|
| 1 | +module.exports = { |
| 2 | + parser: "@babel/eslint-parser", |
| 3 | + plugins: ["prettier", "cypress", "testing-library"], |
| 4 | + extends: [ |
| 5 | + "react-app", // Use the recommended rules from CRA. |
| 6 | + "plugin:cypress/recommended", |
| 7 | + "plugin:prettier/recommended", // Ensure this is last in the list. |
| 8 | + ], |
| 9 | + parserOptions: { |
| 10 | + ecmaFeatures: { |
| 11 | + jsx: true, |
| 12 | + }, |
| 13 | + ecmaVersion: 2018, |
| 14 | + sourceType: "module", |
| 15 | + }, |
| 16 | + rules: { |
| 17 | + "prettier/prettier": "error", |
| 18 | + "react/forbid-component-props": [ |
| 19 | + "error", |
| 20 | + { |
| 21 | + forbid: [ |
| 22 | + { |
| 23 | + propName: "data-test", |
| 24 | + message: "Use `data-testid` instead of `data-test` attribute", |
| 25 | + }, |
| 26 | + ], |
| 27 | + }, |
| 28 | + ], |
| 29 | + "react/forbid-dom-props": [ |
| 30 | + "error", |
| 31 | + { |
| 32 | + forbid: [ |
| 33 | + { |
| 34 | + propName: "data-test", |
| 35 | + message: "Use `data-testid` instead of `data-test` attribute", |
| 36 | + }, |
| 37 | + ], |
| 38 | + }, |
| 39 | + ], |
| 40 | + }, |
| 41 | + settings: { |
| 42 | + react: { |
| 43 | + version: "detect", |
| 44 | + }, |
| 45 | + }, |
| 46 | + overrides: [ |
| 47 | + { |
| 48 | + files: ["**/*.ts?(x)"], |
| 49 | + parser: "@typescript-eslint/parser", |
| 50 | + extends: [ |
| 51 | + "react-app", // Uses the recommended rules from CRA. |
| 52 | + "plugin:prettier/recommended", // Ensure this is last in the list. |
| 53 | + ], |
| 54 | + parserOptions: { |
| 55 | + ecmaFeatures: { |
| 56 | + jsx: true, |
| 57 | + }, |
| 58 | + ecmaVersion: 2018, |
| 59 | + sourceType: "module", |
| 60 | + }, |
| 61 | + rules: { |
| 62 | + "prettier/prettier": "error", |
| 63 | + }, |
| 64 | + settings: { |
| 65 | + react: { |
| 66 | + version: "detect", |
| 67 | + }, |
| 68 | + }, |
| 69 | + }, |
| 70 | + { |
| 71 | + files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"], |
| 72 | + extends: ["plugin:testing-library/react"], |
| 73 | + rules: { |
| 74 | + "testing-library/no-node-access": "warn", |
| 75 | + "testing-library/no-container": "warn", |
| 76 | + "testing-library/no-render-in-setup": "warn", |
| 77 | + }, |
| 78 | + }, |
| 79 | + ], |
| 80 | +}; |
0 commit comments