@st1ggy/linter-config 7.3.1 → 8.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.
Files changed (49) hide show
  1. package/README.md +127 -8
  2. package/data/oxlint-config-inventory.json +2268 -0
  3. package/data/oxlint-rule-map.json +91896 -0
  4. package/data/oxlint-source-inventory.json +107728 -0
  5. package/docs/OXLINT_RULE_MAPPING.md +2972 -0
  6. package/docs/RULE_MAPPING.md +15 -0
  7. package/package.json +68 -3
  8. package/scripts/README.md +37 -1
  9. package/scripts/init-astro-ox.sh +4 -0
  10. package/scripts/init-common-ox.sh +4 -0
  11. package/scripts/init-next-ox.sh +4 -0
  12. package/scripts/init-react-ox.sh +4 -0
  13. package/scripts/init-solid-ox.sh +4 -0
  14. package/scripts/init-svelte-ox.sh +4 -0
  15. package/scripts/linter-init-core.mjs +104 -24
  16. package/scripts/linter-init.mjs +24 -32
  17. package/src/oxfmt/index.d.ts +8 -0
  18. package/src/oxfmt/oxfmt.config.common.js +16 -0
  19. package/src/oxlint/configs/config.astro.js +4093 -0
  20. package/src/oxlint/configs/config.common.js +3206 -0
  21. package/src/oxlint/configs/config.next.js +3588 -0
  22. package/src/oxlint/configs/config.react.js +3499 -0
  23. package/src/oxlint/configs/config.solid.js +4972 -0
  24. package/src/oxlint/configs/config.svelte.js +3302 -0
  25. package/src/oxlint/create-config.js +40 -0
  26. package/src/oxlint/index.d.ts +49 -0
  27. package/src/oxlint/oxlint.config.astro.js +4 -0
  28. package/src/oxlint/oxlint.config.common.js +4 -0
  29. package/src/oxlint/oxlint.config.next.js +4 -0
  30. package/src/oxlint/oxlint.config.react.js +4 -0
  31. package/src/oxlint/oxlint.config.solid.js +4 -0
  32. package/src/oxlint/oxlint.config.svelte.js +4 -0
  33. package/src/oxlint/plugins/astro.js +41 -0
  34. package/src/oxlint/plugins/eslint-core.js +5 -0
  35. package/src/oxlint/plugins/fresh-source-code.js +30 -0
  36. package/src/oxlint/plugins/import-x.js +38 -0
  37. package/src/oxlint/plugins/next.js +1 -0
  38. package/src/oxlint/plugins/prettier.js +1 -0
  39. package/src/oxlint/plugins/react-hooks.js +1 -0
  40. package/src/oxlint/plugins/react.js +1 -0
  41. package/src/oxlint/plugins/solid.js +1 -0
  42. package/src/oxlint/plugins/sonarjs.js +5 -0
  43. package/src/oxlint/plugins/stylistic.js +1 -0
  44. package/src/oxlint/plugins/svelte.js +42 -0
  45. package/src/oxlint/plugins/typescript.js +1 -0
  46. package/src/oxlint/plugins/unicorn.js +5 -0
  47. package/src/oxlint/stacks.js +17 -0
  48. package/scripts/package-smoke.mjs +0 -56
  49. package/scripts/solid-config.test.mjs +0 -134
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # st1ggy/linter-config
2
2
 
3
- Single npm package **`@st1ggy/linter-config`** with **subpath exports**. Config sources live under [`src/`](src/) (ESLint, Prettier, Stylelint).
3
+ Single npm package **`@st1ggy/linter-config`** with **subpath exports**. Config sources live under [`src/`](src/) (ESLint, Oxlint, Oxfmt, Prettier, Stylelint).
4
4
 
5
5
  Install once:
6
6
 
@@ -8,24 +8,27 @@ Install once:
8
8
  npm i -D @st1ggy/linter-config
9
9
  ```
10
10
 
11
- Framework-specific ESLint and Prettier plugins are optional peers, so installing this package does not install integrations for unused frameworks. The wizard installs only the selected stack's plugins as dev dependencies.
11
+ Oxlint/Oxfmt engines and framework-specific plugins are optional peers. The wizard installs the selected stack's engines and integration plugins as dev dependencies.
12
12
 
13
13
  ### Generate local wrapper configs
14
14
 
15
- The published CLI is invoked as **`@st1ggy/linter-config`** (see [`package.json`](package.json) `bin`). Each run writes **`eslint.config.js`**, **`prettier.config.js`**, and **`stylelint.config.js`** as ESM re-exports for one stack.
15
+ The published CLI is invoked as **`@st1ggy/linter-config`** (see [`package.json`](package.json) `bin`). Each run writes a linter config, a formatter config and **`stylelint.config.js`** as re-exports for the selected stack. ESLint stacks use **`eslint.config.js`** and **`prettier.config.js`**. Common/React/Solid/Next Oxlint stacks use **`oxlint.config.ts`** and **`oxfmt.config.ts`**; Svelte/Astro Oxlint stacks use **`oxlint.config.ts`** and **`prettier.config.js`**.
16
16
 
17
17
  Unless **`--skip-install`** is passed: if **`package.json`** exists in the target directory, the CLI runs the detected package manager (**npm** / **pnpm** / **yarn** / **bun** from the nearest lockfile) to install **`@st1ggy/linter-config`** and only the selected stack's integration plugins. When all selected packages are already declared but missing from `node_modules`, it runs a regular install instead.
18
18
 
19
- Pick **at most one** stack flag (default **`--common`** if you omit all six):
19
+ Pick **at most one** stack flag (default **`--common`** if omitted):
20
20
 
21
21
  **`--common` · `--react` · `--solid` · `--next` · `--svelte` · `--astro`**
22
22
 
23
+ **`--common-ox` · `--react-ox` · `--solid-ox` · `--next-ox` · `--svelte-ox` · `--astro-ox`**
24
+
23
25
  **After** `npm i -D @st1ggy/linter-config`:
24
26
 
25
27
  ```bash
26
28
  npx @st1ggy/linter-config init
27
29
  npx @st1ggy/linter-config init --react
28
30
  npx @st1ggy/linter-config init --solid
31
+ npx @st1ggy/linter-config init --solid-ox
29
32
  npx @st1ggy/linter-config migrate --svelte --dir ./apps/web
30
33
  npx @st1ggy/linter-config init --astro
31
34
  npm exec @st1ggy/linter-config -- init --common
@@ -46,9 +49,9 @@ The CLI is interactive in a terminal. Command and stack flags preselect their va
46
49
  Older **`--eslint`** on the command line is still accepted for compatibility; **`--eslint`** is optional.
47
50
 
48
51
  - **`init` / `create`** — create only missing files (skip existing).
49
- - **`migrate` / `reinit`** — optionally remove selected legacy configs, then overwrite the three wrapper configs.
52
+ - **`migrate` / `reinit`** — optionally remove selected legacy configs, then overwrite the selected stack's three wrapper configs.
50
53
 
51
- **Legacy filenames** (`.eslintrc.*`, `prettier.config.cjs`, extra copies, …) are presented one by one by `migrate`; no file is deleted without confirmation. [`scripts/remove-current.sh`](scripts/remove-current.sh) remains available as a standalone cleanup helper.
54
+ **Legacy filenames** (`.eslintrc.*`, `.oxlintrc.*`, `.oxfmtrc.*`, `prettier.config.cjs`, extra copies, …) are presented one by one by `migrate`; no file is deleted without confirmation. Changing engines offers the other linter and formatter configs for removal during migration. [`scripts/remove-current.sh`](scripts/remove-current.sh) remains available as a standalone cleanup helper.
52
55
 
53
56
  Your project should use **`"type": "module"`** (or `.mjs` config filenames) so the generated ESM re-exports load.
54
57
 
@@ -88,6 +91,115 @@ The named export is `eslintSolid`. The Solid stack uses `prettier-common` and `s
88
91
 
89
92
  If you previously used Stylelint 16 with this preset, upgrade the consumer to **Stylelint 17** before depending on the latest release.
90
93
 
94
+ ## Oxlint variants
95
+
96
+ Each existing stack has an Oxlint counterpart. The new configs are objects typed as `OxlintConfig`; the existing ESLint configs remain flat-config arrays.
97
+
98
+ | Stack flag | Config import | Formatter | Stylelint |
99
+ | ------------- | --------------------------------- | ----------------- | ---------------- |
100
+ | `--common-ox` | `@st1ggy/linter-config/common-ox` | `oxfmt-common` | `stylelint-scss` |
101
+ | `--react-ox` | `@st1ggy/linter-config/react-ox` | `oxfmt-common` | `stylelint-scss` |
102
+ | `--solid-ox` | `@st1ggy/linter-config/solid-ox` | `oxfmt-common` | `stylelint-scss` |
103
+ | `--next-ox` | `@st1ggy/linter-config/next-ox` | `oxfmt-common` | `stylelint-scss` |
104
+ | `--svelte-ox` | `@st1ggy/linter-config/svelte-ox` | `prettier-svelte` | `stylelint-scss` |
105
+ | `--astro-ox` | `@st1ggy/linter-config/astro-ox` | `prettier-astro` | `stylelint-scss` |
106
+
107
+ ### Install and run
108
+
109
+ The checked engine versions are **Oxlint 1.86.0**, **oxlint-tsgolint 7.0.2003**, and **Oxfmt 0.71.0**, with native TypeScript 7 typed analysis. Use **Node.js 24.16.0+**. JS-plugin compatibility and the rule inventory are checked against these versions; the CLI installs the selected engines with exact versions.
110
+
111
+ ```bash
112
+ npx @st1ggy/linter-config init --solid-ox
113
+ ```
114
+
115
+ For manual Solid installation:
116
+
117
+ ```bash
118
+ npm i -D @st1ggy/linter-config eslint-plugin-solid
119
+ npm i -D --save-exact oxlint@1.86.0 oxlint-tsgolint@7.0.2003 oxfmt@0.71.0
120
+ ```
121
+
122
+ ```ts
123
+ // oxlint.config.ts
124
+ export { default } from '@st1ggy/linter-config/solid-ox'
125
+ ```
126
+
127
+ ```ts
128
+ // oxfmt.config.ts
129
+ export { default } from '@st1ggy/linter-config/oxfmt-common'
130
+ ```
131
+
132
+ ```bash
133
+ npx oxlint .
134
+ npx oxfmt --check .
135
+ # Also report TypeScript errors:
136
+ npx oxlint --type-aware --type-check .
137
+ # Fix supported lint violations, then format:
138
+ npx oxlint --fix .
139
+ npx oxfmt --write .
140
+ ```
141
+
142
+ Oxlint auto-discovers `oxlint.config.ts` and the applicable `tsconfig.json`. Remove options deleted in TypeScript 7, including `baseUrl`; make `paths` relative to the config instead. For Solid JSX, use `"jsx": "preserve"` and `"jsxImportSource": "solid-js"`. The wizard writes wrappers and installs integrations; it does not edit your tsconfig or package scripts.
143
+
144
+ When composing configs, specify `typeAware` at the **consumer root**; root-only options are not inherited through `extends`:
145
+
146
+ ```ts
147
+ import config from '@st1ggy/linter-config/solid-ox'
148
+ import { defineConfig } from 'oxlint'
149
+
150
+ export default defineConfig({
151
+ extends: [config],
152
+ options: { typeAware: true },
153
+ ignorePatterns: ['dist/**'],
154
+ })
155
+ ```
156
+
157
+ ### Oxfmt formatting
158
+
159
+ `common-ox`, `react-ox`, `solid-ox` and `next-ox` use Oxfmt for formatting. Their lint configs do not load `eslint-plugin-prettier` or execute `prettier/prettier`; run the formatter check alongside linting in CI. The generated `oxfmt.config.ts` imports `@st1ggy/linter-config/oxfmt-common` and is discovered automatically.
160
+
161
+ The shared config preserves the common style: 120-column width, two-space indentation, single quotes, no semicolons, trailing commas, LF and a final newline. **Import sorting and package.json sorting are explicitly disabled**; the current import lint rules retain control of import order. `.gitignore` and `.prettierignore` are respected during directory traversal. Oxfmt can format an explicitly named gitignored file; for deliberate exclusions, use `.prettierignore` or `ignorePatterns`.
162
+
163
+ Override options by spreading the shared object:
164
+
165
+ ```ts
166
+ import config from '@st1ggy/linter-config/oxfmt-common'
167
+ import { defineConfig } from 'oxfmt'
168
+
169
+ export default defineConfig({
170
+ ...config,
171
+ ignorePatterns: [...(config.ignorePatterns ?? []), 'dist/**'],
172
+ })
173
+ ```
174
+
175
+ `init` keeps an existing `prettier.config.js`; use `migrate` to offer it for removal when switching to Oxfmt. The wizard does not update consumer package scripts. A typical script pair is `"lint": "oxlint ."` and `"format:check": "oxfmt --check ."`.
176
+
177
+ Svelte/Astro and the original ESLint stacks keep their existing Prettier configs and plugins. Stylelint remains the style-rule tool for every stack. Prettier also remains a dependency for those integrations and this repository's generation/legacy checks.
178
+
179
+ ### Rule coverage
180
+
181
+ The presets carry over native rule equivalents and compatible JS plugins, including custom severity, options, JSX style, import ordering and syntax restrictions. All default Oxlint categories are disabled; only migrated rules are enabled. Type-aware checks run through **tsgolint/TS7**. TS6 remains a library dependency for existing ESLint presets and some JS plugins; the new consumer command does not launch ESLint or create a TS6 type-checking Program.
182
+
183
+ These are **maximum-feasible migrations, with documented gaps**, rather than fully equivalent replacements:
184
+
185
+ - **Svelte/Astro:** Oxlint checks extracted scripts, not templates. Template-only checks and TS parser-service-dependent JS rules are unavailable. Checks that would misreport template-used variables are omitted for those scopes. Svelte script/module rules and aliases are retained where supported.
186
+ - **Astro:** six frontmatter-only script checks are preserved via an adapter (deprecated Astro APIs, deprecated `getEntryBySlug`, component exports and prerender location). Template directives are not checked. The plugin API cannot distinguish frontmatter from a browser script containing identical text; that ambiguity is recorded as partial coverage.
187
+ - Some native implementations have narrower behavior or lack source options. The original JS rule is used where compatible; remaining differences are recorded individually.
188
+ - Compiler configuration-dependent guards are kept, but default-configuration control fixtures do not count as positive violation evidence.
189
+ - Existing `eslint-disable` directives do not automatically retain their meaning after rule namespaces change. Use Oxlint directives with the migrated IDs and check `--report-unused-disable-directives` when migrating.
190
+
191
+ See [the generated rule mapping](docs/OXLINT_RULE_MAPPING.md) for counts and every partial/unsupported mapping. The migrated formatting check is accounted for with status `formatter`, not silently disabled. The full source scopes, rule options and evidence references are in `data/oxlint-*.json`; development tests keep paired source/target fixtures outside the published tarball.
192
+
193
+ ### Migration (v8: native formatter)
194
+
195
+ `common-ox`, `react-ox`, `solid-ox` and `next-ox` use Oxfmt instead of Prettier. Their Oxlint command no longer checks formatting. To upgrade a consumer from v7:
196
+
197
+ 1. Run the wizard with `migrate --<stack>-ox` and select the old formatter config for removal, or install `oxfmt@0.71.0` and create `oxfmt.config.ts` importing `@st1ggy/linter-config/oxfmt-common` manually.
198
+ 2. Add `oxfmt --check .` alongside `oxlint .` in CI; replace the old `prettier --check .` command for that stack.
199
+ 3. Run `oxlint --fix .` followed by `oxfmt --write .` when applying fixes, and review consumer-specific formatter overrides.
200
+
201
+ Svelte/Astro Oxlint stacks and the original ESLint stacks retain their Prettier workflow.
202
+
91
203
  ### Migration (v7)
92
204
 
93
205
  **v7** requires **ESLint 10.8+**. Framework integration plugins are optional peers and are installed by the interactive CLI only for the selected stack.
@@ -112,7 +224,7 @@ Releases are started manually from `Actions` → `Release` → `Run workflow`. I
112
224
 
113
225
  ## Toolchain (this repo)
114
226
 
115
- The `CI` GitHub Actions workflow runs linting, Solid integration tests, TypeScript checks, and a packed-package smoke test on pushes to `main` and pull requests. The smoke test installs the tarball into a temporary project and checks the CLI and Solid preset import. The `Release` workflow runs these checks before publishing as well.
227
+ The `CI` GitHub Actions workflow runs linting, the original Solid tests, Oxlint/Oxfmt tests, explicit TS6 and native TS7 checks, inventory/generated-config checks, and packed-package smoke tests on pushes to `main` and pull requests. It checks Node.js `24.16.0` and `latest`, and installs tarballs with npm and isolated pnpm. A separate `format:ox:check` validates formatting with Oxfmt. The `Release` workflow runs these checks before publishing as well.
116
228
 
117
229
  There is **one** published package at the **repository root** (no `packages/` workspace layout).
118
230
 
@@ -129,10 +241,17 @@ npm run lint
129
241
  | `npm run lint:eslint` | ESLint only |
130
242
  | `npm run lint:stylelint` | Stylelint only |
131
243
  | `npm run lint:prettier` | Prettier `--check` only |
244
+ | `npm run format:ox:check` | Check repository formatting with the shared Oxfmt options |
245
+ | `npm run format:ox:compare` | Compare Oxfmt and Prettier on sources and rule fixtures without rewriting files |
132
246
  | `npm run lint:fix` | Auto-fix ESLint, Stylelint, Prettier |
133
247
  | `npm run inventory` | Regenerate [`data/linter-config-inventory.json`](data/linter-config-inventory.json) |
134
248
  | `node --test scripts/solid-config.test.mjs` | Check Solid JSX/TSX linting and wrapper generation |
135
- | `node scripts/package-smoke.mjs` | Install a packed tarball and check its CLI and Solid preset |
249
+ | `node scripts/package-smoke.mjs` | Check all six packed Oxlint stacks, their CLI/TS7 checks and legacy imports |
250
+ | `node scripts/package-smoke.mjs --pm pnpm` | Check the tarball using isolated pnpm dependencies |
251
+ | `npm run typecheck:ox` | Explicit native TypeScript 7 compiler check |
252
+ | `npm run test:ox` | Oxlint integration, rule parity and coverage guardrail tests |
253
+ | `npm run generate:ox` / `generate:ox:check` | Generate/verify the six Oxlint configurations and rule map |
254
+ | `npm run inventory:ox` / `inventory:ox:check` | Generate/verify source scopes, evidence and coverage reports |
136
255
  | `npm run config:init` | `node ./scripts/linter-init.mjs init --common --dir ./examples/init-smoke` (skip existing); see [`scripts/README.md`](scripts/README.md) |
137
256
  | `npm run config:migrate` | `migrate` selected legacy configs and overwrite wrappers |
138
257
  | `npm run config:reinit` | alias for `config:migrate` |