Skip to content

fix(noRedundantUseStrict): keeps leading trivia#5868

Merged
ematipico merged 3 commits intobiomejs:mainfrom
bushuai:fix/no-redundant-use-strict
Oct 15, 2025
Merged

fix(noRedundantUseStrict): keeps leading trivia#5868
ematipico merged 3 commits intobiomejs:mainfrom
bushuai:fix/no-redundant-use-strict

Conversation

@bushuai
Copy link
Contributor

@bushuai bushuai commented May 3, 2025

Summary

closes #5856

this pr creates a new node that has the same leading trivia as the old one, and then uses the new node to perform the action mutation.

Test Plan

  1. added a test case
  2. updated snapshots

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels May 3, 2025
@bushuai bushuai force-pushed the fix/no-redundant-use-strict branch from 1c01f40 to 3b9f155 Compare May 3, 2025 09:52
@codspeed-hq
Copy link

codspeed-hq bot commented May 3, 2025

CodSpeed Performance Report

Merging #5868 will not alter performance

Comparing bushuai:fix/no-redundant-use-strict (3b9f155) with main (8e77d65)

Summary

✅ 95 untouched benchmarks

[],
))
.build()
.with_leading_trivia_pieces(value_token.leading_trivia().pieces())?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should reuse the same trivia piece only if there are comments. If you check the snapshots, all of them have been updated. Instead of deleting the whole line, we remove the directive but we keep the indentation that belonged to the directive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 Code action of noRedundantUseStrict removes leading comment lines

5 participants