-
Notifications
You must be signed in to change notification settings - Fork 67
/
.eslintrc.js
104 lines (104 loc) · 2.96 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
module.exports = {
root: true,
ignorePatterns: ['dist', 'build', '*.d.ts', 'babel-cjs.js', 'babel-esm.js', 'storybook-static'],
overrides: [
{
files: ['*.{js,jsx,ts,tsx}'],
extends: ['plugin:import/recommended', 'plugin:react/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react-hooks'],
rules: {
'react/display-name': 'off',
'react/jsx-filename-extension': [
'error',
{
allow: 'as-needed',
extensions: ['.tsx', '.jsx'],
},
],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
// This case is covered by the use of TypeScript so we can safely turn it off.
'import/export': 'off',
// We will let TypeScript handle this for tsx? files, and ignore it on jsx? files to enable linting without
// building packages
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/__tests__/**',
'**/test/**',
'**/stories/**',
'**/__fixtures__/**',
'**/fixtures/**',
'**/__perf__/**',
'**/*.test.tsx?',
'**/index.js',
'**/test-utils.ts',
],
},
],
'import/no-unresolved': 'off',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
'newlines-between': 'always',
},
],
'no-debugger': 'error',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
},
},
{
files: ['*.{ts,tsx}'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
},
{
files: ['*.json'],
plugins: ['json-files'],
rules: {
'json-files/sort-package-json': 'error',
},
},
],
settings: {
react: {
version: 'detect',
},
},
};