-
Notifications
You must be signed in to change notification settings - Fork 320
/
.eslintrc.js
167 lines (166 loc) · 5.02 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/**
* @file Base eslint config for AdGuard extension
*/
module.exports = {
'root': true,
'env': {
'browser': true,
'node': true,
'jest': true,
},
'globals': {
'adguard': true,
'chrome': true,
'page': true,
'context': true,
'jestPuppeteer': true,
},
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 2020,
'sourceType': 'module',
'ecmaFeatures': {
'jsx': true,
},
'project': 'tsconfig.json',
},
'settings': {
'react': {
'version': 'detect',
},
'import/resolver': {
'typescript': {
'alwaysTryTypes': true,
},
'node': {
'extensions': [
'.js',
'.jsx',
'.ts',
'.tsx',
],
},
},
},
'extends': [
'airbnb',
'airbnb-typescript',
'airbnb/hooks',
'plugin:jsdoc/recommended',
],
'plugins': [
'import-newlines',
],
'rules': {
'no-console': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/dot-notation': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-cycle': 'off',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'import-newlines/enforce': ['error', 2, 120],
'import/order': [
'error',
{
'groups': [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
'pathGroups': [
// Place all react libraries after external
{
'pattern': '*react*',
'group': 'external',
'position': 'before',
},
// Place all our libraries after react-like
{
'pattern': '@adguard/*',
'group': 'external',
'position': 'after',
},
// Separate group for all .pcss styles
{
'pattern': '*.pcss',
'group': 'object',
'patternOptions': { 'matchBase': true },
'position': 'after',
},
],
'pathGroupsExcludedImportTypes': ['builtin', 'react'],
'newlines-between': 'always',
// To include "side effect imports" in plugin checks
// (like "import 'styles.pcss';")
'warnOnUnassignedImports': true,
},
],
'strict': 'off',
'max-len': ['error', {
'code': 120,
'comments': 120,
'tabWidth': 4,
'ignoreUrls': true,
'ignoreTrailingComments': false,
'ignoreComments': false,
}],
'indent': [
'error',
4,
{
'SwitchCase': 1,
'ignoreComments': false,
},
],
'wrap-iife': 'off',
'func-names': 'off',
'prefer-destructuring': 'off',
'consistent-return': 'off',
'dot-notation': 'off',
'quote-props': 'off',
'arrow-body-style': 'off',
'no-use-before-define': 'off',
'no-useless-escape': 'off',
'no-param-reassign': 'off',
'no-shadow': 'off',
'no-multi-spaces': [
'error',
{
'ignoreEOLComments': true,
},
],
'no-prototype-builtins': 'off',
'no-continue': 'off',
'no-bitwise': 'off',
'no-underscore-dangle': 'off',
// types described in ts
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/tag-lines': 'off',
'jsdoc/require-throws': 'error',
'jsdoc/require-file-overview': 'error',
// These rules are enabled for background only see Extension/src/background/.eslintrc.js
// TODO consider enabling them for the whole project later
'@typescript-eslint/explicit-function-return-type': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-property-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-param': 'off',
'jsdoc/no-undefined-types': 'off',
'jsdoc/require-returns-check': 'off',
'jsdoc/require-jsdoc': 'off',
},
'ignorePatterns': [
'node_modules',
'build',
'Extension/web-accessible-resources',
],
};