@remylagerweij/vue-doctor 1.1.2 → 2.0.1
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 +54 -21
- package/dist/baseline-BKB_9B33.js +6919 -0
- package/dist/baseline-CvI0x3dv.js +3 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +3179 -1307
- package/dist/constants-CeYU52R7.js +6 -0
- package/dist/diagnose-BdHGmTpm.js +2358 -0
- package/dist/diagnose-CGPcvfhI.js +3 -0
- package/dist/discover-project-Bgz3pq6f.js +262 -0
- package/dist/discover-project-CDEFT0XH.js +3 -0
- package/dist/find-monorepo-root-DePS93uu.js +53 -0
- package/dist/find-monorepo-root-DhN-SSup.js +3 -0
- package/dist/index.d.ts +364 -5
- package/dist/index.js +9332 -628
- package/dist/knip-worker.js +54 -0
- package/dist/list-source-files-CUakQejy.js +66 -0
- package/dist/model-Bm-qxrHY.js +147 -0
- package/dist/rules-BTNz1N64.js +322 -0
- package/dist/runner-CRvgMfVK.js +180 -0
- package/dist/schema-DqUjL-n-.js +72 -0
- package/dist/schema-kHObH5zY.js +73 -0
- package/dist/server-BdR8FjL9.js +360 -0
- package/dist/vue-doctor-plugin.d.ts +3 -0
- package/dist/vue-doctor-plugin.js +6381 -878
- package/package.json +42 -21
- package/schema/report.schema.json +583 -0
- package/schema/vue-doctor.schema.json +223 -0
- package/dist/report-DWtJXiH9.js +0 -227
package/README.md
CHANGED
|
@@ -12,22 +12,23 @@ npx vue-doctor@latest
|
|
|
12
12
|
|
|
13
13
|
Vue Doctor runs **three parallel analysis passes** on your codebase:
|
|
14
14
|
|
|
15
|
-
### 1. Oxlint + Vue Doctor Plugin (
|
|
15
|
+
### 1. Oxlint + Vue Doctor Plugin (59 rules, 54 on by default)
|
|
16
16
|
Custom ESTree-based rules for Vue.js:
|
|
17
17
|
|
|
18
18
|
| Category | Rules | Examples |
|
|
19
19
|
|----------|-------|---------|
|
|
20
|
-
| **Reactivity** |
|
|
20
|
+
| **Reactivity** | 9 | `no-fetch-in-watch`, `no-watch-for-computed`, `prefer-computed` |
|
|
21
21
|
| **Ecosystem** | 4 | `pinia-no-destructure`, `router-no-string-push` |
|
|
22
22
|
| **Architecture** | 2 | `no-giant-component`, `no-nested-component-definition` |
|
|
23
|
-
| **Performance** |
|
|
24
|
-
| **Security** |
|
|
23
|
+
| **Performance** | 18 | `no-transition-all`, `no-layout-property-animation`, `async-parallel` |
|
|
24
|
+
| **Security** | 3 | `no-secrets-in-client-code`, `no-unsafe-html-sink` |
|
|
25
25
|
| **Bundle Size** | 5 | `no-full-lodash-import`, `no-moment`, `prefer-dynamic-import` |
|
|
26
|
-
| **Correctness** |
|
|
27
|
-
| **Nuxt** |
|
|
26
|
+
| **Correctness** | 8 | `no-array-index-as-key`, `no-prevent-default`, `no-direct-dom-manipulation` |
|
|
27
|
+
| **Nuxt** | 9 | `nuxt-no-img-element`, `nuxt-no-a-element`, `nuxt-async-client-component` |
|
|
28
28
|
| **Server** | 1 | `server-no-console-in-handler` |
|
|
29
|
+
| **Supply Chain** | 3 | `lockfile-integrity`, `no-remote-dependency-spec`, `no-dependency-install-scripts` (project checks) |
|
|
29
30
|
|
|
30
|
-
### 2. ESLint Plugin Vue (
|
|
31
|
+
### 2. ESLint Plugin Vue (20 template rules)
|
|
31
32
|
Template-level analysis with `eslint-plugin-vue`:
|
|
32
33
|
- `vue/require-v-for-key`, `vue/no-use-v-if-with-v-for`
|
|
33
34
|
- `vue/no-mutating-props`, `vue/no-ref-as-operand`
|
|
@@ -66,29 +67,61 @@ vue-doctor --diff main
|
|
|
66
67
|
|
|
67
68
|
## Configuration
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
Put one config file in the project root: `vue-doctor.config.ts` (or `.mts`, `.js`, `.mjs`, `.json`), or a `vueDoctor` key in `package.json`. Parent directories are never searched.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// vue-doctor.config.ts
|
|
74
|
+
import { defineConfig } from "@remylagerweij/vue-doctor";
|
|
75
|
+
|
|
76
|
+
export default defineConfig({
|
|
77
|
+
extends: ["vue-doctor/recommended"], // or "vue-doctor/strict", "vue-doctor/security"
|
|
78
|
+
rules: {
|
|
79
|
+
"no-giant-component": "off",
|
|
80
|
+
"vue-doctor/security/no-unsafe-html-sink": "error",
|
|
81
|
+
},
|
|
82
|
+
ignore: { files: ["src/legacy/**"], rules: ["no-prevent-default"] },
|
|
83
|
+
gate: { failOn: "error", scope: "new", minScore: 70 },
|
|
84
|
+
deadCode: true,
|
|
85
|
+
});
|
|
86
|
+
```
|
|
70
87
|
|
|
71
88
|
```json
|
|
72
89
|
{
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
"paths": ["legacy/**"]
|
|
76
|
-
}
|
|
90
|
+
"$schema": "./node_modules/@remylagerweij/vue-doctor/schema/vue-doctor.schema.json",
|
|
91
|
+
"ignore": { "files": ["src/legacy/**"] }
|
|
77
92
|
}
|
|
78
93
|
```
|
|
79
94
|
|
|
80
|
-
|
|
95
|
+
- `rules` sets a severity (`"off"`, `"warn"`, `"error"`) per rule. Rule IDs are `vue-doctor/<category>/<rule>` (e.g. `vue-doctor/bundle-size/no-moment`), `vue/<rule>` for template rules and `knip/<type>`; `vue-doctor/security/*` selects a whole group. The 1.x forms `no-moment` and `vue-doctor/no-moment` still work but print a deprecation warning.
|
|
96
|
+
- `gate`, `lint`, `deadCode`, `verbose` and `diff` are defaults; command-line flags win.
|
|
97
|
+
- The config is validated: unknown keys and invalid values exit with code 2 and say what is wrong.
|
|
98
|
+
- `.ts`/`.js` configs are executed. Use JSON when scanning untrusted code.
|
|
81
99
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
100
|
+
## Baseline
|
|
101
|
+
|
|
102
|
+
Adopting Vue Doctor on an existing codebase? Record today's findings and only fail on new ones:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx @remylagerweij/vue-doctor baseline # writes .vue-doctor-baseline.json (commit it)
|
|
106
|
+
npx @remylagerweij/vue-doctor --baseline .vue-doctor-baseline.json --gate new --fail-on error
|
|
90
107
|
```
|
|
91
108
|
|
|
109
|
+
Set `"baseline": ".vue-doctor-baseline.json"` in the config to apply it by default. Fingerprints survive code moving within a file.
|
|
110
|
+
|
|
111
|
+
## Suppressing Findings
|
|
112
|
+
|
|
113
|
+
Vue Doctor has its own suppression comments. `eslint-disable` / `oxlint-disable` comments do **not** hide Vue Doctor findings, and Vue Doctor never modifies your files.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// vue-doctor-disable-next-line vue-doctor/bundle-size/no-moment -- legacy report page
|
|
117
|
+
import moment from "moment";
|
|
118
|
+
const html = render(); // vue-doctor-disable-line
|
|
119
|
+
/* vue-doctor-disable vue-doctor/bundle-size/no-moment */ /* vue-doctor-enable vue-doctor/bundle-size/no-moment */
|
|
120
|
+
// vue-doctor-disable-file no-giant-component
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
In `.vue` templates use HTML comments: `<!-- vue-doctor-disable-next-line vue-doctor/security/no-unsafe-html-sink -->`. Without a rule list every rule is suppressed; rules are written as canonical IDs (`vue-doctor/<category>/<rule>`, `vue/<rule>`); the 1.x forms `rule` and `vue-doctor/rule` still work with a deprecation warning.
|
|
124
|
+
|
|
92
125
|
## Programmatic API
|
|
93
126
|
|
|
94
127
|
```ts
|