Skip to content

Commit d6cbd74

Browse files
authored
Merge branch 'main' into claude/practical-davinci-EUMxp
2 parents 9416b2a + 917281c commit d6cbd74

34 files changed

Lines changed: 1610 additions & 99 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Exercises the sanitizer:
2+
// 1. base-level `fictional/*` rule via an inline plugin namespace that
3+
// doesn't resolve to a native Oxlint plugin nor an installed
4+
// package — translates into `jsPlugins: ['eslint-plugin-fictional']`
5+
// + rule under `fictional/*` (the WeakAuras-style failure shape).
6+
// 2. an OVERRIDE that introduces a second unresolvable plugin
7+
// (`./*.test.js` files only) — verifies the per-override sanitize
8+
// path strips both the override's `jsPlugins` entry and its rules.
9+
export default [
10+
{
11+
plugins: {
12+
fictional: {
13+
rules: {
14+
'no-fiction': {
15+
meta: { type: 'problem' },
16+
create() {
17+
return {};
18+
},
19+
},
20+
},
21+
},
22+
},
23+
rules: {
24+
'fictional/no-fiction': 'warn',
25+
},
26+
},
27+
{
28+
files: ['**/*.test.js'],
29+
plugins: {
30+
'override-only': {
31+
rules: {
32+
'no-skip': {
33+
meta: { type: 'problem' },
34+
create() {
35+
return {};
36+
},
37+
},
38+
},
39+
},
40+
},
41+
rules: {
42+
'override-only/no-skip': 'error',
43+
},
44+
},
45+
];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "migration-eslint-jsplugins-orphan-strip",
3+
"scripts": {
4+
"lint": "eslint ."
5+
},
6+
"devDependencies": {
7+
"eslint": "^9.0.0",
8+
"vite": "^7.0.0"
9+
}
10+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
> vp migrate --no-interactive # orphan jsPlugin / unknown plugin / dangling rule should be stripped, with warnings
2+
◇ Migrated . to Vite+
3+
• Node <semver> pnpm <semver>
4+
• 4 config updates applied
5+
• ESLint rules migrated to Oxlint
6+
! Warnings:
7+
- Stripped JS plugin reference(s) from the generated lint config: eslint-plugin-fictional, eslint-plugin-override-only. No matching package is present in this workspace, so loading them at lint time would fail. If you want their Oxlint coverage back, install each package (e.g. `vp install <name>`) and add its name back to `lint.jsPlugins` in vite.config.ts.
8+
9+
> cat vite.config.ts # lint block should NOT contain `fictional` in plugins / jsPlugins / rules
10+
import { defineConfig } from 'vite-plus';
11+
12+
export default defineConfig({
13+
staged: {
14+
"*": "vp check --fix"
15+
},
16+
fmt: {},
17+
lint: {
18+
"plugins": [
19+
"oxc",
20+
"typescript",
21+
"unicorn",
22+
"react"
23+
],
24+
"jsPlugins": [
25+
{
26+
"name": "vite-plus",
27+
"specifier": "vite-plus/oxlint-plugin"
28+
}
29+
],
30+
"categories": {
31+
"correctness": "warn"
32+
},
33+
"env": {
34+
"builtin": true
35+
},
36+
"rules": {
37+
"vite-plus/prefer-vite-plus-imports": "error"
38+
},
39+
"overrides": [
40+
{
41+
"files": [
42+
"**/*.test.js"
43+
],
44+
"rules": {},
45+
"jsPlugins": []
46+
}
47+
],
48+
"options": {
49+
"typeAware": true,
50+
"typeCheck": true
51+
}
52+
},
53+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commands": [
3+
"vp migrate --no-interactive # orphan jsPlugin / unknown plugin / dangling rule should be stripped, with warnings",
4+
"cat vite.config.ts # lint block should NOT contain `fictional` in plugins / jsPlugins / rules"
5+
]
6+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Inline-defined `survives` plugin — @oxlint/migrate translates it into
2+
// `lint.jsPlugins: ["eslint-plugin-survives"]`. The package is listed
3+
// in this fixture's package.json devDependencies, so:
4+
// 1. The cleanup step should NOT delete `eslint-plugin-survives`
5+
// from package.json (it's referenced by the generated jsPlugins
6+
// array — removing it would invalidate the lint config we just
7+
// generated).
8+
// 2. The sanitizer should NOT strip the jsPlugins entry (the
9+
// package is present in the workspace).
10+
// 3. The `survives/no-fiction` rule should survive in the merged
11+
// `lint.rules` (the `survives` namespace is backed by the kept
12+
// jsPlugin).
13+
export default [
14+
{
15+
plugins: {
16+
survives: {
17+
rules: {
18+
'no-fiction': {
19+
meta: { type: 'problem' },
20+
create() {
21+
return {};
22+
},
23+
},
24+
},
25+
},
26+
},
27+
rules: {
28+
'survives/no-fiction': 'warn',
29+
},
30+
},
31+
];
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "migration-eslint-jsplugins-preserve",
3+
"scripts": {
4+
"lint": "eslint ."
5+
},
6+
"devDependencies": {
7+
"eslint": "^9.0.0",
8+
"eslint-plugin-survives": "^1.0.0",
9+
"vite": "^7.0.0"
10+
}
11+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
> vp migrate --no-interactive # plugin referenced via lint.jsPlugins must be preserved through cleanup AND sanitization
2+
◇ Migrated . to Vite+
3+
• Node <semver> pnpm <semver>
4+
• 4 config updates applied
5+
• ESLint rules migrated to Oxlint
6+
7+
> cat package.json # eslint-plugin-survives stays in devDependencies (eslint itself is removed)
8+
{
9+
"name": "migration-eslint-jsplugins-preserve",
10+
"scripts": {
11+
"lint": "vp lint .",
12+
"prepare": "vp config"
13+
},
14+
"devDependencies": {
15+
"eslint-plugin-survives": "^1.0.0",
16+
"vite": "catalog:",
17+
"vite-plus": "catalog:"
18+
},
19+
"packageManager": "pnpm@<semver>"
20+
}
21+
22+
> cat vite.config.ts # lint.jsPlugins keeps `eslint-plugin-survives`; lint.rules keeps `survives/no-fiction`
23+
import { defineConfig } from 'vite-plus';
24+
25+
export default defineConfig({
26+
staged: {
27+
"*": "vp check --fix"
28+
},
29+
fmt: {},
30+
lint: {
31+
"plugins": [
32+
"oxc",
33+
"typescript",
34+
"unicorn",
35+
"react"
36+
],
37+
"jsPlugins": [
38+
"eslint-plugin-survives",
39+
{
40+
"name": "vite-plus",
41+
"specifier": "vite-plus/oxlint-plugin"
42+
}
43+
],
44+
"categories": {
45+
"correctness": "warn"
46+
},
47+
"env": {
48+
"builtin": true
49+
},
50+
"rules": {
51+
"survives/no-fiction": "warn",
52+
"vite-plus/prefer-vite-plus-imports": "error"
53+
},
54+
"options": {
55+
"typeAware": true,
56+
"typeCheck": true
57+
}
58+
},
59+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"commands": [
3+
"vp migrate --no-interactive # plugin referenced via lint.jsPlugins must be preserved through cleanup AND sanitization",
4+
"cat package.json # eslint-plugin-survives stays in devDependencies (eslint itself is removed)",
5+
"cat vite.config.ts # lint.jsPlugins keeps `eslint-plugin-survives`; lint.rules keeps `survives/no-fiction`"
6+
]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default [
2+
{
3+
rules: {
4+
'no-unused-vars': 'error',
5+
},
6+
},
7+
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "migration-eslint-monorepo-plugins-in-packages",
3+
"scripts": {
4+
"lint": "eslint ."
5+
},
6+
"devDependencies": {
7+
"eslint": "^9.0.0",
8+
"eslint-config-airbnb": "^19.0.0",
9+
"vite": "^7.0.0"
10+
},
11+
"packageManager": "pnpm@10.18.0"
12+
}

0 commit comments

Comments
 (0)