This repository was archived by the owner on Sep 5, 2022. It is now read-only.
File tree 8 files changed +91
-123
lines changed
8 files changed +91
-123
lines changed Original file line number Diff line number Diff line change
1
+ " atom-text-editor[data-grammar='text html basic']" :
2
+ " ctrl-alt-l" : " htmlhint:hint"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ path = require (" path" )
2
+ fs = require (" fs" )
3
+
4
+ module .exports = ->
5
+ defaultConfigPath = path .normalize (path .join (process .env .HOME or process .env .HOMEPATH , " .htmlhintrc" ))
6
+ projectConfigPath = path .normalize (path .join (atom .project .getPath (), " .htmlhintrc" ))
7
+ config = {}
8
+
9
+ try
10
+ config = JSON .parse (fs .readFileSync (defaultConfigPath, " utf-8" ))
11
+ catch err
12
+ console .log " Error reading config file \" " + defaultConfigPath + " \" : " + err if defaultConfigPath and err .code isnt " ENOENT"
13
+ try
14
+ config = JSON .parse (fs .readFileSync (projectConfigPath, " utf-8" ))
15
+ catch err
16
+ console .log " Error reading config file \" " + projectConfigPath + " \" : " + err if projectConfigPath and err .code isnt " ENOENT"
17
+
18
+ return config
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ {MessagePanelView , PlainMessageView , LineMessageView } = require " atom-message-panel"
2
+ config = require (" ./config" )
3
+ htmlHint = require (" htmlhint" ).HTMLHint
4
+ messages = new MessagePanelView
5
+ title : " <span class=\" icon-bug\" ></span> HTMLHint report"
6
+ rawTitle : true
7
+ closeMethod : " destroy"
8
+
9
+ module .exports = ->
10
+ editor = atom .workspace .getActiveTextEditor ()
11
+
12
+ return unless editor
13
+ return unless editor .getGrammar ().name is " HTML"
14
+
15
+ content = editor .getText ()
16
+ result = htmlHint .verify content, config ()
17
+
18
+ messages .clear ()
19
+ messages .attach ()
20
+
21
+ if atom .config .get (" htmlhint.useFoldModeAsDefault" ) and messages .summary .css (" display" ) is " none"
22
+ messages .toggle ()
23
+
24
+ if result .length is 0
25
+ atom .config .observe " htmlhint.hideOnNoErrors" , (value ) ->
26
+ if value is true
27
+ messages .close ()
28
+ else
29
+ messages .add new PlainMessageView
30
+ message : " No errors were found!"
31
+ className : " text-success"
32
+ else
33
+ for error in result
34
+ continue if ! error
35
+
36
+ messages .add new LineMessageView
37
+ message : error .message
38
+ line : error .line
39
+ character : error .col
40
+ preview : error .evidence .trim () if error .evidence
41
+ className : " text-#{ error .type } "
42
+
43
+ atom .workspace .onDidChangeActivePaneItem ->
44
+ messages .close ()
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ linter = require " ./linter"
2
+ module .exports =
3
+ configDefaults :
4
+ validateOnSave : true
5
+ validateOnChange : false
6
+ hideOnNoErrors : false
7
+ useFoldModeAsDefault : false
8
+
9
+ activate : ->
10
+ editor = atom .workspace .getActiveTextEditor ()
11
+
12
+ atom .commands .add " atom-workspace" , " htmlhint:hint" , linter
13
+ atom .config .observe " htmlhint.validateOnSave" , (value ) ->
14
+ if value is true
15
+ editor .buffer .on " saved" , linter
16
+ else
17
+ editor .buffer .off " saved" , linter
18
+
19
+ atom .config .observe " htmlhint.validateOnChange" , (value ) ->
20
+ if value is true
21
+ editor .buffer .on " contents-modified" , linter
22
+ else
23
+ editor .buffer .off " contents-modified" , linter
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " htmlhint" ,
3
- "main" : " ./lib/init " ,
3
+ "main" : " ./lib/main " ,
4
4
"version" : " 0.4.0" ,
5
5
"private" : true ,
6
6
"description" : " HTMLHint reports for your Atom editor" ,
7
7
"repository" : " https://github.com/tcarlsen/atom-htmlhint" ,
8
8
"author" : " tcarlsen" ,
9
9
"license" : " MIT" ,
10
10
"engines" : {
11
- "atom" : " >0.50 .0"
11
+ "atom" : " >0.174 .0"
12
12
},
13
13
"dependencies" : {
14
- "htmlhint" : " ^0.9.3" ,
15
- "atom-message-panel" : " ^0.3.0" ,
16
- "atom-keymap-plus" : " ^0.1.0"
14
+ "htmlhint" : " ^0.9.6" ,
15
+ "atom-message-panel" : " ^1.1.4"
17
16
}
18
17
}
You can’t perform that action at this time.
0 commit comments