Core Types
Diagnostic
Represents a single diagnostic issue found in the codebase.Absolute path to the file containing the issue.
Source of the diagnostic (e.g.,
"oxlint", "knip").Specific rule that was violated (e.g.,
"react-hooks/exhaustive-deps").Severity level of the issue.
Human-readable description of the issue.
Additional context or guidance for fixing the issue.
Line number where the issue occurs (1-indexed).
Column number where the issue occurs (1-indexed).
Categorization of the issue (e.g.,
"correctness", "style", "performance").Numeric weight for score calculation. Higher weights have more impact on the score.
ProjectInfo
Information about the analyzed React project.Absolute path to the project root directory.
Name of the project from
package.json.Version of React installed, or
null if not found.Detected framework. See Framework type.
Whether TypeScript is detected in the project.
Whether React Compiler (
babel-plugin-react-compiler) is detected.Total number of source files in the project.
ScoreResult
Overall health score for the codebase.Numeric score from 0-100, where 100 is perfect health.
Human-readable label for the score (e.g.,
"Excellent", "Good", "Fair", "Poor").DiffInfo
Information about changed files in a git repository.Name of the current git branch.
Name of the base branch for comparison.
Array of file paths that have changed.
Whether the changes are uncommitted (working directory changes).
ReactDoctorConfig
Configuration object fromreact-doctor.config.json.
Rules and files to ignore. See ReactDoctorIgnoreConfig.
Enable linting checks.
Enable dead code detection.
Show verbose output with file details.
Enable diff mode. If a string, specifies the base branch name.
Exit code behavior. See FailOnLevel.
ReactDoctorIgnoreConfig
Configuration for ignoring specific rules or files.Array of rule IDs to ignore (e.g.,
["react-hooks/exhaustive-deps"]).Array of file glob patterns to ignore (e.g.,
["**/*.test.tsx"]).Enums & Unions
Framework
Supported React frameworks.Next.js framework
Vite framework
Create React App
Remix framework
Gatsby framework
Expo framework
React Native (non-Expo)
Framework could not be detected
FailOnLevel
Exit code behavior based on diagnostic severity.Exit with code 1 only if errors are found.
Exit with code 1 if any warnings or errors are found.
Always exit with code 0 regardless of diagnostics.
Internal Types
These types are used internally by React Doctor but may be useful for advanced use cases.EstimatedScoreResult
Estimated score improvement after fixing issues.ScanOptions
Internal options used by the CLI scanner.ScanResult
Internal result from the scanner.PackageJson
Structure of apackage.json file.
WorkspacePackage
Information about a workspace package in a monorepo.Utility Functions
getDiffInfo()
Returns information about changed files in a git repository.Path to the git repository.
Base branch for comparison. If not provided, uses the default base branch (usually
main or master).DiffInfo | null - Diff information or null if not a git repository or no changes found.
filterSourceFiles()
Filters an array of file paths to include only source files.Array of file paths to filter.
string[] - Array containing only source files (JavaScript, TypeScript, JSX, TSX).