New: ability to only lint for certain parts of the code block
See original GitHub issueRef https://github.com/airbnb/javascript/issues/685
Not sure how this would work but an example would be in airbnb’s style guide.
3.1 Use the literal syntax for object creation. eslint rules: no-new-object.
// bad
const item = new Object();
// good
const item = {};
So in this case you would want to check the // good
part is linted correctly while the // bad
snippet is incorrect.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:35 (25 by maintainers)
Top Results From Across the Web
flake8 disable linter only for a block of code - Stack Overflow
I want to lint the rest of the file, and I cannot put at the end of each fieldx an # noqa: E501...
Read more >One bite at a time - How to introduce new lint rules in a large ...
Linters such as ESLint or TSLint can help make your code more readable and maintainable, and help you detect errors earlier.
Read more >A Complete Guide to Linting Go Programs - freshman.tech
Linting is the process of identifying and reporting on patterns found in code, with the aim of improving consistency, and catching bugs ...
Read more >Linters aren't in your way. They're on your side
While linters can check formatting and adherence to code style and warn you if you're off, formatters go straight ahead and just apply...
Read more >Introducing Vale, an NLP-powered linter for prose - Medium
Vale is cross-platform (Windows, macOS, and Linux), written in Go ... ability to ignore code blocks and target only certain sections of text ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just added HTML comments preceding code blocks in the ESLint rule docs, and our new renderer is preserving the comments correctly! I also ran a test with the parser in this plugin. As long as there’s still a blank line preceding the code block (this is required by spec anyway), it correctly picks up the raw HTML and the code block separately.
<!--eslint-plugin-markdown ignore-->
<!--eslint-disable-block-->
<!--eslint-disable-->
/<!--eslint-enable-->
<!--eslint-plugin-markdown-disable-->
/<!--eslint-plugin-markdown-enable-->
Brainstorming a few different options there. Any preferences/other ideas?
Below, I’ve borrowed from ESLint’s eqeqeq docs and inserted comments to demonstrate what this should look like given the latest proposal. Any objections to implementing this as described?
When disabling a specific rule
<!--eslint-disable-next-block eqeqeq-->
, the plugin will alert for syntax errors and other rules but ignore errors from eqeqeq:Without any comments, the plugin will report all errors as received from ESLint:
When disabled for the entire block, the plugin won’t even bother sending the code to ESLint: