@hdot/validate
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

hdot plugin: Attribute Validation

Automatically type check HTML attributes against the HTML spec, powered by markuplint.

Installation

npm i @hdot/plugins/validate

Usage

import validate from "@hdot/plugins/validate";
import { h, setPlugins } from "hdot";

setPlugins(h, [validate]);

h.div.id("my id")();
// ---> Error: 'my id' is not a valid DOMID.

Disabling in Production

If you running hdot in the browser, this plugin should typically not be used in production. Doing so will increase your bundle size.

If your build environment supports NODE_ENV, you might do the following:

import { h, setPlugins } from "hdot";
const plugins = [];

if (process.env.NODE_ENV === "development") {
  const { default: validate } = await import("@hdot/plugins/validate");
  plugins.push(validate);
}

setPlugins(h, plugins);

Readme

Keywords

none

Package Sidebar

Install

npm i @hdot/validate

Homepage

hdot.dev

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

4.29 kB

Total Files

5

Last publish

Collaborators

  • willmartian