Skip to content

Add coding standards and other dev tools - #7

Merged
joedolson merged 7 commits into
mainfrom
add/coding-standards
Aug 27, 2026
Merged

Add coding standards and other dev tools#7
joedolson merged 7 commits into
mainfrom
add/coding-standards

Conversation

@troychaplin

Copy link
Copy Markdown
Member

What?

Adds the coding-standards toolchain for the plugin: Composer + PHPCS + PHPStan baseline, EditorConfig/.nvmrc, ESLint + Stylelint + lint-staged, a Husky pre-commit hook, a CI GitHub Actions workflow, GitHub issue templates (bug report / feature request), a PR template, and a base CONTRIBUTING.md.

Why?

Establishes consistent PHP/JS/CSS style and static analysis across the codebase, and gives contributors structured templates and documentation for filing issues and PRs, ahead of more people working on the plugin.

How?

  • PHP: composer.json, phpcs.xml.dist, phpstan.neon.dist
  • JS/CSS: package.json, eslint.config.js, .stylelintrc.json, .editorconfig, .nvmrc
  • Pre-commit: .husky/pre-commit (lint-staged + project-wide PHPStan)
  • CI: .github/workflows/ci.yml
  • Templates/docs: .github/ISSUE_TEMPLATE/bug_report.yml, .github/ISSUE_TEMPLATE/feature_request.yml, .github/PULL_REQUEST_TEMPLATE.md, CONTRIBUTING.md

Testing Instructions

  1. nvm use && composer install && npm i
  2. Run npm run lint (JS, CSS, PHPCS, PHPStan) and composer phpstan to confirm the toolchain executes correctly.
    • Note: this currently surfaces pre-existing lint/PHPStan violations in the codebase — see Notes for Reviewers below.
  3. Confirm the CI workflow runs via the Actions tab → CIRun workflow (workflow_dispatch).

Changelog Entry

Developer - Add PHPCS/PHPStan/ESLint/Stylelint tooling, a pre-commit hook, a CI workflow, and GitHub issue/PR templates.

Checklist

  • I have read the Contributing Guidelines
  • npm run lint passes locally (JS, CSS, PHPCS, PHPStan) — not yet green repo-wide, see notes below
  • I have manually verified this change using the steps in Testing Instructions
  • I have updated relevant documentation (added CONTRIBUTING.md)

Notes for Reviewers

  • CI is intentionally disabled (workflow_dispatch only) pending team review of the trigger conditions. See the commented-out on: block in ci.yml for the intended final config (push to main + pull requests). Will flip this once approved.
  • The Husky pre-commit hook is present but fully commented out for the same reason — enabling it now would block every commit against the current lint/PHPStan state.
  • After this PR merges, I'll take a pass at fixing the existing lint/PHPStan violations, likely split across smaller follow-up PRs rather than one large cleanup.

@troychaplin troychaplin mentioned this pull request Aug 18, 2026
@troychaplin
troychaplin requested a lite review from Copilot August 18, 2026 03:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@troychaplin

Copy link
Copy Markdown
Member Author

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Didn't mean to trigger this and cancelled.

@troychaplin troychaplin self-assigned this Aug 18, 2026
@troychaplin
troychaplin requested a review from pattonwebz August 18, 2026 12:19
@troychaplin

Copy link
Copy Markdown
Member Author

@aduth I reviewed the feedback you had on #2 and made these changes in this PR:

  • Removed stylelint rule. I agree with you and updating the existing code will be worth the extra time.
  • Node 24: I had updated that in this PR so we'll be well positioned once Gutenberg updates.
  • Enforced linting on config files.
  • Refactored styles while replacing Validation settings page with latest DataViews pacakage.

Other Notes:

  • I usually use Breaking Changes at the top of my changelogs then follow the rest of the standard rules. I'm also ok with using conventional commits. I used what I know and mirrored the AI Labs plugin. Original comment

@joedolson

Copy link
Copy Markdown
Collaborator

In my opinion, we should merge this as it is and iterate. At these very early stages, I think it's better that we get some rules and standards in place early, and if we encounter a need to change things later, we can make those changes in smaller, more discrete changes where the reasoning can be more easily followed.

@joedolson
joedolson merged commit d751886 into main Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants