react-doctor 0.7.0-dev.6b21b70 → 0.7.0-dev.c0c3fc1
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/dist/cli.js +23 -7
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -3
- package/dist/lsp.js +8 -3
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5d16dd1c-3fc1-567b-943f-887174c145c1")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -22405,6 +22405,7 @@ var Diagnostic = class extends Class("Diagnostic")({
|
|
|
22405
22405
|
endLine: optional(Number$1),
|
|
22406
22406
|
endColumn: optional(Number$1),
|
|
22407
22407
|
category: String$1,
|
|
22408
|
+
matchByOccurrence: optional(Boolean$1),
|
|
22408
22409
|
fileContext: optional(Literals(["test", "story"])),
|
|
22409
22410
|
suppressionHint: optional(String$1),
|
|
22410
22411
|
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
@@ -36120,6 +36121,7 @@ const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
|
36120
36121
|
"Accessibility",
|
|
36121
36122
|
"Maintainability"
|
|
36122
36123
|
];
|
|
36124
|
+
const OCCURRENCE_MATCHED_CATEGORIES = new Set(["Accessibility"]);
|
|
36123
36125
|
const APP_ONLY_RULE_KEYS = new Set([
|
|
36124
36126
|
"react-hooks-js/static-components",
|
|
36125
36127
|
"react-doctor/no-render-prop-children",
|
|
@@ -43111,6 +43113,7 @@ const parseRuleCode = (code) => {
|
|
|
43111
43113
|
};
|
|
43112
43114
|
};
|
|
43113
43115
|
const resolveDiagnosticCategory = (plugin, rule) => getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
|
|
43116
|
+
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(reactDoctorPlugin.rules[rule]?.matchByOccurrence);
|
|
43114
43117
|
/**
|
|
43115
43118
|
* Maps oxlint's non-primary labels (`labels[1..]`) into related source
|
|
43116
43119
|
* locations. Editors surface these as a diagnostic's
|
|
@@ -43174,6 +43177,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
43174
43177
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
43175
43178
|
const primarySpan = primaryLabel?.span;
|
|
43176
43179
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
43180
|
+
const category = resolveDiagnosticCategory(plugin, rule);
|
|
43177
43181
|
return {
|
|
43178
43182
|
filePath: normalizedFilePath,
|
|
43179
43183
|
plugin,
|
|
@@ -43189,7 +43193,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
43189
43193
|
offset: primarySpan.offset,
|
|
43190
43194
|
length: primarySpan.length
|
|
43191
43195
|
} : {},
|
|
43192
|
-
category
|
|
43196
|
+
category,
|
|
43197
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
43193
43198
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
43194
43199
|
};
|
|
43195
43200
|
});
|
|
@@ -45425,7 +45430,7 @@ const buildSkippedChecks = (input) => {
|
|
|
45425
45430
|
};
|
|
45426
45431
|
const fingerprintDiagnostic = (diagnostic, lineText) => {
|
|
45427
45432
|
const ruleKey = `${diagnostic.plugin}/${diagnostic.rule}`;
|
|
45428
|
-
const snippet = lineText === null ? "" : createHash("sha1").update(lineText.trim()).digest("hex");
|
|
45433
|
+
const snippet = lineText === null || diagnostic.matchByOccurrence ? "" : createHash("sha1").update(lineText.trim()).digest("hex");
|
|
45429
45434
|
return `${diagnostic.filePath}\u0000${ruleKey}\u0000${snippet}`;
|
|
45430
45435
|
};
|
|
45431
45436
|
/**
|
|
@@ -45436,6 +45441,17 @@ const fingerprintDiagnostic = (diagnostic, lineText) => {
|
|
|
45436
45441
|
* look new, while a genuinely new occurrence (new line text, or one more of
|
|
45437
45442
|
* the same) surfaces. Identical repeated findings are matched by count.
|
|
45438
45443
|
*
|
|
45444
|
+
* Diagnostics carrying `matchByOccurrence` (resolved at diagnostic creation:
|
|
45445
|
+
* every Accessibility-category finding, plus rules opting in via their
|
|
45446
|
+
* `matchByOccurrence` metadata flag) drop the line-text snippet and match by
|
|
45447
|
+
* `(filePath, plugin/rule)` occurrence count alone. Their identity is the
|
|
45448
|
+
* flagged element, not the line's text, so editing the line (reindentation,
|
|
45449
|
+
* prettier reflow, collapsing a multi-line JSX element) doesn't reclassify a
|
|
45450
|
+
* pre-existing finding as new — while one MORE occurrence of the same rule in
|
|
45451
|
+
* the file still surfaces. Expression-level rules keep the line-text snippet:
|
|
45452
|
+
* there the flagged expression IS the finding, so changed text means new +
|
|
45453
|
+
* fixed.
|
|
45454
|
+
*
|
|
45439
45455
|
* v1 limitation: the fingerprint keys on the head-relative `filePath`, and base
|
|
45440
45456
|
* content is read at that same path. A file renamed by the change therefore has
|
|
45441
45457
|
* no base match, so its pre-existing findings are reported as new. This
|
|
@@ -45908,7 +45924,7 @@ const makeNoopConsole = () => ({
|
|
|
45908
45924
|
});
|
|
45909
45925
|
//#endregion
|
|
45910
45926
|
//#region src/cli/utils/version.ts
|
|
45911
|
-
const VERSION = "0.7.0-dev.
|
|
45927
|
+
const VERSION = "0.7.0-dev.c0c3fc1";
|
|
45912
45928
|
//#endregion
|
|
45913
45929
|
//#region src/cli/utils/json-mode.ts
|
|
45914
45930
|
let context = null;
|
|
@@ -46277,13 +46293,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
46277
46293
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
46278
46294
|
* standard `SENTRY_RELEASE` override.
|
|
46279
46295
|
*/
|
|
46280
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.0-dev.
|
|
46296
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.7.0-dev.c0c3fc1`;
|
|
46281
46297
|
/**
|
|
46282
46298
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
46283
46299
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
46284
46300
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
46285
46301
|
*/
|
|
46286
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.0-dev.
|
|
46302
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.7.0-dev.c0c3fc1") ? "development" : "production");
|
|
46287
46303
|
/**
|
|
46288
46304
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
46289
46305
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -64438,4 +64454,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
64438
64454
|
export {};
|
|
64439
64455
|
|
|
64440
64456
|
//# sourceMappingURL=cli.js.map
|
|
64441
|
-
//# debugId=
|
|
64457
|
+
//# debugId=5d16dd1c-3fc1-567b-943f-887174c145c1
|
package/dist/index.d.ts
CHANGED
|
@@ -9493,6 +9493,17 @@ interface Diagnostic {
|
|
|
9493
9493
|
/** 1-indexed end column of the primary span, when derivable. */
|
|
9494
9494
|
endColumn?: number;
|
|
9495
9495
|
category: string;
|
|
9496
|
+
/**
|
|
9497
|
+
* Set when the finding's identity is the flagged element itself (a missing
|
|
9498
|
+
* attribute, a wrong element) rather than the flagged line's text — every
|
|
9499
|
+
* Accessibility-category finding, plus rules that opt in via their
|
|
9500
|
+
* `matchByOccurrence` metadata flag. `computeDiagnosticDelta` matches these
|
|
9501
|
+
* by `(filePath, plugin/rule)` occurrence count, so reformatting the flagged
|
|
9502
|
+
* line doesn't reclassify a pre-existing finding as new. Resolved at
|
|
9503
|
+
* diagnostic creation, where rule metadata is available. Absent means
|
|
9504
|
+
* line-text-sensitive matching (the default).
|
|
9505
|
+
*/
|
|
9506
|
+
matchByOccurrence?: boolean;
|
|
9496
9507
|
/**
|
|
9497
9508
|
* Set when the file never ships to users (`"test"` / `"story"`), so
|
|
9498
9509
|
* renderers can label the site instead of implying production impact.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cf5e895a-deab-574a-b55b-a973e310d0e0")}catch(e){}}();
|
|
3
3
|
import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as NFS from "node:fs";
|
|
@@ -19304,6 +19304,7 @@ var Diagnostic = class extends Class("Diagnostic")({
|
|
|
19304
19304
|
endLine: optional(Number$1),
|
|
19305
19305
|
endColumn: optional(Number$1),
|
|
19306
19306
|
category: String$1,
|
|
19307
|
+
matchByOccurrence: optional(Boolean$1),
|
|
19307
19308
|
fileContext: optional(Literals(["test", "story"])),
|
|
19308
19309
|
suppressionHint: optional(String$1),
|
|
19309
19310
|
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
@@ -32919,6 +32920,7 @@ const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
|
32919
32920
|
"Accessibility",
|
|
32920
32921
|
"Maintainability"
|
|
32921
32922
|
];
|
|
32923
|
+
const OCCURRENCE_MATCHED_CATEGORIES = new Set(["Accessibility"]);
|
|
32922
32924
|
const APP_ONLY_RULE_KEYS = new Set([
|
|
32923
32925
|
"react-hooks-js/static-components",
|
|
32924
32926
|
"react-doctor/no-render-prop-children",
|
|
@@ -39868,6 +39870,7 @@ const parseRuleCode = (code) => {
|
|
|
39868
39870
|
};
|
|
39869
39871
|
};
|
|
39870
39872
|
const resolveDiagnosticCategory = (plugin, rule) => getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
|
|
39873
|
+
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(reactDoctorPlugin.rules[rule]?.matchByOccurrence);
|
|
39871
39874
|
/**
|
|
39872
39875
|
* Maps oxlint's non-primary labels (`labels[1..]`) into related source
|
|
39873
39876
|
* locations. Editors surface these as a diagnostic's
|
|
@@ -39931,6 +39934,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
39931
39934
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
39932
39935
|
const primarySpan = primaryLabel?.span;
|
|
39933
39936
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
39937
|
+
const category = resolveDiagnosticCategory(plugin, rule);
|
|
39934
39938
|
return {
|
|
39935
39939
|
filePath: normalizedFilePath,
|
|
39936
39940
|
plugin,
|
|
@@ -39946,7 +39950,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
39946
39950
|
offset: primarySpan.offset,
|
|
39947
39951
|
length: primarySpan.length
|
|
39948
39952
|
} : {},
|
|
39949
|
-
category
|
|
39953
|
+
category,
|
|
39954
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
39950
39955
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
39951
39956
|
};
|
|
39952
39957
|
});
|
|
@@ -42436,4 +42441,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
42436
42441
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, hasReactRuntime, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
42437
42442
|
|
|
42438
42443
|
//# sourceMappingURL=index.js.map
|
|
42439
|
-
//# debugId=
|
|
42444
|
+
//# debugId=cf5e895a-deab-574a-b55b-a973e310d0e0
|
package/dist/lsp.js
CHANGED
|
@@ -19333,6 +19333,7 @@ var Diagnostic = class extends Class("Diagnostic")({
|
|
|
19333
19333
|
endLine: optional(Number$1),
|
|
19334
19334
|
endColumn: optional(Number$1),
|
|
19335
19335
|
category: String$1,
|
|
19336
|
+
matchByOccurrence: optional(Boolean$1),
|
|
19336
19337
|
fileContext: optional(Literals(["test", "story"])),
|
|
19337
19338
|
suppressionHint: optional(String$1),
|
|
19338
19339
|
relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation)),
|
|
@@ -32978,6 +32979,7 @@ const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
|
32978
32979
|
"Accessibility",
|
|
32979
32980
|
"Maintainability"
|
|
32980
32981
|
];
|
|
32982
|
+
const OCCURRENCE_MATCHED_CATEGORIES = new Set(["Accessibility"]);
|
|
32981
32983
|
const APP_ONLY_RULE_KEYS = new Set([
|
|
32982
32984
|
"react-hooks-js/static-components",
|
|
32983
32985
|
"react-doctor/no-render-prop-children",
|
|
@@ -39853,6 +39855,7 @@ const parseRuleCode = (code) => {
|
|
|
39853
39855
|
};
|
|
39854
39856
|
};
|
|
39855
39857
|
const resolveDiagnosticCategory = (plugin, rule) => getRuleCategory(rule) ?? lookupOwnString(PLUGIN_CATEGORY_MAP, plugin) ?? "Bugs";
|
|
39858
|
+
const resolveMatchByOccurrence = (rule, category) => OCCURRENCE_MATCHED_CATEGORIES.has(category) || Boolean(reactDoctorPlugin.rules[rule]?.matchByOccurrence);
|
|
39856
39859
|
/**
|
|
39857
39860
|
* Maps oxlint's non-primary labels (`labels[1..]`) into related source
|
|
39858
39861
|
* locations. Editors surface these as a diagnostic's
|
|
@@ -39916,6 +39919,7 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
39916
39919
|
const normalizedFilePath = diagnostic.filename.replaceAll("\\", "/");
|
|
39917
39920
|
const primarySpan = primaryLabel?.span;
|
|
39918
39921
|
const relatedLocations = buildRelatedLocations(diagnostic.labels, normalizedFilePath);
|
|
39922
|
+
const category = resolveDiagnosticCategory(plugin, rule);
|
|
39919
39923
|
return {
|
|
39920
39924
|
filePath: normalizedFilePath,
|
|
39921
39925
|
plugin,
|
|
@@ -39931,7 +39935,8 @@ const parseOxlintOutput = (stdout, project, rootDirectory) => {
|
|
|
39931
39935
|
offset: primarySpan.offset,
|
|
39932
39936
|
length: primarySpan.length
|
|
39933
39937
|
} : {},
|
|
39934
|
-
category
|
|
39938
|
+
category,
|
|
39939
|
+
...resolveMatchByOccurrence(rule, category) ? { matchByOccurrence: true } : {},
|
|
39935
39940
|
...relatedLocations.length > 0 ? { relatedLocations } : {}
|
|
39936
39941
|
};
|
|
39937
39942
|
});
|
|
@@ -44155,5 +44160,5 @@ const startLanguageServer = () => {
|
|
|
44155
44160
|
};
|
|
44156
44161
|
//#endregion
|
|
44157
44162
|
export { startLanguageServer };
|
|
44158
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
44159
|
-
//# debugId=
|
|
44163
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="07f4ef15-cbc2-553c-ac41-b73f1d3b7bf8")}catch(e){}}();
|
|
44164
|
+
//# debugId=07f4ef15-cbc2-553c-ac41-b73f1d3b7bf8
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.7.0-dev.
|
|
3
|
+
"version": "0.7.0-dev.c0c3fc1",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
67
|
"yaml": "^2.9.0",
|
|
68
68
|
"deslop-js": "0.7.0",
|
|
69
|
-
"oxlint-plugin-react-doctor": "0.7.0-dev.
|
|
69
|
+
"oxlint-plugin-react-doctor": "0.7.0-dev.c0c3fc1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__code-frame": "^7.27.0",
|