-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.js
144 lines (141 loc) · 3.69 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
const isDev = process.env.NODE_ENV !== 'production';
const jsRules = {
'prettier/prettier': ['error', require('./.prettierrc.js')],
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-shadow': 'off',
'import/no-extraneous-dependencies': 'off',
'no-restricted-exports': 'off',
'func-names': 'off',
'class-methods-use-this': 'off',
'import/extensions': 'off',
'react/function-component-definition': 'off',
'react/jsx-props-no-spreading': 'off',
'react/no-unused-prop-types': 'off',
'react/no-unstable-nested-components': 'warn',
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react-hooks/exhaustive-deps': [
'warn',
{
'additionalHooks': '(usePromiseResult|useAsyncCall)',
},
],
'global-require': 'off',
'import/no-unresolved': 'off',
'no-promise-executor-return': 'off',
'default-param-last': 'off',
'import/no-cycle': 'error',
};
const tsRules = {
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ disallowTypeAnnotations: false },
],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': [isDev ? 'warn' : 'error'],
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'sort-imports': [
'error',
{
'ignoreMemberSort': false,
'ignoreDeclarationSort': true,
},
],
'import/order': [
'warn',
{
'groups': [
'builtin',
'internal',
'index',
'external',
'parent',
'sibling',
'object',
'type',
],
'pathGroups': [
{
'pattern': 'react',
'group': 'builtin',
'position': 'before',
},
{
'pattern': '@baron/**',
'group': 'external',
'position': 'after',
},
],
'alphabetize': {
'order': 'asc',
'caseInsensitive': true,
},
'newlines-between': 'always',
'pathGroupsExcludedImportTypes': ['builtin'],
'warnOnUnassignedImports': true,
},
],
'no-restricted-syntax': [
'error',
{
selector:
"ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
message: 'Default React import not allowed',
},
],
};
module.exports = {
ignorePatterns: [
'packages/components/src/Icon/*',
'packages/desktop/public/static/js-sdk/*',
],
env: {
browser: true,
es6: true,
webextensions: true,
serviceworker: true,
worker: true,
},
overrides: [
{
files: ['*.js', '*.jsx', '*.text-js'],
extends: ['wesbos'],
rules: {
...jsRules,
},
},
{
files: ['*.ts', '*.tsx'],
extends: ['wesbos/typescript'],
rules: {
...jsRules,
...tsRules,
},
},
{
files: ['test/**/*.js', 'test/**/*.ts', '**/*.test.ts'],
extends: ['plugin:jest/recommended'],
env: {
jest: true,
},
rules: {
'jest/expect-expect': 'off',
'jest/no-disabled-tests': 'off',
'jest/no-conditional-expect': 'off',
'jest/valid-title': 'off',
'jest/no-interpolation-in-snapshots': 'off',
'jest/no-export': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
},
},
],
};