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?
@danielrentz
Copy link
Contributor Author

@danielrentz danielrentz commented Mar 11, 2021

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:").

Loading

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

@aladdin-add aladdin-add commented Mar 11, 2021

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

Loading

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Mar 11, 2021

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

Loading

@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

@danielrentz danielrentz commented Mar 12, 2021

allowForLoopAfterthoughts

#14204

Loading

@danielrentz
Copy link
Contributor Author

@danielrentz danielrentz commented Mar 12, 2021

BTW I signed the CLA yesterday.

Loading

@danielrentz
Copy link
Contributor Author

@danielrentz danielrentz commented Mar 12, 2021

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)...

Loading

Copy link
Member

@btmills btmills left a comment

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.

Loading

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

@mdjermanovic mdjermanovic commented Mar 24, 2021

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

Loading

@danielrentz
Copy link
Contributor Author

@danielrentz danielrentz commented Mar 24, 2021

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?

Loading

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

@mdjermanovic mdjermanovic commented Mar 24, 2021

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.

Loading

docs/rules/no-sequences.md Outdated Show resolved Hide resolved
Loading
docs/rules/no-sequences.md Outdated Show resolved Hide resolved
Loading
docs/rules/no-sequences.md Outdated Show resolved Hide resolved
Loading
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Looks great, thanks for contributing!

Loading

@mdjermanovic mdjermanovic merged commit 687ccae into eslint:master Mar 26, 2021
13 checks passed
Loading
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Sep 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants