fix(markdown): scope user rule overrides away from md files#844
Merged
Conversation
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>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
composer.setDefaultIgnores(new ineslint-flat-config-utils@3.2.0) to auto-addignores: ['**/*.md']to any rule config that lacks afiles/ignores/languageconstraint, replacing the hardcodedantfu/markdown/disables/markdownblock. Fixes the regression where any global{ rules: { ... } }override (orunicorn.allRecommended) crashed ESLint onREADME.mdwithTypeError: sourceCode.getAllComments is not a function, because JS-only rules were re-applied to@eslint/markdown'smarkdown/gfmSourceCodeafter the hardcoded disables list ran.test/fixtures.test.ts→issue-837) and a note in the Rules Overrides README section../src→../srcimport infixtures/eslint.config.tsso its config can actually resolve.Closes #837. Related: #806, #828.
Test plan
pnpm test fixtures— 10/10 pass; the newissue-837fixture exercises the user-override pathpnpm typecheckpnpm lintpnpm build🤖 Generated with Claude Code