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

Fix: arrow-parens no reporting for comments inside (fixes #12995) #13312

Merged
merged 8 commits into from May 22, 2020

Conversation

anikethsaha
Copy link
Member

Prerequisites checklist

  • I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

rule: arrow-parens

no reporting when there are comments inside params.
applicable for as-needed option for

Example of valid code (these are invalid in master as of now)

/*eslint arrow-parens: ["error", "as-needed"]*/


const f = (/** @type {number} */a/**hello*/) => a + a;
const ff = (a /**/) => a
const fff = (//
a) => a

These are valid by default in master as well

Is there anything you'd like reviewers to focus on?

None

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label May 16, 2020
@anikethsaha anikethsaha changed the title Fix: no reporting for comments inside (fixes #12995) Fix: arrow-parens no reporting for comments inside (fixes #12995) May 16, 2020
@mdjermanovic mdjermanovic linked an issue May 17, 2020 that may be closed by this pull request
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion autofix This change is related to ESLint's autofixing capabilities bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels May 17, 2020
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
@anikethsaha
Copy link
Member Author

@mdjermanovic I added a check for opening parent before first token for having the false positive which you mentioned

/* eslint arrow-parens: ["error", "always"] */

var foo = /**/ a => b;

the other way for this was to check if the option is as-needed or not.

Let me know if the current change is fine 👍

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works good, I left some comments where it seems that the code could be simplified a bit.

Can we also add some examples to the docs for "as-needed"?

lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
lib/rules/arrow-parens.js Show resolved Hide resolved
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
docs/rules/arrow-parens.md Outdated Show resolved Hide resolved
docs/rules/arrow-parens.md Show resolved Hide resolved
lib/rules/arrow-parens.js Outdated Show resolved Hide resolved
docs/rules/arrow-parens.md Outdated Show resolved Hide resolved
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kaicataldo kaicataldo merged commit cc01451 into eslint:master May 22, 2020
@kaicataldo
Copy link
Member

Thank you!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Nov 19, 2020
@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 Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion autofix This change is related to ESLint's autofixing capabilities bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow JSDoc make arrow parens needed
3 participants