generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
91 lines (91 loc) · 2.32 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
module.exports = {
root: true,
extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'],
ignorePatterns: [
'!.eslintrc.js',
'!jest.config.js',
'node_modules',
'**/dist',
'**/docs',
'**/coverage',
'merged-packages',
'scripts/create-package/package-template',
],
overrides: [
{
files: ['*.test.{ts,tsx,js}'],
extends: ['@metamask/eslint-config-jest'],
rules: {
'@typescript-eslint/no-shadow': ['error', { allow: ['Text'] }],
},
},
{
files: ['*.js', '*.cjs'],
parserOptions: {
sourceType: 'script',
ecmaVersion: '2020',
},
},
{
files: ['*.ts', '*.tsx'],
extends: ['@metamask/eslint-config-typescript'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.packages.json'],
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-shadow': ['error', { allow: ['Text'] }],
},
},
{
files: ['*.d.ts'],
rules: {
'@typescript-eslint/naming-convention': 'warn',
'import/unambiguous': 'off',
},
},
{
files: ['scripts/**/*.ts'],
rules: {
'import/no-unassigned-import': 'off',
'n/no-sync': 'off',
// All scripts will have shebangs.
'n/shebang': 'off',
},
},
],
rules: {
camelcase: 'off',
'id-length': 'off',
'no-restricted-syntax': [
'error',
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
'jsdoc/match-description': [
'off',
{ matchDescription: '^[A-Z`\\d_][\\s\\S]*[.?!`>)}]$' },
],
},
settings: {
'import/resolver': {
typescript: {
// Ensures imports are resolved correctly when using TypeScript e.g. @metamask/ packages.
project: './tsconfig.packages.json',
// Paths for module resolution to match TypeScript paths
paths: ['apps/*', 'packages/*'],
},
node: {
// Specify file extensions that ESLint should consider when resolving modules
extensions: ['.js', '.jsx', '.ts', '.tsx'],
// Include workspace directories to help ESLint resolve modules within these folders
paths: ['apps', 'packages'],
},
},
jsdoc: {
mode: 'typescript',
},
},
};