-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
85 lines (85 loc) · 3.6 KB
/
index.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
module.exports = {
env: {
browser: true,
es6: true,
node: false
},
extends: ["airbnb"],
parser: "@babel/eslint-parser",
plugins: ["@babel"],
rules: {
"@babel/object-curly-spacing": "error", // Replace non-babel version
"arrow-parens": ["error", "always"], // Consistency
"class-methods-use-this": "off", // Allows methods to be overridden
"comma-dangle": ["error", "never"], // Unnecessary
"consistent-return": "off", // Makes it hard to return early for conditionals
"func-names": "off", // Unnecessary and unused with arrow functions
"jsx-a11y/label-has-for": ["error", {
components: [],
required: {
some: ["nesting", "id"],
},
allowChildren: false,
}], // Unnecessary to have nesting for both
"keyword-spacing": ["error", {
after: false,
before: false,
overrides: {
as: {before: true, after: true},
case: {before: true, after: true},
catch: {before: true, after: false},
const: {before: true, after: true},
default: {before: true, after: true},
else: {before: true, after: true},
export: {before: true, after: true},
from: {before: true, after: true},
import: {before: true, after: true},
let: {before: true, after: true},
return: {before: true, after: true},
this: {before: true, after: true},
try: {before: true, after: true}
}
}], // Whitespace - Preference
"lines-between-class-members": ["error", "never"],
"no-else-return": "off", // Allows more functional styles
"no-lonely-if": "off", // Allows more readable conditions
"no-multiple-empty-lines": ["error", {max: 1, maxBOF: 0, maxEOF: 0}], // Little stricter
"no-promise-executor-return": "off", // Makes it hard to return early for conditions
"no-underscore-dangle": "off", // Doesn't allow `const key = _key.toLowerCase()`
"no-unused-expressions": ["error", {allowShortCircuit: true, allowTernary: true}],
"object-curly-newline": ["error", {multiline: true, consistent: true}],
"object-curly-spacing": "off", // Incompatible with babel/object-curly-spacing
"prefer-destructuring": ["error", {
VariableDeclarator: {
array: false,
object: true,
},
AssignmentExpression: {
array: false,
object: false,
},
}, {
enforceForRenamedProperties: false,
}], // Assignment expression looks funky with parens
"quote-props": ["error", "consistent-as-needed", {keywords: false}],
"quotes": ["error", "double", {allowTemplateLiterals: true}],
"react/destructuring-assignment": "off", // Overactive and solved by prefer-destructuring
"react/function-component-definition": ["error", {
namedComponents: ["function-declaration", "function-expression"],
unnamedComponents: "arrow-function"
}], // Allows simple arrow components
"react/jsx-boolean-value": ["error", "always"], // Prefer explicit
"react/jsx-filename-extension": "off", // Unnecessary
"react/jsx-one-expression-per-line": "off", // Creates unnecessary white space issues
"react/jsx-props-no-spreading": "off", // Unnecessary
"react/no-did-update-set-state": "off", // Makes hacks needed for prop change triggers
"react/prefer-stateless-function": "off", // Prefer React
"react/react-in-jsx-scope": "off", // Global React
"react/static-property-placement": ["error", "static public field"], // Airbnb will catch up
"space-before-function-paren": ["error", "never"] // Whitespace - Preference
},
settings: {
"import/resolver": "webpack",
react: {version: "detect"}
}
};