Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8 from AtomLinter/revert-7-revert-6-htmlhintrc_cu…
Browse files Browse the repository at this point in the history
…stomizable_path

Revert "Revert "Allow customizable path and filename for .htmlhintrc""
  • Loading branch information
hd-deman committed Mar 24, 2015
2 parents 596d852 + 18e6f50 commit 083d739
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ You can configure linter-htmlhint by editing ~/.atom/config.cson (choose Open Yo
```
'linter-htmlhint':
'htmlhintExecutablePath': null #htmlhint path. run 'which htmlhint' to find the path
'htmlHintRcFilePath': #OPTIONAL custom path to the htmlhintrc file (which can be used to customize rulesets that are run against the HTML)
'htmlHintRcFileName': #OPTIONAL filename of the htmlhintrc file (defaults to '.htmlhintrc', but can be overridden)
```

## Contributing
Expand Down
16 changes: 12 additions & 4 deletions lib/linter-htmlhint.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,23 @@ class LinterHtmlhint extends Linter

isNodeExecutable: yes

constructor: (editor) ->
super(editor)

config = findFile @cwd, ['.htmlhintrc']
# update the ruleset anytime the watched htmlhintrc file changes
setupHtmlHintRc: =>
htmlHintRcPath = atom.config.get 'linter.linter-htmlhint.htmlhintRcFilePath'
fileName = atom.config.get('linter.linter-htmlhint.htmlhintRcFileName') || '.htmlhintrc'
config = findFile htmlHintRcPath, [fileName]
if config
@cmd = @cmd.concat ['-c', config]


constructor: (editor) ->
super(editor)
atom.config.observe 'linter-htmlhint.htmlhintExecutablePath', @formatShellCmd

# reload if path or file name changed of the htmlhintrc file
atom.config.observe 'linter-htmlhint.htmlHintRcFilePath', @setupHtmlHintRc
atom.config.observe 'linter-htmlhint.htmlHintRcFileName', @setupHtmlHintRc

formatShellCmd: =>
htmlhintExecutablePath = atom.config.get 'linter-htmlhint.htmlhintExecutablePath'
@executablePath = "#{htmlhintExecutablePath}"
Expand Down

0 comments on commit 083d739

Please sign in to comment.