UNPKG

2.2 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 // Disabled for now as it has false positives on inline handlers
35 // TODO :: file a bug report
36 "@swissquote/swissquote/react/jsx-handler-names": "off",
37 "@swissquote/swissquote/react/jsx-pascal-case": "error",
38 "@swissquote/swissquote/react/no-did-mount-set-state": "error",
39 "@swissquote/swissquote/react/no-did-update-set-state": "error",
40 "@swissquote/swissquote/react/no-redundant-should-component-update":
41 "error",
42 "@swissquote/swissquote/react/no-typos": "error",
43 "@swissquote/swissquote/react/no-unused-state": "error",
44 "@swissquote/swissquote/react/no-will-update-set-state": "error",
45 "@swissquote/swissquote/react/prefer-es6-class": ["error", "always"],
46 "@swissquote/swissquote/react/prefer-stateless-function": [
47 "error",
48 { ignorePureComponents: true }
49 ],
50 "@swissquote/swissquote/react/void-dom-elements-no-children": "error"
51 }
52};
53
54// Add all recommended configurations from eslint-plugin-react
55addMissingRules(
56 require("eslint-plugin-react").configs.recommended.rules,
57 module.exports.rules
58);
59
60// Add all recommended configurations from eslint-plugin-react-hooks
61addMissingRules(
62 require("eslint-plugin-react-hooks").configs.recommended.rules,
63 module.exports.rules
64);
65
66// Disable all the rules from eslint-plugin-react that are handled by Prettier
67addMissingRules(
68 require("eslint-config-prettier/react").rules,
69 module.exports.rules
70);