@st1ggy/linter-config 7.3.0 → 7.4.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 (46) hide show
  1. package/README.md +88 -7
  2. package/data/oxlint-config-inventory.json +2091 -0
  3. package/data/oxlint-rule-map.json +91859 -0
  4. package/data/oxlint-source-inventory.json +107728 -0
  5. package/docs/OXLINT_RULE_MAPPING.md +2968 -0
  6. package/docs/RULE_MAPPING.md +15 -0
  7. package/package.json +55 -3
  8. package/scripts/README.md +33 -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 +80 -20
  16. package/scripts/linter-init.mjs +24 -32
  17. package/src/oxlint/configs/config.astro.js +4092 -0
  18. package/src/oxlint/configs/config.common.js +3209 -0
  19. package/src/oxlint/configs/config.next.js +3592 -0
  20. package/src/oxlint/configs/config.react.js +3503 -0
  21. package/src/oxlint/configs/config.solid.js +4986 -0
  22. package/src/oxlint/configs/config.svelte.js +3301 -0
  23. package/src/oxlint/create-config.js +40 -0
  24. package/src/oxlint/index.d.ts +49 -0
  25. package/src/oxlint/oxlint.config.astro.js +4 -0
  26. package/src/oxlint/oxlint.config.common.js +4 -0
  27. package/src/oxlint/oxlint.config.next.js +4 -0
  28. package/src/oxlint/oxlint.config.react.js +4 -0
  29. package/src/oxlint/oxlint.config.solid.js +4 -0
  30. package/src/oxlint/oxlint.config.svelte.js +4 -0
  31. package/src/oxlint/plugins/astro.js +41 -0
  32. package/src/oxlint/plugins/eslint-core.js +5 -0
  33. package/src/oxlint/plugins/fresh-source-code.js +30 -0
  34. package/src/oxlint/plugins/import-x.js +38 -0
  35. package/src/oxlint/plugins/next.js +1 -0
  36. package/src/oxlint/plugins/prettier.js +1 -0
  37. package/src/oxlint/plugins/react-hooks.js +1 -0
  38. package/src/oxlint/plugins/react.js +1 -0
  39. package/src/oxlint/plugins/solid.js +1 -0
  40. package/src/oxlint/plugins/sonarjs.js +5 -0
  41. package/src/oxlint/plugins/stylistic.js +1 -0
  42. package/src/oxlint/plugins/svelte.js +42 -0
  43. package/src/oxlint/plugins/typescript.js +1 -0
  44. package/src/oxlint/plugins/unicorn.js +5 -0
  45. package/src/oxlint/stacks.js +11 -0
  46. 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, 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 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 **`eslint.config.js`** for an ESLint stack or **`oxlint.config.ts`** for an Oxlint stack, plus **`prettier.config.js`** and **`stylelint.config.js`** as re-exports for the selected stack.
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.*`, `prettier.config.cjs`, extra copies, …) are presented one by one by `migrate`; no file is deleted without confirmation. Changing engines offers the other engine's config 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,78 @@ 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 | Prettier | Stylelint |
99
+ | ------------- | --------------------------------- | ----------------- | ---------------- |
100
+ | `--common-ox` | `@st1ggy/linter-config/common-ox` | `prettier-common` | `stylelint-scss` |
101
+ | `--react-ox` | `@st1ggy/linter-config/react-ox` | `prettier-common` | `stylelint-scss` |
102
+ | `--solid-ox` | `@st1ggy/linter-config/solid-ox` | `prettier-common` | `stylelint-scss` |
103
+ | `--next-ox` | `@st1ggy/linter-config/next-ox` | `prettier-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** and **oxlint-tsgolint 7.0.2003**, 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 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
120
+ ```
121
+
122
+ ```ts
123
+ // oxlint.config.ts
124
+ export { default } from '@st1ggy/linter-config/solid-ox'
125
+ ```
126
+
127
+ ```bash
128
+ npx oxlint .
129
+ # Also report TypeScript errors:
130
+ npx oxlint --type-aware --type-check .
131
+ # Fix supported lint violations:
132
+ npx oxlint --fix .
133
+ ```
134
+
135
+ 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.
136
+
137
+ When composing configs, specify `typeAware` at the **consumer root**; root-only options are not inherited through `extends`:
138
+
139
+ ```ts
140
+ import config from '@st1ggy/linter-config/solid-ox'
141
+ import { defineConfig } from 'oxlint'
142
+
143
+ export default defineConfig({
144
+ extends: [config],
145
+ options: { typeAware: true },
146
+ ignorePatterns: ['dist/**'],
147
+ })
148
+ ```
149
+
150
+ Prettier and Stylelint remain the format/style tools, with the existing framework plugins for Svelte and Astro. Oxlint also executes the compatible Prettier JS rule for ordinary JS/TS files. Re-run formatting if overlapping lint fixes leave formatting diagnostics.
151
+
152
+ ### Rule coverage
153
+
154
+ 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.
155
+
156
+ These are **maximum-feasible migrations, with documented gaps**, rather than fully equivalent replacements:
157
+
158
+ - **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.
159
+ - **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.
160
+ - Some native implementations have narrower behavior or lack source options. The original JS rule is used where compatible; remaining differences are recorded individually.
161
+ - Compiler configuration-dependent guards are kept, but default-configuration control fixtures do not count as positive violation evidence.
162
+ - 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.
163
+
164
+ See [the generated rule mapping](docs/OXLINT_RULE_MAPPING.md) for counts and every partial/unsupported mapping. 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.
165
+
91
166
  ### Migration (v7)
92
167
 
93
168
  **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 +187,7 @@ Releases are started manually from `Actions` → `Release` → `Run workflow`. I
112
187
 
113
188
  ## Toolchain (this repo)
114
189
 
115
- The `CI` GitHub Actions workflow runs linting, Solid integration tests, TypeScript checks, and a package dry run on pushes to `main` and pull requests. The `Release` workflow also runs the integration tests and TypeScript checks before publishing.
190
+ The `CI` GitHub Actions workflow runs linting, the original Solid tests, Oxlint 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. The `Release` workflow runs these checks before publishing as well.
116
191
 
117
192
  There is **one** published package at the **repository root** (no `packages/` workspace layout).
118
193
 
@@ -132,6 +207,12 @@ npm run lint
132
207
  | `npm run lint:fix` | Auto-fix ESLint, Stylelint, Prettier |
133
208
  | `npm run inventory` | Regenerate [`data/linter-config-inventory.json`](data/linter-config-inventory.json) |
134
209
  | `node --test scripts/solid-config.test.mjs` | Check Solid JSX/TSX linting and wrapper generation |
210
+ | `node scripts/package-smoke.mjs` | Check all six packed Oxlint stacks, their CLI/TS7 checks and legacy imports |
211
+ | `node scripts/package-smoke.mjs --pm pnpm` | Check the tarball using isolated pnpm dependencies |
212
+ | `npm run typecheck:ox` | Explicit native TypeScript 7 compiler check |
213
+ | `npm run test:ox` | Oxlint integration, rule parity and coverage guardrail tests |
214
+ | `npm run generate:ox` / `generate:ox:check` | Generate/verify the six Oxlint configurations and rule map |
215
+ | `npm run inventory:ox` / `inventory:ox:check` | Generate/verify source scopes, evidence and coverage reports |
135
216
  | `npm run config:init` | `node ./scripts/linter-init.mjs init --common --dir ./examples/init-smoke` (skip existing); see [`scripts/README.md`](scripts/README.md) |
136
217
  | `npm run config:migrate` | `migrate` selected legacy configs and overwrite wrappers |
137
218
  | `npm run config:reinit` | alias for `config:migrate` |