Registry / testing / eslint-plugin-amo

eslint-plugin-amo

JSON →
library3.0.0jsnpmunverified

An ESLint plugin for Mozilla's AMO (Addons.mozilla.org) project, providing custom lint rules for React, i18n, testing conventions, and TypeScript. Version 3.0.0 is the latest stable release, actively maintained by Mozilla. It includes a recommended preset, a TypeScript preset, and rules like `dangerously-set-inner-html`, `i18n-no-interpolated-values`, and `describe-with-filename`. Unlike generic ESLint plugins, this is tailored specifically for AMO's codebase and conventions, making it essential for contributors to the addons-frontend project.

npm install eslint-plugin-amo
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-AMO
E
eslint-plugin-amo
testingjavascriptv3.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

plugin
// In .eslintrc: { "plugins": ["amo"] }
{ "plugins": ["eslint-plugin-amo"] }
ESLint automatically strips the 'eslint-plugin-' prefix in plugin names.
recommended config
// In .eslintrc: { "extends": ["plugin:amo/recommended"] }
{ "extends": ["amo/recommended"] }
The 'plugin:' prefix is required when extending from an ESLint plugin config.
custom rule
// In .eslintrc: { "rules": { "amo/dangerously-set-inner-html": 2 } }
{ "rules": { "dangerously-set-inner-html": 2 } }
Rules must be prefixed with the plugin name: 'amo/'.

Shows basic ESLint configuration to enable the amo plugin, extend the recommended preset, and add custom rules.

// .eslintrc.json { "plugins": ["amo"], "extends": ["plugin:amo/recommended"], "rules": { "amo/dangerously-set-inner-html": 2, "amo/no-sinon-assert-called-if-called-with": 2 } } // Then run: // npx eslint src/**/*.js
Debug
Known issues
gotchaPlugin name in ESLint config must omit 'eslint-plugin-' prefix — use 'amo' not 'eslint-plugin-amo'.
fix
Use "plugins": ["amo"] in your ESLint config.
affects: >=1.0.0
gotchaRules must be prefixed with 'amo/' — e.g., 'amo/dangerously-set-inner-html' not 'dangerously-set-inner-html'.
fix
Use "amo/rule-name": 2 in your rules.
affects: >=1.0.0
gotchaExtending the plugin's config requires 'plugin:' prefix — e.g., 'plugin:amo/recommended' not 'amo/recommended'.
fix
Use "extends": ["plugin:amo/recommended"].
affects: >=1.0.0
breakingVersion 3.0.0 removed support for older ESLint versions. ESLint >= 6 required.
fix
Update ESLint to version 6 or later.
affects: >=3.0.0
deprecatedThe 'i18n-no-reference' rule is not included in the 'recommended' preset — must be explicitly enabled.
fix
Add "amo/i18n-no-reference": 2 to your rules if needed.
affects: >=1.0.0
Errors
Common errors & fixes
Configuration for rule "amo/dangerously-set-inner-html" is invalid: severity must be one of the following: 0, 1, 2; "error", "warn", "off".
Using a string like 'error' instead of numeric severity or invalid severity value.
fix
Use 2 for error, 1 for warning, 0 for off, or the equivalent strings.
ESLint couldn't find the plugin "eslint-plugin-amo". (ESLint couldn't find the plugin "eslint-plugin-amo".)
Plugin not installed or ESLint is installed globally while plugin is local (or vice versa).
fix
Install both ESLint and eslint-plugin-amo in the same project: npm i --save-dev eslint eslint-plugin-amo
Error while loading rule 'amo/dangerously-set-inner-html': Rule returned undefined.
The plugin version is incompatible with the ESLint version (e.g., plugin v3 with ESLint < 6).
fix
Update ESLint to version 6 or later, or downgrade the plugin.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required to use ESLint plugins.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-amo — npm install eslint-plugin-amo · libregistry