eslint-plugin-no-unsanitized weekly downloads statistics
By mozilla (3 listings) · npm · ESLint plugins
ESLint rule to disallow unsanitized code
eslint-plugin-no-unsanitized has 627,363 recorded weekly downloads on npm, a decrease of 30.8% over the past 30 days, ranking #251 of 2,322 tracked listings.
About eslint-plugin-no-unsanitized
Disallow unsanitized code (no-unsanitized)
These rules disallow unsafe coding practices that may result into security
vulnerabilities. We will disallow assignments (e.g., to innerHTML) as well as
calls (e.g., to insertAdjacentHTML) without the use of a pre-defined escaping
function. The escaping functions must be called with a template string.
The function names are hardcoded as Sanitizer.escapeHTML and escapeHTML.
The plugin also supports the
Sanitizer API
and calls to .setHTML() are also allowed by default.
This plugin is built for and used within Mozilla to maintain and improve the security of our products and services.
Rule Details
method
The method rule disallows certain function calls.
E.g., document.write() or insertAdjacentHTML().
See docs/rules/method.md for more.
property
The property rule disallows certain assignment expressions, e.g., to innerHTML.
See docs/rules/property.md for more.
Examples
Here are a few examples of code that we do not want to allow:
foo.innerHTML = input.value;
bar.innerHTML = "<a href='" + url + "'>About</a>";
A few examples of allowed practices:
foo.innerHTML = 5;
bar.innerHTML = "<a href='/about.html'>About</a>";
bar.innerHTML = escapeHTML`<a href='${url}'>About</a>`;
Install
With yarn or npm:
$ yarn add -D eslint-plugin-no-unsanitized
$ npm install --save-dev eslint-plugin-no-unsanitized
Usage
Flat config
import nounsanitized from "eslint-plugin-no-unsanitized";
export default config = [nounsanitized.configs.recommended];
or
import nounsanitized from "eslint-plugin-no-unsanitized";
export default config = [
{
files: ["**/*.js"],
plugins: { nounsanitized },
rules: {
"nounsanitized/method": "error",
"nounsanitized/property": "error",
},
},
];
eslintrc
In your .eslintrc.json file enable this rule with the following:
{
"extends": ["plugin:no-unsanitized/recommended-legacy"]
}
Or:
{
"plugins": ["no-unsanitized"],
"rules": {
"no-unsanitized/method": "error",
"no-unsanitized/property": "error"
}
}
Documentation
See docs/.
Description from the npm listing.
- eslint
- eslint-plugin
- eslintplugin
- lint
- sanitize
- innerHTML
- security
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (122)Similar npm ESLint plugins plugins
All 20 eslint-plugin-no-unsanitized alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/eslint-plugin-no-unsanitized. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.