diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5af4e33..e330dbc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -152,7 +152,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: schema.json - path: schema/schema.json + path: schema.json if-no-files-found: error web: diff --git a/.gitignore b/.gitignore index 2b2a8c8..419d3d8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,8 @@ Cargo.lock commitlint # Commitlint config file +.commitlintrc .commitlintrc.* + +# JSON schema +schema.json diff --git a/cli/src/git.rs b/cli/src/git.rs index 99d82bc..e584459 100644 --- a/cli/src/git.rs +++ b/cli/src/git.rs @@ -67,7 +67,7 @@ fn extract_commit_messages(input: &str) -> Vec { /// Please refer the official documentation for the commit message format. /// See: https://www.conventionalcommits.org/en/v1.0.0/#summary /// -/// ``` +/// ```ignore /// [optional scope]: <-- Subject /// /// [optional body] <-- Body diff --git a/web/src/content/docs/config/IDE.md b/web/src/content/docs/config/IDE.md new file mode 100644 index 0000000..7d7a4f1 --- /dev/null +++ b/web/src/content/docs/config/IDE.md @@ -0,0 +1,83 @@ +--- +title: IDE +description: Guide how to setup your IDE to work with commitlint +--- + +Commitlint offers schema by supporting [JSON schema](https://json-schema.org/) so that you can configure your IDE to work with Commitlint and have better developer experience. + +:::tip + +If you want to pin the schema to a specific version, you can configure the version in the URL. + +```console +https://github.com/KeisukeYamashita/commitlint-rs/releases/download/v0.2.0/schema.json +``` + +In this case, the schema is pinned to version `0.2.0`. + +::: + +## Visual Studio Code + +Configure your [Visual Studio Code](https://code.visualstudio.com/) to work with Commitlint. + +### Edit in `settings.json` + +Update your user `settings.json` or workspace settings (`/.vscode/settings.json`) to configure the schema. + +#### JSON + +```json +"json.schemas": [ + { + "fileMatch": [ + ".commitlintrc", + ".commitlintrc.json" + ], + "url": "https://github.com/KeisukeYamashita/commitlint-rs/releases/latest/download/schema.json" + } +] +``` + +#### YAML + +Associating schemas with YAMLs are supported by the [YAML language server](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml). + +```json +"yaml.schemas": { + "https://github.com/KeisukeYamashita/commitlint-rs/releases/latest/download/schema.json": [ + ".commitlintrc", + ".commitlintrc.yaml", + ".commitlint.yml" + ] +} +``` + +### Specify schema in the configuration file + +```json +{ + "$schema": "https://github.com/KeisukeYamashita/commitlint-rs/releases/download/v0.2.0/schema.json", + "rules": {} +} +``` + +#### JSON + +Add the following comment in your `.commitlintrc` or `.commitlintrc.json` file. + +```json +{ + "$schema": "https://github.com/KeisukeYamashita/commitlint-rs/releases/latest/download/schema.json", + "rules": {} +} +``` + +#### YAML + +Associating schemas with YAMLs are supported by the [YAML language server](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml). Add the following comment in your `.commitlintrc`, `.commitlintrc.yaml` or `.commitlintrc.yml` file. + +```yaml +# yaml-language-server: $schema=https://github.com/KeisukeYamashita/commitlint-rs/releases/latest/download/schema.json +rules: +```