generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
98 lines (95 loc) · 2.94 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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'react'],
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended'
],
rules: {
/**
* ESlint base rules
* Some must be disabled as @typescript-eslint can report incorrect errors
**/
'no-unused-vars': 'off',
'no-invalid-this': 'off',
'no-duplicate-imports': 'off',
'no-var': 'error',
'no-param-reassign': 'error',
'prefer-const': 'error',
'max-lines-per-function': 'error',
'max-nested-callbacks': ['error', { max: 5 }],
/**
* @typescript-eslint rules
**/
'@typescript-eslint/no-unused-vars': 2,
'@typescript-eslint/no-use-before-define': 1,
'@typescript-eslint/explicit-function-return-type': 2,
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'as',
objectLiteralTypeAssertions: 'allow-as-parameter'
}
],
'@typescript-eslint/consistent-type-imports': 2,
'@typescript-eslint/no-implicit-any-catch': 2,
'@typescript-eslint/no-require-imports': 2,
'@typescript-eslint/no-unnecessary-boolean-literal-compare': [
'error',
{
allowComparingNullableBooleansToTrue: true,
allowComparingNullableBooleansToFalse: true
}
],
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/no-unnecessary-condition': 2,
'@typescript-eslint/prefer-nullish-coalescing': 2,
'@typescript-eslint/prefer-optional-chain': 2,
'@typescript-eslint/prefer-reduce-type-parameter': 1,
'@typescript-eslint/prefer-string-starts-ends-with': 2,
'@typescript-eslint/promise-function-async': 2,
'@typescript-eslint/require-array-sort-compare': 2,
'@typescript-eslint/strict-boolean-expressions': 0,
'@typescript-eslint/switch-exhaustiveness-check': 1,
'@typescript-eslint/typedef': [
'error',
{
arrayDestructuring: false,
arrowParameter: false,
memberVariableDeclaration: true,
objectDestructuring: false,
parameter: true,
propertyDeclaration: true,
variableDeclaration: false,
variableDeclarationIgnoreFunction: true
}
],
'@typescript-eslint/unified-signatures': 2,
'@typescript-eslint/no-duplicate-imports': 2,
'@typescript-eslint/no-invalid-this': 2,
/**
* react-plugin rules
**/
'react/prop-types': 0,
'react/prefer-stateless-function': 1,
'react/destructuring-assignment': 1,
'react/jsx-sort-props': 2,
'react/jsx-no-bind': 2,
'react/no-unsafe': 2,
'react/jsx-no-useless-fragment': 2,
'react/jsx-handler-names': 2
},
settings: {
react: {
pragma: 'React',
version: 'detect'
}
}
}