Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@coyote-labs/html-lint

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coyote-labs/html-lint

[![npm version](https://badge.fury.io/js/%40coyote-labs%2Fhtml-lint.svg)](https://badge.fury.io/js/%40coyote-labs%2Fhtml-lint) [![Build Status](https://github.com/coyote-labs/html-lint/workflows/Build/badge.svg)](https://github.com/coyote-labs/html-lint/)

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

html-lint

npm version Build Status

A meaningful static analysis tool for HTML

html-lint is a linter for HTML files. It uses reshape to analyse your HTML and provides feedback to make your HTML better.

Features

  • Only meaningful rules
  • Fully extensible using custom rules
  • Contextual feedback

Installation

yarn add -D @coyote-labs/html-lint

Usage

node_modules/.bin/html-lint build/**/*.html

You can also use this programmatically.

const { htmlLint } = require('@coyote-labs/html-lint');

(async() => {
  try {
    // it accepts glob patterns or an array of file paths.
    await htmlLint('dist/*.html');
  } catch (error) {
    console.log(error)
  }
})();

html-lint results

Configuration

Project Level

html-lint loads the following configuration files if they are present:

  • An html-lint property in package.json.
  • A .html-lintrc file in JSON or YAML format.
  • A .html-lintrc.json, .html-lintrc.yaml, .html-lintrc.yml, or .html-lintrc.js file.
  • A .html-lint.config.js file exporting a JS object.

The configuration file can be used to toggle rules. The allowed levels are on, off and warn.

For example,

{
  'doctype-first': 'on',
  'class-ad-disabled': 'off',
  'src-not-empty': 'warn'
}

You can also use this file to configure custom rules, if any.

{
  'class-ad-disabled': 'off',
  'custom-rules': {
    'dir': 'my-custom-rules',
    'rules': {
      'custom-rule-one': 'error',
      'custom-rule-two': 'warn'
    }
  }
}

File Level

File level rule configuration is also possible. For example,

<!-- html-lint doctype-first:warn, id-ad-disabled:off -->
<html>
  <head>
    <title>Hello</title>
  </head>
  <body>
    <main class="sponsors">
      <ul>
        <li id="company-ad">Company A</li>
        <li id="company">Company B</li>
      </ul>
    </main>
  </body>
</html>

FAQs

Package last updated on 01 Oct 2019

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc