Skip to content

Commit aa49a25

Browse files
authoredMar 17, 2024
[docs-infra] Fail CI on Vale error (#40944)
1 parent 32c22e9 commit aa49a25

File tree

16 files changed

+68
-33
lines changed

16 files changed

+68
-33
lines changed
 

‎.circleci/config.yml

+37
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,43 @@ jobs:
207207
- run:
208208
name: Lint Markdown
209209
command: pnpm markdownlint
210+
- run:
211+
# See https://circleci.com/developer/orbs/orb/circleci/vale as reference
212+
name: Install Vale
213+
command: |
214+
#!/bin/bash
215+
VALE_STR_CLI_VERSION=3.3.0
216+
217+
mkdir /tmp/vale-extract
218+
cd /tmp/vale-extract
219+
GZIPPED_OUTPUT="vale.tar.gz"
220+
BINARY_URL=https://github.com/errata-ai/vale/releases/download/v${VALE_STR_CLI_VERSION}/vale_${VALE_STR_CLI_VERSION}_Linux_64-bit.tar.gz
221+
curl -sSL "$BINARY_URL" -o "${GZIPPED_OUTPUT}"
222+
223+
if [ ! -s "${GZIPPED_OUTPUT}" ]; then
224+
echo "Downloaded file is empty"
225+
rm "${GZIPPED_OUTPUT}"
226+
exit 1
227+
fi
228+
229+
tar -xzf "${GZIPPED_OUTPUT}"
230+
$SUDO mv vale /usr/local/bin
231+
rm "${GZIPPED_OUTPUT}"
232+
233+
# validate installation
234+
if [[ -z "$(command -v vale)" ]]; then
235+
echo "vale installation failed"
236+
exit 1
237+
else
238+
echo "vale installation successful"
239+
vale --version
240+
exit 0
241+
fi
242+
- run:
243+
name: Lint writing style
244+
command: |
245+
vale sync
246+
pnpm run valelint
210247
test_static:
211248
<<: *default-job
212249
steps:

‎.github/workflows/vale-action.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
1616
- uses: errata-ai/vale-action@38bf078c328061f59879b347ca344a718a736018 # v2.1.0
17-
continue-on-error: true
17+
continue-on-error: true # GitHub Action flag needed until https://github.com/errata-ai/vale-action/issues/89 is fixed
1818
with:
19-
reporter: github-pr-review
20-
files: docs/data
21-
env:
22-
# Required, set by GitHub actions automatically:
23-
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
24-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
19+
fail_on_error: true
20+
reporter: github-pr-check
21+
token: ${{secrets.GITHUB_TOKEN}}

‎.vale.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ Google.We = YES # Avoid first-person plural
1919
Google.Will = YES # Avoid future tense
2020
Google.OxfordComma = YES # Prefer Oxford comma
2121

22-
[CHANGELOG*.md]
22+
[*CHANGELOG*.md]
2323
MUI.CorrectReferenceAllCases = NO

‎docs/mui-vale.zip

-1 Bytes
Binary file not shown.

‎docs/mui-vale/styles/MUI/CorrectReferenceAllCases.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ignorecase: true
77
# for more information: https://vale.sh/docs/topics/styles/#substitution
88
swap:
99
' api': API
10-
typescript: TypeScript
10+
'typescript ': TypeScript
1111
' ts': TypeScript
1212
' js': JavaScript
1313
javascript: JavaScript

‎docs/pages/blog/2019-developer-survey-results.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Multiple options were allowed.
281281

282282
<img src="/static/blog/2019-developer-survey-results/16.png" style="display: block; margin: 0 auto;" alt="Pie chart: 54,3% for my company, 24.9% for a client, 15.2% as a side project, 5.6% more than one of these." />
283283

284-
### 17. Which JS framework are you using, if any?
284+
### 17. Which JavaScript framework are you using, if any?
285285

286286
Multiple options were allowed.
287287

‎docs/pages/blog/2019.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Some of the key factors:
6464
- We have fixed a significant number of [accessibility issues](https://github.com/mui/material-ui/issues?q=is%3Aissue+label%3Aaccessibility+is%3Aclosed).
6565
- We have introduced global class names.
6666
- We have migrated the whole codebase to hooks.
67-
- We migrated all the demos to TypeScript (while also offering transpiled JS demos).
67+
- We migrated all the demos to TypeScript (while also offering transpiled JavaScript demos).
6868
- We introduced [native tree-shaking](/material-ui/guides/minimizing-bundle-size/) support.
6969
- We introduced [built-in localization](/material-ui/guides/localization/).
7070
- We removed a good number of external dependencies and increased the `features/bundle size` density.

‎docs/pages/blog/2020-developer-survey-results.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ section.
277277
<img src="/static/blog/2020-survey/17.png" style="width: 796px; margin-top: 16px; margin-bottom: 8px;" alt="Pie chart: 55.17% For my company
278278
22.86% For a client, 16.94% Side project, 5.03% More than one of these." />
279279

280-
### 18. Which JS framework are you using, if any?
280+
### 18. Which JavaScript framework are you using, if any?
281281

282282
<img src="/static/blog/2020-survey/18.png" style="width: 796px; margin-top: 16px; margin-bottom: 8px;" alt="Pie chart: 57.34% Create React App, 16.40% Custom Webpack, 12.35% Next.js, 5.40% Gatsby, 8.51% Other." />
283283

‎docs/pages/blog/making-customizable-components.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ you can play around with it in [CodeSandbox](https://codesandbox.io/p/sandbox/fa
5959
}
6060
```
6161

62-
### Let JS generate the CSS
62+
### Let JavaScript generate the CSS
6363

6464
Maybe you don't want to spend your time switching between CSS and JavaScript files, or writing long, cluttered stylesheets.
65-
To avoid these problems you can integrate styles directly into your JS code. 🎉
65+
To avoid these problems you can integrate styles directly into your JavaScript code. 🎉
6666

6767
Because the level of customization varies across projects, Material UI's components can be customized in several different ways.
6868
For more information on this topic, check out the [Material UI customization documentation](https://mui.com/material-ui/customization/how-to-customize/).

‎docs/pages/blog/toolpad-use-cases.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Your browser does not support the video tag.
6161
</video>
6262

6363
We opted for Toolpad since Metabase doesn't support importing data from REST APIs.
64-
This is possible in Google Sheets but it requires writing a lot of JS code, and since we wanted to embed it in a [Notion page](https://mui-org.notion.site/KPIs-1ce9658b85ce4628a2a2ed2ae74ff69c?pvs=4#3974cb6ed12b4c5a9013bac63113e3bc), Toolpad was the ideal choice.
64+
This is possible in Google Sheets but it requires writing a lot of JavaScript code, and since we wanted to embed it in a [Notion page](https://mui-org.notion.site/KPIs-1ce9658b85ce4628a2a2ed2ae74ff69c?pvs=4#3974cb6ed12b4c5a9013bac63113e3bc), Toolpad was the ideal choice.
6565
Toolpad handles state management and routing, and simplifies query building and data binding, removing the need to write glue code.
6666

6767
You can explore both of the aforementioned apps in dev mode on your device by running the underlying [Node application](https://github.com/mui/mui-public/tree/HEAD/tools-public).

‎docs/src/pages/premium-themes/onepirate/modules/views/privacy.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Please read this policy carefully to understand how we handle and treat your per
1313

1414
We may collect and process the following personal information from you:
1515

16-
- **Information you provide to us:** We collect personal information when you voluntarily provide us with such information in the course of using our website or Services. For example, when you register to use our Services, we will collect your name, email address and organization information. We also collect personal information from you when you subscribe to our newsletter, or respond to a survey. If you make an enquiry through our website, or contact us in any other way, we will keep a copy of your communications with us.
16+
- **Information you provide to us:** We collect personal information when you voluntarily provide us with such information in the course of using our website or Services. For example, when you register to use our Services, we will collect your name, email address and organization information. We also collect personal information from you when you subscribe to our newsletter, or respond to a survey. If you make an inquiry through our website, or contact us in any other way, we will keep a copy of your communications with us.
1717
- **Information we collect when you do business with us:** We may process your personal information when you do business with us – for example, as a customer or prospective customer, or as a vendor, supplier, consultant or other third party. For example, we may hold your business contact information and financial account information (if any) and other communications you have with us for the purposes of maintaining our business relations with you.
1818
- **Information we automatically collect:** We may also collect certain technical information by automatic means when you visit our website, such as IP address, browser type and operating system, referring URLs, your use of our website, and other clickstream data. We collect this information automatically through the use of various technologies, such as cookies.
1919
- **Personal information where we act as a data processor:** We also process personal information on behalf of our customers in the context of supporting our products and services. Where a customer subscribes to our Services for their website, game or app, they will be the ones who control what event data is collected and stored on our systems. For example, they may ask us to log basic user data (for example email address or username), device identifiers, IP addresses, event type, and related source code. In such cases, we are data processors acting in accordance with the instructions of our customers. You will need to refer to the privacy policies of our customers to find out more about how such information is handled by them.
@@ -84,7 +84,7 @@ You can also unsubscribe from our marketing communications at any time by follow
8484

8585
## Data Retention
8686

87-
We may retain your personal information as long as you continue to use the Services, have an account with us or for as long as is necessary to fulfil the purposes outlined in the policy. You can ask to close your account by contacting us at the details below and we will delete your personal information on request.
87+
We may retain your personal information as long as you continue to use the Services, have an account with us or for as long as is necessary to fulfill the purposes outlined in the policy. You can ask to close your account by contacting us at the details below and we will delete your personal information on request.
8888

8989
We may however retain personal information for an additional period as is permitted or required under applicable laws, for legal, tax or regulatory reasons, or for legitimate and lawful business purposes.
9090

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"eslint:ci": "eslint . --report-unused-disable-directives --ext .js,.ts,.tsx --max-warnings 0",
4747
"stylelint": "stylelint --reportInvalidScopeDisables --reportNeedlessDisables \"docs/**/*.{js,ts,tsx}\"",
4848
"markdownlint": "markdownlint-cli2 \"**/*.md\"",
49+
"valelint": "git ls-files | grep -h \".md$\" | xargs vale --filter='.Level==\"error\"'",
4950
"prettier": "pretty-quick --ignore-path .eslintignore",
5051
"prettier:all": "prettier --write . --ignore-path .eslintignore",
5152
"size:snapshot": "node --max-old-space-size=4096 ./scripts/sizeSnapshot/create",

‎packages-internal/scripts/typescript-to-proptypes/CHANGELOG.old.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ All notable changes to this project will be documented in this file. See [standa
123123
- **parser:** handle optional any ([30f56ec](https://github.com/merceyz/typescript-to-proptypes/commit/30f56ec))
124124
- **parser:** handle optional React.ElementType ([c7a87fd](https://github.com/merceyz/typescript-to-proptypes/commit/c7a87fd))
125125
- **parser:** treat ComponentType as elementType ([53f1e21](https://github.com/merceyz/typescript-to-proptypes/commit/53f1e21))
126-
- export typescript as ts ([ba90e22](https://github.com/merceyz/typescript-to-proptypes/commit/ba90e22))
126+
- export TypeScript as ts ([ba90e22](https://github.com/merceyz/typescript-to-proptypes/commit/ba90e22))
127127

128128
### Features
129129

‎packages/mui-codemod/CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The codemod is a tool that helps developers migrate their codebase when we introduce changes in a new version. The changes could be deprecations, enhancements, or breaking changes.
66

7-
The codemods for JS files are based on [jscodeshift](https://github.com/facebook/jscodeshift) which is a wrapper of [recast](https://github.com/benjamn/recast).
7+
The codemods for JavaScript files are based on [jscodeshift](https://github.com/facebook/jscodeshift) which is a wrapper of [recast](https://github.com/benjamn/recast).
88

99
The codemods for CSS files are based on [postcss](https://github.com/postcss/postcss).
1010

@@ -22,7 +22,7 @@ The codemods for CSS files are based on [postcss](https://github.com/postcss/pos
2222
- `actual.css` - the input for the postcss plugin (optional)
2323
- `expected.css` - the expected output of the postcss plugin (optional)
2424
3. Use [astexplorer](https://astexplorer.net/) to check the AST types and properties
25-
- For JS codemods set </> to @babel/parser because we use [`tsx`](https://github.com/benjamn/recast/blob/master/parsers/babel.ts) as a default parser.
25+
- For JavaScript codemods set </> to @babel/parser because we use [`tsx`](https://github.com/benjamn/recast/blob/master/parsers/babel.ts) as a default parser.
2626
- For CSS codemods set </> to postcss
2727
4. [Test the codemod locally](#local)
2828
5. Add the codemod to README.md

‎packages/mui-codemod/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ The following scenarios are not currently handled by this codemod and will be ma
16391639
- In order for arrow functions at the rule level to be converted, the parameter must use object
16401640
destructuring (for example `root: ({color, padding}) => (...)`). If the parameter is not destructured
16411641
(for example `root: (props) => (...)`), it will not be converted.
1642-
- If an arrow function at the rule level contains a code block (i.e. contains an explicit `return`
1642+
- If an arrow function at the rule level contains a code block (that is contains an explicit `return`
16431643
statement) rather than just an object expression, it will not be converted.
16441644

16451645
You can find more details about migrating from JSS to tss-react in [the migration guide](https://mui.com/material-ui/migration/migrating-from-jss/#2-use-tss-react).

‎packages/pigment-css-react/README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Thanks to recent advancements in CSS (like CSS variables and `color-mix()`), "tr
3434
Pigment CSS addresses the needs of the modern React developer by providing a zero-runtime CSS-in-JS styling solution as a successor to tools like Emotion and styled-components.
3535

3636
Compared to its predecessors, Pigment CSS offers improved DX and runtime performance (though at the cost of increased build time) while also being compatible with React Server Components.
37-
Pigment CSS is built on top of [WyW-in-JS](https://wyw-in-js.dev/), enabling us to provide the smoothest possible experience for Material UI users when migrating from Emotion in v5 to Pigment CSS in v6.
37+
Pigment CSS is built on top of [WyW-in-JS](https://wyw-in-js.dev/), enabling to provide the smoothest possible experience for Material UI users when migrating from Emotion in v5 to Pigment CSS in v6.
3838

3939
### Start with Next.js
4040

@@ -157,7 +157,7 @@ function App() {
157157
}
158158
```
159159

160-
The call to the `css` function will be replaced with a unique string that represents the CSS class name for the generated styles.
160+
The call to the `css` function is replaced with a unique string that represents the CSS class name for the generated styles.
161161

162162
Use a callback function to get access to the [theme](#theming) values:
163163

@@ -264,7 +264,7 @@ const Button = styled('button')({
264264
});
265265
```
266266

267-
Note that the `props` function will not work if it is inside another closure, for example, inside an `array.map`:
267+
Note that the `props` function doesn't work if it is inside another closure, for example, inside an `array.map`:
268268

269269
```jsx
270270
const Button = styled('button')({
@@ -307,7 +307,7 @@ const Heading = styled('h1')({
307307
});
308308
```
309309

310-
Pigment CSS will replace the callback with a CSS variable and inject the value through inline style. This makes it possible to create a static CSS file while still allowing dynamic styles.
310+
Pigment CSS replaces the callback with a CSS variable and inject the value through inline style. This makes it possible to create a static CSS file while still allowing dynamic styles.
311311

312312
```css
313313
.Heading_class_akjsdfb {
@@ -384,7 +384,7 @@ function Example1() {
384384
}
385385
```
386386

387-
The call to the `keyframes` function will be replaced with a unique string that represents the CSS animation name. It can be used with `css` or `styled` too.
387+
The call to the `keyframes` function is replaced with a unique string that represents the CSS animation name. It can be used with `css` or `styled` too.
388388

389389
```js
390390
import { css, styled, keyframes } from '@pigment-css/react';
@@ -415,7 +415,7 @@ Theming is an **optional** feature that lets you reuse the same values, such as
415415

416416
> **💡 Good to know**:
417417
>
418-
> The **theme** object is used at build time and does not exist in the final JS bundle. This means that components created using Pigment's `styled` can be used with React Server Components by default while still getting the benefits of theming.
418+
> The **theme** object is used at build time and does not exist in the final JavaScript bundle. This means that components created using Pigment CSS's `styled` can be used with React Server Components by default while still getting the benefits of theming.
419419
420420
For example, in Next.js, you can define a theme in the `next.config.js` file like this:
421421

@@ -484,7 +484,7 @@ module.exports = withPigment(
484484
);
485485
```
486486

487-
The `extendTheme` utility will go through the theme and create a `vars` object which represents the tokens that refer to CSS variables.
487+
The `extendTheme` utility goes through the theme and create a `vars` object which represents the tokens that refer to CSS variables.
488488

489489
```jsx
490490
const theme = extendTheme({
@@ -508,7 +508,7 @@ extendTheme({
508508
});
509509
```
510510

511-
The generated CSS variables will have the `pigment` prefix:
511+
The generated CSS variables has the `pigment` prefix:
512512

513513
```css
514514
:root {
@@ -579,7 +579,7 @@ function App() {
579579
#### Styling based on color scheme
580580

581581
The `extendTheme` utility attaches a function called `applyStyles` to the theme object. It receives a color scheme as the first argument followed by a style object.
582-
It will return a proper CSS selector based on the theme configuration.
582+
It returns a proper CSS selector based on the theme configuration.
583583

584584
```jsx
585585
const Heading = styled('h1')(({ theme }) => ({
@@ -620,7 +620,7 @@ declare module '@pigment-css/react/theme' {
620620

621621
Emotion and styled-components are runtime CSS-in-JS libraries. What you write in your styles is what you get in the final bundle, which means the styles can be as dynamic as you want with bundle size and performance overhead trade-offs.
622622

623-
On the other hand, Pigment CSS extracts CSS at build time and replaces the JS code with hashed class names and some CSS variables. This means that it has to know all of the styles to be extracted ahead of time, so there are rules and limitations that you need to be aware of when using JavaScript callbacks or variables in Pigment CSS's APIs.
623+
On the other hand, Pigment CSS extracts CSS at build time and replaces the JavaScript code with hashed class names and some CSS variables. This means that it has to know all of the styles to be extracted ahead of time, so there are rules and limitations that you need to be aware of when using JavaScript callbacks or variables in Pigment CSS's APIs.
624624

625625
Here are some common patterns and how to achieve them with Pigment CSS:
626626

@@ -669,7 +669,7 @@ const Flex = styled('div')((props) => ({
669669
670670
2. **Programatically generated styles**
671671

672-
For Emotion and styled-components, the styles will be different on each render and instance because the styles are generated at runtime:
672+
For Emotion and styled-components, the styles is different on each render and instance because the styles are generated at runtime:
673673

674674
```js
675675
function randomBetween(min: number, max: number) {
@@ -693,7 +693,7 @@ function App() {
693693
}
694694
```
695695

696-
However, in Pigment CSS with the same code as above, all instances will have the same styles and won't change between renders because the styles are extracted at build time.
696+
However, in Pigment CSS with the same code as above, all instances have the same styles and won't change between renders because the styles are extracted at build time.
697697

698698
To achieve the same result, you need to move the dynamic logic to props and pass the value to CSS variables instead:
699699

0 commit comments

Comments
 (0)
Please sign in to comment.