[code-infra] Use vale rules from code-infra package#48173
Conversation
Netlify deploy previewhttps://deploy-preview-48173--material-ui.netlify.app/ Bundle size report
|
f840749 to
7028099
Compare
b9b8ffa to
b011ff5
Compare
| ``` | ||
|
|
||
| ### Testing | ||
| ### Testing JSDOM |
There was a problem hiding this comment.
This was just to check the error reporting. But since the workflow change is in this PR, it only gets read-only token. So vale cant add annotations to the PR.
Once this PR gets merged, annotation will get added inline.
b011ff5 to
c0383e8
Compare
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| id: vale-inputs | ||
| run: | | ||
| echo "files=$(git ls-files '*.md' '*.mdx' | paste -sd ',' -)" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
If we don't do this, vale traverses the whole directory tree, including node_modules and breaks when it encounters symlinks. Even its glob flag doesnt work.
We could also update this to only consider the changed md files in the PR and not all md files.
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }}..HEAD -- '*.md' '*.mdx' | paste -sd ',' -)
else
FILES=$(git ls-files '*.md' '*.mdx' | paste -sd ',' -)
fi
echo "files=$FILES" >> $GITHUB_OUTPUT
echo "version=$(node -p 'require("./package.json").mui.valeVersion')" >> $GITHUB_OUTPUT| "version": "9.0.0-beta.0", | ||
| "private": true, | ||
| "mui": { | ||
| "valeVersion": "3.12.0" |
There was a problem hiding this comment.
this will not automatically update through renovate. So we can either keep it as-is (update manually or through custom renovate manager) or add @vvago/vale as a devDepedency back insted of the current pnpm dlx based usage.
| # Required, set by GitHub actions automatically: | ||
| # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret | ||
| token: ${{secrets.GITHUB_TOKEN}} | ||
| version: ${{ steps.vale-inputs.outputs.version }} |
There was a problem hiding this comment.
without flags, it logs warnings as well. So we can pass flags to filter based just on errors similar to what we do in pnpm valelint - vale --filter='.Level==\"error\"'
There was a problem hiding this comment.
Pull request overview
This PR migrates Vale configuration/rules to consume the shared rules shipped from @mui/internal-code-infra, removing the in-repo docs/mui-vale rules bundle and wiring Vale into the main CI workflow.
Changes:
- Point Vale’s
.vale.inito use rules from@mui/internal-code-infrainstead ofdocs/mui-vale.zip. - Remove the
docs/mui-valerule sources and the dedicatedvale-action.ymlworkflow. - Add Vale execution to
.github/workflows/ci.ymland centralize the Vale CLI version inpackage.json.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Adds a central mui.valeVersion and updates valelint; switches @mui/internal-code-infra to a pkg.pr.new URL. |
pnpm-lock.yaml |
Updates lockfile entries to match the @mui/internal-code-infra source change. |
.vale.ini |
Switches Vale package source from docs/mui-vale.zip to @mui/internal-code-infra. |
.github/workflows/ci.yml |
Runs Vale as part of CI (Ubuntu leg) and adjusts job permissions. |
.github/workflows/vale-action.yml |
Removes the standalone Vale workflow. |
docs/mui-vale/** (multiple deletions) |
Removes the previously vendored MUI Vale rules/styles and related config. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Collect Vale inputs | ||
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| id: vale-inputs | ||
| run: | | ||
| echo "files=$(git ls-files '*.md' '*.mdx' | paste -sd ',' -)" >> $GITHUB_OUTPUT | ||
| echo "version=$(node -p 'require("./package.json").mui.valeVersion')" >> $GITHUB_OUTPUT | ||
| - name: Vale | ||
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| uses: vale-cli/vale-action@d89dee975228ae261d22c15adcd03578634d429c # v2.1.1 | ||
| continue-on-error: true # GitHub Action flag needed until https://github.com/errata-ai/vale-action/issues/89 is fixed |
There was a problem hiding this comment.
The Vale step is added to ci.yml, but this workflow is configured with on.pull_request.paths-ignore: ['docs/**']. As a result, PRs that only touch docs/markdown won’t run this workflow, so Vale won’t run on the changes it’s meant to validate. Consider keeping Vale in a separate workflow that runs on all PRs (or at least on docs/**), or adjusting the CI/CI Check path filters so Vale still executes for docs-only PRs.
| "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.24", | ||
| "@mui/internal-bundle-size-checker": "1.0.9-canary.70", | ||
| "@mui/internal-code-infra": "0.0.4-canary.11", | ||
| "@mui/internal-code-infra": "https://pkg.pr.new/mui/mui-public/@mui/internal-code-infra@d11ec04", |
There was a problem hiding this comment.
@mui/internal-code-infra is pinned to a pkg.pr.new preview URL. Those preview artifacts are intended for temporary testing and can become unavailable over time, which would break installs and make builds less reproducible. Please switch this back to a published version/range (e.g. the canary you had before) and only use pkg.pr.new overrides locally or in short-lived test branches.
| "@mui/internal-code-infra": "https://pkg.pr.new/mui/mui-public/@mui/internal-code-infra@d11ec04", | |
| "@mui/internal-code-infra": "workspace:^", |
1975681 to
72b7ad0
Compare
c85e313 to
5434e8e
Compare
440a1dc to
ae58490
Compare
aecd276 to
2bc3d61
Compare
2bc3d61 to
20fe39f
Compare
Bundle size
Deploy previewhttps://deploy-preview-48173--material-ui.netlify.app/ Check out the code infra dashboard for more information about this PR. |
075978f to
b53f41d
Compare
Janpot
left a comment
There was a problem hiding this comment.
Was there a specific reason to move this from circle to GHA?
Both had it actually. Circle has general linting and github has linting with code annotations through the cake action. If we don't need the annotation, we can just keep the circle ci one. |
|
Right, I see. I don't find them particularly useful, but maybe someone on the team? |
|
We can do a team poll to validate if we need it or not. I am assuming it'll help devex team. |
Correct. I think both are important: It's about the rule that are warning. Rules that are error should break the CI, so easy, only Circle CI, but warnings go silent if they are not shown in the Code diff view as annotations. |
b53f41d to
3dfcb33
Compare
3dfcb33 to
ccaf5e0
Compare
The previous URL https://github.com/mui/material-ui/raw/HEAD/docs/mui-vale.zip was removed in mui/material-ui#48173 — vale rules now live in @mui/internal-code-infra. Match material-ui's own .vale.ini.
The previous URL https://github.com/mui/material-ui/raw/HEAD/docs/mui-vale.zip was removed in mui/material-ui#48173 — vale rules now live in @mui/internal-code-infra. Match material-ui's own .vale.ini.
Implements changes in mui/mui-public#1276