1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-09-19 17:07:18 +03: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:
Iván Ovejero 2023-11-09 17:50:59 +01:00 committed by GitHub
parent 40dc5a0d85
commit f73a0597ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 23 additions and 11 deletions

View File

@ -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
*/

View File

@ -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,
};
};

View File

@ -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) {

View File

@ -74,7 +74,7 @@ export function getAllWorkflowExecutionMetadata(
executionData: IRunExecutionData,
): Record<string, string> {
// Make a copy so it can't be modified directly
return { ...executionData.resultData.metadata } ?? {};
return executionData.resultData.metadata ? { ...executionData.resultData.metadata } : {};
}
export function getWorkflowExecutionMetadata(

View File

@ -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;

View File

@ -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) {

View File

@ -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 ??

View File

@ -743,7 +743,7 @@ export class ClickUp implements INodeType {
) {
if (
additionalFields.stepsStart === undefined ||
!additionalFields.stepsEnd === undefined
additionalFields.stepsEnd === undefined
) {
throw new NodeOperationError(
this.getNode(),

View File

@ -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);

View File

@ -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),

View File

@ -84,7 +84,7 @@ export function updateDisplayOptions(
export function processJsonInput<T>(jsonData: T, inputName?: string) {
let values;
const input = `'${inputName}' ` || '';
const input = inputName ? `'${inputName}' ` : '';
if (typeof jsonData === 'string') {
try {