@geoql/doctor-core 0.1.0-alpha.0 → 0.1.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 +70 -10
- package/dist/index.d.ts +381 -11
- package/dist/index.js +2895 -198
- package/dist/index.js.map +1 -1
- package/dist/load-BGjurxpY.js +629 -0
- package/dist/load-BGjurxpY.js.map +1 -0
- package/package.json +14 -5
package/README.md
CHANGED
|
@@ -1,34 +1,94 @@
|
|
|
1
1
|
# `@geoql/doctor-core`
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> The audit engine behind [`@geoql/vue-doctor`](../vue-doctor) and [`@geoql/nuxt-doctor`](../nuxt-doctor).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This is the library that does the work. The two CLIs are thin `cac` wrappers; everything real lives here: the hybrid scan, scoring, reporters, config loading, and project detection. You usually depend on a CLI, not on this package directly. Reach for `doctor-core` only when you're embedding the audit into your own tool.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
2. **Script pass** — spawns `oxlint` as a subprocess with a generated `.oxlintrc.json` that activates oxlint's built-in `vue` plugin AND a custom `jsPlugins` entry (`@geoql/oxlint-plugin-vue-doctor`).
|
|
7
|
+
## What it does
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
`doctor-core` runs a **hybrid two-pass scan** over a Vue 3 or Nuxt 4 project, as locked in [`docs/ARCHITECTURE.md`](../../docs/ARCHITECTURE.md):
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- **Pass 1 — template AST.** Parses `.vue` SFCs with `@vue/compiler-sfc` and walks the template AST in-process. This is the only pass that can see the template, so template-shaped rules (`v-for` missing `:key`, `v-if`/`v-for` on the same node, inline object props in lists) live here.
|
|
12
|
+
- **Pass 2 — script ESTree.** Spawns `oxlint` as a subprocess against a generated `.oxlintrc.json` that turns on oxlint's native `vue` plugin plus the doctor JS plugins (`@geoql/oxlint-plugin-vue-doctor`, `@geoql/oxlint-plugin-nuxt-doctor`). oxlint only hands JS plugins the extracted `<script>`, so all script-level rules run here.
|
|
13
|
+
|
|
14
|
+
Diagnostics from both passes are merged and deduped on `(file, line, column, ruleId)`, then collapsed into a deterministic 0–100 score. Scoring uses fixed severity weights (`error` = 5, `warn` = 2, `info` = 0.5) with √-decay on repeat offenders so one noisy rule can't tank the whole score. Same code in, same score out: no randomness, no config-tunable weights.
|
|
15
|
+
|
|
16
|
+
It also owns the pieces the CLIs surface: the config loader (`doctor.config.ts` via `c12`), project/capability detection used to gate rules, the rule registry, and every reporter format.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm i @geoql/doctor-core
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Published on [npm](https://www.npmjs.com/package/@geoql/doctor-core) and [JSR](https://jsr.io/@geoql/doctor-core) at `v0.1.0` with provenance. ESM-only. `knip` and `oxlint` are peer dependencies (the dead-code and script passes shell out to them).
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
The main entry is `audit()`. It returns a report carrying diagnostics, the numeric score, the score breakdown, detected project info, and a process exit code.
|
|
13
29
|
|
|
14
30
|
```ts
|
|
15
|
-
import { audit } from '@geoql/doctor-core';
|
|
31
|
+
import { audit, format } from '@geoql/doctor-core';
|
|
16
32
|
|
|
17
33
|
const report = await audit({
|
|
18
34
|
rootDir: process.cwd(),
|
|
19
35
|
include: ['**/*.vue', '**/*.ts'],
|
|
36
|
+
exclude: ['node_modules', 'dist', '.nuxt', '.output'],
|
|
20
37
|
failOn: 'error',
|
|
21
38
|
});
|
|
22
39
|
|
|
23
|
-
for (const
|
|
40
|
+
for (const d of report.diagnostics) {
|
|
24
41
|
console.log(
|
|
25
|
-
`${
|
|
42
|
+
`${d.file}:${d.line}:${d.column} ${d.severity} ${d.ruleId}: ${d.message}`,
|
|
26
43
|
);
|
|
27
44
|
}
|
|
45
|
+
|
|
28
46
|
console.log(`Score: ${report.score}/100`);
|
|
47
|
+
console.log(`Exit code: ${report.exitCode}`);
|
|
48
|
+
|
|
49
|
+
// Render any reporter format. `format()` takes a ReporterInput,
|
|
50
|
+
// which you assemble from the report.
|
|
51
|
+
process.stdout.write(
|
|
52
|
+
format(
|
|
53
|
+
{
|
|
54
|
+
toolName: '@geoql/vue-doctor',
|
|
55
|
+
toolVersion: '0.1.0',
|
|
56
|
+
rootDirectory: report.rootDir,
|
|
57
|
+
analyzedFileCount: report.filesScanned,
|
|
58
|
+
elapsedMs: report.elapsedMs,
|
|
59
|
+
diagnostics: report.diagnostics,
|
|
60
|
+
score: report.scoreResult,
|
|
61
|
+
projectInfo: report.projectInfo,
|
|
62
|
+
},
|
|
63
|
+
'agent',
|
|
64
|
+
),
|
|
65
|
+
);
|
|
29
66
|
```
|
|
30
67
|
|
|
31
|
-
|
|
68
|
+
Severity is `error | warn | info` throughout. `failOn` accepts `error | warn | none`.
|
|
69
|
+
|
|
70
|
+
### Key exports
|
|
71
|
+
|
|
72
|
+
| Export | Purpose |
|
|
73
|
+
| ------------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
74
|
+
| `audit` | Run the two-pass scan and return the full report. |
|
|
75
|
+
| `format` | Render a report as `agent`, `pretty`, `json`, `json-compact`, `sarif`, or `html`. |
|
|
76
|
+
| `loadDoctorConfig`, `defineConfig`, `mergeCliOverrides` | Load `doctor.config.ts` (via `c12`) and layer CLI overrides on top. |
|
|
77
|
+
| `detectProject` | Detect framework, versions, and capability tokens used to gate rules. |
|
|
78
|
+
| `listRules`, `RULE_REGISTRY`, `loadRuleDoc` | Inspect the rule registry and per-rule docs. |
|
|
79
|
+
| `scoreDiagnostics` | Deterministic 0–100 scoring with the breakdown. |
|
|
80
|
+
| `listChangedFiles` | Resolve diff/staged file scopes for incremental runs. |
|
|
81
|
+
| `encodeAnnotations` | Emit GitHub Actions `::error::` / `::warning::` lines. |
|
|
82
|
+
|
|
83
|
+
Types ship alongside (`AuditConfig`, `AuditReport`, `Diagnostic`, `Severity`, `ReporterFormat`, `ProjectInfo`, `ScoreResult`, and more).
|
|
84
|
+
|
|
85
|
+
## Scope
|
|
86
|
+
|
|
87
|
+
Vue 3 and Nuxt 4 only. Nuxt detection expects the `app/` directory layout with `compatibilityVersion: 4`.
|
|
88
|
+
|
|
89
|
+
## Architecture
|
|
90
|
+
|
|
91
|
+
See [`docs/ARCHITECTURE.md`](../../docs/ARCHITECTURE.md) for the full two-pass design, the empirical oxlint findings that shaped it, and the canonical `Diagnostic` shape.
|
|
32
92
|
|
|
33
93
|
## License
|
|
34
94
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
|
+
//#region src/score.d.ts
|
|
2
|
+
interface ScoreBreakdownEntry {
|
|
3
|
+
ruleId: string;
|
|
4
|
+
occurrences: number;
|
|
5
|
+
weightPerOccurrence: number;
|
|
6
|
+
penalty: number;
|
|
7
|
+
}
|
|
8
|
+
interface ScoreResult {
|
|
9
|
+
score: number;
|
|
10
|
+
passed: boolean;
|
|
11
|
+
threshold: number;
|
|
12
|
+
totalFindings: number;
|
|
13
|
+
errorCount: number;
|
|
14
|
+
warnCount: number;
|
|
15
|
+
infoCount: number;
|
|
16
|
+
breakdown: ScoreBreakdownEntry[];
|
|
17
|
+
}
|
|
18
|
+
interface ScoreConfig {
|
|
19
|
+
rules?: Record<string, {
|
|
20
|
+
weight?: number;
|
|
21
|
+
}>;
|
|
22
|
+
threshold?: number;
|
|
23
|
+
}
|
|
24
|
+
declare function scoreDiagnostics(diagnostics: Diagnostic[], config?: ScoreConfig): ScoreResult;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/types/project-info.d.ts
|
|
27
|
+
type Framework = 'vue' | 'nuxt' | 'unknown';
|
|
28
|
+
type Capability = string;
|
|
29
|
+
type MonorepoKind = 'pnpm' | 'yarn' | 'npm' | 'turbo' | null;
|
|
30
|
+
interface ProjectInfo {
|
|
31
|
+
readonly framework: Framework;
|
|
32
|
+
readonly rootDirectory: string;
|
|
33
|
+
readonly packageJsonPath: string | null;
|
|
34
|
+
readonly vueVersion: string | null;
|
|
35
|
+
readonly nuxtVersion: string | null;
|
|
36
|
+
readonly typescriptVersion: string | null;
|
|
37
|
+
readonly hasAutoImports: boolean;
|
|
38
|
+
readonly hasComponentsAutoImport: boolean;
|
|
39
|
+
readonly hasPinia: boolean;
|
|
40
|
+
readonly hasVueRouter: boolean;
|
|
41
|
+
readonly nitroPreset: string | null;
|
|
42
|
+
readonly nuxtCompatibilityVersion: 3 | 4 | null;
|
|
43
|
+
readonly monorepoKind: MonorepoKind;
|
|
44
|
+
readonly nuxtConfigPath: string | null;
|
|
45
|
+
readonly hasAppDir: boolean;
|
|
46
|
+
readonly appDirPath: string | null;
|
|
47
|
+
readonly hasServerDir: boolean;
|
|
48
|
+
readonly hasPagesDir: boolean;
|
|
49
|
+
readonly hasWranglerConfig: boolean;
|
|
50
|
+
readonly capabilities: ReadonlySet<Capability>;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/reporters/types.d.ts
|
|
54
|
+
interface ProjectInfoLite {
|
|
55
|
+
readonly framework: Framework;
|
|
56
|
+
readonly vueVersion: string | null;
|
|
57
|
+
readonly nuxtVersion: string | null;
|
|
58
|
+
readonly capabilities: readonly string[];
|
|
59
|
+
readonly rootDirectory: string;
|
|
60
|
+
}
|
|
61
|
+
interface ReporterInput {
|
|
62
|
+
readonly toolName: string;
|
|
63
|
+
readonly toolVersion: string;
|
|
64
|
+
readonly rootDirectory: string;
|
|
65
|
+
readonly analyzedFileCount: number;
|
|
66
|
+
readonly elapsedMs: number;
|
|
67
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
68
|
+
readonly score: ScoreResult;
|
|
69
|
+
readonly projectInfo: ProjectInfoLite;
|
|
70
|
+
}
|
|
71
|
+
interface ReporterOptions {
|
|
72
|
+
readonly color?: boolean;
|
|
73
|
+
readonly quiet?: boolean;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
1
76
|
//#region src/types.d.ts
|
|
2
|
-
type Severity = 'error' | '
|
|
3
|
-
type DiagnosticSource = 'template' | 'oxlint';
|
|
77
|
+
type Severity = 'error' | 'warn' | 'info';
|
|
78
|
+
type DiagnosticSource = 'template' | 'oxlint' | 'sfc' | 'dead-code' | 'project' | 'deps';
|
|
4
79
|
interface Diagnostic {
|
|
5
80
|
file: string;
|
|
6
81
|
line: number;
|
|
@@ -12,13 +87,26 @@ interface Diagnostic {
|
|
|
12
87
|
message: string;
|
|
13
88
|
source: DiagnosticSource;
|
|
14
89
|
recommendation?: string;
|
|
90
|
+
codeSnippet?: string;
|
|
15
91
|
}
|
|
16
92
|
interface AuditConfig {
|
|
17
93
|
rootDir?: string;
|
|
18
94
|
include?: string[];
|
|
19
95
|
exclude?: string[];
|
|
20
96
|
rules?: Record<string, Severity | 'off'>;
|
|
21
|
-
failOn?:
|
|
97
|
+
failOn?: 'error' | 'warn' | 'none';
|
|
98
|
+
deadCode?: boolean;
|
|
99
|
+
lint?: boolean;
|
|
100
|
+
threshold?: number;
|
|
101
|
+
scopeFiles?: string[];
|
|
102
|
+
respectInlineDisables?: boolean;
|
|
103
|
+
}
|
|
104
|
+
interface AuditTimings {
|
|
105
|
+
template: number;
|
|
106
|
+
sfc: number;
|
|
107
|
+
script: number;
|
|
108
|
+
deadCode: number;
|
|
109
|
+
total: number;
|
|
22
110
|
}
|
|
23
111
|
interface AuditReport {
|
|
24
112
|
rootDir: string;
|
|
@@ -26,23 +114,305 @@ interface AuditReport {
|
|
|
26
114
|
diagnostics: Diagnostic[];
|
|
27
115
|
score: number;
|
|
28
116
|
errorCount: number;
|
|
29
|
-
|
|
117
|
+
warnCount: number;
|
|
118
|
+
infoCount: number;
|
|
30
119
|
exitCode: 0 | 1 | 2;
|
|
120
|
+
scoreResult: ScoreResult;
|
|
121
|
+
projectInfo: ProjectInfoLite;
|
|
122
|
+
elapsedMs: number;
|
|
123
|
+
timings: AuditTimings;
|
|
124
|
+
ruleCounts: Record<string, number>;
|
|
31
125
|
}
|
|
32
126
|
//#endregion
|
|
127
|
+
//#region src/annotations.d.ts
|
|
128
|
+
declare function encodeAnnotation(diagnostic: Diagnostic): string;
|
|
129
|
+
declare function encodeAnnotations(diagnostics: Diagnostic[]): string;
|
|
130
|
+
//#endregion
|
|
33
131
|
//#region src/audit.d.ts
|
|
34
132
|
declare function audit(config?: AuditConfig): Promise<AuditReport>;
|
|
35
133
|
//#endregion
|
|
36
|
-
//#region src/
|
|
37
|
-
|
|
38
|
-
|
|
134
|
+
//#region src/check-build-quality.d.ts
|
|
135
|
+
declare function checkBuildQuality(projectInfo: ProjectInfo): Promise<Diagnostic[]>;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/check-deps.d.ts
|
|
138
|
+
declare function checkDeps(projectInfo: ProjectInfo): Promise<Diagnostic[]>;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/config/types.d.ts
|
|
141
|
+
type ConfigSource = 'flag' | 'ts' | 'mjs' | 'js' | 'json' | 'package.json' | 'built-in';
|
|
142
|
+
interface DoctorUserConfig {
|
|
143
|
+
rootDir?: string;
|
|
144
|
+
include?: string[];
|
|
145
|
+
exclude?: string[];
|
|
146
|
+
failOn?: 'error' | 'warn' | 'none';
|
|
147
|
+
threshold?: number;
|
|
148
|
+
preset?: string;
|
|
149
|
+
rules?: Record<string, Severity | 'off'>;
|
|
150
|
+
extends?: string[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Resolved + normalized config that audit consumes.
|
|
154
|
+
* - `rules` is the merged effective severity map (preset base + user overrides - explicit offs).
|
|
155
|
+
* - `preset` is the preset name that was applied as the base.
|
|
156
|
+
*/
|
|
157
|
+
interface ResolvedDoctorConfig {
|
|
158
|
+
rootDir: string;
|
|
159
|
+
include: string[];
|
|
160
|
+
exclude: string[];
|
|
161
|
+
failOn: 'error' | 'warn' | 'none';
|
|
162
|
+
threshold: number;
|
|
163
|
+
rules: Record<string, Severity>;
|
|
164
|
+
preset: 'minimal' | 'recommended' | 'strict' | 'all';
|
|
165
|
+
source: ConfigSource;
|
|
39
166
|
configFile?: string;
|
|
40
167
|
}
|
|
41
|
-
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/dead-code/dedupe.d.ts
|
|
170
|
+
declare function dedupeDeadCodeAgainstLint(deadCode: Diagnostic[], lint: Diagnostic[]): Diagnostic[];
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/dead-code/errors.d.ts
|
|
173
|
+
declare class DeadCodeTimeoutError extends Error {
|
|
174
|
+
name: "DeadCodeTimeoutError";
|
|
175
|
+
constructor(timeoutMs: number);
|
|
176
|
+
}
|
|
177
|
+
declare class DeadCodeImportFailed extends Error {
|
|
178
|
+
name: "DeadCodeImportFailed";
|
|
179
|
+
constructor(cause?: unknown);
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/check-dead-code.d.ts
|
|
183
|
+
interface CheckDeadCodeOptions {
|
|
184
|
+
projectInfo: ProjectInfo;
|
|
185
|
+
doctorConfig: ResolvedDoctorConfig;
|
|
186
|
+
enabled: boolean;
|
|
187
|
+
timeoutMs?: number;
|
|
188
|
+
}
|
|
189
|
+
declare function checkDeadCode(options: CheckDeadCodeOptions): Promise<Diagnostic[]>;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/check-nuxt-project.d.ts
|
|
192
|
+
declare function checkNuxtProject(projectInfo: ProjectInfo): Promise<Diagnostic[]>;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/config/built-in.d.ts
|
|
195
|
+
declare const BUILT_IN_RECOMMENDED: Omit<ResolvedDoctorConfig, 'rootDir' | 'source' | 'configFile'>;
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/config/merge-cli-overrides.d.ts
|
|
198
|
+
interface CliOverrides {
|
|
199
|
+
include?: string[];
|
|
200
|
+
exclude?: string[];
|
|
201
|
+
failOn?: 'error' | 'warn' | 'none';
|
|
202
|
+
threshold?: number;
|
|
203
|
+
rules?: Record<string, Severity | 'off'>;
|
|
204
|
+
}
|
|
205
|
+
declare function mergeCliOverrides(resolved: ResolvedDoctorConfig, cli: CliOverrides): ResolvedDoctorConfig;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/config/errors.d.ts
|
|
208
|
+
declare class ConfigFileNotFoundError extends Error {
|
|
209
|
+
name: "ConfigFileNotFoundError";
|
|
210
|
+
constructor(path: string);
|
|
211
|
+
}
|
|
212
|
+
declare class ConfigCycleError extends Error {
|
|
213
|
+
name: "ConfigCycleError";
|
|
214
|
+
constructor(chain: string[]);
|
|
215
|
+
}
|
|
216
|
+
declare class InvalidConfigError extends Error {
|
|
217
|
+
name: "InvalidConfigError";
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/config/define-config.d.ts
|
|
221
|
+
declare function defineConfig<T extends DoctorUserConfig>(config: T): T;
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/config/load.d.ts
|
|
224
|
+
interface LoadDoctorConfigOptions {
|
|
225
|
+
readonly explicitPath?: string;
|
|
226
|
+
readonly presetOverride?: string;
|
|
227
|
+
}
|
|
228
|
+
declare function loadDoctorConfig(rootDir: string, explicitPathOrOptions?: string | LoadDoctorConfigOptions): Promise<ResolvedDoctorConfig>;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/config/validate.d.ts
|
|
231
|
+
declare function validateConfig(raw: unknown): void;
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/detect-project.d.ts
|
|
234
|
+
declare function detectProject(rootDirectory: string): Promise<ProjectInfo>;
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/disables/apply.d.ts
|
|
237
|
+
interface ApplyInlineDisablesOptions {
|
|
238
|
+
respect: boolean;
|
|
239
|
+
}
|
|
240
|
+
declare function applyInlineDisables(diags: Diagnostic[], opts: ApplyInlineDisablesOptions): Diagnostic[];
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/disables/parse-directives.d.ts
|
|
243
|
+
interface DirectiveRange {
|
|
244
|
+
start: number;
|
|
245
|
+
end: number;
|
|
246
|
+
rules: string[];
|
|
247
|
+
}
|
|
248
|
+
interface DirectiveLine {
|
|
249
|
+
line: number;
|
|
250
|
+
rules: string[];
|
|
251
|
+
}
|
|
252
|
+
interface DirectiveSet {
|
|
253
|
+
blocks: DirectiveRange[];
|
|
254
|
+
nextLine: DirectiveLine[];
|
|
255
|
+
sameLine: DirectiveLine[];
|
|
256
|
+
}
|
|
257
|
+
declare function parseDirectives(text: string): DirectiveSet;
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/git-scope.d.ts
|
|
260
|
+
type GitScopeMode = 'diff' | 'staged';
|
|
261
|
+
interface GitScopeOptions {
|
|
262
|
+
rootDir: string;
|
|
263
|
+
mode: GitScopeMode;
|
|
264
|
+
}
|
|
265
|
+
declare function listChangedFiles(options: GitScopeOptions): Promise<string[]>;
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/nuxt/file-role.d.ts
|
|
268
|
+
/**
|
|
269
|
+
* True when the path points at a Nuxt page component — a `.vue` file under
|
|
270
|
+
* `pages/` (Nuxt 3 layout) or `app/pages/` (Nuxt 4 layout) at the project root.
|
|
271
|
+
*/
|
|
272
|
+
declare function isNuxtPageFile(relPath: string): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* True when the path points at a Nitro server file — a `.ts` file under the
|
|
275
|
+
* project-root `server/` directory.
|
|
276
|
+
*/
|
|
277
|
+
declare function isNuxtServerFile(relPath: string): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* True when the path points at a Nuxt layout component — a `.vue` file under
|
|
280
|
+
* `layouts/` (Nuxt 3 layout) or `app/layouts/` (Nuxt 4 layout) at the project
|
|
281
|
+
* root.
|
|
282
|
+
*/
|
|
283
|
+
declare function isNuxtLayoutFile(relPath: string): boolean;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/nuxt/cross-file/run.d.ts
|
|
286
|
+
interface CrossFilePassOptions {
|
|
287
|
+
files: string[];
|
|
288
|
+
projectInfo: ProjectInfo;
|
|
289
|
+
}
|
|
290
|
+
declare function runCrossFilePass(opts: CrossFilePassOptions): Promise<Diagnostic[]>;
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/oxlint/errors.d.ts
|
|
293
|
+
declare class OxlintSpawnFailed extends Error {
|
|
294
|
+
name: "OxlintSpawnFailed";
|
|
295
|
+
constructor(exitCode: number | null, stderr: string);
|
|
296
|
+
}
|
|
297
|
+
declare class OxlintOutputTooLarge extends Error {
|
|
298
|
+
name: "OxlintOutputTooLarge";
|
|
299
|
+
constructor(maxBytes: number);
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/reporters/agent.d.ts
|
|
303
|
+
declare function agentReport(input: ReporterInput, options?: ReporterOptions): string;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/reporters/docs-url.d.ts
|
|
306
|
+
declare function docsUrl(ruleId: string): string;
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/reporters/sarif.d.ts
|
|
309
|
+
declare function sarifReport(input: ReporterInput): string;
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/reporters/verbose.d.ts
|
|
312
|
+
interface VerboseTraceOptions {
|
|
313
|
+
configSource?: ConfigSource;
|
|
314
|
+
}
|
|
315
|
+
declare function renderVerboseTrace(report: AuditReport, options: VerboseTraceOptions): string;
|
|
42
316
|
//#endregion
|
|
43
317
|
//#region src/reporters/index.d.ts
|
|
44
|
-
type ReporterFormat = '
|
|
45
|
-
declare function format(
|
|
318
|
+
type ReporterFormat = 'agent' | 'pretty' | 'json' | 'json-compact' | 'sarif' | 'html';
|
|
319
|
+
declare function format(input: ReporterInput, kind?: ReporterFormat, options?: ReporterOptions): string;
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/reporters/json.d.ts
|
|
322
|
+
declare const DOCTOR_REPORT_SCHEMA_VERSION = "1";
|
|
323
|
+
interface DoctorReportDiagnostic {
|
|
324
|
+
file: string;
|
|
325
|
+
line: number;
|
|
326
|
+
column: number;
|
|
327
|
+
endLine?: number;
|
|
328
|
+
endColumn?: number;
|
|
329
|
+
ruleId: string;
|
|
330
|
+
severity: Severity;
|
|
331
|
+
message: string;
|
|
332
|
+
source: string;
|
|
333
|
+
recommendation?: string;
|
|
334
|
+
}
|
|
335
|
+
interface DoctorReportBreakdownEntry {
|
|
336
|
+
ruleId: string;
|
|
337
|
+
occurrences: number;
|
|
338
|
+
weightPerOccurrence: number;
|
|
339
|
+
penalty: number;
|
|
340
|
+
}
|
|
341
|
+
interface DoctorReport {
|
|
342
|
+
schemaVersion: string;
|
|
343
|
+
tool: {
|
|
344
|
+
name: string;
|
|
345
|
+
version: string;
|
|
346
|
+
};
|
|
347
|
+
projectInfo: {
|
|
348
|
+
framework: string;
|
|
349
|
+
vueVersion: string | null;
|
|
350
|
+
nuxtVersion: string | null;
|
|
351
|
+
capabilities: string[];
|
|
352
|
+
rootDirectory: string;
|
|
353
|
+
};
|
|
354
|
+
score: {
|
|
355
|
+
value: number;
|
|
356
|
+
threshold: number;
|
|
357
|
+
passed: boolean;
|
|
358
|
+
bySeverity: {
|
|
359
|
+
error: number;
|
|
360
|
+
warn: number;
|
|
361
|
+
info: number;
|
|
362
|
+
};
|
|
363
|
+
breakdown: DoctorReportBreakdownEntry[];
|
|
364
|
+
};
|
|
365
|
+
diagnostics: DoctorReportDiagnostic[];
|
|
366
|
+
timing: {
|
|
367
|
+
elapsedMs: number;
|
|
368
|
+
analyzedFileCount: number;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
declare function buildDoctorReport(input: ReporterInput): DoctorReport;
|
|
372
|
+
declare function jsonReport(input: ReporterInput): string;
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/reporters/json-compact.d.ts
|
|
375
|
+
declare function jsonCompactReport(input: ReporterInput): string;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/reporters/pretty.d.ts
|
|
378
|
+
declare function prettyReport(input: ReporterInput, options?: ReporterOptions): string;
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/rule-docs.d.ts
|
|
381
|
+
interface RuleDoc {
|
|
382
|
+
readonly id: string;
|
|
383
|
+
readonly title: string;
|
|
384
|
+
readonly severity: string;
|
|
385
|
+
readonly category: string;
|
|
386
|
+
readonly recommended: boolean;
|
|
387
|
+
readonly source: string;
|
|
388
|
+
readonly helpUri: string;
|
|
389
|
+
readonly description: string;
|
|
390
|
+
readonly hasOverride: boolean;
|
|
391
|
+
}
|
|
392
|
+
interface LoadRuleDocOptions {
|
|
393
|
+
readonly docsRoot?: string;
|
|
394
|
+
}
|
|
395
|
+
declare function loadRuleDoc(ruleId: string, options?: LoadRuleDocOptions): RuleDoc | null;
|
|
396
|
+
declare function loadAllRuleDocs(options?: LoadRuleDocOptions): RuleDoc[];
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/rule-registry.d.ts
|
|
399
|
+
type RuleCategory = 'ai-slop' | 'reactivity' | 'composition' | 'performance' | 'template' | 'template-perf' | 'build-quality' | 'deps' | 'dead-code' | 'sfc' | 'vue-builtin' | 'structure' | 'modules-deps' | 'nitro' | 'seo' | 'cloudflare' | 'server-routes' | 'hydration' | 'data-fetching';
|
|
400
|
+
type RuleSource = 'doctor' | 'oxlint-builtin' | 'eslint-plugin-vue';
|
|
401
|
+
interface RegisteredRule {
|
|
402
|
+
readonly id: string;
|
|
403
|
+
readonly severity: Severity;
|
|
404
|
+
readonly category: RuleCategory;
|
|
405
|
+
readonly source: RuleSource;
|
|
406
|
+
readonly recommended: boolean;
|
|
407
|
+
}
|
|
408
|
+
declare const RULE_REGISTRY: readonly RegisteredRule[];
|
|
409
|
+
interface ListRulesFilter {
|
|
410
|
+
readonly preset?: 'recommended' | 'all';
|
|
411
|
+
readonly category?: RuleCategory;
|
|
412
|
+
readonly source?: RuleSource;
|
|
413
|
+
readonly severity?: Severity;
|
|
414
|
+
}
|
|
415
|
+
declare function listRules(filter?: ListRulesFilter): RegisteredRule[];
|
|
46
416
|
//#endregion
|
|
47
|
-
export { type AuditConfig, type AuditReport, type Diagnostic, type DiagnosticSource, type ReporterFormat, type Severity, audit, format,
|
|
417
|
+
export { type ApplyInlineDisablesOptions, type AuditConfig, type AuditReport, type AuditTimings, BUILT_IN_RECOMMENDED, type Capability, type CliOverrides, ConfigCycleError, ConfigFileNotFoundError, type ConfigSource, DOCTOR_REPORT_SCHEMA_VERSION, DeadCodeImportFailed, DeadCodeTimeoutError, type Diagnostic, type DiagnosticSource, type DirectiveLine, type DirectiveRange, type DirectiveSet, type DoctorReport, type DoctorUserConfig, type Framework, type GitScopeMode, InvalidConfigError, type ListRulesFilter, type LoadRuleDocOptions, type MonorepoKind, OxlintOutputTooLarge, OxlintSpawnFailed, type ProjectInfo, type ProjectInfoLite, RULE_REGISTRY, type RegisteredRule, type ReporterFormat, type ReporterInput, type ReporterOptions, type ResolvedDoctorConfig, type RuleCategory, type RuleDoc, type RuleSource, type ScoreBreakdownEntry, type ScoreConfig, type ScoreResult, type Severity, type VerboseTraceOptions, agentReport, applyInlineDisables, audit, buildDoctorReport, checkBuildQuality, checkDeadCode, checkDeps, checkNuxtProject, dedupeDeadCodeAgainstLint, defineConfig, detectProject, docsUrl, encodeAnnotation, encodeAnnotations, format, isNuxtLayoutFile, isNuxtPageFile, isNuxtServerFile, jsonCompactReport, jsonReport, listChangedFiles, listRules, loadAllRuleDocs, loadDoctorConfig, loadRuleDoc, mergeCliOverrides, parseDirectives, prettyReport, renderVerboseTrace, runCrossFilePass, sarifReport, scoreDiagnostics, validateConfig };
|
|
48
418
|
//# sourceMappingURL=index.d.ts.map
|