-
Notifications
You must be signed in to change notification settings - Fork 306
/
.eslintrc.js
110 lines (110 loc) · 4.5 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
module.exports = {
extends: ['@deriv-com/eslint-config-deriv'],
rules: {
'global-require': 'off',
indent: 'off',
'default-param-last': 'warn',
'no-confusing-arrow': 'warn',
'no-unsafe-optional-chaining': 'warn',
'class-methods-use-this': 'warn',
'prefer-regex-literals': 'warn',
'prefer-exponentiation-operator': 'warn',
'no-restricted-exports': 'warn',
'no-promise-executor-return': 'warn',
'import/no-relative-packages': 'warn',
'import/no-mutable-exports': 'warn',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 'off',
},
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
rules: {
'testing-library/await-async-events': 'warn',
'testing-library/no-wait-for-multiple-assertions': 'warn',
'testing-library/no-wait-for-side-effects': 'warn',
'testing-library/no-unnecessary-act': 'warn',
'testing-library/prefer-presence-queries': 'warn',
'testing-library/prefer-query-by-disappearance': 'warn',
'testing-library/no-render-in-lifecycle': 'warn',
'testing-library/no-manual-cleanup': 'warn',
'jest-dom/prefer-checked': 'warn',
'jest-dom/prefer-to-have-value': 'warn',
},
},
{
files: ['*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime', // Enables the new JSX transform runtime
],
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
},
parserOptions: {
ecmaversion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
babelOptions: {
presets: ['@babel/preset-react', '@babel/preset-typescript'],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-transform-class-properties', { loose: true }],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-transform-object-rest-spread',
'@babel/plugin-transform-export-namespace-from',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-optional-chaining',
'@babel/plugin-transform-nullish-coalescing-operator',
],
},
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {
// use an array
project: 'packages/**/tsconfig.json',
},
node: {
extensions: ['.ts', '.tsx'],
moduleDirectory: ['src', 'node_modules'],
},
},
},
},
{
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.test.ts', '**/*.test.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
},
},
],
};