From f219c89ec023560e93d4032645d277b278243b53 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 16:49:02 -0400 Subject: [PATCH 01/11] Remove unused view.js Most of these blocks don't use this boilerplate file, which only had a console.log statement. In those cases, we remove the file entirely, as well as the entry in block.json which called for it to be loaded. --- .../featured-and-events-section/block.json | 1 - .../featured-and-events-section/view.js | 25 ------------------- .../featured-collection-section/block.json | 3 +-- .../featured-collection-section/view.js | 25 ------------------- .../blocks/hero-section/block.json | 1 - .../mitlib-blocks/blocks/hero-section/view.js | 25 ------------------- .../using-the-libraries-section/block.json | 3 +-- .../using-the-libraries-section/view.js | 25 ------------------- 8 files changed, 2 insertions(+), 106 deletions(-) delete mode 100644 web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js delete mode 100644 web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js delete mode 100644 web/app/plugins/mitlib-blocks/blocks/hero-section/view.js delete mode 100644 web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json index 1c4de72e..e3ca6cd0 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json @@ -25,6 +25,5 @@ "editorScript": "file:./index.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", - "viewScript": "file:./view.js", "render": "file:./render.php" } diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js deleted file mode 100644 index 85cb3620..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-featured-and-events-section block)' ); -/* eslint-enable no-console */ diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json index 30f01b97..bcd5aab9 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json @@ -14,6 +14,5 @@ "textdomain": "mitlib-blocks", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js deleted file mode 100644 index c6a1baa3..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-featured-collection-section block)' ); -/* eslint-enable no-console */ diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json b/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json index 2586f08a..e133a25f 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json @@ -21,6 +21,5 @@ "editorScript": "file:./index.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", - "viewScript": "file:./view.js", "render": "file:./render.php" } diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/view.js b/web/app/plugins/mitlib-blocks/blocks/hero-section/view.js deleted file mode 100644 index ae94783d..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-hero-section block)' ); -/* eslint-enable no-console */ diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json index d86c23ae..e5f71a27 100644 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json @@ -36,6 +36,5 @@ "textdomain": "mitlib-blocks", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js deleted file mode 100644 index 573b3df4..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-using-the-libraries-section block)' ); -/* eslint-enable no-console */ From 3a78843925ff898aadcf646411fcb17cb78cb74a Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 16:49:18 -0400 Subject: [PATCH 02/11] Remove "main" entry from package.json These blocks aren't part of a javascript application stack, so there is no need to declare an entry point into their materials. --- web/app/plugins/mitlib-blocks/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/web/app/plugins/mitlib-blocks/package.json b/web/app/plugins/mitlib-blocks/package.json index 76987e01..43f9b8d9 100644 --- a/web/app/plugins/mitlib-blocks/package.json +++ b/web/app/plugins/mitlib-blocks/package.json @@ -4,7 +4,6 @@ "description": "Custom MIT Libraries editor blocks.", "author": "MIT Libraries", "license": "GPL-2.0-or-later", - "main": "build/index.js", "scripts": { "build": "wp-scripts build --blocks-manifest --source-path=blocks", "format": "wp-scripts format", From 87f6238e6bb5ecef4faed3169beceec45127e197 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 16:50:06 -0400 Subject: [PATCH 03/11] Declare dependencies with versions The boilerplace declares wordpress dependencies to _always_ use the latest version, which causes problems in our CI workflow because a new release may have become available between when the developer started a branch and when the CI runs to evaluate it. Keeping branches short-lived is only a partial solution. The more robust option is to declare our dependencies using a predictable version. This provides for consistency between environments (among developers, and with our CI workflows). The cost of this is that we need to manage dependency updates ourselves, but this is already something we are doing. --- web/app/plugins/mitlib-blocks/package.json | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/web/app/plugins/mitlib-blocks/package.json b/web/app/plugins/mitlib-blocks/package.json index 43f9b8d9..32c0d4c7 100644 --- a/web/app/plugins/mitlib-blocks/package.json +++ b/web/app/plugins/mitlib-blocks/package.json @@ -13,15 +13,13 @@ "plugin-zip": "wp-scripts plugin-zip", "start": "wp-scripts start --blocks-manifest --source-path=blocks" }, - "dependencies": { - "@wordpress/block-editor": "latest", - "@wordpress/blocks": "latest", - "@wordpress/components": "latest", - "@wordpress/core-data": "latest", - "@wordpress/data": "latest", - "@wordpress/i18n": "latest" - }, "devDependencies": { + "@wordpress/block-editor": "^17.0.0", + "@wordpress/blocks": "^15.27.0", + "@wordpress/components": "^40.0.0", + "@wordpress/core-data": "^8.0.0", + "@wordpress/data": "^10.54.0", + "@wordpress/i18n": "^6.27.0", "@wordpress/scripts": "^34.2.0" } } From 07e3c2e89c217e4b470643ff815e1918f9a6da34 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 17:02:35 -0400 Subject: [PATCH 04/11] npm run format The javascript community has a set of formatting rules which they've adopted, and their tooling will automatically apply that formatting. This commit applies the changes necessary for `npm run lint:js` to return no output. (We can tweak the rules that it applies as we go forward - some of these seem pretty silly to me - but having those discussions will take time to reflect and reach consensus, and we want to get this branch done quickly for the moment. --- .../featured-and-events-section/edit.js | 30 ++++- .../featured-collection-section/edit.js | 2 +- .../featured-collection-section/save.js | 28 ++++- .../mitlib-blocks/blocks/hero-section/edit.js | 22 ++-- .../mitlib-blocks/blocks/hero-section/save.js | 2 +- .../blocks/hours-section/edit.js | 64 +++++----- .../blocks/hours-section/save.js | 62 ++++++++-- .../using-the-libraries-section/edit.js | 99 ++++++++++------ .../using-the-libraries-section/save.js | 109 +++++++++++++----- 9 files changed, 290 insertions(+), 128 deletions(-) diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/edit.js index 27b810b0..9a5b8ab4 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/edit.js @@ -4,7 +4,11 @@ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ */ import { __ } from '@wordpress/i18n'; -import { useBlockProps, RichText, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + RichText, + InspectorControls, +} from '@wordpress/block-editor'; import { PanelBody, SelectControl, Spinner } from '@wordpress/components'; import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; @@ -14,10 +18,22 @@ export default function Edit( { attributes, setAttributes } ) { const { heading, featuredExpertId } = attributes; const { experts, hasResolvedExperts } = useSelect( ( select ) => { - const query = { per_page: -1, status: 'publish', orderby: 'title', order: 'asc' }; + const query = { + per_page: -1, + status: 'publish', + orderby: 'title', + order: 'asc', + }; return { - experts: select( coreStore ).getEntityRecords( 'postType', 'experts', query ), - hasResolvedExperts: select( coreStore ).hasFinishedResolution( 'getEntityRecords', [ 'postType', 'experts', query ] ), + experts: select( coreStore ).getEntityRecords( + 'postType', + 'experts', + query + ), + hasResolvedExperts: select( coreStore ).hasFinishedResolution( + 'getEntityRecords', + [ 'postType', 'experts', query ] + ), }; }, [] ); @@ -38,7 +54,11 @@ export default function Edit( { attributes, setAttributes } ) { label={ __( 'Featured expert', 'mitlib-blocks' ) } value={ featuredExpertId } options={ expertOptions } - onChange={ ( value ) => setAttributes( { featuredExpertId: Number( value ) } ) } + onChange={ ( value ) => + setAttributes( { + featuredExpertId: Number( value ), + } ) + } /> ) : ( diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js index e7bb602e..b96cf610 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js @@ -31,6 +31,6 @@ export default function Edit() { return (

Featured collection (No title to edit)

-
+ ); } diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js index 6c9642c2..b98f70c7 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js @@ -19,15 +19,35 @@ export default function save() { return ( diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js index 68226f46..d91337a4 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js @@ -14,16 +14,16 @@ import { useBlockProps, RichText } from '@wordpress/block-editor'; import './editor.scss'; export default function Edit( { attributes, setAttributes } ) { - const blockProps = useBlockProps(); + const blockProps = useBlockProps(); - return ( -
- setAttributes( { heading } ) } - placeholder={ __( 'Enter heading…', 'mitlib-blocks' ) } - /> -
- ); + return ( +
+ setAttributes( { heading } ) } + placeholder={ __( 'Enter heading…', 'mitlib-blocks' ) } + /> +
+ ); } diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js b/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js index 34a57a53..fa631549 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js @@ -16,5 +16,5 @@ import { useBlockProps } from '@wordpress/block-editor'; * @return {Element} Element to render. */ export default function save() { - return null; + return null; } diff --git a/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js index d2042d8c..98f66d54 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js @@ -4,7 +4,11 @@ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ */ import { __ } from '@wordpress/i18n'; -import { useBlockProps, RichText, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + RichText, + InspectorControls, +} from '@wordpress/block-editor'; import { PanelBody, TextControl } from '@wordpress/components'; import './editor.scss'; @@ -13,32 +17,38 @@ export default function Edit( { attributes, setAttributes } ) { return ( <> - - - setAttributes( { linkText: value } ) } - /> - setAttributes( { linkUrl: value } ) } - type="url" - /> - - -
-
- setAttributes( { heading: value } ) } - placeholder={ __( 'Today\'s hours', 'mitlib-blocks' ) } - allowedFormats={ [] } - /> -
-
+ + + + setAttributes( { linkText: value } ) + } + /> + + setAttributes( { linkUrl: value } ) + } + type="url" + /> + + +
+
+ + setAttributes( { heading: value } ) + } + placeholder={ __( "Today's hours", 'mitlib-blocks' ) } + allowedFormats={ [] } + /> +
+
); } diff --git a/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js b/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js index c6ad2181..fc93d5da 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js @@ -15,36 +15,74 @@ export default function save( { attributes } ) {
  1. - Hayden Library - + + + Hayden Library + + + + + - + 24/7 study
  2. - Rotch Library - + + + Rotch Library + + + + + - + 24/7 study
  3. - Barker Library - + + + Barker Library + + + + + - + 24/7 study
  4. - Lewis Music Library - + + + Lewis Music Library + + + + +
- { linkText } + + { linkText } + ); diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js index fb8efba7..8d7893fa 100644 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js @@ -4,51 +4,74 @@ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ */ import { __ } from '@wordpress/i18n'; -import { useBlockProps, RichText, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + RichText, + InspectorControls, +} from '@wordpress/block-editor'; import { PanelBody, TextControl, TextareaControl } from '@wordpress/components'; import './editor.scss'; export default function Edit( { attributes, setAttributes } ) { - const { heading, askUsTitle, askUsDescription, askUsLinkText, askUsLinkUrl } = attributes; + const { + heading, + askUsTitle, + askUsDescription, + askUsLinkText, + askUsLinkUrl, + } = attributes; return ( <> - - - setAttributes( { askUsTitle: value } ) } - /> - setAttributes( { askUsDescription: value } ) } - /> - setAttributes( { askUsLinkText: value } ) } - /> - setAttributes( { askUsLinkUrl: value } ) } - type="url" - /> - - -
-
- setAttributes( { heading: value } ) } - placeholder={ __( 'Using the Libraries', 'mitlib-blocks' ) } - allowedFormats={ [] } - /> -
-
+ + + + setAttributes( { askUsTitle: value } ) + } + /> + + setAttributes( { askUsDescription: value } ) + } + /> + + setAttributes( { askUsLinkText: value } ) + } + /> + + setAttributes( { askUsLinkUrl: value } ) + } + type="url" + /> + + +
+
+ + setAttributes( { heading: value } ) + } + placeholder={ __( + 'Using the Libraries', + 'mitlib-blocks' + ) } + allowedFormats={ [] } + /> +
+
); } diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js index 0efb0ef2..6700a6bc 100644 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js @@ -7,45 +7,96 @@ import { useBlockProps, RichText } from '@wordpress/block-editor'; export default function save( { attributes } ) { - const { heading, askUsTitle, askUsDescription, askUsLinkText, askUsLinkUrl } = attributes; + const { + heading, + askUsTitle, + askUsDescription, + askUsLinkText, + askUsLinkUrl, + } = attributes; return (
-
-
- -
-

Find a study space

-

Quiet and group spaces—many available 24/7

+
+
+ +
+

+ Find a study space +

+

+ Quiet and group spaces—many available 24/7 +

+
-
-
- -
-

Learn how to get materials

-

Find, request, and get articles, books, and more

+
+ +
+

+ + Learn how to get materials + +

+

+ Find, request, and get articles, books, and + more +

+
-
-
- -
-

Discover guides & librarians

-

Resource and class guides with experts for every subject

+
+ +
+

+ + Discover guides & librarians + +

+

+ Resource and class guides with experts for + every subject +

+
-
-
- -
-

Find and manage data

-

Get support from creating and visualizing to using and sharing data

+
+ +
+

+ + Find and manage data + +

+

+ Get support from creating and visualizing to + using and sharing data +

+
-
-
-
- +
+
+

{ askUsTitle }

{ askUsDescription }

From e1b39dd844a6105241750a5b0e7a8f5b74618000 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 20:30:44 -0400 Subject: [PATCH 05/11] replace class with className in javascript files This is part of the NPM linter, but there were so many of these changes that it seemed better to split them out into their own commit. --- .../featured-collection-section/save.js | 14 ++++----- .../using-the-libraries-section/edit.js | 2 +- .../using-the-libraries-section/save.js | 30 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js index b98f70c7..3830d12f 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js @@ -18,18 +18,18 @@ import { useBlockProps } from '@wordpress/block-editor'; export default function save() { return (