Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HTMLHint from being require()'d and instead use window global like other linters #4962

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions addon/lint/html-lint.js
Expand Up @@ -7,12 +7,12 @@

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("htmlhint"));
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "htmlhint"], mod);
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror, window.HTMLHint);
})(function(CodeMirror, HTMLHint) {
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";

var defaultRules = {
Expand All @@ -29,11 +29,11 @@

CodeMirror.registerHelper("lint", "html", function(text, options) {
var found = [];
var HTMLHint = window.HTMLHint;
if (HTMLHint && !HTMLHint.verify) HTMLHint = HTMLHint.HTMLHint;
if (!HTMLHint) HTMLHint = window.HTMLHint;
if (!HTMLHint) {
if (window.console) {
window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
window.console.error("Error: window.HTMLHint not defined, CodeMirror HTML linting cannot run.");
}
return found;
}
Expand Down