'use strict'; var eslintPluginUtils = require('eslint-plugin-utils'); var htmlhint = require('htmlhint'); var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); const base = { parser: "eslint-plugin-htm", plugins: ["htm", "utils"], processor: "utils/jsonMessage" }; const recommended = __spreadProps(__spreadValues({}, base), { rules: { "htm/html": 1 } }); var configs = /*#__PURE__*/Object.freeze({ __proto__: null, base: base, recommended: recommended }); const parseForESLint = (text, _options) => { const lines = text.split("\n"); return { ast: { type: "Program", sourceType: "module", comments: [], tokens: [], body: [], range: [0, text.length], loc: { start: { line: 1, column: 0 }, end: { line: lines.length, column: lines[lines.length - 1].length } } } }; }; const parse = (text, options) => parseForESLint(text).ast; const html = { meta: { type: "problem" }, create(context) { const sourceCode = context.getSourceCode().text; return { Program() { const results = htmlhint.HTMLHint.verify(sourceCode); for (const { evidence, message, line, col, rule } of results) { context.report({ message: JSON.stringify({ evidence, message, rule }), loc: { line, // ! eslint ast column is 0-indexed, but htmlhint is 1-indexed column: col - 1 } }); } } }; } }; var index = /*#__PURE__*/Object.freeze({ __proto__: null, html: html }); eslintPluginUtils.registerJsonMessageHandler("htm/html", ({ evidence, rule, message }) => { var _a; return { ruleId: `htm/${rule.id}`, message: `${message} evidence: ${evidence} reference: ${// istanbul ignore next (_a = rule.link) != null ? _a : "-"}` }; }); exports.configs = configs; exports.parse = parse; exports.parseForESLint = parseForESLint; exports.rules = index;