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

Add dprint formatter #6

Merged
merged 4 commits into from
Sep 19, 2023
Merged

Add dprint formatter #6

merged 4 commits into from
Sep 19, 2023

Conversation

sirreal
Copy link
Contributor

@sirreal sirreal commented Sep 12, 2023

No description provided.

@xiaoshihou514
Copy link
Collaborator

Thanks for the pr! Would you mind writing a test for this pr and the other two linter ones? It's easier for someone that uses the tool to test locally and it ensures that everything is working correctly :) Of course if you don't want to spend more time on this just poke me and I will still happily merge this.

@sirreal
Copy link
Contributor Author

sirreal commented Sep 14, 2023

I looked at adding tests but the CI runs need approval and there don't seem to be any instructions on how to run tests locally. I don't mind writing some tests but I don't want to spend a lot of time figuring out set up in order to do that. I can probably provide some tests that are pretty close if you want to take it over (already in this PR in a reverted commit).

@xiaoshihou514
Copy link
Collaborator

xiaoshihou514 commented Sep 15, 2023

You have a point! Will add the test docs soon. Added CONTRIBUTING.md. The tests are ran using vusted

luarocks --lua-version=5.1 install vusted

For formatter show the input and expected formatted output (what you did was the right thing, but since you tested with tsx maybe write a tsx snippet and not just js?), and for linters the input and the expected diagnostics (get that by running :lua vim.print(vim.diagnotic.get()). Finally add the tools installation to setup.sh. The tests fails on CI now because the appropriate pr for adding guard-collection has not been merge yet so don't worry. Just show that it passes locally (vusted ./test/formatter/dprint_spec.lua and vusted ./test/linter/eslint_d_spec.lua) is good enough for now.
Thank you once again for adding support for these tools :)

@barrett-ruth
Copy link
Member

I think you should also include a find = regex according to dprint spec. dprint can only run if certain file in base directory.

@sirreal
Copy link
Contributor Author

sirreal commented Sep 15, 2023

Good call, I added find according to the spec, it seems to work as expected 👍

@sirreal
Copy link
Contributor Author

sirreal commented Sep 18, 2023

Any blockers I can address here?

@xiaoshihou514 xiaoshihou514 merged commit 3996861 into nvimdev:main Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants