Lint only changed files in a git PR
Nice guide to lint only changed files (git)
Typically, code linters will lint the entire project and report back any violations across any file. This very safely accomplishes catching any error in a compliant project, but makes gradual adoption very hard. Itās 100% buy-in and you canāt get the rewards until youāve finished the process.
What if instead we state āall new code should adopt these rulesā. For each pull request, lint only the files that contain changes. Donāt bother linting files that this PR has left alone, because itās not a regression and PRs need to have discipline in the tasks they complete. Over time, however, we might expect to see much of the codebase transformed, with maybe a little task at the end to clean up odds and ends. We can transform a big-upfront cost into a much more manageable process and de-risk the project significantly by gradually adopting a styleguide instead of Big Refactor Upfrontā¢.