From 3f73d7521db5053c2a4d1017dc40a7f56c8b553d Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Mon, 16 Nov 2015 13:18:56 -0800 Subject: [PATCH 1/2] Remove broken scopes Removes a bunch of scopes that this linter doesn't properly handle. --- lib/init.coffee | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/init.coffee b/lib/init.coffee index ac633e2..64841c3 100644 --- a/lib/init.coffee +++ b/lib/init.coffee @@ -9,14 +9,10 @@ module.exports = type: 'string' description: 'HTMLHint Executable Path' activate: -> - console.log 'activate linter-htmlhint' - # console.log 'config', @config - # console.log 'dirname', __dirname - @subscriptions = new CompositeDisposable - @subscriptions.add atom.config.observe 'linter-htmlhint.executablePath', - (executablePath) => - @executablePath = executablePath - @scopes = ['text.html.angular', 'text.html.basic', 'text.html.erb', 'text.html.gohtml', 'text.html.jsp', 'text.html.mustache', 'text.html.handlebars', 'text.html.ruby'] + @subscriptions = new CompositeDisposable + @subscriptions.add atom.config.observe 'linter-htmlhint.executablePath', + (executablePath) => + @executablePath = executablePath deactivate: -> @subscriptions.dispose() @@ -24,7 +20,7 @@ module.exports = provideLinter: -> helpers = require('atom-linter') provider = - grammarScopes: @scopes + grammarScopes: ['text.html.basic'] scope: 'file' lintOnFly: true lint: (textEditor) -> @@ -36,7 +32,7 @@ module.exports = if htmlhintrc and '-c' not in parameters parameters = parameters.concat ['-c', htmlhintrc] - return helpers.execNode(atom.config.get('linter-htmlhint.executablePath'), parameters, {}).then (output) -> + return helpers.execNode(@executablePath, parameters, {}).then (output) -> # console.log('output', output) linterResults = JSON.parse output return [] unless linterResults.length From 123f4f859b2d4643b51f32606f76335f1d377f57 Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Tue, 17 Nov 2015 10:39:41 -0800 Subject: [PATCH 2/2] Add back Mustache and Angular Although Angular is invalid HTML, `htmlhint` isn't currently smart enough to see this so it should be okay for now. Mustache also looks like it might be "valid" according to `htmlhint`, at least for now. --- lib/init.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.coffee b/lib/init.coffee index 64841c3..4cfc273 100644 --- a/lib/init.coffee +++ b/lib/init.coffee @@ -20,7 +20,7 @@ module.exports = provideLinter: -> helpers = require('atom-linter') provider = - grammarScopes: ['text.html.basic'] + grammarScopes: ['text.html.basic', 'text.html.angular', 'text.html.mustache'] scope: 'file' lintOnFly: true lint: (textEditor) ->