From f700bd13ae750c007ca4d06d0dbb3ee84c455156 Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:55:48 -0500 Subject: [PATCH] Improve generateEditorConfig example in docs (#2436) This better demonstrates generating config for different code styles, as per https://github.com/pinterest/ktlint/pull/2436#issuecomment-1856313635. --- documentation/release-latest/docs/install/cli.md | 5 +++-- documentation/snapshot/docs/install/cli.md | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/documentation/release-latest/docs/install/cli.md b/documentation/release-latest/docs/install/cli.md index eae355a0b6..9e3203bd93 100644 --- a/documentation/release-latest/docs/install/cli.md +++ b/documentation/release-latest/docs/install/cli.md @@ -141,11 +141,12 @@ Some rules can be tweaked via the [`editorconfig file`](../../rules/configuratio A scaffold of the `.editorconfig file` can be generated with command below. Note: that the generated file only contains configuration settings which are actively used by the [rules which are loaded](#rule-sets): ```shell title="Generate .editorconfig" +# By default use ktlint_official ktlint generateEditorConfig # or -ktlint generateEditorConfig +ktlint generateEditorConfig intellij_idea # or -ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig +ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig android_studio ``` Normally this file is located in the root of your project directory. In case the file is located in a sub folder of the project, the settings of that file only applies to that subdirectory and its folders (recursively). Ktlint automatically detects and reads all `.editorconfig` files in your project. diff --git a/documentation/snapshot/docs/install/cli.md b/documentation/snapshot/docs/install/cli.md index 8508b85162..9f6bf4cee9 100644 --- a/documentation/snapshot/docs/install/cli.md +++ b/documentation/snapshot/docs/install/cli.md @@ -141,11 +141,12 @@ Some rules can be tweaked via the [`editorconfig file`](../../rules/configuratio A scaffold of the `.editorconfig` file can be generated with command below. Note: that the generated file only contains configuration settings which are actively used by the [rules which are loaded](#rule-sets): ```shell title="Generate .editorconfig" -ktlint generateEditorConfig ktlint_official +# By default use ktlint_official +ktlint generateEditorConfig # or -ktlint generateEditorConfig ktlint_official +ktlint generateEditorConfig intellij_idea # or -ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig ktlint_official +ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig android_studio ``` Normally the `.editorconfig` file is located in the root of your project directory. In case the file is located in a sub folder of the project, the settings of that file only applies to that subdirectory and its folders (recursively). Ktlint automatically detects and reads all `.editorconfig` files in your project.