Skip to content

Commit 8fc8b93

Browse files
committed
docs: extend prettier config docs
1 parent 4ab68b6 commit 8fc8b93

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Runs spotless
134134
Available formatting steps:
135135
license-header Runs license header
136136
google-java-format Runs google java format
137-
prettier Runs prettier
137+
prettier Runs prettier, the opinionated code formatter.
138138
```
139139

140140
<!---freshmark /usage_main -->
@@ -284,23 +284,27 @@ Usage: spotless prettier [-hV] [-C=<cacheDir>] [-n=<explicitNpmExecutable>]
284284
[-N=<explicitNodeExecutable>]
285285
[-P=<prettierConfigPath>] [-R=<explicitNpmrcFile>]
286286
[-A=<additionalNpmrcLocations>]...
287-
[-c=<String=String>]... [-D=<String=String>]...
288-
Runs prettier
287+
[-c='OPTION=VALUE']... [-D='PACKAGE=VERSION']...
288+
Runs prettier, the opinionated code formatter.
289289
-A, --additional-npmrc-location=<additionalNpmrcLocations>
290290
Additional locations to search for .npmrc files.
291-
-c, --prettier-config-option=<String=String>
292-
The Prettier configuration options.
291+
-c, --prettier-config-option='OPTION=VALUE'
292+
A prettier configuration options.
293+
The format is 'OPTION=VALUE'.
294+
example: 'printWidth=80'
293295
-C, --cache-dir=<cacheDir>
294-
The directory to use for caching Prettier.
295-
-D, --dev-dependency=<String=String>
296-
The devDependencies to use for Prettier.
296+
The directory to use for caching prettier.
297+
-D, --dev-dependency='PACKAGE=VERSION'
298+
An entry to add to the package.json for running prettier.
299+
The format is 'PACKAGE=VERSION'.
300+
example: 'prettier=2.8.7'
297301
-h, --help Show this help message and exit.
298302
-n, --npm-exec=<explicitNpmExecutable>
299303
The explicit path to the npm executable.
300304
-N, --node-exec=<explicitNodeExecutable>
301305
The explicit path to the node executable.
302306
-P, --prettier-config-path=<prettierConfigPath>
303-
The path to the Prettier configuration file.
307+
The path to the prettier configuration file.
304308
-R, --npmrc-file=<explicitNpmrcFile>
305309
The explicit path to the .npmrc file.
306310
-V, --version Print version information and exit.

app/src/main/java/com/diffplug/spotless/cli/steps/Prettier.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,22 @@
3737
import static com.diffplug.spotless.cli.core.FilePathUtil.asFile;
3838
import static com.diffplug.spotless.cli.core.FilePathUtil.asFiles;
3939
import static com.diffplug.spotless.cli.core.FilePathUtil.assertDirectoryExists;
40+
import static com.diffplug.spotless.cli.help.OptionConstants.NEW_LINE;
4041
import static com.diffplug.spotless.cli.steps.OptionDefaultUse.use;
4142

42-
@CommandLine.Command(name = "prettier", description = "Runs prettier")
43+
@CommandLine.Command(name = "prettier", description = "Runs prettier, the opinionated code formatter.")
4344
public class Prettier extends SpotlessFormatterStep {
4445

4546
@CommandLine.Option(
4647
names = {"--dev-dependency", "-D"},
47-
description = "The devDependencies to use for Prettier.")
48+
description = "An entry to add to the package.json for running prettier." + NEW_LINE
49+
+ "The format is @|YELLOW 'PACKAGE=VERSION'|@." + NEW_LINE + "example: 'prettier=2.8.7'",
50+
paramLabel = "'PACKAGE=VERSION'")
4851
Map<String, String> devDependencies;
4952

5053
@CommandLine.Option(
5154
names = {"--cache-dir", "-C"},
52-
description = "The directory to use for caching Prettier.")
55+
description = "The directory to use for caching prettier.")
5356
Path cacheDir;
5457

5558
@CommandLine.Option(
@@ -74,12 +77,14 @@ public class Prettier extends SpotlessFormatterStep {
7477

7578
@CommandLine.Option(
7679
names = {"--prettier-config-path", "-P"},
77-
description = "The path to the Prettier configuration file.")
80+
description = "The path to the prettier configuration file.")
7881
Path prettierConfigPath;
7982

8083
@CommandLine.Option(
8184
names = {"--prettier-config-option", "-c"},
82-
description = "The Prettier configuration options.")
85+
description = "A prettier configuration options." + NEW_LINE + "The format is @|YELLOW 'OPTION=VALUE'|@."
86+
+ NEW_LINE + "example: 'printWidth=80'",
87+
paramLabel = "'OPTION=VALUE'")
8388
Map<String, String> prettierConfigOptions;
8489

8590
@NotNull @Override

0 commit comments

Comments
 (0)