developertools-tech / developertools.tech

A collection of tools for developers served as a PWA
https://www.developertools.tech
MIT License
39 stars 45 forks source link

[Req]: Use `husky` and `lint-staged` to lint files on every commit #56

Closed gaston-flores closed 1 year ago

gaston-flores commented 1 year ago

Explain the proposed feature

Not exactly a feature, more of a nice-to-have for the repo. We can configure git hooks to trigger lint-staged on every commit, which in turn would run eslint and prettier on the staged files. This should give more immediate feedback to the developer on the changes they are committing. As an added plus they won't need to remember to run cq on every push to the repo.

As an aside, I'd also suggest removing eslint-plugin-prettier and running prettier as a separate command. Using this plugin is discouraged by prettier themselves and on a more personal note, I find it a bit distracting (your mileage may vary).

Looking forward to your feedback!

Requirements

dlford commented 1 year ago

@gaston-flores

I've used husky and lint-staged before and I think it would help keep the PR's cleaner, so I'm on board.

I didn't know about the eslint-plugin-prettier discouragement, thanks for sharing that, I think it's a sound argument and agree with you there too.

We would also have to add a prettier:ci script that doesn't modify the files, and include that in the cq:ci script. I'm sure you'd have seen that need but it doesn't hurt to be specific.

The only thing missing is tsc --noEmit, which I added to the cq script because there are some TypeScript errors that eslint doesn't catch, but I suppose that could be run with husky too.

Also, I think we could let tests run on GitHub actions instead of in contributor land (currently running in both), they are starting to get more time consuming and I don't see a need to run them twice.

Lastly, we would also need to adjust the CONTRIBUTING.md file accordingly.

This one's all yours if you want it?

dlford commented 1 year ago

Oh, and the PR template mentions the cq script too, forgot about that

gaston-flores commented 1 year ago

Great! Agreed on all points 🚀

dlford commented 1 year ago

@gaston-flores thank you!