Skip to content

fix: validate string array config fields (projects, textComponents, etc.)#929

Draft
skoshx wants to merge 3 commits into
mainfrom
cursor/triage-921-47a3
Draft

fix: validate string array config fields (projects, textComponents, etc.)#929
skoshx wants to merge 3 commits into
mainfrom
cursor/triage-921-47a3

Conversation

@skoshx

@skoshx skoshx commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #921 (Sentry REACT-DOCTOR-1R)

Non-string entries in config.projects caused selectProjects to crash with requestedName.trim is not a function because the projects field was not validated at config load time.

Root Cause

The config validator (validateConfigTypes) already filtered non-string entries from other string-array fields (plugins, surfaces.*Tags, etc.) but projects, textComponents, rawTextWrapperComponents, and serverAuthFunctionNames were missing from the validation.

When a user wrote:

// doctor.config.ts
export default { projects: [42] };

The config would pass TypeScript's type checking (since it's authored JS/TS at runtime) but crash when selectProjects called .trim() on the number 42.

Scope

Fixed: All four string-array fields (projects, textComponents, rawTextWrapperComponents, serverAuthFunctionNames) now validate at config-load time:

  • Non-string entries are filtered out with warnings
  • Non-array values drop the entire field
  • The scan continues instead of crashing

Not changed: No rule logic, no lint behavior. This is a config validation fix only.

Test Coverage

  • Unit tests in validate-config-types.test.ts for all validation paths (valid arrays, mixed valid/invalid entries, non-arrays, empty arrays)
  • Regression tests in scan-resilience.test.ts for the crash scenario (all three edge cases: mixed entries, all-invalid, non-array)

Parity

This fix prevents crashes in the config loading phase (before any scanning occurs). It does not change any rule logic or diagnostic output. Expected parity result: zero diagnostic changes — only invalid configs that would have crashed now emit warnings and continue.

The baseline scan for parity is not available in this environment, but given the nature of this fix (config validation only, no rule changes), there should be no diagnostic differences across the corpus.

Open in Web Open in Cursor 

cursoragent and others added 2 commits June 21, 2026 22:10
…tc.)

Fixes #921 (REACT-DOCTOR-1R)

Non-string entries in config.projects caused selectProjects to crash with
`requestedName.trim is not a function` because the `projects` field
was not validated at config load time. The validator already filtered
non-string entries from other string-array fields (`plugins`,
`surfaces.*Tags`, etc.) but `projects`, `textComponents`,
`rawTextWrapperComponents`, and `serverAuthFunctionNames` were
missing.

This adds validation for all four fields: non-string entries are
filtered out with a warning, non-array values drop the entire field,
and the scan continues instead of crashing.

Test coverage:
- Unit tests in validate-config-types.test.ts for all validation paths
- Regression tests in scan-resilience.test.ts for the crash scenario

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@929
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@929
npm i https://pkg.pr.new/react-doctor@929

commit: 95d6551

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-string projects config entry crashes selectProjects (requestedName.trim is not a function)

2 participants