-
Notifications
You must be signed in to change notification settings - Fork 18
/
.eslintrc
108 lines (108 loc) · 4.48 KB
/
.eslintrc
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
// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
// the base style guide for this project is Airbnb
// see: https://github.com/airbnb/javascript
{
"extends": "airbnb",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2018,
"presets": ["@babel/preset-react"]
},
"globals": {
"window": true,
"document": true
},
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src/js", "src/_scss"]
}
}
},
// overrides to the Airbnb style follow
"rules": {
// indentation should be 4 spaces (use soft tabs) and switch cases should be indented
"indent": [2, 4, {
"SwitchCase": 1
}],
// This is in direct competition with the above indent rule for some reason even when given the same
// arguments, so it is turned off and the above adequately handles jsx files.
"react/jsx-indent": [0],
"react/jsx-indent-props": [0],
// Allows React Router "Link" component to be a11y compliant
"jsx-a11y/anchor-is-valid": [ "error", {
"components": [ "Link" ],
"specialLink": [ "to", "hrefLeft", "hrefRight" ],
"aspects": [ "noHref", "invalidHref", "preferButton" ]
}],
// Restrict console use to only warnings and errors to aid in rapid debugging
"no-console": ["error", { "allow": ["warn", "error"] }]
,
// closing brackets should be aligned with the final prop (props.. />)
"react/jsx-closing-bracket-location": [2, "after-props"],
"react/no-unused-prop-types": [2],
// also set the tab width for the max line width with a max length of 120
"max-len": [1, 120, {"tabWidth": 4}],
// do not allow dangling commas at the end of arrays, objects, etc.
"comma-dangle": [2, "never"],
// downgrade extra semicolons to warnings
"no-extra-semi": [1],
// require parens in arrow functions with single arguments for improved readability
"arrow-parens": [2, "always"],
// allow double-quoted strings
"quotes": [0],
// allow for loops
"no-restricted-syntax": [2, "LabeledStatement", "WithStatement"],
// require stroustrup brace styles
"brace-style": [1, "stroustrup"],
// disallow stateless functions in place of fully declared React components
"react/prefer-stateless-function": [0],
// allow binding in React props because we don't have autobind in ES6
"react/jsx-no-bind": [0],
// downgrading export default preference to warning, since we may add additional exports
// to files in the future
"import/prefer-default-export": [1],
// disabling class method "this" requirement to avoid React conflicts
"class-methods-use-this": [0],
"no-underscore-dangle": [0, {
"allowAfterThis": true
}],
// allow ++ and -- in for loops
"no-plusplus": [2, {
"allowForLoopAfterthoughts": true
}],
// allow continue statements
"no-continue": [0],
// allow named exports in files with default exports in order to expose containers
// for testing
"import/no-named-as-default": [0],
// don't require all function arguments be on new lines
"function-paren-newline": [0],
// ignore jsdoc
"spaced-comment": [2, "always", {
"exceptions": ["*"]
}],
// for now, don't do destructuring
"prefer-destructuring": [0],
// allow some globals
"no-restricted-globals": [0],
// default prop types not required
"react/require-default-props": [0],
"react/default-props-match-prop-types": [1],
// allow object prop-type
"react/forbid-prop-types": [1, {
"forbid": ["any"]
}],
// allow unused state because linter does not always know when a state is passed to child
// components
"react/no-unused-state": [0],
// Disabling this rule, since its been deprecated
"jsx-a11y/label-has-for": [0],
// downgrade array index as React key to warning (though it should be higher, this would
// be an expensive refactor)
"react/no-array-index-key": [1],
// prevent no-unused-vars error on for loop variables
"no-unused-vars": [1]
}
}