From 5fac5dcc57557c3514a86cefa37a6d3f059549f6 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Tue, 13 Jun 2023 17:28:21 +0900 Subject: [PATCH] Fix `--print-config` description in CLI help (#6914) The `--print-config` option never requires an argument. For example: ```console $ bin/stylelint.js --print-config -c scripts/visual-config.json scripts/visual.css { "rules": { ... ``` On the other hand, the following example is mistaken: ```console $ bin/stylelint.js --print-config scripts/visual-config.json Error: No configuration provided for /Users/masafumi.koba/git/stylelint/stylelint/scripts/visual-config.json ... ``` --- .changeset/sixty-masks-sip.md | 5 +++++ docs/user-guide/cli.md | 10 +++++++++- lib/__tests__/__snapshots__/cli.test.js.snap | 4 ++-- lib/cli.js | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .changeset/sixty-masks-sip.md diff --git a/.changeset/sixty-masks-sip.md b/.changeset/sixty-masks-sip.md new file mode 100644 index 0000000000..cd91045078 --- /dev/null +++ b/.changeset/sixty-masks-sip.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `--print-config` description in CLI help diff --git a/docs/user-guide/cli.md b/docs/user-guide/cli.md index 7cd2505c75..3737967cac 100644 --- a/docs/user-guide/cli.md +++ b/docs/user-guide/cli.md @@ -94,7 +94,7 @@ Path of file to write a report. Stylelint outputs the report to the specified `f ### `--print-config` -Print the configuration for the given path. Stylelint outputs the configuration used for the file passed. +Print the configuration for the given input path. Globs are unsupported. ### `--quiet, -q` @@ -206,6 +206,14 @@ Ensure output on successful runs: stylelint -f verbose "foo/**/*.css" ``` +### Example J - print a config + +Print a configuration used for the given input file: + +```shell +stylelint test.css --print-config +``` + ## Exit codes The CLI can exit the process with the following exit codes: diff --git a/lib/__tests__/__snapshots__/cli.test.js.snap b/lib/__tests__/__snapshots__/cli.test.js.snap index 3f7fdf2bef..1adb789f39 100644 --- a/lib/__tests__/__snapshots__/cli.test.js.snap +++ b/lib/__tests__/__snapshots__/cli.test.js.snap @@ -35,9 +35,9 @@ exports[`CLI --help 1`] = ` "plugins", and "customSyntax" are *relative to*. Only necessary if these values are relative paths. - --print-config + --print-config - Print the configuration for the given path. + Print the configuration for the given input file path. Globs are unsupported. --ignore-path, -i diff --git a/lib/cli.js b/lib/cli.js index 222a20d17d..e35343f23d 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -126,9 +126,9 @@ const meowOptions = { "plugins", and "customSyntax" are *relative to*. Only necessary if these values are relative paths. - --print-config + --print-config - Print the configuration for the given path. + Print the configuration for the given input file path. Globs are unsupported. --ignore-path, -i