Recommended 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.
Cost
Open source. Both are MIT licensed and free to use in any project.
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
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
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
- Format all code with one tool in Architecture
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/testing-and-code-quality/eslint-and-prettier. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.