all files / src/eslint/ cli.js

58.82% Statements 10/17
10% Branches 1/10
0% Functions 0/1
58.82% Lines 10/17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                               
'use strict';
var child = require('child_process');
var path = require('path');
var os = require('os');
 
var logger = require('../log')('eslint-cli');
logger.debug('Loaded');
 
var cmd = os.platform() === 'win32' ? '.cmd' : '';
var eslint = path.resolve('./node_modules/.bin/eslint' + cmd);
logger.debug('EsLint path: %s', eslint);
var spawn = child.spawn;
 
module.exports = function(args, options, childOptions){
  if(!options){
    options = { _: './' };
  }
  if(options._ && options._.length === 0){
    options._ = './';
  }
 
  childOptions = childOptions ? childOptions : { stdio: 'inherit' };
  logger.debug('Linting: %o', options._);
  return spawn(eslint, args, childOptions);
};