DEV Community

[Comment from a deleted post]
Collapse
 
qm3ster profile image
Mihail Malo • Edited

The only solution seems to automate it as far as you can throw it, and optimize for developer pleasure.

  1. Make the fixing automatic, not just linting. Even if Prettier produces sub-optimal formatting in some cases, it's better than an eslint rule that makes the developer fix some formatting by hand.
  2. Have an opinion on everything. Limit language features being used, there should be only one way to implement a feature. Deprecate outdated language features.
  3. Include style linting into the dev script, but don't make it fail builds. Let developers get instant feedback, even if they are using forbidden language features, but display the errors.
  4. Be extremely cautious if you think of using git pre-commit hook for linting which requires manual intervention, and testing. Use continuous integration in the pull request for that. The hook creates friction and prevents developers from committing often on their own machines. Either that, or they will use --no-verify mechanically, which is a very bad idea. Why not tests, you ask? Because the tests can take a relatively long time to complete. The dev script should be running continuous testing. Committing code that fails tests, which CI will clearly mark, is embarrassing enough that the developers will be careful, and it's not like there's any chance it will get merged.