Nezir Zahirovic
Nezir Zahirovic

Using Git to run ESLint on changed files in a feature branch

I lied a bit in the title: this works for any static analysis tool. So if you're a RuboCop, Pylint, or [insert awesome static analysis util here] user, this solution has you covered. The impetus for this post was ESLint, though, so I'll use that for the sake of a specific example.I found myself in the unenviable position of trying to introduce a new linter rule. The reason this was such a pain was because there were over 4,000 violations in our codebase, and this particular rule didn't have an automated fix available. The manual fix wasn't just a matter of style, either — it would require regression-testing every module it touched. That's out of the question. Ignoring the error was impossible, too, because our CI build runs eslint against all of our frontend code. And making it a warning would not sufficiently incentivize the team to fix the underlying issues this rule is supposed to police. What to do?.


Using Git to run ESLint on changed files in a feature branch #javascriptba #javascript #nodejs #reactjs #angularjs #vuejs #meteorjs #typescript #jquery #emberjs #denojs #bosnia