Skip to content
Merged
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: 0 additions & 5 deletions .changeset/add-bippy-dependency.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/adopt-tailwind-settings.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/bump-oxc-toolchain.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/calm-compilers-rest.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/dependency-hygiene-1686.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/few-berries-drum.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-action-json-report.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-ci-recommendation-monorepo.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-expo-config-plugins.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-expo-metro-config-subpaths.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-expo-metro-config-wrappers.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/fix-fbt-component-return.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-fbt-fragment-returns.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/fix-fbt-in-text-wrappers.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-function-resolution-stack-overflow.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-implicit-subproject-entries.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-member-hook-state-consumption.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-npm-cache-corruption-error.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-recent-rule-false-positives.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-scope-changed-remote-base.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/fix-string-includes-false-positive.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/fix-test-noise-application-paths.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-type-only-window.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fruity-wombats-teach.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/harden-react-doctor-ci.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/honest-flatmap-advice.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/polite-monkeys-laugh.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/quiet-agent-stop-hooks.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/react-cleanup-engine.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/runtime-traces-browse.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/shadcn-composition-rules.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/vast-numbers-roll.md

This file was deleted.

7 changes: 7 additions & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @react-doctor/api

## 0.9.13

### Patch Changes

- Updated dependencies [[`ac87f7d`](https://github.com/millionco/react-doctor/commit/ac87f7d7f64d77cc0a648ee863dd50b3c69c0257), [`40b9d79`](https://github.com/millionco/react-doctor/commit/40b9d79703c398f47ba92488ce1bdea011f12109), [`6adf55e`](https://github.com/millionco/react-doctor/commit/6adf55ed8841c9a6f63a3e93cc0d2ccfbe4ca852), [`990daaf`](https://github.com/millionco/react-doctor/commit/990daafa6277b966aab30152a8e23c194bcce738), [`77aec24`](https://github.com/millionco/react-doctor/commit/77aec24f42fa8a2c55504550df929ea3985b7748), [`79d8007`](https://github.com/millionco/react-doctor/commit/79d80072817eb86c74f3dd42ce91c8104f448810), [`a163de9`](https://github.com/millionco/react-doctor/commit/a163de9afa0c4a84c2d6e13ddd7ac55c910dacc3)]:
- @react-doctor/core@0.9.13

## 0.9.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-doctor/api",
"version": "0.9.12",
"version": "0.9.13",
"private": true,
"description": "Programmatic API for React Doctor.",
"license": "SEE LICENSE IN LICENSE",
Expand Down
21 changes: 21 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# @react-doctor/core

## 0.9.13

### Patch Changes

- [#1695](https://github.com/millionco/react-doctor/pull/1695) [`ac87f7d`](https://github.com/millionco/react-doctor/commit/ac87f7d7f64d77cc0a648ee863dd50b3c69c0257) Thanks [@skoshx](https://github.com/skoshx)! - Preserve plugin settings when React Doctor adopts an existing lint config.

- [#1713](https://github.com/millionco/react-doctor/pull/1713) [`40b9d79`](https://github.com/millionco/react-doctor/commit/40b9d79703c398f47ba92488ce1bdea011f12109) Thanks [@aidenybai](https://github.com/aidenybai)! - Recognize Expo config plugin packages and local plugin paths behind TypeScript `satisfies` expressions.

- [#1728](https://github.com/millionco/react-doctor/pull/1728) [`6adf55e`](https://github.com/millionco/react-doctor/commit/6adf55ed8841c9a6f63a3e93cc0d2ccfbe4ca852) Thanks [@skoshx](https://github.com/skoshx)! - Keep `@expo/metro-config` as a direct dependency when project code imports a package subpath that the `expo/metro-config` umbrella does not expose.

- [#1718](https://github.com/millionco/react-doctor/pull/1718) [`990daaf`](https://github.com/millionco/react-doctor/commit/990daafa6277b966aab30152a8e23c194bcce738) Thanks [@skoshx](https://github.com/skoshx)! - Fix Expo Metro config false positives for local helpers and the PostHog Expo wrapper.

- [#1666](https://github.com/millionco/react-doctor/pull/1666) [`77aec24`](https://github.com/millionco/react-doctor/commit/77aec24f42fa8a2c55504550df929ea3985b7748) Thanks [@skoshx](https://github.com/skoshx)! - Use entry points from discovered implicit subprojects outside declared workspace globs, preventing legitimate files from being reported as unused.

- [#1676](https://github.com/millionco/react-doctor/pull/1676) [`79d8007`](https://github.com/millionco/react-doctor/commit/79d80072817eb86c74f3dd42ce91c8104f448810) Thanks [@aidenybai](https://github.com/aidenybai)! - Compare automatic changed scopes against the remote default branch, so committed branch changes are not mistaken for working-tree changes or skipped when no local default branch exists.

- [#1690](https://github.com/millionco/react-doctor/pull/1690) [`a163de9`](https://github.com/millionco/react-doctor/commit/a163de9afa0c4a84c2d6e13ddd7ac55c910dacc3) Thanks [@skoshx](https://github.com/skoshx)! - Recover audit-mode source files after an interrupted process, without overwriting files that changed after the interruption.

- Updated dependencies [[`ffc2d14`](https://github.com/millionco/react-doctor/commit/ffc2d142545167107b11908f004d764ac4e31399), [`f7efb7d`](https://github.com/millionco/react-doctor/commit/f7efb7d1c4fc564fa647a0dc26c48867da9166c9), [`05ef989`](https://github.com/millionco/react-doctor/commit/05ef98926de787b01e817c8853101d6c31e2071a), [`a04b933`](https://github.com/millionco/react-doctor/commit/a04b933c027f6addf4161ba0df1c11eb8922b879), [`adc3a91`](https://github.com/millionco/react-doctor/commit/adc3a9129190315263a5fa92bda7ea3e3e2ba94a), [`2c4560f`](https://github.com/millionco/react-doctor/commit/2c4560fc0abbf70f1574fe847402d320347d061e), [`e1d4c51`](https://github.com/millionco/react-doctor/commit/e1d4c51abfd9d15ec96f5001259c3e8f332f7d50), [`905607f`](https://github.com/millionco/react-doctor/commit/905607f7fc2240304cbad5f41d3ad496eab06b17), [`17eeeb5`](https://github.com/millionco/react-doctor/commit/17eeeb5367177e6a3ba814ca8d107d009addc9dc), [`afa1780`](https://github.com/millionco/react-doctor/commit/afa1780254bfd72175e6d0025841560582d32ad1), [`025d69d`](https://github.com/millionco/react-doctor/commit/025d69d701581092632caa87ea59e5a719094ab9), [`0f59a3b`](https://github.com/millionco/react-doctor/commit/0f59a3b84dd5233f6bcf5e4a621da6699c432405), [`5bc88ae`](https://github.com/millionco/react-doctor/commit/5bc88ae6a0cd7518ffa8c6348f9176868d00ea77), [`4bf7aff`](https://github.com/millionco/react-doctor/commit/4bf7aff4398383adb6b3dace48f72050dfd195a6), [`bd08406`](https://github.com/millionco/react-doctor/commit/bd08406381618785181aedf8bee956047ad107d3), [`2b0f06e`](https://github.com/millionco/react-doctor/commit/2b0f06ec70943f083d8893f8a1b989eba2ae40c6), [`8c2f03a`](https://github.com/millionco/react-doctor/commit/8c2f03aea9885f24da8f2002e85a32ac186bf5bf), [`6416370`](https://github.com/millionco/react-doctor/commit/6416370836deaa0a09189343a8579fb3f5d13494), [`28d4343`](https://github.com/millionco/react-doctor/commit/28d4343e4d90a8d80c0fdb5eac0173bdd8826866)]:
- oxlint-plugin-react-doctor@0.9.13

## 0.9.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-doctor/core",
"version": "0.9.12",
"version": "0.9.13",
"private": true,
"description": "Diagnostic engine for React Doctor.",
"license": "SEE LICENSE IN LICENSE",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/apply-ignore-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Diagnostic, ReactDoctorConfig, ReactDoctorIgnoreOverride } from ".
import { isPlainObject } from "./project-info/index.js";
import { isSameRuleKey } from "./rule-key-aliases.js";
import { compileGlobPatternsLenient } from "./utils/match-glob-pattern.js";
import { toRelativePath } from "./utils/to-relative-path.js";
import { toNormalizedRelativePath } from "./utils/to-normalized-relative-path.js";
import { warnConfigIssue } from "./utils/warn-config-issue.js";

interface CompiledIgnoreOverride {
Expand Down Expand Up @@ -76,7 +76,7 @@ export const isDiagnosticIgnoredByOverrides = (
overrides: CompiledIgnoreOverride[],
): boolean => {
if (overrides.length === 0) return false;
const relativeFilePath = toRelativePath(diagnostic.filePath, rootDirectory);
const relativeFilePath = toNormalizedRelativePath(diagnostic.filePath, rootDirectory);
const ruleIdentifier = `${diagnostic.plugin}/${diagnostic.rule}`;

return overrides.some(
Expand Down
10 changes: 4 additions & 6 deletions packages/core/src/build-json-report.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as path from "node:path";
import type {
Diagnostic,
DiffInfo,
Expand All @@ -16,6 +15,7 @@ import { summarizeDiagnostics } from "./summarize-diagnostics.js";
import { hasReactRuntime } from "./utils/has-react-runtime.js";
import { isScanComplete } from "./utils/is-scan-complete.js";
import { toNormalizedRelativePath } from "./utils/to-normalized-relative-path.js";
import { resolveCandidateReadPath } from "./utils/resolve-candidate-read-path.js";

interface BuildJsonReportInput {
version: string;
Expand Down Expand Up @@ -72,11 +72,9 @@ const toJsonReportDiagnostic = (
projectRoot: string,
reportRoot: string,
): JsonReportDiagnosticV3 => {
const normalizedFilePath = toNormalizedRelativePath(diagnostic.filePath, projectRoot);
const reportRelativeFilePath = toNormalizedRelativePath(
path.resolve(projectRoot, diagnostic.filePath),
reportRoot,
);
const resolvedFilePath = resolveCandidateReadPath(projectRoot, diagnostic.filePath);
const normalizedFilePath = toNormalizedRelativePath(resolvedFilePath, projectRoot);
const reportRelativeFilePath = toNormalizedRelativePath(resolvedFilePath, reportRoot);
const ruleIdentity = getDiagnosticRuleIdentity(diagnostic);
return {
...diagnostic,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/is-ignored-file.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactDoctorConfig } from "./types/index.js";
import { compileGlobPatternsLenient } from "./utils/match-glob-pattern.js";
import { toRelativePath } from "./utils/to-relative-path.js";
import { toNormalizedRelativePath } from "./utils/to-normalized-relative-path.js";
import { warnConfigIssue } from "./utils/warn-config-issue.js";

export const compileIgnoredFilePatterns = (userConfig: ReactDoctorConfig | null): RegExp[] => {
Expand All @@ -18,6 +18,6 @@ export const isFileIgnoredByPatterns = (
patterns: RegExp[],
): boolean => {
if (patterns.length === 0) return false;
const relativePath = toRelativePath(filePath, rootDirectory);
const relativePath = toNormalizedRelativePath(filePath, rootDirectory);
return patterns.some((pattern) => pattern.test(relativePath));
};
6 changes: 5 additions & 1 deletion packages/core/src/utils/to-normalized-relative-path.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as path from "node:path";
import { resolveCandidateReadPath } from "./resolve-candidate-read-path.js";

export const toNormalizedRelativePath = (filePath: string, rootDirectory: string): string =>
path
.relative(path.resolve(rootDirectory), path.resolve(rootDirectory, filePath))
.relative(
path.resolve(rootDirectory),
path.resolve(resolveCandidateReadPath(rootDirectory, filePath)),
)
.replaceAll("\\", "/") || ".";
28 changes: 28 additions & 0 deletions packages/core/tests/build-json-report.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { describe, expect, it } from "vite-plus/test";
import * as path from "node:path";
import { pathToFileURL } from "node:url";
import { buildJsonReport } from "@react-doctor/core";
import type { Diagnostic, InspectResult, ProjectInfo } from "@react-doctor/core";

Expand Down Expand Up @@ -116,6 +118,32 @@ describe("buildJsonReport", () => {
expect(report.diagnostics[0]).not.toHaveProperty("location");
});

it("normalizes a diagnostic file URL without changing the report schema", () => {
const fileUrl = pathToFileURL(path.join(projectInfo.rootDirectory, "src", "App.tsx")).href;
const report = buildJsonReport({
version: "1.2.3",
directory: projectInfo.rootDirectory,
mode: "full",
diff: null,
scans: [
{
directory: projectInfo.rootDirectory,
result: result({ diagnostics: [{ ...errorDiagnostic, filePath: fileUrl }] }),
},
],
totalElapsedMilliseconds: 1200,
});

expect(report.schemaVersion).toBe(3);
expect(report.diagnostics[0]).toMatchObject({
filePath: fileUrl,
normalizedFilePath: "src/App.tsx",
id: expect.stringMatching(
/^src\/App\.tsx::12:1::react-doctor\/no-array-index-as-key::[a-f0-9]{64}$/,
),
});
});

it("assigns distinct occurrence identities to same-site findings from one rule", () => {
const cleanupMessage =
"Your cleanup may read the wrong node since the ref `sidebarRef.current` can change before it runs.";
Expand Down
Loading
Loading