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

Update: add option "allowInParentheses" to no-sequences (fixes #14197) #14199

Merged
merged 6 commits into from Mar 26, 2021

Conversation

danielrentz
Copy link
Contributor

@danielrentz danielrentz commented Mar 11, 2021

Prerequisites checklist

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

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

What rule do you want to change?

no-sequences

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

more

How will the change be implemented? (New option, new default behavior, etc.)?

new option "allowInParentheses".

Please provide some example code that this change will affect:
What does the rule currently do for this code?
What will the rule do after it's changed?

fixes #14197

What changes did you make? (Give an overview)

Add new option "allowInParentheses" to rule "no-sequences" to opt-in for allowing parenthesized sequence expressions.

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

This is the first commit which adds the option and adapts the unit tests.

To be done:

  • Agree on option name. Currently allowInParentheses. By default the rule is strict, and users can opt-in for more "sloppiness".
  • Currently, the option defaults to false making this a breaking change. Maybe set default value to true? Is this acceptable? Personally, I dislike boolean options defaulting to true.
  • Missing documentation. Do you have a pointer where to add this?

@eslint-github-bot eslint-github-bot bot added the triage An ESLint team member will look at this issue soon label Mar 11, 2021
@danielrentz
Copy link
Contributor Author

What about a second option "allowForLoopAfterthoughts" (name taken from no-plusplus)? Can/should be true by default.

Would make the last sentence in the documentation obsolete ("Another case is where you might want to report all usages of the comma operator, even in a for loop. You can achieve this using rule no-restricted-syntax:").

lib/rules/no-sequences.js Outdated Show resolved Hide resolved
@aladdin-add
Copy link
Member

👍 to "allowForLoopAfterthoughts". can you file a new issue please?

@mdjermanovic mdjermanovic added 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 and removed triage An ESLint team member will look at this issue soon labels Mar 11, 2021
@mdjermanovic
Copy link
Member

Marked as "evaluating" since the related proposal #14197 doesn't have consensus yet. It needs a champion and one more 👍 to be accepted.

@mdjermanovic mdjermanovic changed the title New: add option "allowInParentheses" to rule "no-sequences" Update: add option "allowInParentheses" to no-sequences (fixes #14197) Mar 11, 2021
@danielrentz
Copy link
Contributor Author

allowForLoopAfterthoughts

#14204

@danielrentz
Copy link
Contributor Author

BTW I signed the CLA yesterday.

@danielrentz
Copy link
Contributor Author

Marked as "evaluating" since the related proposal #14197 doesn't have consensus yet. It needs a champion and one more 👍 to be accepted.

@aladdin-add how do I find a champion (sorry, this is my first PR in eslint)...

@btmills btmills added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Mar 24, 2021
Copy link
Member

@btmills btmills left a comment

Choose a reason for hiding this comment

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

I marked this as accepted now that the issue is accepted. Nice work @danielrentz! I had one idea for the docs, but LGTM either way.

docs/rules/no-sequences.md Show resolved Hide resolved
@mdjermanovic
Copy link
Member

BTW I signed the CLA yesterday.

The CLA check is still pending. It looks like you used a different email address for commits, so maybe this could help:

https://docs.github.com/en/github/committing-changes-to-your-project/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user

@danielrentz
Copy link
Contributor Author

Oh right, I committed with my company address. I have added this address to my github account right now, is there any information what to do to make the CLA step pass?

tests/lib/rules/no-sequences.js Outdated Show resolved Hide resolved
docs/rules/no-sequences.md Outdated Show resolved Hide resolved
docs/rules/no-sequences.md Outdated Show resolved Hide resolved
docs/rules/no-sequences.md Outdated Show resolved Hide resolved
@mdjermanovic
Copy link
Member

Oh right, I committed with my company address. I have added this address to my github account right now, is there any information what to do to make the CLA step pass?

I think the bot will re-check all commits after the next one.

docs/rules/no-sequences.md Outdated Show resolved Hide resolved
docs/rules/no-sequences.md Outdated Show resolved Hide resolved
docs/rules/no-sequences.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.

Looks great, thanks for contributing!

@mdjermanovic mdjermanovic merged commit 687ccae into eslint:master Mar 26, 2021
13 checks passed
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Sep 23, 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 Sep 23, 2021
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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-sequences] Add option to disable the "in-parentheses" exception
4 participants