oxlint.json 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. {
  2. "$schema": "https://oxc-project.github.io/oxlint/schema.json",
  3. "plugins": ["import", "react", "jsx-a11y", "typescript", "unicorn"],
  4. "env": {
  5. "browser": true,
  6. "node": true,
  7. "es2020": true
  8. },
  9. "globals": {
  10. "__webpack_public_path__": "writable",
  11. "__webpack_init_sharing__": "readonly",
  12. "__webpack_share_scopes__": "readonly",
  13. "jest": "readonly"
  14. },
  15. "settings": {
  16. "react": {
  17. "version": "detect"
  18. }
  19. },
  20. "rules": {
  21. // === Custom Superset rules are handled by scripts/check-custom-rules.js ===
  22. // These rules check for:
  23. // - No literal colors (use theme colors)
  24. // - No FontAwesome icons (use Icons component)
  25. // - No template variables in i18n (use parameterized messages)
  26. // === Core ESLint rules ===
  27. // Error prevention
  28. "no-console": "warn",
  29. "no-alert": "warn",
  30. "no-debugger": "error",
  31. "no-unused-vars": "off",
  32. "no-undef": "error",
  33. "no-prototype-builtins": "off",
  34. "no-unsafe-optional-chaining": "off",
  35. "no-import-assign": "off",
  36. "no-promise-executor-return": "off",
  37. // Best practices
  38. "eqeqeq": ["error", "always", { "null": "ignore" }],
  39. "curly": "off",
  40. // TODO: Gradually enforce destructuring patterns
  41. "prefer-destructuring": "warn",
  42. "prefer-const": [
  43. "error",
  44. { "destructuring": "any", "ignoreReadBeforeAssign": true }
  45. ],
  46. "prefer-template": "error",
  47. "prefer-spread": "error",
  48. "prefer-rest-params": "error",
  49. "no-var": "error",
  50. "no-eval": "error",
  51. "no-implied-eval": "error",
  52. "no-new-func": "error",
  53. "no-iterator": "error",
  54. "no-proto": "error",
  55. "no-script-url": "error",
  56. "no-void": "error",
  57. "radix": "error",
  58. "no-plusplus": "error",
  59. "no-nested-ternary": "off",
  60. "no-unneeded-ternary": ["error", { "defaultAssignment": false }],
  61. "object-shorthand": [
  62. "error",
  63. "always",
  64. { "ignoreConstructors": false, "avoidQuotes": true }
  65. ],
  66. "arrow-body-style": [
  67. "error",
  68. "as-needed",
  69. { "requireReturnForObjectLiteral": false }
  70. ],
  71. // === Import plugin rules ===
  72. "import/no-unresolved": "error",
  73. // TODO: Fix incorrect named imports in Storybook and other files
  74. "import/named": "warn",
  75. // TODO: Fix duplicate exports in shared-controls and other modules
  76. // Temporarily disabled during OXC migration
  77. "import/export": "warn",
  78. // TODO: Re-enable after fixing default export patterns across codebase
  79. // This is temporarily disabled during OXC migration to unblock CI
  80. // Tracking issue: [Create issue after PR merge]
  81. "import/no-named-as-default": "off",
  82. "import/no-named-as-default-member": "off",
  83. "import/no-mutable-exports": "error",
  84. "import/no-amd": "error",
  85. "import/first": "error",
  86. // TODO: Consolidate duplicate imports in DatasetList and other files
  87. "import/no-duplicates": "warn",
  88. "import/newline-after-import": "error",
  89. "import/no-absolute-path": "error",
  90. "import/no-dynamic-require": "error",
  91. "import/no-webpack-loader-syntax": "error",
  92. "import/no-self-import": "error",
  93. "import/no-cycle": "off",
  94. "import/no-useless-path-segments": ["error", { "commonjs": true }],
  95. "import/prefer-default-export": "off",
  96. "import/no-relative-packages": "off",
  97. "import/no-import-module-exports": "off",
  98. "import/no-extraneous-dependencies": [
  99. "error",
  100. {
  101. "devDependencies": [
  102. "test/**",
  103. "tests/**",
  104. "spec/**",
  105. "**/__tests__/**",
  106. "**/__mocks__/**",
  107. "*.test.{js,jsx,ts,tsx}",
  108. "*.spec.{js,jsx,ts,tsx}",
  109. "**/*.test.{js,jsx,ts,tsx}",
  110. "**/*.spec.{js,jsx,ts,tsx}",
  111. "**/jest.config.js",
  112. "**/jest.setup.js",
  113. "**/webpack.config.js",
  114. "**/webpack.config.*.js",
  115. "**/.eslintrc.js"
  116. ],
  117. "optionalDependencies": false
  118. }
  119. ],
  120. // === React plugin rules ===
  121. "react/prop-types": "off",
  122. "react/require-default-props": "off",
  123. "react/forbid-prop-types": "off",
  124. "react/forbid-component-props": "warn",
  125. "react/jsx-filename-extension": [
  126. "warn",
  127. { "extensions": [".jsx", ".tsx"] }
  128. ],
  129. "react/jsx-fragments": ["warn", "syntax"],
  130. "react/jsx-no-bind": "off",
  131. "react/jsx-props-no-spreading": "off",
  132. "react/jsx-boolean-value": ["error", "never", { "always": [] }],
  133. "react/jsx-no-duplicate-props": ["error", { "ignoreCase": true }],
  134. "react/jsx-no-undef": "error",
  135. "react/jsx-pascal-case": ["error", { "allowAllCaps": true, "ignore": [] }],
  136. "react/jsx-uses-vars": "error",
  137. "react/jsx-no-target-blank": ["error", { "enforceDynamicLinks": "always" }],
  138. "react/jsx-no-comment-textnodes": "error",
  139. "react/jsx-no-useless-fragment": "off",
  140. "react/jsx-curly-brace-presence": [
  141. "error",
  142. { "props": "never", "children": "never" }
  143. ],
  144. "react/no-array-index-key": "off",
  145. "react/no-children-prop": "error",
  146. "react/no-danger": "warn",
  147. "react/no-danger-with-children": "error",
  148. "react/no-deprecated": "error",
  149. "react/no-did-update-set-state": "error",
  150. "react/no-find-dom-node": "error",
  151. "react/no-is-mounted": "error",
  152. "react/no-render-return-value": "error",
  153. "react/no-string-refs": "off",
  154. "react/no-unescaped-entities": "off",
  155. "react/no-unknown-property": "off",
  156. "react/no-unused-prop-types": "off",
  157. "react/no-unused-state": "error",
  158. "react/no-will-update-set-state": "error",
  159. "react/prefer-es6-class": ["error", "always"],
  160. "react/prefer-stateless-function": [
  161. "error",
  162. { "ignorePureComponents": true }
  163. ],
  164. "react/require-render-return": "error",
  165. "react/self-closing-comp": "error",
  166. "react/void-dom-elements-no-children": "error",
  167. "react/no-access-state-in-setstate": "error",
  168. "react/no-redundant-should-component-update": "error",
  169. "react/no-this-in-sfc": "error",
  170. "react/no-typos": "error",
  171. "react/no-unstable-nested-components": "off",
  172. "react/no-unused-class-component-methods": "off",
  173. "react/destructuring-assignment": "off",
  174. "react/sort-comp": "off",
  175. "react/state-in-constructor": "off",
  176. "react/static-property-placement": "off",
  177. "react/react-in-jsx-scope": "off",
  178. "react/function-component-definition": "off",
  179. "react/default-props-match-prop-types": "off",
  180. "react/button-has-type": [
  181. "error",
  182. { "button": true, "submit": true, "reset": false }
  183. ],
  184. // === React Hooks rules ===
  185. // TODO: Fix conditional hook usage and anonymous component issues
  186. "react-hooks/rules-of-hooks": "warn",
  187. "react-hooks/exhaustive-deps": "warn",
  188. // === JSX-a11y rules ===
  189. "jsx-a11y/alt-text": "error",
  190. "jsx-a11y/anchor-has-content": "error",
  191. "jsx-a11y/anchor-is-valid": "warn",
  192. "jsx-a11y/aria-activedescendant-has-tabindex": "error",
  193. "jsx-a11y/aria-props": "error",
  194. "jsx-a11y/aria-proptypes": "error",
  195. "jsx-a11y/aria-role": ["error", { "ignoreNonDOM": false }],
  196. "jsx-a11y/aria-unsupported-elements": "error",
  197. "jsx-a11y/click-events-have-key-events": "off",
  198. "jsx-a11y/heading-has-content": "error",
  199. "jsx-a11y/html-has-lang": "error",
  200. "jsx-a11y/iframe-has-title": "error",
  201. "jsx-a11y/img-redundant-alt": "error",
  202. "jsx-a11y/interactive-supports-focus": "error",
  203. "jsx-a11y/label-has-associated-control": "error",
  204. "jsx-a11y/lang": "error",
  205. "jsx-a11y/media-has-caption": "error",
  206. "jsx-a11y/mouse-events-have-key-events": "off",
  207. "jsx-a11y/no-access-key": "error",
  208. "jsx-a11y/no-autofocus": ["error", { "ignoreNonDOM": true }],
  209. "jsx-a11y/no-distracting-elements": "error",
  210. "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
  211. "jsx-a11y/no-noninteractive-element-interactions": "error",
  212. "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
  213. "jsx-a11y/no-noninteractive-tabindex": "error",
  214. "jsx-a11y/no-redundant-roles": "error",
  215. "jsx-a11y/no-static-element-interactions": "off",
  216. // TODO: Fix missing aria-selected on tab roles
  217. "jsx-a11y/role-has-required-aria-props": "warn",
  218. "jsx-a11y/role-supports-aria-props": "error",
  219. "jsx-a11y/scope": "error",
  220. "jsx-a11y/tabindex-no-positive": "error",
  221. // === TypeScript rules ===
  222. "@typescript-eslint/ban-ts-comment": "off",
  223. "@typescript-eslint/ban-types": "off",
  224. "@typescript-eslint/no-empty-function": "off",
  225. "@typescript-eslint/no-explicit-any": "off",
  226. "@typescript-eslint/no-use-before-define": "warn",
  227. "@typescript-eslint/no-non-null-assertion": "off",
  228. "@typescript-eslint/explicit-function-return-type": "off",
  229. "@typescript-eslint/explicit-module-boundary-types": "off",
  230. "@typescript-eslint/no-unused-vars": "warn",
  231. "@typescript-eslint/prefer-optional-chain": "error",
  232. "@typescript-eslint/naming-convention": [
  233. "error",
  234. {
  235. "selector": "enum",
  236. "format": ["PascalCase"]
  237. },
  238. {
  239. "selector": "enumMember",
  240. "format": ["PascalCase"]
  241. }
  242. ],
  243. // === Unicorn rules (bonus coverage) ===
  244. "unicorn/filename-case": "off",
  245. "unicorn/prevent-abbreviations": "off",
  246. "unicorn/no-null": "off",
  247. "unicorn/no-array-reduce": "off",
  248. "unicorn/no-array-for-each": "off",
  249. "unicorn/prefer-module": "off",
  250. "unicorn/prefer-node-protocol": "off",
  251. "unicorn/no-useless-undefined": "off"
  252. },
  253. "ignorePatterns": [
  254. "*.test.{js,ts,jsx,tsx}",
  255. "*.spec.{js,ts,jsx,tsx}",
  256. "**/__tests__/**",
  257. "**/__mocks__/**",
  258. "**/test/**",
  259. "**/tests/**",
  260. "**/spec/**",
  261. "plugins/**/test/**/*",
  262. "packages/**/test/**/*",
  263. "packages/generator-superset/**/*",
  264. "cypress-base/**",
  265. "node_modules/**",
  266. "build/**",
  267. "dist/**",
  268. "lib/**",
  269. "esm/**",
  270. "*.min.js",
  271. "coverage/**",
  272. ".git/**",
  273. "**/*.config.js",
  274. "**/*.config.ts"
  275. ]
  276. }