Commit 496d85af authored by tyyin lan's avatar tyyin lan

refactor: eslit配置

parent f17ace8d
......@@ -4,20 +4,23 @@ import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import vueParser from 'vue-eslint-parser'
import tsParser from '@typescript-eslint/parser'
import autoImportGlobals from './eslint-auto-import.json' assert { type: 'json' }
import { globalIgnores } from 'eslint/config'
export default [
pluginJs.configs.recommended,
export default tseslint.config(
globalIgnores(['**/node_modules/', '.git/', 'dist/', 'public/', 'src/components/rich-text-editor/lib']),
...tseslint.configs.recommended,
...pluginVue.configs['flat/recommended'],
pluginJs.configs.recommended,
tseslint.configs.recommended,
pluginVue.configs['flat/recommended'],
{
files: ['**/*.{js,mjs,ts,mts,vue,jsx,tsx}'],
languageOptions: {
globals: {
...autoImportGlobals.globals,
...globals.browser,
NodeJS: 'readonly',
Recordable: 'readonly',
ViteEnv: 'readonly',
......@@ -25,19 +28,11 @@ export default [
ConversationMessageItem: 'readonly',
ConversationMessageItemInfo: 'readonly',
},
parser: vueParser,
parserOptions: {
parser: tsParser,
sourceType: 'module',
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'no-console': 'warn',
/* vue rule */
'vue/attribute-hyphenation': 'error',
'vue/multi-word-component-names': 'off',
'vue/component-name-in-template-casing': [
......@@ -57,6 +52,7 @@ export default [
},
],
/* typescript rule */
'@typescript-eslint/no-unused-vars': [
'error',
{
......@@ -69,9 +65,20 @@ export default [
},
},
eslintPluginPrettierRecommended,
{
ignores: ['dist/', 'public/'],
files: ['**/*.{ts,tsx,vue}'],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true,
},
},
},
]
},
eslintPluginPrettierRecommended,
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment