-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eslintrc.js
167 lines (160 loc) · 4.91 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
module.exports = {
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:flowtype/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react", "flowtype", "fp"
],
"globals": {
"require": false
},
"rules": {
// possible errors
"getter-return": "error",
"no-extra-parens": ["error", "functions"],
"no-template-curly-in-string": "error",
"valid-jsdoc": "error",
// best practices
"accessor-pairs": "error",
"array-callback-return": "error",
"block-scoped-var": "error",
"consistent-return": ["error", { "treatUndefinedAsUnspecified": true }],
"curly": "error",
"default-case": ["error", { "commentPattern": "^skip\\sdefault" }],
"dot-location": ["error", "property"],
"eqeqeq": ["error", "smart"],
"no-alert": "error",
"no-caller": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-label": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
"no-iterator": "error",
"no-loop-func": "error",
"no-multi-spaces": "warn",
"no-multi-str": "error",
"no-new": "warn",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "error",
"no-proto": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": ["error", {
"allowShortCircuit": true,
"allowTernary": true
}],
"no-useless-call": "warn",
"no-useless-return": "error",
"no-warning-comments": ["warn", { "terms": ["todo", "fixme", "error", "bug"] }],
"no-with": "error",
"prefer-promise-reject-errors": "error",
"radix": "warn",
"require-await": "warn",
"vars-on-top": "warn",
"yoda": "warn",
// variables
"init-declarations": ["error", "always"],
"no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
"no-catch-shadow": "error",
"no-label-var": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-use-before-define": "error",
// stylistic issues
"array-bracket-spacing": ["error", "never"],
"block-spacing": ["error", "always"],
"brace-style": ["warn", "1tbs"],
"camelcase": ["warn", { properties: "always" }],
"comma-dangle": ["error", {
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"comma-spacing": "warn",
"computed-property-spacing": ["warn", "never"],
"eol-last": ["warn", "always"],
"func-call-spacing": ["warn", "never"],
"func-names": ["warn", "as-needed"],
"indent": ["warn", 2],
"jsx-quotes": "warn",
"key-spacing": "warn",
"keyword-spacing": "warn",
"linebreak-style": ["error", "unix"],
"lines-around-comment": "warn",
"lines-between-class-members": ["warn", "always"],
"max-len": "error",
"max-nested-callbacks": ["error", 5],
"max-statements-per-line": "error",
"multiline-comment-style": ["error", "starred-block"],
"new-parens": "error",
"no-array-constructor": "error",
"no-trailing-spaces": "error",
"no-unneeded-ternary": "warn",
"no-whitespace-before-property": "error",
"one-var": ["error", "never"],
"semi": ["error", "always"],
"semi-spacing": "error",
"semi-style": "error",
"space-before-blocks": "error",
"quotes": ["error", "double"],
// ES6
"arrow-spacing": "error",
"arrow-parens": "warn",
"no-confusing-arrow": ["error", {"allowParens": true}],
// react
"react/prop-types": "off",
"react/display-name": "off",
// flow
"flowtype/no-dupe-keys": "error",
"flowtype/no-weak-types": "warn",
"flowtype/require-variable-type": "off", // wait for https://github.com/gajus/eslint-plugin-flowtype/issues/198 to be resolved
// fp
// TODO: Import fp/recommended after resolving the warnings
"fp/no-arguments": "warn",
"fp/no-class": "warn",
"fp/no-delete": "warn",
"fp/no-events": "warn",
"fp/no-get-set": "warn",
"fp/no-let": "warn",
"fp/no-loops": "warn",
"fp/no-mutating-assign": "warn",
"fp/no-mutating-methods": "warn",
"fp/no-mutation": "warn",
"fp/no-nil": "warn",
"fp/no-proxy": "warn",
"fp/no-rest-parameters": "warn",
"fp/no-this": "warn",
"fp/no-throw": "warn",
"fp/no-unused-expression": "warn",
"fp/no-valueof-field": "warn",
"no-var": "warn"
}
};