-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
122 lines (122 loc) · 3.55 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
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-import', 'unused-imports'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
root: true,
extends: ['google', 'plugin:prettier/recommended', 'plugin:import/typescript'],
ignorePatterns: [
'custom-elements-manifest.config.js',
'commitlint.config.js',
'.eslintrc.js',
'**/dist/**/*',
'**/public/**/*',
'**/out/**/*',
'**/node_modules/**/*',
'scripts/**/*',
'**/polyfill.ts',
],
settings: {
'import/resolver': {
node: false,
typescript: true,
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
},
rules: {
'jsx-quotes': ['error', 'prefer-double'],
'valid-jsdoc': 'off',
'require-jsdoc': 'off',
'linebreak-style': 0,
// `h` in particular is "unused" but used in the built rendering
'no-unused-vars': 'off',
// Stencil's output throws this off given the multiple contexts
'no-invalid-this': 'off',
// Decorators in TypeScript throw this off
'new-cap': 'off',
// Custom max length from Google's recommendation
'max-len': [
'error',
{
code: 120,
tabWidth: 4,
ignoreComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
'eol-last': ['error', 'always'],
'require-await': ['off'],
'require-yield': ['error'],
'no-async-promise-executor': ['error'],
'no-await-in-loop': ['error'],
'require-atomic-updates': ['error'],
complexity: ['error', { max: 20 }],
'max-depth': ['error', { max: 4 }],
'prefer-promise-reject-errors': ['error'],
'no-throw-literal': ['error'],
'no-promise-executor-return': ['error'],
'no-sparse-arrays': ['error'],
'no-unreachable-loop': ['error'],
'no-unsafe-optional-chaining': ['error'],
'no-lone-blocks': ['error'],
'@typescript-eslint/no-magic-numbers': [
'warn',
{
detectObjects: false,
ignoreDefaultValues: true,
ignoreArrayIndexes: true,
ignoreEnums: true,
ignoreNumericLiteralTypes: true,
ignoreReadonlyClassProperties: true,
ignore: [-1, 0, 2, 1, 100, 9000],
},
],
'no-unmodified-loop-condition': ['error'],
'no-useless-call': ['error'],
'prefer-named-capture-group': ['off'],
'no-shadow': ['off'],
'@typescript-eslint/no-shadow': ['error'],
'no-shadow-restricted-names': ['error'],
'no-use-before-define': 'off',
'no-plusplus': ['error'],
'guard-for-in': ['error'],
'no-return-await': ['error'],
'padded-blocks': 'off',
'unused-imports/no-unused-imports': ['warn'],
'import/imports-first': ['error', 'absolute-first'],
'import/namespace': ['error', { allowComputed: true }],
'import/newline-after-import': ['error'],
'import/no-absolute-path': ['error'],
'import/no-mutable-exports': ['error'],
'import/no-extraneous-dependencies': ['error'],
'import/no-unresolved': 'off',
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
},
overrides: [
{
files: ['*.styles.ts', '*.test.ts', 'webpack.config.js'],
rules: {
'@typescript-eslint/no-magic-numbers': ['off'],
},
},
{
files: ['*.js'],
rules: {
'import/no-extraneous-dependencies': ['off'],
},
},
],
};