-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
84 lines (84 loc) · 2.34 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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
},
env: {
browser: true,
node: true,
},
plugins: ['import'],
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:jest-dom/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'plugin:storybook/recommended',
],
settings: {
react: {
// to indicate latest version
// https://github.com/yannickcr/eslint-plugin-react/blob/b8e91a571bc6b58cc3c78e9e62e8b60ecb45e233/lib/util/version.js#L48
version: '999.999.999',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
'import/default': 'off',
'import/no-default-export': 'off',
'react/display-name': 'off',
'import/no-named-as-default-member': 'warn',
// see for rational https://basarat.gitbook.io/typescript/main-1/defaultisbad
'import/no-default-export': 'error',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
},
overrides: [
{
// required because of https://github.com/yannickcr/eslint-plugin-react/issues/2353
// otherwise get missing prop-types error in tsx files
files: ['**/*.tsx'],
rules: {
'react/prop-types': 'off',
},
},
{
// allow node_module mocks to have default exports
files: ['__mocks__/**/*'],
rules: {
'import/no-default-export': 'off',
},
},
],
ignorePatterns: [
'dist',
'docs',
'example',
'node_modules',
'**/*.stories.tsx',
'**/*.test.ts',
],
}