Permalink
Browse files

Merge pull request #457 from scottgonzalez/jsonrc

Support JSON for .csslintrc files.
  • Loading branch information...
2 parents a0bce62 + f0b4097 commit f2abc8bfa5fbe14a528197d597d135fb288325b9 @stubbornella stubbornella committed Feb 27, 2014
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/cli/common.js
View
14 src/cli/common.js
@@ -292,8 +292,20 @@ function cli(api){
}
function readConfigFile(options) {
- var data = api.readFile(api.getFullPath(".csslintrc"));
+ var data = api.readFile(api.getFullPath(".csslintrc")),
+ json;
if (data) {
+ if (data.charAt(0) === "{") {
+ try {
+ json = JSON.parse(data);
+ data = "";
+ for (var optionName in json) {
+ if (json.hasOwnProperty(optionName)) {
+ data += "--" + optionName + "=" + json[optionName].join();
+ }
+ }
+ } catch(e) {}
+ }
options = processArguments(data.split(/[\s\n\r]+/m), options);
}

0 comments on commit f2abc8b

Please sign in to comment.