Skip to content

Commit

Permalink
Allow comments in json
Browse files Browse the repository at this point in the history
  • Loading branch information
yaniswang committed Oct 6, 2015
1 parent ed33566 commit 921a842
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 8 additions & 6 deletions bin/htmlhint
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env node

var program = require('commander'),
fs = require('fs'),
path = require('path'),
HTMLHint = require("../index").HTMLHint,
pkg = require('../package.json');
var program = require('commander');
var fs = require('fs');
var path = require('path');
var stripJsonComments = require('strip-json-comments');

var HTMLHint = require("../index").HTMLHint;
var pkg = require('../package.json');

require('colors');

Expand Down Expand Up @@ -71,7 +73,7 @@ function getConfig(configFile){
var config = fs.readFileSync(configFile, 'utf-8'),
ruleset;
try{
ruleset = JSON.parse(config);
ruleset = JSON.parse(stripJsonComments(config));
}
catch(e){}
return ruleset;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"description": "A Static Code Analysis Tool for HTML",
"main": "./index",
"dependencies": {
"commander": "2.6.0",
"colors": "1.0.3",
"commander": "2.6.0",
"csslint": "0.10.0",
"jshint": "2.8.0",
"csslint": "0.10.0"
"strip-json-comments": "1.0.4"
},
"devDependencies": {
"expect.js": "0.2.0",
Expand Down

0 comments on commit 921a842

Please sign in to comment.