markdownlint-disable/enable is the wrong pattern; use disable/restore instead
DavidAnson opened this issue · 7 comments
all-contributors-cli
version: Latestnode
version: N/Anpm
(oryarn
) version: N/A
Relevant code or config
- https://github.com/all-contributors/all-contributors-cli/blob/72de75abc51ef73e2782a70de7a2be26342bf22f/src/init/init-content.js#L15-L16
- https://github.com/all-contributors/all-contributors-cli/blob/d26cd47c817ffbbcdc7362b50c0d066fc2820975/src/generate/index.js#L30-L32
What you did:
Investigated an issue reported by @bnb where markdownlint
rules were being ignored in a specific file that was generated by this project.
What happened:
The pattern produced by this project of <!-- markdownlint-disable -->
then <!-- markdownlint-enable -->
in the two files referenced above has the effect of (re-)enabling all markdownlint
rules. In cases where the relevant project/file/user has disabled some (ex: line-length
), they are undesirably enabled for the remainder of the file. Instead, use <!-- markdownlint-restore -->
to restore the previously-enabled rules.
There's a discussion and example here: https://github.com/DavidAnson/markdownlint#configuration
Reproduction repository:
Any repository that uses the pattern above.
Problem description:
See above.
Suggested solution:
See above.
I'm not quite sure where the issue is, this disable/enable comment section is there to prevent a previously raised issue where MarkdownLint would complain about the table not respecting rules while still allowing it to do its job as far as the rest of the file (e.g. README.md
) is concerned.
@Berkmann18 the problem is that enable
turns on all rules ignoring the users' initial config. In my case, I had a rule I was ignoring that was triggered after the all-contributors block, and because enable
is used rather than restore
, my config was ignored and the rules were reset to defaults which was throwing errors rather than restoring my rules.
@bnb That makes sense. A PR would be welcome for this.
@bnb I probably won't get to this anytime soon. If you want to send the PR, please go ahead. The change is trivial, but I don't know how easy/hard it will be to add tests, etc..
I decided to YOLO a PR. All checks pass. Here you go: #278
🎉 This issue has been resolved in version 6.17.1 🎉
The release is available on:
Your semantic-release bot 📦🚀