-
Notifications
You must be signed in to change notification settings - Fork 16
/
.eslintrc.cjs
114 lines (104 loc) · 3.63 KB
/
.eslintrc.cjs
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
/*eslint-env commonjs*/
/*eslint quote-props: ['error', "always"] */
module.exports = {
'root': true,
// https://qiita.com/kurkuru/items/d4eebd34f0898c6a2d5a
// this is required to accept `import.meta.url`
'parser': '@babel/eslint-parser',
'parserOptions': {
'ecmaVersion': 2020,
'sourceType': 'module',
'requireConfigFile': false,
},
'globals': {
'ClipboardItem': true
},
'env': {
'browser': true,
'es6': true,
'webextensions': true,
'node': true,
},
'plugins': [
'import',
],
'settings': {
'import/resolver': {
'babel-module': {
'root': ['./'],
}
}
},
'rules': {
// stylisitc problem
'indent': ['warn', 2, {
'SwitchCase': 1,
'MemberExpression': 1,
'CallExpression': {
'arguments': 'first',
},
'VariableDeclarator': {
'var': 2,
'let': 2,
'const': 3,
}
}],
'quotes': ['warn', 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true,
}],
'no-const-assign': 'error',
'prefer-const': ['warn', {
'destructuring': 'any',
'ignoreReadBeforeAssign': false
}],
'no-var': 'error',
'no-unused-vars': ['warn', { // Not make an error for debugging.
'vars': 'all',
'args': 'after-used',
'argsIgnorePattern': '^_',
'caughtErrors': 'all',
'caughtErrorsIgnorePattern': '^_', // Allow `catch (_e) {...}`
}],
'no-use-before-define': ['error', { // the measure for Temporary Dead Zone
'functions': false, // Function declarations are hoisted.
'classes': true, // Class declarations are not hoisted. We should warn it.
}],
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-undef': ['error', {
'typeof': true,
}],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md
'import/default': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
'import/namespace': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
'import/export': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
'import/extensions': ['error', 'always'],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
'import/first': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md
'import/named': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
'import/no-named-as-default': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
'import/no-named-as-default-member': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-cycle.md
'import/no-cycle': ['warn', {
// If we comment out this, `maxDepth` is `Infinity`.
//'maxDepth': 1,
}],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
'import/no-self-import': 'error',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': ['error', {
'caseSensitive': true,
}],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md
'import/no-useless-path-segments': 'error',
}
};