-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
142 lines (140 loc) · 4.82 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
130
131
132
133
134
135
136
137
138
139
140
141
142
// https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules
// https://www.sitepoint.com/react-with-typescript-best-practices/
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
plugins: [
'@typescript-eslint',
'react-hooks', // Uses eslint-plugin-react-hooks
'destructuring', // Uses eslint-plugin-destructuring
'typescript-sort-keys', // Uses typescript-sort-keys
],
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
'plugin:destructuring/recommended',
'plugin:typescript-sort-keys/recommended',
// Make sure this is always the last configuration in the extends array.
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors.
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
rules: {
'@typescript-eslint/camelcase': 0, // Would like to use this but cannot because of api data names
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-explicit-any': 2,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/no-unused-vars': [2, { args: 'none', ignoreRestSiblings: true }],
'array-bracket-spacing': [2, 'never'],
'no-return-await': 2,
curly: 2,
'destructuring/no-rename': 0,
'eol-last': 2,
'keyword-spacing': [
2,
{
before: true,
after: true,
},
],
'no-const-assign': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-global-assign': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-assign': 2,
'no-multi-str': 2,
'no-trailing-spaces': 2,
'no-unreachable': 2,
'no-var': 2,
'no-whitespace-before-property': 2,
'object-curly-spacing': [2, 'always'],
'one-var': [2, 'never'],
'padded-blocks': [2, 'never'],
'padding-line-between-statements': [
2,
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: 'return' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: '*', next: 'multiline-block-like' },
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' },
{ blankLine: 'never', prev: '*', next: 'case' },
],
'prefer-const': 2,
'prefer-template': 2,
'react-hooks/rules-of-hooks': 2,
// 'react-hooks/exhaustive-deps': 1,
'react/prop-types': 0,
'react/jsx-boolean-value': [2, 'always'],
'space-before-blocks': [2, 'always'],
'newline-after-var': [2, 'always'],
'space-before-function-paren': [
2,
{
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
},
],
'space-infix-ops': 2,
'space-in-parens': [2, 'never'],
'template-curly-spacing': [2, 'never'],
'destructuring/in-params': ['error', { 'max-params': 0 }],
'spaced-comment': [
2,
'always',
{
line: {
markers: ['/'],
exceptions: ['-'],
},
block: {
markers: ['/', '*'],
},
},
],
// 'no-nested-ternary': 2,
'no-param-reassign': [2, { props: false }],
// 'max-params': [2, 5],
// 'quote-props': [2, 'as-needed', { keywords: true }],
'dot-notation': [2, { allowPattern: '^[a-z]+(_[a-z]+)+$' }],
quotes: [2, 'single', { avoidEscape: true }],
// 'no-unused-vars': [
// 2,
// {
// vars: 'local',
// args: 'after-used',
// ignoreRestSiblings: true,
// },
// ],
// 'max-len': [
// 2,
// {
// code: 120,
// ignoreUrls: true,
// ignoreComments: false,
// ignoreRegExpLiterals: true,
// ignoreStrings: true,
// ignoreTemplateLiterals: true,
// },
// ],
// TODO: turn this on once we get stricter
'@typescript-eslint/no-explicit-any': 0, // Delete this line
'@typescript-eslint/ban-ts-ignore': 0, // Delete this line
'@typescript-eslint/ban-ts-comment': 0, // Delete this line
'@typescript-eslint/no-use-before-define': 0, // Delete this line
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
};