talira

eslint-plugin-html

ESLint plugin that lints and fixes inline scripts in HTML files

open sourceISCfree

eslint-plugin-html is an ESLint plugin that lints and fixes the inline <script> blocks in HTML and XML files. It shares the global scope between classic script tags the way a browser does (module scripts each get their own), and settings choose the file extensions, script MIME types and indentation. It doesn't lint the HTML itself: its README points to @html-eslint for that.

Problems it solves

  • run ESLint on JavaScript inside HTML files
  • lint script tags in static HTML pages
  • fix indentation of inline scripts with ESLint

Features

  • lints and fixes inline scripts in HTML and XML
  • browser-like shared scope between script tags
  • configurable extensions, MIME types and indentation

Limitations

  • Doesn't lint the HTML markup itself, and isn't compatible with ESLint's language option.1

Alternatives

The same job

These do what eslint-plugin-html does.

  1. ESLint Find and fix problems in your JavaScript code.
  2. eslint-plugin-prettier Run Prettier as an ESLint rule
  3. eslint-plugin-unicorn More than 300 powerful ESLint rules
  4. Biome One fast toolchain that formats and lints JavaScript, TypeScript, JSON, CSS, HTML, GraphQL, YAML and Markdown.
  5. eslint-plugin-mocha ESLint rules for Mocha test suites
  6. XO Zero-config JavaScript and TypeScript linter built on ESLint

Compare eslint-plugin-html with the top 3