-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
100 lines (77 loc) · 2.98 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
module.exports = {
extends: [
"eslint-config-airbnb",
].map(require.resolve),
plugins: [
"prefer-arrow",
"no-loops",
"react-hooks"
],
parser: "babel-eslint",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: true
},
},
rules: {
// Use prop-types on any component that receives props
"react/prop-types": "error",
// Omit constructor in classes if not being used
// Prefer export statement after component declaration
"import/exports-last": "error",
// Prefer functional stateless components if possible
"react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
// Use classnames for dynamically applying classes
// TODO - Can't find any way to enforce this one, might have to write our own
// Require strict === and !== except when comparing to null
"eqeqeq": ["error", "always", {"null": "ignore"}],
// Prefer arrow functions over the function keyword except when defining classes or methods
"prefer-arrow/prefer-arrow-functions": [
"warn",
{
"disallowPrototype": true,
"singleReturnOnly": false,
"classPropertiesAllowed": true
}
],
// lowerCamelCase for variables and functions / SCREAMING_SNAKE_CASE for constants
"camelcase": ["error", {"properties": "always"}],
// Prefer template strings over string concatenation
"prefer-template": "error",
// Prefer array functions like map and forEach over loops
"no-loops/no-loops": "warn",
// Use const for declaring variables that will never be re-assigned, and let otherwise
"prefer-const": "error",
// Avoid var to declare variables
"no-var": "error",
// Use a trailing comma after each item in a multi-line array or
// object literal, including the last item
"comma-dangle": ["error", "always-multiline"],
// Do not include parentheses around a sole arrow function parameter
"arrow-parens": ["error", "as-needed"],
// Print spaces between brackets in object literals
"object-curly-spacing": ["error", "always"],
// The maximum characters per line of code should be 80
"max-len": ["error", {
"code": 80,
"tabWidth": 2,
"ignoreUrls": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
}],
// Do not use semicolons at the end of statements
"semi": ["error", "never", { "beforeStatementContinuationChars": "never"}],
// Prefer double quotes to single quotes (but backticks are okay)
"quotes": ["error", "double", { "allowTemplateLiterals": true }],
// Allow usage of variables before they're defined
// (useful for declaring styles underneath JSX)
"no-use-before-define": "off",
// Allow JSX to exist in files that don't have the .jsx extension
"react/jsx-filename-extension": "off",
// https://reactjs.org/docs/hooks-rules.html
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
},
}