ESLint plugin to lint and fix inline scripts inside HTML files. Current stable version is 8.1.4, with a release cadence of several months. It integrates with ESLint's flat config (ESLint 9+) and legacy config, supports multiple script tags per file with shared or module scope, and provides settings for HTML/XML extensions, indentation, and ignoring script tags without type. Unlike other HTML linting plugins, it focuses exclusively on JavaScript within HTML without providing HTML-specific rules.
npm install eslint-plugin-htmlVerified import paths — ran on the pinned version, not inferred.
Configures ESLint to lint inline scripts in HTML files using flat config (ESLint 9+).
Adopt flat config as shown in the quickstart or use the 'legacy' plugin wrapper if you must use .eslintrc.
Upgrade Node to >=6 and ESLint to >=4.
Remove 'html/html-extensions' and rely on the 'files' pattern in flat config.
Set 'sourceType: module' in ESLint parser options if using ES modules.
If you don't need XML linting, ensure 'html/xml-extensions' is not set.
Run 'npm install --save-dev eslint-plugin-html' and ensure the import path is correct.
Use the 'settings' property: settings: { html: { indent: 4 } } instead of rules.Switch to eslint.config.js flat config, or use the 'legacy' plugin object (import { legacy } from 'eslint-plugin-html').