ESLint vs Prettier: Should Style Corrections Reside in the Linting Pipeline?
0 reputation · 16 Jul 2023, 00:31 UTC
0 reputation · 16 Jul 2023, 00:31 UTC
ESLint 9 introduces array-based configuration, changing how eslint-config-prettier is composed, while Prettier continues to enforce indentation, quotes, semicolons, and other stylistic rules that also appear in ESLint's core style checks.
The overlap creates ambiguity about whether formatting should be handled by linting or a dedicated formatter, affecting editor responsiveness, CI speed, and the ability to disable conflicting rules without losing useful checks.
Given these considerations, the key questions are: (1) Should style corrections be performed solely by ESLint, relying on eslint-config-prettier to suppress overlapping rules? (2) Does coupling Prettier via eslint-plugin-prettier improve consistency at the cost of slower --fix runs? (3) Can the community-maintained mapping alone guarantee that all stylistic ESLint rules have equivalent Prettier behavior?
The established best practice is to delegate pure stylistic corrections (indentation, quotes, semicolons) entirely to Prettier, while using ESLint for enforcing code quality, potential bugs, and structural correctness.
eslint-config-prettier, must be used to disable ESLint rules that conflict with Prettier's formatting decisions.eslint-config-prettier must be the last configuration loaded in the ESLint setup chain.eslint-config-prettier.eslint-config-prettier after all other quality configurations.--fix flag on a test file to confirm style is handled by Prettier and ESLint reports no style conflicts.Coupling Prettier via eslint-plugin-prettier is an option for consistency but may increase linting time; separating the concerns is generally clearer for maintenance.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.