Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Jadelint now walks up the tree
Browse files Browse the repository at this point in the history
  • Loading branch information
rrdelaney committed Sep 8, 2015
1 parent 838e574 commit b928016
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 1 addition & 7 deletions bin/jadelint
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ var filenames = process.argv
}
});

try {
var jadelintrc = JSON.parse(fs.readFileSync(process.cwd() + '/.jadelintrc'));
} catch (e) {
var jadelintrc = {};
}

vinyl.src(filenames)
.pipe(jadelint(jadelintrc, undefined, function(reporter) {
.pipe(jadelint(undefined, undefined, function(reporter) {
var exitCode = reporter.report();
console.log(reporter.log);
if (exitCode !== 0) {
Expand Down
17 changes: 13 additions & 4 deletions src/jadelint.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ rules = require './rules'
# exitCode = reporter.report()
# console.log reporter.log
jadelint = (conf, reporter = new Reporter, callback = ->) ->
dir = process.cwd()
conf ?= try require "#{dir}/.jadelintrc"
conf ?= (try require "#{dir}/.jadelintrc") while (dir += '/..'; '/' isnt fs.realpathSync dir)
conf ?= {}
getDefaultConf = () ->
def = {}
dir = process.cwd()
while '/' isnt fs.realpathSync dir
try
for prop, val of JSON.parse fs.readFileSync "#{dir}/.jadelintrc"
def[prop] ?= val

dir += '/..'

def

conf ?= getDefaultConf()

through2.obj (file, _, cb) ->
linter = new Linter file, undefined, conf
Expand Down

0 comments on commit b928016

Please sign in to comment.