Skip to content

Commit

Permalink
Fix --print-config description in CLI help (#6914)
Browse files Browse the repository at this point in the history
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
...
```
  • Loading branch information
ybiquitous authored Jun 13, 2023
1 parent cbc0b6e commit 5fac5dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-masks-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `--print-config` description in CLI help
10 changes: 9 additions & 1 deletion docs/user-guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions lib/__tests__/__snapshots__/cli.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ exports[`CLI --help 1`] = `
"plugins", and "customSyntax" are *relative to*. Only necessary if these
values are relative paths.
--print-config <path>
--print-config
Print the configuration for the given path.
Print the configuration for the given input file path. Globs are unsupported.
--ignore-path, -i <path>
Expand Down
4 changes: 2 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ const meowOptions = {
"plugins", and "customSyntax" are *relative to*. Only necessary if these
values are relative paths.
--print-config <path>
--print-config
Print the configuration for the given path.
Print the configuration for the given input file path. Globs are unsupported.
--ignore-path, -i <path>
Expand Down

0 comments on commit 5fac5dc

Please sign in to comment.