Skip to content

Commit

Permalink
New: Adds new info flag (fixes #11958)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Aug 4, 2019
1 parent f5e0cc4 commit 8a7428d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/cli.js
Expand Up @@ -18,6 +18,7 @@
const fs = require("fs"),
path = require("path"),
mkdirp = require("mkdirp"),
envinfo = require("envinfo"),
{ CLIEngine } = require("./cli-engine"),
options = require("./options"),
log = require("./shared/logging");
Expand Down Expand Up @@ -67,7 +68,8 @@ function translateOptions(cliOptions) {
fixTypes: cliOptions.fixType,
allowInlineConfig: cliOptions.inlineConfig,
reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives,
resolvePluginsRelativeTo: cliOptions.resolvePluginsRelativeTo
resolvePluginsRelativeTo: cliOptions.resolvePluginsRelativeTo,
info: cliOptions.info
};
}

Expand Down Expand Up @@ -165,7 +167,6 @@ const cli = {
if (currentOptions.version) { // version from package.json

log.info(`v${require("../package.json").version}`);

} else if (currentOptions.printConfig) {
if (files.length) {
log.error("The --print-config option must be used with exactly one file name.");
Expand All @@ -182,6 +183,16 @@ const cli = {

log.info(JSON.stringify(fileConfig, null, " "));
return 0;
} else if (currentOptions.info) {
log.info("\n Environment Information:-");
envinfo
.run({
System: ["OS", "CPU"],
Binaries: ["Node", "Yarn", "npm"],
Browsers: ["Chrome", "Edge", "Firefox", "Safari"],
npmGlobalPackages: ["eslint"]
})
.then(log.info);
} else if (currentOptions.help || (!files.length && !useStdin)) {

log.info(options.generateHelp());
Expand Down
6 changes: 6 additions & 0 deletions lib/options.js
Expand Up @@ -246,6 +246,12 @@ module.exports = optionator({
option: "print-config",
type: "path::String",
description: "Print the configuration for the given file"
},
{
option: "info",
alias: "i",
type: "Boolean",
description: "Print debugging information concerning the local environmet"
}
]
});
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -49,6 +49,7 @@
"cross-spawn": "^6.0.5",
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"envinfo": "^7.3.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^1.3.1",
"eslint-visitor-keys": "^1.0.0",
Expand Down

0 comments on commit 8a7428d

Please sign in to comment.