Skip to content

chore: resolve missing inherited members and fix CEM type overrides#11252

Closed
web-padawan wants to merge 5 commits intomainfrom
chore/cem-inherited-members
Closed

chore: resolve missing inherited members and fix CEM type overrides#11252
web-padawan wants to merge 5 commits intomainfrom
chore/cem-inherited-members

Conversation

@web-padawan
Copy link
Copy Markdown
Member

@web-padawan web-padawan commented Mar 5, 2026

Description

The CEM analyzer only follows inheritedFrom one level deep, so members inherited through 2+ levels of mixins or superclasses are dropped from class declarations (e.g., TextField.label via FieldMixin → LabelMixin).

Add a multi-pass resolution step that copies missing members and attributes from mixin and superclass declarations to class declarations.

Type of change

  • Internal change

Note

Can be tested by running yarn release:cem - in this PR there will be label property in the custom-elements.json for vaadin-text-field component, and in main branch it's missing from there:

{
  "kind": "field",
  "name": "label",
  "privacy": "public",
  "type": {
    "text": "string"
  },
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
  "attribute": "label",
  "inheritedFrom": {
    "name": "FieldMixin",
    "package": "@vaadin/field-base/src/field-mixin.js"
  }
},

UPD: added a second commit that fixes a problem with type for i18n properties incorrectly set to Object.

@web-padawan web-padawan force-pushed the chore/cem-inherited-members branch from e77bab0 to 12328a4 Compare March 6, 2026 10:39
@web-padawan web-padawan changed the title chore: resolve missing inherited members in CEM class declarations chore: resolve missing inherited members and fix CEM type overrides Mar 6, 2026
@web-padawan web-padawan force-pushed the chore/cem-inherited-members branch 2 times, most recently from 5821ca6 to 9d9d7ad Compare March 6, 2026 14:17
web-padawan and others added 5 commits March 12, 2026 12:06
The CEM analyzer only follows inheritedFrom one level deep, so members
inherited through 2+ levels of mixins or superclasses are dropped from
class declarations (e.g., TextField.label via FieldMixin → LabelMixin).

Add a multi-pass resolution step that copies missing members and
attributes from mixin and superclass declarations to class declarations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CEM analyzer resolves inherited members from the deepest ancestor
(e.g., I18nMixin), losing specific @type JSDoc overrides from closer
mixins (e.g., AppLayoutMixin's @type {!AppLayoutI18n}).

Add typeOverridePlugin (analyzePhase) to collect @type tags from getter
overrides, and applyTypeOverrides (packageLinkPhase) to re-apply them
after the analyzer's inheritance resolution using closest-wins BFS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract repeated `(node.jsDoc || []).flatMap(doc => doc.tags || [])`
pattern into a shared `getJsDocTags` helper used by three plugins.

Switch readonlyPlugin from `extractMixinNodes` to `findClassNode` for
consistency with typeOverridePlugin, removing the unused import.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a member already exists on a class but has no type (due to multi-level
inheritance), copy the type from the parent declaration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…CEM config

Extend copyMissingItems to also propagate descriptions from parent
declarations when a member exists but has no description (e.g., value
on Checkbox and RadioButton inherited via multi-level mixin chain).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@web-padawan web-padawan force-pushed the chore/cem-inherited-members branch from 9d9d7ad to eac4449 Compare March 12, 2026 10:06
@sonarqubecloud
Copy link
Copy Markdown

@web-padawan
Copy link
Copy Markdown
Member Author

This PR got quite big and contains unrelated changes, I will split it into smaller parts to make it easier to review.

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.

1 participant