New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@figma/eslint-plugin-html-cem

Package Overview
Dependencies
Maintainers
55
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figma/eslint-plugin-html-cem

ESLint plugin that lints custom-element usage in HTML files against a Custom Elements Manifest (CEM).

latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
55
Weekly downloads
 
Created
Source

eslint-plugin-html-cem

CEM-aware HTML linting for ESLint. Validates custom-element usage in .html files (and HTML-in-JS template literals) against a project's Custom Elements Manifest (custom-elements.json).

Built on top of @html-eslint/parser — uses its AST, doesn't fork it.

Why

@html-eslint/eslint-plugin ships rules for standard HTML5 only. It has no concept of a custom element's contract, so usages like <my-button labl="Save" variant="ghost"> slip through. This plugin loads your CEM and adds rules that catch unknown elements, unknown attributes, missing required attributes, invalid attribute values, unknown slot names, and deprecated usage.

Install

npm i -D @figma/eslint-plugin-html-cem @html-eslint/parser

Usage

// eslint.config.js
import htmlParser from "@html-eslint/parser";
import htmlCem from "@figma/eslint-plugin-html-cem";

export default [
  {
    files: ["**/*.html"],
    languageOptions: { parser: htmlParser },
    plugins: { "html-cem": htmlCem },
    settings: {
      "html-cem": {
        manifests: [
          "./custom-elements.json",
          "./node_modules/@my-org/components/custom-elements.json",
        ],
      },
    },
    rules: {
      ...htmlCem.configs.recommended.rules,
    },
  },
];

Rules

RuleDescription
html-cem/no-unknown-elementFlag dashed tags not registered in any loaded CEM.
html-cem/no-unknown-attrFlag attributes on a known custom element that aren't in its CEM.
html-cem/require-attrsFlag missing attributes marked @required in the CEM description.
html-cem/no-invalid-attr-valueValidate values against CEM types (boolean / number / string-literal unions).
html-cem/no-unknown-slotFlag slot="x" not declared in the parent element's CEM slots[].
html-cem/no-deprecatedWarn on elements/attrs marked deprecated in CEM.

Status

v0 — APIs may change. Feedback welcome.

License

MIT

Keywords

eslint

FAQs

Package last updated on 11 May 2026

Related posts