-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
142 lines (140 loc) · 4.07 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
module.exports = {
extends: [
'react-app',
'prettier',
'plugin:prettier/recommended',
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
settings: {
react: {
version: 'detect',
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
project: ['./tsconfig.json'],
},
},
],
rules: {
//
// Configurations
//
// Base
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
'no-template-curly-in-string': 'warn',
'no-unsafe-optional-chaining': [
'error',
{ disallowArithmeticOperators: true },
],
'array-callback-return': ['warn', { checkForEach: true }],
curly: 'warn',
'default-case': 'warn',
'default-case-last': 'warn',
'dot-notation': 'warn',
eqeqeq: 'error',
'no-else-return': 'warn',
'no-floating-decimal': 'warn',
'no-new-func': 'error',
'no-return-assign': 'error',
'no-return-await': 'warn',
'no-throw-literal': 'error',
'no-useless-concat': 'warn',
'prefer-promise-reject-errors': 'warn',
radix: 'error',
// React
'react/function-component-definition': [
'warn',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/no-array-index-key': 'warn',
'react/no-this-in-sfc': 'error',
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
'react/self-closing-comp': 'warn',
'react/jsx-boolean-value': 'warn',
'react/jsx-curly-brace-presence': [
'warn',
{ props: 'never', children: 'never' },
],
'react/jsx-fragments': 'warn',
'react/jsx-no-constructed-context-values': 'error',
'react/jsx-no-useless-fragment': 'warn',
'react/jsx-pascal-case': 'warn',
// Typescript
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true },
],
'@typescript-eslint/array-type': ['warn', { default: 'generic' }],
'@typescript-eslint/no-require-imports': 'warn',
// This seemed to warn more than I would expect. Try again another time
// '@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
'@typescript-eslint/switch-exhaustiveness-check': 'warn',
// Import
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/no-anonymous-default-export': 'warn',
//
// Disabled
//
// React
'react/prop-types': 'off',
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
// Typescript
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
// Would Like to turn these back on eventually
indent: 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
// Seems to have a high number of false positives when mixed with ts. Worth digging into this more
'import/no-named-as-default-member': 'off',
},
};