+
Skip to content

fix(noRedundantUseStrict): keeps leading trivia #5868

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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
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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载