Exemplo n.º 1
0
function run(err, str) {
    if (err) {
        bbresults.notify('error, reading ' + pathname, {title: title});

    } else if (lint(str, getOptions(path.dirname(pathname)))) {
        bbresults.notify(pathname + ' is lint free', {title: title});

    } else {
        bbresults.show(lint.errors, pathname, title);
    }
}
Exemplo n.º 2
0
function run(err, str) {
    var title = 'JSLint results',
        results;

    if (err) {
        bbresults.notify('error, reading ' + pathname, {title: title});
    } else {
        results = lint(str);
        if (results.ok) {
            bbresults.notify(pathname + ' is lint free', {title: title});
        } else {
            bbresults.show(results.errors, pathname, title);
        }
    }
}
Exemplo n.º 3
0
        opts = require('./jshint-flags');
    }

    if (fs.existsSync(candidate = path.join(dir, '.jshintrc'))) {
        opts = JSON.parse(stripJsonComments(fs.readFileSync(candidate, "utf8")));
    }

    return opts || getOptions(path.join(dir, '..'));
}

function run(err, str) {
    if (err) {
        bbresults.notify('error, reading ' + pathname, {title: title});

    } else if (lint(str, getOptions(path.dirname(pathname)))) {
        bbresults.notify(pathname + ' is lint free', {title: title});

    } else {
        bbresults.show(lint.errors, pathname, title);
    }
}

if (require.main === module) {
    if (undefined === pathname) {
        bbresults.notify('please save the document and try again', {title: title});

    } else {
        fs.readFile(pathname, 'utf-8', run);
    }
}