Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-infra] Add vale for style-guide lint on docs #3178

Merged
merged 17 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/styles/Blog/BrandName.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Without a non-breaking space, brand names can be split in the middle, with the start and end on two different lines.
extends: substitution
message: Use a non-breaking space for brand name ('%s' instead of '%s')
level: error
ignorecase: true
# swap maps tokens in form of bad: good
# for more information: https://vale.sh/docs/topics/styles/#substitution
swap:
Material UI: Material UI
MUI X: MUI X
Base UI: Base UI
MUI System: MUI System
MUI Store: MUI Store
MUI Core: MUI Core
MUI Toolpad: MUI Toolpad
MUI Connect: MUI Connect
24 changes: 24 additions & 0 deletions .github/styles/Blog/ComponentNaming.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extends: substitution
message: Unless you're referring to the general concept, consider using '%s' instead of '%s'.
level: suggestion
ignorecase: false
# swap maps tokens in form of bad: good
# for more information: https://vale.sh/docs/topics/styles/#substitution
swap:
# Capitalize
data grid: Data Grid
date picker: Date Picker
Data grid: Data Grid
Date picker: Date Picker
Time picker: Time Picker
Date [t|T]ime picker: Date Time Picker
Date [r|R]ange picker: Date Range Picker
Time [r|R]ange picker: Time Range Picker
Date [t|T]ime [r|R]ange picker: Date Time Range Picker
time picker: Time Picker
date time picker: Date Time Picker
date range picker: Date Range Picker
time range picker: Time Range Picker
date time range picker: Date Time Range Picker
# use Data Grid instead of grid
the grid: the Data Grid
12 changes: 12 additions & 0 deletions .github/styles/Blog/ComposedWords.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends: substitution
message: To be consistent with the rest of the documentation, consider using '%s' instead of '%s'.
level: warning
ignorecase: true
# swap maps tokens in form of bad: good
swap:
'sub-component': subcomponent
'sub-components': subcomponents
'sub component': subcomponent
'sub components': subcomponents
'use-case': 'use case'
'usecase': 'use case'
17 changes: 17 additions & 0 deletions .github/styles/Blog/NamingConventions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends: substitution
message: To be consistent with capitalization, consider using '%s' instead of '%s'.
level: warning
ignorecase: false
# swap maps tokens in form of bad: good
# for more information: https://vale.sh/docs/topics/styles/#substitution
swap:
api: API
Api: API
typescript: TypeScript
Typescript: TypeScript
ts: TypeScript
TS: TypeScript
javascript: JavaScript
Javascript: JavaScript
css: CSS
Css: CSS
13 changes: 13 additions & 0 deletions .github/styles/Blog/NoCompanyName.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends: existence
message: We avoid referencing the company name '%s'. Instead you can reference a product or the team.
level: warning
ignorecase: false
tokens:
- 'MUI \w+'
exceptions:
- 'MUI X'
- 'MUI System'
- 'MUI Store'
- 'MUI Core'
- 'MUI Toolpad'
- 'MUI Connect'
11 changes: 11 additions & 0 deletions .github/styles/Blog/Typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: substitution
message: Do you mean '%s' instead of '%s'?
level: error
ignorecase: true
# swap maps tokens in form of bad: good
# for more information: https://vale.sh/docs/topics/styles/#substitution
swap:
bellow: below
eg: e.g.
eg.: e.g.
'e.g ': 'e.g. '
23 changes: 23 additions & 0 deletions .github/workflows/vale-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Vale action

on: [pull_request]

permissions: {}

jobs:
vale:
name: runner / vale
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: errata-ai/vale-action@c4213d4de3d5f718b8497bd86161531c78992084 # v2.0.1
with:
reporter: github-pr-review
files: docs/data
env:
# Required, set by GitHub actions automatically:
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ test-results
.yarn-playwright-cache

/test/regressions/screenshots/**

# vale downloaded config
.github/styles/Google
.github/styles/write-good
27 changes: 27 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#Config vale. More information at https://docs.errata.ai/vale/config
StylesPath = .github/styles
MinAlertLevel = suggestion

# Run `vale sync` to include packages: https://vale.sh/hub/google/
Packages = Google

[*.md]
# Ignore code injection which start with {{...
BlockIgnores = {{.*

# Custom syle
# BasedOnStyles = Blog

Blog.ComposedWords = YES
Blog.NamingConventions = YES
Blog.Typos = YES

# Google:
Google.FirstPerson = YES # Avoid first-person pronouns such as I, me, ...'.
Google.GenderBias = YES # Avoid gendered profession
Google.OxfordComma = YES
Google.Quotes = YES # Commas and periods go inside quotation marks.
Google.Spelling = YES #In general, use American spelling (word ending with 'nised' or 'logue')
Google.We = YES # Try to avoid using first-person plural
Google.Latin = YES # Try to avoid latin expressions e.g. and i.e.

Loading