Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nextjs-manifest-fingerprint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"oxlint-plugin-react-doctor": patch
---

Cache Next.js async dynamic API diagnostics against the owning package manifest.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,30 @@ describe("forwarded Hook dependency collectors", () => {
});

describe("nextjs collectors", () => {
it("records the owning package manifest for the async dynamic API wrapper gate", () => {
writeFixtureFile(
"package.json",
`{ "dependencies": { "next": "^15.0.0", "react": "^19.0.0" } }\n`,
);
const pagePath = writeFixtureFile(
"app/page.tsx",
`import { cookies } from "next/headers";
export default function Page() {
return cookies().get("session");
}
`,
);

for (const trace of [
collectFor(pagePath, ["nextjs-async-dynamic-api-not-awaited"]),
collectFor(pagePath, ["nextjs-async-dynamic-api-not-awaited"]),
]) {
expect(trace).not.toBeNull();
expect(trace?.contentPaths.has(fixturePath("package.json"))).toBe(true);
expect(trace?.existencePaths.has(fixturePath("app/package.json"))).toBe(true);
}
});

it("records ancestor layout probes for a page file only", () => {
writeFixtureFile("app/layout.tsx", "export default ({ children }) => children;\n");
const pagePath = writeFixtureFile("app/products/page.tsx", "export default () => <div />;\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ export const CROSS_FILE_DEPENDENCY_COLLECTORS: ReadonlyMap<string, CrossFileDepe
["client-passive-event-listeners", collectEffectValueHelperDependencies],
["exhaustive-deps", collectForwardedHookDependencies],
["no-barrel-import", collectNoBarrelImportDependencies],
["nextjs-async-dynamic-api-not-awaited", collectNearestManifestDependencies],
["nextjs-missing-metadata", collectNextjsMissingMetadataDependencies],
["nextjs-no-use-search-params-without-suspense", collectNextjsSearchParamsDependencies],
["no-dynamic-import-path", collectNearestManifestDependencies],
Expand Down Expand Up @@ -466,7 +467,6 @@ export const CROSS_FILE_DEPENDENCY_COLLECTORS: ReadonlyMap<string, CrossFileDepe
* partition), forcing a conscious classification.
*/
export const UNBOUNDED_CROSS_FILE_RULE_IDS: ReadonlySet<string> = new Set([
"nextjs-async-dynamic-api-not-awaited",
"nextjs-no-img-element",
"no-loading-flag-reset-outside-finally",
"only-export-components",
Expand Down
Loading