|
1 | 1 | { |
2 | | - // Extend the AirBnb lint config |
| 2 | + "env": { |
| 3 | + "browser": true, |
| 4 | + "es2021": true, |
| 5 | + "jest": true, |
| 6 | + "node": true |
| 7 | + }, |
3 | 8 | "extends": ["airbnb", "airbnb-typescript", "airbnb/hooks"], |
4 | 9 | "parser": "@typescript-eslint/parser", |
5 | 10 | "parserOptions": { |
6 | | - "ecmaVersion": 6, |
7 | 11 | "ecmaFeatures": { |
8 | 12 | "globalReturn": true, |
9 | 13 | "impliedStrict": true, |
|
12 | 16 | "project": "./tsconfig.json", |
13 | 17 | "sourceType": "module" |
14 | 18 | }, |
15 | | - "env": { |
16 | | - "es6": true, |
17 | | - "browser": true, |
18 | | - "node": true, |
19 | | - "jest": true |
20 | | - }, |
21 | | - "globals": { |
22 | | - "wp": true |
23 | | - }, |
24 | | - "settings": { |
25 | | - "import/resolver": "webpack" |
26 | | - }, |
27 | | - "plugins": [ |
28 | | - "react-hooks" |
29 | | - ], |
30 | 19 | "rules": { |
31 | | - "react-hooks/rules-of-hooks": "error", |
32 | | - "react-hooks/exhaustive-deps": "warn", |
33 | | - "import/prefer-default-export": "off", |
34 | | - "import/no-unresolved": [0], |
35 | | - "import/no-cycle": [0], |
36 | | - "import/extensions": [0], |
| 20 | + "no-restricted-syntax": [ |
| 21 | + "error", |
| 22 | + { |
| 23 | + "message": "Ternaries must be used instead of && in JSX expressions to avoid the potential for accidental output. Use, for example, {condition ? <Element /> : null}.", |
| 24 | + "selector": ":matches(JSXElement, JSXFragment) > JSXExpressionContainer > LogicalExpression[operator='&&']" |
| 25 | + }, |
| 26 | + { |
| 27 | + "message": "Ternaries must be used instead of || in JSX expressions to avoid the potential for accidental output. Use, for example, {thing1 ? thing1 : thing2}.", |
| 28 | + "selector": ":matches(JSXElement, JSXFragment) > JSXExpressionContainer > LogicalExpression[operator='||']" |
| 29 | + } |
| 30 | + ], |
| 31 | + "react/jsx-props-no-spreading": "off", |
37 | 32 | "react/react-in-jsx-scope": "off", |
38 | 33 | "react/require-default-props": "off" |
| 34 | + }, |
| 35 | + "settings": { |
| 36 | + "import/resolver": "webpack" |
39 | 37 | } |
40 | 38 | } |
0 commit comments