From 2add03c7efbbb1c685e7da0c4c3733778c6f35d9 Mon Sep 17 00:00:00 2001
From: Jeff Hanke <geophree@tesglobal.com>
Date: Wed, 9 Aug 2017 04:13:27 -0700
Subject: [PATCH] [html-line addon] Play more nicely with node/webpack.

* Pass in and use the htmlhint module required.
* Check for verify() and try HTMLHint.HTMLHint if missing because of
  module nesting. it's require('htmlhint').HTMLHint in node.
---
 addon/lint/html-lint.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/addon/lint/html-lint.js b/addon/lint/html-lint.js
index 98c36b0b..23de9bb2 100644
--- a/addon/lint/html-lint.js
+++ b/addon/lint/html-lint.js
@@ -11,8 +11,8 @@
   else if (typeof define == "function" && define.amd) // AMD
     define(["../../lib/codemirror", "htmlhint"], mod);
   else // Plain browser env
-    mod(CodeMirror);
-})(function(CodeMirror) {
+    mod(CodeMirror, window.HTMLHint);
+})(function(CodeMirror, HTMLHint) {
   "use strict";
 
   var defaultRules = {
@@ -29,9 +29,11 @@
 
   CodeMirror.registerHelper("lint", "html", function(text, options) {
     var found = [];
-    if (!window.HTMLHint) {
+    if (HTMLHint && !HTMLHint.verify) HTMLHint = HTMLHint.HTMLHint;
+    if (!HTMLHint) HTMLHint = window.HTMLHint;
+    if (!HTMLHint) {
       if (window.console) {
-          window.console.error("Error: window.HTMLHint not defined, CodeMirror HTML linting cannot run.");
+          window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
       }
       return found;
     }
-- 
GitLab