@stll/oxlint-config 0.14.1 → 1.0.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/README.md +42 -1
- package/dist/cloud-setup-cli.mjs +1 -1
- package/dist/index.cjs +50 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -41
- package/dist/index.d.mts +46 -41
- package/dist/index.mjs +50 -41
- package/dist/index.mjs.map +1 -1
- package/dist/toolchain-changed.cjs +5 -22
- package/dist/toolchain-changed.cjs.map +1 -1
- package/dist/toolchain-changed.mjs +6 -23
- package/dist/toolchain-changed.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +830 -121
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +832 -123
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +10 -2
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +5 -3
- package/dist/toolchain-inputs.mjs.map +1 -1
- package/dist/toolchain-schema.cjs +0 -3
- package/dist/toolchain-schema.cjs.map +1 -1
- package/dist/toolchain-schema.mjs +1 -4
- package/dist/toolchain-schema.mjs.map +1 -1
- package/dist/typecheck-parity.cjs +1 -1
- package/dist/typecheck-parity.cjs.map +1 -1
- package/dist/typecheck-parity.mjs +1 -1
- package/dist/typecheck-parity.mjs.map +1 -1
- package/package.json +1 -1
- package/toolchain.json +1 -2
package/README.md
CHANGED
|
@@ -36,6 +36,33 @@ portable safety and route-query rules. See the
|
|
|
36
36
|
[repository usage guide](https://github.com/stella/tooling#usage) for other
|
|
37
37
|
presets, CommonJS configuration, and plugin composition.
|
|
38
38
|
|
|
39
|
+
`library()` is framework-neutral. Enable React and its actionable React Compiler
|
|
40
|
+
rules only for files owned by React:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
export default library({
|
|
44
|
+
react: {
|
|
45
|
+
files: ["packages/react/**/*.{ts,tsx}", "apps/web/src/**/*.{ts,tsx}"],
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Include `.ts` hooks as well as `.tsx` components. Keep Vue composables and other
|
|
51
|
+
frameworks outside these globs. Consumer `rules` take precedence over all preset
|
|
52
|
+
rules, including scoped presets. Consumer `overrides` are applied last and can
|
|
53
|
+
customize individual paths. React is activated only in the selected override.
|
|
54
|
+
Oxlint resolves later overrides against the base plugin list: when configuring
|
|
55
|
+
React rules in a consumer override, explicitly supply
|
|
56
|
+
`plugins: [...libraryPlugins, "react"]` (plus any other consumer plugins) and
|
|
57
|
+
select React-owned files. Framework-neutral
|
|
58
|
+
`jsx-a11y` configuration can continue to be supplied through `plugins` and `rules`.
|
|
59
|
+
|
|
60
|
+
When upgrading from a version that enabled React globally, add `react.files`
|
|
61
|
+
explicitly to preserve diagnostics in React packages. Direct composition is also
|
|
62
|
+
breaking: `libraryRules` and `libraryPlugins` are now framework-neutral. Import
|
|
63
|
+
`reactRules` and add `"react"` to the plugins of a file-scoped override to retain
|
|
64
|
+
React diagnostics.
|
|
65
|
+
|
|
39
66
|
## Shared toolchain and Bun
|
|
40
67
|
|
|
41
68
|
`@stll/oxlint-config/toolchain.json` is a versioned policy for package pins,
|
|
@@ -503,7 +530,7 @@ cannot be compared without executing Bun.
|
|
|
503
530
|
Workflow/action and Docker definition edits conservatively force full CI.
|
|
504
531
|
Unrelated application dependency changes do not force compiler parity.
|
|
505
532
|
Setup-action runtime selectors and their tracked version-file contents must
|
|
506
|
-
identify an exact stable release
|
|
533
|
+
identify an exact stable release. Floating selectors,
|
|
507
534
|
ranges, expressions, empty
|
|
508
535
|
values, or omitted runtime versions report an unreadable snapshot and run parity
|
|
509
536
|
even when their committed text is unchanged.
|
|
@@ -553,3 +580,17 @@ Supported text locks include Bun, npm, pnpm and bounded
|
|
|
553
580
|
Yarn Classic/Berry shapes; unrecognized lock shapes run parity. Yarn compiler
|
|
554
581
|
`patch:` protocols are unsupported and run parity because their patch bytes are
|
|
555
582
|
not represented by the lock checksum alone.
|
|
583
|
+
|
|
584
|
+
## Rust selectors
|
|
585
|
+
|
|
586
|
+
The shared `toolchain.json` Rust pin applies to `rust-toolchain(.toml)`, runtime
|
|
587
|
+
managers, workflow Rust action/reusable-workflow inputs and `RUSTUP_TOOLCHAIN`,
|
|
588
|
+
Cargo/rustup commands in scripts, and Rust Docker/service images. An omitted
|
|
589
|
+
`dtolnay/rust-toolchain` version selects a floating action default and fails.
|
|
590
|
+
Cargo manifest `rust-version` remains an MSRV floor at or below the shared pin.
|
|
591
|
+
|
|
592
|
+
Only `rustExceptions` in the consumer's root `stll-toolchain.json` can authorize
|
|
593
|
+
another exact stable release. Each record contains exactly `pin`, `reason`,
|
|
594
|
+
`tracking` (a GitHub issue URL) and `expires` (a future `YYYY-MM-DD` date).
|
|
595
|
+
Channels, expired records and `rust-version` rule opt-outs fail validation.
|
|
596
|
+
See the [root policy guide](../../README.md) for a complete declaration.
|
package/dist/cloud-setup-cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { h as generateCloudSetup, m as cloudSetupPath } from "./toolchain-inputs.mjs";
|
|
3
3
|
import { n as parseToolchainConfiguration, r as readToolchainInputs } from "./toolchain-guard.mjs";
|
|
4
4
|
import { t as parseToolchainPolicy } from "./toolchain-schema.mjs";
|
|
5
5
|
import { constants } from "node:fs";
|
package/dist/index.cjs
CHANGED
|
@@ -17,8 +17,7 @@ const libraryPlugins = [
|
|
|
17
17
|
"unicorn",
|
|
18
18
|
"oxc",
|
|
19
19
|
"import",
|
|
20
|
-
"promise"
|
|
21
|
-
"react"
|
|
20
|
+
"promise"
|
|
22
21
|
];
|
|
23
22
|
const reactCompilerRules = {
|
|
24
23
|
"react/capitalized-calls": "error",
|
|
@@ -103,6 +102,25 @@ const libraryRules = {
|
|
|
103
102
|
"promise/prefer-await-to-then": "off",
|
|
104
103
|
"promise/prefer-await-to-callbacks": "off",
|
|
105
104
|
"promise/avoid-new": "off",
|
|
105
|
+
"sort-keys": "off",
|
|
106
|
+
"no-plusplus": "off",
|
|
107
|
+
"no-inline-comments": "off",
|
|
108
|
+
"max-statements": "off",
|
|
109
|
+
"prefer-destructuring": "off",
|
|
110
|
+
"no-negated-condition": "off",
|
|
111
|
+
"no-use-before-define": "off",
|
|
112
|
+
"no-useless-return": "off",
|
|
113
|
+
"no-warning-comments": "off",
|
|
114
|
+
"no-unexpected-multiline": "off",
|
|
115
|
+
"max-classes-per-file": "off",
|
|
116
|
+
"class-methods-use-this": "off",
|
|
117
|
+
"no-unmodified-loop-condition": "off",
|
|
118
|
+
complexity: "off",
|
|
119
|
+
"func-style": "off",
|
|
120
|
+
"func-names": "off",
|
|
121
|
+
"default-case": "off"
|
|
122
|
+
};
|
|
123
|
+
const reactRules = {
|
|
106
124
|
"react/exhaustive-deps": "off",
|
|
107
125
|
"react/forward-ref-uses-ref": "off",
|
|
108
126
|
"react/jsx-key": "off",
|
|
@@ -122,24 +140,7 @@ const libraryRules = {
|
|
|
122
140
|
"react/no-unsafe": "off",
|
|
123
141
|
"react/no-will-update-set-state": "off",
|
|
124
142
|
"react/void-dom-elements-no-children": "off",
|
|
125
|
-
...reactCompilerRules
|
|
126
|
-
"sort-keys": "off",
|
|
127
|
-
"no-plusplus": "off",
|
|
128
|
-
"no-inline-comments": "off",
|
|
129
|
-
"max-statements": "off",
|
|
130
|
-
"prefer-destructuring": "off",
|
|
131
|
-
"no-negated-condition": "off",
|
|
132
|
-
"no-use-before-define": "off",
|
|
133
|
-
"no-useless-return": "off",
|
|
134
|
-
"no-warning-comments": "off",
|
|
135
|
-
"no-unexpected-multiline": "off",
|
|
136
|
-
"max-classes-per-file": "off",
|
|
137
|
-
"class-methods-use-this": "off",
|
|
138
|
-
"no-unmodified-loop-condition": "off",
|
|
139
|
-
complexity: "off",
|
|
140
|
-
"func-style": "off",
|
|
141
|
-
"func-names": "off",
|
|
142
|
-
"default-case": "off"
|
|
143
|
+
...reactCompilerRules
|
|
143
144
|
};
|
|
144
145
|
const libraryOverrides = [{
|
|
145
146
|
files: [
|
|
@@ -153,26 +154,34 @@ const libraryOverrides = [{
|
|
|
153
154
|
"no-non-null-assertion": "off"
|
|
154
155
|
}
|
|
155
156
|
}];
|
|
156
|
-
const library = (options = {}) =>
|
|
157
|
-
options
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
157
|
+
const library = (options = {}) => {
|
|
158
|
+
const plugins = /* @__PURE__ */ new Set([...libraryPlugins, ...options.plugins ?? []]);
|
|
159
|
+
const presetOverrides = [...libraryOverrides, ...options.react === void 0 ? [] : [{
|
|
160
|
+
files: options.react.files,
|
|
161
|
+
plugins: [...plugins, "react"],
|
|
162
|
+
rules: reactRules
|
|
163
|
+
}]];
|
|
164
|
+
return (0, oxlint.defineConfig)({
|
|
165
|
+
options: {
|
|
166
|
+
denyWarnings: true,
|
|
167
|
+
reportUnusedDisableDirectives: "error",
|
|
168
|
+
typeAware: true,
|
|
169
|
+
...options.options
|
|
170
|
+
},
|
|
171
|
+
plugins: Array.from(plugins),
|
|
172
|
+
jsPlugins: [
|
|
173
|
+
stellaLowercasePluginSpecifier,
|
|
174
|
+
noRawColorsPluginSpecifier,
|
|
175
|
+
...options.jsPlugins ?? []
|
|
176
|
+
],
|
|
177
|
+
ignorePatterns: [...libraryIgnorePatterns, ...options.ignorePatterns ?? []],
|
|
178
|
+
rules: {
|
|
179
|
+
...libraryRules,
|
|
180
|
+
...options.rules
|
|
181
|
+
},
|
|
182
|
+
overrides: [...presetOverrides.map((override) => Object.assign({}, override, { rules: Object.assign({}, override.rules, options.rules) })), ...options.overrides ?? []]
|
|
183
|
+
});
|
|
184
|
+
};
|
|
176
185
|
var src_default = library();
|
|
177
186
|
//#endregion
|
|
178
187
|
exports.default = src_default;
|
|
@@ -183,6 +192,7 @@ exports.libraryPlugins = libraryPlugins;
|
|
|
183
192
|
exports.libraryRules = libraryRules;
|
|
184
193
|
exports.noRawColorsPluginSpecifier = noRawColorsPluginSpecifier;
|
|
185
194
|
exports.reactCompilerRules = reactCompilerRules;
|
|
195
|
+
exports.reactRules = reactRules;
|
|
186
196
|
exports.stellaLowercasePluginSpecifier = stellaLowercasePluginSpecifier;
|
|
187
197
|
|
|
188
198
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -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 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,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;C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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 react?: { files: [string, ...string[]] };\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.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\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 \"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\n// Applied only to the consumer-selected React files.\nexport const reactRules = {\n // Enabling the `react` plugin 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} 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 const plugins = new Set([...libraryPlugins, ...(options.plugins ?? [])]);\n const presetOverrides = [\n ...libraryOverrides,\n ...(options.react === undefined\n ? []\n : [\n {\n files: options.react.files,\n plugins: [...plugins, \"react\"],\n rules: reactRules,\n } satisfies OxlintOverride,\n ]),\n ];\n return defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(plugins),\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: [\n // Consumer rules take precedence over every preset, including scoped ones.\n ...presetOverrides.map((override) =>\n Object.assign({}, override, {\n rules: Object.assign({}, override.rules, options.rules),\n }),\n ),\n ...(options.overrides ?? []),\n ],\n });\n};\n\nexport default library();\n"],"mappings":";;;;;;AAiBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;CAAiB;CAAS;AAAW;AAO3E,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAa,qBAAqB;CAChC,2BAA2B;CAC3B,0BAA0B;CAC1B,wCAAwC;CACxC,iBAAiB;CACjB,e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;EACA,SAAS,MAAM,KAAK,OAAO;EAC3B,WAAW;GACT;GACA;GACA,GAAI,QAAQ,aAAa,CAAC;EAC5B;EACA,gBAAgB,CACd,GAAG,uBACH,GAAI,QAAQ,kBAAkB,CAAC,CACjC;EACA,OAAO;GACL,GAAG;GACH,GAAG,QAAQ;EACb;EACA,WAAW,CAET,GAAG,gBAAgB,KAAK,aACtB,OAAO,OAAO,CAAC,GAAG,UAAU,EAC1B,OAAO,OAAO,OAAO,CAAC,GAAG,SAAS,OAAO,QAAQ,KAAK,EACxD,CAAC,CACH,GACA,GAAI,QAAQ,aAAa,CAAC,CAC5B;CACF,CAAC;AACH;AAEA,IAAA,cAAe,QAAQ"}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,11 +11,14 @@ type LibraryOptions = {
|
|
|
11
11
|
overrides?: OxlintOverride[];
|
|
12
12
|
plugins?: Plugins;
|
|
13
13
|
rules?: Rules;
|
|
14
|
+
react?: {
|
|
15
|
+
files: [string, ...string[]];
|
|
16
|
+
};
|
|
14
17
|
};
|
|
15
18
|
declare const stellaLowercasePluginSpecifier = "@stll/oxlint-config/plugin";
|
|
16
19
|
declare const noRawColorsPluginSpecifier = "@stll/oxlint-config/no-raw-colors";
|
|
17
20
|
declare const libraryIgnorePatterns: string[];
|
|
18
|
-
declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "
|
|
21
|
+
declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "typescript" | "unicorn")[];
|
|
19
22
|
declare const reactCompilerRules: {
|
|
20
23
|
"react/capitalized-calls": "error";
|
|
21
24
|
"react/error-boundaries": "error";
|
|
@@ -41,28 +44,6 @@ declare const reactCompilerRules: {
|
|
|
41
44
|
"react/void-use-memo": "error";
|
|
42
45
|
};
|
|
43
46
|
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";
|
|
66
47
|
"no-console": "off";
|
|
67
48
|
"no-shadow": "error";
|
|
68
49
|
"require-await": "error";
|
|
@@ -133,6 +114,47 @@ declare const libraryRules: {
|
|
|
133
114
|
"promise/prefer-await-to-then": "off";
|
|
134
115
|
"promise/prefer-await-to-callbacks": "off";
|
|
135
116
|
"promise/avoid-new": "off";
|
|
117
|
+
"sort-keys": "off";
|
|
118
|
+
"no-plusplus": "off";
|
|
119
|
+
"no-inline-comments": "off";
|
|
120
|
+
"max-statements": "off";
|
|
121
|
+
"prefer-destructuring": "off";
|
|
122
|
+
"no-negated-condition": "off";
|
|
123
|
+
"no-use-before-define": "off";
|
|
124
|
+
"no-useless-return": "off";
|
|
125
|
+
"no-warning-comments": "off";
|
|
126
|
+
"no-unexpected-multiline": "off";
|
|
127
|
+
"max-classes-per-file": "off";
|
|
128
|
+
"class-methods-use-this": "off";
|
|
129
|
+
"no-unmodified-loop-condition": "off";
|
|
130
|
+
complexity: "off";
|
|
131
|
+
"func-style": "off";
|
|
132
|
+
"func-names": "off";
|
|
133
|
+
"default-case": "off";
|
|
134
|
+
};
|
|
135
|
+
declare const reactRules: {
|
|
136
|
+
"react/capitalized-calls": "error";
|
|
137
|
+
"react/error-boundaries": "error";
|
|
138
|
+
"react/exhaustive-effect-dependencies": "error";
|
|
139
|
+
"react/globals": "error";
|
|
140
|
+
"react/hooks": "error";
|
|
141
|
+
"react/immutability": "error";
|
|
142
|
+
"react/incompatible-library": "error";
|
|
143
|
+
"react/invariant": "off";
|
|
144
|
+
"react/memo-dependencies": "error";
|
|
145
|
+
"react/no-deriving-state-in-effects": "error";
|
|
146
|
+
"react/preserve-manual-memoization": "error";
|
|
147
|
+
"react/purity": "error";
|
|
148
|
+
"react/refs": "error";
|
|
149
|
+
"react/rule-suppression": "error";
|
|
150
|
+
"react/set-state-in-effect": "error";
|
|
151
|
+
"react/set-state-in-render": "error";
|
|
152
|
+
"react/static-components": "error";
|
|
153
|
+
"react/syntax": "error";
|
|
154
|
+
"react/todo": "off";
|
|
155
|
+
"react/unsupported-syntax": "error";
|
|
156
|
+
"react/use-memo": "error";
|
|
157
|
+
"react/void-use-memo": "error";
|
|
136
158
|
"react/exhaustive-deps": "off";
|
|
137
159
|
"react/forward-ref-uses-ref": "off";
|
|
138
160
|
"react/jsx-key": "off";
|
|
@@ -152,23 +174,6 @@ declare const libraryRules: {
|
|
|
152
174
|
"react/no-unsafe": "off";
|
|
153
175
|
"react/no-will-update-set-state": "off";
|
|
154
176
|
"react/void-dom-elements-no-children": "off";
|
|
155
|
-
"sort-keys": "off";
|
|
156
|
-
"no-plusplus": "off";
|
|
157
|
-
"no-inline-comments": "off";
|
|
158
|
-
"max-statements": "off";
|
|
159
|
-
"prefer-destructuring": "off";
|
|
160
|
-
"no-negated-condition": "off";
|
|
161
|
-
"no-use-before-define": "off";
|
|
162
|
-
"no-useless-return": "off";
|
|
163
|
-
"no-warning-comments": "off";
|
|
164
|
-
"no-unexpected-multiline": "off";
|
|
165
|
-
"max-classes-per-file": "off";
|
|
166
|
-
"class-methods-use-this": "off";
|
|
167
|
-
"no-unmodified-loop-condition": "off";
|
|
168
|
-
complexity: "off";
|
|
169
|
-
"func-style": "off";
|
|
170
|
-
"func-names": "off";
|
|
171
|
-
"default-case": "off";
|
|
172
177
|
};
|
|
173
178
|
declare const libraryOverrides: {
|
|
174
179
|
files: string[];
|
|
@@ -181,5 +186,5 @@ declare const libraryOverrides: {
|
|
|
181
186
|
declare const library: (options?: LibraryOptions) => OxlintConfig;
|
|
182
187
|
declare const _default: OxlintConfig;
|
|
183
188
|
//#endregion
|
|
184
|
-
export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
|
|
189
|
+
export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, reactRules, stellaLowercasePluginSpecifier };
|
|
185
190
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -11,11 +11,14 @@ type LibraryOptions = {
|
|
|
11
11
|
overrides?: OxlintOverride[];
|
|
12
12
|
plugins?: Plugins;
|
|
13
13
|
rules?: Rules;
|
|
14
|
+
react?: {
|
|
15
|
+
files: [string, ...string[]];
|
|
16
|
+
};
|
|
14
17
|
};
|
|
15
18
|
declare const stellaLowercasePluginSpecifier = "@stll/oxlint-config/plugin";
|
|
16
19
|
declare const noRawColorsPluginSpecifier = "@stll/oxlint-config/no-raw-colors";
|
|
17
20
|
declare const libraryIgnorePatterns: string[];
|
|
18
|
-
declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "
|
|
21
|
+
declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "typescript" | "unicorn")[];
|
|
19
22
|
declare const reactCompilerRules: {
|
|
20
23
|
"react/capitalized-calls": "error";
|
|
21
24
|
"react/error-boundaries": "error";
|
|
@@ -41,28 +44,6 @@ declare const reactCompilerRules: {
|
|
|
41
44
|
"react/void-use-memo": "error";
|
|
42
45
|
};
|
|
43
46
|
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";
|
|
66
47
|
"no-console": "off";
|
|
67
48
|
"no-shadow": "error";
|
|
68
49
|
"require-await": "error";
|
|
@@ -133,6 +114,47 @@ declare const libraryRules: {
|
|
|
133
114
|
"promise/prefer-await-to-then": "off";
|
|
134
115
|
"promise/prefer-await-to-callbacks": "off";
|
|
135
116
|
"promise/avoid-new": "off";
|
|
117
|
+
"sort-keys": "off";
|
|
118
|
+
"no-plusplus": "off";
|
|
119
|
+
"no-inline-comments": "off";
|
|
120
|
+
"max-statements": "off";
|
|
121
|
+
"prefer-destructuring": "off";
|
|
122
|
+
"no-negated-condition": "off";
|
|
123
|
+
"no-use-before-define": "off";
|
|
124
|
+
"no-useless-return": "off";
|
|
125
|
+
"no-warning-comments": "off";
|
|
126
|
+
"no-unexpected-multiline": "off";
|
|
127
|
+
"max-classes-per-file": "off";
|
|
128
|
+
"class-methods-use-this": "off";
|
|
129
|
+
"no-unmodified-loop-condition": "off";
|
|
130
|
+
complexity: "off";
|
|
131
|
+
"func-style": "off";
|
|
132
|
+
"func-names": "off";
|
|
133
|
+
"default-case": "off";
|
|
134
|
+
};
|
|
135
|
+
declare const reactRules: {
|
|
136
|
+
"react/capitalized-calls": "error";
|
|
137
|
+
"react/error-boundaries": "error";
|
|
138
|
+
"react/exhaustive-effect-dependencies": "error";
|
|
139
|
+
"react/globals": "error";
|
|
140
|
+
"react/hooks": "error";
|
|
141
|
+
"react/immutability": "error";
|
|
142
|
+
"react/incompatible-library": "error";
|
|
143
|
+
"react/invariant": "off";
|
|
144
|
+
"react/memo-dependencies": "error";
|
|
145
|
+
"react/no-deriving-state-in-effects": "error";
|
|
146
|
+
"react/preserve-manual-memoization": "error";
|
|
147
|
+
"react/purity": "error";
|
|
148
|
+
"react/refs": "error";
|
|
149
|
+
"react/rule-suppression": "error";
|
|
150
|
+
"react/set-state-in-effect": "error";
|
|
151
|
+
"react/set-state-in-render": "error";
|
|
152
|
+
"react/static-components": "error";
|
|
153
|
+
"react/syntax": "error";
|
|
154
|
+
"react/todo": "off";
|
|
155
|
+
"react/unsupported-syntax": "error";
|
|
156
|
+
"react/use-memo": "error";
|
|
157
|
+
"react/void-use-memo": "error";
|
|
136
158
|
"react/exhaustive-deps": "off";
|
|
137
159
|
"react/forward-ref-uses-ref": "off";
|
|
138
160
|
"react/jsx-key": "off";
|
|
@@ -152,23 +174,6 @@ declare const libraryRules: {
|
|
|
152
174
|
"react/no-unsafe": "off";
|
|
153
175
|
"react/no-will-update-set-state": "off";
|
|
154
176
|
"react/void-dom-elements-no-children": "off";
|
|
155
|
-
"sort-keys": "off";
|
|
156
|
-
"no-plusplus": "off";
|
|
157
|
-
"no-inline-comments": "off";
|
|
158
|
-
"max-statements": "off";
|
|
159
|
-
"prefer-destructuring": "off";
|
|
160
|
-
"no-negated-condition": "off";
|
|
161
|
-
"no-use-before-define": "off";
|
|
162
|
-
"no-useless-return": "off";
|
|
163
|
-
"no-warning-comments": "off";
|
|
164
|
-
"no-unexpected-multiline": "off";
|
|
165
|
-
"max-classes-per-file": "off";
|
|
166
|
-
"class-methods-use-this": "off";
|
|
167
|
-
"no-unmodified-loop-condition": "off";
|
|
168
|
-
complexity: "off";
|
|
169
|
-
"func-style": "off";
|
|
170
|
-
"func-names": "off";
|
|
171
|
-
"default-case": "off";
|
|
172
177
|
};
|
|
173
178
|
declare const libraryOverrides: {
|
|
174
179
|
files: string[];
|
|
@@ -181,5 +186,5 @@ declare const libraryOverrides: {
|
|
|
181
186
|
declare const library: (options?: LibraryOptions) => OxlintConfig;
|
|
182
187
|
declare const _default: OxlintConfig;
|
|
183
188
|
//#endregion
|
|
184
|
-
export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
|
|
189
|
+
export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, reactRules, stellaLowercasePluginSpecifier };
|
|
185
190
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -13,8 +13,7 @@ const libraryPlugins = [
|
|
|
13
13
|
"unicorn",
|
|
14
14
|
"oxc",
|
|
15
15
|
"import",
|
|
16
|
-
"promise"
|
|
17
|
-
"react"
|
|
16
|
+
"promise"
|
|
18
17
|
];
|
|
19
18
|
const reactCompilerRules = {
|
|
20
19
|
"react/capitalized-calls": "error",
|
|
@@ -99,6 +98,25 @@ const libraryRules = {
|
|
|
99
98
|
"promise/prefer-await-to-then": "off",
|
|
100
99
|
"promise/prefer-await-to-callbacks": "off",
|
|
101
100
|
"promise/avoid-new": "off",
|
|
101
|
+
"sort-keys": "off",
|
|
102
|
+
"no-plusplus": "off",
|
|
103
|
+
"no-inline-comments": "off",
|
|
104
|
+
"max-statements": "off",
|
|
105
|
+
"prefer-destructuring": "off",
|
|
106
|
+
"no-negated-condition": "off",
|
|
107
|
+
"no-use-before-define": "off",
|
|
108
|
+
"no-useless-return": "off",
|
|
109
|
+
"no-warning-comments": "off",
|
|
110
|
+
"no-unexpected-multiline": "off",
|
|
111
|
+
"max-classes-per-file": "off",
|
|
112
|
+
"class-methods-use-this": "off",
|
|
113
|
+
"no-unmodified-loop-condition": "off",
|
|
114
|
+
complexity: "off",
|
|
115
|
+
"func-style": "off",
|
|
116
|
+
"func-names": "off",
|
|
117
|
+
"default-case": "off"
|
|
118
|
+
};
|
|
119
|
+
const reactRules = {
|
|
102
120
|
"react/exhaustive-deps": "off",
|
|
103
121
|
"react/forward-ref-uses-ref": "off",
|
|
104
122
|
"react/jsx-key": "off",
|
|
@@ -118,24 +136,7 @@ const libraryRules = {
|
|
|
118
136
|
"react/no-unsafe": "off",
|
|
119
137
|
"react/no-will-update-set-state": "off",
|
|
120
138
|
"react/void-dom-elements-no-children": "off",
|
|
121
|
-
...reactCompilerRules
|
|
122
|
-
"sort-keys": "off",
|
|
123
|
-
"no-plusplus": "off",
|
|
124
|
-
"no-inline-comments": "off",
|
|
125
|
-
"max-statements": "off",
|
|
126
|
-
"prefer-destructuring": "off",
|
|
127
|
-
"no-negated-condition": "off",
|
|
128
|
-
"no-use-before-define": "off",
|
|
129
|
-
"no-useless-return": "off",
|
|
130
|
-
"no-warning-comments": "off",
|
|
131
|
-
"no-unexpected-multiline": "off",
|
|
132
|
-
"max-classes-per-file": "off",
|
|
133
|
-
"class-methods-use-this": "off",
|
|
134
|
-
"no-unmodified-loop-condition": "off",
|
|
135
|
-
complexity: "off",
|
|
136
|
-
"func-style": "off",
|
|
137
|
-
"func-names": "off",
|
|
138
|
-
"default-case": "off"
|
|
139
|
+
...reactCompilerRules
|
|
139
140
|
};
|
|
140
141
|
const libraryOverrides = [{
|
|
141
142
|
files: [
|
|
@@ -149,28 +150,36 @@ const libraryOverrides = [{
|
|
|
149
150
|
"no-non-null-assertion": "off"
|
|
150
151
|
}
|
|
151
152
|
}];
|
|
152
|
-
const library = (options = {}) =>
|
|
153
|
-
options
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
153
|
+
const library = (options = {}) => {
|
|
154
|
+
const plugins = /* @__PURE__ */ new Set([...libraryPlugins, ...options.plugins ?? []]);
|
|
155
|
+
const presetOverrides = [...libraryOverrides, ...options.react === void 0 ? [] : [{
|
|
156
|
+
files: options.react.files,
|
|
157
|
+
plugins: [...plugins, "react"],
|
|
158
|
+
rules: reactRules
|
|
159
|
+
}]];
|
|
160
|
+
return defineConfig({
|
|
161
|
+
options: {
|
|
162
|
+
denyWarnings: true,
|
|
163
|
+
reportUnusedDisableDirectives: "error",
|
|
164
|
+
typeAware: true,
|
|
165
|
+
...options.options
|
|
166
|
+
},
|
|
167
|
+
plugins: Array.from(plugins),
|
|
168
|
+
jsPlugins: [
|
|
169
|
+
stellaLowercasePluginSpecifier,
|
|
170
|
+
noRawColorsPluginSpecifier,
|
|
171
|
+
...options.jsPlugins ?? []
|
|
172
|
+
],
|
|
173
|
+
ignorePatterns: [...libraryIgnorePatterns, ...options.ignorePatterns ?? []],
|
|
174
|
+
rules: {
|
|
175
|
+
...libraryRules,
|
|
176
|
+
...options.rules
|
|
177
|
+
},
|
|
178
|
+
overrides: [...presetOverrides.map((override) => Object.assign({}, override, { rules: Object.assign({}, override.rules, options.rules) })), ...options.overrides ?? []]
|
|
179
|
+
});
|
|
180
|
+
};
|
|
172
181
|
var src_default = library();
|
|
173
182
|
//#endregion
|
|
174
|
-
export { src_default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
|
|
183
|
+
export { src_default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, reactRules, stellaLowercasePluginSpecifier };
|
|
175
184
|
|
|
176
185
|
//# sourceMappingURL=index.mjs.map
|