eslint-plugin-html weekly downloads statistics
By BenoitZugmeyer · npm · ESLint plugins
A ESLint plugin to lint and fix inline scripts contained in HTML files.
eslint-plugin-html has 867,590 recorded weekly downloads on npm, a decrease of 7.5% over the past 30 days, ranking #310 of 3,247 tracked listings.
About eslint-plugin-html
- Usage
- Disabling ESLint
- Linting HTML
- Multiple scripts tags in a HTML file
- XML support
- Settings
- Troubleshooting
- Migration from older versions
- Credits
Usage
Simply install via npm install --save-dev eslint-plugin-html and add the plugin to your ESLint
configuration. See
ESLint documentation.
import html from "eslint-plugin-html"
export default [
{
files: ["**/*.html"],
plugins: { html },
},
]
</details>
<details>
<summary>Example with ESLint 8 and below</summary>
{
"plugins": ["html"]
}
</details>
Disabling ESLint
To temporarily disable ESLint, use the <!-- eslint-disable --> HTML comment. Re-enable it with
<!-- eslint enable -->. Example:
<!-- eslint-disable -->
<script>
var foo = 1
</script>
<!-- eslint-enable -->
To disable ESLint for the next script tag only, use the <!-- eslint-disable-next-script --> HTML
comment. Example:
<!-- eslint-disable-next-script -->
<script>
var foo = 1
</script>
Disabled script tags are completely ignored: their content will not be parsed as JavaScript. You can use this to disable script tags containing template syntax.
Linting HTML
This plugin focuses on applying ESLint rules on inline scripts contained in HTML. It does not
provide any rule related to HTML. For that, you can use other plugins like
@html-eslint or
@angular-eslint. This plugin is not compatible
with the ESLint language option (this is an ESLint limitation). To lint both HTML and JS within
script tags, you have two alternatives:
Manual configuration
Provide the html-eslint plugin option manually, without relying on the
language option:
import { defineConfig } from "eslint/config"
import parserHtml from "@html-eslint/parser"
import pluginHtml from "@html-eslint/eslint-plugin"
import pluginJs from "@eslint/js"
import pluginJsInHtml from "eslint-plugin-html"
export default defineConfig([
{
files: ["**/*.html"],
plugins: {
html: pluginHtml,
jsInHtml: pluginJsInHtml,
js: pluginJs,
},
languageOptions: {
parser: parserHtml,
},
extends: ["js/recommended", "html/recommended"],
},
])
Use two configuration files
eslint.config.js with the eslint-plugin-html plugin to lint all JavaScript code and
eslint.config-html.js with the html-eslint plugin for HTML rules.
Run ESLint once with each configuration:
eslint . # lints JS
eslint -c eslint.config-html.js . # lints HTML
This alternative works well in CI and hooks, but might be limited in text editors where only one config is applied.
Multiple scripts tags in a HTML file
When linting a HTML with multiple script tags, this plugin tries to emulate the browser behavior by
sharing the global scope between scripts by default. This behavior doesn't apply to "module"
scripts (ie: <script type="module"> and most transpiled code), where each script tag gets its own
top-level scope.
ESLint has already an
option to tell the parser
if the script are modules. eslint-plugin-html will use this option as well to know if the scopes
should be shared (the default) or not. To change this, just set it in your ESLint configuration:
export default [
{
// ...
languageOptions: {
sourceType: "module",
},
},
]
</details>
<details>
<summary>ESLint 8 and below</summary>
{
"parserOptions": {
"sourceType": "module"
}
}
</details>
To illustrate this behavior, consider this HTML extract:
<script>
var foo = 1
</script>
<script>
alert(foo)
</script>
This is perfectly valid by default, and the ESLint rules no-unused-vars and no-undef shouldn't
complain. But if those scripts are considerated as ES modules, no-unused-vars should report an
error in the first script, and no-undef should report an error in the second script.
History…
Description from the npm listing.
- eslint-plugin
- eslintplugin
- eslint
- html
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 (170)Similar npm ESLint plugins plugins
All 20 eslint-plugin-html 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-html. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.