Skip to content

Commit f2abc8b

Browse files
committed
Merge pull request #457 from scottgonzalez/jsonrc
Support JSON for .csslintrc files.
2 parents a0bce62 + f0b4097 commit f2abc8b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/cli/common.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,20 @@ function cli(api){
292292
}
293293

294294
function readConfigFile(options) {
295-
var data = api.readFile(api.getFullPath(".csslintrc"));
295+
var data = api.readFile(api.getFullPath(".csslintrc")),
296+
json;
296297
if (data) {
298+
if (data.charAt(0) === "{") {
299+
try {
300+
json = JSON.parse(data);
301+
data = "";
302+
for (var optionName in json) {
303+
if (json.hasOwnProperty(optionName)) {
304+
data += "--" + optionName + "=" + json[optionName].join();
305+
}
306+
}
307+
} catch(e) {}
308+
}
297309
options = processArguments(data.split(/[\s\n\r]+/m), options);
298310
}
299311

0 commit comments

Comments
 (0)