nvimdev / guard-collection

collection the tools config for guard
MIT License
31 stars 9 forks source link

Add dprint formatter #6

Closed sirreal closed 1 year ago

xiaoshihou514 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

~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 commented 1 year ago

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

sirreal commented 1 year ago

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

sirreal commented 1 year ago

Any blockers I can address here?