Skip to content

[docs-utils] 4️⃣ Unnamed exports validator#252644

Merged
clintandrewhall merged 3 commits intoelastic:mainfrom
clintandrewhall:feat/docs-utils/4-unnamed-exports
Feb 24, 2026
Merged

[docs-utils] 4️⃣ Unnamed exports validator#252644
clintandrewhall merged 3 commits intoelastic:mainfrom
clintandrewhall:feat/docs-utils/4-unnamed-exports

Conversation

@clintandrewhall
Copy link
Copy Markdown
Contributor

Summary

Adds detection and tracking of unnamed exports in Kibana plugins. When a JSDoc-style comment appears above a line that isn't a proper declaration (e.g., a stray export or a comment above a non-declaration), the tooling now identifies these as unnamed exports and reports them as validation issues.

Note

This PR is a subset of #247688 for ease of review.

This PR was written with Cursor and claude-4.5-opus-high.

Before / After Example

Given an index file with a stray export like:

/** Some docs for a random export */
export { something } from './internal';

Before this PR:

The tooling silently skipped these nodes with no indication of an issue:

info pluginFoo: Processing public scope...

After this PR:

The tooling identifies the unnamed export and reports it:

warn pluginFoo: 1 unnamed export(s) found
  - public/index.ts:5 — `export { something } from './internal';`

And a new --stats unnamed flag allows listing all unnamed exports:

node scripts/check_package_docs.js --plugin pluginFoo --stats unnamed

Changes

  • Add UnnamedExport, UnnamedExportsByPlugin types and unnamedExports field to ApiStats and IssuesByPlugin
  • Refactor getDeclarationNodesForPluginScope to return a DeclarationNodesResult containing both nodes and unnamed exports
  • Detect unnamed exports in getExportedFileDeclarations when a node has no identifiable name
  • Propagate unnamed exports through getPluginApi and getPluginApiMap into stats collection
  • Add --stats unnamed CLI flag for listing unnamed exports
  • Update integration tests and snapshots

Impact

  • Plugins with stray or malformed exports are now surfaced in validation reports
  • No change to existing validation pass/fail criteria -- unnamed exports are tracked but do not block

Made with Cursor

- Add UnnamedExport type.
- Extend IssuesByPlugin with optional unnamedExports field.
- Update getDeclarationNodesForPluginScope to detect unnamed exports.
- Update getPluginApi to propagate unnamed exports.
- Add --check unnamed CLI flag.
- Add tests for unnamed export detection.
@clintandrewhall clintandrewhall requested a review from a team as a code owner February 11, 2026 03:00
@clintandrewhall clintandrewhall added review Team:Operations Kibana-Operations Team release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v9.4.0 labels Feb 11, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

1 similar comment
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

Copy link
Copy Markdown
Contributor

@mistic mistic left a comment

Choose a reason for hiding this comment

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

lgtm

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #1 / discover responsive sidebar should render buttons in data view picker correctly

Metrics [docs]

✅ unchanged

History

@clintandrewhall clintandrewhall merged commit 814aa13 into elastic:main Feb 24, 2026
16 checks passed
@clintandrewhall clintandrewhall deleted the feat/docs-utils/4-unnamed-exports branch February 24, 2026 00:08
nreese pushed a commit to nreese/kibana that referenced this pull request Feb 25, 2026
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
bhapas pushed a commit to bhapas/kibana that referenced this pull request Feb 25, 2026
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 11, 2026
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes review Team:Operations Kibana-Operations Team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants