Skip to content
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(js_formatter): correctly handle placement of comments inside named import clause #2566

Merged
merged 4 commits into from Apr 23, 2024

Conversation

ah-yu
Copy link
Contributor

@ah-yu ah-yu commented Apr 23, 2024

Summary

FIx formatting of following case. It's strange that the export declaration doesn't have such an issue.

// input
import {} from /* comment*/ 'foo'
import {} from // comment
'foo'
import {a} from /* comment */'foo'
import {a} from // comment
'foo'

// before
import {} from /* comment*/ "foo";
import {} from "foo"; // comment
import { a } from /* comment */ "foo";
import { a } from "foo";

// after
import {} from /* comment*/ "foo";
import {} from // comment
"foo";
import { a } from /* comment */ "foo";
import {
  a, // comment
} from "foo";

Test Plan

Add new test cases

@github-actions github-actions bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Apr 23, 2024
@github-actions github-actions bot added the A-Changelog Area: changelog label Apr 23, 2024
Copy link

codspeed-hq bot commented Apr 23, 2024

CodSpeed Performance Report

Merging #2566 will improve performances by 77.63%

Comparing ah-yu:refmt_import (57d8619) with main (2ecfe4c)

Summary

⚡ 1 improvements
✅ 92 untouched benchmarks

Benchmarks breakdown

Benchmark main ah-yu:refmt_import Change
big5-added.json[uncached] 4.9 ms 2.7 ms +77.63%

Copy link
Member

@Conaclos Conaclos left a comment

Choose a reason for hiding this comment

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

Much better!

@ah-yu ah-yu merged commit 65a61d7 into biomejs:main Apr 23, 2024
13 checks passed
@ah-yu ah-yu deleted the refmt_import branch April 23, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants