Skip to content

Commit

Permalink
Generate correct help
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni committed Feb 10, 2021
1 parent 058d662 commit bc46363
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion bin/eslint_d.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ if (cmd === '-v' || cmd === '--version') {
}

if (cmd === '-h' || cmd === '--help') {
const options = require('../lib/options-cliengine');
const eslint_path = require('../lib/eslint-path');
const eslint = require(eslint_path.resolve(process.cwd()));
const options = eslint.ESLint
? require('../lib/options-eslint')
: require('../lib/options-cliengine');
console.log(options.generateHelp());
return;
}
Expand Down
9 changes: 5 additions & 4 deletions lib/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,10 @@ exports.invoke = async function (cwd, args, text, mtime, callback) {
}
cache.last_run = Date.now();

const opts = cache.eslint.ESLint
? options_eslint.parse([0, 0].concat(args))
: options_cliengine.parse([0, 0].concat(args));
const options = cache.eslint.ESLint
? options_eslint
: options_cliengine;
const opts = options.parse([0, 0].concat(args));
cache.chalk.enabled = opts.color;
if (opts.color === false) {
cache.chalk.level = 0;
Expand All @@ -300,7 +301,7 @@ exports.invoke = async function (cwd, args, text, mtime, callback) {
const files = opts._;
const stdin = opts.stdin;
if (!files.length && (!stdin || typeof text !== 'string')) {
callback(null, `${options_cliengine.generateHelp()}\n`);
callback(null, `${options.generateHelp()}\n`);
return;
}

Expand Down

0 comments on commit bc46363

Please sign in to comment.