This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
fix(rome_js_analyze): noNonoctalDecimalEscape returns single diagnostic #4663
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
Addresses https://discord.com/channels/678763474494423051/978209399120216076/1126496823587115018
This PR modifies the noNonoctalDecimalEscape rule and narrows the scope of its fixes. This change eliminates the unusual circumstance of multiple diagnostics being performed on behalf of the user and also rectifies issues with the
cargo lintdoc
command.If I understand correctly, the current analyzer should only be able to return one action for each diagnostic.
In this rule, below example
\0\8
should have multiple diagnoses and suggest multiple fixes.Ideally, this rule would allow a unique
TextRange
to propose a single diagnostic and multiple actions (fixes) for it.However, this rule in its current state has diagnosed the same place many times.
I remove the code regarding addition of
EscapeBackslash
for reducing multiple diagnoses anyway.EscapeBackslash
is valid change. But fixing the mistake to simple number (8
or9
)Refator
is more strait-forward.Test Plan
cargo test -p rome_js_analyze -- no_nonoctal_decimal_escape
Thought
RuleAdvice can have
SuggestionList
andCodeSuggestionList
. But this isn't used by Rule directly and they needMarkupBuf
instead of properties thatJsRuleAction
requires.