0.7.0 • Published 3 years ago

@linthtml/gulp-linthtml v0.7.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

gulp-linthtml Build Status

A gulp plugin for LintHTML

Installation

Use npm.

npm install @linthtml/gulp-linthtml

Usage

const {src} = require('gulp');
const linthtml = require('@linthtml/gulp-linthtml');

function lintHTML() {
  return src("app/**/*.html")
    .pipe(linthtml())
    .pipe(linthtml.format())
    .pipe(linthtml.failOnError());
}

lintHTML.description = "Analyse all HTML files using linthtml";
exports.default = lintHTML;

API

linthtml()

No explicit configuration. A .linthtmlrc.* file may be resolved relative to the gulpfile.

linthtml(options)

options.rules

Type: Object

Set of rules.

{
  "rules":{
    "attr-bans": ["div", "center"],
    "attr-quote-style": "double",
    "html-req-lang": true
  }
}

options.configFile

Type: String

Path to the LintHTML rules configuration file.

linthtml(configFilePath)

Type: String

Shorthand for defining options.configFile.

linthtml.failOnError()

Stop a task/stream if a LintHTML error has been reported for any file.

// Cause the stream to stop(/fail) before copying an invalid JS file to the output directory
gulp.src('**/*.html')
    .pipe(linthtml())
    .pipe(linthtml.failOnError());

linthtml.format()

Format all linted files once. This should be used in the stream after piping through linthtml; otherwise, this will find no LintHTML results to format.

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago