-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc.json
131 lines (127 loc) · 5.28 KB
/
.eslintrc.json
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
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:all",
"plugin:react/all",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"arrow-parens": "off", // We like this
"comma-dangle": ["error", "always-multiline"],
"eqeqeq": ["error", "always", { "null": "ignore" }],
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
"function-call-argument-newline": "off", // What?
"generator-star-spacing": ["error", "after"],
"id-length": "off",
"indent": ["error", "tab"],
"init-declarations": "off", // TypeScript already handles this
"linebreak-style": ["error", "windows"],
"max-len": ["error", { "code": 120, "tabWidth": 2, "ignoreUrls": true }],
"multiline-comment-style": "off",
"newline-per-chained-call": "off",
"no-console": "error",
"no-debugger": "error",
"no-eq-null": "off", // We like this
"no-invalid-this": "off", // Not compatible with class properties
"no-magic-numbers": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-tabs": ["error", { "allowIndentationTabs": true }],
"no-ternary": "off", // We like this
"no-undefined": "off", // We like this
"no-use-before-define": "off", // TypeScript is better at this
"no-useless-constructor": "off", // Incompatible with TypeScript
"object-curly-spacing": ["error", "always"],
"object-property-newline": "off",
"one-var": "off", // No way!
"padded-blocks": "off",
"prefer-const": "off",
"prefer-template": "off",
"quote-props": ["error", "as-needed"],
"semi": ["error", "always"],
"sort-imports": "off", // No way!
"sort-keys": "off", // No way!
"space-before-function-paren": ["error", "never"],
"no-extra-parens": "off",
"multiline-ternary": "off",
"dot-location": ["error", "property"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"max-statements-per-line": ["error", { "max": 2 }],
"spaced-comment": ["error", "always"],
"array-element-newline": ["error", "consistent"],
"no-warning-comments": "off",
"max-params": ["error", 6],
"consistent-return": "off", // TypeScript can handle this
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTaggedTemplates": true }],
"lines-between-class-members": "off", // Does not work with TypeScript overload definitions
"prefer-destructuring": "off",
"max-statements": "off",
"max-lines": ["error", { "max": 400 }],
"max-lines-per-function": ["error", { "max": 200 }],
"lines-around-comment": "off", // Doesn't really work with interfaces in TypeScript
"no-continue": "off", // This is very useful. Works like return in .forEach()
"no-return-assign": "off", // Is useful
"prefer-named-capture-group": "off", // ES2018 required, TypeScript doesn't transpile regular expressions
"capitalized-comments": ["error", "always", { "ignoreConsecutiveComments": true }],
"no-multi-assign": "off", // Is useful
"array-callback-return": "off", // TypeScript is better
"require-atomic-updates": "off", // Too many false positives
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
"func-call-spacing": "off", // Use @typescript-eslint/func-call-spacing
"@typescript-eslint/func-call-spacing": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/member-delimiter-style": ["error", { "singleline": { "delimiter": "comma" } }],
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "as", "objectLiteralTypeAssertions": "never" }],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"quotes": "off", // Use @typescript-eslint/quotes
"@typescript-eslint/quotes": ["error", "single"],
"no-duplicate-imports": "off", // Use @typescript-eslint/no-duplicate-imports
"@typescript-eslint/no-duplicate-imports": "off",
"no-shadow": "off", // Use @typescript-eslint/no-shadow
"@typescript-eslint/no-shadow": ["error"],
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
"react/jsx-indent-props": ["error", "tab"],
"react/jsx-indent": ["error", "tab"],
"react/jsx-max-props-per-line": ["error", { "maximum": 3 }],
"react/jsx-no-bind": ["error", { "ignoreDOMComponents": true }],
"react/jsx-props-no-spreading": ["error", { "explicitSpread": "ignore" }],
"react/destructuring-assignment": "off",
"react/jsx-closing-tag-location": "off",
"react/jsx-filename-extension": "off",
"react/jsx-handler-names": "off",
"react/jsx-max-depth": "off",
"react/jsx-no-literals": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-sort-props": "off",
"react/jsx-wrap-multilines": "off",
"react/no-array-index-key": "off", // Doesn't work with custom objects that have .map()
"react/no-render-return-value": "off",
"react/no-set-state": "off",
"react/react-in-jsx-scope": "off",
"react/require-optimization": "off",
"react/sort-comp": "off"
}
}