-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eslintrc.js
82 lines (75 loc) · 1.93 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
module.exports = {
root: true,
parserOptions: {
sourceType: 'module',
},
extends: [require.resolve('@metamask/eslint-config')],
overrides: [
{
files: ['**/*.js', '**/*.cjs'],
extends: [require.resolve('@metamask/eslint-config-nodejs')],
parserOptions: {
ecmaVersion: 2020,
},
},
{
files: ['**/*.mjs'],
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts'],
extends: [require.resolve("@metamask/eslint-config-typescript")],
rules: {
'@typescript-eslint/consistent-type-imports': [
'warn', // Change 'warn' to 'error' if you want it to be strictly enforced
{
prefer: 'type-imports',
disallowTypeAnnotations: false, // Allows flexibility in certain scenarios
},
],
// This allows importing the `Text` JSX component.
"@typescript-eslint/no-shadow": [
"error",
{
allow: ["Text"],
},
],
// Without the `allowAny` option, this rule causes a lot of false
// positives.
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowAny: true,
allowBoolean: true,
allowNumber: true,
},
],
},
},
{
files: ['**/*.test.ts', "**/*.test.tsx", '**/*.test.js'],
extends: [require.resolve('@metamask/eslint-config-jest')],
rules: {
'@typescript-eslint/no-shadow': [
'error',
{ allow: ['describe', 'expect', 'it'] },
],
'@typescript-eslint/unbound-method': 'off',
'no-console': 'off',
},
}
],
ignorePatterns: [
'!.prettierrc.js',
'**/!.eslintrc.js',
'**/dist*/',
'**/*__GENERATED__*',
'**/build',
'**/public',
'**/.cache',
'packages/**',
],
};