From 3a06084363c316d18d930761e841a3b715008025 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 11 Sep 2024 12:19:54 -0400 Subject: [PATCH] Update `@wordpress/eslint-plugin` (#39305) This brings two new rules that needed fixing: * `@wordpress/i18n-no-flanking-whitespace` complains about leading or trailing whitespace in JS i18n messages. Fix depends on context: * Sometimes it makes no difference, the browser (or React) strips it out. Removed these. * Sometimes it does, or it's unclear. In these cases I added it back outside the i18n call. * `@wordpress/i18n-hyphenated-range` wants en-dashes (or em-dashes) for numeric ranges. Switched them to en-dashes. --- pnpm-lock.yaml | 10 +++++----- .../changelog/update-wordpress-eslint-plugin | 4 ++++ .../packages/backup/src/js/components/Backups.js | 2 +- .../forms/changelog/update-wordpress-eslint-plugin | 4 ++++ .../jetpack-salesforce-lead-form-settings.js | 2 +- .../changelog/update-wordpress-eslint-plugin | 4 ++++ .../dashboard/components/upsell-nudge/index.jsx | 4 ++-- .../src/instant-search/components/search-sort.jsx | 2 +- .../_inc/client/at-a-glance/boost/index.jsx | 2 +- .../jetpack/_inc/client/at-a-glance/search.jsx | 2 +- .../jetpack/_inc/client/my-plan/my-plan-body.jsx | 2 +- .../jetpack/_inc/client/performance/search.jsx | 2 +- .../changelog/update-wordpress-eslint-plugin | 4 ++++ .../components/prompt-templates-control/index.tsx | 14 +++++++------- .../podcast-player/components/track-error.js | 2 +- .../components/breve/controls.tsx | 2 +- .../changelog/update-wordpress-eslint-plugin | 4 ++++ .../src/js/components/migration/index.tsx | 2 +- .../changelog/update-wordpress-eslint-plugin | 4 ++++ .../src/js/components/firewall-footer/index.jsx | 4 ++-- .../src/js/components/scan-footer/index.jsx | 6 +++--- .../changelog/update-wordpress-eslint-plugin | 4 ++++ .../plugins/super-cache/js/preload-notification.js | 2 +- tools/js-tools/package.json | 2 +- 24 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 projects/packages/backup/changelog/update-wordpress-eslint-plugin create mode 100644 projects/packages/forms/changelog/update-wordpress-eslint-plugin create mode 100644 projects/packages/search/changelog/update-wordpress-eslint-plugin create mode 100644 projects/plugins/jetpack/changelog/update-wordpress-eslint-plugin create mode 100644 projects/plugins/migration/changelog/update-wordpress-eslint-plugin create mode 100644 projects/plugins/protect/changelog/update-wordpress-eslint-plugin create mode 100644 projects/plugins/super-cache/changelog/update-wordpress-eslint-plugin diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2bb84136eb2ab..0d50f7f558382 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4844,8 +4844,8 @@ importers: specifier: 6.21.0 version: 6.21.0(eslint@8.57.0)(typescript@5.0.4) '@wordpress/eslint-plugin': - specifier: 20.3.0 - version: 20.3.0(2g4wiqq3ubewvaaot6et2pay5m) + specifier: 21.0.0 + version: 21.0.0(2g4wiqq3ubewvaaot6et2pay5m) '@wordpress/jest-console': specifier: 8.7.0 version: 8.7.0(jest@29.7.0) @@ -7868,8 +7868,8 @@ packages: resolution: {integrity: sha512-VqLQGNMs1BF6LnS+5eNjpM/sCUQhjn4QOfhDlWdVDi0ZxpZgssPzKhJ1ils/7FC0qF3vrMg8EH5xXxw2xz8A/w==} engines: {node: '>=18.12.0', npm: '>=8.19.2'} - '@wordpress/eslint-plugin@20.3.0': - resolution: {integrity: sha512-Y272ZtosmXPJJ0K5X7j0ufcpuDf1unEEDOmdyStHhYV3DGjfETPKgMBVjpmWIObu5oMlqqkTiiQaNb+lho3EIQ==} + '@wordpress/eslint-plugin@21.0.0': + resolution: {integrity: sha512-4ioakbwSZNL8eXkfK0hcY93e5Fj9dZljxj3lEFkCBWMkSpU8/pPw/7UMS0OBbGQK8rqmvnXF1y/LFH7ihCxuww==} engines: {node: '>=18.12.0', npm: '>=8.19.2'} peerDependencies: '@babel/core': '>=7' @@ -19243,7 +19243,7 @@ snapshots: dependencies: '@babel/runtime': 7.24.7 - '@wordpress/eslint-plugin@20.3.0(2g4wiqq3ubewvaaot6et2pay5m)': + '@wordpress/eslint-plugin@21.0.0(2g4wiqq3ubewvaaot6et2pay5m)': dependencies: '@babel/core': 7.24.7 '@babel/eslint-parser': 7.24.7(@babel/core@7.24.7)(eslint@8.57.0) diff --git a/projects/packages/backup/changelog/update-wordpress-eslint-plugin b/projects/packages/backup/changelog/update-wordpress-eslint-plugin new file mode 100644 index 0000000000000..79c05e77ac0cb --- /dev/null +++ b/projects/packages/backup/changelog/update-wordpress-eslint-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Remove unnecessary leading space from i18n message. diff --git a/projects/packages/backup/src/js/components/Backups.js b/projects/packages/backup/src/js/components/Backups.js index 9d809fb9a2ce9..bfe641cdb4f18 100644 --- a/projects/packages/backup/src/js/components/Backups.js +++ b/projects/packages/backup/src/js/components/Backups.js @@ -62,7 +62,7 @@ const NoGoodBackups = () => {

{ createInterpolateElement( __( - ' Get in touch with us to get your site backups going again.', + 'Get in touch with us to get your site backups going again.', 'jetpack-backup-pkg' ), { diff --git a/projects/packages/forms/changelog/update-wordpress-eslint-plugin b/projects/packages/forms/changelog/update-wordpress-eslint-plugin new file mode 100644 index 0000000000000..b7741525f5678 --- /dev/null +++ b/projects/packages/forms/changelog/update-wordpress-eslint-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Use en-dash in numeric range in i18n message to conform to guidelines. diff --git a/projects/packages/forms/src/blocks/contact-form/components/jetpack-salesforce-lead-form/jetpack-salesforce-lead-form-settings.js b/projects/packages/forms/src/blocks/contact-form/components/jetpack-salesforce-lead-form/jetpack-salesforce-lead-form-settings.js index 4feab8bb8a60a..989d8aa665215 100644 --- a/projects/packages/forms/src/blocks/contact-form/components/jetpack-salesforce-lead-form/jetpack-salesforce-lead-form-settings.js +++ b/projects/packages/forms/src/blocks/contact-form/components/jetpack-salesforce-lead-form/jetpack-salesforce-lead-form-settings.js @@ -141,7 +141,7 @@ export default ( { salesforceData, setAttributes, instanceId } ) => { { organizationIdError && ( { __( - 'Invalid Organization ID. Should be a 15 - 18 characters long alphanumeric string.', + 'Invalid Organization ID. Should be a 15 – 18 characters long alphanumeric string.', 'jetpack-forms' ) } diff --git a/projects/packages/search/changelog/update-wordpress-eslint-plugin b/projects/packages/search/changelog/update-wordpress-eslint-plugin new file mode 100644 index 0000000000000..fb574fa3a5eb5 --- /dev/null +++ b/projects/packages/search/changelog/update-wordpress-eslint-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Move trailing spaces out of i18n messages. diff --git a/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx b/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx index df266550d91ba..e7751ce44f534 100644 --- a/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx +++ b/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx @@ -14,10 +14,10 @@ export default function InstantSearchUpsellNudge( props = { upgrade: true } ) { { __( - 'Offer instant search results to your visitors as soon as they start typing. ', + 'Offer instant search results to your visitors as soon as they start typing.', 'jetpack-search-pkg' ) } - + { ' ' } { __( 'Try Jetpack Instant Search for free now', 'jetpack-search-pkg' ) } diff --git a/projects/packages/search/src/instant-search/components/search-sort.jsx b/projects/packages/search/src/instant-search/components/search-sort.jsx index 39445a74a18d6..2301567f44a6a 100644 --- a/projects/packages/search/src/instant-search/components/search-sort.jsx +++ b/projects/packages/search/src/instant-search/components/search-sort.jsx @@ -59,7 +59,7 @@ export default class SearchSort extends Component { aria-controls="jetpack-instant-search__search-results-content" className="jetpack-instant-search__search-sort jetpack-instant-search__search-sort-with-links" > -

{ __( 'Sort by: ', 'jetpack-search-pkg' ) }
+
{ __( 'Sort by:', 'jetpack-search-pkg' ) }
{ [ ...sortOptions.entries() ].map( ( [ sortKey, label ] ) => ( <>
diff --git a/projects/plugins/super-cache/changelog/update-wordpress-eslint-plugin b/projects/plugins/super-cache/changelog/update-wordpress-eslint-plugin new file mode 100644 index 0000000000000..1b5211fc7fb1d --- /dev/null +++ b/projects/plugins/super-cache/changelog/update-wordpress-eslint-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Move trailing space out of i18n message. diff --git a/projects/plugins/super-cache/js/preload-notification.js b/projects/plugins/super-cache/js/preload-notification.js index 0aebefe29fb41..50ad92d2d864d 100644 --- a/projects/plugins/super-cache/js/preload-notification.js +++ b/projects/plugins/super-cache/js/preload-notification.js @@ -108,7 +108,7 @@ jQuery( document ).ready( function () { if ( data.previous ) { const p = jQuery( '

' ); - p.append( jQuery( '' ).text( __( 'Last preload finished: ', 'wp-super-cache' ) ) ); + p.append( jQuery( '' ).text( __( 'Last preload finished:', 'wp-super-cache' ) + ' ' ) ); p.append( jQuery( '' ).text( new Date( data.previous * 1000 ).toLocaleString() ) ); panel.append( p ); } diff --git a/tools/js-tools/package.json b/tools/js-tools/package.json index 1105a227da2cc..b40ead7153009 100644 --- a/tools/js-tools/package.json +++ b/tools/js-tools/package.json @@ -22,7 +22,7 @@ "@testing-library/jest-dom": "6.5.0", "@typescript-eslint/eslint-plugin": "6.21.0", "@typescript-eslint/parser": "6.21.0", - "@wordpress/eslint-plugin": "20.3.0", + "@wordpress/eslint-plugin": "21.0.0", "@wordpress/jest-console": "8.7.0", "babel-jest": "29.4.3", "chalk": "4.1.2",