Skip to content

fix: don't re-add removed markdownlint comments to generated lists - #541

Open
JoshuaKGoldberg wants to merge 1 commit into
all-contributors:mainfrom
JoshuaKGoldberg:markdownlint-preserve-removal
Open

JoshuaKGoldberg wants to merge 1 commit into
all-contributors:mainfrom
JoshuaKGoldberg:markdownlint-preserve-removal

Conversation

@JoshuaKGoldberg

Copy link
Copy Markdown
Contributor

What: Fixes #540.

Why: Repos that removed the markdownlint comments from their contributors list get them re-added on every run.

How: When a previously generated list (one with <!-- prettier-ignore-start -->) doesn't have <!-- markdownlint-disable -->, generation now leaves the markdownlint comments out; new and hand-written lists still get them.

Checklist:

  • Documentation N/A
  • Tests
  • Ready to be merged
  • Added myself to contributors table

Fixes all-contributors#540.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@matbrgz

matbrgz commented Sep 27, 2026

Copy link
Copy Markdown

Review from Matheus Breguêz (@matbrgz):

Great UX improvement for repos with custom markdown linting configurations, @JoshuaKGoldberg!

Respecting the absence of <!-- markdownlint-disable --> when regenerating existing lists prevents unwanted formatting noise and dirty git diffs for projects that deliberately manage their own lint rules. Implementation and test coverage look solid.

@matbrgz

matbrgz commented Sep 28, 2026

Copy link
Copy Markdown

Hey @JoshuaKGoldberg, closed #553 so we keep everything focused here! 😄

Your zero-config heuristic is super clean and solves the main annoyance on existing tables without adding any configuration burden.

Just wanted to share the rationale and edge case we were exploring in #553 in case it's helpful as a small enhancement:

The Greenfield / Template Repo Edge Case

In #541, the check is:

const withMarkdownlint =
  previousList.includes('<!-- markdownlint-disable -->') ||
  !previousList.includes('<!-- prettier-ignore-start -->')

For existing lists that had comments manually removed, this works smoothly. However, on fresh setups or template repositories (e.g. running init or generating into a new <!-- ALL-CONTRIBUTORS-LIST:START --> block where <!-- prettier-ignore-start --> isn't present yet):

  • !previousList.includes('<!-- prettier-ignore-start -->') evaluates to true.
  • The markdownlint comments will still be injected on the very first run.
  • The maintainer has to let it generate once and manually delete them so the heuristic kicks in on subsequent runs.

Potential Enhancement

If you think it's worth supporting, an optional config setting (e.g. "markdownlint": false in .all-contributorsrc or via CLI) would let scaffolded projects and repo templates declare this upfront:

const withMarkdownlint =
  options.markdownlint !== undefined
    ? Boolean(options.markdownlint)
    : previousList.includes('<!-- markdownlint-disable -->') ||
      !previousList.includes('<!-- prettier-ignore-start -->')
  • If options.markdownlint is defined, respect it explicitly.
  • Otherwise, fall back to your zero-config heuristic by default.

Either way, #541 is a great quality-of-life fix as-is. Thanks for putting it together! 🚀

This branch has not been deployed

No deployments
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.

Generated contributors list always adds markdownlint-disable/restore comments, with no opt-out

2 participants