-
Notifications
You must be signed in to change notification settings - Fork 22
/
.eslintrc.js
90 lines (88 loc) · 2.45 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
const path = require('path');
const configPath = path.resolve(__dirname, 'tsconfig.eslint.json');
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: configPath,
ecmaFeatures: { jsx: true },
},
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'prettier', 'simple-import-sort'],
extends: [
'eslint:recommended',
'airbnb-typescript',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended',
'plugin:react-hooks/recommended',
],
rules: {
complexity: [2, 11],
'sort-imports': 0,
'spaced-comment': [2, 'always', { markers: ['/'] }],
'class-methods-use-this': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_' }],
'@typescript-eslint/array-type': 2,
'@typescript-eslint/prefer-enum-initializers': 2,
'import/order': 0,
'import/prefer-default-export': 0,
'simple-import-sort/imports': [
2,
{
groups: [
['^\\u0000'], // side effect imports.
['^react', '^@?\\w'], // packages from node_modules. react related packages come first.
['^[^.]'], // absolute imports (mostly written as `@/foo`). Anything that does not start with a dot.
['^\\.'], // relative imports. Anything that starts with a dot.
],
},
],
},
overrides: [
{
files: ['*.tsx'],
rules: {
'react/destructuring-assignment': 0,
'react/jsx-props-no-spreading': 0,
'react/no-unescaped-entities': 0,
'react/prop-types': 0,
'react/require-default-props': 0,
'react/react-in-jsx-scope': 0,
},
},
{
files: ['*.test.(ts|tsx)', '*.stories.tsx', 'setupTests.ts'],
rules: {
'import/no-extraneous-dependencies': 0,
},
},
{
files: ['*.js'],
rules: {
'import/no-extraneous-dependencies': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-unsafe-call': 0,
},
},
],
settings: {
react: { version: 'detect' },
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.ts', '.tsx'],
},
typescript: {
project: configPath,
},
},
},
};