eslint, jshint, and jslint are linters that find errors and enforce style rules, while prettier is a code formatter that automatically fixes layout issues. eslint is the industry standard for customizable linting, supporting modern JavaScript features and plugins. jshint is a simpler linter often used for legacy code or quick checks. jslint is an older tool with rigid rules that is rarely used in modern teams. prettier focuses solely on code appearance, often working alongside a linter to handle style concerns separately.
Keeping JavaScript code clean and error-free requires the right tools. eslint, jshint, and jslint focus on finding bugs and enforcing logic rules, while prettier focuses on fixing code style automatically. Understanding their differences helps you build a workflow that catches errors without slowing down development.
How you configure these tools defines how much control you have over their behavior.
eslint uses a dedicated config file that supports JavaScript, JSON, or YAML.
eslint.config.js (Flat Config) for better performance.// eslint: eslint.config.js
export default [
{
rules: {
"no-unused-vars": "error"
}
}
];
jshint uses a JSON file named .jshintrc.
// jshint: .jshintrc
{
"unused": true,
"eqeqeq": true
}
jslint often relies on inline comments or a simple .jslintrc.
// jslint: Inline comment
/*jslint browser: true, node: true */
function init() { /*...*/ }
prettier uses .prettierrc for style options only.
// prettier: .prettierrc
{
"semi": true,
"singleQuote": true
}
Each package provides a command-line interface to check or fix your code.
eslint runs via the eslint command.
--fix to automatically correct some issues.# eslint: Run on current directory
npx eslint . --fix
jshint runs via the jshint command.
# jshint: Run on current directory
npx jshint .
jslint runs via the jslint command.
# jslint: Run on specific file
npx jslint app.js
prettier runs via the prettier command.
--write to save changes directly to files.# prettier: Format all files
npx prettier --write .
Large projects often need to skip specific folders or generated code.
eslint uses .eslintignore or ignorePatterns in config.
# eslint: .eslintignore
build/
coverage/
*.min.js
jshint uses .jshintignore.
# jshint: .jshintignore
vendor/
dist/
jslint lacks a standard ignore file.
# jslint: Exclude via CLI
npx jslint app.js --exclude vendor/
prettier uses .prettierignore.
.gitignore.# prettier: .prettierignore
build/
*.lock
Sometimes you need to bypass a rule for a specific line of code.
eslint allows fine-grained disables with comments.
// eslint: Disable line
// eslint-disable-next-line no-unused-vars
const unused = 1;
jshint supports inline ignores with comments.
// jshint: Ignore line
// jshint ignore:line
const unused = 1;
jslint does not support inline disables well.
// jslint: No standard inline disable
// Must adjust global settings instead
const unused = 1; // Will likely trigger error
prettier allows ignoring specific blocks.
// prettier: Ignore format
// prettier-ignore
const messy = { a:1,b:2 };
Support for new language features is critical for modern development.
| Package | ES6+ Support | JSX/React | TypeScript | Configurable |
|---|---|---|---|---|
eslint | โ Full | โ Yes | โ Yes | โ High |
jshint | โ ๏ธ Partial | โ ๏ธ Limited | โ No | โ ๏ธ Medium |
jslint | โ Low | โ No | โ No | โ Low |
prettier | โ Full | โ Yes | โ Yes | โ ๏ธ Style Only |
jslint should NOT be used in new projects.
eslint instead for better long-term support.jshint is maintained but less active.
eslint for richer features.eslint and prettier are actively maintained.
eslint is the core tool for catching errors and enforcing logic rules. It is flexible enough to adapt to any project size or framework. Use it as your primary quality gate.
prettier is the best choice for handling code style automatically. It removes debates about formatting during code reviews. Pair it with ESLint for complete coverage.
jshint has a place in legacy maintenance but lacks modern features. Use it only if migrating an old project where switching costs are too high.
jslint is historically significant but practically outdated. Avoid it for new work to prevent unnecessary friction with your team.
Final Thought: For most teams, the combination of eslint for logic and prettier for style offers the best balance. This setup catches bugs early while keeping code consistent without manual effort.
Choose prettier to automatically handle code formatting so your team does not argue about spaces or semicolons. It works best when paired with a linter like ESLint to handle code quality separately from style. This separation reduces configuration complexity and speeds up code reviews.
Avoid jslint for new projects because its rules are too strict and cannot be easily changed to fit team preferences. It is mostly relevant for historical context or specific personal preferences aligned with its original author. Modern teams usually find it too restrictive for collaborative work.
Choose eslint for most modern projects where you need flexible rules, support for new JavaScript features, and integration with frameworks like React or Vue. It allows you to catch logic errors and enforce coding standards without sacrificing configurability. The ecosystem is vast, offering plugins for almost any need.
Choose jshint if you are maintaining older codebases that already rely on it or need a lightweight checker for simple scripts. It is less configurable than ESLint but requires minimal setup for basic error detection. It works well for projects that do not need complex rule customization.
JavaScript
ยท TypeScript
ยท Flow
ยท JSX
ยท JSON
CSS
ยท SCSS
ยท Less
HTML
ยท Vue
ยท Angular
GraphQL
ยท Markdown
ยท YAML
Your favorite language?
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne(),
);
Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
Install ยท Options ยท CLI ยท API
Show the world you're using Prettier โ
[](https://github.com/prettier/prettier)
See CONTRIBUTING.md.