question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support directive comment groups

See original GitHub issue

The version of ESLint you are using. Latest

The problem you want to solve. We run eslint once on our source code and again on the build output, with different config and plugins.

Any directive comments get picked up by both the source lint and the build lint. We can disable processing directive comments completely on the build lint, but it would be useful for comments to target either the source/build lint. Some of the rules we have on the build lint have false positives so it would be useful to be able to add /* eslint-disable-line custom-rule */ comments to disable them.

Your take on the correct solution to problem. Add the ability to assign directive comments to groups, and specify the group that should be used when running eslint. Any comments that are not part of the provided group are ignored. The group would default to default and it could be a non-breaking change.

Are you willing to submit a pull request to implement this change? Yes. I opened a draft (https://github.com/eslint/eslint/pull/13471) and it would be great to get some feedback before I continue and figure out how to add some tests.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
btmillscommented, Jul 11, 2020

Disable comments are a sometimes-necessary escape valve, and while conditional disable comments are a neat idea, I don’t see us adding features to disable comments to encourage people to reach for them as anything more than a last resort. If there were some use case that couldn’t be achieved another way, that might change things, but in your case you have a couple of less invasive options.

Another one I thought of since my earlier comment: if your codebase is in TypeScript, you should be able to make your rule type-aware so that it only reports e.g. .find() on instances of Array, which would fix the false positive issue altogether.

If this is still something you’d like to see implemented, we can leave the issue open to see if anyone else on the team has ideas for other use cases and want to include this.

0reactions
eslint-deprecated[bot]commented, Aug 21, 2020

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

doc: add guidelines for comment directives #43776 - GitHub
This would help tools which use directives be more consistent, as well as tools which want to inspect all comments and directives in...
Read more >
Documentation - Triple-Slash Directives - TypeScript
Triple-slash directives are single-line comments containing a single XML tag. The contents of the comment are used as compiler directives.
Read more >
USE GROUP directive - Micro Focus
The USE GROUP directive indicates that the following group item is to correspond to a column as if it were an elementary item...
Read more >
Object Definitions
This directive is used to define a short name used to identify the host. It is used in host group and service definitions...
Read more >
Directives Help — DOE Directives, Guidance, and Delegations
RevCom, the online review, comment, and approval system for draft DOE directives. You can sign in here to review documents; Directives tools, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found