react-doctor 0.5.8-dev.6339f71 → 0.5.8-dev.6e67626
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 +9 -3
- package/dist/cli.js +9038 -1377
- package/dist/index.d.ts +9 -0
- package/dist/index.js +87 -50
- package/dist/lsp.js +92 -50
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -9271,6 +9271,15 @@ interface ReactDoctorConfig {
|
|
|
9271
9271
|
* suppresses regardless of sibling content.
|
|
9272
9272
|
*/
|
|
9273
9273
|
rawTextWrapperComponents?: string[];
|
|
9274
|
+
/**
|
|
9275
|
+
* Capitalized identifiers that exist at runtime but aren't imported in
|
|
9276
|
+
* the file that uses them — react-live's `<LiveProvider scope={...}>`,
|
|
9277
|
+
* Storybook globals, MDX live blocks, or an ambient `declare global` in a
|
|
9278
|
+
* separate `.d.ts`. The single-file `jsx-no-undef` rule can't see those
|
|
9279
|
+
* bindings and would report `<DatePicker />` as an undefined JSX component.
|
|
9280
|
+
* List the injected names here and `jsx-no-undef` treats them as known.
|
|
9281
|
+
*/
|
|
9282
|
+
runtimeGlobals?: string[];
|
|
9274
9283
|
/**
|
|
9275
9284
|
* Project-level allowlist of function names that the
|
|
9276
9285
|
* `server-auth-actions` rule treats as an auth check at the top of
|
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]="3fb133b5-fc1f-519f-8f76-6f1d3bb556ce")}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";
|
|
@@ -34999,6 +34999,7 @@ const collectStringSet = (values) => {
|
|
|
34999
34999
|
if (!Array.isArray(values)) return /* @__PURE__ */ new Set();
|
|
35000
35000
|
return new Set(values.filter((value) => typeof value === "string"));
|
|
35001
35001
|
};
|
|
35002
|
+
const JSX_NO_UNDEF_IDENTIFIER_PATTERN = /^`([^`]+)`/;
|
|
35002
35003
|
/**
|
|
35003
35004
|
* Pre-compiles every stateful filter and returns a single
|
|
35004
35005
|
* `apply(diagnostic)` closure that runs (in order):
|
|
@@ -35032,11 +35033,28 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
35032
35033
|
const compiledOverrides = compileIgnoreOverrides(userConfig);
|
|
35033
35034
|
const textComponentNames = collectStringSet(userConfig?.textComponents);
|
|
35034
35035
|
const rawTextWrapperComponentNames = collectStringSet(userConfig?.rawTextWrapperComponents);
|
|
35036
|
+
const runtimeGlobalNames = collectStringSet(userConfig?.runtimeGlobals);
|
|
35035
35037
|
const hasTextComponents = textComponentNames.size > 0;
|
|
35036
35038
|
const hasRawTextWrappers = rawTextWrapperComponentNames.size > 0;
|
|
35039
|
+
const hasRuntimeGlobals = runtimeGlobalNames.size > 0;
|
|
35037
35040
|
const fileLinesCache = /* @__PURE__ */ new Map();
|
|
35038
35041
|
const fileContextCache = /* @__PURE__ */ new Map();
|
|
35039
35042
|
const libraryFileCache = /* @__PURE__ */ new Map();
|
|
35043
|
+
const suppressions = /* @__PURE__ */ new Map();
|
|
35044
|
+
const suppress = (diagnostic, source) => {
|
|
35045
|
+
const { ruleKey } = getDiagnosticRuleIdentity(diagnostic);
|
|
35046
|
+
const suppressionKey = `${ruleKey}\u0000${source}`;
|
|
35047
|
+
const existing = suppressions.get(suppressionKey);
|
|
35048
|
+
suppressions.set(suppressionKey, existing ? {
|
|
35049
|
+
...existing,
|
|
35050
|
+
count: existing.count + 1
|
|
35051
|
+
} : {
|
|
35052
|
+
rule: ruleKey,
|
|
35053
|
+
source,
|
|
35054
|
+
count: 1
|
|
35055
|
+
});
|
|
35056
|
+
return null;
|
|
35057
|
+
};
|
|
35040
35058
|
const isLibraryFile = (filePath) => {
|
|
35041
35059
|
let cached = libraryFileCache.get(filePath);
|
|
35042
35060
|
if (cached === void 0) {
|
|
@@ -35085,50 +35103,60 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
35085
35103
|
if (hasRawTextWrappers && isInsideStringOnlyWrapper(lines, diagnostic.line, diagnostic.column, rawTextWrapperComponentNames)) return true;
|
|
35086
35104
|
return false;
|
|
35087
35105
|
};
|
|
35088
|
-
|
|
35089
|
-
if (
|
|
35090
|
-
|
|
35091
|
-
|
|
35092
|
-
|
|
35093
|
-
|
|
35094
|
-
|
|
35095
|
-
|
|
35096
|
-
|
|
35097
|
-
|
|
35098
|
-
|
|
35099
|
-
|
|
35100
|
-
if (
|
|
35101
|
-
|
|
35102
|
-
|
|
35103
|
-
|
|
35104
|
-
|
|
35105
|
-
|
|
35106
|
-
|
|
35107
|
-
|
|
35108
|
-
|
|
35109
|
-
if (isFileIgnoredByPatterns(current.filePath, rootDirectory, ignoredFilePatterns)) return null;
|
|
35110
|
-
if (isDiagnosticIgnoredByOverrides(current, rootDirectory, compiledOverrides)) return null;
|
|
35111
|
-
if (isRnRawTextSuppressedByConfig(current)) return null;
|
|
35112
|
-
}
|
|
35113
|
-
if (respectInlineDisables && current.line > 0) {
|
|
35114
|
-
const lines = getFileLines(current.filePath);
|
|
35115
|
-
if (lines) {
|
|
35116
|
-
const ruleIdentifier = `${current.plugin}/${current.rule}`;
|
|
35117
|
-
const evaluation = evaluateSuppression(lines, current.line - 1, ruleIdentifier);
|
|
35118
|
-
if (evaluation.isSuppressed) return null;
|
|
35119
|
-
if (evaluation.nearMissHint) current = {
|
|
35120
|
-
...current,
|
|
35121
|
-
suppressionHint: evaluation.nearMissHint
|
|
35122
|
-
};
|
|
35106
|
+
const isJsxNoUndefSuppressedByConfig = (diagnostic) => {
|
|
35107
|
+
if (!hasRuntimeGlobals) return false;
|
|
35108
|
+
if (diagnostic.rule !== "jsx-no-undef") return false;
|
|
35109
|
+
const identifierMatch = JSX_NO_UNDEF_IDENTIFIER_PATTERN.exec(diagnostic.message);
|
|
35110
|
+
return identifierMatch !== null && runtimeGlobalNames.has(identifierMatch[1]);
|
|
35111
|
+
};
|
|
35112
|
+
return {
|
|
35113
|
+
apply: (diagnostic) => {
|
|
35114
|
+
if (shouldAutoSuppress(diagnostic)) return null;
|
|
35115
|
+
let current = diagnostic;
|
|
35116
|
+
let explicitSeverityOverride;
|
|
35117
|
+
let explicitRuleOverride;
|
|
35118
|
+
if (severityControls) {
|
|
35119
|
+
const { ruleKey, category } = getDiagnosticRuleIdentity(current);
|
|
35120
|
+
explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey }, severityControls);
|
|
35121
|
+
explicitSeverityOverride = resolveRuleSeverityOverride({
|
|
35122
|
+
ruleKey,
|
|
35123
|
+
category
|
|
35124
|
+
}, severityControls);
|
|
35125
|
+
if (explicitSeverityOverride === "off") return suppress(current, "config");
|
|
35126
|
+
if (explicitSeverityOverride !== void 0) current = restampSeverity(current, explicitSeverityOverride);
|
|
35123
35127
|
}
|
|
35124
|
-
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
|
|
35130
|
-
|
|
35131
|
-
|
|
35128
|
+
if (explicitRuleOverride === void 0) {
|
|
35129
|
+
if (isAppOnlyRule(`${current.plugin}/${current.rule}`) && isLibraryFile(current.filePath)) return null;
|
|
35130
|
+
}
|
|
35131
|
+
if (!showWarnings && current.severity === "warning" && explicitSeverityOverride !== "warn") return null;
|
|
35132
|
+
if (userConfig) {
|
|
35133
|
+
if (isRuleIgnored(`${current.plugin}/${current.rule}`)) return suppress(current, "config");
|
|
35134
|
+
if (isFileIgnoredByPatterns(current.filePath, rootDirectory, ignoredFilePatterns)) return null;
|
|
35135
|
+
if (isDiagnosticIgnoredByOverrides(current, rootDirectory, compiledOverrides)) return suppress(current, "override");
|
|
35136
|
+
if (isRnRawTextSuppressedByConfig(current)) return null;
|
|
35137
|
+
if (isJsxNoUndefSuppressedByConfig(current)) return null;
|
|
35138
|
+
}
|
|
35139
|
+
if (respectInlineDisables && current.line > 0) {
|
|
35140
|
+
const lines = getFileLines(current.filePath);
|
|
35141
|
+
if (lines) {
|
|
35142
|
+
const ruleIdentifier = `${current.plugin}/${current.rule}`;
|
|
35143
|
+
const evaluation = evaluateSuppression(lines, current.line - 1, ruleIdentifier);
|
|
35144
|
+
if (evaluation.isSuppressed) return suppress(current, "inline");
|
|
35145
|
+
if (evaluation.nearMissHint) current = {
|
|
35146
|
+
...current,
|
|
35147
|
+
suppressionHint: evaluation.nearMissHint
|
|
35148
|
+
};
|
|
35149
|
+
}
|
|
35150
|
+
}
|
|
35151
|
+
const fileContext = getFileContext(current.filePath);
|
|
35152
|
+
if (fileContext !== "production") current = {
|
|
35153
|
+
...current,
|
|
35154
|
+
fileContext
|
|
35155
|
+
};
|
|
35156
|
+
return current;
|
|
35157
|
+
},
|
|
35158
|
+
summarizeSuppressions: () => [...suppressions.values()]
|
|
35159
|
+
};
|
|
35132
35160
|
};
|
|
35133
35161
|
const OxlintUnavailableKind = Literals(["binary-not-found", "native-binding-missing"]);
|
|
35134
35162
|
var OxlintUnavailable = class extends TaggedErrorClass()("OxlintUnavailable", {
|
|
@@ -35586,6 +35614,7 @@ const STRING_ARRAY_FIELD_NAMES = [
|
|
|
35586
35614
|
"projects",
|
|
35587
35615
|
"textComponents",
|
|
35588
35616
|
"rawTextWrapperComponents",
|
|
35617
|
+
"runtimeGlobals",
|
|
35589
35618
|
"serverAuthFunctionNames"
|
|
35590
35619
|
];
|
|
35591
35620
|
const SURFACE_CONTROL_FIELD_NAMES = [
|
|
@@ -37290,6 +37319,11 @@ const toCanonicalPath = (filePath) => {
|
|
|
37290
37319
|
};
|
|
37291
37320
|
const DEAD_CODE_PLUGIN = "deslop";
|
|
37292
37321
|
const DEAD_CODE_CATEGORY = "Maintainability";
|
|
37322
|
+
const REACT_DOCTOR_TOOLCHAIN_PACKAGES = new Set([
|
|
37323
|
+
"react-doctor",
|
|
37324
|
+
"eslint-plugin-react-doctor",
|
|
37325
|
+
"oxlint-plugin-react-doctor"
|
|
37326
|
+
]);
|
|
37293
37327
|
const DEAD_CODE_WORKER_SCRIPT = `
|
|
37294
37328
|
const inputChunks = [];
|
|
37295
37329
|
process.stdin.on("data", (chunk) => inputChunks.push(chunk));
|
|
@@ -37595,6 +37629,7 @@ const checkDeadCode = async (options) => {
|
|
|
37595
37629
|
});
|
|
37596
37630
|
}
|
|
37597
37631
|
for (const unusedDependency of result.unusedDependencies) {
|
|
37632
|
+
if (REACT_DOCTOR_TOOLCHAIN_PACKAGES.has(unusedDependency.name)) continue;
|
|
37598
37633
|
const label = unusedDependency.isDevDependency ? "devDependency" : "dependency";
|
|
37599
37634
|
diagnostics.push({
|
|
37600
37635
|
filePath: "package.json",
|
|
@@ -39328,11 +39363,12 @@ const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
|
|
|
39328
39363
|
const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
|
|
39329
39364
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
39330
39365
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
39366
|
+
const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
|
|
39331
39367
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
39332
|
-
const buildReactCompilerMessage = (reasonSummary) => {
|
|
39368
|
+
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
39333
39369
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
39334
|
-
if (!normalizedSummary) return
|
|
39335
|
-
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${
|
|
39370
|
+
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
39371
|
+
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
39336
39372
|
};
|
|
39337
39373
|
const PLUGIN_CATEGORY_MAP = {
|
|
39338
39374
|
react: "Bugs",
|
|
@@ -39381,7 +39417,7 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
39381
39417
|
const [reasonSummary = "", ...reasonDetailLines] = bailoutReason.split("\n");
|
|
39382
39418
|
const reasonDetail = reasonDetailLines.join("\n").trim();
|
|
39383
39419
|
return {
|
|
39384
|
-
message: buildReactCompilerMessage(reasonSummary.trim()),
|
|
39420
|
+
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
39385
39421
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
39386
39422
|
};
|
|
39387
39423
|
}
|
|
@@ -41006,7 +41042,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
41006
41042
|
scanConcurrency,
|
|
41007
41043
|
supplyChainOverlapTimedOut: supplyChainResult.timedOut,
|
|
41008
41044
|
lintCacheHitFileCount,
|
|
41009
|
-
lintCacheTotalFileCount
|
|
41045
|
+
lintCacheTotalFileCount,
|
|
41046
|
+
suppressedRuleCounts: transform.summarizeSuppressions()
|
|
41010
41047
|
};
|
|
41011
41048
|
}).pipe(withSpan("runInspect", { attributes: {
|
|
41012
41049
|
"inspect.directory": input.directory,
|
|
@@ -41645,4 +41682,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
41645
41682
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
41646
41683
|
|
|
41647
41684
|
//# sourceMappingURL=index.js.map
|
|
41648
|
-
//# debugId=
|
|
41685
|
+
//# debugId=3fb133b5-fc1f-519f-8f76-6f1d3bb556ce
|
package/dist/lsp.js
CHANGED
|
@@ -35054,6 +35054,7 @@ const collectStringSet = (values) => {
|
|
|
35054
35054
|
if (!Array.isArray(values)) return /* @__PURE__ */ new Set();
|
|
35055
35055
|
return new Set(values.filter((value) => typeof value === "string"));
|
|
35056
35056
|
};
|
|
35057
|
+
const JSX_NO_UNDEF_IDENTIFIER_PATTERN = /^`([^`]+)`/;
|
|
35057
35058
|
/**
|
|
35058
35059
|
* Pre-compiles every stateful filter and returns a single
|
|
35059
35060
|
* `apply(diagnostic)` closure that runs (in order):
|
|
@@ -35087,11 +35088,28 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
35087
35088
|
const compiledOverrides = compileIgnoreOverrides(userConfig);
|
|
35088
35089
|
const textComponentNames = collectStringSet(userConfig?.textComponents);
|
|
35089
35090
|
const rawTextWrapperComponentNames = collectStringSet(userConfig?.rawTextWrapperComponents);
|
|
35091
|
+
const runtimeGlobalNames = collectStringSet(userConfig?.runtimeGlobals);
|
|
35090
35092
|
const hasTextComponents = textComponentNames.size > 0;
|
|
35091
35093
|
const hasRawTextWrappers = rawTextWrapperComponentNames.size > 0;
|
|
35094
|
+
const hasRuntimeGlobals = runtimeGlobalNames.size > 0;
|
|
35092
35095
|
const fileLinesCache = /* @__PURE__ */ new Map();
|
|
35093
35096
|
const fileContextCache = /* @__PURE__ */ new Map();
|
|
35094
35097
|
const libraryFileCache = /* @__PURE__ */ new Map();
|
|
35098
|
+
const suppressions = /* @__PURE__ */ new Map();
|
|
35099
|
+
const suppress = (diagnostic, source) => {
|
|
35100
|
+
const { ruleKey } = getDiagnosticRuleIdentity(diagnostic);
|
|
35101
|
+
const suppressionKey = `${ruleKey}\u0000${source}`;
|
|
35102
|
+
const existing = suppressions.get(suppressionKey);
|
|
35103
|
+
suppressions.set(suppressionKey, existing ? {
|
|
35104
|
+
...existing,
|
|
35105
|
+
count: existing.count + 1
|
|
35106
|
+
} : {
|
|
35107
|
+
rule: ruleKey,
|
|
35108
|
+
source,
|
|
35109
|
+
count: 1
|
|
35110
|
+
});
|
|
35111
|
+
return null;
|
|
35112
|
+
};
|
|
35095
35113
|
const isLibraryFile = (filePath) => {
|
|
35096
35114
|
let cached = libraryFileCache.get(filePath);
|
|
35097
35115
|
if (cached === void 0) {
|
|
@@ -35140,50 +35158,60 @@ const buildDiagnosticPipeline = (input) => {
|
|
|
35140
35158
|
if (hasRawTextWrappers && isInsideStringOnlyWrapper(lines, diagnostic.line, diagnostic.column, rawTextWrapperComponentNames)) return true;
|
|
35141
35159
|
return false;
|
|
35142
35160
|
};
|
|
35143
|
-
|
|
35144
|
-
if (
|
|
35145
|
-
|
|
35146
|
-
|
|
35147
|
-
|
|
35148
|
-
|
|
35149
|
-
|
|
35150
|
-
|
|
35151
|
-
|
|
35152
|
-
|
|
35153
|
-
|
|
35154
|
-
|
|
35155
|
-
if (
|
|
35156
|
-
|
|
35157
|
-
|
|
35158
|
-
|
|
35159
|
-
|
|
35160
|
-
|
|
35161
|
-
|
|
35162
|
-
|
|
35163
|
-
|
|
35164
|
-
if (isFileIgnoredByPatterns(current.filePath, rootDirectory, ignoredFilePatterns)) return null;
|
|
35165
|
-
if (isDiagnosticIgnoredByOverrides(current, rootDirectory, compiledOverrides)) return null;
|
|
35166
|
-
if (isRnRawTextSuppressedByConfig(current)) return null;
|
|
35167
|
-
}
|
|
35168
|
-
if (respectInlineDisables && current.line > 0) {
|
|
35169
|
-
const lines = getFileLines(current.filePath);
|
|
35170
|
-
if (lines) {
|
|
35171
|
-
const ruleIdentifier = `${current.plugin}/${current.rule}`;
|
|
35172
|
-
const evaluation = evaluateSuppression(lines, current.line - 1, ruleIdentifier);
|
|
35173
|
-
if (evaluation.isSuppressed) return null;
|
|
35174
|
-
if (evaluation.nearMissHint) current = {
|
|
35175
|
-
...current,
|
|
35176
|
-
suppressionHint: evaluation.nearMissHint
|
|
35177
|
-
};
|
|
35161
|
+
const isJsxNoUndefSuppressedByConfig = (diagnostic) => {
|
|
35162
|
+
if (!hasRuntimeGlobals) return false;
|
|
35163
|
+
if (diagnostic.rule !== "jsx-no-undef") return false;
|
|
35164
|
+
const identifierMatch = JSX_NO_UNDEF_IDENTIFIER_PATTERN.exec(diagnostic.message);
|
|
35165
|
+
return identifierMatch !== null && runtimeGlobalNames.has(identifierMatch[1]);
|
|
35166
|
+
};
|
|
35167
|
+
return {
|
|
35168
|
+
apply: (diagnostic) => {
|
|
35169
|
+
if (shouldAutoSuppress(diagnostic)) return null;
|
|
35170
|
+
let current = diagnostic;
|
|
35171
|
+
let explicitSeverityOverride;
|
|
35172
|
+
let explicitRuleOverride;
|
|
35173
|
+
if (severityControls) {
|
|
35174
|
+
const { ruleKey, category } = getDiagnosticRuleIdentity(current);
|
|
35175
|
+
explicitRuleOverride = resolveRuleSeverityOverride({ ruleKey }, severityControls);
|
|
35176
|
+
explicitSeverityOverride = resolveRuleSeverityOverride({
|
|
35177
|
+
ruleKey,
|
|
35178
|
+
category
|
|
35179
|
+
}, severityControls);
|
|
35180
|
+
if (explicitSeverityOverride === "off") return suppress(current, "config");
|
|
35181
|
+
if (explicitSeverityOverride !== void 0) current = restampSeverity(current, explicitSeverityOverride);
|
|
35178
35182
|
}
|
|
35179
|
-
|
|
35180
|
-
|
|
35181
|
-
|
|
35182
|
-
|
|
35183
|
-
|
|
35184
|
-
|
|
35185
|
-
|
|
35186
|
-
|
|
35183
|
+
if (explicitRuleOverride === void 0) {
|
|
35184
|
+
if (isAppOnlyRule(`${current.plugin}/${current.rule}`) && isLibraryFile(current.filePath)) return null;
|
|
35185
|
+
}
|
|
35186
|
+
if (!showWarnings && current.severity === "warning" && explicitSeverityOverride !== "warn") return null;
|
|
35187
|
+
if (userConfig) {
|
|
35188
|
+
if (isRuleIgnored(`${current.plugin}/${current.rule}`)) return suppress(current, "config");
|
|
35189
|
+
if (isFileIgnoredByPatterns(current.filePath, rootDirectory, ignoredFilePatterns)) return null;
|
|
35190
|
+
if (isDiagnosticIgnoredByOverrides(current, rootDirectory, compiledOverrides)) return suppress(current, "override");
|
|
35191
|
+
if (isRnRawTextSuppressedByConfig(current)) return null;
|
|
35192
|
+
if (isJsxNoUndefSuppressedByConfig(current)) return null;
|
|
35193
|
+
}
|
|
35194
|
+
if (respectInlineDisables && current.line > 0) {
|
|
35195
|
+
const lines = getFileLines(current.filePath);
|
|
35196
|
+
if (lines) {
|
|
35197
|
+
const ruleIdentifier = `${current.plugin}/${current.rule}`;
|
|
35198
|
+
const evaluation = evaluateSuppression(lines, current.line - 1, ruleIdentifier);
|
|
35199
|
+
if (evaluation.isSuppressed) return suppress(current, "inline");
|
|
35200
|
+
if (evaluation.nearMissHint) current = {
|
|
35201
|
+
...current,
|
|
35202
|
+
suppressionHint: evaluation.nearMissHint
|
|
35203
|
+
};
|
|
35204
|
+
}
|
|
35205
|
+
}
|
|
35206
|
+
const fileContext = getFileContext(current.filePath);
|
|
35207
|
+
if (fileContext !== "production") current = {
|
|
35208
|
+
...current,
|
|
35209
|
+
fileContext
|
|
35210
|
+
};
|
|
35211
|
+
return current;
|
|
35212
|
+
},
|
|
35213
|
+
summarizeSuppressions: () => [...suppressions.values()]
|
|
35214
|
+
};
|
|
35187
35215
|
};
|
|
35188
35216
|
const OxlintUnavailableKind = Literals(["binary-not-found", "native-binding-missing"]);
|
|
35189
35217
|
var OxlintUnavailable = class extends TaggedErrorClass()("OxlintUnavailable", {
|
|
@@ -35619,6 +35647,7 @@ const STRING_ARRAY_FIELD_NAMES = [
|
|
|
35619
35647
|
"projects",
|
|
35620
35648
|
"textComponents",
|
|
35621
35649
|
"rawTextWrapperComponents",
|
|
35650
|
+
"runtimeGlobals",
|
|
35622
35651
|
"serverAuthFunctionNames"
|
|
35623
35652
|
];
|
|
35624
35653
|
const SURFACE_CONTROL_FIELD_NAMES = [
|
|
@@ -37275,6 +37304,11 @@ const toCanonicalPath = (filePath) => {
|
|
|
37275
37304
|
};
|
|
37276
37305
|
const DEAD_CODE_PLUGIN = "deslop";
|
|
37277
37306
|
const DEAD_CODE_CATEGORY = "Maintainability";
|
|
37307
|
+
const REACT_DOCTOR_TOOLCHAIN_PACKAGES = new Set([
|
|
37308
|
+
"react-doctor",
|
|
37309
|
+
"eslint-plugin-react-doctor",
|
|
37310
|
+
"oxlint-plugin-react-doctor"
|
|
37311
|
+
]);
|
|
37278
37312
|
const DEAD_CODE_WORKER_SCRIPT = `
|
|
37279
37313
|
const inputChunks = [];
|
|
37280
37314
|
process.stdin.on("data", (chunk) => inputChunks.push(chunk));
|
|
@@ -37580,6 +37614,7 @@ const checkDeadCode = async (options) => {
|
|
|
37580
37614
|
});
|
|
37581
37615
|
}
|
|
37582
37616
|
for (const unusedDependency of result.unusedDependencies) {
|
|
37617
|
+
if (REACT_DOCTOR_TOOLCHAIN_PACKAGES.has(unusedDependency.name)) continue;
|
|
37583
37618
|
const label = unusedDependency.isDevDependency ? "devDependency" : "dependency";
|
|
37584
37619
|
diagnostics.push({
|
|
37585
37620
|
filePath: "package.json",
|
|
@@ -39313,11 +39348,12 @@ const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
|
|
|
39313
39348
|
const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
|
|
39314
39349
|
const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
|
|
39315
39350
|
const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
|
|
39351
|
+
const REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION = "It's how the library works, not a bug in your code. Memoize values you pass from it into other memoized components, or suppress it with `// react-doctor-disable-next-line react-hooks-js/incompatible-library`.";
|
|
39316
39352
|
const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
|
|
39317
|
-
const buildReactCompilerMessage = (reasonSummary) => {
|
|
39353
|
+
const buildReactCompilerMessage = (reasonSummary, action = REACT_COMPILER_ACTION) => {
|
|
39318
39354
|
const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
|
|
39319
|
-
if (!normalizedSummary) return
|
|
39320
|
-
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${
|
|
39355
|
+
if (!normalizedSummary) return `${REACT_COMPILER_IMPACT}. ${action}`;
|
|
39356
|
+
return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${action}`;
|
|
39321
39357
|
};
|
|
39322
39358
|
const PLUGIN_CATEGORY_MAP = {
|
|
39323
39359
|
react: "Bugs",
|
|
@@ -39366,7 +39402,7 @@ const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
|
|
|
39366
39402
|
const [reasonSummary = "", ...reasonDetailLines] = bailoutReason.split("\n");
|
|
39367
39403
|
const reasonDetail = reasonDetailLines.join("\n").trim();
|
|
39368
39404
|
return {
|
|
39369
|
-
message: buildReactCompilerMessage(reasonSummary.trim()),
|
|
39405
|
+
message: buildReactCompilerMessage(reasonSummary.trim(), rule === "incompatible-library" ? REACT_COMPILER_INCOMPATIBLE_LIBRARY_ACTION : REACT_COMPILER_ACTION),
|
|
39370
39406
|
help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
|
|
39371
39407
|
};
|
|
39372
39408
|
}
|
|
@@ -40991,7 +41027,8 @@ const runInspect = (input, hooks = {}) => gen(function* () {
|
|
|
40991
41027
|
scanConcurrency,
|
|
40992
41028
|
supplyChainOverlapTimedOut: supplyChainResult.timedOut,
|
|
40993
41029
|
lintCacheHitFileCount,
|
|
40994
|
-
lintCacheTotalFileCount
|
|
41030
|
+
lintCacheTotalFileCount,
|
|
41031
|
+
suppressedRuleCounts: transform.summarizeSuppressions()
|
|
40995
41032
|
};
|
|
40996
41033
|
}).pipe(withSpan("runInspect", { attributes: {
|
|
40997
41034
|
"inspect.directory": input.directory,
|
|
@@ -43029,6 +43066,8 @@ const METRIC = {
|
|
|
43029
43066
|
scanCheckSkipped: "scan.check_skipped",
|
|
43030
43067
|
baselineDegraded: "baseline.degraded",
|
|
43031
43068
|
ruleFired: "rule.fired",
|
|
43069
|
+
ruleDisabled: "rule.disabled",
|
|
43070
|
+
ruleSuppressed: "rule.suppressed",
|
|
43032
43071
|
lintFailed: "lint.failed",
|
|
43033
43072
|
deadCodeFailed: "deadcode.failed",
|
|
43034
43073
|
scoreUnavailable: "score.unavailable",
|
|
@@ -43041,6 +43080,9 @@ const METRIC = {
|
|
|
43041
43080
|
installWorkflow: "install.workflow",
|
|
43042
43081
|
installAgentHooks: "install.agent_hooks",
|
|
43043
43082
|
installDependency: "install.dependency",
|
|
43083
|
+
ciScaffolded: "ci.scaffolded",
|
|
43084
|
+
ciUpgraded: "ci.upgraded",
|
|
43085
|
+
ciConfigured: "ci.configured",
|
|
43044
43086
|
rulesChanged: "rules.changed",
|
|
43045
43087
|
rulesQueried: "rules.queried",
|
|
43046
43088
|
lspSessionStarted: "lsp.session.started",
|
|
@@ -43365,5 +43407,5 @@ const startLanguageServer = () => {
|
|
|
43365
43407
|
};
|
|
43366
43408
|
//#endregion
|
|
43367
43409
|
export { startLanguageServer };
|
|
43368
|
-
!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]="
|
|
43369
|
-
//# debugId=
|
|
43410
|
+
!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]="1822e36c-fbae-57bf-bdb9-98afebb9a03b")}catch(e){}}();
|
|
43411
|
+
//# debugId=1822e36c-fbae-57bf-bdb9-98afebb9a03b
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.5.8-dev.
|
|
3
|
+
"version": "0.5.8-dev.6e67626",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -60,12 +60,13 @@
|
|
|
60
60
|
"magicast": "^0.5.3",
|
|
61
61
|
"oxlint": ">=1.66.0 <1.67.0",
|
|
62
62
|
"prompts": "^2.4.2",
|
|
63
|
-
"typescript": ">=5.0.4 <
|
|
63
|
+
"typescript": ">=5.0.4 <6",
|
|
64
64
|
"vscode-languageserver": "^9.0.1",
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
|
-
"
|
|
68
|
-
"oxlint-plugin-react-doctor": "0.5.8-dev.
|
|
67
|
+
"yaml": "^2.9.0",
|
|
68
|
+
"oxlint-plugin-react-doctor": "0.5.8-dev.6e67626",
|
|
69
|
+
"deslop-js": "0.5.8"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -74,8 +75,8 @@
|
|
|
74
75
|
"commander": "^14.0.3",
|
|
75
76
|
"ora": "^9.4.0",
|
|
76
77
|
"@react-doctor/api": "0.5.8",
|
|
77
|
-
"@react-doctor/
|
|
78
|
-
"@react-doctor/
|
|
78
|
+
"@react-doctor/core": "0.5.8",
|
|
79
|
+
"@react-doctor/language-server": "0.5.8"
|
|
79
80
|
},
|
|
80
81
|
"engines": {
|
|
81
82
|
"node": "^20.19.0 || >=22.13.0"
|