Skip to content

feat(core): format-bytes - #205

Merged
coryrylan merged 3 commits into
mainfrom
topic-format-bytes
Aug 7, 2026
Merged

feat(core): format-bytes#205
coryrylan merged 3 commits into
mainfrom
topic-format-bytes

Conversation

@coryrylan

@coryrylan coryrylan commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator
  • Introduced nve-format-bytes component to convert byte counts into human-readable decimal or binary units

Summary by CodeRabbit

  • New Features

    • Added the Format Bytes component for localized decimal or binary byte formatting.
    • Supports automatic or fixed units, short or long labels, locale selection, precision controls, and value fallback.
    • Added custom-element registration and public package exports.
  • Documentation

    • Added user documentation, navigation, installation guidance, and usage examples.
  • Tests

    • Added coverage for formatting behavior, accessibility, performance, server rendering, and visual appearance.

@coryrylan
coryrylan requested a review from johnyanarella July 31, 2026 22:52
@coryrylan coryrylan self-assigned this Jul 31, 2026
Copilot AI lite review requested due to automatic review settings July 31, 2026 22:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added scope(core) scope(docs) dependencies Pull requests that update a dependency file labels Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds the FormatBytes custom element with localized decimal or binary formatting, package and bundle exports, documentation, examples, and validation tests. It also adds an ESLint rule that checks bundle components against Lighthouse imports and updates related repository workflows.

Changes

Format Bytes component

Layer / File(s) Summary
Formatting component and rendering
projects/core/src/format-bytes/format-bytes.ts, projects/core/src/format-bytes/format-bytes.css
FormatBytes validates input, formats byte values, supports locales and precision, renders semantic data, updates slot fallback content, and applies styling.
Custom-element registration and package exposure
projects/core/src/format-bytes/define.ts, projects/core/src/format-bytes/index.ts, projects/core/package.json, projects/core/src/bundle.ts
The component registers as nve-format-bytes and is exposed through package and bundle entry points.
Examples and component validation
projects/core/src/format-bytes/*, projects/core/src/index.test.lighthouse.ts
Examples and unit, SSR, accessibility, Lighthouse, visual, and bundle-size tests cover the component.
Documentation site integration
projects/site/src/_11ty/layouts/common.js, projects/site/src/docs/elements/format-bytes.md
The site adds navigation and documentation for installation, formatting options, locales, values, and examples.

Repository validation and maintenance

Layer / File(s) Summary
Bundle and Lighthouse registration validation
projects/core/eslint.config.js, projects/internals/eslint/src/configs/lit.js, projects/internals/eslint/src/local/*bundle*.js, projects/internals/eslint/README.md
A new ESLint rule checks that bundle components have direct imports in the aggregate Lighthouse benchmark. Rule configuration, documentation, and tests are updated.
Workflow and fixture maintenance
.agents/skills/component-creation/SKILL.md, mise.toml, projects/core/src/internal/utils/keynav.test.ts
Component-creation guidance and install behavior are updated. Key navigation tests use shared fixture helpers.
Element status filtering
config/vale/styles/config/vocabularies/Elements/accept.txt, projects/site/src/docs/metrics/api-status.11ty.js
The json-viewer vocabulary and status-filter exclusions are removed.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Consumer
  participant FormatBytes
  participant IntlNumberFormat
  Consumer->>FormatBytes: Set value, unit, locale, and precision
  FormatBytes->>IntlNumberFormat: Format converted byte value
  IntlNumberFormat-->>FormatBytes: Return localized number
  FormatBytes-->>Consumer: Render formatted value and unit label
Loading

Suggested labels: scope(lint)

Suggested reviewers: copilot, johnyanarella

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the core format-bytes component.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch topic-format-bytes

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/core/src/format-bytes/format-bytes.test.axe.ts`:
- Around line 13-26: Update the stability setup in the test around
FormatBytes.metadata.tag to await elementIsStable for all three nve-format-bytes
fixture elements, rather than only the first querySelector result, before
calling runAxe. Preserve the existing fixture cleanup and accessibility
assertion.

In `@projects/core/src/format-bytes/format-bytes.ts`:
- Around line 130-146: Make display sourcing consistent between `#resolveAutoUnit`
and `#formatLabel`. Prefer passing the display value explicitly by updating
`#formatLabel` to accept a display parameter and updating its call in
`#formattedBytes` to pass this.display, while using that parameter for label
selection.
- Around line 148-167: Update `#warnInvalidOption` to remove the rawValue
parameter and return type/value, then adjust its callers in
`#hasValidConfiguration` to pass only the option name and value. Remove rawValue
from `#hasValidConfiguration` as well, and update its call site to invoke it
without arguments while preserving the existing invalid-configuration return
behavior.
- Around line 142-146: Update the formatting flow around `#formattedBytes` and
`#formatLabel` so the value is rounded once using the same fraction-digit settings
as `#formatNumber`, then pass that rounded value to both helpers. Select singular
versus plural in `#formatLabel` based on the rounded value while preserving
short-label behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b30e9a98-6f6c-4e84-ac6e-c5b9e9faad96

📥 Commits

Reviewing files that changed from the base of the PR and between 651abf3 and b57257b.

⛔ Files ignored due to path filters (2)
  • projects/core/.visual/format-bytes.dark.png is excluded by !**/*.png
  • projects/core/.visual/format-bytes.png is excluded by !**/*.png
📒 Files selected for processing (15)
  • projects/core/package.json
  • projects/core/src/bundle.ts
  • projects/core/src/format-bytes/define.ts
  • projects/core/src/format-bytes/format-bytes.css
  • projects/core/src/format-bytes/format-bytes.examples.ts
  • projects/core/src/format-bytes/format-bytes.test.axe.ts
  • projects/core/src/format-bytes/format-bytes.test.lighthouse.ts
  • projects/core/src/format-bytes/format-bytes.test.ssr.ts
  • projects/core/src/format-bytes/format-bytes.test.ts
  • projects/core/src/format-bytes/format-bytes.test.visual.ts
  • projects/core/src/format-bytes/format-bytes.ts
  • projects/core/src/format-bytes/index.ts
  • projects/core/src/index.test.lighthouse.ts
  • projects/site/src/_11ty/layouts/common.js
  • projects/site/src/docs/elements/format-bytes.md

Comment thread projects/core/src/format-bytes/format-bytes.test.axe.ts Outdated
Comment thread projects/core/src/format-bytes/format-bytes.ts
Comment thread projects/core/src/format-bytes/format-bytes.ts
Comment thread projects/core/src/format-bytes/format-bytes.ts Outdated
Copilot AI review requested due to automatic review settings August 4, 2026 14:31
@coryrylan
coryrylan force-pushed the topic-format-bytes branch from b57257b to 351a0f2 Compare August 4, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/core/src/index.test.lighthouse.ts`:
- Line 18: The FormatBytes component definition import is missing from the
js-modules list used in the benchmark, so the new component is not included in
the aggregate payload measurement. Add the
`@nvidia-elements/core/format-bytes/define.js` import to the module-import list in
the test setup. After adding the import, run the benchmark to measure the actual
payload. Update the 134.5 KB threshold in the expect assertion only if the
measured payload for index.js exceeds the current limit.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 660ec1ed-b543-4228-96dd-5fab6d84b4ae

📥 Commits

Reviewing files that changed from the base of the PR and between b57257b and 351a0f2.

⛔ Files ignored due to path filters (2)
  • projects/core/.visual/format-bytes.dark.png is excluded by !**/*.png
  • projects/core/.visual/format-bytes.png is excluded by !**/*.png
📒 Files selected for processing (15)
  • projects/core/package.json
  • projects/core/src/bundle.ts
  • projects/core/src/format-bytes/define.ts
  • projects/core/src/format-bytes/format-bytes.css
  • projects/core/src/format-bytes/format-bytes.examples.ts
  • projects/core/src/format-bytes/format-bytes.test.axe.ts
  • projects/core/src/format-bytes/format-bytes.test.lighthouse.ts
  • projects/core/src/format-bytes/format-bytes.test.ssr.ts
  • projects/core/src/format-bytes/format-bytes.test.ts
  • projects/core/src/format-bytes/format-bytes.test.visual.ts
  • projects/core/src/format-bytes/format-bytes.ts
  • projects/core/src/format-bytes/index.ts
  • projects/core/src/index.test.lighthouse.ts
  • projects/site/src/_11ty/layouts/common.js
  • projects/site/src/docs/elements/format-bytes.md

Comment thread projects/core/src/index.test.lighthouse.ts
@property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;

get #rawValue(): string {
if (this.value === undefined) return this.textContent?.trim() ?? '';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

|| this.value === null)

Lit will set value to null if the value attribute is removed. Without this check, the component skips this branch and renders "null" instead of the text fallback.

(The other formatter components handle this with a nullish fallback.)

Copilot AI review requested due to automatic review settings August 5, 2026 22:46
@coryrylan
coryrylan force-pushed the topic-format-bytes branch from 351a0f2 to c46c74d Compare August 5, 2026 22:46
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated no new comments.

Suppressed comments (1)

projects/core/src/format-bytes/format-bytes.ts:111

  • When value is provided via the attribute and is not a valid number (e.g. value="not-a-number"), Lit's Number converter sets this.value to NaN. The current #rawValue then becomes 'NaN', so the component both warns about and renders NaN rather than preserving the original input string (unlike invalid slot content, and unlike format-number which preserves invalid attribute text).
  get #rawValue(): string {
    return String(this.value ?? this.textContent?.trim() ?? '');
  }

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/internals/eslint/src/local/no-missing-bundle-registration.js`:
- Around line 153-159: In no-missing-bundle-registration.js, replace raw-text
lighthouse import matching with AST-based collection of only static
ImportDeclaration module specifiers, preserving extraction of the component name
from valid `${escapedPrefix}/<component>/define.js` imports. In
projects/internals/eslint/src/local/no-missing-bundle-registration.test.js lines
109-137, add coverage proving matching text in comments or string literals still
reports missing-lighthouse-registration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 371bf729-2dbd-48c2-8432-5470988dba19

📥 Commits

Reviewing files that changed from the base of the PR and between 0b24dcc and c46c74d.

⛔ Files ignored due to path filters (2)
  • projects/core/.visual/format-bytes.dark.png is excluded by !**/*.png
  • projects/core/.visual/format-bytes.png is excluded by !**/*.png
📒 Files selected for processing (23)
  • .agents/skills/component-creation/SKILL.md
  • config/vale/styles/config/vocabularies/Elements/accept.txt
  • projects/core/eslint.config.js
  • projects/core/package.json
  • projects/core/src/bundle.ts
  • projects/core/src/format-bytes/define.ts
  • projects/core/src/format-bytes/format-bytes.css
  • projects/core/src/format-bytes/format-bytes.examples.ts
  • projects/core/src/format-bytes/format-bytes.test.axe.ts
  • projects/core/src/format-bytes/format-bytes.test.lighthouse.ts
  • projects/core/src/format-bytes/format-bytes.test.ssr.ts
  • projects/core/src/format-bytes/format-bytes.test.ts
  • projects/core/src/format-bytes/format-bytes.test.visual.ts
  • projects/core/src/format-bytes/format-bytes.ts
  • projects/core/src/format-bytes/index.ts
  • projects/core/src/index.test.lighthouse.ts
  • projects/core/src/internal/utils/keynav.test.ts
  • projects/internals/eslint/src/configs/lit.js
  • projects/internals/eslint/src/local/no-missing-bundle-registration.js
  • projects/internals/eslint/src/local/no-missing-bundle-registration.test.js
  • projects/site/src/_11ty/layouts/common.js
  • projects/site/src/docs/elements/format-bytes.md
  • projects/site/src/docs/metrics/api-status.11ty.js
💤 Files with no reviewable changes (2)
  • config/vale/styles/config/vocabularies/Elements/accept.txt
  • projects/internals/eslint/src/configs/lit.js

Comment thread projects/internals/eslint/src/local/no-missing-bundle-registration.js Outdated
@johnyanarella
johnyanarella self-requested a review August 5, 2026 23:20
@coryrylan
coryrylan force-pushed the topic-format-bytes branch from c46c74d to edf2cd6 Compare August 6, 2026 15:34
Copilot AI review requested due to automatic review settings August 6, 2026 15:34
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.agents/skills/component-creation/SKILL.md:
- Line 39: Update the component-creation guidance to require only the define.js
import in projects/core/src/bundle.ts, preserving its import-only registration
role. Remove the instruction to add a matching public export there, and direct
public export changes to the component or package export surface instead.

In `@projects/internals/eslint/README.md`:
- Line 112: Update the no-missing-bundle-test entry in the ESLint rule catalog
to document that it requires the lighthouseTestFile option, naming the aggregate
Lighthouse test file configured for the project. Keep the existing rule behavior
description and follow the repository’s Markdown technical-writing style.

In `@projects/internals/eslint/src/configs/lit.js`:
- Around line 70-71: Update the litConfig consumers in projects/code and
projects/monaco to enable local/no-missing-bundle-registration, ensuring
src/bundle.ts is enforced in both projects while preserving the existing
no-missing-bundle-test configuration.

In `@projects/internals/eslint/src/local/no-missing-bundle-test.js`:
- Around line 68-86: Move the duplicated getPackageName helper and the shared
prefix-escaping/importPattern construction into src/local/utils.js, then import
and reuse them from both no-missing-bundle-test.js and
no-missing-bundle-registration.js. Preserve the existing helper behavior and
generated import patterns while removing the duplicate local implementations.
- Around line 145-147: Update the missing-file branch in the Program:exit
handler to report a diagnostic when lighthouseTestPath does not exist instead of
returning silently. Add and use a dedicated missing-lighthouse-test messageId,
while preserving the existing validation flow when the file is present.
- Around line 103-118: Update the schema for the rule options object alongside
importPrefix and lighthouseTestFile to declare lighthouseTestFile as required.
Keep additionalProperties and the existing property definitions unchanged so
ESLint rejects configurations that omit this option.
- Around line 50-66: Update getModuleScriptSources to use optional chaining when
reading the script node value, so module ScriptTag nodes with undefined value
are skipped without throwing while preserving the existing string check and
collection behavior.

In `@projects/internals/eslint/src/local/no-missing-bundle-test.test.js`:
- Around line 20-41: Make both createBundleFixture helpers deterministic by
writing a package.json with name `@nvidia-elements/core` into each mkdtemp
directory before resolving the fixture. Update
projects/internals/eslint/src/local/no-missing-bundle-test.test.js lines 20-41
and projects/internals/eslint/src/local/no-missing-bundle-registration.test.js
lines 60-82; no other changes are needed.

In `@projects/site/src/docs/metrics/api-status.11ty.js`:
- Line 25: Add a regression assertion in the api-status test cases verifying
that an element named nve-json-viewer is retained by the filter while an element
whose name contains internal remains excluded. Keep the test focused on the
filtering behavior introduced in the api-status implementation.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 8a2ab864-c427-42e1-be87-a33ecfc2550f

📥 Commits

Reviewing files that changed from the base of the PR and between c7e16a5 and edf2cd6.

⛔ Files ignored due to path filters (2)
  • projects/core/.visual/format-bytes.dark.png is excluded by !**/*.png
  • projects/core/.visual/format-bytes.png is excluded by !**/*.png
📒 Files selected for processing (25)
  • .agents/skills/component-creation/SKILL.md
  • config/vale/styles/config/vocabularies/Elements/accept.txt
  • projects/core/eslint.config.js
  • projects/core/package.json
  • projects/core/src/bundle.ts
  • projects/core/src/format-bytes/define.ts
  • projects/core/src/format-bytes/format-bytes.css
  • projects/core/src/format-bytes/format-bytes.examples.ts
  • projects/core/src/format-bytes/format-bytes.test.axe.ts
  • projects/core/src/format-bytes/format-bytes.test.lighthouse.ts
  • projects/core/src/format-bytes/format-bytes.test.ssr.ts
  • projects/core/src/format-bytes/format-bytes.test.ts
  • projects/core/src/format-bytes/format-bytes.test.visual.ts
  • projects/core/src/format-bytes/format-bytes.ts
  • projects/core/src/format-bytes/index.ts
  • projects/core/src/index.test.lighthouse.ts
  • projects/core/src/internal/utils/keynav.test.ts
  • projects/internals/eslint/README.md
  • projects/internals/eslint/src/configs/lit.js
  • projects/internals/eslint/src/local/no-missing-bundle-registration.test.js
  • projects/internals/eslint/src/local/no-missing-bundle-test.js
  • projects/internals/eslint/src/local/no-missing-bundle-test.test.js
  • projects/site/src/_11ty/layouts/common.js
  • projects/site/src/docs/elements/format-bytes.md
  • projects/site/src/docs/metrics/api-status.11ty.js
💤 Files with no reviewable changes (1)
  • config/vale/styles/config/vocabularies/Elements/accept.txt

Comment thread .agents/skills/component-creation/SKILL.md Outdated
Comment thread projects/internals/eslint/README.md Outdated
Comment on lines 70 to +71
'no-missing-bundle-registration': noMissingBundleRegistration,
'no-missing-bundle-test': noMissingBundleTest,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find every bundle.ts and check which eslint configs enable the bundle rules.
fd -t f 'bundle.ts' projects
fd -t f 'eslint.config.js' projects --exec rg -n 'no-missing-bundle-(registration|test)' {} \; -x echo "-- {}"
rg -n 'no-missing-bundle' projects --glob 'eslint.config.js' -C2

Repository: NVIDIA/elements

Length of output: 871


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- lint configuration files ---'
fd -t f 'eslint.config.js' projects -0 | xargs -0 -r -n1 sh -c '
  echo "--- $0"
  cat -n "$0"
'

printf '%s\n' '--- litConfig usages ---'
rg -n -C3 'litConfig|configs/lit|eslint.*lit' projects --glob 'eslint.config.js' --glob 'package.json'

printf '%s\n' '--- bundle rule definitions and references ---'
rg -n -C4 'no-missing-bundle-(registration|test)' projects/internals projects --glob '*.{js,ts,json}' \
  --glob '!**/node_modules/**'

Repository: NVIDIA/elements

Length of output: 45372


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path
import re

root = Path("projects")
configs = sorted(root.rglob("eslint.config.js"))
bundles = sorted(
    p for p in root.rglob("bundle.ts")
    if "node_modules" not in p.parts
)

lit_consumers = []
severity_configs = []
for config in configs:
    text = config.read_text()
    if re.search(r"\blitConfig\b", text):
        lit_consumers.append(config)
    if re.search(r"['\"](?:local/)?no-missing-bundle-registration['\"]\s*:", text):
        severity_configs.append(config)

print("bundle.ts files:")
for path in bundles:
    print(f"  {path}")

print("\nlitConfig consumers:")
for path in lit_consumers:
    print(f"  {path}")

print("\nconfigs with no-missing-bundle-registration severity:")
for path in severity_configs:
    text = path.read_text()
    for match in re.finditer(
        r"['\"](?:local/)?no-missing-bundle-registration['\"]\s*:\s*([^,\n]+)",
        text,
    ):
        print(f"  {path}: {match.group(1).strip()}")

print("\npackage/result matrix:")
for bundle in bundles:
    package_dir = bundle.parent.parent
    config = package_dir / "eslint.config.js"
    consumes_lit = config.exists() and bool(re.search(r"\blitConfig\b", config.read_text()))
    has_severity = config.exists() and bool(
        re.search(r"['\"](?:local/)?no-missing-bundle-registration['\"]\s*:", config.read_text())
    )
    print(
        f"  {bundle}: config={config if config.exists() else 'none'}, "
        f"litConfig={consumes_lit}, local severity={has_severity}"
    )
PY

Repository: NVIDIA/elements

Length of output: 984


Restore enforcement for src/bundle.ts in every litConfig consumer.

projects/code and projects/monaco consume litConfig and contain src/bundle.ts, but neither enables local/no-missing-bundle-registration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/internals/eslint/src/configs/lit.js` around lines 70 - 71, Update
the litConfig consumers in projects/code and projects/monaco to enable
local/no-missing-bundle-registration, ensuring src/bundle.ts is enforced in both
projects while preserving the existing no-missing-bundle-test configuration.

Comment thread projects/internals/eslint/src/local/no-missing-bundle-test.js
Comment thread projects/internals/eslint/src/local/no-missing-bundle-test.js Outdated
Comment thread projects/internals/eslint/src/local/no-missing-bundle-test.js
Comment thread projects/internals/eslint/src/local/no-missing-bundle-test.js Outdated
Comment thread projects/internals/eslint/src/local/no-missing-bundle-test.test.js
Comment thread projects/site/src/docs/metrics/api-status.11ty.js

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings August 6, 2026 17:04
@coryrylan
coryrylan force-pushed the topic-format-bytes branch from edf2cd6 to ee3436a Compare August 6, 2026 17:04
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/core/src/index.test.lighthouse.ts`:
- Line 102: Update the assertion in the buildPage payload test to validate the
intended JavaScript payload: either assert the expected request key before
checking its size, or switch to report.payload.javascript.kb if the 86.3 KB
limit applies across all code-split modules.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 80082bb2-f9ec-4542-9d3b-46233b161891

📥 Commits

Reviewing files that changed from the base of the PR and between c7e16a5 and ee3436a.

⛔ Files ignored due to path filters (2)
  • projects/core/.visual/format-bytes.dark.png is excluded by !**/*.png
  • projects/core/.visual/format-bytes.png is excluded by !**/*.png
📒 Files selected for processing (27)
  • .agents/skills/component-creation/SKILL.md
  • config/vale/styles/config/vocabularies/Elements/accept.txt
  • knip.config.js
  • mise.toml
  • projects/core/eslint.config.js
  • projects/core/package.json
  • projects/core/src/bundle.ts
  • projects/core/src/format-bytes/define.ts
  • projects/core/src/format-bytes/format-bytes.css
  • projects/core/src/format-bytes/format-bytes.examples.ts
  • projects/core/src/format-bytes/format-bytes.test.axe.ts
  • projects/core/src/format-bytes/format-bytes.test.lighthouse.ts
  • projects/core/src/format-bytes/format-bytes.test.ssr.ts
  • projects/core/src/format-bytes/format-bytes.test.ts
  • projects/core/src/format-bytes/format-bytes.test.visual.ts
  • projects/core/src/format-bytes/format-bytes.ts
  • projects/core/src/format-bytes/index.ts
  • projects/core/src/index.test.lighthouse.ts
  • projects/core/src/internal/utils/keynav.test.ts
  • projects/internals/eslint/README.md
  • projects/internals/eslint/src/configs/lit.js
  • projects/internals/eslint/src/local/no-missing-bundle-registration.test.js
  • projects/internals/eslint/src/local/no-missing-bundle-test.js
  • projects/internals/eslint/src/local/no-missing-bundle-test.test.js
  • projects/site/src/_11ty/layouts/common.js
  • projects/site/src/docs/elements/format-bytes.md
  • projects/site/src/docs/metrics/api-status.11ty.js
💤 Files with no reviewable changes (2)
  • knip.config.js
  • config/vale/styles/config/vocabularies/Elements/accept.txt

Comment thread projects/core/src/index.test.lighthouse.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings August 6, 2026 18:26
@coryrylan
coryrylan force-pushed the topic-format-bytes branch from ee3436a to e7f5d5c Compare August 6, 2026 18:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

- Introduced `nve-format-bytes` component to convert byte counts into human-readable decimal or binary units

Signed-off-by: Cory Rylan <crylan@nvidia.com>
- Updated the component creation guide to include new steps for updating shared entry points and measuring payloads.
- Modified ESLint rules to enforce bundle registration and added support for Lighthouse benchmark integration.
- Expanded Lighthouse test imports to include additional components and adjusted payload size expectations.
- Removed deprecated component from vocabulary list and updated related documentation.

Signed-off-by: Cory Rylan <crylan@nvidia.com>
Signed-off-by: Cory Rylan <crylan@nvidia.com>
@coryrylan
coryrylan force-pushed the topic-format-bytes branch from 0ecb039 to a06c5c7 Compare August 7, 2026 19:35
@coryrylan
coryrylan merged commit ff596a1 into main Aug 7, 2026
15 checks passed
@coryrylan
coryrylan deleted the topic-format-bytes branch August 7, 2026 19:52
@coryrylan

Copy link
Copy Markdown
Collaborator Author

🎉 This issue has been resolved in version 2.3.0 🎉

Changelog

@coryrylan

Copy link
Copy Markdown
Collaborator Author

🎉 This issue has been resolved in version 2.1.10 🎉

Changelog

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.

3 participants