eslint-plugin-es5
raw JSON → 1.5.0 verified Sat Apr 25 auth: no javascript
ESLint plugin that enforces ES5-only code by forbidding ES2015+ syntax. Version 1.5.0 (stable, no recent updates). Maintains a comprehensive set of rules covering arrow functions, classes, destructuring, modules, generators, and more. Includes fixable rules for many features. Unlike similar plugins, provides preset configurations like `plugin:es5/no-es2015` to ban all ES2015 features at once. Requires ESLint >=3.
Common errors
error Error: Cannot find module 'eslint-plugin-es5' ↓
cause Plugin not installed or not in node_modules
fix
Run
npm install --save-dev eslint-plugin-es5 error Configuration for rule "es5/no-arrow-functions" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '"error"') ↓
cause Using string severity instead of numeric in some ESLint config contexts
fix
Use numeric severity: 'error' => 2 or use string in modern ESLint configs (check ESLint version)
error Rule 'es5/no-block-scoping' has been deprecated and replaced by 'es5/no-const' and 'es5/no-let' ↓
cause Older versions had separate rules, but unified in this plugin
fix
Use 'es5/no-block-scoping' with options or switch to individual rules if needed
Warnings
gotcha Rules may conflict with other ESLint rules that allow ES2015 features. ↓
fix Disable conflicting rules or ensure es5 rules are evaluated last.
gotcha Plugin does not handle TypeScript or JSX - those parsers may allow ES2015 syntax even with plugin enabled. ↓
fix Use TypeScript-specific plugins or parser options to enforce ES5.
deprecated Preset `plugin:es5/no-es2015` is still available but not updated for newer ES features beyond ES2016. ↓
fix Consider using `plugin:es5/no-es2016` for ES2016 restrictions or manually configure rules for later versions.
Install
npm install eslint-plugin-es5 yarn add eslint-plugin-es5 pnpm add eslint-plugin-es5 Imports
- plugin wrong
ESLint config should use `plugins` array, not importcorrectplugins: ['es5'] - rules wrong
'es5/no-arrow-functions': 2correct'es5/no-arrow-functions': 'error' - preset wrong
extends: ['eslint:recommended', 'es5/no-es2015']correctextends: ['plugin:es5/no-es2015']
Quickstart
// .eslintrc.json
{
"plugins": ["es5"],
"rules": {
"es5/no-arrow-functions": "error",
"es5/no-template-literals": "warn",
"es5/no-block-scoping": ["error", { "let": true, "const": true }]
}
}
// Or use preset to forbid all ES2015:
{
"extends": ["eslint:recommended", "plugin:es5/no-es2015"],
"rules": {
"es5/no-for-of": "error"
}
}