-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.eslintrc.js
129 lines (126 loc) · 3.74 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
module.exports = {
globals: {
__DEV__: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
extends: [
'prettier',
'airbnb',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react-hooks/recommended',
],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
plugins: ['prettier', 'simple-import-sort', 'react-hooks', 'import'],
rules: {
'no-underscore-dangle': 0,
'prettier/prettier': 1,
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/forbid-prop-types': 0,
'react/prop-types': 'off',
'import/prefer-default-export': 0,
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
// allow using devDependencies (vs dependencies) in test files
'import/no-extraneous-dependencies': ['error', { devDependencies: ['src/test/**/*.ts'] }],
'import/order': 0,
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_' }],
'no-use-before-define': 'off',
'no-shadow': 'off',
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['state', 'acc'] }],
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/ban-ts-comment': 'off',
'no-restricted-exports': 'off',
'react/function-component-definition': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
// Not possible to enforce destructureInSignature: 'never' - only 'ignore' is possible
'react/require-default-props': 'off',
// simple-import-sort rules
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': [
1,
{
groups: [
[
'^\\u0000', // Side effect imports.
],
[
'^.+\\.s?css$', // Style imports.
'^react', // `react` related packages come first.
],
[
// Node.js builtins.
'^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)',
'^@?\\w',
],
['^meta(\\/\\w)*'],
['^client\\/store(\\/\\w)*', '^client\\/hooks(\\/\\w)*', '^client\\components(\\/\\w)*', '^client(\\/\\w)*'],
['^server(\\/\\w)*'],
['^test(\\/\\w)*'],
[
'^\\.\\.(?!/?$)',
'^\\.\\./?$', // Parent imports. Put `..` last.
'^\\./(?=.*/)(?!/?$)',
'^\\.(?!/?$)',
'^\\./?$', // Other relative imports. Put same-folder imports and `.` last.
],
],
},
],
'react/jsx-sort-props': [
'error',
{
ignoreCase: true,
callbacksLast: false,
shorthandFirst: false,
shorthandLast: false,
noSortAlphabetically: false,
reservedFirst: true,
},
],
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
webpack: {
config: 'webpack.config.babel.js',
},
// typescript: {},
},
// 'import/resolver': {
// node: {},
// webpack: {
// config: 'webpack.config.babel.js',
// },
// },
},
}