mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -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',
|
||||
|
||||
/**
|
||||
* https://eslint.org/docs/latest/rules/no-constant-binary-expression
|
||||
*/
|
||||
'no-constant-binary-expression': 'error',
|
||||
|
||||
/**
|
||||
* https://eslint.org/docs/latest/rules/sort-imports
|
||||
*/
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 ??
|
||||
|
|
|
@ -743,7 +743,7 @@ export class ClickUp implements INodeType {
|
|||
) {
|
||||
if (
|
||||
additionalFields.stepsStart === undefined ||
|
||||
!additionalFields.stepsEnd === undefined
|
||||
additionalFields.stepsEnd === undefined
|
||||
) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue