Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions lib/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ 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()

provideLinter: ->
helpers = require('atom-linter')
provider =
grammarScopes: @scopes
grammarScopes: ['text.html.basic', 'text.html.angular', 'text.html.mustache']
scope: 'file'
lintOnFly: true
lint: (textEditor) ->
Expand All @@ -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
Expand Down