My new favorite tool is the ridiculously named husky package, which allows for configurable git hooks inside of package.json. Specifically what I'm doing now is precommit eslint and prettier, and prepush test:all i.e. people on my team will be unable to commit if they fail lint and unable to push if they fail unit tests. There's of course positives and negatives to this approach but the former significantly outweigh the later in my experience.
This completely breaks a number of git workflows. In my opinion a better option is to have eslint / tests / prettier / etc run as part of CI, and have your pull requests require CI to pass before they can be merged.
I like this balance better because the end goal is still met: "bad" code doesn't make it to the main git branch.
But it also allows for git workflows which involve frequent commits. (If all tests have to pass for every commit, even locally when the commits may be rebased away, it encourages very large and hard to review commits instead of the smallest commit possible for the given changes.)
And you do this in a new job? Introducing a linter the first week seems like a great way to make your new coworkers hate you. Sure, it's a good thing to do, but if your teammates aren't already using one then unilaterally introducing this into the commit process seems a little radical.
My OP should have called out that I specifically let everyone know that I have no problem with them using git commit -n and git push --no-verify to get around it if they are in feature branches. But yes I implemented this on day.. 2 of my current position which was lead of a greenfield project.
My new favorite tool is the ridiculously named husky package, which allows for configurable git hooks inside of package.json. Specifically what I'm doing now is precommit eslint and prettier, and prepush test:all i.e. people on my team will be unable to commit if they fail lint and unable to push if they fail unit tests. There's of course positives and negatives to this approach but the former significantly outweigh the later in my experience.