-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
122 lines (106 loc) · 3.81 KB
/
.eslintrc.json
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
{
"env": {
"browser": true,
"es6": true
},
"extends": "react-app",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"plugins": [
"react",
"chai-friendly"
],
"rules": {
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/react-in-jsx-scope": "error",
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
// Chai shortcut syntax expect(...).to.be.null triggers default eslint validation
// This plugin overrides it for just chai expressions.
// https://www.npmjs.com/package/eslint-plugin-chai-friendly
"no-unused-expressions": 0,
"chai-friendly/no-unused-expressions": 2,
// Import sorting does not take into account react vs mabl libraries. Turned off for now.
"sort-imports": ["off", {
"ignoreCase": false,
"ignoreDeclarationSort": false,
"ignoreMemberSort": false,
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
}],
// Additions from airbnb code style, set to warn for now
// es6
// require let or const instead of var
"no-var": "warn",
// suggest using of const declaration for variables that are never modified after declared
"prefer-const": ["warn"],
// Prefer destructuring from arrays and objects
// https://eslint.org/docs/rules/prefer-destructuring
"prefer-destructuring": ["warn", {
"VariableDeclarator": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": true,
"object": true
}
}, {
"enforceForRenamedProperties": false
}],
// Enforce props alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
"react/jsx-sort-props": ["warn", {
"ignoreCase": true,
"callbacksLast": false,
"shorthandFirst": false,
"shorthandLast": false,
"noSortAlphabetically": false,
"reservedFirst": false
}],
// Prevent unused propType definitions
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
"react/no-unused-prop-types": ["warn", {
"customValidators": [
],
"skipShapeProps": true
}],
// Prevent missing props validation in a React component definition
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
"react/prop-types": ["warn", {
"ignore": [],
"customValidators": [],
"skipUndeclared": false
}],
// Enforce propTypes declarations alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
"react/sort-prop-types": ["warn", {
"ignoreCase": true,
"callbacksLast": false,
"requiredFirst": false,
"sortShapeProp": true
}],
// Require style prop value be an object or var
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
"react/style-prop-object": "warn",
// react
// Enforce all defaultProps have a corresponding non-required PropType
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
"react/default-props-match-prop-types": ["warn", { "allowRequiredDefaults": false }],
// variables
// disallow declaration of variables that are not used in the code
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": true }],
// disallow use of variables before they are defined
"no-use-before-define": ["warn", { "functions": false, "classes": true, "variables": true }]
}
}