Skip to content

Fix consistent-data-testid fileName on Windows paths#1320

Open
sjh9714 wants to merge 1 commit into
testing-library:mainfrom
sjh9714:fix-consistent-data-testid-windows-filename
Open

Fix consistent-data-testid fileName on Windows paths#1320
sjh9714 wants to merge 1 commit into
testing-library:mainfrom
sjh9714:fix-consistent-data-testid-windows-filename

Conversation

@sjh9714
Copy link
Copy Markdown

@sjh9714 sjh9714 commented May 18, 2026

Summary

Fixes {fileName} replacement in consistent-data-testid when ESLint reports Windows-style paths.

What changed

  • Added regression coverage for a Windows path in the filename test case.
  • Updated filename extraction to handle both POSIX and Windows path separators.
  • Preserved the existing index file and dynamic route filename behavior.

Why

Issue #782 reports that {fileName} can expand to the full Windows path instead of just the component file name because the rule only splits paths on /.

Testing

  • pnpm test tests/rules/consistent-data-testid.test.ts
  • pnpm run lint
  • pnpm run type-check
  • pnpm test
  • git diff upstream/main...HEAD --check

Fixes #782

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.

consistent-data-testid: Wrong {fileName} value in testIdPattern on Windows

1 participant