diff --git a/CHANGELOG.md b/CHANGELOG.md
index b3d3a0e93..1b628740b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## [0.16.3](https://github.com/htmlhint/HTMLHint/compare/v0.16.2...v0.16.3) (2021-11-24)
+
+
+### Reverts
+
+* Revert "chore(deps-dev): upgrade strip-json-comments (#763)" (#767) ([6c2f0cc](https://github.com/htmlhint/HTMLHint/commit/6c2f0cc088e6b154d85e3fbe7046fbcb65d89a96)), closes [#763](https://github.com/htmlhint/HTMLHint/issues/763) [#767](https://github.com/htmlhint/HTMLHint/issues/767)
+
## [0.16.2](https://github.com/htmlhint/HTMLHint/compare/v0.16.1...v0.16.2) (2021-11-23)
diff --git a/dist/cli/formatter.js b/dist/cli/formatter.js
new file mode 100644
index 000000000..a16c9d540
--- /dev/null
+++ b/dist/cli/formatter.js
@@ -0,0 +1,51 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var chalk = require("chalk");
+var events_1 = require("events");
+var glob_1 = require("glob");
+var path_1 = require("path");
+var HTMLHint;
+var options;
+var mapFormatters = loadFormatters();
+var arrSupportedFormatters = [];
+for (var formatterName in mapFormatters) {
+ if (formatterName !== 'default') {
+ arrSupportedFormatters.push(formatterName);
+ }
+}
+function loadFormatters() {
+ var arrFiles = glob_1.sync('./formatters/*.js', {
+ cwd: __dirname,
+ dot: false,
+ nodir: true,
+ strict: false,
+ silent: true,
+ });
+ var mapFormatters = {};
+ arrFiles.forEach(function (file) {
+ var fileInfo = path_1.parse(file);
+ var formatterPath = path_1.resolve(__dirname, file);
+ mapFormatters[fileInfo.name] = require(formatterPath);
+ });
+ return mapFormatters;
+}
+var formatter = new events_1.EventEmitter();
+formatter.getSupported = function () {
+ return arrSupportedFormatters;
+};
+formatter.init = function (tmpHTMLHint, tmpOptions) {
+ HTMLHint = tmpHTMLHint;
+ options = tmpOptions;
+};
+formatter.setFormat = function (format) {
+ var formatHandel = mapFormatters[format];
+ if (formatHandel === undefined) {
+ console.log(chalk.red('No supported formatter, supported formatters: %s'), arrSupportedFormatters.join(', '));
+ process.exit(1);
+ }
+ else {
+ formatHandel(formatter, HTMLHint, options);
+ }
+};
+module.exports = formatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9mb3JtYXR0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBOEI7QUFDOUIsaUNBQXFDO0FBQ3JDLDZCQUF1QztBQUN2Qyw2QkFBcUM7QUFJckMsSUFBSSxRQUEwQixDQUFBO0FBQzlCLElBQUksT0FBOEIsQ0FBQTtBQUdsQyxJQUFNLGFBQWEsR0FBRyxjQUFjLEVBQUUsQ0FBQTtBQUN0QyxJQUFNLHNCQUFzQixHQUFhLEVBQUUsQ0FBQTtBQUUzQyxLQUFLLElBQU0sYUFBYSxJQUFJLGFBQWEsRUFBRTtJQUN6QyxJQUFJLGFBQWEsS0FBSyxTQUFTLEVBQUU7UUFDL0Isc0JBQXNCLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxDQUFBO0tBQzNDO0NBQ0Y7QUFHRCxTQUFTLGNBQWM7SUFDckIsSUFBTSxRQUFRLEdBQUcsV0FBUSxDQUFDLG1CQUFtQixFQUFFO1FBQzdDLEdBQUcsRUFBRSxTQUFTO1FBQ2QsR0FBRyxFQUFFLEtBQUs7UUFDVixLQUFLLEVBQUUsSUFBSTtRQUNYLE1BQU0sRUFBRSxLQUFLO1FBQ2IsTUFBTSxFQUFFLElBQUk7S0FDYixDQUFDLENBQUE7SUFFRixJQUFNLGFBQWEsR0FBMEMsRUFBRSxDQUFBO0lBQy9ELFFBQVEsQ0FBQyxPQUFPLENBQUMsVUFBQyxJQUFJO1FBQ3BCLElBQU0sUUFBUSxHQUFHLFlBQUssQ0FBQyxJQ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yxDQUFBIn0=
\ No newline at end of file
diff --git a/dist/cli/formatters/checkstyle.js b/dist/cli/formatters/checkstyle.js
new file mode 100644
index 000000000..d5c4863f2
--- /dev/null
+++ b/dist/cli/formatters/checkstyle.js
@@ -0,0 +1,57 @@
+"use strict";
+var __spreadArrays = (this && this.__spreadArrays) || function () {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var xml = require("xml");
+var checkstyleFormatter = function (formatter) {
+ formatter.on('end', function (event) {
+ var arrFiles = [];
+ var arrAllMessages = event.arrAllMessages;
+ arrAllMessages.forEach(function (fileInfo) {
+ var arrMessages = fileInfo.messages;
+ var arrErrors = [];
+ arrMessages.forEach(function (message) {
+ arrErrors.push({
+ error: {
+ _attr: {
+ line: message.line,
+ column: message.col,
+ severity: message.type,
+ message: message.message,
+ source: "htmlhint." + message.rule.id,
+ },
+ },
+ });
+ });
+ arrFiles.push({
+ file: __spreadArrays([
+ {
+ _attr: {
+ name: fileInfo.file,
+ },
+ }
+ ], arrErrors),
+ });
+ });
+ var objXml = {
+ checkstyle: __spreadArrays([
+ {
+ _attr: {
+ version: '4.3',
+ },
+ }
+ ], arrFiles),
+ };
+ console.log(xml(objXml, {
+ declaration: true,
+ indent: ' ',
+ }));
+ });
+};
+module.exports = checkstyleFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tzdHlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvZm9ybWF0dGVycy9jaGVja3N0eWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLHlCQUEwQjtBQUkxQixJQUFNLG1CQ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QkFDTCxPQUFPLEVBQUUsS0FBSztxQkFDZjtpQkFDRjtlQUNFLFFBQVEsQ0FDWjtTQUNGLENBQUE7UUFFRCxPQUFPLENBQUMsR0FBRyxDQUNULEdBQUcsQ0FBQyxNQUFNLEVBQUU7WUFDVixXQUFXLEVBQUUsSUFBSTtZQUNqQixNQUFNLEVBQUUsTUFBTTtTQUNmLENBQUMsQ0FDSCxDQUFBO0lBQ0gsQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUE7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLG1CQUFtQixDQUFBIn0=
\ No newline at end of file
diff --git a/dist/cli/formatters/compact.js b/dist/cli/formatters/compact.js
new file mode 100644
index 000000000..0f64f4564
--- /dev/null
+++ b/dist/cli/formatters/compact.js
@@ -0,0 +1,22 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var chalk = require("chalk");
+var compactFormatter = function (formatter, HTMLHint, options) {
+ var nocolor = options.nocolor;
+ var chalkInstance = nocolor !== false ? new chalk.Instance({ level: 1 }) : chalk;
+ formatter.on('file', function (event) {
+ event.messages.forEach(function (message) {
+ console.log('%s: line %d, col %d, %s - %s (%s)', event.file, message.line, message.col, message.type, message.message, message.rule.id);
+ });
+ });
+ formatter.on('end', function (event) {
+ var allHintCount = event.allHintCount;
+ if (allHintCount > 0) {
+ console.log('');
+ var message = '%d problems';
+ console.log(nocolor ? message : chalkInstance.red(message), event.allHintCount);
+ }
+ });
+};
+module.exports = compactFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGFjdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvZm9ybWF0dGVycy9jb21wYWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQThCO0FBRzlCLElBQU0sZ0JBQWdCLEdBQXNCLFVBQzFDLFNBQVMsR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xPQUFPLENBQUMsRUFDOUMsS0FBSyxDQUFDLFlBQVksQ0FDbkIsQ0FBQTtTQUNGO0lBQ0gsQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUE7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLGdCQUFnQixDQUFBIn0=
\ No newline at end of file
diff --git a/dist/cli/formatters/default.js b/dist/cli/formatters/default.js
new file mode 100644
index 000000000..49c11d34b
--- /dev/null
+++ b/dist/cli/formatters/default.js
@@ -0,0 +1,42 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var chalk = require("chalk");
+var defaultFormatter = function (formatter, HTMLHint, options) {
+ var nocolor = !!options.nocolor;
+ formatter.on('start', function () {
+ console.log('');
+ });
+ formatter.on('config', function (event) {
+ var configPath = event.configPath;
+ console.log(' Config loaded: %s', nocolor ? configPath : chalk.cyan(configPath));
+ console.log('');
+ });
+ formatter.on('file', function (event) {
+ console.log(" " + chalk.white(event.file));
+ var arrLogs = HTMLHint.format(event.messages, {
+ colors: !nocolor,
+ indent: 6,
+ });
+ arrLogs.forEach(function (str) {
+ console.log(str);
+ });
+ console.log('');
+ });
+ formatter.on('end', function (event) {
+ var allFileCount = event.allFileCount;
+ var allHintCount = event.allHintCount;
+ var allHintFileCount = event.allHintFileCount;
+ var time = event.time;
+ var message;
+ if (allHintCount > 0) {
+ message = 'Scanned %d files, found %d errors in %d files (%d ms)';
+ console.log(nocolor ? message : chalk.red(message), allFileCount, allHintCount, allHintFileCount, time);
+ }
+ else {
+ message = 'Scanned %d files, no errors found (%d ms).';
+ console.log(nocolor ? message : chalk.green(message), allFileCount, time);
+ }
+ });
+};
+module.exports = defaultFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmYXVsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvZm9ybWF0dGVycy9kZWZhdWx0LnRzIl0s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FNLENBQUMsT0FBTyxHQUFHLGdCQUFnQixDQUFBIn0=
\ No newline at end of file
diff --git a/dist/cli/formatters/html.js b/dist/cli/formatters/html.js
new file mode 100644
index 000000000..966b53553
--- /dev/null
+++ b/dist/cli/formatters/html.js
@@ -0,0 +1,31 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var fs_1 = require("fs");
+var htmlFormatter = function (formatter) {
+ formatter.on('end', function (event) {
+ var fileContent = '';
+ fileContent += '
HTML Hint Violation Report';
+ fileContent += '';
+ fileContent += 'Violation Report
';
+ fileContent += '';
+ fileContent +=
+ 'Number# | File Name | Line Number | Message |
';
+ var _loop_1 = function (file, messages) {
+ fileContent += messages
+ .map(function (_a, i) {
+ var line = _a.line, message = _a.message;
+ return "" + (i + 1) + " | " + file + " | " + line + " | " + message + " |
";
+ })
+ .join('');
+ };
+ for (var _i = 0, _a = event.arrAllMessages; _i < _a.length; _i++) {
+ var _b = _a[_i], file = _b.file, messages = _b.messages;
+ _loop_1(file, messages);
+ }
+ fileContent += '
';
+ console.log(fileContent);
+ fs_1.writeFileSync('report.html', fileContent);
+ });
+};
+module.exports = htmlFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHRtbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvZm9ybWF0dGVycy9odG1sLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseUJBQWtDO0FBR2xDLElBQU0sYUFBYSxHQUFzQixVQUFVLFNBQVM7SUFDMUQsU0FBUyxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsVUFBQyxLQUFLO1FBQ3hCLElBQUksV0FBVyxHQUFHLFFBQVEsQ0FBQTtRQUMxQixXQUFXLElBQUksd0RBQXdELENBQUE7UUFDdkUsV0FBVyxJQUFJLFFBQVEsQ0FBQTtRQUN2QixXQUFXLElBQUksNENBQTRDLENBQUE7UUFFM0QsV0FBVyxJQUFJLG9CQUFvQixDQUFBO1FBQ25DLFdBQVc7WUFDVCxpRkFBaUYsQ0FBQTtnQ0FFdEUsSUFBSSxFQUFFLFFBQVE7WUFDekIsV0FBVyxJQUFJLFFBQVE7aUJBQ3BCLEdBQUcsQ0FDRixVQUFDLEVBQWlCLEVBQUUsQ0FBQztvQkFBbEIsSUFBSSxVQUFBLEVBQUUsT0FBTyxhQUFBO2dCQUNkLE9BQUEsY0FDRSxDQUFDLEdBQUcsQ0FBQyxrQkFDSyxJQUFJLGlCQUFZLElBQUksaUJBQVksT0FBTyxlQUFZO1lBRi9ELENBRStELENBQ2xFO2lCQUNBLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQTs7UUFSYixLQUFpQyxVQUFvQixFQUFwQixLQUFBLEtBQUssQ0FBQyxjQUFjLEVBQXBCLGNBQW9CLEVBQXBCLElBQW9CO1lBQTFDLElBQUEsV0FBa0IsRUFBaEIsSUFBSSxVQUFBLEVBQUUsUUFBUSxjQUFBO29CQUFkLElBQUksRUFBRSxRQUFRO1NBUzFCO1FBRUQsV0FBVyxJQUFJLHdCQUF3QixDQUFBO1FBQ3ZDLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLENBQUE7UUFDeEIsa0JBQWEsQ0FBQyxhQUFhLEVBQUUsV0FBVyxDQUFDLENBQUE7SUFDM0MsQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUE7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLGFBQWEsQ0FBQSJ9
\ No newline at end of file
diff --git a/dist/cli/formatters/json.js b/dist/cli/formatters/json.js
new file mode 100644
index 000000000..8b48950ea
--- /dev/null
+++ b/dist/cli/formatters/json.js
@@ -0,0 +1,9 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var jsonFormatter = function (formatter) {
+ formatter.on('end', function (event) {
+ console.log(JSON.stringify(event.arrAllMessages));
+ });
+};
+module.exports = jsonFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvZm9ybWF0dGVycy9qc29uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsSUFBTSxhQUFhLEdBQXNCLFVBQVUsU0FBUztJQUMxRCxTQUFTLENBQUMsRUFBRSxDQUFDLEtBQUssRUFBRSxVQUFDLEtBQUs7UUFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFBO0lBQ25ELENBQUMsQ0FBQyxDQUFBO0FBQ0osQ0FBQyxDQUFBO0FBRUQsTUFBTSxDQUFDLE9BQU8sR0FBRyxhQUFhLENBQUEifQ==
\ No newline at end of file
diff --git a/dist/cli/formatters/junit.js b/dist/cli/formatters/junit.js
new file mode 100644
index 000000000..4e005a630
--- /dev/null
+++ b/dist/cli/formatters/junit.js
@@ -0,0 +1,60 @@
+"use strict";
+var __spreadArrays = (this && this.__spreadArrays) || function () {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var xml = require("xml");
+var junitFormatter = function (formatter, HTMLHint) {
+ formatter.on('end', function (event) {
+ var arrTestcase = [];
+ var arrAllMessages = event.arrAllMessages;
+ arrAllMessages.forEach(function (fileInfo) {
+ var arrMessages = fileInfo.messages;
+ var arrLogs = HTMLHint.format(arrMessages);
+ arrTestcase.push({
+ testcase: [
+ {
+ _attr: {
+ name: fileInfo.file,
+ time: (fileInfo.time / 1000).toFixed(3),
+ },
+ },
+ {
+ failure: {
+ _attr: {
+ message: "Found " + arrMessages.length + " errors",
+ },
+ _cdata: arrLogs.join('\r\n'),
+ },
+ },
+ ],
+ });
+ });
+ var objXml = {
+ testsuites: [
+ {
+ testsuite: __spreadArrays([
+ {
+ _attr: {
+ name: 'HTMLHint Tests',
+ time: (event.time / 1000).toFixed(3),
+ tests: event.allFileCount,
+ failures: arrAllMessages.length,
+ },
+ }
+ ], arrTestcase),
+ },
+ ],
+ };
+ console.log(xml(objXml, {
+ declaration: true,
+ indent: ' ',
+ }));
+ });
+};
+module.exports = junitFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianVuaXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2Zvcm1hdHRlcnMvanVuaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEseUJBQTBCO0FBSTFCLElBQU0sY0FBYyxHQUFzQixVQUFVLFNBQVMsRUFBRSxRQUFRO0lBQ3JFLFNBQVMsQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFLFVBQUMsS0FBSztRQUN4QixJQUFNLFdBQVcsR0FBZ0IsRUFBRSxDQUFBO1FBQ25DLElBQU0sY0FBYyxHQUFHLEtBQUssQ0FBQyxjQUFjLENBQUE7UUFFM0MsY0FBYyxDQUFDLE9BQU8sQ0FBQyxVQUFDLFFBQVE7WUFDOUIsSUFBTSxXQUFXLEdBQUcsUUFBUSxDQUFDLFFBQVEsQ0FBQTtZQUNyQyxJQUFNLE9BQU8sR0FBRyxRQUFRLENBQUMsTUFBTSxDQUFDLFdBQVcsQ0FBQyxDQUFBO1lBRTVDLFdBQVcsQ0FBQyxJQUFJLENBQUM7Z0JBQ2YsUUFBUSxFQUFFO29CQUNSO3dCQUNFLEtBQUssRUFBRTs0QkFDTCxJQUFJLEVBQUUsUUFBUSxDQUFDLElBQUk7NEJBQ25CLEl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cli/formatters/markdown.js
new file mode 100644
index 000000000..9452e3a71
--- /dev/null
+++ b/dist/cli/formatters/markdown.js
@@ -0,0 +1,39 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var markdownFormatter = function (formatter, HTMLHint) {
+ formatter.on('end', function (event) {
+ console.log('# TOC');
+ var arrToc = [];
+ var arrContents = [];
+ var arrAllMessages = event.arrAllMessages;
+ arrAllMessages.forEach(function (fileInfo) {
+ var filePath = fileInfo.file;
+ var arrMessages = fileInfo.messages;
+ var errorCount = 0;
+ var warningCount = 0;
+ arrMessages.forEach(function (message) {
+ if (message.type === 'error') {
+ errorCount++;
+ }
+ else {
+ warningCount++;
+ }
+ });
+ arrToc.push(" - [" + filePath + "](#" + filePath + ")");
+ arrContents.push("");
+ arrContents.push("# " + filePath);
+ arrContents.push('');
+ arrContents.push("Found " + errorCount + " errors, " + warningCount + " warnings");
+ var arrLogs = HTMLHint.format(arrMessages);
+ arrContents.push('');
+ arrLogs.forEach(function (log) {
+ arrContents.push(" " + log);
+ });
+ arrContents.push('');
+ });
+ console.log(arrToc.join('\r\n') + "\r\n");
+ console.log(arrContents.join('\r\n'));
+ });
+};
+module.exports = markdownFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFya2Rvd24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2Zvcm1hdHRlcnMvbWFya2Rvd24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSxJQUFNLGlCQUFpQixHQUFzQixVQUFVLFNBQVMsRUFBRSxRQUFRO0lBQ3hFLFNBQVMsQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFLFVBQUMsS0FBSztRQUN4QixPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBRXBCLElBQU0sTUFBTSxHQUFhLEVBQUUsQ0FBQTtRQUMzQixJQ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FDLFVBQUMsR0FBRztnQkFDbEIsV0FBVyxDQUFDLElBQUksQ0FBQyxTQUFPLEdBQUssQ0FBQyxDQUFBO1lBQ2hDLENBQUMsQ0FBQyxDQUFBO1lBQ0YsV0FBVyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQTtRQUN0QixDQUFDLENBQUMsQ0FBQTtRQUVGLE9BQU8sQ0FBQyxHQUFHLENBQUksTUFBTSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBTSxDQUFDLENBQUE7UUFDekMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUE7SUFDdkMsQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUE7QUFFRCxNQUFNLENBQUMsT0FBTyxHQUFHLGlCQUFpQixDQUFBIn0=
\ No newline at end of file
diff --git a/dist/cli/formatters/unix.js b/dist/cli/formatters/unix.js
new file mode 100644
index 000000000..8baa3b086
--- /dev/null
+++ b/dist/cli/formatters/unix.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var chalk = require("chalk");
+var unixFormatter = function (formatter, HTMLHint, options) {
+ var nocolor = options.nocolor;
+ var chalkInstance = nocolor !== false ? new chalk.Instance({ level: 1 }) : chalk;
+ formatter.on('file', function (event) {
+ event.messages.forEach(function (message) {
+ console.log([
+ event.file,
+ message.line,
+ message.col,
+ " " + message.message + " [" + message.type + "/" + message.rule.id + "]",
+ ].join(':'));
+ });
+ });
+ formatter.on('end', function (event) {
+ var allHintCount = event.allHintCount;
+ if (allHintCount > 0) {
+ console.log('');
+ var message = '%d problems';
+ console.log(nocolor ? message : chalkInstance.red(message), event.allHintCount);
+ }
+ });
+};
+module.exports = unixFormatter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5peC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb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DLEVBQUUsQ0FBQyxDQUFBO1lBQ2YsSUFBTSxPQUFPLEdBQUcsYUFBYSxDQUFBO1lBQzdCLE9BQU8sQ0FBQyxHQUFHLENBQ1QsT0FBTyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLEVBQzlDLEtBQUssQ0FBQyxZQUFZLENBQ25CLENBQUE7U0FDRjtJQUNILENBQUMsQ0FBQyxDQUFBO0FBQ0osQ0FBQyxDQUFBO0FBRUQsTUFBTSxDQUFDLE9BQU8sR0FBRyxhQUFhLENBQUEifQ==
\ No newline at end of file
diff --git a/dist/cli/htmlhint.js b/dist/cli/htmlhint.js
new file mode 100644
index 000000000..d41bb7104
--- /dev/null
+++ b/dist/cli/htmlhint.js
@@ -0,0 +1,352 @@
+#!/usr/bin/env node
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var async_1 = require("async");
+var chalk = require("chalk");
+var program = require("commander");
+var fs_1 = require("fs");
+var glob = require("glob");
+var parseGlob = require("parse-glob");
+var path_1 = require("path");
+var node_fetch_1 = require("node-fetch");
+var stripJsonComments = require("strip-json-comments");
+var HTMLHint = require('../htmlhint.js').HTMLHint;
+var formatter = require('./formatter');
+var pkg = require('../../package.json');
+function map(val) {
+ var objMap = {};
+ val.split(',').forEach(function (item) {
+ var arrItem = item.split(/\s*=\s*/);
+ objMap[arrItem[0]] = arrItem[1] ? arrItem[1] : true;
+ });
+ return objMap;
+}
+program.on('--help', function () {
+ console.log(' Examples:');
+ console.log('');
+ console.log(' htmlhint');
+ console.log(' htmlhint www');
+ console.log(' htmlhint www/test.html');
+ console.log(' htmlhint www/**/*.xhtml');
+ console.log(' htmlhint www/**/*.{htm,html}');
+ console.log(' htmlhint http://www.alibaba.com/');
+ console.log(' cat test.html | htmlhint stdin');
+ console.log(' htmlhint --list');
+ console.log(' htmlhint --rules tag-pair,id-class-value=underline test.html');
+ console.log(' htmlhint --config .htmlhintrc test.html');
+ console.log(' htmlhint --ignore **/build/**,**/test/**');
+ console.log(' htmlhint --rulesdir ./rules/');
+ console.log('');
+});
+var arrSupportedFormatters = formatter.getSupported();
+program
+ .version(pkg.version)
+ .usage(' [options]')
+ .option('-l, --list', 'show all of the rules available')
+ .option('-c, --config ', 'custom configuration file')
+ .option('-r, --rules ', 'set all of the rules available', map)
+ .option('-R, --rulesdir ', 'load custom rules from file or folder')
+ .option("-f, --format <" + arrSupportedFormatters.join('|') + ">", 'output messages as custom format')
+ .option('-i, --ignore ', 'add pattern to exclude matches')
+ .option('--nocolor', 'disable color')
+ .option('--warn', 'Warn only, exit with 0')
+ .parse(process.argv);
+if (program.list) {
+ listRules();
+ process.exit(0);
+}
+var arrTargets = program.args;
+if (arrTargets.length === 0) {
+ arrTargets.push('./');
+}
+formatter.init(HTMLHint, {
+ nocolor: program.nocolor,
+});
+var format = program.format || 'default';
+if (format) {
+ formatter.setFormat(format);
+}
+hintTargets(arrTargets, {
+ rulesdir: program.rulesdir,
+ ruleset: program.rules,
+ formatter: formatter,
+ ignore: program.ignore,
+});
+function listRules() {
+ var rules = HTMLHint.rules;
+ var rule;
+ console.log(' All rules:');
+ console.log(' ==================================================');
+ for (var id in rules) {
+ rule = rules[id];
+ console.log(' %s : %s', chalk.bold(rule.id), rule.description);
+ }
+}
+function hintTargets(arrTargets, options) {
+ var arrAllMessages = [];
+ var allFileCount = 0;
+ var allHintFileCount = 0;
+ var allHintCount = 0;
+ var startTime = new Date().getTime();
+ var formatter = options.formatter;
+ var rulesdir = options.rulesdir;
+ if (rulesdir) {
+ loadCustomRules(rulesdir);
+ }
+ formatter.emit('start');
+ var arrTasks = [];
+ arrTargets.forEach(function (target) {
+ arrTasks.push(function (next) {
+ hintAllFiles(target, options, function (result) {
+ allFileCount += result.targetFileCount;
+ allHintFileCount += result.targetHintFileCount;
+ allHintCount += result.targetHintCount;
+ arrAllMessages = arrAllMessages.concat(result.arrTargetMessages);
+ next();
+ });
+ });
+ });
+ async_1.series(arrTasks, function () {
+ var spendTime = new Date().getTime() - startTime;
+ formatter.emit('end', {
+ arrAllMessages: arrAllMessages,
+ allFileCount: allFileCount,
+ allHintFileCount: allHintFileCount,
+ allHintCount: allHintCount,
+ time: spendTime,
+ });
+ process.exit(!program.warn && allHintCount > 0 ? 1 : 0);
+ });
+}
+function loadCustomRules(rulesdir) {
+ rulesdir = rulesdir.replace(/\\/g, '/');
+ if (fs_1.existsSync(rulesdir)) {
+ if (fs_1.statSync(rulesdir).isDirectory()) {
+ rulesdir += /\/$/.test(rulesdir) ? '' : '/';
+ rulesdir += '**/*.js';
+ var arrFiles = glob.sync(rulesdir, {
+ dot: false,
+ nodir: true,
+ strict: false,
+ silent: true,
+ });
+ arrFiles.forEach(function (file) {
+ loadRule(file);
+ });
+ }
+ else {
+ loadRule(rulesdir);
+ }
+ }
+}
+function loadRule(filepath) {
+ filepath = path_1.resolve(filepath);
+ try {
+ var module_1 = require(filepath);
+ module_1(HTMLHint);
+ }
+ catch (e) {
+ }
+}
+function hintAllFiles(target, options, onFinished) {
+ var globInfo = getGlobInfo(target);
+ globInfo.ignore = options.ignore;
+ var formatter = options.formatter;
+ var targetFileCount = 0;
+ var targetHintFileCount = 0;
+ var targetHintCount = 0;
+ var arrTargetMessages = [];
+ var ruleset = options.ruleset;
+ if (ruleset === undefined) {
+ ruleset = getConfig(program.config, globInfo.base, formatter);
+ }
+ var hintQueue = async_1.queue(function (filepath, next) {
+ var startTime = new Date().getTime();
+ if (filepath === 'stdin') {
+ hintStdin(ruleset, hintNext);
+ }
+ else if (/^https?:\/\//.test(filepath)) {
+ hintUrl(filepath, ruleset, hintNext);
+ }
+ else {
+ var messages = hintFile(filepath, ruleset);
+ hintNext(messages);
+ }
+ function hintNext(messages) {
+ var spendTime = new Date().getTime() - startTime;
+ var hintCount = messages.length;
+ if (hintCount > 0) {
+ formatter.emit('file', {
+ file: filepath,
+ messages: messages,
+ time: spendTime,
+ });
+ arrTargetMessages.push({
+ file: filepath,
+ messages: messages,
+ time: spendTime,
+ });
+ targetHintFileCount++;
+ targetHintCount += hintCount;
+ }
+ targetFileCount++;
+ setImmediate(next);
+ }
+ }, 10);
+ var isWalkDone = false;
+ var isHintDone = true;
+ hintQueue.drain(function () {
+ isHintDone = true;
+ checkAllHinted();
+ });
+ function checkAllHinted() {
+ if (isWalkDone && isHintDone) {
+ onFinished({
+ targetFileCount: targetFileCount,
+ targetHintFileCount: targetHintFileCount,
+ targetHintCount: targetHintCount,
+ arrTargetMessages: arrTargetMessages,
+ });
+ }
+ }
+ if (target === 'stdin') {
+ isWalkDone = true;
+ void hintQueue.push(target);
+ }
+ else if (/^https?:\/\//.test(target)) {
+ isWalkDone = true;
+ void hintQueue.push(target);
+ }
+ else {
+ walkPath(globInfo, function (filepath) {
+ isHintDone = false;
+ void hintQueue.push(filepath);
+ }, function () {
+ isWalkDone = true;
+ checkAllHinted();
+ });
+ }
+}
+function getGlobInfo(target) {
+ target = target.replace(/\\/g, '/');
+ var globInfo = parseGlob(target);
+ var base = path_1.resolve(globInfo.base);
+ base += /\/$/.test(base) ? '' : '/';
+ var pattern = globInfo.glob;
+ var globPath = globInfo.path;
+ var defaultGlob = '*.{htm,html}';
+ if (globInfo.is.glob === true) {
+ if (globPath.basename === '') {
+ pattern += defaultGlob;
+ }
+ }
+ else {
+ if (globPath.basename === '') {
+ pattern += "**/" + defaultGlob;
+ }
+ else if (fs_1.existsSync(target) && fs_1.statSync(target).isDirectory()) {
+ base += globPath.basename + "/";
+ pattern = "**/" + defaultGlob;
+ }
+ }
+ return {
+ base: base,
+ pattern: pattern,
+ };
+}
+function getConfig(configPath, base, formatter) {
+ if (configPath === undefined && fs_1.existsSync(base)) {
+ if (fs_1.statSync(base).isDirectory() === false) {
+ base = path_1.dirname(base);
+ }
+ while (base) {
+ var tmpConfigFile = path_1.resolve(base, '.htmlhintrc');
+ if (fs_1.existsSync(tmpConfigFile)) {
+ configPath = tmpConfigFile;
+ break;
+ }
+ if (!base) {
+ break;
+ }
+ base = base.substring(0, base.lastIndexOf(path_1.sep));
+ }
+ }
+ if (configPath !== undefined && fs_1.existsSync(configPath)) {
+ var config = fs_1.readFileSync(configPath, 'utf-8');
+ var ruleset = {};
+ try {
+ ruleset = JSON.parse(stripJsonComments(config));
+ formatter.emit('config', {
+ ruleset: ruleset,
+ configPath: configPath,
+ });
+ }
+ catch (e) {
+ }
+ return ruleset;
+ }
+}
+function walkPath(globInfo, callback, onFinish) {
+ var base = globInfo.base;
+ var pattern = globInfo.pattern;
+ var ignore = globInfo.ignore;
+ var arrIgnores = ['**/node_modules/**'];
+ if (ignore) {
+ ignore.split(',').forEach(function (pattern) {
+ arrIgnores.push(pattern);
+ });
+ }
+ var walk = glob(pattern, {
+ cwd: base,
+ dot: false,
+ ignore: arrIgnores,
+ nodir: true,
+ strict: false,
+ silent: true,
+ }, function () {
+ onFinish();
+ });
+ walk.on('match', function (file) {
+ base = base.replace(/^.\//, '');
+ if (path_1.sep !== '/') {
+ base = base.replace(/\//g, path_1.sep);
+ }
+ callback(base + file);
+ });
+}
+function hintFile(filepath, ruleset) {
+ var content = '';
+ try {
+ content = fs_1.readFileSync(filepath, 'utf-8');
+ }
+ catch (e) {
+ }
+ return HTMLHint.verify(content, ruleset);
+}
+function hintStdin(ruleset, callback) {
+ process.stdin.setEncoding('utf8');
+ var buffers = [];
+ process.stdin.on('data', function (text) {
+ buffers.push(text);
+ });
+ process.stdin.on('end', function () {
+ var content = buffers.join('');
+ var messages = HTMLHint.verify(content, ruleset);
+ callback(messages);
+ });
+}
+function hintUrl(url, ruleset, callback) {
+ var errorFn = function () { return callback([]); };
+ node_fetch_1.default(url).then(function (response) {
+ if (response.ok) {
+ response.text().then(function (body) {
+ var messages = HTMLHint.verify(body, ruleset);
+ callback(messages);
+ }, errorFn);
+ }
+ else {
+ errorFn();
+ }
+ }, errorFn);
+}
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR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RUFBRTtRQUN0QixJQUFNLE9BQU8sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFBO1FBQ2hDLElBQU0sUUFBUSxHQUFHLFFBQVEsQ0FBQyxNQUFNLENBQUMsT0FBTyxFQUFFLE9BQU8sQ0FBQyxDQUFBO1FBQ2xELFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQTtJQUNwQixDQUFDLENBQUMsQ0FBQTtBQUNKLENBQUM7QUFHRCxTQUFTLE9BQU8sQ0FDZCxHQUFXLEVBQ1gsT0FBNEIsRUFDNUIsUUFBb0M7SUFFcEMsSUFBTSxPQUFPLEdBQUcsY0FBTSxPQUFBLFFBQVEsQ0FBQyxFQUFFLENBQUMsRUFBWixDQUFZLENBQUE7SUFDbEMsb0JBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsVUFBQyxRQUFRO1FBQ3ZCLElBQUksUUFBUSxDQUFDLEVBQUUsRUFBRTtZQUNmLFFBQVEsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxJQUFJLENBQUMsVUFBQyxJQUFJO2dCQUN4QixJQUFNLFFBQVEsR0FBRyxRQUFRLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQTtnQkFDL0MsUUFBUSxDQUFDLFFBQVEsQ0FBQyxDQUFBO1lBQ3BCLENBQUMsRUFBRSxPQUFPLENBQUMsQ0FBQTtTQUNaO2FBQU07WUFDTCxPQUFPLEVBQUUsQ0FBQTtTQUNWO0lBQ0gsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxDQUFBO0FBQ2IsQ0FBQyJ9
\ No newline at end of file
diff --git a/dist/core/core.js b/dist/core/core.js
new file mode 100644
index 000000000..b643ca16b
--- /dev/null
+++ b/dist/core/core.js
@@ -0,0 +1,112 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.HTMLParser = exports.Reporter = exports.HTMLRules = exports.HTMLHint = void 0;
+var htmlparser_1 = require("./htmlparser");
+exports.HTMLParser = htmlparser_1.default;
+var reporter_1 = require("./reporter");
+exports.Reporter = reporter_1.default;
+var HTMLRules = require("./rules");
+exports.HTMLRules = HTMLRules;
+var HTMLHintCore = (function () {
+ function HTMLHintCore() {
+ this.rules = {};
+ this.defaultRuleset = {
+ 'tagname-lowercase': true,
+ 'attr-lowercase': true,
+ 'attr-value-double-quotes': true,
+ 'doctype-first': true,
+ 'tag-pair': true,
+ 'spec-char-escape': true,
+ 'id-unique': true,
+ 'src-not-empty': true,
+ 'attr-no-duplication': true,
+ 'title-require': true,
+ };
+ }
+ HTMLHintCore.prototype.addRule = function (rule) {
+ this.rules[rule.id] = rule;
+ };
+ HTMLHintCore.prototype.verify = function (html, ruleset) {
+ if (ruleset === void 0) { ruleset = this.defaultRuleset; }
+ if (Object.keys(ruleset).length === 0) {
+ ruleset = this.defaultRuleset;
+ }
+ html = html.replace(/^\s*/i, function (all, strRuleset) {
+ strRuleset.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g, function (all, ruleId, value) {
+ ruleset[ruleId] =
+ value !== undefined && value.length > 0 ? JSON.parse(value) : true;
+ return '';
+ });
+ return '';
+ });
+ var parser = new htmlparser_1.default();
+ var reporter = new reporter_1.default(html, ruleset);
+ var rules = this.rules;
+ var rule;
+ for (var id in ruleset) {
+ rule = rules[id];
+ if (rule !== undefined && ruleset[id] !== false) {
+ rule.init(parser, reporter, ruleset[id]);
+ }
+ }
+ parser.parse(html);
+ return reporter.messages;
+ };
+ HTMLHintCore.prototype.format = function (arrMessages, options) {
+ if (options === void 0) { options = {}; }
+ var arrLogs = [];
+ var colors = {
+ white: '',
+ grey: '',
+ red: '',
+ reset: '',
+ };
+ if (options.colors) {
+ colors.white = '\x1b[37m';
+ colors.grey = '\x1b[90m';
+ colors.red = '\x1b[31m';
+ colors.reset = '\x1b[39m';
+ }
+ var indent = options.indent || 0;
+ arrMessages.forEach(function (hint) {
+ var leftWindow = 40;
+ var rightWindow = leftWindow + 20;
+ var evidence = hint.evidence;
+ var line = hint.line;
+ var col = hint.col;
+ var evidenceCount = evidence.length;
+ var leftCol = col > leftWindow + 1 ? col - leftWindow : 1;
+ var rightCol = evidence.length > col + rightWindow ? col + rightWindow : evidenceCount;
+ if (col < leftWindow + 1) {
+ rightCol += leftWindow - col + 1;
+ }
+ evidence = evidence.replace(/\t/g, ' ').substring(leftCol - 1, rightCol);
+ if (leftCol > 1) {
+ evidence = "..." + evidence;
+ leftCol -= 3;
+ }
+ if (rightCol < evidenceCount) {
+ evidence += '...';
+ }
+ arrLogs.push(colors.white + repeatStr(indent) + "L" + line + " |" + colors.grey + evidence + colors.reset);
+ var pointCol = col - leftCol;
+ var match = evidence.substring(0, pointCol).match(/[^\u0000-\u00ff]/g);
+ if (match !== null) {
+ pointCol += match.length;
+ }
+ arrLogs.push(colors.white +
+ repeatStr(indent) +
+ repeatStr(String(line).length + 3 + pointCol) + "^ " + colors.red + hint.message + " (" + hint.rule.id + ")" + colors.reset);
+ });
+ return arrLogs;
+ };
+ return HTMLHintCore;
+}());
+function repeatStr(n, str) {
+ return new Array(n + 1).join(str || ' ');
+}
+exports.HTMLHint = new HTMLHintCore();
+Object.keys(HTMLRules).forEach(function (key) {
+ exports.HTMLHint.addRule(HTMLRules[key]);
+});
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29yZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL2NvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkNBQXFDO0FBb0tQLHFCQXBLdkIsb0JBQVUsQ0FvS3VCO0FBbkt4Qyx1Q0FBaUM7QUFtS2IsbUJBbktiLGtCQUFRLENBbUthO0FBbEs1QixtQ0FBb0M7QUFrSzNCLDhCQUFTO0FBMUpsQjtJQUFBO1FBQ1MsVUFBSyxHQUE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ENBQUMsTUFBTSxHQUFHLENBQUMsR0FBRyxRQUFRLENBQUMsVUFDMUMsTUFBTSxDQUFDLEdBQUcsR0FBRyxJQUFJLENBQUMsT0FBTyxVQUFLLElBQUksQ0FBQyxJQUFJLENBQUMsRUFBRSxTQUFJLE1BQU0sQ0FBQyxLQUFPLENBQ2xFLENBQUE7UUFDSCxDQUFDLENBQUMsQ0FBQTtRQUVGLE9BQU8sT0FBTyxDQUFBO0lBQ2hCLENBQUM7SUFDSCxtQkFBQztBQUFELENBQUMsQUEzSUQsSUEySUM7QUFHRCxTQUFTLFNBQVMsQ0FBQyxDQUFTLEVBQUUsR0FBWTtJQUN4QyxPQUFPLElBQUksS0FBSyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxDQUFBO0FBQzFDLENBQUM7QUFFWSxRQUFBLFFBQVEsR0FBRyxJQUFJLFlBQVksRUFBRSxDQUFBO0FBRTFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQUMsR0FBRztJQUdqQyxnQkFBUSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQTtBQUNsQyxDQUFDLENBQUMsQ0FBQSJ9
\ No newline at end of file
diff --git a/dist/core/htmlparser.js b/dist/core/htmlparser.js
new file mode 100644
index 000000000..70f2f9fc2
--- /dev/null
+++ b/dist/core/htmlparser.js
@@ -0,0 +1,240 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var HTMLParser = (function () {
+ function HTMLParser() {
+ this._listeners = {};
+ this._mapCdataTags = this.makeMap('script,style');
+ this._arrBlocks = [];
+ this.lastEvent = null;
+ }
+ HTMLParser.prototype.makeMap = function (str) {
+ var obj = {};
+ var items = str.split(',');
+ for (var i = 0; i < items.length; i++) {
+ obj[items[i]] = true;
+ }
+ return obj;
+ };
+ HTMLParser.prototype.parse = function (html) {
+ var _this = this;
+ var mapCdataTags = this._mapCdataTags;
+ var regTag = /<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g;
+ var regAttr = /\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g;
+ var regLine = /\r?\n/g;
+ var match;
+ var matchIndex;
+ var lastIndex = 0;
+ var tagName;
+ var arrAttrs;
+ var tagCDATA = null;
+ var attrsCDATA;
+ var arrCDATA = [];
+ var lastCDATAIndex = 0;
+ var text;
+ var lastLineIndex = 0;
+ var line = 1;
+ var arrBlocks = this._arrBlocks;
+ this.fire('start', {
+ pos: 0,
+ line: 1,
+ col: 1,
+ });
+ var isMapCdataTagsRequired = function () {
+ var attrType = arrAttrs.find(function (attr) { return attr.name === 'type'; }) || {
+ value: '',
+ };
+ return (mapCdataTags[tagName] &&
+ attrType.value.indexOf('text/ng-template') === -1);
+ };
+ var saveBlock = function (type, raw, pos, data) {
+ var col = pos - lastLineIndex + 1;
+ if (data === undefined) {
+ data = {};
+ }
+ data.raw = raw;
+ data.pos = pos;
+ data.line = line;
+ data.col = col;
+ arrBlocks.push(data);
+ _this.fire(type, data);
+ var lineMatch;
+ while ((lineMatch = regLine.exec(raw))) {
+ line++;
+ lastLineIndex = pos + regLine.lastIndex;
+ }
+ };
+ while ((match = regTag.exec(html))) {
+ matchIndex = match.index;
+ if (matchIndex > lastIndex) {
+ text = html.substring(lastIndex, matchIndex);
+ if (tagCDATA) {
+ arrCDATA.push(text);
+ }
+ else {
+ saveBlock('text', text, lastIndex);
+ }
+ }
+ lastIndex = regTag.lastIndex;
+ if ((tagName = match[1])) {
+ if (tagCDATA && tagName === tagCDATA) {
+ text = arrCDATA.join('');
+ saveBlock('cdata', text, lastCDATAIndex, {
+ tagName: tagCDATA,
+ attrs: attrsCDATA,
+ });
+ tagCDATA = null;
+ attrsCDATA = undefined;
+ arrCDATA = [];
+ }
+ if (!tagCDATA) {
+ saveBlock('tagend', match[0], matchIndex, {
+ tagName: tagName,
+ });
+ continue;
+ }
+ }
+ if (tagCDATA) {
+ arrCDATA.push(match[0]);
+ }
+ else {
+ if ((tagName = match[4])) {
+ arrAttrs = [];
+ var attrs = match[5];
+ var attrMatch = void 0;
+ var attrMatchCount = 0;
+ while ((attrMatch = regAttr.exec(attrs))) {
+ var name_1 = attrMatch[1];
+ var quote = attrMatch[2]
+ ? attrMatch[2]
+ : attrMatch[4]
+ ? attrMatch[4]
+ : '';
+ var value = attrMatch[3]
+ ? attrMatch[3]
+ : attrMatch[5]
+ ? attrMatch[5]
+ : attrMatch[6]
+ ? attrMatch[6]
+ : '';
+ arrAttrs.push({
+ name: name_1,
+ value: value,
+ quote: quote,
+ index: attrMatch.index,
+ raw: attrMatch[0],
+ });
+ attrMatchCount += attrMatch[0].length;
+ }
+ if (attrMatchCount === attrs.length) {
+ saveBlock('tagstart', match[0], matchIndex, {
+ tagName: tagName,
+ attrs: arrAttrs,
+ close: match[6],
+ });
+ if (isMapCdataTagsRequired()) {
+ tagCDATA = tagName;
+ attrsCDATA = arrAttrs.concat();
+ arrCDATA = [];
+ lastCDATAIndex = lastIndex;
+ }
+ }
+ else {
+ saveBlock('text', match[0], matchIndex);
+ }
+ }
+ else if (match[2] || match[3]) {
+ saveBlock('comment', match[0], matchIndex, {
+ content: match[2] || match[3],
+ long: match[2] ? true : false,
+ });
+ }
+ }
+ }
+ if (html.length > lastIndex) {
+ text = html.substring(lastIndex, html.length);
+ saveBlock('text', text, lastIndex);
+ }
+ this.fire('end', {
+ pos: lastIndex,
+ line: line,
+ col: html.length - lastLineIndex + 1,
+ });
+ };
+ HTMLParser.prototype.addListener = function (types, listener) {
+ var _listeners = this._listeners;
+ var arrTypes = types.split(/[,\s]/);
+ var type;
+ for (var i = 0, l = arrTypes.length; i < l; i++) {
+ type = arrTypes[i];
+ if (_listeners[type] === undefined) {
+ _listeners[type] = [];
+ }
+ _listeners[type].push(listener);
+ }
+ };
+ HTMLParser.prototype.fire = function (type, data) {
+ if (data === undefined) {
+ data = {};
+ }
+ data.type = type;
+ var listeners = [];
+ var listenersType = this._listeners[type];
+ var listenersAll = this._listeners['all'];
+ if (listenersType !== undefined) {
+ listeners = listeners.concat(listenersType);
+ }
+ if (listenersAll !== undefined) {
+ listeners = listeners.concat(listenersAll);
+ }
+ var lastEvent = this.lastEvent;
+ if (lastEvent !== null) {
+ delete lastEvent['lastEvent'];
+ data.lastEvent = lastEvent;
+ }
+ this.lastEvent = data;
+ for (var i = 0, l = listeners.length; i < l; i++) {
+ listeners[i].call(this, data);
+ }
+ };
+ HTMLParser.prototype.removeListener = function (type, listener) {
+ var listenersType = this._listeners[type];
+ if (listenersType !== undefined) {
+ for (var i = 0, l = listenersType.length; i < l; i++) {
+ if (listenersType[i] === listener) {
+ listenersType.splice(i, 1);
+ break;
+ }
+ }
+ }
+ };
+ HTMLParser.prototype.fixPos = function (event, index) {
+ var text = event.raw.substr(0, index);
+ var arrLines = text.split(/\r?\n/);
+ var lineCount = arrLines.length - 1;
+ var line = event.line;
+ var col;
+ if (lineCount > 0) {
+ line += lineCount;
+ col = arrLines[lineCount].length + 1;
+ }
+ else {
+ col = event.col + index;
+ }
+ return {
+ line: line,
+ col: col,
+ };
+ };
+ HTMLParser.prototype.getMapAttrs = function (arrAttrs) {
+ var mapAttrs = {};
+ var attr;
+ for (var i = 0, l = arrAttrs.length; i < l; i++) {
+ attr = arrAttrs[i];
+ mapAttrs[attr.name] = attr.value;
+ }
+ return mapAttrs;
+ };
+ return HTMLParser;
+}());
+exports.default = HTMLParser;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHRtbHBhcnNlci5qcyIsInNvdXJjZ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7WUFDakIsR0FBRyxHQUFHLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFBO1NBQ3JDO2FBQU07WUFDTCxHQUFHLEdBQUcsS0FBSyxDQUFDLEdBQUcsR0FBRyxLQUFLLENBQUE7U0FDeEI7UUFFRCxPQUFPO1lBQ0wsSUFBSSxFQUFFLElBQUk7WUFDVixHQUFHLEVBQUUsR0FBRztTQUNULENBQUE7SUFDSCxDQUFDO0lBRU0sZ0NBQVcsR0FBbEIsVUFBbUIsUUFBZ0I7UUFHakMsSUFBTSxRQUFRLEdBQStCLEVBQUUsQ0FBQTtRQUMvQyxJQUFJLElBQVUsQ0FBQTtRQUVkLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxRQUFRLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUU7WUFDL0MsSUFBSSxHQUFHLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtZQUNsQixRQUFRLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUE7U0FDakM7UUFFRCxPQUFPLFFBQVEsQ0FBQTtJQUNqQixDQUFDO0lBQ0gsaUJBQUM7QUFBRCxDQUFDLEFBL1NELElBK1NDIn0=
\ No newline at end of file
diff --git a/dist/core/reporter.js b/dist/core/reporter.js
new file mode 100644
index 000000000..5ea05eb72
--- /dev/null
+++ b/dist/core/reporter.js
@@ -0,0 +1,57 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Reporter = (function () {
+ function Reporter(html, ruleset) {
+ this.html = html;
+ this.lines = html.split(/\r?\n/);
+ var match = /\r?\n/.exec(html);
+ this.brLen = match !== null ? match[0].length : 0;
+ this.ruleset = ruleset;
+ this.messages = [];
+ }
+ Reporter.prototype.info = function (message, line, col, rule, raw) {
+ this.report("info", message, line, col, rule, raw);
+ };
+ Reporter.prototype.warn = function (message, line, col, rule, raw) {
+ this.report("warning", message, line, col, rule, raw);
+ };
+ Reporter.prototype.error = function (message, line, col, rule, raw) {
+ this.report("error", message, line, col, rule, raw);
+ };
+ Reporter.prototype.report = function (type, message, line, col, rule, raw) {
+ var lines = this.lines;
+ var brLen = this.brLen;
+ var evidence = '';
+ var evidenceLen = 0;
+ for (var i = line - 1, lineCount = lines.length; i < lineCount; i++) {
+ evidence = lines[i];
+ evidenceLen = evidence.length;
+ if (col > evidenceLen && line < lineCount) {
+ line++;
+ col -= evidenceLen;
+ if (col !== 1) {
+ col -= brLen;
+ }
+ }
+ else {
+ break;
+ }
+ }
+ this.messages.push({
+ type: type,
+ message: message,
+ raw: raw,
+ evidence: evidence,
+ line: line,
+ col: col,
+ rule: {
+ id: rule.id,
+ description: rule.description,
+ link: "https://github.com/thedaviddias/HTMLHint/wiki/" + rule.id,
+ },
+ });
+ };
+ return Reporter;
+}());
+exports.default = Reporter;
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVwb3J0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29yZS9yZXBvcnRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0lBT0Usa0JBQW1CLElBQVksRUFBRSxPQUFnQjtRQUMvQyxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQTtRQUNoQixJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDaEMsSUFBTSxLQUFLLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUVoQyxJQUFJLENBQUMsS0FBSyxHQUFHLEtBQUssS0FBSyxJQUFJLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FB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file mode 100644
index 000000000..a1d5df098
--- /dev/null
+++ b/dist/core/rules/alt-require.js
@@ -0,0 +1,26 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'alt-require',
+ description: 'The alt attribute of an element must be present and alt attribute of area[href] and input[type=image] must have a value.',
+ init: function (parser, reporter) {
+ var _this = this;
+ parser.addListener('tagstart', function (event) {
+ var tagName = event.tagName.toLowerCase();
+ var mapAttrs = parser.getMapAttrs(event.attrs);
+ var col = event.col + tagName.length + 1;
+ var selector;
+ if (tagName === 'img' && !('alt' in mapAttrs)) {
+ reporter.warn('An alt attribute must be present on elements.', event.line, col, _this, event.raw);
+ }
+ else if ((tagName === 'area' && 'href' in mapAttrs) ||
+ (tagName === 'input' && mapAttrs['type'] === 'image')) {
+ if (!('alt' in mapAttrs) || mapAttrs['alt'] === '') {
+ selector = tagName === 'area' ? 'area[href]' : 'input[type=image]';
+ reporter.warn("The alt attribute of " + selector + " must have a value.", event.line, col, _this, event.raw);
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWx0LXJlcXVpcmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29yZS9ydWxlcy9hbHQtcmVxdWlyZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBLGtCQUFlO0lBQ2IsRUFBRSxFQUFFLGFBQWE7SUFDakIsV0FBVyxFQUNULGdJQUFnSTtJQUNsSSxJQUFJLFlBQUMsTUFBTSxFQUFFLFFBQVE7UUFBckIsaUJBK0JDO1FBOUJDLE1BQU0sQ0FBQyxXQUFXLENBQUMsVUFBVSxFQUFFLFVBQUMsS0FBSztZQUNuQyxJQUFNLE9BQU8sR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLFdBQVcsRUFBRSxDQUFBO1lBQzNDLElBQU0sUUFBUSxHQUFHLE1BQU0sQ0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lowercase.js b/dist/core/rules/attr-lowercase.js
new file mode 100644
index 000000000..4bd1ca14d
--- /dev/null
+++ b/dist/core/rules/attr-lowercase.js
@@ -0,0 +1,48 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+function testAgainstStringOrRegExp(value, comparison) {
+ if (comparison instanceof RegExp) {
+ return comparison.test(value)
+ ? { match: value, pattern: comparison }
+ : false;
+ }
+ var firstComparisonChar = comparison[0];
+ var lastComparisonChar = comparison[comparison.length - 1];
+ var secondToLastComparisonChar = comparison[comparison.length - 2];
+ var comparisonIsRegex = firstComparisonChar === '/' &&
+ (lastComparisonChar === '/' ||
+ (secondToLastComparisonChar === '/' && lastComparisonChar === 'i'));
+ var hasCaseInsensitiveFlag = comparisonIsRegex && lastComparisonChar === 'i';
+ if (comparisonIsRegex) {
+ var valueMatches = hasCaseInsensitiveFlag
+ ? new RegExp(comparison.slice(1, -2), 'i').test(value)
+ : new RegExp(comparison.slice(1, -1)).test(value);
+ return valueMatches;
+ }
+ return value === comparison;
+}
+exports.default = {
+ id: 'attr-lowercase',
+ description: 'All attribute names must be in lowercase.',
+ init: function (parser, reporter, options) {
+ var _this = this;
+ var exceptions = Array.isArray(options) ? options : [];
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var col = event.col + event.tagName.length + 1;
+ var _loop_1 = function (i, l) {
+ attr = attrs[i];
+ var attrName = attr.name;
+ if (!exceptions.find(function (exp) { return testAgainstStringOrRegExp(attrName, exp); }) &&
+ attrName !== attrName.toLowerCase()) {
+ reporter.error("The attribute name of [ " + attrName + " ] must be in lowercase.", event.line, col + attr.index, _this, attr.raw);
+ }
+ };
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ _loop_1(i, l);
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci1sb3dlcmNhc2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi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FFLEdBQUcsQ0FBQyxFQUF4QyxDQUF3QyxDQUFDO29CQUNuRSxRQUFRLEtBQUssUUFBUSxDQUFDLFdBQVcsRUFBRSxFQUNuQztvQkFDQSxRQUFRLENBQUMsS0FBSyxDQUNaLDZCQUEyQixRQUFRLDZCQUEwQixFQUM3RCxLQUFLLENBQUMsSUFBSSxFQUNWLEdBQUcsR0FBRyxJQUFJLENBQUMsS0FBSyxFQUNoQixLQUFJLEVBQ0osSUFBSSxDQUFDLEdBQUcsQ0FDVCxDQUFBO2lCQUNGOztZQWZILEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxLQUFLLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFO3dCQUFuQyxDQUFDLEVBQU0sQ0FBQzthQWdCaEI7UUFDSCxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDTSxDQUFBIn0=
\ No newline at end of file
diff --git a/dist/core/rules/attr-no-duplication.js b/dist/core/rules/attr-no-duplication.js
new file mode 100644
index 000000000..f50e42fed
--- /dev/null
+++ b/dist/core/rules/attr-no-duplication.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-no-duplication',
+ description: 'Elements cannot have duplicate attributes.',
+ init: function (parser, reporter) {
+ var _this = this;
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var attrName;
+ var col = event.col + event.tagName.length + 1;
+ var mapAttrName = {};
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ attr = attrs[i];
+ attrName = attr.name;
+ if (mapAttrName[attrName] === true) {
+ reporter.error("Duplicate of attribute name [ " + attr.name + " ] was found.", event.line, col + attr.index, _this, attr.raw);
+ }
+ mapAttrName[attrName] = true;
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYX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xHQUFHLElBQUksQ0FBQyxLQUFLLEVBQ2hCLEtBQUksRUFDSixJQUFJLENBQUMsR0FBRyxDQUNULENBQUE7aUJBQ0Y7Z0JBQ0QsV0FBVyxDQUFDLFFBQVEsQ0FBQyxHQUFHLElBQUksQ0FBQTthQUM3QjtRQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNNLENBQUEifQ==
\ No newline at end of file
diff --git a/dist/core/rules/attr-no-unnecessary-whitespace.js b/dist/core/rules/attr-no-unnecessary-whitespace.js
new file mode 100644
index 000000000..4ebaeab5e
--- /dev/null
+++ b/dist/core/rules/attr-no-unnecessary-whitespace.js
@@ -0,0 +1,23 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-no-unnecessary-whitespace',
+ description: 'No spaces between attribute names and values.',
+ init: function (parser, reporter, options) {
+ var _this = this;
+ var exceptions = Array.isArray(options) ? options : [];
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var col = event.col + event.tagName.length + 1;
+ for (var i = 0; i < attrs.length; i++) {
+ if (exceptions.indexOf(attrs[i].name) === -1) {
+ var match = /(\s*)=(\s*)/.exec(attrs[i].raw.trim());
+ if (match && (match[1].length !== 0 || match[2].length !== 0)) {
+ reporter.error("The attribute '" + attrs[i].name + "' must not have spaces between the name and value.", event.line, col + attrs[i].index, _this, attrs[i].raw);
+ }
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci1uby11bm5lY2Vzc2FyeS13aGl0ZXNwYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci1uby11bm5lY2Vzc2FyeS13aGl0ZXNwYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsa0JBQWU7SUFDYixFQUFFLEVBQUUsZ0N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UMsQ0FBQyxDQUFDLElBQUksdURBQW9ELEVBQ25GLEtBQUssQ0FBQyxJQUFJLEVBQ1YsR0FBRyxHQUFHLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQ3BCLEtBQUksRUFDSixLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUNiLENBQUE7cUJBQ0Y7aUJBQ0Y7YUFDRjtRQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNNLENBQUEifQ==
\ No newline at end of file
diff --git a/dist/core/rules/attr-sorted.js b/dist/core/rules/attr-sorted.js
new file mode 100644
index 000000000..8586806e2
--- /dev/null
+++ b/dist/core/rules/attr-sorted.js
@@ -0,0 +1,50 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-sorted',
+ description: 'Attribute tags must be in proper order.',
+ init: function (parser, reporter) {
+ var _this = this;
+ var orderMap = {};
+ var sortOrder = [
+ 'class',
+ 'id',
+ 'name',
+ 'src',
+ 'for',
+ 'type',
+ 'href',
+ 'value',
+ 'title',
+ 'alt',
+ 'role',
+ ];
+ for (var i = 0; i < sortOrder.length; i++) {
+ orderMap[sortOrder[i]] = i;
+ }
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var listOfAttributes = [];
+ for (var i = 0; i < attrs.length; i++) {
+ listOfAttributes.push(attrs[i].name);
+ }
+ var originalAttrs = JSON.stringify(listOfAttributes);
+ listOfAttributes.sort(function (a, b) {
+ if (orderMap[a] == undefined && orderMap[b] == undefined) {
+ return 0;
+ }
+ if (orderMap[a] == undefined) {
+ return 1;
+ }
+ else if (orderMap[b] == undefined) {
+ return -1;
+ }
+ return orderMap[a] - orderMap[b] || a.localeCompare(b);
+ });
+ if (originalAttrs !== JSON.stringify(listOfAttributes)) {
+ reporter.error("Inaccurate order " + originalAttrs + " should be in hierarchy " + JSON.stringify(listOfAttributes) + " ", event.line, event.col, _this, event.raw);
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O1FBQ0gsQ0FBQyxDQUFDLENBQUE7SUFDSixDQUFDO0NBQ00sQ0FBQSJ9
\ No newline at end of file
diff --git a/dist/core/rules/attr-unsafe-chars.js b/dist/core/rules/attr-unsafe-chars.js
new file mode 100644
index 000000000..1b5d1c89b
--- /dev/null
+++ b/dist/core/rules/attr-unsafe-chars.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-unsafe-chars',
+ description: 'Attribute values cannot contain unsafe chars.',
+ init: function (parser, reporter) {
+ var _this = this;
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var col = event.col + event.tagName.length + 1;
+ var regUnsafe = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
+ var match;
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ attr = attrs[i];
+ match = regUnsafe.exec(attr.value);
+ if (match !== null) {
+ var unsafeCode = escape(match[0])
+ .replace(/%u/, '\\u')
+ .replace(/%/, '\\x');
+ reporter.warn("The value of attribute [ " + attr.name + " ] cannot contain an unsafe char [ " + unsafeCode + " ].", event.line, col + attr.index, _this, attr.raw);
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci11bnNhZmUtY2hhcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29yZS9ydWxlcy9hdHRyLXVuc2FmZS1jaGFycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBLGtCQUFlO0lBQ2IsRUFBRSxFQUFFLG1CQUFtQjtJQUN2QixXQUFXLEVBQUUsK0NBQStDO0lBQzVELElBQUksWUFBQyxNQUFNLEVBQUUsUUFBUTtRQUFyQixpQk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YUFDRjtRQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNNLENBQUEifQ==
\ No newline at end of file
diff --git a/dist/core/rules/attr-value-double-quotes.js b/dist/core/rules/attr-value-double-quotes.js
new file mode 100644
index 000000000..9f602b092
--- /dev/null
+++ b/dist/core/rules/attr-value-double-quotes.js
@@ -0,0 +1,22 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-value-double-quotes',
+ description: 'Attribute values must be in double quotes.',
+ init: function (parser, reporter) {
+ var _this = this;
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var col = event.col + event.tagName.length + 1;
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ attr = attrs[i];
+ if ((attr.value !== '' && attr.quote !== '"') ||
+ (attr.value === '' && attr.quote === "'")) {
+ reporter.error("The value of attribute [ " + attr.name + " ] must be in double quotes.", event.line, col + attr.index, _this, attr.raw);
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci12YWx1ZS1kb3VibGUtcXVvdGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci12YWx1ZS1kb3VibGUtcXVvdGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsa0JBQWU7SUFDYixFQUFFLEVBQUUsMEJBQTBCO0lBQzlCLFdBQVcsRUFBRSw0Q0FBNEM7SUFDekQsSUFBSSxZQUFDLE1BQU0sRUFBRSxRQUFRO1FBQXJCLGlCQXVCQztRQXRCQyxNQUFNLENBQUMsV0FBVyxDQUFDLFVBQVUsRUFBRSxVQUFDLEtBQUs7WUFDbkMsSUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQTtZQUN6QixJQUFJLElBQUksQ0FBQTtZQUNSLElBQU0sR0FBRyxHQUFHLEtBQUssQ0FBQyxHQUFHLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFBO1lBRWhELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxLQUFLLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUU7Z0JBQzVDLElBQUksR0FBRyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUE7Z0JBRWYsSUFDRSxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssRUFBRSxJQUFJLElBQUksQ0FBQyxLQUFLLEtBQUssR0FBRyxDQUFDO29CQUN6QyxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssRUFBRSxJQUFJLElBQUksQ0FBQyxLQUFLLEtBQUssR0FBRyxDQUFDLEVBQ3pDO29CQUNBLFFBQVEsQ0FBQyxLQUFLLENBQ1osOEJBQTRCLElBQUksQ0FBQyxJQUFJLGlDQUE4QixFQUNuRSxLQUFLLENBQUMsSUFBSSxFQUNWLEdBQUcsR0FBRyxJQUFJLENBQUMsS0FBSyxFQUNoQixLQUFJLEVBQ0osSUFBSSxDQUFDLEdBQUcsQ0FDVCxDQUFBO2lCQUNGO2FBQ0Y7UUFDSCxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDTSxDQUFBIn0=
\ No newline at end of file
diff --git a/dist/core/rules/attr-value-not-empty.js b/dist/core/rules/attr-value-not-empty.js
new file mode 100644
index 000000000..d4d69596d
--- /dev/null
+++ b/dist/core/rules/attr-value-not-empty.js
@@ -0,0 +1,21 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-value-not-empty',
+ description: 'All attributes must have values.',
+ init: function (parser, reporter) {
+ var _this = this;
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var col = event.col + event.tagName.length + 1;
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ attr = attrs[i];
+ if (attr.quote === '' && attr.value === '') {
+ reporter.warn("The attribute [ " + attr.name + " ] must have a value.", event.line, col + attr.index, _this, attr.raw);
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci12YWx1ZS1ub3QtZW1wdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29yZS9ydWxlcy9hdHRyLXZhbHVlLW5vdC1lbXB0eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBLGtCQUFlO0lBQ2IsRUFBRSxFQUFFLHNCQUFzQjtJQUMxQixXQUFXLEVBQUUsa0NBQWtDO0lBQy9DLElBQUksWUFBQyxNQUFNLEVBQUUsUUFBUTtRQUFyQixpQkFvQkM7UUFuQkMsTUFBTSxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUUsVUFBQyxLQUFLO1lBQ25DLElBQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUE7WUFDekIsSUFBSSxJQUFJLENBQUE7WUFDUixJQUFNLEdBQUcsR0FBRyxLQUFLLENBQUMsR0FBRyxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQTtZQUVoRCxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxDQUFDLE1BQU0sRUFBRSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFO2dCQUM1QyxJQUFJLEdBQUcsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFBO2dCQUVmLElBQUksSUFBSSxDQUFDLEtBQUssS0FBSyxFQUFFLElBQUksSUFBSSxDQUFDLEtBQUssS0FBSyxFQUFFLEVBQUU7b0JBQzFDLFFBQVEsQ0FBQyxJQUFJLENBQ1gscUJBQW1CLElBQUksQ0FBQyxJQUFJLDBCQUF1QixFQUNuRCxLQUFLLENBQUMsSUFBSSxFQUNWLEdBQUcsR0FBRyxJQUFJLENBQUMsS0FBSyxFQUNoQixLQUFJLEVBQ0osSUFBSSxDQUFDLEdBQUcsQ0FDVCxDQUFBO2lCQUNGO2FBQ0Y7UUFDSCxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDTSxDQUFBIn0=
\ No newline at end of file
diff --git a/dist/core/rules/attr-value-single-quotes.js b/dist/core/rules/attr-value-single-quotes.js
new file mode 100644
index 000000000..af20b93a4
--- /dev/null
+++ b/dist/core/rules/attr-value-single-quotes.js
@@ -0,0 +1,22 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-value-single-quotes',
+ description: 'Attribute values must be in single quotes.',
+ init: function (parser, reporter) {
+ var _this = this;
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var col = event.col + event.tagName.length + 1;
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ attr = attrs[i];
+ if ((attr.value !== '' && attr.quote !== "'") ||
+ (attr.value === '' && attr.quote === '"')) {
+ reporter.error("The value of attribute [ " + attr.name + " ] must be in single quotes.", event.line, col + attr.index, _this, attr.raw);
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci12YWx1ZS1zaW5nbGUtcXVvdGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci12YWx1ZS1zaW5nbGUtcXVvdGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsa0JBQWU7SUFDYixFQUFFLEVBQUUsMEJBQTBCO0lBQzlCLFdBQVcsRUFBRSw0Q0FBNEM7SUFDekQsSUFBSSxZQUFDLE1BQU0sRUFBRSxRQUFRO1FBQXJCLGlCQXVCQztRQXRCQyxNQUFNLENBQUMsV0FBVyxDQUFDLFVBQVUsRUFBRSxVQUFDLEtBQUs7WUFDbkMsSUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQTtZQUN6QixJQUFJLElBQUksQ0FBQTtZQUNSLElBQU0sR0FBRyxHQUFHLEtBQUssQ0FBQyxHQUFHLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFBO1lBRWhELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxLQUFLLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUU7Z0JBQzVDLElBQUksR0FBRyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUE7Z0JBRWYsSUFDRSxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssRUFBRSxJQUFJLElBQUksQ0FBQyxLQUFLLEtBQUssR0FBRyxDQUFDO29CQUN6QyxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssRUFBRSxJQUFJLElBQUksQ0FBQyxLQUFLLEtBQUssR0FBRyxDQUFDLEVBQ3pDO29CQUNBLFFBQVEsQ0FBQyxLQUFLLENBQ1osOEJBQTRCLElBQUksQ0FBQyxJQUFJLGlDQUE4QixFQUNuRSxLQUFLLENBQUMsSUFBSSxFQUNWLEdBQUcsR0FBRyxJQUFJLENBQUMsS0FBSyxFQUNoQixLQUFJLEVBQ0osSUFBSSxDQUFDLEdBQUcsQ0FDVCxDQUFBO2lCQUNGO2FBQ0Y7UUFDSCxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDTSxDQUFBIn0=
\ No newline at end of file
diff --git a/dist/core/rules/attr-whitespace.js b/dist/core/rules/attr-whitespace.js
new file mode 100644
index 000000000..272aa487b
--- /dev/null
+++ b/dist/core/rules/attr-whitespace.js
@@ -0,0 +1,31 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'attr-whitespace',
+ description: 'All attributes should be separated by only one space and not have leading/trailing whitespace.',
+ init: function (parser, reporter, options) {
+ var _this = this;
+ var exceptions = Array.isArray(options)
+ ? options
+ : [];
+ parser.addListener('tagstart', function (event) {
+ var attrs = event.attrs;
+ var attr;
+ var col = event.col + event.tagName.length + 1;
+ attrs.forEach(function (elem) {
+ attr = elem;
+ var attrName = elem.name;
+ if (exceptions.indexOf(attrName) !== -1) {
+ return;
+ }
+ if (elem.value.trim() !== elem.value) {
+ reporter.error("The attributes of [ " + attrName + " ] must not have trailing whitespace.", event.line, col + attr.index, _this, attr.raw);
+ }
+ if (elem.value.replace(/ +(?= )/g, '') !== elem.value) {
+ reporter.error("The attributes of [ " + attrName + " ] must be separated by only one space.", event.line, col + attr.index, _this, attr.raw);
+ }
+ });
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci13aGl0ZXNwYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci13aGl0ZXNwYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsa0JBQWU7SUFDYixFQUFFLEVBQUUsaUJBQWlCO0lBQ3JCLFdBQVcsRUFDVCxnR0FBZ0c7SUFDbEcsSUFBSSxFQUFKLFVBQUssTUFBTSxFQUFFLFFBQVEsRUFBRSxPQUFPO1FBQTlCLGlCQXdDQztRQXZDQyxJQUFNLFVBQVUsR0FBNEIsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUM7WUFDaEUsQ0FBQyxDQUFDLE9BQU87WUFDVCxDQUFDLENBQUMsRUFBRSxDQUFBO1FBRU4sTUFBTSxDQUFDLFdBQVcsQ0FBQyxV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RjtZQUNILENBQUMsQ0FBQyxDQUFBO1FBQ0osQ0FBQyxDQUFDLENBQUE7SUFDSixDQUFDO0NBQ00sQ0FBQSJ9
\ No newline at end of file
diff --git a/dist/core/rules/doctype-first.js b/dist/core/rules/doctype-first.js
new file mode 100644
index 000000000..b8966a415
--- /dev/null
+++ b/dist/core/rules/doctype-first.js
@@ -0,0 +1,22 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'doctype-first',
+ description: 'Doctype must be declared first.',
+ init: function (parser, reporter) {
+ var _this = this;
+ var allEvent = function (event) {
+ if (event.type === 'start' ||
+ (event.type === 'text' && /^\s*$/.test(event.raw))) {
+ return;
+ }
+ if ((event.type !== 'comment' && event.long === false) ||
+ /^DOCTYPE\s+/i.test(event.content) === false) {
+ reporter.error('Doctype must be declared first.', event.line, event.col, _this, event.raw);
+ }
+ parser.removeListener('all', allEvent);
+ };
+ parser.addListener('all', allEvent);
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9jdHlwZS1maXJzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb3JlL3J1bGVzL2RvY3R5cGUtZmlyc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFHQSxrQkFBZTtJQUNiLEVBQUUsRUFBRSxlQUFlO0lBQ25CLFdBQVcsRUFBRSxpQ0FBaUM7SUFDOUMsSUFBSSxFQUFKLFVBQUssTUFBTSxFQUFFLFFBQVE7UUFBckIsaUJBMEJDO1FBekJDLElBQU0sUUFBUSxHQUFhLFVBQUMsS0FBSztZQUMvQixJQUNFLEtBQUssQ0FBQyxJQUFJLEtBQUssT0FBTztnQkFDdEIsQ0FBQyxLQUFLLENBQUMsSUFBSSxLQUFLLE1BQU0sSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQyxFQUNsRDtnQkFDQSxPQUFNO2FBQ1A7WUFFRCxJQUNFLENBQUMsS0FBSyxDQUFDLElBQUksS0FBSyxTQUFTLElBQUksS0FBSyxDQUFDLElBQUksS0FBSyxLQUFLLENBQUM7Z0JBQ2xELGNBQWMsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEtBQUssRUFDNUM7Z0JBQ0EsUUFBUSxDQUFDLEtBQUssQ0FDWixpQ0FBaUMsRUFDakMsS0FBSyxDQUFDLElBQUksRUFDVixLQUFLLENBQUMsR0FBRyxFQUNULEtBQUksRUFDSixLQUFLLENBQUMsR0FBRyxDQUNWLENBQUE7YUFDRjtZQUVELE1BQU0sQ0FBQyxjQUFjLENBQUMsS0FBSyxFQUFFLFFBQVEsQ0FBQyxDQUFBO1FBQ3hDLENBQUMsQ0FBQTtRQUVELE1BQU0sQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLFFBQVEsQ0FBQyxDQUFBO0lBQ3JDLENBQUM7Q0FDTSxDQUFBIn0=
\ No newline at end of file
diff --git a/dist/core/rules/doctype-html5.js b/dist/core/rules/doctype-html5.js
new file mode 100644
index 000000000..a48544ce7
--- /dev/null
+++ b/dist/core/rules/doctype-html5.js
@@ -0,0 +1,22 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'doctype-html5',
+ description: 'Invalid doctype. Use: ""',
+ init: function (parser, reporter) {
+ var _this = this;
+ var onComment = function (event) {
+ if (event.long === false &&
+ event.content.toLowerCase() !== 'doctype html') {
+ reporter.warn('Invalid doctype. Use: ""', event.line, event.col, _this, event.raw);
+ }
+ };
+ var onTagStart = function () {
+ parser.removeListener('comment', onComment);
+ parser.removeListener('tagstart', onTagStart);
+ };
+ parser.addListener('all', onComment);
+ parser.addListener('tagstart', onTagStart);
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9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.js
new file mode 100644
index 000000000..c849c2dee
--- /dev/null
+++ b/dist/core/rules/empty-tag-not-self-closed.js
@@ -0,0 +1,19 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'empty-tag-not-self-closed',
+ description: 'Empty tags must not use self closed syntax.',
+ init: function (parser, reporter) {
+ var _this = this;
+ var mapEmptyTags = parser.makeMap('area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr');
+ parser.addListener('tagstart', function (event) {
+ var tagName = event.tagName.toLowerCase();
+ if (mapEmptyTags[tagName] !== undefined) {
+ if (event.close) {
+ reporter.error("The empty tag : [ " + tagName + " ] must not use self closed syntax.", event.line, event.col, _this, event.raw);
+ }
+ }
+ });
+ },
+};
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1wdHktdGFnLW5vdC1zZWxmLWNsb3NlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb3JlL3J1bGVzL2VtcHR5LXRhZy1ub3Qtc2VsZi1jbG9zZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSxrQkFBZTtJQUNiLEVBQUUsRUFBRSwyQkFBMkI7SUFDL0IsV0FBVyxFQUFFLDZDQUE2QztJQUMxRCxJQUFJLFlBQUMsTUFBTSxFQUFFLFFBQVE7UUFBckIsaUJBbUJDO1FBbEJDLElBQU0sWUFBWSxHQUFHLE1BQU0sQ0FBQyxPQUFPLENBQ2pDLG9IQUFvSCxDQUNySCxDQUFBO1FBRUQsTUFBTSxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUUsVUFBQyxLQUFLO1lBQ25DLElBQU0sT0FBTyxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUE7WUFDM0MsSUFBSSxZQUFZLENBQUMsT0FBTyxDQUFDLEtBQUssU0FBUyxFQUFFO2dCQUN2QyxJQUFJLEtBQUssQ0FBQyxLQUFLLEVBQUU7b0JBQ2YsUUFBUSxDQUFDLEtBQUssQ0FDWix1QkFBcUIsT0FBTyx3Q0FBcUMsRUFDakUsS0FBSyxDQUFDLElBQUksRUFDVixLQUFLLENBQUMsR0FBRyxFQUNULEtBQUksRUFDSixLQUFLLENBQUMsR0FBRyxDQUNWLENBQUE7aUJBQ0Y7YUFDRjtRQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNNLENBQUEifQ==
\ No newline at end of file
diff --git a/dist/core/rules/head-script-disabled.js b/dist/core/rules/head-script-disabled.js
new file mode 100644
index 000000000..821e6362b
--- /dev/null
+++ b/dist/core/rules/head-script-disabled.js
@@ -0,0 +1,33 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = {
+ id: 'head-script-disabled',
+ description: 'The