mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
refactor: Add rule no-constant-binary-expression
(no-changelog) (#7670)
https://eslint.org/docs/latest/rules/no-constant-binary-expression
This commit is contained in:
parent
40dc5a0d85
commit
f73a0597ba
|
@ -134,6 +134,11 @@ const config = (module.exports = {
|
||||||
*/
|
*/
|
||||||
indent: 'off',
|
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
|
* https://eslint.org/docs/latest/rules/sort-imports
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -147,9 +147,11 @@ export const loadPublicApiVersions = async (
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const version = versions.pop()?.charAt(1);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
apiRouters,
|
apiRouters,
|
||||||
apiLatestVersion: Number(versions.pop()?.charAt(1)) ?? 1,
|
apiLatestVersion: version ? Number(version) : 1,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,9 @@ export class SourceControlGitService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.setGitUserDetails(
|
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,
|
user.email ?? SOURCE_CONTROL_DEFAULT_EMAIL,
|
||||||
);
|
);
|
||||||
if (sourceControlPreferences.initRepo) {
|
if (sourceControlPreferences.initRepo) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ export function getAllWorkflowExecutionMetadata(
|
||||||
executionData: IRunExecutionData,
|
executionData: IRunExecutionData,
|
||||||
): Record<string, string> {
|
): Record<string, string> {
|
||||||
// Make a copy so it can't be modified directly
|
// Make a copy so it can't be modified directly
|
||||||
return { ...executionData.resultData.metadata } ?? {};
|
return executionData.resultData.metadata ? { ...executionData.resultData.metadata } : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getWorkflowExecutionMetadata(
|
export function getWorkflowExecutionMetadata(
|
||||||
|
|
|
@ -141,7 +141,8 @@ export default defineComponent({
|
||||||
if (tag === 'img' && name === 'src') {
|
if (tag === 'img' && name === 'src') {
|
||||||
if (value.match(fileIdRegex)) {
|
if (value.match(fileIdRegex)) {
|
||||||
const id = value.split('fileId:')[1];
|
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
|
// Only allow http requests to supported image files from the `static` directory
|
||||||
const isImageFile = value.split('#')[0].match(/\.(jpeg|jpg|gif|png|webp)$/) !== null;
|
const isImageFile = value.split('#')[0].match(/\.(jpeg|jpg|gif|png|webp)$/) !== null;
|
||||||
|
|
|
@ -59,7 +59,7 @@ function wrappedEmit(
|
||||||
) {
|
) {
|
||||||
if (props.disabled) return;
|
if (props.disabled) return;
|
||||||
|
|
||||||
emit((event as 'selected') || 'dragstart' || 'dragend', element, $e);
|
emit(event, element, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeEnter(el: HTMLElement) {
|
function beforeEnter(el: HTMLElement) {
|
||||||
|
|
|
@ -2641,6 +2641,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
// eslint-disable-next-line no-constant-binary-expression
|
||||||
this.isReadOnlyRoute ??
|
this.isReadOnlyRoute ??
|
||||||
this.readOnlyEnv ??
|
this.readOnlyEnv ??
|
||||||
this.enterTimer ??
|
this.enterTimer ??
|
||||||
|
@ -2674,6 +2675,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
// eslint-disable-next-line no-constant-binary-expression
|
||||||
this.isReadOnlyRoute ??
|
this.isReadOnlyRoute ??
|
||||||
this.readOnlyEnv ??
|
this.readOnlyEnv ??
|
||||||
!connection ??
|
!connection ??
|
||||||
|
|
|
@ -743,7 +743,7 @@ export class ClickUp implements INodeType {
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
additionalFields.stepsStart === undefined ||
|
additionalFields.stepsStart === undefined ||
|
||||||
!additionalFields.stepsEnd === undefined
|
additionalFields.stepsEnd === undefined
|
||||||
) {
|
) {
|
||||||
throw new NodeOperationError(
|
throw new NodeOperationError(
|
||||||
this.getNode(),
|
this.getNode(),
|
||||||
|
|
|
@ -96,7 +96,7 @@ export async function haloPSAApiRequest(
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = (error as JsonObject).message as string;
|
const message = (error as JsonObject).message as string;
|
||||||
if (method === 'DELETE' || 'GET' || ('UPDATE' && message)) {
|
if (method === 'DELETE' || method === 'GET' || (method === 'UPDATE' && message)) {
|
||||||
let newErrorMessage;
|
let newErrorMessage;
|
||||||
if (message.includes('400')) {
|
if (message.includes('400')) {
|
||||||
console.log(message);
|
console.log(message);
|
||||||
|
|
|
@ -235,7 +235,7 @@ export async function odooGet(
|
||||||
password,
|
password,
|
||||||
mapOdooResources[resource] || resource,
|
mapOdooResources[resource] || resource,
|
||||||
mapOperationToJSONRPC[operation],
|
mapOperationToJSONRPC[operation],
|
||||||
[+itemsID] || [],
|
itemsID ? [+itemsID] : [],
|
||||||
fieldsToReturn || [],
|
fieldsToReturn || [],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -326,7 +326,7 @@ export async function odooUpdate(
|
||||||
password,
|
password,
|
||||||
mapOdooResources[resource] || resource,
|
mapOdooResources[resource] || resource,
|
||||||
mapOperationToJSONRPC[operation],
|
mapOperationToJSONRPC[operation],
|
||||||
[+itemsID] || [],
|
itemsID ? [+itemsID] : [],
|
||||||
fieldsToUpdate,
|
fieldsToUpdate,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -369,7 +369,7 @@ export async function odooDelete(
|
||||||
password,
|
password,
|
||||||
mapOdooResources[resource] || resource,
|
mapOdooResources[resource] || resource,
|
||||||
mapOperationToJSONRPC[operation],
|
mapOperationToJSONRPC[operation],
|
||||||
[+itemsID] || [],
|
itemsID ? [+itemsID] : [],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
id: Math.floor(Math.random() * 100),
|
id: Math.floor(Math.random() * 100),
|
||||||
|
|
|
@ -84,7 +84,7 @@ export function updateDisplayOptions(
|
||||||
|
|
||||||
export function processJsonInput<T>(jsonData: T, inputName?: string) {
|
export function processJsonInput<T>(jsonData: T, inputName?: string) {
|
||||||
let values;
|
let values;
|
||||||
const input = `'${inputName}' ` || '';
|
const input = inputName ? `'${inputName}' ` : '';
|
||||||
|
|
||||||
if (typeof jsonData === 'string') {
|
if (typeof jsonData === 'string') {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue