UNPKG

2.1 kBJavaScriptView Raw
1const { addMissingRules } = require("./utils");
2
3// EcmaScript 6 specific configuration
4module.exports = {
5 settings: {
6 "import/resolver": {
7 node: {
8 extensions: [".js", ".jsx", ".json"]
9 }
10 },
11 react: {
12 version: "detect"
13 }
14 },
15 parserOptions: {
16 ecmaFeatures: {
17 jsx: true
18 }
19 },
20 rules: {
21 // Recommended rules override
22 "@swissquote/swissquote/react/display-name": 0, // Disabled as it generates false positives
23 "@swissquote/swissquote/react/jsx-no-duplicate-props": [
24 "error",
25 { ignoreCase: true }
26 ],
27 "@swissquote/swissquote/react/no-deprecated": "warn",
28 "@swissquote/swissquote/react/prop-types": [
29 "warn",
30 { skipUndeclared: true }
31 ],
32
33 // Swissquote Rules
34 "@swissquote/swissquote/react/jsx-handler-names": "error",
35 "@swissquote/swissquote/react/jsx-pascal-case": "error",
36 "@swissquote/swissquote/react/no-did-mount-set-state": "error",
37 "@swissquote/swissquote/react/no-did-update-set-state": "error",
38 "@swissquote/swissquote/react/no-redundant-should-component-update":
39 "error",
40 "@swissquote/swissquote/react/no-typos": "error",
41 "@swissquote/swissquote/react/no-unused-state": "error",
42 "@swissquote/swissquote/react/no-will-update-set-state": "error",
43 "@swissquote/swissquote/react/prefer-es6-class": ["error", "always"],
44 "@swissquote/swissquote/react/prefer-stateless-function": [
45 "error",
46 { ignorePureComponents: true }
47 ],
48 "@swissquote/swissquote/react/void-dom-elements-no-children": "error"
49 }
50};
51
52// Add all recommended configurations from eslint-plugin-react
53addMissingRules(
54 require("eslint-plugin-react").configs.recommended.rules,
55 module.exports.rules
56);
57
58// Add all recommended configurations from eslint-plugin-react-hooks
59addMissingRules(
60 require("eslint-plugin-react-hooks").configs.recommended.rules,
61 module.exports.rules
62);
63
64// Disable all the rules from eslint-plugin-react that are handled by Prettier
65addMissingRules(
66 require("eslint-config-prettier/react").rules,
67 module.exports.rules
68);