Skip to content

Commit 6379670

Browse files
committed
Add Vale prose linting to feature descriptions
1 parent 0485b78 commit 6379670

16 files changed

+57
-10
lines changed

.github/workflows/pull_request.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ jobs:
2929
cache: npm
3030
- run: npm ci
3131
- run: npm test
32+
vale:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: errata-ai/vale-action@d89dee975228ae261d22c15adcd03578634d429c # v2.1.1
37+
with:
38+
fail_on_error: true
39+
version: 3.12.0
3240

3341
env:
3442
FORCE_COLOR: 3

.vale.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
StylesPath = .vale
2+
3+
[features/*.yml]
4+
View = features
5+
BasedOnStyles = Vale, web-features-styles
6+
Vale.Spelling = NO

.vale/config/views/features.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
engine: dasel
2+
scopes:
3+
- name: description
4+
expr: description
5+
type: md

.vale/web-features-styles/Avoid.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends: existence
2+
message: Consider removing '%s'
3+
level: warning
4+
ignorecase: true
5+
tokens:
6+
- is used to
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: substitution
2+
message: Consider using '%s' instead of '%s'
3+
level: warning
4+
ignorecase: false
5+
# swap maps tokens in form of bad: good
6+
swap:
7+
defines: sets
8+
specifies: sets
9+
determines: sets

docs/guidelines.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ The identifier should match the name, with these additional guidelines:
7979

8080
## Descriptions
8181

82+
> [!TIP]
83+
> Some description rules are enforced by linting with Vale.
84+
> A workflow reviews files that you change in your pull request and suggest changes.
85+
> To run the Vale linter locally, [install Vale](https://vale.sh/docs/install) and run `vale .` from the root of the repository.
86+
8287
The `description` field contains a short description of the feature in Markdown-formatted text, which is converted to HTML in the published package.
8388
Follow the general writing guidelines in this section, but see the [word and phrase list](#word-and-phrase-list) for specific usage instructions.
8489

@@ -158,12 +163,16 @@ Avoid.
158163
See [sets](#sets).
159164
([#727](https://github.com/web-platform-dx/web-features/pull/727#discussion_r1537635491))
160165

166+
⚠️ Warned by vale: [`Substitute.yml`](/.vale/web-features-styles/Substitute.yml)
167+
161168
#### determines
162169

163170
Avoid.
164171
See [sets](#sets).
165172
([#727](https://github.com/web-platform-dx/web-features/pull/727#discussion_r1537635491))
166173

174+
⚠️ Warned by vale: [`Substitute.yml`](/.vale/web-features-styles/Substitute.yml)
175+
167176
#### device
168177

169178
Use "device" to refer to the underlying operating system or hardware environment, or combination thereof.
@@ -195,6 +204,8 @@ Omit "is used" where there's no loss in meaning.
195204
For example, prefer "The feature reads…" over "The feature is used to read…"
196205
([#727](https://github.com/web-platform-dx/web-features/pull/727#discussion_r1537635981))
197206

207+
✅ Required by vale: [`Avoid.yml`](/.vale/web-features-styles/Avoid.yml)
208+
198209
#### longhands and shorthands
199210

200211
Use the terms "shorthand" and "longhand" to describe the relationship between CSS properties that combine multiple properties into a single declaration and the individual properties.
@@ -231,6 +242,8 @@ Avoid.
231242
See [sets](#sets).
232243
([#727](https://github.com/web-platform-dx/web-features/pull/727#discussion_r1537635491))
233244

245+
⚠️ Warned by vale: [`Substitute.yml`](/.vale/web-features-styles/Substitute.yml)
246+
234247
#### styling … as … by default
235248

236249
Use this phrase (or using another appropriate preposition, such as "styling in") to note conventional or standardized default styling.

features/beforeunload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: beforeunload
2-
description: "The `beforeunload` event is fired when the current window is about to be unloaded. Typically this is used to display a dialog to confirm if users really want to leave the page when there is unsaved data that would be lost."
2+
description: "The `beforeunload` event is fired when the current window is about to be unloaded. Typically you use this to display a dialog to confirm if users really want to leave the page when there is unsaved data that would be lost."
33
spec: https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-beforeunloadevent-interface
44
status:
55
compute_from: api.Window.beforeunload_event

features/charset.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "@charset"
2-
description: The `@charset` CSS at-rule specifies the character encoding of an external style sheet.
2+
description: The `@charset` CSS at-rule specifies the character encoding of an external style sheet.
33
spec: https://drafts.csswg.org/css2/#charset
44
group: css
55
compat_features:

features/del.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: <del>
2-
description: The `<del>` element element represents a range of text that has been deleted from a document, styling text as strikethrough by default.
2+
description: The `<del>` element element represents a range of text that has been deleted from a document, styling text as strikethrough by default.
33
spec: https://html.spec.whatwg.org/multipage/edits.html#the-del-element
44
group: html-elements
55
compat_features:

features/font-kerning.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: font-kerning
2-
description: The `font-kerning` CSS property sets whether kerning data from a font is used to adjust the space between letters.
2+
description: The `font-kerning` CSS property sets whether to use kerning data from a font to adjust the space between letters.
33
spec: https://drafts.csswg.org/css-fonts-4/#font-kerning-prop
44
group: font-features
55
caniuse: font-kerning

0 commit comments

Comments
 (0)