STK-43Default Open source
Use ESLint and Prettier for JavaScript code
Lint JavaScript and TypeScript with ESLint and format it with Prettier, and fail the build on either.
Review by
2027-04-30
How to do it
ESLint 1.0 shipped in July 2015, and 10.13.0 came out on 16 October 2026. Prettier 1.0 shipped in April 2017, and 3.9.10 came out on 10 October 2026. Both are MIT licensed. npm counted 96 million weekly downloads of ESLint and 82 million of Prettier in the week to 18 October 2026. Keep one formatter, as Format all code with one tool says. Choose something else when speed matters more than plugins. Biome lints and formats in one tool, but its 1.0 shipped in August 2023.
Examples
JavaScript example
// eslint.config.js
import js from '@eslint/js';
export default [
js.configs.recommended,
{ rules: { 'no-unused-vars': 'error', eqeqeq: 'error' } },
];
JSON example
{
"scripts": {
"lint": "eslint . && prettier --check ."
}
}
How to check
npx eslint . and npx prettier --check . both exit 0 in the build, and the project has no second formatter.
Sources
Related rules
- ARC-67 Format all code with one tool in Clean code and architecture
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/testing-and-code-quality/eslint-and-prettier">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.