@stll/oxlint-config 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -20,6 +20,30 @@ const libraryPlugins = [
20
20
  "promise",
21
21
  "react"
22
22
  ];
23
+ const reactCompilerRules = {
24
+ "react/capitalized-calls": "error",
25
+ "react/error-boundaries": "error",
26
+ "react/exhaustive-effect-dependencies": "error",
27
+ "react/globals": "error",
28
+ "react/hooks": "error",
29
+ "react/immutability": "error",
30
+ "react/incompatible-library": "error",
31
+ "react/invariant": "off",
32
+ "react/memo-dependencies": "error",
33
+ "react/no-deriving-state-in-effects": "error",
34
+ "react/preserve-manual-memoization": "error",
35
+ "react/purity": "error",
36
+ "react/refs": "error",
37
+ "react/rule-suppression": "error",
38
+ "react/set-state-in-effect": "error",
39
+ "react/set-state-in-render": "error",
40
+ "react/static-components": "error",
41
+ "react/syntax": "error",
42
+ "react/todo": "off",
43
+ "react/unsupported-syntax": "error",
44
+ "react/use-memo": "error",
45
+ "react/void-use-memo": "error"
46
+ };
23
47
  const libraryRules = {
24
48
  "no-console": "off",
25
49
  "no-shadow": "error",
@@ -98,7 +122,7 @@ const libraryRules = {
98
122
  "react/no-unsafe": "off",
99
123
  "react/no-will-update-set-state": "off",
100
124
  "react/void-dom-elements-no-children": "off",
101
- "react/react-compiler": "error",
125
+ ...reactCompilerRules,
102
126
  "sort-keys": "off",
103
127
  "no-plusplus": "off",
104
128
  "no-inline-comments": "off",
@@ -158,6 +182,7 @@ exports.libraryOverrides = libraryOverrides;
158
182
  exports.libraryPlugins = libraryPlugins;
159
183
  exports.libraryRules = libraryRules;
160
184
  exports.noRawColorsPluginSpecifier = noRawColorsPluginSpecifier;
185
+ exports.reactCompilerRules = reactCompilerRules;
161
186
  exports.stellaLowercasePluginSpecifier = stellaLowercasePluginSpecifier;
162
187
 
163
188
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig, type OxlintConfig, type OxlintOverride } from \"oxlint\";\n\ntype Rules = NonNullable<OxlintConfig[\"rules\"]>;\ntype JsPlugins = NonNullable<OxlintConfig[\"jsPlugins\"]>;\ntype Options = NonNullable<OxlintConfig[\"options\"]>;\ntype Plugins = NonNullable<OxlintConfig[\"plugins\"]>;\n\nexport type LibraryOptions = {\n jsPlugins?: JsPlugins;\n ignorePatterns?: string[];\n options?: Options;\n overrides?: OxlintOverride[];\n plugins?: Plugins;\n rules?: Rules;\n};\n\nexport const stellaLowercasePluginSpecifier = \"@stll/oxlint-config/plugin\";\nexport const noRawColorsPluginSpecifier = \"@stll/oxlint-config/no-raw-colors\";\n\nexport const libraryIgnorePatterns = [\"node_modules/\", \"dist/\", \"coverage/\"];\n\n// Setting oxlint's `plugins` config replaces its built-in default list rather\n// than appending to it. This must stay in sync with every plugin-prefixed\n// rule below: `import/*` and `promise/*` rules are configured further down,\n// but oxlint disables both plugins unless they are listed here, which left\n// `import/no-cycle` and every `promise/*` rule silently unenforced. `react`\n// is enabled for `react/react-compiler`; see the comment on that rule for\n// why every other `react/*` rule is explicitly turned back off below.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\n \"react\",\n] satisfies Plugins;\n\nexport const libraryRules = {\n \"no-console\": \"off\",\n \"no-shadow\": \"error\",\n \"require-await\": \"error\",\n \"no-useless-catch\": \"error\",\n \"no-non-null-assertion\": \"error\",\n \"no-useless-assignment\": \"error\",\n \"no-loop-func\": \"error\",\n \"no-nested-ternary\": \"error\",\n \"no-void\": [\"error\", { allowAsStatement: true }],\n // Callback expressions should stay lexically scoped; avoids accidental `this` rebinding.\n \"prefer-arrow-callback\": \"error\",\n \"stella-lowercase/stella-lowercase\": \"error\",\n \"no-raw-colors/no-raw-colors\": \"error\",\n\n // Spreading into an accumulator on every loop iteration is O(n^2); push/concat instead.\n \"oxc/no-accumulating-spread\": \"error\",\n // Spreading inside `.map()` allocates a new array per callback invocation; push instead.\n \"oxc/no-map-spread\": \"error\",\n // Flags `if`/`switch` branches with identical bodies: likely dead logic or a missed merge.\n \"oxc/branches-sharing-code\": \"error\",\n\n \"typescript/no-explicit-any\": \"error\",\n \"typescript/no-dynamic-delete\": \"error\",\n \"typescript/no-misused-promises\": [\n \"error\",\n { checksVoidReturn: { attributes: false } },\n ],\n \"typescript/consistent-type-definitions\": [\"error\", \"type\"],\n \"typescript/consistent-return\": \"error\",\n \"typescript/dot-notation\": \"error\",\n \"typescript/no-inferrable-types\": \"off\",\n \"typescript/no-unnecessary-type-conversion\": \"error\",\n \"typescript/no-unnecessary-condition\": [\n \"error\",\n { allowConstantLoopConditions: \"only-allowed-literals\" },\n ],\n \"typescript/no-unnecessary-type-arguments\": \"error\",\n \"typescript/switch-exhaustiveness-check\": [\n \"error\",\n { considerDefaultExhaustiveForUnions: true },\n ],\n \"typescript/strict-boolean-expressions\": [\n \"error\",\n { allowNullableString: true, allowNullableBoolean: true },\n ],\n \"typescript/no-confusing-void-expression\": [\n \"error\",\n { ignoreArrowShorthand: true, ignoreVoidReturningFunctions: true },\n ],\n \"typescript/prefer-nullish-coalescing\": [\n \"error\",\n { ignorePrimitives: { string: true, boolean: true } },\n ],\n \"typescript/only-throw-error\": \"error\",\n \"typescript/return-await\": [\"error\", \"error-handling-correctness-only\"],\n\n \"unicorn/no-useless-undefined\": \"off\",\n \"unicorn/prefer-array-find\": \"error\",\n \"unicorn/prefer-at\": \"error\",\n \"unicorn/prefer-set-has\": \"error\",\n \"unicorn/filename-case\": \"off\",\n \"unicorn/consistent-function-scoping\": \"off\",\n \"unicorn/prefer-ternary\": \"off\",\n \"unicorn/no-array-reduce\": \"error\",\n \"unicorn/no-nested-ternary\": \"off\",\n // `Array.from({ length }).fill(obj)` shares one reference across every slot.\n \"unicorn/no-array-fill-with-reference-type\": \"error\",\n\n \"import/no-cycle\": \"error\",\n \"import/consistent-type-specifier-style\": \"off\",\n // Keep a blank line after the import block so it stays visually separate from module body.\n \"import/newline-after-import\": \"error\",\n\n \"promise/always-return\": \"error\",\n \"promise/no-return-in-finally\": \"error\",\n \"promise/prefer-await-to-then\": \"off\",\n \"promise/prefer-await-to-callbacks\": \"off\",\n \"promise/avoid-new\": \"off\",\n\n // Enabling the `react` plugin (above) turns on its whole correctness-category\n // rule set at \"warn\" by default, not just react-compiler. Only react-compiler\n // is a deliberate addition here, so the rest are turned off to keep this\n // package's blast radius scoped to the one rule being added; lift any of\n // these independently if a future change wants them.\n \"react/exhaustive-deps\": \"off\",\n \"react/forward-ref-uses-ref\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": \"off\",\n \"react/jsx-no-undef\": \"off\",\n \"react/jsx-props-no-spread-multi\": \"off\",\n \"react/no-children-prop\": \"off\",\n \"react/no-danger-with-children\": \"off\",\n \"react/no-did-mount-set-state\": \"off\",\n \"react/no-did-update-set-state\": \"off\",\n \"react/no-direct-mutation-state\": \"off\",\n \"react/no-find-dom-node\": \"off\",\n \"react/no-is-mounted\": \"off\",\n \"react/no-render-return-value\": \"off\",\n \"react/no-string-refs\": \"off\",\n \"react/no-this-in-sfc\": \"off\",\n \"react/no-unsafe\": \"off\",\n \"react/no-will-update-set-state\": \"off\",\n \"react/void-dom-elements-no-children\": \"off\",\n // Requires oxlint >= 1.70. Nursery rule upstream: flags violations of the\n // Rules of React that block compiler memoization; diagnostics may shift\n // between oxlint minors, so re-audit findings after bumping the oxlint\n // devDependency. oxlint has no bulk-suppression/baseline mechanism as of\n // 1.72.0 (oxc-project/oxc#10549 tracks the upstream feature request and is\n // still open); consumers adopting this against an existing findings\n // backlog should carve out temporary `overrides` entries per legacy path\n // (or per rule, at `\"off\"`) and fix forward, rather than expecting a\n // generated suppression file.\n \"react/react-compiler\": \"error\",\n\n \"sort-keys\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-inline-comments\": \"off\",\n \"max-statements\": \"off\",\n \"prefer-destructuring\": \"off\",\n \"no-negated-condition\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-warning-comments\": \"off\",\n \"no-unexpected-multiline\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"class-methods-use-this\": \"off\",\n \"no-unmodified-loop-condition\": \"off\",\n complexity: \"off\",\n \"func-style\": \"off\",\n \"func-names\": \"off\",\n \"default-case\": \"off\",\n} satisfies Rules;\n\nexport const libraryOverrides = [\n {\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\", \"__test__/**\", \"__tests__/**\"],\n rules: {\n \"no-console\": \"off\",\n \"require-await\": \"off\",\n \"no-non-null-assertion\": \"off\",\n },\n },\n] satisfies OxlintOverride[];\n\nexport const library = (options: LibraryOptions = {}): OxlintConfig =>\n defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(\n new Set([...libraryPlugins, ...(options.plugins ?? [])]),\n ),\n jsPlugins: [\n stellaLowercasePluginSpecifier,\n noRawColorsPluginSpecifier,\n ...(options.jsPlugins ?? []),\n ],\n ignorePatterns: [\n ...libraryIgnorePatterns,\n ...(options.ignorePatterns ?? []),\n ],\n rules: {\n ...libraryRules,\n ...options.rules,\n },\n overrides: [...libraryOverrides, ...(options.overrides ?? [])],\n });\n\nexport default library();\n"],"mappings":";;;;;;AAgBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;CAAiB;CAAS;AAAW;AAS3E,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,eAAe;CAC1B,cAAc;CACd,aAAa;CACb,iBAAiB;CACjB,oBAAoB;CACpB,yBAAyB;CACzB,yBAAyB;CACzB,gBAAgB;CAChB,qBAAqB;CACrB,WAAW,CAAC,SAAS,EAAE,kBAAkB,KAAK,CAAC;CAE/C,yB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AAa;CACb,eAAe;CACf,sBAAsB;CACtB,kBAAkB;CAClB,wBAAwB;CACxB,wBAAwB;CACxB,wBAAwB;CACxB,qBAAqB;CACrB,uBAAuB;CACvB,2BAA2B;CAC3B,wBAAwB;CACxB,0BAA0B;CAC1B,gCAAgC;CAChC,YAAY;CACZ,cAAc;CACd,cAAc;CACd,gBAAgB;AAClB;AAEA,MAAa,mBAAmB,CAC9B;CACE,OAAO;EAAC;EAAoC;EAAe;CAAc;CACzE,OAAO;EACL,cAAc;EACd,iBAAiB;EACjB,yBAAyB;CAC3B;AACF,CACF;AAEA,MAAa,WAAW,UAA0B,CAAC,OAAA,GAAA,OAAA,aAAA,CACpC;CACX,SAAS;EACP,cAAc;EACd,+BAA+B;EAC/B,WAAW;EACX,GAAG,QAAQ;CACb;CACA,SAAS,MAAM,qBACb,IAAI,IAAI,CAAC,GAAG,gBAAgB,GAAI,QAAQ,WAAW,CAAC,CAAE,CAAC,CACzD;CACA,WAAW;EACT;EACA;EACA,GAAI,QAAQ,aAAa,CAAC;CAC5B;CACA,gBAAgB,CACd,GAAG,uBACH,GAAI,QAAQ,kBAAkB,CAAC,CACjC;CACA,OAAO;EACL,GAAG;EACH,GAAG,QAAQ;CACb;CACA,WAAW,CAAC,GAAG,kBAAkB,GAAI,QAAQ,aAAa,CAAC,CAAE;AAC/D,CAAC;AAEH,IAAA,cAAe,QAAQ"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig, type OxlintConfig, type OxlintOverride } from \"oxlint\";\n\ntype Rules = NonNullable<OxlintConfig[\"rules\"]>;\ntype JsPlugins = NonNullable<OxlintConfig[\"jsPlugins\"]>;\ntype Options = NonNullable<OxlintConfig[\"options\"]>;\ntype Plugins = NonNullable<OxlintConfig[\"plugins\"]>;\n\nexport type LibraryOptions = {\n jsPlugins?: JsPlugins;\n ignorePatterns?: string[];\n options?: Options;\n overrides?: OxlintOverride[];\n plugins?: Plugins;\n rules?: Rules;\n};\n\nexport const stellaLowercasePluginSpecifier = \"@stll/oxlint-config/plugin\";\nexport const noRawColorsPluginSpecifier = \"@stll/oxlint-config/no-raw-colors\";\n\nexport const libraryIgnorePatterns = [\"node_modules/\", \"dist/\", \"coverage/\"];\n\n// Setting oxlint's `plugins` config replaces its built-in default list rather\n// than appending to it. This must stay in sync with every plugin-prefixed\n// rule below: `import/*` and `promise/*` rules are configured further down,\n// but oxlint disables both plugins unless they are listed here, which left\n// `import/no-cycle` and every `promise/*` rule silently unenforced. `react`\n// is enabled for the React Compiler category rules; see the comment on that\n// ruleset for why every other `react/*` rule is explicitly turned back off.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\n \"react\",\n] satisfies Plugins;\n\n// Oxlint 1.80 replaced react/react-compiler with category-specific rules.\n// Keep the actionable compiler diagnostics strict while excluding internal\n// invariant and unfinished-feature reports that do not identify source bugs.\nexport const reactCompilerRules = {\n \"react/capitalized-calls\": \"error\",\n \"react/error-boundaries\": \"error\",\n \"react/exhaustive-effect-dependencies\": \"error\",\n \"react/globals\": \"error\",\n \"react/hooks\": \"error\",\n \"react/immutability\": \"error\",\n \"react/incompatible-library\": \"error\",\n \"react/invariant\": \"off\",\n \"react/memo-dependencies\": \"error\",\n \"react/no-deriving-state-in-effects\": \"error\",\n \"react/preserve-manual-memoization\": \"error\",\n \"react/purity\": \"error\",\n \"react/refs\": \"error\",\n \"react/rule-suppression\": \"error\",\n \"react/set-state-in-effect\": \"error\",\n \"react/set-state-in-render\": \"error\",\n \"react/static-components\": \"error\",\n \"react/syntax\": \"error\",\n \"react/todo\": \"off\",\n \"react/unsupported-syntax\": \"error\",\n \"react/use-memo\": \"error\",\n \"react/void-use-memo\": \"error\",\n} satisfies Rules;\n\nexport const libraryRules = {\n \"no-console\": \"off\",\n \"no-shadow\": \"error\",\n \"require-await\": \"error\",\n \"no-useless-catch\": \"error\",\n \"no-non-null-assertion\": \"error\",\n \"no-useless-assignment\": \"error\",\n \"no-loop-func\": \"error\",\n \"no-nested-ternary\": \"error\",\n \"no-void\": [\"error\", { allowAsStatement: true }],\n // Callback expressions should stay lexically scoped; avoids accidental `this` rebinding.\n \"prefer-arrow-callback\": \"error\",\n \"stella-lowercase/stella-lowercase\": \"error\",\n \"no-raw-colors/no-raw-colors\": \"error\",\n\n // Spreading into an accumulator on every loop iteration is O(n^2); push/concat instead.\n \"oxc/no-accumulating-spread\": \"error\",\n // Spreading inside `.map()` allocates a new array per callback invocation; push instead.\n \"oxc/no-map-spread\": \"error\",\n // Flags `if`/`switch` branches with identical bodies: likely dead logic or a missed merge.\n \"oxc/branches-sharing-code\": \"error\",\n\n \"typescript/no-explicit-any\": \"error\",\n \"typescript/no-dynamic-delete\": \"error\",\n \"typescript/no-misused-promises\": [\n \"error\",\n { checksVoidReturn: { attributes: false } },\n ],\n \"typescript/consistent-type-definitions\": [\"error\", \"type\"],\n \"typescript/consistent-return\": \"error\",\n \"typescript/dot-notation\": \"error\",\n \"typescript/no-inferrable-types\": \"off\",\n \"typescript/no-unnecessary-type-conversion\": \"error\",\n \"typescript/no-unnecessary-condition\": [\n \"error\",\n { allowConstantLoopConditions: \"only-allowed-literals\" },\n ],\n \"typescript/no-unnecessary-type-arguments\": \"error\",\n \"typescript/switch-exhaustiveness-check\": [\n \"error\",\n { considerDefaultExhaustiveForUnions: true },\n ],\n \"typescript/strict-boolean-expressions\": [\n \"error\",\n { allowNullableString: true, allowNullableBoolean: true },\n ],\n \"typescript/no-confusing-void-expression\": [\n \"error\",\n { ignoreArrowShorthand: true, ignoreVoidReturningFunctions: true },\n ],\n \"typescript/prefer-nullish-coalescing\": [\n \"error\",\n { ignorePrimitives: { string: true, boolean: true } },\n ],\n \"typescript/only-throw-error\": \"error\",\n \"typescript/return-await\": [\"error\", \"error-handling-correctness-only\"],\n\n \"unicorn/no-useless-undefined\": \"off\",\n \"unicorn/prefer-array-find\": \"error\",\n \"unicorn/prefer-at\": \"error\",\n \"unicorn/prefer-set-has\": \"error\",\n \"unicorn/filename-case\": \"off\",\n \"unicorn/consistent-function-scoping\": \"off\",\n \"unicorn/prefer-ternary\": \"off\",\n \"unicorn/no-array-reduce\": \"error\",\n \"unicorn/no-nested-ternary\": \"off\",\n // `Array.from({ length }).fill(obj)` shares one reference across every slot.\n \"unicorn/no-array-fill-with-reference-type\": \"error\",\n\n \"import/no-cycle\": \"error\",\n \"import/consistent-type-specifier-style\": \"off\",\n // Keep a blank line after the import block so it stays visually separate from module body.\n \"import/newline-after-import\": \"error\",\n\n \"promise/always-return\": \"error\",\n \"promise/no-return-in-finally\": \"error\",\n \"promise/prefer-await-to-then\": \"off\",\n \"promise/prefer-await-to-callbacks\": \"off\",\n \"promise/avoid-new\": \"off\",\n\n // Enabling the `react` plugin (above) turns on its whole correctness-category\n // rule set at \"warn\" by default, not just the React Compiler categories.\n // Only the compiler categories are deliberate additions here, so the rest\n // are turned off to keep this package's blast radius scoped; lift any of\n // these independently if a future change wants them.\n \"react/exhaustive-deps\": \"off\",\n \"react/forward-ref-uses-ref\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": \"off\",\n \"react/jsx-no-undef\": \"off\",\n \"react/jsx-props-no-spread-multi\": \"off\",\n \"react/no-children-prop\": \"off\",\n \"react/no-danger-with-children\": \"off\",\n \"react/no-did-mount-set-state\": \"off\",\n \"react/no-did-update-set-state\": \"off\",\n \"react/no-direct-mutation-state\": \"off\",\n \"react/no-find-dom-node\": \"off\",\n \"react/no-is-mounted\": \"off\",\n \"react/no-render-return-value\": \"off\",\n \"react/no-string-refs\": \"off\",\n \"react/no-this-in-sfc\": \"off\",\n \"react/no-unsafe\": \"off\",\n \"react/no-will-update-set-state\": \"off\",\n \"react/void-dom-elements-no-children\": \"off\",\n ...reactCompilerRules,\n\n \"sort-keys\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-inline-comments\": \"off\",\n \"max-statements\": \"off\",\n \"prefer-destructuring\": \"off\",\n \"no-negated-condition\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-warning-comments\": \"off\",\n \"no-unexpected-multiline\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"class-methods-use-this\": \"off\",\n \"no-unmodified-loop-condition\": \"off\",\n complexity: \"off\",\n \"func-style\": \"off\",\n \"func-names\": \"off\",\n \"default-case\": \"off\",\n} satisfies Rules;\n\nexport const libraryOverrides = [\n {\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\", \"__test__/**\", \"__tests__/**\"],\n rules: {\n \"no-console\": \"off\",\n \"require-await\": \"off\",\n \"no-non-null-assertion\": \"off\",\n },\n },\n] satisfies OxlintOverride[];\n\nexport const library = (options: LibraryOptions = {}): OxlintConfig =>\n defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(\n new Set([...libraryPlugins, ...(options.plugins ?? [])]),\n ),\n jsPlugins: [\n stellaLowercasePluginSpecifier,\n noRawColorsPluginSpecifier,\n ...(options.jsPlugins ?? []),\n ],\n ignorePatterns: [\n ...libraryIgnorePatterns,\n ...(options.ignorePatterns ?? []),\n ],\n rules: {\n ...libraryRules,\n ...options.rules,\n },\n overrides: [...libraryOverrides, ...(options.overrides ?? [])],\n });\n\nexport default library();\n"],"mappings":";;;;;;AAgBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;CAAiB;CAAS;AAAW;AAS3E,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAa,qBAAqB;CAChC,2BAA2B;CAC3B,0BAA0B;CAC1B,wCAAwC;CACxC,iBAAiB;CACjB,eAAe;CACf,sBAAsB;CACtB,8BAA8B;CAC9B,mBAAmB;CACnB,2BAA2B;CAC3B,sCAAsC;CACtC,qCAAqC;CACrC,gBAAgB;CAChB,cAAc;CACd,0BAA0B;C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@stll/oxlint-config/plugin";
16
16
  declare const noRawColorsPluginSpecifier = "@stll/oxlint-config/no-raw-colors";
17
17
  declare const libraryIgnorePatterns: string[];
18
18
  declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "react" | "typescript" | "unicorn")[];
19
+ declare const reactCompilerRules: {
20
+ "react/capitalized-calls": "error";
21
+ "react/error-boundaries": "error";
22
+ "react/exhaustive-effect-dependencies": "error";
23
+ "react/globals": "error";
24
+ "react/hooks": "error";
25
+ "react/immutability": "error";
26
+ "react/incompatible-library": "error";
27
+ "react/invariant": "off";
28
+ "react/memo-dependencies": "error";
29
+ "react/no-deriving-state-in-effects": "error";
30
+ "react/preserve-manual-memoization": "error";
31
+ "react/purity": "error";
32
+ "react/refs": "error";
33
+ "react/rule-suppression": "error";
34
+ "react/set-state-in-effect": "error";
35
+ "react/set-state-in-render": "error";
36
+ "react/static-components": "error";
37
+ "react/syntax": "error";
38
+ "react/todo": "off";
39
+ "react/unsupported-syntax": "error";
40
+ "react/use-memo": "error";
41
+ "react/void-use-memo": "error";
42
+ };
19
43
  declare const libraryRules: {
44
+ "react/capitalized-calls": "error";
45
+ "react/error-boundaries": "error";
46
+ "react/exhaustive-effect-dependencies": "error";
47
+ "react/globals": "error";
48
+ "react/hooks": "error";
49
+ "react/immutability": "error";
50
+ "react/incompatible-library": "error";
51
+ "react/invariant": "off";
52
+ "react/memo-dependencies": "error";
53
+ "react/no-deriving-state-in-effects": "error";
54
+ "react/preserve-manual-memoization": "error";
55
+ "react/purity": "error";
56
+ "react/refs": "error";
57
+ "react/rule-suppression": "error";
58
+ "react/set-state-in-effect": "error";
59
+ "react/set-state-in-render": "error";
60
+ "react/static-components": "error";
61
+ "react/syntax": "error";
62
+ "react/todo": "off";
63
+ "react/unsupported-syntax": "error";
64
+ "react/use-memo": "error";
65
+ "react/void-use-memo": "error";
20
66
  "no-console": "off";
21
67
  "no-shadow": "error";
22
68
  "require-await": "error";
@@ -106,7 +152,6 @@ declare const libraryRules: {
106
152
  "react/no-unsafe": "off";
107
153
  "react/no-will-update-set-state": "off";
108
154
  "react/void-dom-elements-no-children": "off";
109
- "react/react-compiler": "error";
110
155
  "sort-keys": "off";
111
156
  "no-plusplus": "off";
112
157
  "no-inline-comments": "off";
@@ -136,5 +181,5 @@ declare const libraryOverrides: {
136
181
  declare const library: (options?: LibraryOptions) => OxlintConfig;
137
182
  declare const _default: OxlintConfig;
138
183
  //#endregion
139
- export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, stellaLowercasePluginSpecifier };
184
+ export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
140
185
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -16,7 +16,53 @@ declare const stellaLowercasePluginSpecifier = "@stll/oxlint-config/plugin";
16
16
  declare const noRawColorsPluginSpecifier = "@stll/oxlint-config/no-raw-colors";
17
17
  declare const libraryIgnorePatterns: string[];
18
18
  declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "react" | "typescript" | "unicorn")[];
19
+ declare const reactCompilerRules: {
20
+ "react/capitalized-calls": "error";
21
+ "react/error-boundaries": "error";
22
+ "react/exhaustive-effect-dependencies": "error";
23
+ "react/globals": "error";
24
+ "react/hooks": "error";
25
+ "react/immutability": "error";
26
+ "react/incompatible-library": "error";
27
+ "react/invariant": "off";
28
+ "react/memo-dependencies": "error";
29
+ "react/no-deriving-state-in-effects": "error";
30
+ "react/preserve-manual-memoization": "error";
31
+ "react/purity": "error";
32
+ "react/refs": "error";
33
+ "react/rule-suppression": "error";
34
+ "react/set-state-in-effect": "error";
35
+ "react/set-state-in-render": "error";
36
+ "react/static-components": "error";
37
+ "react/syntax": "error";
38
+ "react/todo": "off";
39
+ "react/unsupported-syntax": "error";
40
+ "react/use-memo": "error";
41
+ "react/void-use-memo": "error";
42
+ };
19
43
  declare const libraryRules: {
44
+ "react/capitalized-calls": "error";
45
+ "react/error-boundaries": "error";
46
+ "react/exhaustive-effect-dependencies": "error";
47
+ "react/globals": "error";
48
+ "react/hooks": "error";
49
+ "react/immutability": "error";
50
+ "react/incompatible-library": "error";
51
+ "react/invariant": "off";
52
+ "react/memo-dependencies": "error";
53
+ "react/no-deriving-state-in-effects": "error";
54
+ "react/preserve-manual-memoization": "error";
55
+ "react/purity": "error";
56
+ "react/refs": "error";
57
+ "react/rule-suppression": "error";
58
+ "react/set-state-in-effect": "error";
59
+ "react/set-state-in-render": "error";
60
+ "react/static-components": "error";
61
+ "react/syntax": "error";
62
+ "react/todo": "off";
63
+ "react/unsupported-syntax": "error";
64
+ "react/use-memo": "error";
65
+ "react/void-use-memo": "error";
20
66
  "no-console": "off";
21
67
  "no-shadow": "error";
22
68
  "require-await": "error";
@@ -106,7 +152,6 @@ declare const libraryRules: {
106
152
  "react/no-unsafe": "off";
107
153
  "react/no-will-update-set-state": "off";
108
154
  "react/void-dom-elements-no-children": "off";
109
- "react/react-compiler": "error";
110
155
  "sort-keys": "off";
111
156
  "no-plusplus": "off";
112
157
  "no-inline-comments": "off";
@@ -136,5 +181,5 @@ declare const libraryOverrides: {
136
181
  declare const library: (options?: LibraryOptions) => OxlintConfig;
137
182
  declare const _default: OxlintConfig;
138
183
  //#endregion
139
- export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, stellaLowercasePluginSpecifier };
184
+ export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
140
185
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -16,6 +16,30 @@ const libraryPlugins = [
16
16
  "promise",
17
17
  "react"
18
18
  ];
19
+ const reactCompilerRules = {
20
+ "react/capitalized-calls": "error",
21
+ "react/error-boundaries": "error",
22
+ "react/exhaustive-effect-dependencies": "error",
23
+ "react/globals": "error",
24
+ "react/hooks": "error",
25
+ "react/immutability": "error",
26
+ "react/incompatible-library": "error",
27
+ "react/invariant": "off",
28
+ "react/memo-dependencies": "error",
29
+ "react/no-deriving-state-in-effects": "error",
30
+ "react/preserve-manual-memoization": "error",
31
+ "react/purity": "error",
32
+ "react/refs": "error",
33
+ "react/rule-suppression": "error",
34
+ "react/set-state-in-effect": "error",
35
+ "react/set-state-in-render": "error",
36
+ "react/static-components": "error",
37
+ "react/syntax": "error",
38
+ "react/todo": "off",
39
+ "react/unsupported-syntax": "error",
40
+ "react/use-memo": "error",
41
+ "react/void-use-memo": "error"
42
+ };
19
43
  const libraryRules = {
20
44
  "no-console": "off",
21
45
  "no-shadow": "error",
@@ -94,7 +118,7 @@ const libraryRules = {
94
118
  "react/no-unsafe": "off",
95
119
  "react/no-will-update-set-state": "off",
96
120
  "react/void-dom-elements-no-children": "off",
97
- "react/react-compiler": "error",
121
+ ...reactCompilerRules,
98
122
  "sort-keys": "off",
99
123
  "no-plusplus": "off",
100
124
  "no-inline-comments": "off",
@@ -147,6 +171,6 @@ const library = (options = {}) => defineConfig({
147
171
  });
148
172
  var src_default = library();
149
173
  //#endregion
150
- export { src_default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, stellaLowercasePluginSpecifier };
174
+ export { src_default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
151
175
 
152
176
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig, type OxlintConfig, type OxlintOverride } from \"oxlint\";\n\ntype Rules = NonNullable<OxlintConfig[\"rules\"]>;\ntype JsPlugins = NonNullable<OxlintConfig[\"jsPlugins\"]>;\ntype Options = NonNullable<OxlintConfig[\"options\"]>;\ntype Plugins = NonNullable<OxlintConfig[\"plugins\"]>;\n\nexport type LibraryOptions = {\n jsPlugins?: JsPlugins;\n ignorePatterns?: string[];\n options?: Options;\n overrides?: OxlintOverride[];\n plugins?: Plugins;\n rules?: Rules;\n};\n\nexport const stellaLowercasePluginSpecifier = \"@stll/oxlint-config/plugin\";\nexport const noRawColorsPluginSpecifier = \"@stll/oxlint-config/no-raw-colors\";\n\nexport const libraryIgnorePatterns = [\"node_modules/\", \"dist/\", \"coverage/\"];\n\n// Setting oxlint's `plugins` config replaces its built-in default list rather\n// than appending to it. This must stay in sync with every plugin-prefixed\n// rule below: `import/*` and `promise/*` rules are configured further down,\n// but oxlint disables both plugins unless they are listed here, which left\n// `import/no-cycle` and every `promise/*` rule silently unenforced. `react`\n// is enabled for `react/react-compiler`; see the comment on that rule for\n// why every other `react/*` rule is explicitly turned back off below.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\n \"react\",\n] satisfies Plugins;\n\nexport const libraryRules = {\n \"no-console\": \"off\",\n \"no-shadow\": \"error\",\n \"require-await\": \"error\",\n \"no-useless-catch\": \"error\",\n \"no-non-null-assertion\": \"error\",\n \"no-useless-assignment\": \"error\",\n \"no-loop-func\": \"error\",\n \"no-nested-ternary\": \"error\",\n \"no-void\": [\"error\", { allowAsStatement: true }],\n // Callback expressions should stay lexically scoped; avoids accidental `this` rebinding.\n \"prefer-arrow-callback\": \"error\",\n \"stella-lowercase/stella-lowercase\": \"error\",\n \"no-raw-colors/no-raw-colors\": \"error\",\n\n // Spreading into an accumulator on every loop iteration is O(n^2); push/concat instead.\n \"oxc/no-accumulating-spread\": \"error\",\n // Spreading inside `.map()` allocates a new array per callback invocation; push instead.\n \"oxc/no-map-spread\": \"error\",\n // Flags `if`/`switch` branches with identical bodies: likely dead logic or a missed merge.\n \"oxc/branches-sharing-code\": \"error\",\n\n \"typescript/no-explicit-any\": \"error\",\n \"typescript/no-dynamic-delete\": \"error\",\n \"typescript/no-misused-promises\": [\n \"error\",\n { checksVoidReturn: { attributes: false } },\n ],\n \"typescript/consistent-type-definitions\": [\"error\", \"type\"],\n \"typescript/consistent-return\": \"error\",\n \"typescript/dot-notation\": \"error\",\n \"typescript/no-inferrable-types\": \"off\",\n \"typescript/no-unnecessary-type-conversion\": \"error\",\n \"typescript/no-unnecessary-condition\": [\n \"error\",\n { allowConstantLoopConditions: \"only-allowed-literals\" },\n ],\n \"typescript/no-unnecessary-type-arguments\": \"error\",\n \"typescript/switch-exhaustiveness-check\": [\n \"error\",\n { considerDefaultExhaustiveForUnions: true },\n ],\n \"typescript/strict-boolean-expressions\": [\n \"error\",\n { allowNullableString: true, allowNullableBoolean: true },\n ],\n \"typescript/no-confusing-void-expression\": [\n \"error\",\n { ignoreArrowShorthand: true, ignoreVoidReturningFunctions: true },\n ],\n \"typescript/prefer-nullish-coalescing\": [\n \"error\",\n { ignorePrimitives: { string: true, boolean: true } },\n ],\n \"typescript/only-throw-error\": \"error\",\n \"typescript/return-await\": [\"error\", \"error-handling-correctness-only\"],\n\n \"unicorn/no-useless-undefined\": \"off\",\n \"unicorn/prefer-array-find\": \"error\",\n \"unicorn/prefer-at\": \"error\",\n \"unicorn/prefer-set-has\": \"error\",\n \"unicorn/filename-case\": \"off\",\n \"unicorn/consistent-function-scoping\": \"off\",\n \"unicorn/prefer-ternary\": \"off\",\n \"unicorn/no-array-reduce\": \"error\",\n \"unicorn/no-nested-ternary\": \"off\",\n // `Array.from({ length }).fill(obj)` shares one reference across every slot.\n \"unicorn/no-array-fill-with-reference-type\": \"error\",\n\n \"import/no-cycle\": \"error\",\n \"import/consistent-type-specifier-style\": \"off\",\n // Keep a blank line after the import block so it stays visually separate from module body.\n \"import/newline-after-import\": \"error\",\n\n \"promise/always-return\": \"error\",\n \"promise/no-return-in-finally\": \"error\",\n \"promise/prefer-await-to-then\": \"off\",\n \"promise/prefer-await-to-callbacks\": \"off\",\n \"promise/avoid-new\": \"off\",\n\n // Enabling the `react` plugin (above) turns on its whole correctness-category\n // rule set at \"warn\" by default, not just react-compiler. Only react-compiler\n // is a deliberate addition here, so the rest are turned off to keep this\n // package's blast radius scoped to the one rule being added; lift any of\n // these independently if a future change wants them.\n \"react/exhaustive-deps\": \"off\",\n \"react/forward-ref-uses-ref\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": \"off\",\n \"react/jsx-no-undef\": \"off\",\n \"react/jsx-props-no-spread-multi\": \"off\",\n \"react/no-children-prop\": \"off\",\n \"react/no-danger-with-children\": \"off\",\n \"react/no-did-mount-set-state\": \"off\",\n \"react/no-did-update-set-state\": \"off\",\n \"react/no-direct-mutation-state\": \"off\",\n \"react/no-find-dom-node\": \"off\",\n \"react/no-is-mounted\": \"off\",\n \"react/no-render-return-value\": \"off\",\n \"react/no-string-refs\": \"off\",\n \"react/no-this-in-sfc\": \"off\",\n \"react/no-unsafe\": \"off\",\n \"react/no-will-update-set-state\": \"off\",\n \"react/void-dom-elements-no-children\": \"off\",\n // Requires oxlint >= 1.70. Nursery rule upstream: flags violations of the\n // Rules of React that block compiler memoization; diagnostics may shift\n // between oxlint minors, so re-audit findings after bumping the oxlint\n // devDependency. oxlint has no bulk-suppression/baseline mechanism as of\n // 1.72.0 (oxc-project/oxc#10549 tracks the upstream feature request and is\n // still open); consumers adopting this against an existing findings\n // backlog should carve out temporary `overrides` entries per legacy path\n // (or per rule, at `\"off\"`) and fix forward, rather than expecting a\n // generated suppression file.\n \"react/react-compiler\": \"error\",\n\n \"sort-keys\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-inline-comments\": \"off\",\n \"max-statements\": \"off\",\n \"prefer-destructuring\": \"off\",\n \"no-negated-condition\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-warning-comments\": \"off\",\n \"no-unexpected-multiline\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"class-methods-use-this\": \"off\",\n \"no-unmodified-loop-condition\": \"off\",\n complexity: \"off\",\n \"func-style\": \"off\",\n \"func-names\": \"off\",\n \"default-case\": \"off\",\n} satisfies Rules;\n\nexport const libraryOverrides = [\n {\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\", \"__test__/**\", \"__tests__/**\"],\n rules: {\n \"no-console\": \"off\",\n \"require-await\": \"off\",\n \"no-non-null-assertion\": \"off\",\n },\n },\n] satisfies OxlintOverride[];\n\nexport const library = (options: LibraryOptions = {}): OxlintConfig =>\n defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(\n new Set([...libraryPlugins, ...(options.plugins ?? [])]),\n ),\n jsPlugins: [\n stellaLowercasePluginSpecifier,\n noRawColorsPluginSpecifier,\n ...(options.jsPlugins ?? []),\n ],\n ignorePatterns: [\n ...libraryIgnorePatterns,\n ...(options.ignorePatterns ?? []),\n ],\n rules: {\n ...libraryRules,\n ...options.rules,\n },\n overrides: [...libraryOverrides, ...(options.overrides ?? [])],\n });\n\nexport default library();\n"],"mappings":";;AAgBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;CAAiB;CAAS;AAAW;AAS3E,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,eAAe;CAC1B,cAAc;CACd,aAAa;CACb,iBAAiB;CACjB,oBAAoB;CACpB,yBAAyB;CACzB,yBAAyB;CACzB,gBAAgB;CAChB,qBAAqB;CACrB,WAAW,CAAC,SAAS,EAAE,kBAAkB,KAAK,CAAC;CAE/C,yBAAyB;CACzB,qCAAqC;CACrC,+BAA+B;CAG/B,8BAA8B;CAE9B,qBAAqB;CAErB,6BAA6B;CAE7B,8BAA8B;CAC9B,gCAAgC;CAChC,kCAAkC,CAChC,SACA,EAAE,kBAAkB,EAAE,YAAY,MAAM,EAAE,CAC5C;CACA,0CA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,cAAc;CACd,cAAc;CACd,gBAAgB;AAClB;AAEA,MAAa,mBAAmB,CAC9B;CACE,OAAO;EAAC;EAAoC;EAAe;CAAc;CACzE,OAAO;EACL,cAAc;EACd,iBAAiB;EACjB,yBAAyB;CAC3B;AACF,CACF;AAEA,MAAa,WAAW,UAA0B,CAAC,MACjD,aAAa;CACX,SAAS;EACP,cAAc;EACd,+BAA+B;EAC/B,WAAW;EACX,GAAG,QAAQ;CACb;CACA,SAAS,MAAM,qBACb,IAAI,IAAI,CAAC,GAAG,gBAAgB,GAAI,QAAQ,WAAW,CAAC,CAAE,CAAC,CACzD;CACA,WAAW;EACT;EACA;EACA,GAAI,QAAQ,aAAa,CAAC;CAC5B;CACA,gBAAgB,CACd,GAAG,uBACH,GAAI,QAAQ,kBAAkB,CAAC,CACjC;CACA,OAAO;EACL,GAAG;EACH,GAAG,QAAQ;CACb;CACA,WAAW,CAAC,GAAG,kBAAkB,GAAI,QAAQ,aAAa,CAAC,CAAE;AAC/D,CAAC;AAEH,IAAA,cAAe,QAAQ"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig, type OxlintConfig, type OxlintOverride } from \"oxlint\";\n\ntype Rules = NonNullable<OxlintConfig[\"rules\"]>;\ntype JsPlugins = NonNullable<OxlintConfig[\"jsPlugins\"]>;\ntype Options = NonNullable<OxlintConfig[\"options\"]>;\ntype Plugins = NonNullable<OxlintConfig[\"plugins\"]>;\n\nexport type LibraryOptions = {\n jsPlugins?: JsPlugins;\n ignorePatterns?: string[];\n options?: Options;\n overrides?: OxlintOverride[];\n plugins?: Plugins;\n rules?: Rules;\n};\n\nexport const stellaLowercasePluginSpecifier = \"@stll/oxlint-config/plugin\";\nexport const noRawColorsPluginSpecifier = \"@stll/oxlint-config/no-raw-colors\";\n\nexport const libraryIgnorePatterns = [\"node_modules/\", \"dist/\", \"coverage/\"];\n\n// Setting oxlint's `plugins` config replaces its built-in default list rather\n// than appending to it. This must stay in sync with every plugin-prefixed\n// rule below: `import/*` and `promise/*` rules are configured further down,\n// but oxlint disables both plugins unless they are listed here, which left\n// `import/no-cycle` and every `promise/*` rule silently unenforced. `react`\n// is enabled for the React Compiler category rules; see the comment on that\n// ruleset for why every other `react/*` rule is explicitly turned back off.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\n \"react\",\n] satisfies Plugins;\n\n// Oxlint 1.80 replaced react/react-compiler with category-specific rules.\n// Keep the actionable compiler diagnostics strict while excluding internal\n// invariant and unfinished-feature reports that do not identify source bugs.\nexport const reactCompilerRules = {\n \"react/capitalized-calls\": \"error\",\n \"react/error-boundaries\": \"error\",\n \"react/exhaustive-effect-dependencies\": \"error\",\n \"react/globals\": \"error\",\n \"react/hooks\": \"error\",\n \"react/immutability\": \"error\",\n \"react/incompatible-library\": \"error\",\n \"react/invariant\": \"off\",\n \"react/memo-dependencies\": \"error\",\n \"react/no-deriving-state-in-effects\": \"error\",\n \"react/preserve-manual-memoization\": \"error\",\n \"react/purity\": \"error\",\n \"react/refs\": \"error\",\n \"react/rule-suppression\": \"error\",\n \"react/set-state-in-effect\": \"error\",\n \"react/set-state-in-render\": \"error\",\n \"react/static-components\": \"error\",\n \"react/syntax\": \"error\",\n \"react/todo\": \"off\",\n \"react/unsupported-syntax\": \"error\",\n \"react/use-memo\": \"error\",\n \"react/void-use-memo\": \"error\",\n} satisfies Rules;\n\nexport const libraryRules = {\n \"no-console\": \"off\",\n \"no-shadow\": \"error\",\n \"require-await\": \"error\",\n \"no-useless-catch\": \"error\",\n \"no-non-null-assertion\": \"error\",\n \"no-useless-assignment\": \"error\",\n \"no-loop-func\": \"error\",\n \"no-nested-ternary\": \"error\",\n \"no-void\": [\"error\", { allowAsStatement: true }],\n // Callback expressions should stay lexically scoped; avoids accidental `this` rebinding.\n \"prefer-arrow-callback\": \"error\",\n \"stella-lowercase/stella-lowercase\": \"error\",\n \"no-raw-colors/no-raw-colors\": \"error\",\n\n // Spreading into an accumulator on every loop iteration is O(n^2); push/concat instead.\n \"oxc/no-accumulating-spread\": \"error\",\n // Spreading inside `.map()` allocates a new array per callback invocation; push instead.\n \"oxc/no-map-spread\": \"error\",\n // Flags `if`/`switch` branches with identical bodies: likely dead logic or a missed merge.\n \"oxc/branches-sharing-code\": \"error\",\n\n \"typescript/no-explicit-any\": \"error\",\n \"typescript/no-dynamic-delete\": \"error\",\n \"typescript/no-misused-promises\": [\n \"error\",\n { checksVoidReturn: { attributes: false } },\n ],\n \"typescript/consistent-type-definitions\": [\"error\", \"type\"],\n \"typescript/consistent-return\": \"error\",\n \"typescript/dot-notation\": \"error\",\n \"typescript/no-inferrable-types\": \"off\",\n \"typescript/no-unnecessary-type-conversion\": \"error\",\n \"typescript/no-unnecessary-condition\": [\n \"error\",\n { allowConstantLoopConditions: \"only-allowed-literals\" },\n ],\n \"typescript/no-unnecessary-type-arguments\": \"error\",\n \"typescript/switch-exhaustiveness-check\": [\n \"error\",\n { considerDefaultExhaustiveForUnions: true },\n ],\n \"typescript/strict-boolean-expressions\": [\n \"error\",\n { allowNullableString: true, allowNullableBoolean: true },\n ],\n \"typescript/no-confusing-void-expression\": [\n \"error\",\n { ignoreArrowShorthand: true, ignoreVoidReturningFunctions: true },\n ],\n \"typescript/prefer-nullish-coalescing\": [\n \"error\",\n { ignorePrimitives: { string: true, boolean: true } },\n ],\n \"typescript/only-throw-error\": \"error\",\n \"typescript/return-await\": [\"error\", \"error-handling-correctness-only\"],\n\n \"unicorn/no-useless-undefined\": \"off\",\n \"unicorn/prefer-array-find\": \"error\",\n \"unicorn/prefer-at\": \"error\",\n \"unicorn/prefer-set-has\": \"error\",\n \"unicorn/filename-case\": \"off\",\n \"unicorn/consistent-function-scoping\": \"off\",\n \"unicorn/prefer-ternary\": \"off\",\n \"unicorn/no-array-reduce\": \"error\",\n \"unicorn/no-nested-ternary\": \"off\",\n // `Array.from({ length }).fill(obj)` shares one reference across every slot.\n \"unicorn/no-array-fill-with-reference-type\": \"error\",\n\n \"import/no-cycle\": \"error\",\n \"import/consistent-type-specifier-style\": \"off\",\n // Keep a blank line after the import block so it stays visually separate from module body.\n \"import/newline-after-import\": \"error\",\n\n \"promise/always-return\": \"error\",\n \"promise/no-return-in-finally\": \"error\",\n \"promise/prefer-await-to-then\": \"off\",\n \"promise/prefer-await-to-callbacks\": \"off\",\n \"promise/avoid-new\": \"off\",\n\n // Enabling the `react` plugin (above) turns on its whole correctness-category\n // rule set at \"warn\" by default, not just the React Compiler categories.\n // Only the compiler categories are deliberate additions here, so the rest\n // are turned off to keep this package's blast radius scoped; lift any of\n // these independently if a future change wants them.\n \"react/exhaustive-deps\": \"off\",\n \"react/forward-ref-uses-ref\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": \"off\",\n \"react/jsx-no-undef\": \"off\",\n \"react/jsx-props-no-spread-multi\": \"off\",\n \"react/no-children-prop\": \"off\",\n \"react/no-danger-with-children\": \"off\",\n \"react/no-did-mount-set-state\": \"off\",\n \"react/no-did-update-set-state\": \"off\",\n \"react/no-direct-mutation-state\": \"off\",\n \"react/no-find-dom-node\": \"off\",\n \"react/no-is-mounted\": \"off\",\n \"react/no-render-return-value\": \"off\",\n \"react/no-string-refs\": \"off\",\n \"react/no-this-in-sfc\": \"off\",\n \"react/no-unsafe\": \"off\",\n \"react/no-will-update-set-state\": \"off\",\n \"react/void-dom-elements-no-children\": \"off\",\n ...reactCompilerRules,\n\n \"sort-keys\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-inline-comments\": \"off\",\n \"max-statements\": \"off\",\n \"prefer-destructuring\": \"off\",\n \"no-negated-condition\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-warning-comments\": \"off\",\n \"no-unexpected-multiline\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"class-methods-use-this\": \"off\",\n \"no-unmodified-loop-condition\": \"off\",\n complexity: \"off\",\n \"func-style\": \"off\",\n \"func-names\": \"off\",\n \"default-case\": \"off\",\n} satisfies Rules;\n\nexport const libraryOverrides = [\n {\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\", \"__test__/**\", \"__tests__/**\"],\n rules: {\n \"no-console\": \"off\",\n \"require-await\": \"off\",\n \"no-non-null-assertion\": \"off\",\n },\n },\n] satisfies OxlintOverride[];\n\nexport const library = (options: LibraryOptions = {}): OxlintConfig =>\n defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(\n new Set([...libraryPlugins, ...(options.plugins ?? [])]),\n ),\n jsPlugins: [\n stellaLowercasePluginSpecifier,\n noRawColorsPluginSpecifier,\n ...(options.jsPlugins ?? []),\n ],\n ignorePatterns: [\n ...libraryIgnorePatterns,\n ...(options.ignorePatterns ?? []),\n ],\n rules: {\n ...libraryRules,\n ...options.rules,\n },\n overrides: [...libraryOverrides, ...(options.overrides ?? [])],\n });\n\nexport default library();\n"],"mappings":";;AAgBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;CAAiB;CAAS;AAAW;AAS3E,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAa,qBAAqB;CAChC,2BAA2B;CAC3B,0BAA0B;CAC1B,wCAAwC;CACxC,iBAAiB;CACjB,eAAe;CACf,sBAAsB;CACtB,8BAA8B;CAC9B,mBAAmB;CACnB,2BAA2B;CAC3B,sCAAsC;CACtC,qCAAqC;CACrC,gBAAgB;CAChB,cAAc;CACd,0BAA0B;CAC1B,6BAA6B;CAC7B,6BAA6B;CAC7B,2BAA2B;CAC3B,gBAAgB;CAChB,cAAc;CACd,4BAA4B;CAC5B,kBAAkB;CAClB,uBAAuB;AACzB;AAEA,MAAa,eAAe;CAC1B,cAAc;CACd,aAAa;CACb,iBAAiB;CACjB,oBAAoB;CACpB,yBAAyB;CACzB,y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;CAChC,wBAAwB;CACxB,wBAAwB;CACxB,mBAAmB;CACnB,kCAAkC;CAClC,uCAAuC;CACvC,GAAG;CAEH,aAAa;CACb,eAAe;CACf,sBAAsB;CACtB,kBAAkB;CAClB,wBAAwB;CACxB,wBAAwB;CACxB,wBAAwB;CACxB,qBAAqB;CACrB,uBAAuB;CACvB,2BAA2B;CAC3B,wBAAwB;CACxB,0BAA0B;CAC1B,gCAAgC;CAChC,YAAY;CACZ,cAAc;CACd,cAAc;CACd,gBAAgB;AAClB;AAEA,MAAa,mBAAmB,CAC9B;CACE,OAAO;EAAC;EAAoC;EAAe;CAAc;CACzE,OAAO;EACL,cAAc;EACd,iBAAiB;EACjB,yBAAyB;CAC3B;AACF,CACF;AAEA,MAAa,WAAW,UAA0B,CAAC,MACjD,aAAa;CACX,SAAS;EACP,cAAc;EACd,+BAA+B;EAC/B,WAAW;EACX,GAAG,QAAQ;CACb;CACA,SAAS,MAAM,qBACb,IAAI,IAAI,CAAC,GAAG,gBAAgB,GAAI,QAAQ,WAAW,CAAC,CAAE,CAAC,CACzD;CACA,WAAW;EACT;EACA;EACA,GAAI,QAAQ,aAAa,CAAC;CAC5B;CACA,gBAAgB,CACd,GAAG,uBACH,GAAI,QAAQ,kBAAkB,CAAC,CACjC;CACA,OAAO;EACL,GAAG;EACH,GAAG,QAAQ;CACb;CACA,WAAW,CAAC,GAAG,kBAAkB,GAAI,QAAQ,aAAa,CAAC,CAAE;AAC/D,CAAC;AAEH,IAAA,cAAe,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/oxlint-config",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Shared general oxlint configuration for stella packages.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -61,11 +61,11 @@
61
61
  "devDependencies": {
62
62
  "@stll/typescript-config": "workspace:*",
63
63
  "oxfmt": "0.48.0",
64
- "oxlint": "1.75.0",
64
+ "oxlint": "1.81.0",
65
65
  "typescript": "7.0.2"
66
66
  },
67
67
  "peerDependencies": {
68
- "oxlint": ">=1.75.0 <2",
68
+ "oxlint": ">=1.80.0 <2",
69
69
  "oxlint-tsgolint": ">=7.0.2001 <8"
70
70
  },
71
71
  "engines": {