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

Sorting Should Respect Newlines #161

Closed
han-tyumi opened this issue Jun 7, 2021 · 2 comments
Closed

Sorting Should Respect Newlines #161

han-tyumi opened this issue Jun 7, 2021 · 2 comments
Assignees
Labels
pending triage Not classified yet

Comments

@han-tyumi
Copy link

I would like to enable Sort On Save but unfortunately there is a conflict when using Prettier.
Prettier wants long class attributes names' to be on separate lines but Windi will sort them back onto one line.
After saving it appears Windi's sorting is happening after Prettier leading to issues if you are also using ESLint with Prettier.

image
image

So one solution, if possible, could be to run the sorter before Prettier or other formatters.
However I think the better solution would be to respect the formatting when sorting class names.

@alexanderniebuhr alexanderniebuhr added the pending triage Not classified yet label Jun 7, 2021
@IgnisDa
Copy link
Contributor

IgnisDa commented Aug 10, 2021

I would like to work on this. Will make a PR soon.

alexanderniebuhr pushed a commit that referenced this issue Aug 11, 2021
* fix: respect separators while sorting

fixes issue #161

* test(sort.test.ts): add tests for sorting

* test(sort.test.ts): add tests for malformed HTML

* perf(commands.ts, index.ts): improve sorting

Use new strategy to sort classes and
preserve formatting.

* test(sort.test.ts): use new functions for testing
@alexanderniebuhr
Copy link
Member

v0.20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending triage Not classified yet
Projects
None yet
Development

No branches or pull requests

3 participants