This repository was 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 lintdoccommand.If I understand correctly, the current analyzer should only be able to return one action for each diagnostic.
In this rule, below example
\0\8should have multiple diagnoses and suggest multiple fixes.Ideally, this rule would allow a unique
TextRangeto 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
EscapeBackslashfor reducing multiple diagnoses anyway.EscapeBackslashis valid change. But fixing the mistake to simple number (8or9)Refatoris more strait-forward.Test Plan
cargo test -p rome_js_analyze -- no_nonoctal_decimal_escapeThought
RuleAdvice can have
SuggestionListandCodeSuggestionList. But this isn't used by Rule directly and they needMarkupBufinstead of properties thatJsRuleActionrequires.