+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

fix(rome_js_formatter): Fix arrow binding parameter in test call #3399

Merged
merged 2 commits into from
Oct 11, 2022

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Oct 11, 2022

Rome has special formatting for test calls that ensures that callbacks remain on the same line as the it or describe even if exceeding the configured print width. This check was missing for arrow function expression with a single binding parameter so that formatting

it('should have the default duration when using the onClose arguments', done => {
	expect(true);
	done();
});

first resulted in

it('should have the default duration when using the onClose arguments', (
	done,
) => {
	expect(true);
	done();
});

and ultimately in

it('should have the default duration when using the onClose arguments', (done) => {
	expect(true);
	done();
});

This PR removes the need for a second formatting pass by picking up the test call layout in the arrow function binding parameter formatting.

Tests

I added a new snapshot test and verified that formatting the ant-design project twice yields no more formatting changes.

Rome has a special formatting for test calls that ensures that callbacks remain on the same line as the `it` or `describe` even if exceeding the configured print width

```
it('should have the default duration when using the onClose arguments', done => {
	expect(true);
	done();
});
```

This logic has been missing for arrow functions with a single binding parameter (not using parameters). This PR adds the additional check.

## Tests

I added a new snapshot test and verified that formatting the ant-design project twice yields no more formatting changes.
@MichaReiser MichaReiser added the A-Formatter Area: formatter label Oct 11, 2022
@MichaReiser MichaReiser added this to the 10.0.0 milestone Oct 11, 2022
@netlify
Copy link

netlify bot commented Oct 11, 2022

Deploy Preview for rometools canceled.

Name Link
🔨 Latest commit c2a593b
🔍 Latest deploy log https://app.netlify.com/sites/rometools/deploys/63455bcd085eee0009f3dda0

@MichaReiser MichaReiser temporarily deployed to netlify-playground October 11, 2022 12:04 Inactive
@github-actions
Copy link

@MichaReiser MichaReiser merged commit 828cdc2 into main Oct 11, 2022
@MichaReiser MichaReiser deleted the fix/arrow-binding-parameter branch October 11, 2022 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载