From 2c4623641bf6495021bbb4ce5f4e14c531cc5ddf Mon Sep 17 00:00:00 2001 From: jeremyfelt Date: Sat, 1 Aug 2026 10:16:25 -0700 Subject: [PATCH 1/2] Use the consolidated PHP and JavaScript check workflows Replaces the single-purpose check workflows with the consolidated php-checks and js-checks workflows from happyprime/workflows. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/js-checks.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/js-checks.yml diff --git a/.github/workflows/js-checks.yml b/.github/workflows/js-checks.yml new file mode 100644 index 0000000..2a5fcee --- /dev/null +++ b/.github/workflows/js-checks.yml @@ -0,0 +1,23 @@ +# Run ESLint, Stylelint, package.json linting, and unit tests in a single job. +# +# Each check runs only when the project defines an npm script for it, so this +# file is safe to sync to a repository that has only some of them. A check the +# project is half set up for is reported on the pull request rather than failed. +# +# This file is managed in https://github.com/happyprime/projects +name: JavaScript checks + +on: pull_request + +# The consolidated workflow comments on the pull request when a project is set +# up for a check it cannot run. A workflow level permissions block caps what a +# reusable workflow receives, so the write scope is granted here. +permissions: + contents: read + pull-requests: write + +jobs: + call-workflow: + uses: happyprime/workflows/.github/workflows/js-checks.yml@trunk + with: + node-version: 24 From 66ed1accee90f398104fbf6df5f45c3988b189a9 Mon Sep 17 00:00:00 2001 From: jeremyfelt Date: Sat, 1 Aug 2026 12:07:37 -0700 Subject: [PATCH 2/2] Add package.json linting and refresh check tooling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - NEEDS DECISION: license is 'MIT', the shared config only accepts 'GPL-2.0-or-later' — left unchanged - keywords=['happyprime', 'javascript'] - homepage='https://github.com/happyprime/setup-tabbed-groups/' - bugs='https://github.com/happyprime/setup-tabbed-groups/issues' - lint:js='eslint .' - lint:package scoped to the repository's own package.json - devDeps: @wordpress/npm-package-json-lint-config - npmpackagejsonlint config added Co-Authored-By: Claude Opus 5 (1M context) --- docs/js/index.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 15 +++++++++++++++ package.json | 17 +++++++++++++++-- 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/docs/js/index.js b/docs/js/index.js index 573baec..b266260 100644 --- a/docs/js/index.js +++ b/docs/js/index.js @@ -1 +1,47 @@ -{const e=document.querySelectorAll(".js-tabbed-groups"),t=(t,l)=>{e[l].querySelectorAll(":scope >.wp-block-buttons > .wp-block-button > .wp-block-button__link").forEach(((e,l)=>{const n=e.closest(".wp-block-buttons").nextElementSibling;t!==l?(e.ariaSelected=!1,n.classList.add("is-inactive")):(e.ariaSelected=!0,n.classList.remove("is-inactive"))}))},l=(e,l,n)=>{const a=e.closest(".wp-block-buttons").nextElementSibling;e.id="tab-"+n+"-"+l,e.tabIndex=0,e.role="tab",e.setAttribute("aria-controls","panel-"+n+"-"+l),a.role="tabpanel",a.id="panel-"+n+"-"+l,a.setAttribute("aria-labelledby","tab-"+n+"-"+l),0!==l?(e.ariaSelected=!1,a.classList.add("is-inactive")):e.ariaSelected=!0,e.addEventListener("click",(function(e){e.preventDefault(),t(l,n)})),e.addEventListener("keydown",(function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(l,n))}))};e.forEach(((e,t)=>{const n=e.querySelectorAll(".js-tabbed-groups > .wp-block-buttons .wp-element-button");n.length&&(e.role="tablist",n.forEach(((e,n)=>{l(e,n,t)})))}))} \ No newline at end of file +{ + const e = document.querySelectorAll('.js-tabbed-groups'), + t = (t, l) => { + e[l] + .querySelectorAll( + ':scope >.wp-block-buttons > .wp-block-button > .wp-block-button__link' + ) + .forEach((e, l) => { + const n = e.closest('.wp-block-buttons').nextElementSibling; + t !== l + ? ((e.ariaSelected = !1), + n.classList.add('is-inactive')) + : ((e.ariaSelected = !0), + n.classList.remove('is-inactive')); + }); + }, + l = (e, l, n) => { + const a = e.closest('.wp-block-buttons').nextElementSibling; + (e.id = 'tab-' + n + '-' + l), + (e.tabIndex = 0), + (e.role = 'tab'), + e.setAttribute('aria-controls', 'panel-' + n + '-' + l), + (a.role = 'tabpanel'), + (a.id = 'panel-' + n + '-' + l), + a.setAttribute('aria-labelledby', 'tab-' + n + '-' + l), + 0 !== l + ? ((e.ariaSelected = !1), a.classList.add('is-inactive')) + : (e.ariaSelected = !0), + e.addEventListener('click', function (e) { + e.preventDefault(), t(l, n); + }), + e.addEventListener('keydown', function (e) { + ('Enter' !== e.key && ' ' !== e.key) || + (e.preventDefault(), t(l, n)); + }); + }; + e.forEach((e, t) => { + const n = e.querySelectorAll( + '.js-tabbed-groups > .wp-block-buttons .wp-element-button' + ); + n.length && + ((e.role = 'tablist'), + n.forEach((e, n) => { + l(e, n, t); + })); + }); +} diff --git a/package-lock.json b/package-lock.json index 00efdc6..7cabf93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "devDependencies": { "@happyprime/eslint-config": "^0.0.10", + "@wordpress/npm-package-json-lint-config": "^5.10.0", "npm-package-json-lint": "^8.0.0", "npm-package-json-lint-config-default": "^7.0.1", "terser": "^5.34.1" @@ -395,6 +396,20 @@ "dev": true, "peer": true }, + "node_modules/@wordpress/npm-package-json-lint-config": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@wordpress/npm-package-json-lint-config/-/npm-package-json-lint-config-5.52.0.tgz", + "integrity": "sha512-+3fv1jmdmsvSIhlZ2PpYKVQ6VQ1zKJFMTbHoJKSSiUA0Os5ASgAAH6S/+s4B0EGHZ94G3SV3k8oaiOnwOghE5Q==", + "dev": true, + "license": "GPL-2.0-or-later", + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "npm-package-json-lint": ">=6.0.0" + } + }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", diff --git a/package.json b/package.json index fc538ca..d519986 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,25 @@ "description": "Setup a tabbed groups interface based on specific markup provided by the WordPress block editor", "author": "Happy Prime", "license": "MIT", + "keywords": [ + "happyprime", + "javascript" + ], + "homepage": "https://github.com/happyprime/setup-tabbed-groups/", "repository": { "type": "git", "url": "https://github.com/happyprime/setup-tabbed-groups.git" }, + "bugs": { + "url": "https://github.com/happyprime/setup-tabbed-groups/issues" + }, "files": [ "build" ], "main": "build/index.js", "devDependencies": { "@happyprime/eslint-config": "^0.0.10", + "@wordpress/npm-package-json-lint-config": "^5.10.0", "npm-package-json-lint": "^8.0.0", "npm-package-json-lint-config-default": "^7.0.1", "terser": "^5.34.1" @@ -22,8 +31,12 @@ "build": "npm run build:main && npm run build:docs", "build:main": "terser --compress --mangle -o build/index.js -- src/index.js", "build:docs": "terser --compress --mangle -o docs/js/index.js -- src/index.js", - "lint": "eslint .", + "lint": "npm run lint:js", "fix": "eslint . --fix", - "lint:package": "node ./node_modules/npm-package-json-lint/dist/cli.js ./" + "lint:package": "node ./node_modules/npm-package-json-lint/dist/cli.js ./package.json", + "lint:js": "eslint ." + }, + "npmpackagejsonlint": { + "extends": "@wordpress/npm-package-json-lint-config" } }