UNPKG

647 BJavaScriptView Raw
1var lodash = require('lodash'),
2 Linter = require('./linter');
3
4/**
5 * The htmllint namespace.
6 * @namespace
7 */
8var htmllint = function () {
9 var linter = htmllint.defaultLinter;
10
11 return linter.lint.apply(linter, arguments);
12};
13
14module.exports = htmllint;
15
16htmllint.Linter = Linter;
17htmllint.rules = require('./rules');
18htmllint.messages = require('./messages');
19htmllint.defaultLinter = new Linter(htmllint.rules);
20
21htmllint.use = function (plugins) {
22 plugins.forEach(function (plugin) {
23 if (lodash.isString(plugin)) {
24 plugin = require(plugin);
25 }
26
27 htmllint.defaultLinter.use(plugin);
28 });
29};