Skip to content

TINY-12656: Add new custom rule to enforce type location - #55

Open
ltrouton wants to merge 7 commits into
mainfrom
feature/TINY-12656
Open

TINY-12656: Add new custom rule to enforce type location#55
ltrouton wants to merge 7 commits into
mainfrom
feature/TINY-12656

Conversation

@ltrouton

Copy link
Copy Markdown
Contributor

Related Ticket: TINY-12656

Description of Changes:

  • Enforce interfaces, types and enums to be at the top of the file

Pre-checks:

  • Changelog entry added
  • package.json version bumped (if first change of new major/minor)
  • Tests have been added (if applicable)

@ltrouton
ltrouton requested review from a team, jscasca, kimwoodfield, metricjs and shanmen-tiny and removed request for a team December 17, 2025 00:30
@ltrouton
ltrouton requested review from a team as code owners December 17, 2025 00:30
*/
const isTypeDeclaration = (node: TSESTree.Node): boolean => {
if (TYPE_DECLARATION_NODE_TYPES.includes(node.type)) {
return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As the AI points out on your tinymce PR, TypeScript is not this simple. We do some weird things in our codebases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have updated based on the coderabbits suggestion to skip stories.tsx files.
All other comments weren't related to types not being moved correctly.

I believe everything has been resolved correctly now

Comment thread src/main/ts/rules/TypesAtTop.ts
@ltrouton
ltrouton requested a review from TheSpyder January 12, 2026 03:21
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.

4 participants