mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #528] markdownlint-configure-file Directive Does Not Allow JSON5 Comments #2279
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#2279
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @adam-grant-hendry on GitHub (May 21, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/528
Adding comments is desirable so the reason why a rule is ignored is documented. However, JSON5-style comments are not parsed by VSCode in file configurations:
@adam-grant-hendry commented on GitHub (May 21, 2022):
@DavidAnson Do I need to move this to vscode-markdownlint?
@DavidAnson commented on GitHub (May 21, 2022):
No, this is the right place. I'll probably do this soon for the upcoming release.
@adam-grant-hendry commented on GitHub (May 22, 2022):
@DavidAnson Okay, no problem. Thanks!
@adam-grant-hendry commented on GitHub (Oct 5, 2022):
@DavidAnson This fixes the issue in VSCode, but
pre-commitissues an error when comments are used. Do you have a recommendation?@DavidAnson commented on GitHub (Oct 5, 2022):
Is pre-commit itself emitting an error, or is a tool it runs doing so? If the latter, make sure it's using the latest version of markdownlint with support for JSONC.
@adam-grant-hendry commented on GitHub (Oct 5, 2022):
Oh good call: I was using https://github.com/igorshubovych/markdownlint-cli in
pre-commit. Maybe that repo isn't up-to-date with yours...?Should I run this as a local hook instead, or is there a preferred repo to use? I see there is
-cliand-cli2, for instance.@DavidAnson commented on GitHub (Oct 5, 2022):
The latest version of both CLIs have support for JSONC, but probably only the latest version. Depending on how you are referencing it from pre-commit, you might not be getting that? I might be able to tell from looking at an example.
@adam-grant-hendry commented on GitHub (Oct 6, 2022):
@DavidAnson Here is what is happening. As you can see, VSCode gives no linting errors, but pre-commit running
markdownlint-cliis still outputting an error:@adam-grant-hendry commented on GitHub (Oct 6, 2022):
@DavidAnson Here is my
.pre-commit-config.ymlfile:and the content of my
CHANGELOG.md:@adam-grant-hendry commented on GitHub (Oct 6, 2022):
@DavidAnson My
.markdownlint.ymlis:If I remove the comment in my
CHANGELOG.md, thenpre-commitpasses:@DavidAnson commented on GitHub (Oct 6, 2022):
I don't spot the problem on visual inspection. However, I do not understand your last message that removing the comment gets pre-commit to pass. For one, I still see the comment at the top of the file in your screenshot, and for another, I thought pre-commit was only supposed to pass if that comment was present (i.e., the rule is disabled).
Is this repository public?
@adam-grant-hendry commented on GitHub (Oct 6, 2022):
The JSON comment, not the HTML comment. Above was changed from
to
Yes: it is called
qtpygraph. Please feel free to take a look: https://github.com/adam-grant-hendry/qtpygraph.@DavidAnson commented on GitHub (Oct 7, 2022):
@adam-grant-hendry, your scenario in your repo seems to work fine for me in a GitHub Codespace:
And after breaking the JSONC disable:
@nschonni commented on GitHub (Oct 7, 2022):
I think if I had to rename the title of this to be clearer, it would be "markdownlint-configure-file directive does not allow JSON comments". @DavidAnson you're test was just for the
markdownlint-configure-file, not the part that was breaking above, when a comment is included into an already valid directive@DavidAnson commented on GitHub (Oct 7, 2022):
Understood, thanks! I will try again tomorrow.
@DavidAnson commented on GitHub (Oct 8, 2022):
So, ha ha, funny story... While most changes to the
markdownlintlibrary automatically show up in the CLIs, this one does not.markdownlint-cliis missing a commit like this one to use the newconfigParsersoption to support JSONC insidemarkdownlint-configure-file. @adam-grant-hendry, could you please open an issue in that repo for this task? https://github.com/igorshubovych/markdownlint-cli/issuesSorry for the confusion.
@DavidAnson commented on GitHub (Oct 8, 2022):
Nevermind, here's the fix for
markdownlint-cli:github.com/igorshubovych/markdownlint-cli@40c1734aa8@DavidAnson commented on GitHub (Oct 8, 2022):
If you want something that works right now, CLI2 is also configured to support pre-commit.