Harmonize prettier and eslint configs
Ever since we added prettier, we have attempted to use it alongside our existing eslint style rules (inherited from the AirBnB plugin). They have not always played nice together. We've been curating a list of incompatible rules to disable in our
.eslintrc. This list changes from time to time as we upgrade eslint, upgrade the AirBnB ruleset, or upgrade prettier and we've been tracking the breaking changes as technical debt.
I don't think this approach is sustainable. It is not practical to spend this time maintaining support for two competing style guide standards.
I propose we:
- Throw out all of the AirBnB rules effecting spacing, indentation, and other aesthetic rules (
arrow-parens, etc), but keep everything related to code standards (
prefer-const, etc etc)
- Give prettier sole domain over style and formatting.
Fortunately there is already a plugin that will handle this, maintained by the prettier team itself:
eslint-config-prettier. This plugin will automatically disable all rules that might come into conflict with the prettier config. It will allow us to maintain them separately without them stepping all over each other.
- Prettier will keep our code uniform and readable.
- ESLint will catch bugs and bad practices through static code analysis.
If we still want code style violations to fail builds (as it does currently with eslint) we can also utilize
eslint-plugin-prettier which will turn prettier into another eslint rule. Though given the current state of our prettier conversion (58% according to @leipert's visualization), we probably won't want to enable this until we convert the remaining scripts.