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.

Warn when ESLint directives which expect to be used in block level comments are used in inline comments

See original GitHub issue

The problem you want to solve.

ESLint requires that eslint-disable rule-name and similar directives are placed in block level comments (/* */) and not in inline comments (// ).

To temporarily disable rule warnings in your file, use block comments in the following format:

Configuring ESLint

While the rational is not stated in the docs, I assume this is because disabling a rule is a “big deal” and that should be reflected in the type of comment used.

I think this requirement makes sense, but it can be hard to remember, and when you get it wrong (use an inline comment instead of a block level comment), ESLint just silently ignores your request.

Your take on the correct solution to problem.

I propose that we emit an error or warning when we discover an ESLint directive that is in the incorrect type of comment.

There is some precedent for this, as getDirectiveComments already has a number of different places where it will emit problems.

Are you willing to submit a pull request to implement this change?

Yes.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
captbaritonecommented, Jul 22, 2019

I went ahead and opened the RFC: https://github.com/eslint/rfcs/pull/34

0reactions
eslint-deprecated[bot]commented, Aug 22, 2019

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

Rules - ESLint - Pluggable JavaScript Linter
Rules are the core building block of ESLint. A rule validates if your code meets a certain expectation, and what to do if...
Read more >
eslint-plugin-vue/comment-directive.md at master - GitHub
The eslint-disable -like comments can be used in the <template> and in the block level. The eslint-disable comments has no effect after one...
Read more >
eslint-comments/require-description - mysticatea
This rule warns directive comments without description. WARNING. This rule can only be used with ESLint v7.x or later. # Rule Details. Examples...
Read more >
Turning off eslint rule for a specific line - Stack Overflow
-> Expected exception block, space or tab after '/*' in comment. :) – Rimian. Dec 29, 2017 at 0:57. I use a ...
Read more >
Writing Comments in Python (Guide)
You used some quirky variable names and wrote with super terse syntax. The new hires spend a lot of time stepping through your...
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