-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patheslint.config.js
83 lines (74 loc) · 2.27 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import js from '@eslint/js'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import prettierConfig from 'eslint-config-prettier'
import importPlugin from 'eslint-plugin-import'
import vuePlugin from 'eslint-plugin-vue'
import globals from 'globals'
import tsEslint from 'typescript-eslint'
export default tsEslint.config(
js.configs.recommended,
...tsEslint.configs.strict,
...vuePlugin.configs['flat/recommended'],
...vueTsEslintConfig(),
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
prettierConfig,
{
name: 'browser',
languageOptions: {
globals: globals.browser,
ecmaVersion: 'latest',
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
settings: {
'import/resolver': {
typescript: true,
alias: {
map: [['^@', './src/']],
extensions: ['.ts', '.js', '.vue', '.json'],
},
},
},
rules: {
'arrow-body-style': ['error', 'as-needed'],
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
'spaced-comment': [
'error',
'always',
{
line: { markers: ['/'], exceptions: ['-', '+'] },
block: { markers: ['!'], exceptions: ['*'], balanced: true },
},
],
'vue/multi-word-component-names': 'off',
'vue/attribute-hyphenation': 'off',
'vue/no-v-html': 'off',
'vue/block-lang': ['error', { script: { lang: ['ts', 'tsx'] } }],
'import/named': 'off', // TypeScript 已经确保了命名导入在引用的模块中存在
'import/no-named-as-default-member': 'off',
'import/order': [
'error',
{
'newlines-between': 'always',
groups: ['type', 'builtin', 'external', ['internal', 'parent', 'sibling', 'index'], 'object', 'unknown'],
pathGroups: [{ pattern: '@/**', group: 'external', position: 'after' }],
pathGroupsExcludedImportTypes: ['type'],
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
},
},
{
name: 'node',
files: ['./*.config.{js,ts}', '.prettierrc.js', './src/utils/dev-proxy/generate-proxy.ts'],
languageOptions: {
globals: globals.node,
},
},
{
name: 'ignore',
ignores: ['dist'],
},
)