-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add support for linting annotations and other static analysis workflow improvements #76120
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
Changes from all commits
3cccf7e
3cf00c0
59fb444
7f45020
e81a47a
44b76f4
016c76c
464f02e
900b6ca
eed1253
d30e5a0
0913877
802e921
8ff0b5e
65504ba
b9b91da
20f0ebd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,12 @@ jobs: | |
| event: ['${{ github.event_name }}'] | ||
| node: ['20', '22', '24'] | ||
| os: ['macos-15', 'ubuntu-24.04', 'windows-2025'] | ||
|
|
||
| include: | ||
| # Only generate annotations once. | ||
| - node: '24' | ||
| os: 'ubuntu-24.04' | ||
| annotations: true | ||
| exclude: | ||
| # On PRs: Only test Node 20 on Ubuntu and Windows | ||
| - event: 'pull_request' | ||
|
|
@@ -50,11 +56,12 @@ jobs: | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| cache: npm | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it'll be a nice win as a standalone change 👍 Surprised we didn't have this or that it's not a default. Though reading the relevant documentation, it does have me thinking whether we should have
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. That is a relatively new addition to I'm torn for this one. On one hand it's good to have it on by default for the sake of better performance. But on the other, making it an intentional addition makes it a conscious choice and could help guard against cache poisoning attacks when production assets are being built or commits are being pushed to the repository. It's also possible that someone could submit a PR to add I am leaning towards adding it now and auditing where |
||
|
|
||
| - name: Pin npm version for consistency | ||
| run: npm install -g npm@10 | ||
|
|
||
| - name: Npm install | ||
| - name: npm install | ||
| # A "full" install is executed, since `npm ci` does not always exit | ||
| # with an error status code if the lock file is inaccurate. This also | ||
| # helps to catch dependencies not being installed with exact version. | ||
|
|
@@ -63,8 +70,22 @@ jobs: | |
| # See: https://github.com/WordPress/gutenberg/pull/39865 | ||
| run: npm install | ||
|
|
||
| - name: Lint JavaScript and Styles | ||
| run: npm run lint | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noting a couple things about this change to use granular scripts:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that is possible. One approach to make sure this scenario is caught could be to run We likely need to just have better documentation and guidance around this within packages. Each package should have a section detailing where any automation or CI/CD testing should be added when updating the package as a reminder. Maybe that could be a reason to introduce a |
||
| - name: Lint package.json files | ||
| run: npm run lint:pkg-json | ||
|
|
||
| - name: Lint package-lock.json file | ||
| run: npm run lint:lockfile | ||
|
|
||
| - name: Validate TypeScript config | ||
| run: npm run lint:tsconfig | ||
|
|
||
| - name: Lint JavaScript | ||
| if: ${{ matrix.annotations }} | ||
| run: npm run lint:js -- --format compact | ||
|
|
||
| - name: Lint Styles | ||
| if: ${{ matrix.annotations }} | ||
| run: npm run lint:css -- --formatter compact | ||
|
|
||
desrosj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Type checking | ||
| run: npm run build | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.