-
-
Notifications
You must be signed in to change notification settings - Fork 508
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(lint/useExponentiationOperator): avoid incorrect code fixes #121
Merged
Conaclos
merged 1 commit into
main
from
conaclos/lint/useExponentiationOperator/rome3850
Sep 4, 2023
Merged
fix(lint/useExponentiationOperator): avoid incorrect code fixes #121
Conaclos
merged 1 commit into
main
from
conaclos/lint/useExponentiationOperator/rome3850
Sep 4, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Conaclos
temporarily deployed
to
Website deployment
September 2, 2023 12:10 — with
GitHub Actions
Inactive
github-actions
bot
added
A-Linter
Area: linter
A-Parser
Area: parser
L-JavaScript
Language: JavaScript and super languages
labels
Sep 2, 2023
Conaclos
force-pushed
the
conaclos/lint/useExponentiationOperator/rome3850
branch
from
September 2, 2023 14:42
27537a2
to
aee2acb
Compare
Conaclos
temporarily deployed
to
Website deployment
September 2, 2023 14:42 — with
GitHub Actions
Inactive
Conaclos
force-pushed
the
conaclos/lint/useExponentiationOperator/rome3850
branch
from
September 2, 2023 14:50
aee2acb
to
19479a4
Compare
Conaclos
temporarily deployed
to
Website deployment
September 2, 2023 14:50 — with
GitHub Actions
Inactive
Conaclos
force-pushed
the
conaclos/lint/useExponentiationOperator/rome3850
branch
from
September 2, 2023 15:41
19479a4
to
dc3f4dc
Compare
Conaclos
temporarily deployed
to
Website deployment
September 2, 2023 15:41 — with
GitHub Actions
Inactive
ematipico
approved these changes
Sep 4, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestion
crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs
Show resolved
Hide resolved
Conaclos
force-pushed
the
conaclos/lint/useExponentiationOperator/rome3850
branch
from
September 4, 2023 13:59
dc3f4dc
to
c8e51be
Compare
Conaclos
force-pushed
the
conaclos/lint/useExponentiationOperator/rome3850
branch
3 times, most recently
from
September 4, 2023 15:07
4ee9068
to
9ae1b88
Compare
Conaclos
temporarily deployed
to
Website deployment
September 4, 2023 15:07 — with
GitHub Actions
Inactive
github-actions
bot
added
A-Changelog
Area: changelog
and removed
A-Tooling
Area: internal tools
labels
Sep 4, 2023
Conaclos
changed the title
refactor(lint/useExponentiationOperator): avoid incorrect code fixes
fix(lint/useExponentiationOperator): avoid incorrect code fixes
Sep 4, 2023
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
Conaclos
deleted the
conaclos/lint/useExponentiationOperator/rome3850
branch
September 4, 2023 15:26
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Changelog
Area: changelog
A-Linter
Area: linter
A-Parser
Area: parser
A-Website
Area: website
L-JavaScript
Language: JavaScript and super languages
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fix rome#3850.
Handle pre-update
Previously, Biome suggested an incorrect code fix for the following example:
rome#3850 proposed adding a space between
+
and++
to mimic the behavior of ESLint.However, Biome and Prettier automatically add parentheses around
++a
.Thus, I decided to provide the following suggestion:
The code fix now preserves any parentheses around the arguments.
The code fix now adds spaces around
**
.Previously the rule didn't suggest any code fix if a leading or trailing comment was present.
The rule now provides a suggestion (and keeps the leading and trailing comments)
Previously the rule didn't suggest any code fix if inner comments was removed.
Now the rule makes suggestions even if this removes inner comments.
I think it is ok because the rule is marked as unsafe.
An alternative is to transfer all inner comments:
Any thoughts?
EDIT: I finally decided to choose the alternative, i.e. keeping the comments.
I also take the opportunity to remove all unnecessary cloning.
Test Plan
Updated tests.