Skip to content

Commit

Permalink
feat(web): add IDE document (#390)
Browse files Browse the repository at this point in the history
* feat: add IDE document

Signed-off-by: KeisukeYamashita <[email protected]>

* fix(cli): remove doctest from parse_commit_message example

Signed-off-by: KeisukeYamashita <[email protected]>

---------

Signed-off-by: KeisukeYamashita <[email protected]>
  • Loading branch information
KeisukeYamashita authored Dec 3, 2024
1 parent 91bd0a7 commit 1564290
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ Cargo.lock
commitlint

# Commitlint config file
.commitlintrc
.commitlintrc.*

# JSON schema
schema.json
2 changes: 1 addition & 1 deletion cli/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn extract_commit_messages(input: &str) -> Vec<String> {
/// Please refer the official documentation for the commit message format.
/// See: https://www.conventionalcommits.org/en/v1.0.0/#summary
///
/// ```
/// ```ignore
/// <type>[optional scope]: <description> <-- Subject
///
/// [optional body] <-- Body
Expand Down
83 changes: 83 additions & 0 deletions web/src/content/docs/config/IDE.md
Original file line number Diff line number Diff line change
@@ -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:
```

0 comments on commit 1564290

Please sign in to comment.