mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat: add vue 3 eslint rules and fix issues
This commit is contained in:
parent
34fbff0828
commit
e0276b12ef
|
@ -4,7 +4,7 @@
|
|||
module.exports = {
|
||||
plugins: ['vue'],
|
||||
|
||||
extends: ['plugin:vue/essential', '@vue/typescript', './base'],
|
||||
extends: ['plugin:vue/vue3-essential', '@vue/typescript', './base'],
|
||||
|
||||
env: {
|
||||
browser: true,
|
||||
|
@ -37,6 +37,12 @@ module.exports = {
|
|||
'vue/no-unused-components': 'error',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
|
||||
// TODO: fix these
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
|
||||
// TODO: remove these
|
||||
'vue/no-mutating-props': 'warn',
|
||||
'vue/no-side-effects-in-computed-properties': 'warn',
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
:placement="placement"
|
||||
:size="size"
|
||||
trigger="click"
|
||||
@click.native.stop
|
||||
@click.stop
|
||||
@command="onCommand"
|
||||
@visible-change="onVisibleChange"
|
||||
>
|
||||
|
|
|
@ -164,7 +164,7 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
function onUpdateItemSize(item: { [key: string]: string }) {
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
const itemId = item[props.itemKey];
|
||||
const itemRef = itemRefs.value[itemId] as HTMLElement;
|
||||
const previousSize = itemSizeCache.value[itemId];
|
||||
|
@ -186,7 +186,7 @@ export default defineComponent({
|
|||
function onWindowResize() {
|
||||
if (wrapperRef.value) {
|
||||
wrapperHeight.value = wrapperRef.value.offsetHeight;
|
||||
nextTick(() => {
|
||||
void nextTick(() => {
|
||||
updateItemSizeCache(visibleItems.value);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ export default defineComponent({
|
|||
this.canScrollRight = scrollWidth - width > this.scrollPosition;
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
unmounted() {
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect();
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export default defineComponent({
|
|||
observer.observe(this.$refs.root as HTMLDivElement);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
if (this.enabled) {
|
||||
this.observer?.disconnect(); // eslint-disable-line
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export default defineComponent({
|
|||
this.observer.observe(body, { attributes: true });
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
unmounted() {
|
||||
if (this.observer) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export default defineComponent({
|
|||
this.observer.observe(body, { attributes: true });
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
unmounted() {
|
||||
if (this.observer) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ export default defineComponent({
|
|||
this.observer.observe(body, { attributes: true });
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
unmounted() {
|
||||
if (this.observer) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import { defineComponent } from 'vue';
|
||||
import { copyPaste } from '@/mixins/copyPaste';
|
||||
import { useToast } from '@/composables';
|
||||
import { i18n } from '@/plugins/i18n';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [copyPaste],
|
||||
|
@ -36,13 +37,13 @@ export default defineComponent({
|
|||
copyButtonText: {
|
||||
type: String,
|
||||
default(): string {
|
||||
return this.$locale.baseText('generic.copy');
|
||||
return i18n.baseText('generic.copy');
|
||||
},
|
||||
},
|
||||
toastTitle: {
|
||||
type: String,
|
||||
default(): string {
|
||||
return this.$locale.baseText('generic.copiedToClipboard');
|
||||
return i18n.baseText('generic.copiedToClipboard');
|
||||
},
|
||||
},
|
||||
toastMessage: {
|
||||
|
|
|
@ -349,7 +349,9 @@ export default defineComponent({
|
|||
async startAutoRefreshInterval() {
|
||||
if (this.autoRefresh) {
|
||||
await this.loadAutoRefresh();
|
||||
this.autoRefreshTimeout = setTimeout(() => this.startAutoRefreshInterval(), 4000);
|
||||
this.autoRefreshTimeout = setTimeout(() => {
|
||||
void this.startAutoRefreshInterval();
|
||||
}, 4000);
|
||||
}
|
||||
},
|
||||
stopAutoRefreshInterval() {
|
||||
|
@ -363,13 +365,13 @@ export default defineComponent({
|
|||
this.uiStore.executionSidebarAutoRefresh = this.autoRefresh;
|
||||
|
||||
this.stopAutoRefreshInterval(); // Clear any previously existing intervals (if any - there shouldn't)
|
||||
this.startAutoRefreshInterval();
|
||||
void this.startAutoRefreshInterval();
|
||||
},
|
||||
onDocumentVisibilityChange() {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
this.stopAutoRefreshInterval();
|
||||
void this.stopAutoRefreshInterval();
|
||||
} else {
|
||||
this.startAutoRefreshInterval();
|
||||
void this.startAutoRefreshInterval();
|
||||
}
|
||||
},
|
||||
async loadAutoRefresh(): Promise<void> {
|
||||
|
@ -449,7 +451,7 @@ export default defineComponent({
|
|||
return [];
|
||||
}
|
||||
try {
|
||||
return await this.workflowsStore.loadCurrentWorkflowExecutions(this.requestFilter);
|
||||
return this.workflowsStore.loadCurrentWorkflowExecutions(this.requestFilter);
|
||||
} catch (error) {
|
||||
if (error.errorCode === NO_NETWORK_ERROR_CODE) {
|
||||
this.showMessage(
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineAsyncComponent, defineComponent } from 'vue';
|
||||
import type { Component, PropType } from 'vue';
|
||||
import type { PropType } from 'vue';
|
||||
import type { IUpdateInformation } from '@/Interface';
|
||||
|
||||
import type {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, getCurrentInstance, onMounted, defineComponent, h } from 'vue';
|
||||
import type { VNode, PropType } from 'vue';
|
||||
import type { PropType } from 'vue';
|
||||
import type {
|
||||
INodeCreateElement,
|
||||
ActionTypeDescription,
|
||||
|
|
|
@ -418,7 +418,7 @@ export default defineComponent({
|
|||
this.avgOutputRowHeight = 0;
|
||||
this.avgInputRowHeight = 0;
|
||||
|
||||
setTimeout(this.ndvStore.setNDVSessionId, 0);
|
||||
setTimeout(() => this.ndvStore.setNDVSessionId(), 0);
|
||||
void this.$externalHooks().run('dataDisplay.nodeTypeChanged', {
|
||||
nodeSubtitle: this.getNodeSubtitle(node, this.activeNodeType, this.getCurrentWorkflow()),
|
||||
});
|
||||
|
|
|
@ -261,7 +261,7 @@ export default defineComponent({
|
|||
}, 0);
|
||||
},
|
||||
loading() {
|
||||
setTimeout(this.onResultsEnd, 0); // in case of filtering
|
||||
setTimeout(() => this.onResultsEnd(), 0); // in case of filtering
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -449,11 +449,11 @@
|
|||
<el-pagination
|
||||
background
|
||||
:hide-on-single-page="true"
|
||||
:current-page.sync="currentPage"
|
||||
:current-page="currentPage"
|
||||
:pager-count="5"
|
||||
:page-size="pageSize"
|
||||
layout="prev, pager, next"
|
||||
@current-change="onCurrentPageChange"
|
||||
@update:current-page="onCurrentPageChange"
|
||||
:total="dataCount"
|
||||
>
|
||||
</el-pagination>
|
||||
|
@ -1134,7 +1134,8 @@ export default defineComponent({
|
|||
unlinkRun() {
|
||||
this.$emit('unlinkRun');
|
||||
},
|
||||
onCurrentPageChange() {
|
||||
onCurrentPageChange(value) {
|
||||
this.currentPage = value;
|
||||
this.$telemetry.track('User changed ndv page', {
|
||||
node_type: this.activeNode?.type,
|
||||
workflow_id: this.workflowsStore.workflowId,
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
:data="jsonData"
|
||||
:deep="10"
|
||||
:showLength="true"
|
||||
:selected-value.sync="selectedJsonPath"
|
||||
:selectedValue="selectedJsonPath"
|
||||
rootPath=""
|
||||
selectableType="single"
|
||||
class="json-data"
|
||||
@update:selectedValue="selectedJsonPath = $event"
|
||||
>
|
||||
<template #renderNodeKey="{ node }">
|
||||
<span
|
||||
|
|
|
@ -24,8 +24,8 @@ import {
|
|||
highlightActiveLineGutter,
|
||||
keymap,
|
||||
lineNumbers,
|
||||
ViewUpdate,
|
||||
} from '@codemirror/view';
|
||||
import type { ViewUpdate } from '@codemirror/view';
|
||||
import {
|
||||
MSSQL,
|
||||
MySQL,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
v-touch:end="touchEnd"
|
||||
>
|
||||
<n8n-sticky
|
||||
:content.sync="node.parameters.content"
|
||||
:content="node.parameters.content"
|
||||
:height="node.parameters.height"
|
||||
:width="node.parameters.width"
|
||||
:scale="nodeViewScale"
|
||||
|
@ -190,6 +190,7 @@ export default defineComponent({
|
|||
}
|
||||
},
|
||||
onInputChange(content: string) {
|
||||
this.node.parameters.content = content;
|
||||
this.setParameters({ content });
|
||||
},
|
||||
onResizeStart() {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
declare module 'vue-json-pretty' {
|
||||
import { Component } from 'vue';
|
||||
const vueJsonPretty: Component;
|
||||
export default vueJsonPretty;
|
||||
}
|
Loading…
Reference in a new issue