Skip to content

Add guideline for defining the name of a controller#8528

Open
mcmire wants to merge 1 commit intomainfrom
add-guideline-for-controller-name
Open

Add guideline for defining the name of a controller#8528
mcmire wants to merge 1 commit intomainfrom
add-guideline-for-controller-name

Conversation

@mcmire
Copy link
Copy Markdown
Contributor

@mcmire mcmire commented Apr 20, 2026

Explanation

There is no written standard for defining the name of a controller, and some contributors do not have a common understanding of the do's and dont's for the name.

This commit adds such a guideline, highlighting the following points:

  • The name of a controller should be defined in a variable called CONTROLLER_NAME (formerly controllerName)
  • The name should be used to define custom actions and events and should be passed to BaseController
  • The name should not be exported from the package

Besides updating the guidelines, this commit also updates the sample-controllers package to follow them, most notably changing controllerName to CONTROLLER_NAME and removing the export from this constant.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Low risk documentation and sample-code refactor; the only potential impact is for any downstream code importing controllerName directly from sample controller source files rather than via the package’s public exports.

Overview
Adds a new controller guideline recommending an internal CONTROLLER_NAME constant to namespace messenger actions/events and controller state, and explicitly discouraging exporting that constant from the package.

Updates the sample-controllers examples to follow the guideline by renaming controllerName to CONTROLLER_NAME, making it non-exported, and wiring all related Messenger/BaseController type parameters and name initialization to the new constant.

Reviewed by Cursor Bugbot for commit 85bcaf7. Bugbot is set up for automated code reviews on this repo. Configure here.

There is no written standard for defining the name of a controller, and
some contributors do not have a common understanding of the do's and
dont's for the name.

This commit adds such a guideline, highlighting the following points:

- The name of a controller should be defined in a variable called
  `CONTROLLER_NAME` (formerly `controllerName`)
- The name should be used to define custom actions and events and should
  be passed to `BaseController`
- The name should not be exported from the package
@mcmire
Copy link
Copy Markdown
Contributor Author

mcmire commented Apr 20, 2026

Adding no-changelog because this is a non-public-facing change to sample-controllers.

@mcmire mcmire marked this pull request as ready for review April 20, 2026 17:34
@mcmire mcmire requested a review from a team as a code owner April 20, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant