eslint-html-parser is a custom ESLint parser designed to lint HTML files, including embedded JavaScript within `<script>` tags. It achieves this by parsing HTML into a specific Abstract Syntax Tree (AST) structure, while delegating the parsing of JavaScript code (both in `<script>` tags and standalone `.js`/`.jsx` files) to a configurable ECMAScript parser, defaulting to `espree`. This enables developers to apply standard ESLint rules to their JavaScript within HTML, as well as define custom rules that target the HTML structure itself. The package is currently at version 6.8.2 and appears to be actively maintained, offering a crucial bridge for projects that require robust linting across both HTML and JavaScript within a single ESLint setup. It differentiates itself by providing a comprehensive HTML AST for deep linting, unlike simpler preprocessors that only extract script content.
Verified import paths — ran on the pinned version, not inferred.
Primarily an internal ESLint API. Directly importing and using this is for advanced custom tooling or deep integration, not typical application usage. It's the entry point ESLint calls to parse files.
Type import for the AST node representing an HTML element. Useful when developing custom ESLint rules that traverse the HTML AST produced by this parser.
Type import for the AST node representing an HTML attribute. Useful when developing custom ESLint rules that target HTML attributes.
Demonstrates installation, basic ESLint configuration using eslint-html-parser for both HTML and standalone JavaScript files, and running the linter.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.