-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
87 lines (80 loc) · 2.38 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
const OFF = 0;
// const WARN = 1;
const ERROR = 2;
module.exports = {
env: {
browser: true,
es6: true,
mocha: true,
},
extends: ['airbnb', 'airbnb/hooks', 'prettier', 'plugin:cypress/recommended'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
JSX: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', '@typescript-eslint', 'simple-import-sort', 'prettier'],
settings: {
'import/resolver': {
typescript: {},
},
},
rules: {
// note you must disable the base rule as it can report incorrect errors
'no-use-before-define': OFF,
'no-void': OFF,
'@typescript-eslint/no-use-before-define': ERROR,
'prettier/prettier': ERROR,
// note you must disable the base rule as it can report incorrect errors
'no-shadow': OFF,
'@typescript-eslint/no-shadow': [ERROR],
// ESLint rules
'no-underscore-dangle': OFF,
'arrow-parens': [ERROR, 'as-needed'],
'no-nested-ternary': OFF,
'import/prefer-default-export': OFF,
'import/extensions': [ERROR, 'never'],
'import/no-unresolved': ERROR,
'import/no-extraneous-dependencies': [
ERROR,
{
devDependencies: true,
},
],
'no-param-reassign': ['error', { props: false }],
// Sorting rules
'sort-imports': OFF,
'import/order': OFF,
'import/first': ERROR,
'import/no-duplicates': ERROR,
'simple-import-sort/imports': ERROR,
'simple-import-sort/exports': ERROR,
'import/newline-after-import': ['error', { count: 1 }],
// TypeScript rules
'no-unused-vars': 'off', // disable the native no-unused-vars so that only the TS one is enabled
'@typescript-eslint/no-unused-vars': OFF,
'@typescript-eslint/explicit-function-return-type': OFF,
'@typescript-eslint/no-explicit-any': OFF,
'no-redeclare': OFF,
// React rules
'react/require-default-props': OFF,
'react/prop-types': OFF, // otherwise creates false alerts in TS code
'react/jsx-props-no-spreading': OFF,
'react/destructuring-assignment': OFF,
'react/jsx-filename-extension': [
ERROR,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
],
'react/jsx-curly-newline': OFF,
'react/jsx-uses-react': [ERROR],
'react/react-in-jsx-scope': OFF,
},
};