@geoql/eslint-plugin-nuxt-doctor 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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vinayak Kulkarni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @geoql/eslint-plugin-nuxt-doctor
|
|
2
|
+
|
|
3
|
+
ESLint **flat-config** plugin that flags Nuxt 4 anti-patterns, AI-slop, hydration
|
|
4
|
+
traps, and server-route mistakes — the same detection logic that powers
|
|
5
|
+
[`@geoql/oxlint-plugin-nuxt-doctor`](../oxlint-plugin-nuxt-doctor), exposed for
|
|
6
|
+
teams whose lint pipeline is ESLint rather than oxlint.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pnpm add -D @geoql/eslint-plugin-nuxt-doctor @geoql/eslint-plugin-vue-doctor eslint
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage (flat config)
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
// eslint.config.js
|
|
18
|
+
import nuxtDoctor from '@geoql/eslint-plugin-nuxt-doctor';
|
|
19
|
+
import vueDoctor from '@geoql/eslint-plugin-vue-doctor';
|
|
20
|
+
|
|
21
|
+
export default [
|
|
22
|
+
...nuxtDoctor.configs.recommended,
|
|
23
|
+
...vueDoctor.configs.recommended,
|
|
24
|
+
];
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The Nuxt recommended preset **does not** automatically include the Vue rules;
|
|
28
|
+
spread both. (Pushing the Vue rules in by default would create a circular
|
|
29
|
+
dependency between the two plugin packages — Nuxt extends Vue, not the other way
|
|
30
|
+
around.)
|
|
31
|
+
|
|
32
|
+
### Presets
|
|
33
|
+
|
|
34
|
+
- `configs.recommended` — every Nuxt rule flagged `recommended` in the shared
|
|
35
|
+
registry, wired at its registry severity (`error`/`warn`).
|
|
36
|
+
- `configs.all` — every script rule the plugin ships, all at `error`.
|
|
37
|
+
|
|
38
|
+
## Scope — script rules only (deliberate)
|
|
39
|
+
|
|
40
|
+
This plugin wires **every ESTree/JavaScript-AST rule core** from
|
|
41
|
+
`@geoql/doctor-rule-core` (the same cores the oxlint plugin uses). Each ESLint
|
|
42
|
+
rule is a thin adapter: it imports the shared core and forwards the core's
|
|
43
|
+
visitor and message into ESLint's `create` / `context.report` API. There is **no
|
|
44
|
+
duplicated detection logic** — a rule's behavior is identical across oxlint and
|
|
45
|
+
ESLint because both consume the same core.
|
|
46
|
+
|
|
47
|
+
**Template-AST rules are intentionally not included.** Those rules remain
|
|
48
|
+
available through `@geoql/oxlint-plugin-nuxt-doctor` and the `@geoql/nuxt-doctor`
|
|
49
|
+
CLI.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT © [Vinayak Kulkarni](https://vinayakkulkarni.dev)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CoreRule, NUXT_AUTO_IMPORTED, NUXT_RULES, Severity, Severity as Severity$1 } from "@geoql/doctor-rule-core";
|
|
2
|
+
import { toESLintRule } from "@geoql/eslint-plugin-vue-doctor";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin.d.ts
|
|
5
|
+
type ESLintSeverity = 'error' | 'warn';
|
|
6
|
+
interface NuxtDoctorRuleModule {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly severity: Severity$1;
|
|
9
|
+
readonly recommended: boolean;
|
|
10
|
+
readonly category: string;
|
|
11
|
+
}
|
|
12
|
+
interface NuxtDoctorConfig {
|
|
13
|
+
readonly files: ReadonlyArray<string>;
|
|
14
|
+
readonly plugins: {
|
|
15
|
+
readonly 'nuxt-doctor': NuxtDoctorPlugin;
|
|
16
|
+
};
|
|
17
|
+
readonly rules: Readonly<Record<string, ESLintSeverity>>;
|
|
18
|
+
}
|
|
19
|
+
interface NuxtDoctorPlugin {
|
|
20
|
+
readonly meta: {
|
|
21
|
+
readonly name: 'nuxt-doctor';
|
|
22
|
+
readonly version: string;
|
|
23
|
+
};
|
|
24
|
+
readonly rules: Readonly<Record<string, ReturnType<typeof toESLintRule>>>;
|
|
25
|
+
readonly ruleMeta: Readonly<Record<string, NuxtDoctorRuleModule>>;
|
|
26
|
+
readonly configs: {
|
|
27
|
+
readonly recommended: ReadonlyArray<NuxtDoctorConfig>;
|
|
28
|
+
readonly all: ReadonlyArray<NuxtDoctorConfig>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare const finalPlugin: NuxtDoctorPlugin;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { type CoreRule, NUXT_AUTO_IMPORTED, NUXT_RULES, type NuxtDoctorConfig, type NuxtDoctorPlugin, type NuxtDoctorRuleModule, type Severity, finalPlugin as default, finalPlugin as plugin };
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { NUXT_AUTO_IMPORTED, NUXT_RULES, NUXT_RULES as NUXT_RULES$1 } from "@geoql/doctor-rule-core";
|
|
2
|
+
import { toESLintRule } from "@geoql/eslint-plugin-vue-doctor";
|
|
3
|
+
//#region src/plugin.ts
|
|
4
|
+
const SEVERITY_TO_ESLINT = {
|
|
5
|
+
error: "error",
|
|
6
|
+
warn: "warn",
|
|
7
|
+
info: "warn"
|
|
8
|
+
};
|
|
9
|
+
function toRecord(rules) {
|
|
10
|
+
const out = {};
|
|
11
|
+
for (const core of rules) out[core.id] = toESLintRule(core);
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
function toMetaRecord(rules) {
|
|
15
|
+
const out = {};
|
|
16
|
+
for (const core of rules) out[core.id] = {
|
|
17
|
+
id: core.id,
|
|
18
|
+
severity: core.severity,
|
|
19
|
+
recommended: core.recommended,
|
|
20
|
+
category: core.category
|
|
21
|
+
};
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
const NUXT_DOCTOR_VERSION = "1.0.0";
|
|
25
|
+
const rules = toRecord(NUXT_RULES$1);
|
|
26
|
+
const ruleMeta = toMetaRecord(NUXT_RULES$1);
|
|
27
|
+
function buildConfigs(self) {
|
|
28
|
+
const recommendedConfig = {
|
|
29
|
+
files: ["**/*.{js,jsx,ts,tsx,vue}"],
|
|
30
|
+
plugins: { "nuxt-doctor": self },
|
|
31
|
+
rules: Object.fromEntries(NUXT_RULES$1.filter((r) => r.recommended).map((r) => [`nuxt-doctor/${r.id}`, SEVERITY_TO_ESLINT[r.severity]]))
|
|
32
|
+
};
|
|
33
|
+
const allConfig = {
|
|
34
|
+
files: ["**/*.{js,jsx,ts,tsx,vue}"],
|
|
35
|
+
plugins: { "nuxt-doctor": self },
|
|
36
|
+
rules: Object.fromEntries(NUXT_RULES$1.map((r) => [`nuxt-doctor/${r.id}`, SEVERITY_TO_ESLINT[r.severity]]))
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
recommended: [recommendedConfig],
|
|
40
|
+
all: [allConfig]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const finalPlugin = {
|
|
44
|
+
meta: {
|
|
45
|
+
name: "nuxt-doctor",
|
|
46
|
+
version: NUXT_DOCTOR_VERSION
|
|
47
|
+
},
|
|
48
|
+
rules,
|
|
49
|
+
ruleMeta,
|
|
50
|
+
configs: buildConfigs({
|
|
51
|
+
meta: {
|
|
52
|
+
name: "nuxt-doctor",
|
|
53
|
+
version: NUXT_DOCTOR_VERSION
|
|
54
|
+
},
|
|
55
|
+
rules,
|
|
56
|
+
ruleMeta,
|
|
57
|
+
configs: {
|
|
58
|
+
recommended: [],
|
|
59
|
+
all: []
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { NUXT_AUTO_IMPORTED, NUXT_RULES, finalPlugin as default, finalPlugin as plugin };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["NUXT_RULES"],"sources":["../src/plugin.ts"],"sourcesContent":["import {\n type CoreRule,\n type Severity,\n NUXT_RULES,\n} from '@geoql/doctor-rule-core';\nimport { toESLintRule } from '@geoql/eslint-plugin-vue-doctor';\n\ntype ESLintSeverity = 'error' | 'warn';\n\nexport interface NuxtDoctorRuleModule {\n readonly id: string;\n readonly severity: Severity;\n readonly recommended: boolean;\n readonly category: string;\n}\n\nexport interface NuxtDoctorConfig {\n readonly files: ReadonlyArray<string>;\n readonly plugins: { readonly 'nuxt-doctor': NuxtDoctorPlugin };\n readonly rules: Readonly<Record<string, ESLintSeverity>>;\n}\n\nexport interface NuxtDoctorPlugin {\n readonly meta: { readonly name: 'nuxt-doctor'; readonly version: string };\n readonly rules: Readonly<Record<string, ReturnType<typeof toESLintRule>>>;\n readonly ruleMeta: Readonly<Record<string, NuxtDoctorRuleModule>>;\n readonly configs: {\n readonly recommended: ReadonlyArray<NuxtDoctorConfig>;\n readonly all: ReadonlyArray<NuxtDoctorConfig>;\n };\n}\n\nconst SEVERITY_TO_ESLINT: Readonly<Record<Severity, ESLintSeverity>> = {\n error: 'error',\n warn: 'warn',\n info: 'warn',\n};\n\nfunction toRecord(\n rules: readonly CoreRule[],\n): Record<string, ReturnType<typeof toESLintRule>> {\n const out: Record<string, ReturnType<typeof toESLintRule>> = {};\n for (const core of rules) {\n out[core.id] = toESLintRule(core);\n }\n return out;\n}\n\nfunction toMetaRecord(\n rules: readonly CoreRule[],\n): Record<string, NuxtDoctorRuleModule> {\n const out: Record<string, NuxtDoctorRuleModule> = {};\n for (const core of rules) {\n out[core.id] = {\n id: core.id,\n severity: core.severity,\n recommended: core.recommended,\n category: core.category,\n };\n }\n return out;\n}\n\nconst NUXT_DOCTOR_VERSION = '1.0.0';\n\nconst rules = toRecord(NUXT_RULES);\nconst ruleMeta = toMetaRecord(NUXT_RULES);\n\nfunction buildConfigs(self: NuxtDoctorPlugin): NuxtDoctorPlugin['configs'] {\n const recommendedConfig: NuxtDoctorConfig = {\n files: ['**/*.{js,jsx,ts,tsx,vue}'],\n plugins: { 'nuxt-doctor': self },\n rules: Object.fromEntries(\n NUXT_RULES.filter((r) => r.recommended).map((r) => [\n `nuxt-doctor/${r.id}`,\n SEVERITY_TO_ESLINT[r.severity],\n ]),\n ),\n };\n const allConfig: NuxtDoctorConfig = {\n files: ['**/*.{js,jsx,ts,tsx,vue}'],\n plugins: { 'nuxt-doctor': self },\n rules: Object.fromEntries(\n NUXT_RULES.map((r) => [\n `nuxt-doctor/${r.id}`,\n SEVERITY_TO_ESLINT[r.severity],\n ]),\n ),\n };\n return {\n recommended: [recommendedConfig],\n all: [allConfig],\n };\n}\n\nconst plugin: NuxtDoctorPlugin = {\n meta: { name: 'nuxt-doctor', version: NUXT_DOCTOR_VERSION },\n rules,\n ruleMeta,\n configs: { recommended: [], all: [] },\n};\n\nconst finalPlugin: NuxtDoctorPlugin = {\n meta: { name: 'nuxt-doctor', version: NUXT_DOCTOR_VERSION },\n rules,\n ruleMeta,\n configs: buildConfigs(plugin),\n};\n\nexport default finalPlugin;\nexport { finalPlugin as plugin };\n"],"mappings":";;;AAgCA,MAAM,qBAAiE;CACrE,OAAO;CACP,MAAM;CACN,MAAM;AACR;AAEA,SAAS,SACP,OACiD;CACjD,MAAM,MAAuD,CAAC;CAC9D,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,MAAM,aAAa,IAAI;CAElC,OAAO;AACT;AAEA,SAAS,aACP,OACsC;CACtC,MAAM,MAA4C,CAAC;CACnD,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,MAAM;EACb,IAAI,KAAK;EACT,UAAU,KAAK;EACf,aAAa,KAAK;EAClB,UAAU,KAAK;CACjB;CAEF,OAAO;AACT;AAEA,MAAM,sBAAsB;AAE5B,MAAM,QAAQ,SAASA,YAAU;AACjC,MAAM,WAAW,aAAaA,YAAU;AAExC,SAAS,aAAa,MAAqD;CACzE,MAAM,oBAAsC;EAC1C,OAAO,CAAC,0BAA0B;EAClC,SAAS,EAAE,eAAe,KAAK;EAC/B,OAAO,OAAO,YACZA,aAAW,QAAQ,MAAM,EAAE,WAAW,EAAE,KAAK,MAAM,CACjD,eAAe,EAAE,MACjB,mBAAmB,EAAE,SACvB,CAAC,CACH;CACF;CACA,MAAM,YAA8B;EAClC,OAAO,CAAC,0BAA0B;EAClC,SAAS,EAAE,eAAe,KAAK;EAC/B,OAAO,OAAO,YACZA,aAAW,KAAK,MAAM,CACpB,eAAe,EAAE,MACjB,mBAAmB,EAAE,SACvB,CAAC,CACH;CACF;CACA,OAAO;EACL,aAAa,CAAC,iBAAiB;EAC/B,KAAK,CAAC,SAAS;CACjB;AACF;AASA,MAAM,cAAgC;CACpC,MAAM;EAAE,MAAM;EAAe,SAAS;CAAoB;CAC1D;CACA;CACA,SAAS,aAAa;EAVtB,MAAM;GAAE,MAAM;GAAe,SAAS;EAAoB;EAC1D;EACA;EACA,SAAS;GAAE,aAAa,CAAC;GAAG,KAAK,CAAC;EAAE;CAOT,CAAC;AAC9B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geoql/eslint-plugin-nuxt-doctor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "ESLint flat-config plugin for Nuxt 4 anti-patterns and AI-slop detection. Shares the same rule cores as @geoql/oxlint-plugin-nuxt-doctor and the eslint-plugin-vue-doctor rules. TypeScript, ESM.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"ai-slop",
|
|
8
|
+
"eslint",
|
|
9
|
+
"eslint-plugin",
|
|
10
|
+
"geoql",
|
|
11
|
+
"lint",
|
|
12
|
+
"nuxt",
|
|
13
|
+
"nuxt4"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/geoql/doctor#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/geoql/doctor/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Vinayak Kulkarni",
|
|
22
|
+
"email": "inbox.vinayak@gmail.com",
|
|
23
|
+
"url": "https://vinayakkulkarni.dev"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/geoql/doctor.git",
|
|
28
|
+
"directory": "packages/eslint-plugin-nuxt-doctor"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"type": "module",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@geoql/eslint-plugin-vue-doctor": "^1.0.0",
|
|
46
|
+
"@geoql/doctor-rule-core": "1.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^25.9.3",
|
|
50
|
+
"@typescript-eslint/parser": "^8.61.1",
|
|
51
|
+
"eslint": "^10.5.0",
|
|
52
|
+
"typescript": "^6.0.3",
|
|
53
|
+
"vitest": "^4.1.9",
|
|
54
|
+
"@geoql/doctor-core": "1.1.1"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"eslint": ">=9.0.0"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=24"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"lint": "vp lint src",
|
|
64
|
+
"lint:fix": "vp lint src --fix",
|
|
65
|
+
"format": "vp fmt",
|
|
66
|
+
"format:check": "vp fmt --check",
|
|
67
|
+
"build": "vp pack",
|
|
68
|
+
"test": "vitest run"
|
|
69
|
+
}
|
|
70
|
+
}
|