Skip to content

feat: clean identifiers for Marko component auto-imports - #530

Merged
DylanPiercey merged 2 commits into
mainfrom
claude/gracious-ride-yak3vg
Jun 25, 2026
Merged

feat: clean identifiers for Marko component auto-imports#530
DylanPiercey merged 2 commits into
mainfrom
claude/gracious-ride-yak3vg

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

Marko components that are auto-discoverable as tags (files under a components/tags directory) now name their default export's binding, so TypeScript offers a clean identifier for auto-imports instead of the file-derived default:

  • components/my-button.markoimport MyButton from "..." (was MyButtonMarko)
  • components/foo/index.markoimport Foo (was import index)

This works natively in the language server, the ts-plugin, and @marko/type-check — TypeScript indexes the component under its real name, so it's discoverable by that name too.

The name is the PascalCased tag name (components/foo.marko, components/foo/index.marko, and components/foo/foo.marko all → Foo; same under tags/). It's skipped — keeping the plain anonymous export default — when the file isn't discoverable, when the tag name wouldn't be a valid identifier (e.g. 3d-view), or when the name already appears in the source (a cheap conservative check that avoids redeclaring an existing binding).


Generated by Claude Code

@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5c7a4a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@marko/language-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DylanPiercey, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 17 minutes and 7 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 73bf9131-46f5-460e-8553-0969faa6a7f2

📥 Commits

Reviewing files that changed from the base of the PR and between 379559f and 5c7a4a7.

⛔ Files ignored due to path filters (37)
  • packages/language-server/src/__tests__/fixtures/script/attr-class-id-shorthands/__snapshots__/attr-class-id-shorthands.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tag-target-property/__snapshots__/attr-tag-target-property.expected/components/test-tag/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-dynamic-for-typed/__snapshots__/attr-tags-dynamic-for-typed.expected/tags/my-menu/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-for-narrowing/__snapshots__/attr-tags-for-narrowing.expected/components/list.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-generic/__snapshots__/attr-tags-generic.expected/tags/foo/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-nested-dynamic-for-typed/__snapshots__/attr-tags-nested-dynamic-for-typed.expected/tags/my-layout/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-nested-type/__snapshots__/attr-tags-nested-type.expected/components/list.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-params-js/__snapshots__/attr-tags-params-js.expected/components/child.js is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/attr-tags-params/__snapshots__/attr-tags-params.expected/components/child.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/bound-attr-missing-impl/__snapshots__/bound-attr-missing-impl.expected/tags/child.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/bound-attr-modifier-dynamic-member/__snapshots__/bound-attr-modifier-dynamic-member.expected/tags/child.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/bound-attr-modifier-ident/__snapshots__/bound-attr-modifier-ident.expected/tags/child.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/bound-attr-modifier-literal-member/__snapshots__/bound-attr-modifier-literal-member.expected/tags/child.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/class-api-basic/__snapshots__/class-api-basic.expected/components/fancy-button/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/class-api-event-binding/__snapshots__/class-api-event-binding.expected/components/fancy-button/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/custom-tag-args/__snapshots__/custom-tag-args.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/for-tag-attr-tags/__snapshots__/for-tag-attr-tags.expected/components/my-table.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/for-tag-input/__snapshots__/for-tag-input.expected/components/my-select.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/invalid-attrs/__snapshots__/invalid-attrs.expected/components/fancy-button/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/prefer-local-identifier-tag-name/__snapshots__/prefer-local-identifier-tag-name.expected/components/TestTagA.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/prefer-local-identifier-tag-name/__snapshots__/prefer-local-identifier-tag-name.expected/components/TestTagB.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/recursive-input-provided/__snapshots__/recursive-input-provided.expected/components/comments.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/recursive-input-scope-hoist/__snapshots__/recursive-input-scope-hoist.expected/components/comments.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/render-body-basic/__snapshots__/render-body-basic.expected/components/my-tag/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/return-as-type/__snapshots__/return-as-type.expected/tags/oneOrTwo.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/return-tag-nested/__snapshots__/return-tag-nested.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/split-component-d-ts/__snapshots__/split-component-d-ts.expected/components/fancy-button/index.d.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/split-component-d-ts/__snapshots__/split-component-d-ts.expected/components/fancy-button/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/split-component-d-ts/__snapshots__/split-component-d-ts.expected/components/regular-button/index.d.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/split-component-d-ts/__snapshots__/split-component-d-ts.expected/components/regular-button/index.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tag-param-mutation/__snapshots__/tag-param-mutation.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tag-params-basic/__snapshots__/tag-params-basic.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tag-params-with-generics/__snapshots__/tag-params-with-generics.expected/components/loader.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tag-type-args/__snapshots__/tag-type-args.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tag-type-params/__snapshots__/tag-type-params.expected/components/test-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tag-var-mutation-patterns/__snapshots__/tag-var-mutation-patterns.expected/components/my-tag.ts is excluded by !**/__snapshots__/** and included by **
  • packages/language-server/src/__tests__/fixtures/script/tags-api-basic/__snapshots__/tags-api-basic.expected/components/fancy-button/index.ts is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (4)
  • .changeset/component-auto-import-names.md
  • packages/language-server/src/__tests__/component-auto-import.test.ts
  • packages/language-tools/src/extractors/script/index.ts
  • packages/language-tools/src/extractors/script/util/get-component-name.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/gracious-ride-yak3vg

Comment @coderabbitai help to get the list of available commands.

@DylanPiercey
DylanPiercey merged commit 1091b69 into main Jun 25, 2026
5 checks passed
@DylanPiercey
DylanPiercey deleted the claude/gracious-ride-yak3vg branch June 25, 2026 21:19
@github-actions github-actions Bot mentioned this pull request Jun 26, 2026
@DylanPiercey DylanPiercey moved this to Done in Roadmap Jun 29, 2026
@DylanPiercey DylanPiercey self-assigned this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant