ci: Fix lint setup in chat package (no-changelog) (#8275)

This commit is contained in:
Iván Ovejero 2024-01-09 16:37:05 +01:00 committed by GitHub
parent d1ca368c7d
commit d5dcbbf8e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 17 additions and 67 deletions

View file

@ -7,45 +7,4 @@ module.exports = {
extends: ['@n8n_io/eslint-config/frontend'], extends: ['@n8n_io/eslint-config/frontend'],
...sharedOptions(__dirname, 'frontend'), ...sharedOptions(__dirname, 'frontend'),
rules: {
'n8n-local-rules/dangerously-use-html-string-missing': 'off',
// TODO: Remove these
'id-denylist': 'warn',
'import/extensions': 'warn',
'import/no-default-export': 'warn',
'import/order': 'off',
'import/no-cycle': 'warn',
'import/no-duplicates': 'warn',
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/dot-notation': 'warn',
'@typescript-eslint/lines-between-class-members': 'warn',
'@typescript-eslint/member-delimiter-style': 'warn',
'@typescript-eslint/naming-convention': 'warn',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-for-in-array': 'warn',
'@typescript-eslint/no-loop-func': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-shadow': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/unbound-method': 'warn',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-base-to-string': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
},
}; };

View file

@ -14,7 +14,8 @@
"test:dev": "vitest", "test:dev": "vitest",
"test": "vitest run --coverage", "test": "vitest run --coverage",
"type-check": "vue-tsc --noEmit -p tsconfig.json --composite false", "type-check": "vue-tsc --noEmit -p tsconfig.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --ignore-path .eslintignore", "lint": "eslint . --ext .js,.ts,.vue --quiet",
"lintfix": "eslint . --ext .js,.ts,.vue --fix",
"format": "prettier --write src/", "format": "prettier --write src/",
"storybook": "storybook dev -p 6006 --no-open", "storybook": "storybook dev -p 6006 --no-open",
"build:storybook": "storybook build", "build:storybook": "storybook build",

View file

@ -1,9 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Chat, ChatWindow } from '@n8n/chat/components';
import { computed, onMounted } from 'vue'; import { computed, onMounted } from 'vue';
import hljs from 'highlight.js/lib/core'; import hljs from 'highlight.js/lib/core';
import hljsXML from 'highlight.js/lib/languages/xml'; import hljsXML from 'highlight.js/lib/languages/xml';
import hljsJavascript from 'highlight.js/lib/languages/javascript'; import hljsJavascript from 'highlight.js/lib/languages/javascript';
import { Chat, ChatWindow } from '@n8n/chat/components';
import { useOptions } from '@n8n/chat/composables'; import { useOptions } from '@n8n/chat/composables';
defineProps({}); defineProps({});

View file

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import type { StoryObj } from '@storybook/vue3'; import type { StoryObj } from '@storybook/vue3';
import { onMounted } from 'vue';
import type { ChatOptions } from '@n8n/chat/types'; import type { ChatOptions } from '@n8n/chat/types';
import { createChat } from '@n8n/chat/index'; import { createChat } from '@n8n/chat/index';
import { onMounted } from 'vue';
const webhookUrl = 'http://localhost:5678/webhook/f406671e-c954-4691-b39a-66c90aa2f103/chat'; const webhookUrl = 'http://localhost:5678/webhook/f406671e-c954-4691-b39a-66c90aa2f103/chat';

View file

@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, onMounted } from 'vue';
import Layout from '@n8n/chat/components/Layout.vue'; import Layout from '@n8n/chat/components/Layout.vue';
import GetStarted from '@n8n/chat/components/GetStarted.vue'; import GetStarted from '@n8n/chat/components/GetStarted.vue';
import GetStartedFooter from '@n8n/chat/components/GetStartedFooter.vue'; import GetStartedFooter from '@n8n/chat/components/GetStartedFooter.vue';
import MessagesList from '@n8n/chat/components/MessagesList.vue'; import MessagesList from '@n8n/chat/components/MessagesList.vue';
import Input from '@n8n/chat/components/Input.vue'; import Input from '@n8n/chat/components/Input.vue';
import { nextTick, onMounted } from 'vue';
import { useI18n, useChat, useOptions } from '@n8n/chat/composables'; import { useI18n, useChat, useOptions } from '@n8n/chat/composables';
import { chatEventBus } from '@n8n/chat/event-buses'; import { chatEventBus } from '@n8n/chat/event-buses';

View file

@ -3,8 +3,8 @@
import IconChat from 'virtual:icons/mdi/chat'; import IconChat from 'virtual:icons/mdi/chat';
// eslint-disable-next-line import/no-unresolved // eslint-disable-next-line import/no-unresolved
import IconChevronDown from 'virtual:icons/mdi/chevron-down'; import IconChevronDown from 'virtual:icons/mdi/chevron-down';
import Chat from '@n8n/chat/components/Chat.vue';
import { nextTick, ref } from 'vue'; import { nextTick, ref } from 'vue';
import Chat from '@n8n/chat/components/Chat.vue';
import { chatEventBus } from '@n8n/chat/event-buses'; import { chatEventBus } from '@n8n/chat/event-buses';
const isOpen = ref(false); const isOpen = ref(false);
@ -23,7 +23,7 @@ function toggle() {
<template> <template>
<div class="chat-window-wrapper"> <div class="chat-window-wrapper">
<Transition name="chat-window-transition"> <Transition name="chat-window-transition">
<div class="chat-window" v-show="isOpen"> <div v-show="isOpen" class="chat-window">
<Chat /> <Chat />
</div> </div>
</Transition> </Transition>

View file

@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
// eslint-disable-next-line import/no-unresolved // eslint-disable-next-line import/no-unresolved
import IconSend from 'virtual:icons/mdi/send'; import IconSend from 'virtual:icons/mdi/send';
import { useI18n, useChat } from '@n8n/chat/composables';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n, useChat } from '@n8n/chat/composables';
const chatStore = useChat(); const chatStore = useChat();
const { waitingForResponse } = chatStore; const { waitingForResponse } = chatStore;

View file

@ -26,7 +26,7 @@ onBeforeUnmount(() => {
<div v-if="$slots.header" class="chat-header"> <div v-if="$slots.header" class="chat-header">
<slot name="header" /> <slot name="header" />
</div> </div>
<div v-if="$slots.default" class="chat-body" ref="chatBodyRef"> <div v-if="$slots.default" ref="chatBodyRef" class="chat-body">
<slot /> <slot />
</div> </div>
<div v-if="$slots.footer" class="chat-footer"> <div v-if="$slots.footer" class="chat-footer">

View file

@ -1,10 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import type { ChatMessage } from '@n8n/chat/types';
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import { computed, toRefs } from 'vue'; import { computed, toRefs } from 'vue';
import VueMarkdown from 'vue-markdown-render'; import VueMarkdown from 'vue-markdown-render';
import hljs from 'highlight.js/lib/core'; import hljs from 'highlight.js/lib/core';
import type { ChatMessage } from '@n8n/chat/types';
const props = defineProps({ const props = defineProps({
message: { message: {
@ -41,11 +41,7 @@ const markdownOptions = {
<template> <template>
<div class="chat-message" :class="classes"> <div class="chat-message" :class="classes">
<slot> <slot>
<vue-markdown <VueMarkdown class="chat-message-markdown" :source="messageText" :options="markdownOptions" />
class="chat-message-markdown"
:source="messageText"
:options="markdownOptions"
/>
</slot> </slot>
</div> </div>
</template> </template>

View file

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ChatMessage } from '@n8n/chat/types';
import { Message } from './index';
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
import { Message } from './index';
import type { ChatMessage } from '@n8n/chat/types';
const props = defineProps({ const props = defineProps({
animation: { animation: {

View file

@ -1,7 +1,7 @@
import type { Plugin } from 'vue'; import type { Plugin } from 'vue';
import { computed, nextTick, ref } from 'vue'; import { computed, nextTick, ref } from 'vue';
import type { ChatMessage, ChatOptions } from '@n8n/chat/types';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import type { ChatMessage, ChatOptions } from '@n8n/chat/types';
import { chatEventBus } from '@n8n/chat/event-buses'; import { chatEventBus } from '@n8n/chat/event-buses';
import * as api from '@n8n/chat/api'; import * as api from '@n8n/chat/api';
import { ChatOptionsSymbol, ChatSymbol, localStorageSessionIdKey } from '@n8n/chat/constants'; import { ChatOptionsSymbol, ChatSymbol, localStorageSessionIdKey } from '@n8n/chat/constants';

View file

@ -1,5 +1,5 @@
import type { ChatMessage } from '@n8n/chat/types/messages';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
import type { ChatMessage } from '@n8n/chat/types/messages';
export interface Chat { export interface Chat {
initialMessages: Ref<ChatMessage[]>; initialMessages: Ref<ChatMessage[]>;

View file

@ -15,12 +15,6 @@ module.exports = {
ignorePatterns: ['**/*.js', '**/*.d.ts', 'vite.config.ts', '**/*.ts.snap'], ignorePatterns: ['**/*.js', '**/*.d.ts', 'vite.config.ts', '**/*.ts.snap'],
overrides: [ overrides: [
{
files: ['src/**/*.vue'],
rules: {
'n8n-local-rules/dangerously-use-html-string-missing': 'error',
},
},
{ {
files: ['**/*.test.ts', '**/test/**/*.ts', '**/__tests__/**/*.ts'], files: ['**/*.test.ts', '**/test/**/*.ts', '**/__tests__/**/*.ts'],
rules: { rules: {

View file

@ -9,8 +9,6 @@ module.exports = {
...sharedOptions(__dirname, 'frontend'), ...sharedOptions(__dirname, 'frontend'),
rules: { rules: {
'n8n-local-rules/dangerously-use-html-string-missing': 'off',
// TODO: Remove these // TODO: Remove these
'import/no-default-export': 'warn', 'import/no-default-export': 'warn',
'import/order': 'off', 'import/order': 'off',

View file

@ -9,6 +9,8 @@ module.exports = {
...sharedOptions(__dirname, 'frontend'), ...sharedOptions(__dirname, 'frontend'),
rules: { rules: {
'n8n-local-rules/dangerously-use-html-string-missing': 'error',
// TODO: Remove these // TODO: Remove these
'id-denylist': 'warn', 'id-denylist': 'warn',
'import/extensions': 'warn', 'import/extensions': 'warn',