You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if it's possible to set up a lint job to check if the templ generate has been ran on the project after changes to it and they are in sync with the go files. Current issue is some developers might forget to run the command and incomplete changes might get merged into repository.
The text was updated successfully, but these errors were encountered:
We run templ generate without version headers, because we change the templ version every commit, but you can probably just run templ generate.
templ generate -include-version=false
Then, we check to see if the git repo is dirty after re-running the generate. If no changes have been made to the templ files, or the version of templ, there shouldn't be.
git diff --exit-code
I'm pretty sure people have discussed adding something like a --dry-run or check flag before, but can't remember where it ended up. It could be that we decided that, at the time, it was enough.
A simpler version might be to have a git hook that checks that if .templ files are dirty, the .templ.go files are dirty too, although, that wouldn't ensure that dirty files are actually up-to-date.
Since it's so fast to generate templ files, another option would be to have a pre-commit hook that runs templ generate.
Those last two would be documentation updates only.
I was wondering if it's possible to set up a lint job to check if the templ generate has been ran on the project after changes to it and they are in sync with the go files. Current issue is some developers might forget to run the command and incomplete changes might get merged into repository.
The text was updated successfully, but these errors were encountered: