Skip to content

convert: don't emit config tables with nothing in them - #18

Merged
Paritsingla7 merged 1 commit into
mainfrom
fix/drop-empty-config-tables
Aug 21, 2026
Merged

Paritsingla7 merged 1 commit into
mainfrom
fix/drop-empty-config-tables

Conversation

@Paritsingla7

Copy link
Copy Markdown
Owner

What

A config block whose every key was TODO'd out (or that was empty in the source) still emitted hl.config({ <name> = {} }).

Two problems with that:

  1. It sets nothing — dead output.
  2. When the block name itself is unresolvable, the leftover table is output the converter knows is invalid, so convert's own post-convert validation flags it and the command exits 1 — on a file it handled exactly as designed.

The clearest instance is a per-device block, which Hyprland's own default config ships as a commented example, so it's widespread:

device:epic-mouse-v1 {
    sensitivity = -0.5
}

Before: TODO comment emitted (correct), plus hl.config({ ["device:epic-mouse-v1"] = {} }), then 1 issue(s) found in the converted output. and exit 1.

After: TODO comment only, exit 0.

How

Prune empty tables at both levels — the top-level block and nested sub-blocks — and keep the TODO note. This is the same call the plugin block path already made ("flag for manual conversion rather than emitting empty/invalid tables"); it just wasn't applied to the general config path.

Keys that did convert are untouched — covered by a test.

Verification

  • 173 passed (was 170; +3 new tests)
  • Found and verified against a real third-party config from the wild: output went 74 → 58 lines, all 7 TODO comments preserved, exit 1 → exit 0.
  • site/bundle.js regenerated (mapper.py is a bundled module).

A block whose every key was TODO'd out (or that was empty in the source)
still produced `hl.config({ <name> = {} })`. That sets nothing, and when
the block name itself is unresolvable - a per-device `device:foo` block,
which Hyprland's default config ships as a commented example - the
leftover table was flagged by convert's own post-convert checker, so the
command exited 1 on a file it had handled exactly as designed.

Prune empty tables at both levels (top-level block and nested sub-block)
and keep the TODO note, matching what the plugin-block path already did.

Found running the converter against a real config from the wild.

@Paritsingla7 Paritsingla7 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

approved

@Paritsingla7
Paritsingla7 merged commit 941306e into main Aug 21, 2026
6 checks passed
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