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

no-inline-comments exception for istanbul ignore comments #12755

Closed
coreyfarrell opened this issue Jan 7, 2020 · 8 comments · Fixed by #13029
Closed

no-inline-comments exception for istanbul ignore comments #12755

coreyfarrell opened this issue Jan 7, 2020 · 8 comments · Fixed by #13029
Assignees
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules

Comments

@coreyfarrell
Copy link

What rule do you want to change?
no-inline-comments

Does this change cause the rule to produce more or fewer warnings?
Fewer

How will the change be implemented? (New option, new default behavior, etc.)?
Either a new option or default behavior could work depending on what eslint maintainers think is appropriate.

Please provide some example code that this change will affect:

if (condition1) {
  console.log('condition1');
} /* istanbul ignore else */ else if (condition2) {
  console.log('condition2');
} else {
  console.log('unreachable');
}

What does the rule currently do for this code?
Report an error

What will the rule do after it's changed?
Allow an exception for istanbul ignore comments. This is needed as the location of this comment matters. For it to ignore the chained else branch the comment needs to be directly before else if or between the else and if.

Are you willing to submit a pull request to implement this change?
I can try if this is an acceptable change and if I'm given guidance about an option vs default behavior.

@coreyfarrell coreyfarrell added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules triage An ESLint team member will look at this issue soon labels Jan 7, 2020
@ilyavolodin
Copy link
Member

Can you provide an error that you are seeing?

@coreyfarrell
Copy link
Author

eslint output:

/usr/src/npm/tmp/test.js
  3:3  error  Unexpected comment inline with code  no-inline-comments

✖ 1 problem (1 error, 0 warnings)

@mdjermanovic mdjermanovic added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jan 7, 2020
@mdjermanovic
Copy link
Member

An option where user can define a regex pattern (or array of patterns?) to ignore comments that match the pattern seems reasonable to me.

@kaicataldo
Copy link
Member

I think an option to allow this would be fine. Alternatively, you can disable the no-inline-comments rule around these comments using eslint-disable comments.

@mdjermanovic
Copy link
Member

I think it would be useful to support this in some way 👍

Exceptions (default and options) are already supported in other comment rules: line-comment-position, capitalized-comments and lines-around-comment.

no-inline-comments is very similar to line-comment-position (actually, it looks like they're overlapping/conflicting for line comments?).

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Feb 21, 2020
@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.

@mdjermanovic
Copy link
Member

I'll champion this.

@mdjermanovic mdjermanovic reopened this Feb 22, 2020
@mdjermanovic mdjermanovic removed the auto closed The bot closed this issue label Feb 22, 2020
@mdjermanovic mdjermanovic self-assigned this Feb 22, 2020
@mdjermanovic
Copy link
Member

This will be fixed by #13029, we'll add "ignorePattern" option (accepts string that will be treated as regex) which will allow users to configure this rule to ignore istanbul comments.

@mdjermanovic mdjermanovic linked a pull request Jun 20, 2020 that will close this issue
10 tasks
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Mar 26, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 26, 2021
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 enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants