Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context menu to disable rule for line or file scope #224

Open
nschonni opened this issue Jan 21, 2022 · 5 comments
Open

Add context menu to disable rule for line or file scope #224

nschonni opened this issue Jan 21, 2022 · 5 comments

Comments

@nschonni
Copy link
Contributor

Like what https://github.com/microsoft/vscode-eslint does in that it allows for disabling through the inline comments at either the file or line scope, when you don't want to globally disable a rule (like asked in #210)

@DavidAnson
Copy link
Owner

I like what you propose better, actually, and added your suggestions into that issue for tracking. I never felt like I had a good plan for how/where to enable globally, so using an approach like yours or using local file overrides seems pretty appealing right now.

Actually, I guess I will leave the two issues separate for now, but what I'm guessing will happen is that I implement this one and decline that one.

@nschonni
Copy link
Contributor Author

I didn't dig through the other repo very far, but I figure there might be some code to get inspiration from

@DavidAnson
Copy link
Owner

I'll look at their documentation for how they've approached this, but I don't look at code for other projects to avoid the risk of licensing, etc. issues.

@DavidAnson
Copy link
Owner

I've thought about how to do this for line scope and the challenge is that problems quickly arise with how/where to add the suppression comment:

Adding markdownlint-disable-line to the end of the line can break scenarios like:

`Code with space ` and hard break  <!-- markdownlint-disable-line no-space-in-code -->
Text text text

Using markdownlint-disable-next-line instead can break for scenarios like:

```code
<!-- markdownlint-disable-next-line blanks-around-fences -->
```
Text text text

Using markdownlint-disable paired with markdownlint-restore may need the two comments to be pretty far apart to avoid problems like the examples above - and that risks suppressing more than just the intended warning.

Using markdownlint-disable at the top of the file or markdownlint-disable-file at the bottom of the file could both work, but suppress many, many warnings - and at that point you should probably change the linting configuration instead.

markdownlint-disable-file is my current best idea, but I don't like it much for line scope. For file scope, I think it can work, but I worry about encouraging the wrong behavior: "Ugh, it's such a pain to open every file and disable the rules I don't like".

@nschonni
Copy link
Contributor Author

Personally, I'd probably use the next-line more often, and I'd probably be OK if the inserts were not really that context aware. I think if the disable comment is added but doesn't work, its not the end of the world. You'd probably start to get a few edge case reported at the beginning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants