diff --git a/packages/@n8n_io/eslint-config/base.js b/packages/@n8n_io/eslint-config/base.js index 8438a54e1b..516db28926 100644 --- a/packages/@n8n_io/eslint-config/base.js +++ b/packages/@n8n_io/eslint-config/base.js @@ -134,6 +134,11 @@ const config = (module.exports = { */ indent: 'off', + /** + * https://eslint.org/docs/latest/rules/no-constant-binary-expression + */ + 'no-constant-binary-expression': 'error', + /** * https://eslint.org/docs/latest/rules/sort-imports */ diff --git a/packages/cli/src/PublicApi/index.ts b/packages/cli/src/PublicApi/index.ts index 32860e930a..585955c401 100644 --- a/packages/cli/src/PublicApi/index.ts +++ b/packages/cli/src/PublicApi/index.ts @@ -147,9 +147,11 @@ export const loadPublicApiVersions = async ( }), ); + const version = versions.pop()?.charAt(1); + return { apiRouters, - apiLatestVersion: Number(versions.pop()?.charAt(1)) ?? 1, + apiLatestVersion: version ? Number(version) : 1, }; }; diff --git a/packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts b/packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts index 88da95cf14..c1acc02cb9 100644 --- a/packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts +++ b/packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts @@ -174,7 +174,9 @@ export class SourceControlGitService { } } await this.setGitUserDetails( - `${user.firstName} ${user.lastName}` ?? SOURCE_CONTROL_DEFAULT_NAME, + user.firstName && user.lastName + ? `${user.firstName} ${user.lastName}` + : SOURCE_CONTROL_DEFAULT_NAME, user.email ?? SOURCE_CONTROL_DEFAULT_EMAIL, ); if (sourceControlPreferences.initRepo) { diff --git a/packages/core/src/WorkflowExecutionMetadata.ts b/packages/core/src/WorkflowExecutionMetadata.ts index a6c186a20d..79c3652753 100644 --- a/packages/core/src/WorkflowExecutionMetadata.ts +++ b/packages/core/src/WorkflowExecutionMetadata.ts @@ -74,7 +74,7 @@ export function getAllWorkflowExecutionMetadata( executionData: IRunExecutionData, ): Record { // Make a copy so it can't be modified directly - return { ...executionData.resultData.metadata } ?? {}; + return executionData.resultData.metadata ? { ...executionData.resultData.metadata } : {}; } export function getWorkflowExecutionMetadata( diff --git a/packages/design-system/src/components/N8nMarkdown/Markdown.vue b/packages/design-system/src/components/N8nMarkdown/Markdown.vue index 42fb662b7f..37cded9d72 100644 --- a/packages/design-system/src/components/N8nMarkdown/Markdown.vue +++ b/packages/design-system/src/components/N8nMarkdown/Markdown.vue @@ -141,7 +141,8 @@ export default defineComponent({ if (tag === 'img' && name === 'src') { if (value.match(fileIdRegex)) { const id = value.split('fileId:')[1]; - return `src=${friendlyAttrValue(imageUrls[id])}` || ''; + const attributeValue = friendlyAttrValue(imageUrls[id]); + return attributeValue ? `src=${attributeValue}` : ''; } // Only allow http requests to supported image files from the `static` directory const isImageFile = value.split('#')[0].match(/\.(jpeg|jpg|gif|png|webp)$/) !== null; diff --git a/packages/editor-ui/src/components/Node/NodeCreator/Renderers/ItemsRenderer.vue b/packages/editor-ui/src/components/Node/NodeCreator/Renderers/ItemsRenderer.vue index 72743a34c0..60f506d4f4 100644 --- a/packages/editor-ui/src/components/Node/NodeCreator/Renderers/ItemsRenderer.vue +++ b/packages/editor-ui/src/components/Node/NodeCreator/Renderers/ItemsRenderer.vue @@ -59,7 +59,7 @@ function wrappedEmit( ) { if (props.disabled) return; - emit((event as 'selected') || 'dragstart' || 'dragend', element, $e); + emit(event, element, $e); } function beforeEnter(el: HTMLElement) { diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index cb4c14a66c..269a6a108c 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -2641,6 +2641,7 @@ export default defineComponent({ } if ( + // eslint-disable-next-line no-constant-binary-expression this.isReadOnlyRoute ?? this.readOnlyEnv ?? this.enterTimer ?? @@ -2674,6 +2675,7 @@ export default defineComponent({ } if ( + // eslint-disable-next-line no-constant-binary-expression this.isReadOnlyRoute ?? this.readOnlyEnv ?? !connection ?? diff --git a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts index f67fd7ac34..71e0431de4 100644 --- a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts +++ b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts @@ -743,7 +743,7 @@ export class ClickUp implements INodeType { ) { if ( additionalFields.stepsStart === undefined || - !additionalFields.stepsEnd === undefined + additionalFields.stepsEnd === undefined ) { throw new NodeOperationError( this.getNode(), diff --git a/packages/nodes-base/nodes/HaloPSA/GenericFunctions.ts b/packages/nodes-base/nodes/HaloPSA/GenericFunctions.ts index 2d000453ec..83717c6527 100644 --- a/packages/nodes-base/nodes/HaloPSA/GenericFunctions.ts +++ b/packages/nodes-base/nodes/HaloPSA/GenericFunctions.ts @@ -96,7 +96,7 @@ export async function haloPSAApiRequest( return result; } catch (error) { const message = (error as JsonObject).message as string; - if (method === 'DELETE' || 'GET' || ('UPDATE' && message)) { + if (method === 'DELETE' || method === 'GET' || (method === 'UPDATE' && message)) { let newErrorMessage; if (message.includes('400')) { console.log(message); diff --git a/packages/nodes-base/nodes/Odoo/GenericFunctions.ts b/packages/nodes-base/nodes/Odoo/GenericFunctions.ts index 8cecc59cc9..3bd8a214d1 100644 --- a/packages/nodes-base/nodes/Odoo/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Odoo/GenericFunctions.ts @@ -235,7 +235,7 @@ export async function odooGet( password, mapOdooResources[resource] || resource, mapOperationToJSONRPC[operation], - [+itemsID] || [], + itemsID ? [+itemsID] : [], fieldsToReturn || [], ], }, @@ -326,7 +326,7 @@ export async function odooUpdate( password, mapOdooResources[resource] || resource, mapOperationToJSONRPC[operation], - [+itemsID] || [], + itemsID ? [+itemsID] : [], fieldsToUpdate, ], }, @@ -369,7 +369,7 @@ export async function odooDelete( password, mapOdooResources[resource] || resource, mapOperationToJSONRPC[operation], - [+itemsID] || [], + itemsID ? [+itemsID] : [], ], }, id: Math.floor(Math.random() * 100), diff --git a/packages/nodes-base/utils/utilities.ts b/packages/nodes-base/utils/utilities.ts index 9fe3be14a6..056e56cbdb 100644 --- a/packages/nodes-base/utils/utilities.ts +++ b/packages/nodes-base/utils/utilities.ts @@ -84,7 +84,7 @@ export function updateDisplayOptions( export function processJsonInput(jsonData: T, inputName?: string) { let values; - const input = `'${inputName}' ` || ''; + const input = inputName ? `'${inputName}' ` : ''; if (typeof jsonData === 'string') { try {