Skip to content

Commit 9980d08

Browse files
committed
Merge branch 'trunk' into update/move-font-directory-into-uploads
2 parents 2303f63 + 91084bf commit 9980d08

File tree

2,389 files changed

+57288
-38571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,389 files changed

+57288
-38571
lines changed

.eslintrc.js

Lines changed: 111 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,77 @@ const restrictedImports = [
7676
message:
7777
"edit-widgets is a WordPress top level package that shouldn't be imported into other packages",
7878
},
79+
{
80+
name: 'classnames',
81+
message:
82+
"Please use `clsx` instead. It's a lighter and faster drop-in replacement for `classnames`.",
83+
},
84+
];
85+
86+
const restrictedSyntax = [
87+
// NOTE: We can't include the forward slash in our regex or
88+
// we'll get a `SyntaxError` (Invalid regular expression: \ at end of pattern)
89+
// here. That's why we use \\u002F in the regexes below.
90+
{
91+
selector:
92+
'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]',
93+
message: 'Path access on WordPress dependencies is not allowed.',
94+
},
95+
{
96+
selector:
97+
'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' +
98+
majorMinorRegExp +
99+
'/]',
100+
message:
101+
'Deprecated functions must be removed before releasing this version.',
102+
},
103+
{
104+
selector:
105+
'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
106+
message:
107+
'This method is deprecated. You should use the more explicit API methods available.',
108+
},
109+
{
110+
selector:
111+
'CallExpression[callee.object.name="page"][callee.property.name="waitForTimeout"]',
112+
message: 'Prefer page.waitForSelector instead.',
113+
},
114+
{
115+
selector: 'JSXAttribute[name.name="id"][value.type="Literal"]',
116+
message:
117+
'Do not use string literals for IDs; use withInstanceId instead.',
118+
},
119+
{
120+
// Discourage the usage of `Math.random()` as it's a code smell
121+
// for UUID generation, for which we already have a higher-order
122+
// component: `withInstanceId`.
123+
selector:
124+
'CallExpression[callee.object.name="Math"][callee.property.name="random"]',
125+
message:
126+
'Do not use Math.random() to generate unique IDs; use withInstanceId instead. (If you’re not generating unique IDs: ignore this message.)',
127+
},
128+
{
129+
selector:
130+
'CallExpression[callee.name="withDispatch"] > :function > BlockStatement > :not(VariableDeclaration,ReturnStatement)',
131+
message:
132+
'withDispatch must return an object with consistent keys. Avoid performing logic in `mapDispatchToProps`.',
133+
},
134+
{
135+
selector:
136+
'LogicalExpression[operator="&&"][left.property.name="length"][right.type="JSXElement"]',
137+
message:
138+
'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
139+
},
140+
];
141+
142+
/** `no-restricted-syntax` rules for components. */
143+
const restrictedSyntaxComponents = [
144+
{
145+
selector:
146+
'JSXOpeningElement[name.name="Button"]:not(:has(JSXAttribute[name.name="__experimentalIsFocusable"])) JSXAttribute[name.name="disabled"]',
147+
message:
148+
'`disabled` used without the `__experimentalIsFocusable` prop. Disabling a control without maintaining focusability can cause accessibility issues, by hiding their presence from screen reader users, or preventing focus from returning to a trigger element. (Ignore this error if you truly mean to disable.)',
149+
},
79150
];
80151

81152
module.exports = {
@@ -87,6 +158,7 @@ module.exports = {
87158
],
88159
globals: {
89160
wp: 'off',
161+
globalThis: 'readonly',
90162
},
91163
settings: {
92164
jsdoc: {
@@ -98,8 +170,12 @@ module.exports = {
98170
rules: {
99171
'jest/expect-expect': 'off',
100172
'react/jsx-boolean-value': 'error',
173+
'react/jsx-curly-brace-presence': [
174+
'error',
175+
{ props: 'never', children: 'never' },
176+
],
101177
'@wordpress/dependency-group': 'error',
102-
'@wordpress/is-gutenberg-plugin': 'error',
178+
'@wordpress/wp-global-usage': 'error',
103179
'@wordpress/react-no-unsafe-timeout': 'error',
104180
'@wordpress/i18n-text-domain': [
105181
'error',
@@ -137,63 +213,7 @@ module.exports = {
137213
disallowTypeAnnotations: false,
138214
},
139215
],
140-
'no-restricted-syntax': [
141-
'error',
142-
// NOTE: We can't include the forward slash in our regex or
143-
// we'll get a `SyntaxError` (Invalid regular expression: \ at end of pattern)
144-
// here. That's why we use \\u002F in the regexes below.
145-
{
146-
selector:
147-
'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]',
148-
message:
149-
'Path access on WordPress dependencies is not allowed.',
150-
},
151-
{
152-
selector:
153-
'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' +
154-
majorMinorRegExp +
155-
'/]',
156-
message:
157-
'Deprecated functions must be removed before releasing this version.',
158-
},
159-
{
160-
selector:
161-
'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
162-
message:
163-
'This method is deprecated. You should use the more explicit API methods available.',
164-
},
165-
{
166-
selector:
167-
'CallExpression[callee.object.name="page"][callee.property.name="waitForTimeout"]',
168-
message: 'Prefer page.waitForSelector instead.',
169-
},
170-
{
171-
selector: 'JSXAttribute[name.name="id"][value.type="Literal"]',
172-
message:
173-
'Do not use string literals for IDs; use withInstanceId instead.',
174-
},
175-
{
176-
// Discourage the usage of `Math.random()` as it's a code smell
177-
// for UUID generation, for which we already have a higher-order
178-
// component: `withInstanceId`.
179-
selector:
180-
'CallExpression[callee.object.name="Math"][callee.property.name="random"]',
181-
message:
182-
'Do not use Math.random() to generate unique IDs; use withInstanceId instead. (If you’re not generating unique IDs: ignore this message.)',
183-
},
184-
{
185-
selector:
186-
'CallExpression[callee.name="withDispatch"] > :function > BlockStatement > :not(VariableDeclaration,ReturnStatement)',
187-
message:
188-
'withDispatch must return an object with consistent keys. Avoid performing logic in `mapDispatchToProps`.',
189-
},
190-
{
191-
selector:
192-
'LogicalExpression[operator="&&"][left.property.name="length"][right.type="JSXElement"]',
193-
message:
194-
'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
195-
},
196-
],
216+
'no-restricted-syntax': [ 'error', ...restrictedSyntax ],
197217
},
198218
overrides: [
199219
{
@@ -243,6 +263,20 @@ module.exports = {
243263
],
244264
},
245265
},
266+
{
267+
files: [
268+
'packages/*/src/**/*.[tj]s?(x)',
269+
'storybook/stories/**/*.[tj]s?(x)',
270+
],
271+
excludedFiles: [ '**/*.native.js' ],
272+
rules: {
273+
'no-restricted-syntax': [
274+
'error',
275+
...restrictedSyntax,
276+
...restrictedSyntaxComponents,
277+
],
278+
},
279+
},
246280
{
247281
files: [
248282
// Components package.
@@ -362,6 +396,7 @@ module.exports = {
362396
rules: {
363397
'no-restricted-syntax': [
364398
'error',
399+
...restrictedSyntax,
365400
{
366401
selector:
367402
':matches(Literal[value=/--wp-admin-theme-/],TemplateElement[value.cooked=/--wp-admin-theme-/])',
@@ -407,6 +442,24 @@ module.exports = {
407442
],
408443
},
409444
},
445+
{
446+
files: [ 'packages/edit-post/**', 'packages/edit-site/**' ],
447+
rules: {
448+
'no-restricted-imports': [
449+
'error',
450+
{
451+
paths: [
452+
...restrictedImports,
453+
{
454+
name: '@wordpress/interface',
455+
message:
456+
'The edit-post and edit-site package should not directly import the interface package. They should import them from the private APIs of the editor package instead.',
457+
},
458+
],
459+
},
460+
],
461+
},
462+
},
410463
{
411464
files: [ 'packages/interactivity*/src/**' ],
412465
rules: {

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ c56e8a1910ed74f405b74bbb12fe81dea974e5c3
1515

1616
# ESLint: Enable react/jsx-boolean-value
1717
9a34927870df80ac3b2da14d71f81d20ec23e2b6
18+
19+
# Autofix eslint curly rule.
20+
0221522f253e094b277a1485b7a2d186cb172632
21+
22+
# ESLint: Enable react/jsx-curly-brace-presence
23+
5d4baa9ab5f57d207cc3a048003216a8574574d9

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
/packages/block-editor/src/components/link-control @getdave
4848

4949
# Widgets
50-
/packages/edit-widgets @draganescu @talldan @adamziel @kevin940726
50+
/packages/edit-widgets @draganescu @adamziel @kevin940726
5151
/packages/customize-widgets
5252
/packages/widgets
5353

.github/setup-node/action.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
using: 'composite'
1111
steps:
1212
- name: Use desired version of Node.js
13-
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
13+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
1414
with:
1515
node-version-file: '.nvmrc'
1616
node-version: ${{ inputs.node-version }}
@@ -25,15 +25,22 @@ runs:
2525

2626
- name: Cache node_modules
2727
id: cache-node_modules
28-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
28+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
2929
with:
3030
path: '**/node_modules'
31-
key: node_modules-${{ runner.os }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
31+
key: node_modules-${{ runner.os }}-${{ runner.arch }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
3232

3333
- name: Install npm dependencies
3434
if: ${{ steps.cache-node_modules.outputs.cache-hit != 'true' }}
35-
run: npm ci
35+
run: |
36+
npm ci
3637
shell: bash
38+
- name: Upload npm logs as an artifact on failure
39+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
40+
if: failure()
41+
with:
42+
name: npm-logs
43+
path: C:\npm\cache\_logs
3744

3845
# On cache hit, we run the post-install script to match the native `npm ci` behavior.
3946
# An example of this is to patch `node_modules` using patch-package.

.github/workflows/build-plugin-zip.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969

7070
steps:
7171
- name: Checkout code
72-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
72+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
7373
with:
7474
token: ${{ secrets.GUTENBERG_TOKEN }}
7575
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
@@ -165,7 +165,7 @@ jobs:
165165

166166
steps:
167167
- name: Checkout code
168-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
168+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
169169
with:
170170
ref: ${{ needs.bump-version.outputs.release_branch || github.ref }}
171171
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
@@ -183,7 +183,7 @@ jobs:
183183
NO_CHECKS: 'true'
184184

185185
- name: Upload artifact
186-
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
186+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
187187
with:
188188
name: gutenberg-plugin
189189
path: ./gutenberg.zip
@@ -206,7 +206,7 @@ jobs:
206206
207207
- name: Upload release notes artifact
208208
if: ${{ needs.bump-version.outputs.new_version }}
209-
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
209+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
210210
with:
211211
name: release-notes
212212
path: ./release-notes.txt
@@ -222,7 +222,7 @@ jobs:
222222
223223
steps:
224224
- name: Checkout code
225-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
225+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
226226
with:
227227
fetch-depth: 2
228228
ref: ${{ needs.bump-version.outputs.release_branch }}
@@ -270,12 +270,12 @@ jobs:
270270
run: echo "version=$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' )" >> $GITHUB_OUTPUT
271271

272272
- name: Download Plugin Zip Artifact
273-
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
273+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
274274
with:
275275
name: gutenberg-plugin
276276

277277
- name: Download Release Notes Artifact
278-
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
278+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
279279
with:
280280
name: release-notes
281281

@@ -311,14 +311,14 @@ jobs:
311311
if: ${{ endsWith( needs.bump-version.outputs.new_version, '-rc.1' ) }}
312312
steps:
313313
- name: Checkout (for CLI)
314-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
314+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
315315
with:
316316
path: main
317317
ref: trunk
318318
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
319319

320320
- name: Checkout (for publishing)
321-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
321+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
322322
with:
323323
path: publish
324324
# Later, we switch this branch in the script that publishes packages.

.github/workflows/bundle-size.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838

3939
steps:
40-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
40+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
4141
with:
4242
fetch-depth: 1
4343
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
@@ -49,7 +49,7 @@ jobs:
4949
check-latest: true
5050
cache: npm
5151

52-
- uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2.5.0
52+
- uses: preactjs/compressed-size-action@f780fd104362cfce9e118f9198df2ee37d12946c # v2.6.0
5353
with:
5454
repo-token: '${{ secrets.GITHUB_TOKEN }}'
5555
pattern: '{build/**/*.min.js,build/**/*.css}'

0 commit comments

Comments
 (0)