UNPKG

exlint

Version:

self-contained eslint profile

20 lines (14 loc) 600 B
var fs = require('fs') var path = require('path') var spawn = require('child_process').spawn var eslintPath = './node_modules/.bin/eslint' var eslintLocal = path.resolve(__dirname, eslintPath) var eslintRemote = path.resolve(process.cwd(), eslintPath) var eslint = fs.existsSync(eslintLocal) ? eslintLocal : eslintRemote if (!fs.existsSync(eslint)) { throw new Error('could not find eslint!') } var rules = path.resolve(__dirname, 'rules.js') var arguments = ['-c', rules].concat(process.argv.slice(2)) var child = spawn(eslint, arguments, { stdio: 'inherit' }) child.on('exit', process.exit)