Skip to content

Commit

Permalink
Add Vale instructions.
Browse files Browse the repository at this point in the history
Signed-off-by: bgravenorst <[email protected]>
  • Loading branch information
bgravenorst committed Oct 24, 2024
1 parent 802ac4c commit fcc12bc
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 2 deletions.
Binary file added docs/assets/use-vale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/vale-ci.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/vs-code-ext.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions docs/configure/spell-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@ sidebar_position: 5

# Configure spell check

:::info important
Documentation repositories are in the process of being migrated to use Vale instead of [CSpell](https://cspell.org/).

Refer to the [instructions on how to use Vale](../contribute/run-vale.md).
:::

This template repository uses [CSpell](https://cspell.org/) to check for misspelled words
throughout the documentation.
CSpell runs when you run [`npm run lint:spelling`](../create/run-in-development.md).

You usually don't need to edit the [`.cspell.json`](../create/repo-structure.md#-cspelljson) file itself.
You don't often need to edit the [`.cspell.json`](../create/repo-structure.md#-cspelljson) file itself.
However, you can add ignore paths or files if needed.

:::note
We don't recommend ignoring entire files by placing them into `.cspell.json`.

Instead, we recommend using [in-line comments](https://cspell.org/configuration/document-settings/)
to disable spell checkfor example, if you have a snippet of code with an example API key
to disable spell checkfor example, if you have a snippet of code with an example API key
which CSpell picks up.

If you use a new term that causes spell check to fail, you can [add the term to your project's dictionary](../create/run-in-development.md#npm-run-lintspelling).
Expand Down
84 changes: 84 additions & 0 deletions docs/contribute/run-vale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
description: Run the spelling and style linter
sidebar_position: 7
---

# Run the spelling and style linter

The documentation suite uses [Vale](https://vale.sh/) as the style guide and spelling linter.
Vale is currently integrated into the continuous integration (CI) pipeline and is executed on each
pull request (PR) using a GitHub action. You can select the **Details** link to view the failures.

:::info important
The Vale GitHub workflow runs on all Markdown files in the document, not only the one's you've updated.
Failures in the workflow won't prevent your PR from being merged.

You can run Vale locally to view issues directly related to your PR.
:::

<p align = "center">
![Vale CI](../assets/vale-ci.png)
</p>

## Run locally

Run Vale locally to view issues related to the Markdown files you're working on. You can run Vale using the
command line, or you can integrate it into a [supported editor](https://vale.sh/docs/integrations/guide/) to
view issues in real-time.

### Use the command line

1. [Install Vale locally](https://vale.sh/docs/vale-cli/installation/#package-managers).

1. Checkout the repo containing our Vale settings:

```bash
git clone https://github.com/Consensys/docs-gha.git
```

1. Override the default location of the `.vale.ini` file by setting the `VALE_CONFIG_PATH` environment
variable to the location of the file in the repo. For example, on macOS this is:

```bash
export VALE_CONFIG_PATH="/Users/jdoe/documentation/docs-gha/spelling/.vale.ini"
```

Check failure on line 44 in docs/contribute/run-vale.md

View workflow job for this annotation

GitHub Actions / Lint

Fenced code blocks should be surrounded by blank lines

docs/contribute/run-vale.md:44 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md031.md
:::note
To persist the ENV variable across sessions you’ll need to add the above command it to the appropriate
file. For example `~/.zshrc` (default shell in newer macOS versions).
:::

4. Run the `vale` command in your terminal with the location of your file. For example:

Check failure on line 50 in docs/contribute/run-vale.md

View workflow job for this annotation

GitHub Actions / Lint

Inconsistent indentation for list items at the same level

docs/contribute/run-vale.md:50:1 MD005/list-indent Inconsistent indentation for list items at the same level [Expected: 0; Actual: 1] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md005.md

Check failure on line 50 in docs/contribute/run-vale.md

View workflow job for this annotation

GitHub Actions / Lint

Ordered list item prefix

docs/contribute/run-vale.md:50:2 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 4; Style: 1/1/1] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md029.md

```bash
vale node-sync.md
```

![Run Vale](../assets/use-vale.png)

### Use the VS Code integration

You must have the VS Code editor installed to use this integration.

1. [Install Vale locally](https://vale.sh/docs/vale-cli/installation/#package-managers).

1. Checkout the repo containing our Vale settings:

```bash
git clone https://github.com/Consensys/docs-gha.git
```

1. [Install the VS Code extension](https://marketplace.visualstudio.com/items?itemName=ChrisChinchilla.vale-vscode)

1. In the settings for the Vale VS Code extension, set the location of the `.vale.ini` file, and
enable the spell check. The `.vale.ini` file is located within the `spelling` directory in the
`docs-gha` repo that you checked out.

![VS Code extension settings](../assets/vs-code-ext.png)

1. Restart VS Code.

## Contribute to the spell checker

You can contribute to the spell checker by submitting a PR to the [`docs-gha` repository](https://github.com/Consensys/docs-gha).

You can add your words to the [`accept.txt`](https://github.com/Consensys/docs-gha/blob/main/spelling/styles/config/vocabularies/Consensys-common/accept.txt) file.

Check failure on line 84 in docs/contribute/run-vale.md

View workflow job for this annotation

GitHub Actions / Lint

Files should end with a single newline character

docs/contribute/run-vale.md:84:163 MD047/single-trailing-newline Files should end with a single newline character https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md047.md

0 comments on commit fcc12bc

Please sign in to comment.