.oxlintrc.json 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. {
  2. "$schema": "./node_modules/oxlint/configuration_schema.json",
  3. "plugins": ["typescript", "unicorn", "oxc", "react", "import", "promise"],
  4. "categories": {
  5. "correctness": "error"
  6. },
  7. "env": {
  8. "browser": true,
  9. "builtin": true,
  10. "es2024": true,
  11. "node": true
  12. },
  13. "ignorePatterns": [
  14. "node_modules",
  15. "dist",
  16. "build",
  17. "coverage",
  18. ".tanstack",
  19. ".eslintrc.cjs",
  20. "src/components/ui",
  21. "src/routeTree.gen.ts"
  22. ],
  23. "rules": {
  24. "curly": ["error", "multi-line"],
  25. "eqeqeq": [
  26. "error",
  27. "always",
  28. {
  29. "null": "ignore"
  30. }
  31. ],
  32. "import/first": "warn",
  33. "import/newline-after-import": "warn",
  34. "import/no-cycle": "error",
  35. "import/no-duplicates": [
  36. "error",
  37. {
  38. "preferInline": true
  39. }
  40. ],
  41. "import/no-unassigned-import": "off",
  42. "no-array-constructor": "error",
  43. "no-console": "warn",
  44. "no-duplicate-imports": "error",
  45. "no-nested-ternary": "error",
  46. "no-new-wrappers": "error",
  47. "no-regex-spaces": "error",
  48. "no-unsafe-finally": "warn",
  49. "no-unsafe-negation": "error",
  50. "no-unused-expressions": "warn",
  51. "no-unused-labels": "error",
  52. "no-unused-vars": [
  53. "warn",
  54. {
  55. "args": "all",
  56. "argsIgnorePattern": "^_",
  57. "caughtErrors": "all",
  58. "caughtErrorsIgnorePattern": "^_",
  59. "destructuredArrayIgnorePattern": "^_",
  60. "varsIgnorePattern": "^_",
  61. "ignoreRestSiblings": true
  62. }
  63. ],
  64. "no-useless-catch": "warn",
  65. "no-useless-computed-key": "error",
  66. "no-useless-escape": "warn",
  67. "no-useless-rename": "warn",
  68. "no-var": "warn",
  69. "object-shorthand": "warn",
  70. "oxc/const-comparisons": "error",
  71. "prefer-const": "warn",
  72. "prefer-object-has-own": "warn",
  73. "prefer-object-spread": "warn",
  74. "prefer-template": "warn",
  75. "promise/catch-or-return": "error",
  76. "promise/no-callback-in-promise": "error",
  77. "promise/no-new-statics": "error",
  78. "promise/no-return-wrap": "warn",
  79. "promise/valid-params": "warn",
  80. "react/button-has-type": "error",
  81. "react/checked-requires-onchange-or-readonly": "warn",
  82. "react/exhaustive-deps": "error",
  83. "react/iframe-missing-sandbox": "error",
  84. "react/jsx-boolean-value": "warn",
  85. "react/jsx-curly-brace-presence": "warn",
  86. "react/jsx-fragments": "warn",
  87. "react/jsx-key": "warn",
  88. "react/jsx-no-duplicate-props": "error",
  89. "react/jsx-no-target-blank": "warn",
  90. "react/jsx-no-undef": "error",
  91. "react/jsx-no-useless-fragment": "error",
  92. "react/jsx-props-no-spread-multi": "warn",
  93. "react/no-array-index-key": "error",
  94. "react/no-danger": "warn",
  95. "react/no-unknown-property": "warn",
  96. "react/no-unstable-nested-components": [
  97. "error",
  98. {
  99. "allowAsProps": true
  100. }
  101. ],
  102. "react/only-export-components": [
  103. "error",
  104. {
  105. "allowConstantExport": true,
  106. "allowExportNames": [
  107. "getAuthSectionNavItems",
  108. "getAuthSectionContent",
  109. "getAuthSectionMeta",
  110. "getBillingSectionNavItems",
  111. "getBillingSectionContent",
  112. "getBillingSectionMeta",
  113. "getContentSectionNavItems",
  114. "getContentSectionContent",
  115. "getContentSectionMeta",
  116. "getDashboardSectionNavItems",
  117. "getModelsSectionNavItems",
  118. "getModelsSectionContent",
  119. "getModelsSectionMeta",
  120. "getOperationsSectionNavItems",
  121. "getOperationsSectionContent",
  122. "getOperationsSectionMeta",
  123. "getSecuritySectionNavItems",
  124. "getSecuritySectionContent",
  125. "getSecuritySectionMeta",
  126. "getSiteSectionNavItems",
  127. "getSiteSectionContent",
  128. "getSiteSectionMeta",
  129. "getUsageLogsSectionNavItems",
  130. "isUsageLogsSectionId",
  131. "useSuppressSettingsSectionHeader"
  132. ]
  133. }
  134. ],
  135. "react/react-in-jsx-scope": "off",
  136. "react/rules-of-hooks": "warn",
  137. "react/self-closing-comp": "warn",
  138. "typescript/consistent-type-imports": [
  139. "error",
  140. {
  141. "prefer": "type-imports",
  142. "fixStyle": "inline-type-imports",
  143. "disallowTypeAnnotations": false
  144. }
  145. ],
  146. "typescript/no-duplicate-type-constituents": "error",
  147. "typescript/no-explicit-any": "warn",
  148. "typescript/no-extra-non-null-assertion": "error",
  149. "typescript/no-import-type-side-effects": "error",
  150. "typescript/no-non-null-assertion": "error",
  151. "typescript/no-require-imports": "error",
  152. "typescript/no-unnecessary-template-expression": "error",
  153. "typescript/no-unnecessary-type-arguments": "error",
  154. "typescript/no-unnecessary-type-assertion": "error",
  155. "typescript/no-useless-empty-export": "error",
  156. "typescript/no-wrapper-object-types": "error",
  157. "typescript/prefer-as-const": "error",
  158. "typescript/prefer-namespace-keyword": "error",
  159. "unicorn/no-single-promise-in-promise-methods": "error",
  160. "unicorn/no-unnecessary-await": "error",
  161. "unicorn/no-useless-fallback-in-spread": "warn",
  162. "unicorn/no-useless-length-check": "warn",
  163. "unicorn/no-useless-promise-resolve-reject": "warn",
  164. "unicorn/no-useless-spread": "error",
  165. "unicorn/prefer-add-event-listener": "warn",
  166. "unicorn/prefer-array-find": "warn",
  167. "unicorn/prefer-array-flat": "warn",
  168. "unicorn/prefer-array-flat-map": "warn",
  169. "unicorn/prefer-array-index-of": "warn",
  170. "unicorn/prefer-array-some": "warn",
  171. "unicorn/prefer-at": "error",
  172. "unicorn/prefer-date-now": "warn",
  173. "unicorn/prefer-includes": "warn",
  174. "unicorn/prefer-keyboard-event-key": "warn",
  175. "unicorn/prefer-modern-dom-apis": "warn",
  176. "unicorn/prefer-module": "warn",
  177. "unicorn/prefer-node-protocol": "warn",
  178. "unicorn/prefer-number-properties": "warn",
  179. "unicorn/prefer-object-from-entries": "warn",
  180. "unicorn/prefer-optional-catch-binding": "error",
  181. "unicorn/prefer-query-selector": "warn",
  182. "unicorn/prefer-regexp-test": "warn",
  183. "unicorn/prefer-set-has": "warn",
  184. "unicorn/prefer-spread": "error",
  185. "unicorn/prefer-string-replace-all": "error",
  186. "unicorn/prefer-string-slice": "warn",
  187. "unicorn/prefer-string-starts-ends-with": "warn",
  188. "unicorn/prefer-string-trim-start-end": "warn",
  189. "unicorn/prefer-structured-clone": "warn",
  190. "unicorn/throw-new-error": "error"
  191. },
  192. "overrides": [
  193. {
  194. "files": ["src/routes/**/*.{ts,tsx}"],
  195. "rules": {
  196. "react/only-export-components": "off"
  197. }
  198. },
  199. {
  200. "files": ["**/scripts/**/*.{js,mjs,cjs}"],
  201. "rules": {
  202. "no-console": "off",
  203. "prefer-node-protocol": "off"
  204. }
  205. }
  206. ]
  207. }