Skip to content

Commit 77faa42

Browse files
authored
[code-infra] Use vale rules from code-infra package (#4706)
1 parent 9e41bd0 commit 77faa42

5 files changed

Lines changed: 34 additions & 41 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
code-infra: https://raw.githubusercontent.com/mui/mui-public/3feee347096f50b441cad3087743bd1c5aef8651/.circleci/orbs/code-infra.yml
4+
code-infra: https://raw.githubusercontent.com/mui/mui-public/12844f2b6b11babab17bd3d1f799359ea25d1db7/.circleci/orbs/code-infra.yml
55

66
parameters:
77
browserstack-force:

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
strategy:
2121
matrix:
2222
os: [macos-latest, windows-latest, ubuntu-latest]
23+
permissions:
24+
contents: read
25+
pull-requests: write
2326
steps:
2427
- run: echo "${{ github.actor }}"
2528
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -40,3 +43,27 @@ jobs:
4043
uses: mui/mui-public/.github/actions/ci-publish@3feee347096f50b441cad3087743bd1c5aef8651
4144
with:
4245
pr-comment: true
46+
- name: Extract Vale version
47+
if: ${{ matrix.os == 'ubuntu-latest' }}
48+
id: vale-version
49+
run: |
50+
VERSION=$(node -p "(require('./package.json').config && require('./package.json').config.valeVersion) || ''")
51+
echo "vale_version=$VERSION" >> $GITHUB_OUTPUT
52+
- name: Cache Vale binary
53+
if: ${{ matrix.os == 'ubuntu-latest' }}
54+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
55+
with:
56+
path: node_modules/.cache/mui-vale
57+
key: ${{ runner.os }}-mui-vale-${{ steps.vale-version.outputs.vale_version }}
58+
- uses: vale-cli/vale-action@d89dee975228ae261d22c15adcd03578634d429c # v2.1.1
59+
continue-on-error: true # GitHub Action flag needed until https://github.com/errata-ai/vale-action/issues/89 is fixed
60+
if: ${{ matrix.os == 'ubuntu-latest' }}
61+
with:
62+
version: ${{ steps.vale-version.outputs.vale_version }}
63+
# Errors should be more visible
64+
fail_on_error: true
65+
# The other reports don't work, not really https://github.com/reviewdog/reviewdog#reporters
66+
reporter: github-pr-check
67+
# Required, set by GitHub actions automatically:
68+
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
69+
token: ${{secrets.GITHUB_TOKEN}}

.github/workflows/vale-action.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.vale.ini

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
StylesPath = .github/styles
33
MinAlertLevel = warning
44

5-
# To update mui-vale package:
6-
# 1. Go to the docs folder in the material-ui repo
7-
# 2. Update/create YAML files
8-
# 3. Run `pnpm docs:zipRules` to generate the zip files
9-
# 4. You can test locally by replacing the url with the file path of the generated zip
10-
Packages = Google, https://github.com/mui/material-ui/raw/HEAD/docs/mui-vale.zip
5+
Packages = Google, ./node_modules/@mui/internal-code-infra/vale
116

127
[formats]
138
mdx = md

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"eslint:ci": "pnpm -r lint && eslint . --report-unused-disable-directives --max-warnings 0",
2929
"stylelint": "stylelint --reportInvalidScopeDisables --reportNeedlessDisables \"docs/**/*.{js,ts,tsx}\" \"**/*.css\" --ignore-path .lintignore",
3030
"markdownlint": "markdownlint-cli2 \"**/*.{md,mdx}\"",
31-
"valelint": "pnpm dlx --package @vvago/vale vale sync && git ls-files | grep -E \"\\.(md|mdx)$\" | xargs pnpm dlx --package @vvago/vale vale --filter='.Level==\"error\"'",
31+
"vale:fix": "pnpm code-infra vale sync --vale-version $npm_package_config_valeVersion && git ls-files | grep -E \"\\.(md|mdx)$\" | xargs pnpm code-infra vale --vale-version $npm_package_config_valeVersion --filter='.Level==\"error\"' --auto-fix all",
32+
"valelint": "pnpm code-infra vale sync --vale-version $npm_package_config_valeVersion && git ls-files | grep -E \"\\.(md|mdx)$\" | xargs pnpm code-infra vale --vale-version $npm_package_config_valeVersion --filter='.Level==\"error\"'",
3233
"prettier": "pretty-quick --ignore-path .lintignore --branch master",
3334
"prettier:all": "prettier --write . --ignore-path .lintignore",
3435
"size:snapshot": "pnpm -F ./test/bundle-size check",
@@ -107,6 +108,9 @@
107108
"vite": "8.0.10",
108109
"vitest": "4.1.5"
109110
},
111+
"config": {
112+
"valeVersion": "3.14.1"
113+
},
110114
"packageManager": "pnpm@10.33.2",
111115
"engines": {
112116
"pnpm": "10.33.2",

0 commit comments

Comments
 (0)