Skip to content

Fix Windows path separator handling in lint-markdown-code-blocks - #8742

Open
ShakilUrRehman21 wants to merge 1 commit into
reactjs:mainfrom
ShakilUrRehman21:fix-markdown-linter-windows
Open

ShakilUrRehman21 wants to merge 1 commit into
reactjs:mainfrom
ShakilUrRehman21:fix-markdown-linter-windows

Conversation

@ShakilUrRehman21

Copy link
Copy Markdown
Contributor

Summary

In eslint-local-rules/rules/lint-markdown-code-blocks.js, the rule checks !filename.includes('src/content'). On Windows, context.getFilename() returns native backslash separators (src\content), causing:

  1. yarn test:eslint-local-rules to fail out-of-the-box with AssertionError: expected one diagnostic: 0 !== 1 because the rule exits early on test fixtures.
  2. eslint "src/content/**/*.md" / yarn lint to silently bypass all markdown documents on Windows developer machines.

This PR normalizes context.getFilename() separators to forward slashes before testing path inclusion.

How was this tested?

  • Ran yarn test:eslint-local-rules (now passes cleanly in 4s; previously failed).
  • Verified eslint "src/content/**/*.md" actively checks markdown code blocks on Windows.
  • Ran yarn tsc and npx prettier --check eslint-local-rules/rules/lint-markdown-code-blocks.js.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

This branch was successfully deployed

1 active deployment
Preview — eb4becf4 Deployed Nov 8, 2026 by vercel[bot]
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.

1 participant