You could use something like https://github.com/typicode/husky to prevent a push if the linter fails.
If you're trying to enforce something locally you can definitely enforce it on CI automatically. Once people realized their PRs were failing due to linting issues they started checking them locally as well.