{"id":19778,"library":"eslint-plugin-html","title":"eslint-plugin-html","description":"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.","status":"active","version":"8.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/BenoitZugmeyer/eslint-plugin-html","tags":["javascript","eslint-plugin","eslintplugin","eslint","html"],"install":[{"cmd":"npm install eslint-plugin-html","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-html","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-html","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin extends ESLint functionality.","package":"eslint","optional":true}],"imports":[{"note":"CommonJS require works but is not recommended; ESM is standard since ESLint 9.","wrong":"const html = require('eslint-plugin-html')","symbol":"default (plugin object)","correct":"import html from 'eslint-plugin-html'"},{"note":"The package exports a default object with processors; named exports are available but not the main entry point for flat config.","wrong":"import { processors } from 'eslint-plugin-html'","symbol":"processors","correct":"const { processors } = require('eslint-plugin-html')"},{"note":"This plugin does not define custom rules; it only provides a processor. Use default import to access the processor via html.processors['.html'].","wrong":"import { rules } from 'eslint-plugin-html'","symbol":"Rules (none directly exported)","correct":"import html from 'eslint-plugin-html' // then use html.rules if needed"}],"quickstart":{"code":"// Install: npm install --save-dev eslint eslint-plugin-html\n// eslint.config.js\nimport html from 'eslint-plugin-html';\n\nexport default [\n  {\n    files: ['**/*.html'],\n    plugins: { html },\n    rules: {\n      'semi': 'error'\n    }\n  }\n];\n// Then lint: npx eslint index.html","lang":"javascript","description":"Configures ESLint to lint inline scripts in HTML files using flat config (ESLint 9+)."},"warnings":[{"fix":"Adopt flat config as shown in the quickstart or use the 'legacy' plugin wrapper if you must use .eslintrc.","message":"In v8, ESLint 9 flat config is the primary configuration method; legacy config (.eslintrc) may still work but is discouraged.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Upgrade Node to >=6 and ESLint to >=4.","message":"Version 5+ drops support for Node < 6 and ESLint < 4.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Remove 'html/html-extensions' and rely on the 'files' pattern in flat config.","message":"The 'html/html-extensions' setting is deprecated; use ESLint's built-in file extension matching.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Set 'sourceType: module' in ESLint parser options if using ES modules.","message":"By default, multiple script tags share global scope (non-module). This can cause false positives if variables are reused across tags.","severity":"gotcha","affected_versions":"*"},{"fix":"If you don't need XML linting, ensure 'html/xml-extensions' is not set.","message":"XML files with script tags are also linted if .xml is registered via settings.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev eslint-plugin-html' and ensure the import path is correct.","cause":"Plugin not installed or not listed in eslint.config.js correctly.","error":"ESLint couldn't find the plugin 'eslint-plugin-html'."},{"fix":"Use the 'settings' property: settings: { html: { indent: 4 } } instead of rules.","cause":"The rule 'html/indent' does not exist; it's a setting, not a rule.","error":"Configuration for rule 'html/indent' is invalid."},{"fix":"Switch to eslint.config.js flat config, or use the 'legacy' plugin object (import { legacy } from 'eslint-plugin-html').","cause":"Using .eslintrc instead of flat config with v8.","error":"The 'plugins' section in .eslintrc is for legacy config only."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}