-
Notifications
You must be signed in to change notification settings - Fork 12
/
react.js
executable file
·70 lines (65 loc) · 2.22 KB
/
react.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
const { addMissingRules } = require("./utils");
// EcmaScript 6 specific configuration
module.exports = {
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".json"]
}
},
react: {
version: "detect"
}
},
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
rules: {
// Recommended rules override
"@swissquote/swissquote/react/display-name": 0, // Disabled as it generates false positives
"@swissquote/swissquote/react/jsx-no-duplicate-props": [
"error",
{ ignoreCase: true }
],
"@swissquote/swissquote/react/no-deprecated": "warn",
"@swissquote/swissquote/react/prop-types": [
"warn",
{ skipUndeclared: true }
],
// Swissquote Rules
// Disabled for now as it has false positives on inline handlers
// TODO :: re-enable jsx-handler-names once https://github.com/yannickcr/eslint-plugin-react/issues/2832 is fixed
"@swissquote/swissquote/react/jsx-handler-names": "off",
"@swissquote/swissquote/react/jsx-pascal-case": "error",
"@swissquote/swissquote/react/no-did-mount-set-state": "error",
"@swissquote/swissquote/react/no-did-update-set-state": "error",
"@swissquote/swissquote/react/no-redundant-should-component-update":
"error",
"@swissquote/swissquote/react/no-typos": "error",
"@swissquote/swissquote/react/no-unused-state": "error",
"@swissquote/swissquote/react/no-will-update-set-state": "error",
"@swissquote/swissquote/react/prefer-es6-class": ["error", "always"],
"@swissquote/swissquote/react/prefer-stateless-function": [
"error",
{ ignorePureComponents: true }
],
"@swissquote/swissquote/react/void-dom-elements-no-children": "error"
}
};
// Add all recommended configurations from eslint-plugin-react
addMissingRules(
require("eslint-plugin-react").configs.recommended.rules,
module.exports.rules
);
// Add all recommended configurations from eslint-plugin-react-hooks
addMissingRules(
require("eslint-plugin-react-hooks").configs.recommended.rules,
module.exports.rules
);
// Disable all the rules from eslint-plugin-react that are handled by Prettier
addMissingRules(
require("eslint-config-prettier").rules,
module.exports.rules
);