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

Allow comments after // eslint-disable-line <rule-name> #11298

Closed
dandv opened this issue Jan 20, 2019 · 8 comments
Closed

Allow comments after // eslint-disable-line <rule-name> #11298

dandv opened this issue Jan 20, 2019 · 8 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint

Comments

@dandv
Copy link
Contributor

dandv commented Jan 20, 2019

The version of ESLint you are using.
5.12.1

The problem you want to solve.
I've just filed an issue against an incorrect (in my opinion) application of a rule. I want to disable that rule in my code, and mention why I've done so:

// eslint-disable-line no-unsafe-finally because https://github.com/eslint/eslint/issues/11297

Including the URL on the same comment line is handy because I can click it from my IDE and check on the status, then remove the entire comment once the issue is fixed.

Another use case is simply explaining why a rule was removed.

Your take on the correct solution to problem.

eslint should ignore non-rule comments following // eslint-disable-line <rule-name>.

eslint.org demo.

@dandv dandv added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Jan 20, 2019
@kaicataldo
Copy link
Member

Why is this solution better than having two comments? i.e.

// https://github.com/eslint/eslint/issues/11297
// eslint-disable-line no-unsafe-finally

This would add complexity to directive logic for parsing what is and isn't a rule name, and I'm not convinced the convenience outweighs that maintenance burden and increased surface area for bugs.

@kaicataldo kaicataldo removed the triage An ESLint team member will look at this issue soon label Jan 28, 2019
@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Mar 1, 2019
@eslint-deprecated
Copy link

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.

@JvJefke
Copy link

JvJefke commented Jun 20, 2019

@kaicataldo

Why is this solution better than having two comments? i.e.

You're example is not really a real life one. This one is (kinda):

const someFunction() =>
    // Map the otherData to this list by index
    // https://github.com/eslint/eslint/issues/11298
    response.data.map((item, idx) => (item._templateMeta = otherData[idx])) // eslint-disable-line [some-rule]

There is more visual correlation between te "real" comment than the eslint comment which makes it just confusing.
If you could do something like OP suggests, it isn't:

const someFunction() =>
    // Map the otherData to this list by index
    response.data.map((item, idx) => (item._templateMeta = otherData[idx])) // eslint-disable-line [some-rule] because https://github.com/eslint/eslint/issues/11298

So I do think this solution is better than the workaround you suggested.

@kaicataldo
Copy link
Member

@JvJefke Please feel free to create a new issue with a proposal if this is something you’d like to advocate for. Thanks!

@dandv
Copy link
Contributor Author

dandv commented Jun 20, 2019

Why is this solution better than having two comments? i.e.

// https://github.com/eslint/eslint/issues/11297
// eslint-disable-line no-unsafe-finally

Because,

  1. They're one logical unit: "eslint-disable-line this-rule because of that", so I want to keep them on one line
  2. Two comments cause visual clutter.
  3. Two comments attract attention to the wrong thing. I might have a "real comment", as @JvJefke suggested, above the line. The "eslint-disable-line" comment is not of primary importance, so I want to tack it on at the end of the line.

Please feel free to create a new issue with a proposal if this is something you’d like to advocate for.

Would love to see @JvJefke solution if it's different than mine. If it's the same, can we keep it in this issue?

@ulrichb
Copy link

ulrichb commented Jul 25, 2019

+1 For this. Please reopen.

@kaicataldo
Copy link
Member

There is currently an RFC open for this: eslint/rfcs#33

Please track the issue there.

@ulrichb
Copy link

ulrichb commented Jul 25, 2019

Ah. Okay, thx!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 29, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

No branches or pull requests

4 participants