Registry / testing / eslint-plugin-angular

eslint-plugin-angular

JSON →
library5.0.0jsnpmunverified

ESLint plugin providing AngularJS (Angular 1.x) specific linting rules, covering best practices, conventions, and potential errors. Current stable version is 5.0.0, which requires ESLint ^9.32.0 and drops support for earlier versions. The plugin includes a shareable config based on John Papa's AngularJS style guide. It is the most established ESLint plugin for AngularJS, with over 150 rules organized into categories like possible errors, conventions, and style. Release cadence is low; updates are prompted by major ESLint changes. Key differentiator: specifically for AngularJS (not Angular 2+), with many rules directly mapping to the John Papa style guide.

npm install eslint-plugin-angular
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-ANGU
E
eslint-plugin-angular
testingjavascriptv5.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import angular from 'eslint-plugin-angular';
✗ const angular = require('eslint-plugin-angular');
ESM only; plugin is provided as default export. CommonJS require() fails in ESLint v9 flat config.
configs.johnpapa
✓ import angular from 'eslint-plugin-angular'; export default defineConfig([{ plugins: { angular }, rules: { ...angular.configs.johnpapa.rules } }]);
✗ import { configs } from 'eslint-plugin-angular';
Shareable config is accessed via the default export's configs property. Named export for configs does not exist.
angular/controller-name
✓ rules: { 'angular/controller-name': 'error' }
✗ rules: { 'controller-name': 'error' }
All rules must be prefixed with 'angular/', otherwise ESLint will look for a built-in rule with that name.

Shows how to install and configure eslint-plugin-angular with ESLint v9 flat config, enabling three common rules.

npm init @eslint/config npm install --save-dev eslint eslint-plugin-angular # Create eslint.config.mjs: import angular from 'eslint-plugin-angular'; export default defineConfig([{ plugins: { angular }, rules: { 'angular/controller-name': ['error', { nameStyle: 'camelCase' }], 'angular/module-getter': 'error', 'angular/module-setter': 'error' } }]);
Debug
Known issues
breakingVersion 5.0.0 drops support for ESLint versions < 9.32.0
fix
Upgrade ESLint to ^9.32.0 or pin eslint-plugin-angular to ^4.1.0 if you cannot upgrade.
affects: >=5.0.0
breakingVersion 4.0.0 removed the eslintrc-style config (extends) support; only flat config is supported.
fix
Migrate from .eslintrc to eslint.config.js/.mjs using the flat config format shown in the quickstart.
affects: >=4.0.0
gotchaThe plugin's shareable config must be explicitly spread in the rules object, unlike ESLint's built-in 'extends'.
fix
Use: rules: { ...angular.configs.johnpapa.rules } or specify individual rules.
affects: >=4.0.0
gotchaRules are prefixed with 'angular/', not 'angularjs/' or 'ng/'.
fix
Use 'angular/controller-name', etc. in your rules configuration.
affects: all
deprecatedSome older rules (e.g., 'angular/definedundefined') are deprecated but may still be available for backward compatibility.
fix
Check documentation and migrate to recommended replacements if available.
affects: >=4.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'angular' declared in '.eslintrc': Cannot find module 'eslint-plugin-angular'
The plugin is not installed in the project's node_modules.
fix
Run 'npm install --save-dev eslint-plugin-angular'.
ESLint couldn't find the config 'angular' after extending from the plugin.
In flat config, 'extends' is not used; you must use the plugins object and spread the config.
fix
Replace 'extends: ['angular']' with 'plugins: { angular }, rules: { ...angular.configs.johnpapa.rules }'.
Definition for rule 'angular/controller-name' was not found.
The plugin is not registered in the ESLint config, or the rule prefix is wrong.
fix
Ensure 'plugins: { angular }' is set in flat config, or 'plugins: ['angular']' in legacy config. Use 'angular/' prefix.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin to function
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-angular — npm install eslint-plugin-angular · libregistry