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: operator-assignment should indicate which operator can be shortened #14764

Merged
merged 1 commit into from Jul 10, 2021

Conversation

@paulsmithkc
Copy link
Contributor

@paulsmithkc paulsmithkc commented Jul 2, 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?

operator-assignment

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

no

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

new default behavior

Please provide some example code that this change will affect:

x = x + 3;

What does the rule currently do for this code?

Current error message: "Assignment can be replaced with operator assignment."

What will the rule do after it's changed?

New error message: "Assignment (=) can be replaced with operator assignment (+=)."

What changes did you make? (Give an overview)

  1. Introduced an "operator" token that can be used in the error message.
  2. Updated the error messages to use this token.

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

Are there any other ways to make this error message less cryptic?

nzakas
nzakas approved these changes Jul 9, 2021
Copy link
Member

@nzakas nzakas left a comment

LGTM. Thanks.

Copy link
Contributor

@snitin315 snitin315 left a comment

LGTM, thanks!

Copy link
Member

@btmills btmills left a comment

This is a nice improvement!

@btmills btmills merged commit ddffa8a into eslint:master Jul 10, 2021
14 checks passed
@paulsmithkc paulsmithkc deleted the operator-assignment branch Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants