-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy patheslint.config.js
104 lines (97 loc) · 2.65 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import eslint from '@eslint/js'
import globals from 'globals'
import typescriptEslint from 'typescript-eslint'
import eslintPluginVue from 'eslint-plugin-vue'
import stylistic from '@stylistic/eslint-plugin'
// import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
export default typescriptEslint.config(
{
ignores: ['node_modules', 'extension', 'assets', 'public', 'lib', 'src/auto-imports.d.ts', 'src/components.d.ts'],
},
// 推荐配置
eslint.configs.recommended,
...typescriptEslint.configs.recommended,
...eslintPluginVue.configs['flat/recommended'],
stylistic.configs.customize({
indent: 2,
quotes: 'single',
semi: false,
jsx: true,
braceStyle: '1tbs',
arrowParens: 'always',
}),
/**
* 配置全局变量
*/
{
languageOptions: {
globals: {
...globals.browser,
wx: true,
},
},
},
/**
* 通用规则
*/
{
files: ['**/*.{js,mjs,cjs,ts,tsx,vue}'],
rules: {
'no-console': 'off',
'linebreak-style': 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'no-empty-function': 'off',
'max-len': 'off',
'no-plusplus': 'off',
'no-continue': 'off',
'no-restricted-globals': 'off',
'no-restricted-syntax': 'off',
'no-underscore-dangle': 'off',
'object-curly-newline': 'off',
'arrow-body-style': 'off',
'prefer-destructuring': 'off',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'vue/html-self-closing': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/multi-word-component-names': 'off',
'vue/attribute-hyphenation': 'off',
'@stylistic/quote-props': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
},
/**
* vue 规则
*/
{
files: ['**/*.vue'],
languageOptions: {
parserOptions: {
parser: typescriptEslint.parser, // typescript项目需要配置
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true, // 允许在.vue 文件中使用 JSX
},
},
},
rules: {
'vue/no-mutating-props': [
'error',
{
shallowOnly: true,
},
],
},
},
/**
* prettier 配置,会合并根目录下的prettier.config.js 文件
* @see https://prettier.io/docs/en/options
*/
// eslintPluginPrettierRecommended,
)