@remylagerweij/vue-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/README.md +124 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1469 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +837 -0
- package/dist/report-DWtJXiH9.js +227 -0
- package/dist/vue-doctor-plugin.d.ts +30 -0
- package/dist/vue-doctor-plugin.js +950 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Vue Doctor 🩺
|
|
2
|
+
|
|
3
|
+
Diagnose and fix performance issues in your Vue.js app. Get a 0–100 health score with actionable recommendations.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx vue-doctor@latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What It Checks
|
|
12
|
+
|
|
13
|
+
Vue Doctor runs **three parallel analysis passes** on your codebase:
|
|
14
|
+
|
|
15
|
+
### 1. Oxlint + Vue Doctor Plugin (42 rules)
|
|
16
|
+
Custom ESTree-based rules for Vue.js:
|
|
17
|
+
|
|
18
|
+
| Category | Rules | Examples |
|
|
19
|
+
|----------|-------|---------|
|
|
20
|
+
| **Reactivity** | 7 | `no-fetch-in-watch`, `no-watch-for-computed`, `prefer-computed` |
|
|
21
|
+
| **Architecture** | 2 | `no-giant-component`, `no-nested-component-definition` |
|
|
22
|
+
| **Performance** | 16 | `no-transition-all`, `no-layout-property-animation`, `async-parallel` |
|
|
23
|
+
| **Security** | 2 | `no-secrets-in-client-code`, `no-v-html` |
|
|
24
|
+
| **Bundle Size** | 5 | `no-full-lodash-import`, `no-moment`, `prefer-dynamic-import` |
|
|
25
|
+
| **Correctness** | 4 | `no-array-index-as-key`, `no-prevent-default`, `no-direct-dom-manipulation` |
|
|
26
|
+
| **Nuxt** | 5 | `nuxt-no-img-element`, `nuxt-no-a-element`, `nuxt-async-client-component` |
|
|
27
|
+
| **Server** | 1 | `server-no-console-in-handler` |
|
|
28
|
+
|
|
29
|
+
### 2. ESLint Plugin Vue (19 template rules)
|
|
30
|
+
Template-level analysis with `eslint-plugin-vue`:
|
|
31
|
+
- `vue/require-v-for-key`, `vue/no-use-v-if-with-v-for`
|
|
32
|
+
- `vue/no-mutating-props`, `vue/no-ref-as-operand`
|
|
33
|
+
- `vue/no-side-effects-in-computed-properties`
|
|
34
|
+
- `vue/component-name-in-template-casing`
|
|
35
|
+
- And more...
|
|
36
|
+
|
|
37
|
+
### 3. Dead Code Detection
|
|
38
|
+
Powered by [Knip](https://github.com/webpro/knip):
|
|
39
|
+
- Unused files, exports, types, dependencies
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Scan current directory
|
|
45
|
+
vue-doctor
|
|
46
|
+
|
|
47
|
+
# Scan a specific project
|
|
48
|
+
vue-doctor --project ./my-vue-app
|
|
49
|
+
|
|
50
|
+
# Score only (for CI)
|
|
51
|
+
vue-doctor --score
|
|
52
|
+
|
|
53
|
+
# Verbose output with file details
|
|
54
|
+
vue-doctor --verbose
|
|
55
|
+
|
|
56
|
+
# Only lint checks (skip dead code)
|
|
57
|
+
vue-doctor --no-dead-code
|
|
58
|
+
|
|
59
|
+
# Only dead code checks (skip lint)
|
|
60
|
+
vue-doctor --no-lint
|
|
61
|
+
|
|
62
|
+
# Scan only changed files (diff mode)
|
|
63
|
+
vue-doctor --diff main
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
Create a `vue-doctor.config.json` in your project root:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"ignore": {
|
|
73
|
+
"rules": ["no-giant-component"],
|
|
74
|
+
"paths": ["legacy/**"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or add to `package.json`:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"vueDoctor": {
|
|
84
|
+
"ignore": {
|
|
85
|
+
"rules": ["no-prevent-default"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Programmatic API
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { diagnose } from "vue-doctor/api";
|
|
95
|
+
|
|
96
|
+
const result = await diagnose({
|
|
97
|
+
directory: "./my-vue-app",
|
|
98
|
+
lint: true,
|
|
99
|
+
deadCode: true,
|
|
100
|
+
verbose: false,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
console.log(result.scoreResult?.score); // 0–100
|
|
104
|
+
console.log(result.diagnostics.length); // number of issues
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## GitHub Action
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
- uses: remylagerweij/vue-doctor@v1
|
|
111
|
+
with:
|
|
112
|
+
directory: "."
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Framework Support
|
|
116
|
+
|
|
117
|
+
- **Vue 3** (Composition API, `<script setup>`)
|
|
118
|
+
- **Nuxt 3** (auto-detected, enables Nuxt-specific rules)
|
|
119
|
+
- **Vite** / **Quasar** / **Vue CLI**
|
|
120
|
+
- **Monorepo** workspaces (npm, pnpm, yarn)
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
package/dist/cli.d.ts
ADDED