|
| 1 | +{ |
| 2 | + "$schema": "./node_modules/oxlint/configuration_schema.json", |
| 3 | + "jsPlugins": [ |
| 4 | + // The builtin plugin isn't 1:1 at time of writing. |
| 5 | + { "name": "react-hooks-js", "specifier": "eslint-plugin-react-hooks" }, |
| 6 | + { "name": "react-query-js", "specifier": "@tanstack/eslint-plugin-query" } |
| 7 | + ], |
| 8 | + "plugins": ["eslint", "jsx-a11y", "oxc", "react", "typescript", "unicorn"], |
| 9 | + "rules": { |
| 10 | + "arrow-body-style": ["error", "as-needed"], |
| 11 | + "default-param-last": "error", |
| 12 | + "no-cond-assign": ["warn", "always"], |
| 13 | + "curly": ["warn", "multi"], |
| 14 | + "no-console": "warn", |
| 15 | + "no-fallthrough": "error", |
| 16 | + "no-param-reassign": "error", |
| 17 | + "prefer-template": "warn", |
| 18 | + "oxc/no-barrel-file": ["warn", { "threshold": 0 }], |
| 19 | + "unicorn/no-document-cookie": "warn", |
| 20 | + "unicorn/prefer-number-properties": "error", |
| 21 | + "react/button-has-type": "error", |
| 22 | + "react/jsx-boolean-value": "warn", |
| 23 | + "react/jsx-fragments": "warn", |
| 24 | + "react/jsx-no-useless-fragment": "warn", |
| 25 | + "react/no-array-index-key": "warn", |
| 26 | + "react/no-danger": "error", |
| 27 | + // Temporarily disabled during the POC phase |
| 28 | + // "react/only-export-components": "error", |
| 29 | + "react/self-closing-comp": "warn", |
| 30 | + "typescript/array-type": ["warn", { "default": "generic" }], |
| 31 | + "typescript/ban-ts-comment": "warn", |
| 32 | + "typescript/parameter-properties": "error", |
| 33 | + "typescript/no-explicit-any": "error", |
| 34 | + "typescript/no-inferrable-types": "warn", |
| 35 | + "typescript/no-non-null-assertion": "warn", |
| 36 | + "typescript/no-unnecessary-condition": "warn", |
| 37 | + "typescript/no-unnecessary-template-expression": "warn", |
| 38 | + "typescript/restrict-template-expressions": [ |
| 39 | + "warn", |
| 40 | + { |
| 41 | + "allowAny": false, |
| 42 | + "allowNullish": false, |
| 43 | + "allowRegExp": false |
| 44 | + } |
| 45 | + ], |
| 46 | + "typescript/restrict-plus-operands": [ |
| 47 | + "error", |
| 48 | + { |
| 49 | + "allowAny": false, |
| 50 | + "allowBoolean": false, |
| 51 | + "allowNullish": false, |
| 52 | + "allowNumberAndString": false, |
| 53 | + "allowRegExp": false |
| 54 | + } |
| 55 | + ], |
| 56 | + // "always" flags for lack of await outside of async functions, unlike ESLint: |
| 57 | + // https://github.com/oxc-project/oxc/issues/18452 |
| 58 | + "typescript/return-await": ["error", "error-handling-correctness-only"], |
| 59 | + "typescript/strict-boolean-expressions": [ |
| 60 | + "warn", |
| 61 | + { |
| 62 | + "allowString": false, |
| 63 | + "allowNumber": false, |
| 64 | + "allowNullableBoolean": true |
| 65 | + } |
| 66 | + ], |
| 67 | + "typescript/await-thenable": "error", |
| 68 | + "typescript/no-misused-promises": "error", |
| 69 | + "typescript/no-floating-promises": "error", |
| 70 | + "typescript/no-misused-spread": "error", |
| 71 | + "typescript/no-unsafe-argument": "error", |
| 72 | + "typescript/no-unsafe-assignment": "error", |
| 73 | + "typescript/no-unsafe-call": "error", |
| 74 | + "typescript/no-unsafe-member-access": "error", |
| 75 | + "typescript/no-unsafe-return": "error", |
| 76 | + "typescript/unbound-method": "error", |
| 77 | + |
| 78 | + // Default config has catch violations. |
| 79 | + "no-unused-vars": [ |
| 80 | + "warn", |
| 81 | + { |
| 82 | + "caughtErrorsIgnorePattern": "^_", |
| 83 | + // These are the defaults that are unset by diverging our config at all. |
| 84 | + "argsIgnorePattern": "^_", |
| 85 | + "varsIgnorePattern": "^_" |
| 86 | + } |
| 87 | + ], |
| 88 | + |
| 89 | + // Lots of false positives on sums. |
| 90 | + "react/jsx-key": "off", |
| 91 | + |
| 92 | + // Enable the recommended rules in the JS plugin as per: |
| 93 | + // https://react.dev/reference/eslint-plugin-react-hooks#recommended |
| 94 | + "react-hooks-js/exhaustive-deps": "error", |
| 95 | + "react-hooks-js/rules-of-hooks": "error", |
| 96 | + "react-hooks-js/component-hook-factories": "error", |
| 97 | + "react-hooks-js/config": "error", |
| 98 | + "react-hooks-js/error-boundaries": "error", |
| 99 | + "react-hooks-js/gating": "error", |
| 100 | + "react-hooks-js/globals": "error", |
| 101 | + "react-hooks-js/immutability": "error", |
| 102 | + "react-hooks-js/incompatible-library": "error", |
| 103 | + "react-hooks-js/preserve-manual-memoization": "error", |
| 104 | + "react-hooks-js/purity": "error", |
| 105 | + "react-hooks-js/refs": "error", |
| 106 | + "react-hooks-js/set-state-in-effect": "error", |
| 107 | + "react-hooks-js/set-state-in-render": "error", |
| 108 | + "react-hooks-js/static-components": "error", |
| 109 | + "react-hooks-js/unsupported-syntax": "error", |
| 110 | + "react-hooks-js/use-memo": "error", |
| 111 | + |
| 112 | + // Enable the recommended rules in the JS plugin. |
| 113 | + "react-query-js/exhaustive-deps": "error", |
| 114 | + "react-query-js/no-rest-destructuring": "warn", |
| 115 | + "react-query-js/stable-query-client": "error", |
| 116 | + "react-query-js/no-unstable-deps": "error", |
| 117 | + "react-query-js/infinite-query-property-order": "error" |
| 118 | + } |
| 119 | +} |
0 commit comments