-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
148 lines (144 loc) · 4.07 KB
/
.eslintrc.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const path = require('path');
module.exports = {
root: true,
env: {
node: true,
// The Follow config only works with eslint-plugin-vue v8.0.0+
'vue/setup-compiler-macros': true,
},
globals: {
defineProps: true,
defineEmits: true,
defineExpose: true,
withDefaults: true,
axios: true,
},
extends: ['plugin:vue/essential', 'eslint:recommended', 'plugin:sonarjs/recommended', '@vue/prettier'],
rules: {
// 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
// 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
// 'linebreak-style': [0, 'error', 'windows'],
// 'handle-callback-err': 'off',
// 'max-len': [
// 'error',
// {
// code: 1000
// }
// ],
// 'no-plusplus': 'off',
// 'prefer-destructuring': 'off',
// 'no-param-reassign': 'off',
// 'array-callback-return': 'off',
// // 'import/extensions': [
// // 'error',
// // 'ignorePackages',
// // {
// // js: 'never',
// // jsx: 'never',
// // ts: 'never',
// // tsx: 'never',
// // mjs: 'never',
// // vue: 'never'
// // }
// // ],
// indent: [
// 'warn',
// 2,
// {
// ignoredNodes: ['TemplateLiteral'],
// SwitchCase: 1
// }
// ],
// 'template-curly-spacing': 'off',
// 'space-before-blocks': [2, 'always'],
// 'space-in-parens': [2, 'never'],
// 'consistent-return': 'off',
// 'standard/no-callback-literal': 'off',
// semi: [
// 2,
// 'never'
// ],
// 'vue/max-attributes-per-line': [
// 2,
// {
// singleline: 100,
// multiline: {
// max: 1,
// allowFirstLine: false
// }
// }
// ],
// 'import/prefer-default-export': 'off',
// 'comma-dangle': [2, 'never'],
// 'comma-spacing': [
// 2,
// {
// before: false,
// after: true
// }
// ],
// 'comma-style': [2, 'last'],
// 'block-spacing': [2, 'always'],
// 'brace-style': [
// 2,
// '1tbs',
// {
// allowSingleLine: true
// }
// ],
// camelcase: [
// 0,
// {
// properties: 'always'
// }
// ],
// 'func-names': 'off',
// 'arrow-parens': 'off',
// 'vue/singleline-html-element-content-newline': 'off',
// 'vue/multiline-html-element-content-newline': 'off',
// 'vue/name-property-casing': ['error', 'PascalCase'],
// 'vue/no-v-html': 'off',
// 'space-before-function-paren': [2, 'always'], // 自动添加空格
'no-empty': 'off',
'sonarjs/cognitive-complexity': ['error', 15],
'no-multi-spaces': 'error', // 禁止多个空格
semi: [2, 'always'], // 自动补充分号
quotes: ['error', 'single'], // 使用单引号
'vue/multi-word-component-names': 'off',
'prettier/prettier': [
'error',
{
semi: true, // 是否使用分号, 默认true
singleQuote: true, // 使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)
},
],
},
globals: {
page: true,
axios: true,
},
parserOptions: {
parser: '@babel/eslint-parser',
},
settings: {
'import/resolver': {
alias: {
map: [
['@', path.resolve(__dirname, 'src')],
['services', path.resolve(__dirname, 'src/services')],
['store', path.resolve(__dirname, 'src/store')],
['utils', path.resolve(__dirname, 'src/utils')],
['config', path.resolve(__dirname, 'src/config')],
['views', path.resolve(__dirname, 'src/views')],
['components', path.resolve(__dirname, 'src/components')],
['assets', path.resolve(__dirname, 'src/assets')],
['filters', path.resolve(__dirname, 'src/filters')],
['styles', path.resolve(__dirname, 'src/styles')],
['plugins', path.resolve(__dirname, 'src/plugins')],
['APP_ROOT', path.resolve(__dirname)],
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.vue'],
},
},
},
};