-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc
111 lines (111 loc) · 4.61 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
109
110
111
// 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": 2021,
"presets": ["@babel/preset-react"]
},
"globals": {
"window": true,
"document": true
},
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src/js", "src/_scss"]
}
}
},
"plugins": ["react-hooks", "babel"], // contains linting for react-hooks best practices
// 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
}],
// require 4 spaces in JSX as well
"react/jsx-indent": [0],
"react/jsx-indent-props": [0],
// closing brackets should be aligned with the final prop (props.. />)
"react/jsx-closing-bracket-location": [2, {"location": "after-props"}],
"react/prop-types":[1],
// downgrading to warning when using props purely within componentWillReceiveProps
"react/no-unused-prop-types": [1],
// also set the tab width for the max line width with a max length of 100
"max-len": [1, 100, {"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 --
"no-plusplus": [0],
// 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],
"react/destructuring-assignment": [0],
// allow some globals
"no-restricted-globals": [0],
// default prop types not required
"react/require-default-props": [0],
"react/default-props-match-prop-types": [0],
// 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],
// downgrade label has for to a warning due to some design considerations
"jsx-a11y/label-has-for": [1],
// 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],
// allow await in for-await-in loops
"no-await-in-loop": [0],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"jsx-a11y/anchor-is-valid": "warn",
// prefer arrow functions, but only set to warning
"react/function-component-definition": [1, {"namedComponents": "arrow-function"}],
// do not enforce error for string concat
"prefer-template": [0],
// do not enforce error for 'useless concat'
"no-useless-concat": [0],
// allow props spreading
"react/jsx-props-no-spreading": [0]
}
}