refactor: Clear unused ESLint directives from FE packages (no-changelog) (#6811)

This commit is contained in:
Iván Ovejero 2023-08-01 13:47:55 +02:00 committed by GitHub
parent dec19585bc
commit 2df0c2c473
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 108 additions and 146 deletions

View file

@ -22,8 +22,8 @@
"build:storybook": "storybook build",
"storybook": "storybook dev -p 6006",
"format": "prettier --write . --ignore-path ../../.prettierignore",
"lint": "eslint --quiet --ext .js,.ts,.vue src",
"lintfix": "eslint --ext .js,.ts,.vue src --fix"
"lint": "eslint src --ext .js,.ts,.vue --quiet --report-unused-disable-directives",
"lintfix": "eslint src --ext .js,.ts,.vue --fix --report-unused-disable-directives"
},
"peerDependencies": {
"@fortawesome/fontawesome-svg-core": "1.x",

View file

@ -40,14 +40,12 @@ export default defineComponent({
classes() {
const applied = [];
if (this.align) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
applied.push(`align-${this.align}`);
}
if (this.color) {
applied.push(this.color);
}
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
applied.push(`size-${this.size}`);
applied.push(this.bold ? 'bold' : 'regular');

View file

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
import type { StoryFn } from '@storybook/vue3';
import N8nRecycleScroller from './RecycleScroller.vue';
import type { ComponentInstance } from 'vue';

View file

@ -12,7 +12,6 @@
</template>
<script lang="ts">
/* eslint-disable @typescript-eslint/unbound-method */
import type { PropType } from 'vue';
import { defineComponent } from 'vue';

View file

@ -50,7 +50,6 @@ export default defineComponent({
classes() {
const applied = [];
if (this.align) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
applied.push(`align-${this.align}`);
}
if (this.color) {
@ -61,7 +60,6 @@ export default defineComponent({
applied.push('compact');
}
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
applied.push(`size-${this.size}`);
applied.push(this.bold ? 'bold' : 'regular');

View file

@ -133,7 +133,6 @@ export default defineComponent({
return user.email;
}
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
return `${user.fullName} (${user.email})`;
},
},

View file

@ -70,7 +70,7 @@ export default defineComponent({
},
beforeUnmount() {
if (this.enabled) {
this.observer?.disconnect(); // eslint-disable-line
this.observer?.disconnect();
}
},
});

View file

@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Get a deeply nested value based on a given path string

View file

@ -18,8 +18,8 @@
"build": "cross-env VUE_APP_PUBLIC_PATH=\"/{{BASE_PATH}}/\" NODE_OPTIONS=\"--max-old-space-size=8192\" vite build",
"typecheck": "vue-tsc --emitDeclarationOnly",
"dev": "pnpm serve",
"lint": "eslint --quiet --ext .js,.ts,.vue src",
"lintfix": "eslint --ext .js,.ts,.vue src --fix",
"lint": "eslint src --ext .js,.ts,.vue --quiet --report-unused-disable-directives",
"lintfix": "eslint src --ext .js,.ts,.vue --fix --report-unused-disable-directives",
"format": "prettier --write . --ignore-path ../../.prettierignore",
"serve": "cross-env VUE_APP_URL_BASE_API=http://localhost:5678/ vite --host 0.0.0.0 --port 8080 dev",
"test": "vitest run --coverage",

View file

@ -140,7 +140,7 @@ export default defineComponent({
},
logHiringBanner() {
if (this.settingsStore.isHiringBannerEnabled && !this.isDemoMode) {
console.log(HIRING_BANNER); // eslint-disable-line no-console
console.log(HIRING_BANNER);
}
},
async initialize(): Promise<void> {

View file

@ -1,5 +1,5 @@
import type { CREDENTIAL_EDIT_MODAL_KEY } from './constants';
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { IMenuItem } from 'n8n-design-system';
import type {
GenericValue,

View file

@ -1,6 +1,5 @@
import type { Registry } from 'miragejs';
// eslint-disable-next-line import/no-unresolved
import type Schema from 'miragejs/orm/schema';
import type { models } from './models';

View file

@ -69,7 +69,7 @@ export default defineComponent({
return 'SM';
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value(): any | undefined {
if (this.valueXS !== undefined && this.width < BREAKPOINT_SM) {
return this.valueXS;

View file

@ -671,7 +671,7 @@ export default defineComponent({
};
this.hasUnsavedChanges = true;
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onDataChange({ name, value }: { name: string; value: any }) {
// skip update if new value matches the current
if (this.credentialData[name] === value) return;

View file

@ -65,7 +65,7 @@ const vModel = reactive(
},
set(value) {
// TODO: find out what exactly is typechecker complaining about
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
filter[key] = value;
emit('filterChanged', filter);

View file

@ -622,8 +622,8 @@ export default defineComponent({
console.error(
this.$locale.baseText('nodeView.thereWasAProblemLoadingTheNodeParametersOfNode') +
`: "${node.name}"`,
); // eslint-disable-line no-console
console.error(e); // eslint-disable-line no-console
);
console.error(e);
}
node.parameters = nodeParameters !== null ? nodeParameters : {};

View file

@ -147,7 +147,6 @@ export default defineComponent({
},
itemSelected(eventData: IVariableItemSelected) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this.$refs.inputFieldExpression as any).itemSelected(eventData);
void this.$externalHooks().run('expressionEdit.itemSelected', {
parameter: this.parameter,
@ -225,7 +224,6 @@ export default defineComponent({
this.latestValue = this.modelValue;
const resolvedExpressionValue =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this.$refs.expressionResult && (this.$refs.expressionResult as any).getValue()) ||
undefined;
void this.$externalHooks().run('expressionEdit.dialogVisibleChanged', {

View file

@ -77,8 +77,7 @@ export default defineComponent({
cursor +=
segment.kind === 'plaintext'
? segment.plaintext.length
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
segment.resolved
: segment.resolved
? (segment.resolved as any).toString().length
: 0;

View file

@ -118,8 +118,7 @@ export default defineComponent({
cursor +=
segment.kind === 'plaintext'
? segment.plaintext.length
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
segment.resolved
: segment.resolved
? (segment.resolved as any).toString().length
: 0;
segment.to = cursor;

View file

@ -100,7 +100,6 @@ const draggableStyle = computed<{ top: string; left: string }>(() => ({
const isCommunityNode = computed<boolean>(() => isCommunityPackageName(props.nodeType.name));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const displayName = computed<any>(() => {
const displayName = props.nodeType.displayName.trimEnd();

View file

@ -472,7 +472,6 @@ export default defineComponent({
try {
parameters = JSON.parse(parameters) as {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
};

View file

@ -495,7 +495,6 @@ export default defineComponent({
{
text: 'Today', // TODO
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onClick(picker: any) {
picker.$emit('pick', new Date());
},
@ -503,7 +502,6 @@ export default defineComponent({
{
text: 'Yesterday', // TODO
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onClick(picker: any) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
@ -513,7 +511,6 @@ export default defineComponent({
{
text: 'A week ago', // TODO
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onClick(picker: any) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);

View file

@ -156,7 +156,6 @@
</template>
<script lang="ts">
/* eslint-disable prefer-spread */
import { defineComponent } from 'vue';
import type { PropType } from 'vue';
import { mapStores } from 'pinia';

View file

@ -619,105 +619,89 @@ export default defineComponent({
},
async loadSaveDataErrorExecutionOptions() {
this.saveDataErrorExecutionOptions.length = 0;
this.saveDataErrorExecutionOptions.push.apply(
// eslint-disable-line no-useless-call
this.saveDataErrorExecutionOptions,
[
{
key: 'DEFAULT',
value: this.$locale.baseText(
'workflowSettings.saveDataErrorExecutionOptions.defaultSave',
{
interpolate: {
defaultValue:
this.defaultValues.saveDataErrorExecution === 'all'
? this.$locale.baseText('workflowSettings.saveDataErrorExecutionOptions.save')
: this.$locale.baseText(
'workflowSettings.saveDataErrorExecutionOptions.doNotSave',
),
},
this.saveDataErrorExecutionOptions.push.apply(this.saveDataErrorExecutionOptions, [
{
key: 'DEFAULT',
value: this.$locale.baseText(
'workflowSettings.saveDataErrorExecutionOptions.defaultSave',
{
interpolate: {
defaultValue:
this.defaultValues.saveDataErrorExecution === 'all'
? this.$locale.baseText('workflowSettings.saveDataErrorExecutionOptions.save')
: this.$locale.baseText(
'workflowSettings.saveDataErrorExecutionOptions.doNotSave',
),
},
),
},
{
key: 'all',
value: this.$locale.baseText('workflowSettings.saveDataErrorExecutionOptions.save'),
},
{
key: 'none',
value: this.$locale.baseText(
'workflowSettings.saveDataErrorExecutionOptions.doNotSave',
),
},
],
);
},
),
},
{
key: 'all',
value: this.$locale.baseText('workflowSettings.saveDataErrorExecutionOptions.save'),
},
{
key: 'none',
value: this.$locale.baseText('workflowSettings.saveDataErrorExecutionOptions.doNotSave'),
},
]);
},
async loadSaveDataSuccessExecutionOptions() {
this.saveDataSuccessExecutionOptions.length = 0;
this.saveDataSuccessExecutionOptions.push.apply(
// eslint-disable-line no-useless-call
this.saveDataSuccessExecutionOptions,
[
{
key: 'DEFAULT',
value: this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.defaultSave',
{
interpolate: {
defaultValue:
this.defaultValues.saveDataSuccessExecution === 'all'
? this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.save',
)
: this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.doNotSave',
),
},
this.saveDataSuccessExecutionOptions.push.apply(this.saveDataSuccessExecutionOptions, [
{
key: 'DEFAULT',
value: this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.defaultSave',
{
interpolate: {
defaultValue:
this.defaultValues.saveDataSuccessExecution === 'all'
? this.$locale.baseText('workflowSettings.saveDataSuccessExecutionOptions.save')
: this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.doNotSave',
),
},
),
},
{
key: 'all',
value: this.$locale.baseText('workflowSettings.saveDataSuccessExecutionOptions.save'),
},
{
key: 'none',
value: this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.doNotSave',
),
},
],
);
},
),
},
{
key: 'all',
value: this.$locale.baseText('workflowSettings.saveDataSuccessExecutionOptions.save'),
},
{
key: 'none',
value: this.$locale.baseText(
'workflowSettings.saveDataSuccessExecutionOptions.doNotSave',
),
},
]);
},
async loadSaveExecutionProgressOptions() {
this.saveExecutionProgressOptions.length = 0;
this.saveExecutionProgressOptions.push.apply(
// eslint-disable-line no-useless-call
this.saveExecutionProgressOptions,
[
{
key: 'DEFAULT',
value: this.$locale.baseText(
'workflowSettings.saveExecutionProgressOptions.defaultSave',
{
interpolate: {
defaultValue: this.defaultValues.saveExecutionProgress
? this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.yes')
: this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.no'),
},
this.saveExecutionProgressOptions.push.apply(this.saveExecutionProgressOptions, [
{
key: 'DEFAULT',
value: this.$locale.baseText(
'workflowSettings.saveExecutionProgressOptions.defaultSave',
{
interpolate: {
defaultValue: this.defaultValues.saveExecutionProgress
? this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.yes')
: this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.no'),
},
),
},
{
key: true,
value: this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.yes'),
},
{
key: false,
value: this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.no'),
},
],
);
},
),
},
{
key: true,
value: this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.yes'),
},
{
key: false,
value: this.$locale.baseText('workflowSettings.saveExecutionProgressOptions.no'),
},
]);
},
async loadSaveManualOptions() {
this.saveManualOptions.length = 0;

View file

@ -53,8 +53,8 @@ if (!import.meta.env.PROD) {
// not do anything about it anyway
return;
}
console.error('error caught in main.ts'); // eslint-disable-line no-console
console.error(message); // eslint-disable-line no-console
console.error(error); // eslint-disable-line no-console
console.error('error caught in main.ts');
console.error(message);
console.error(error);
};
}

View file

@ -8,7 +8,6 @@ export const debounceHelper = defineComponent({
};
},
methods: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async callDebounced(...inputParameters: any[]): Promise<void> {
const functionName = inputParameters.shift() as string;
const { trailing, debounceTime } = inputParameters.shift();

View file

@ -13,7 +13,6 @@ export const genericHelpers = defineComponent({
},
data() {
return {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
loadingService: null as any | null,
};
},

View file

@ -198,7 +198,7 @@ export const pushConnection = defineComponent({
if (receivedData.type === 'sendConsoleMessage') {
const pushData = receivedData.data;
console.log(pushData.source, ...pushData.messages); // eslint-disable-line no-console
console.log(pushData.source, ...pushData.messages);
return true;
}

View file

@ -753,7 +753,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
][sourceData.index]) {
for (propertyName of checkProperties) {
if (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(existingConnection as any)[propertyName] !== (destinationData as any)[propertyName]
) {
continue connectionLoop;

View file

@ -202,7 +202,7 @@ function getValue<T extends object>(obj: T, prop: string): unknown {
}
const segments = prop.split('.');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let result: any = obj;
let i = 0;
while (result && i < segments.length) {

View file

@ -361,8 +361,8 @@ export default defineComponent({
};
},
errorCaptured: (err, vm, info) => {
console.error('errorCaptured'); // eslint-disable-line no-console
console.error(err); // eslint-disable-line no-console
console.error('errorCaptured');
console.error(err);
},
watch: {
// Listen to route changes and load the workflow accordingly
@ -812,8 +812,8 @@ export default defineComponent({
if (!nodeErrorFound && data.data.resultData.error.stack) {
// Display some more information for now in console to make debugging easier
console.error(`Execution ${executionId} error:`); // eslint-disable-line no-console
console.error(data.data.resultData.error.stack); // eslint-disable-line no-console
console.error(`Execution ${executionId} error:`);
console.error(data.data.resultData.error.stack);
this.showMessage({
title: this.$locale.baseText('nodeView.showError.workflowError'),
message: data.data.resultData.error.message,
@ -1569,7 +1569,6 @@ export default defineComponent({
source: string,
importTags = true,
): Promise<void> {
// eslint-disable-line @typescript-eslint/default-param-last
// If it is JSON check if it looks on the first look like data we can use
if (!workflowData.hasOwnProperty('nodes') || !workflowData.hasOwnProperty('connections')) {
return;
@ -2141,7 +2140,7 @@ export default defineComponent({
eventSource: NODE_CREATOR_OPEN_SOURCES.NODE_CONNECTION_DROP,
});
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onInterceptBeforeDrop(info: BeforeDropParams) {
@ -2163,7 +2162,7 @@ export default defineComponent({
return true;
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
return true;
}
},
@ -2233,7 +2232,7 @@ export default defineComponent({
}, 0);
}
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onDragMove() {
@ -2273,7 +2272,7 @@ export default defineComponent({
}
}, 150);
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onConnectionMouseOut(connection: Connection) {
@ -2302,7 +2301,7 @@ export default defineComponent({
}
}, 500);
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onConnectionMoved(info: ConnectionMovedParams) {
@ -2331,7 +2330,7 @@ export default defineComponent({
this.__removeConnection(connectionInfo, false);
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onEndpointMouseOver(endpoint: Endpoint, mouse) {
@ -2377,7 +2376,7 @@ export default defineComponent({
this.historyStore.pushCommandToUndo(removeCommand);
}
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onConnectionDrag(connection: Connection) {
@ -2449,7 +2448,7 @@ export default defineComponent({
window.addEventListener('mouseup', onMouseUp);
window.addEventListener('touchend', onMouseMove);
} catch (e) {
console.error(e); // eslint-disable-line no-console
console.error(e);
}
},
onConnectionDragAbortDetached(connection: Connection) {
@ -3284,8 +3283,8 @@ export default defineComponent({
console.error(
this.$locale.baseText('nodeView.thereWasAProblemLoadingTheNodeParametersOfNode') +
`: "${node.name}"`,
); // eslint-disable-line no-console
console.error(e); // eslint-disable-line no-console
);
console.error(e);
}
node.parameters = nodeParameters !== null ? nodeParameters : {};