Skip to content

Commit

Permalink
refactor(editor): Enable @typescript-eslint/no-base-to-string lint ru…
Browse files Browse the repository at this point in the history
…le, fix errors (no-changelog) (#9783)
  • Loading branch information
elsmr authored Jun 18, 2024
1 parent e3cbce5 commit 7e44cd7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
1 change: 0 additions & 1 deletion packages/editor-ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module.exports = {
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-base-to-string': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,9 @@ export default defineComponent({
this.testedSuccessfully = false;
}
const usesExternalSecrets = Object.entries(credentialDetails.data || {}).some(([, value]) =>
/=.*\{\{[^}]*\$secrets\.[^}]+}}.*/.test(`${value}`),
const usesExternalSecrets = Object.entries(credentialDetails.data || {}).some(
([, value]) =>
typeof value !== 'object' && /=.*\{\{[^}]*\$secrets\.[^}]+}}.*/.test(`${value}`),
);
const trackProperties: ITelemetryTrackProperties = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ const outputTypeParsers: {
} else if (content.id.includes('SystemMessage')) {
message = `**System Message:** ${message}`;
}
if (execData.action && execData.action !== 'getMessages') {
if (
execData.action &&
typeof execData.action !== 'object' &&
execData.action !== 'getMessages'
) {
message = `## Action: ${execData.action}\n\n${message}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export default defineComponent({
onModalClose() {
if (!this.hasOnceBeenSaved) {
this.workflowsStore.removeNode(this.node);
if (this.nodeParameters.id) {
if (this.nodeParameters.id && typeof this.nodeParameters.id !== 'object') {
this.logStreamingStore.removeDestination(this.nodeParameters.id.toString());
}
}
Expand All @@ -480,7 +480,9 @@ export default defineComponent({
this.uiStore.stateIsDirty = false;
const destinationType = (
this.nodeParameters.__type ? `${this.nodeParameters.__type}` : 'unknown'
this.nodeParameters.__type && typeof this.nodeParameters.__type !== 'object'
? `${this.nodeParameters.__type}`
: 'unknown'
)
.replace('$$MessageEventBusDestination', '')
.toLowerCase();
Expand Down
3 changes: 2 additions & 1 deletion packages/editor-ui/src/composables/useRunWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
if (!showForm) continue;

const { webhookSuffix } = (node.parameters.options ?? {}) as IDataObject;
const suffix = webhookSuffix ? `/${webhookSuffix}` : '';
const suffix =
webhookSuffix && typeof webhookSuffix !== 'object' ? `/${webhookSuffix}` : '';
testUrl = `${rootStore.getFormWaitingUrl}/${runWorkflowApiResponse.executionId}${suffix}`;
}

Expand Down
4 changes: 3 additions & 1 deletion packages/editor-ui/src/utils/mappingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export function getMappedResult(
} else if (typeof prevValue === 'string' && isExpression(prevValue) && prevValue.length > 1) {
return `${prevValue} ${newParamValue}`;
} else if (prevValue && ['string', 'json'].includes(parameter.type)) {
return prevValue === '=' ? `=${newParamValue}` : `=${prevValue} ${newParamValue}`;
return prevValue === '=' || typeof prevValue === 'object'
? `=${newParamValue}`
: `=${prevValue} ${newParamValue}`;
}

return `=${newParamValue}`;
Expand Down

0 comments on commit 7e44cd7

Please sign in to comment.