Skip to content

fix(markdown): scope user rule overrides away from md files#844

Merged
antfu merged 2 commits into
mainfrom
antfu/fix-md-leak
Apr 30, 2026
Merged

fix(markdown): scope user rule overrides away from md files#844
antfu merged 2 commits into
mainfrom
antfu/fix-md-leak

Conversation

@antfu

@antfu antfu commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adopts composer.setDefaultIgnores (new in eslint-flat-config-utils@3.2.0) to auto-add ignores: ['**/*.md'] to any rule config that lacks a files/ignores/language constraint, replacing the hardcoded antfu/markdown/disables/markdown block. Fixes the regression where any global { rules: { ... } } override (or unicorn.allRecommended) crashed ESLint on README.md with TypeError: sourceCode.getAllComments is not a function, because JS-only rules were re-applied to @eslint/markdown's markdown/gfm SourceCode after the hardcoded disables list ran.
  • Adds a regression fixture (test/fixtures.test.tsissue-837) and a note in the Rules Overrides README section.
  • Bonus: fixes a stale ./src../src import in fixtures/eslint.config.ts so its config can actually resolve.

Closes #837. Related: #806, #828.

Test plan

🤖 Generated with Claude Code

antfu and others added 2 commits April 30, 2026 16:00
Adopt `composer.setDefaultIgnores` from eslint-flat-config-utils@3.2.0
to auto-add `ignores: ['**/*.md']` to any rule config that lacks a
`files`/`ignores`/`language` constraint. This neutralises the v7.5.0
regression where a plain `{ rules: { ... } }` override (or unicorn's
`allRecommended`) would crash ESLint on README.md with
`sourceCode.getAllComments is not a function`, since the JS-only rules
re-applied to the `markdown/gfm` SourceCode bypassed the existing
hardcoded disables list. Replaces the per-rule disables block with a
single language-axis declaration that scales as plugins ship more
JS-only rules. Also fixes a stale `./src` import in
`fixtures/eslint.config.ts` (now `../src`) so it can resolve.

Closes #837. Related: #806, #828.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Regenerate the eight factory-snap snapshots to reflect the
`setDefaultIgnores(['**/*.md'])` injection on every unscoped rule
config and the removal of the `antfu/markdown/disables/markdown` block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@antfu antfu merged commit 8d25a37 into main Apr 30, 2026
7 checks passed
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.

Rules added to config are incorrectly applied to Markdown files

1 participant