generated from little-buddy/craco-react-webapp-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
104 lines (104 loc) · 2.58 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 = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
env: {
browser: true,
es6: true,
},
extends: [
'airbnb',
'airbnb/hooks',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:react/jsx-runtime',
],
plugins: [
'react',
'jsx-a11y',
'import',
'@typescript-eslint/eslint-plugin',
'prettier',
'unused-imports',
],
globals: {
require: true,
},
rules: {
// prettier
'prettier/prettier': 'error',
'no-unused-expressions': 1,
'global-require': 0,
// TypeScript
'@typescript-eslint/no-unused-vars': ['off', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/ban-ts-comment': [
'error',
{ 'ts-expect-error': 'allow-with-description' },
],
/* react */
'react/require-default-props': 0,
'react/no-unused-prop-types': 0,
'react/jsx-props-no-spreading': 0,
// v4 changes
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
// React
'react/no-array-index-key': 1,
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
'react/prop-types': ['off', {}],
'react/function-component-definition': [
'off',
// {
// unnamedComponents: ['function-expression', 'arrow-function'],
// namedComponents: ['function-declaration'],
// },
],
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
// import
// 'import/extensions': [
// 'error',
// 'ignorePackages',
// {
// js: 'never',
// mjs: 'never',
// jsx: 'never',
// ts: 'never',
// tsx: 'never',
// },
// ],
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
/* unused-imports */
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
},
},
'import/extensions': ['.js', '.ts', '.mjs', '.jsx', '.tsx'],
},
};