Socket
Book a DemoInstallSign in
Socket

@html-eslint/template-parser

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@html-eslint/template-parser

HTML parser for template literals

latest
Source
npmnpm
Version
0.46.2
Version published
Weekly downloads
60K
23.83%
Maintainers
1
Weekly downloads
 
Created
Source

@html-eslint/template-parser

A parser that parses the html written inside a template literal.

Usage

const { parse } = require("@html-eslint/template-parser");
const espree = require("espree");
const { SourceCode } = require("eslint");

const code = `html\`<div
  id="\${ id }">
    \${text}
  </div>\`;`;

const ast = espree.parse(code, {
  range: true,
  loc: true,
  ecmaVersion: "latest",
});
const sourceCode = new SourceCode({
  text: code,
  ast: {
    ...ast,
    tokens: [],
    comments: ast.comments ?? [],
    loc: ast.loc,
    range: ast.range,
  },
});

const exp = ast.body[0].expression.quasi;
parse(exp, sourcecode, {
  Tag(node) {
    // ...
  },
  AttributeValue(node) {
    // ...
  },
});

License

Distributed under the MIT License.

FAQs

Package last updated on 03 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.