2022-04-17-【工程化】vue2-js项目eslint配置参考

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
module.exports = {
root: true,
env: {
node: true,
browser: true,
},
extends: ['plugin:vue/essential', 'airbnb-base', 'plugin:prettier/recommended'],
parserOptions: {
parser: 'babel-eslint',
ecmaFeatures: {
jsx: true,
},
},
plugins: ['import'],
settings: {
// 别名
'import/resolver': {
alias: {
map: [['@', './src/']],
extensions: ['.js', '.vue'],
},
},
},
rules: {
'func-names': 0,
'import/extensions': 0,
'no-unused-expressions': 0,
/**
* 导入语句前不允许有任何非导入语句
*/
'import/first': 'error',
/**
* 禁止重复导入模块
*/
'import/no-duplicates': 'error',
/**
* 禁止使用 let 导出
*/
'import/no-mutable-exports': 'warn',
/**
* 禁用导入的模块时使用 webpack 特有的语法(感叹号)
*/
'import/no-webpack-loader-syntax': 'warn',
/**
* 当只有一个导出时,必须使用 export default 来导出
*/
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
'no-plusplus': [
'error',
{
allowForLoopAfterthoughts: true,
},
],
'import/no-dynamic-require': 0,
'global-require': 0,
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
},
};

2022-04-17-【工程化】vue2-js项目eslint配置参考
https://zhangyingxuan.github.io/2022-04-17-【工程化】vue2-js项目eslint配置参考/
作者
blowsysun
许可协议