What Are ESLint Plugins?
You'll learn how ESLint plugins package additional rules beyond the built-in set and how to integrate them into your configuration.
The Core Idea
ESLint ships with a robust collection of built-in rules covering common JavaScript patterns. But the JavaScript ecosystem is vast—frameworks like React, Vue, and TypeScript have their own best practices that ESLint's core rules don't address. Plugins are npm packages that bundle additional rules, configurations, and sometimes custom parsers for specialized code scenarios.
Think of plugins as expansion packs for ESLint: the base tool gives you general-purpose quality checks, while plugins add domain-specific intelligence.
How Plugins Work
Plugins typically:
- Export collections of rules (e.g., React-specific rules like
react/jsx-key) - Provide recommended configurations you can extend
- Sometimes include processors for non-JavaScript files (like
.vue)
Installing a Plugin
Use your package manager to add the plugin:
npm install --save-dev eslint-plugin-react
The naming convention is usually eslint-plugin-<name>.
Referencing Plugins in Configuration
In your .eslintrc file, add the plugin to the plugins array (you can omit the eslint-plugin- prefix):
{
"plugins": ["react"],
"rules": {
"react/jsx-uses-react": "error"
}
}
Now you can enable rules from that plugin by prefixing them with the plugin name (react/rule-name).
Many plugins also provide shareable configs you can extend:
{
"extends": ["plugin:react/recommended"]
}
Key Takeaway: ESLint plugins extend linting capabilities with specialized rules for frameworks, libraries, or coding styles—install them via npm, add them to plugins, and reference their rules or configs in your .eslintrc.