Skip to content

refactor: output idiomatic boolean attributes in JSX#432

Open
faridreaming wants to merge 1 commit intoritz078:masterfrom
faridreaming:fix/idiomatic-boolean-attributes
Open

refactor: output idiomatic boolean attributes in JSX#432
faridreaming wants to merge 1 commit intoritz078:masterfrom
faridreaming:fix/idiomatic-boolean-attributes

Conversation

@faridreaming
Copy link

Description

Currently, the HTML-to-JSX conversion produces non-idiomatic JSX for boolean attributes (e.g., required="" instead of just required). This happens because the underlying htmltojsx package is no longer maintained.

This PR adds a post-processing step to clean up these attributes using a predefined list of HTML5 boolean attributes.

Changes

  • Created constants/jsxAttributes.ts to store a comprehensive list of boolean attributes and a reusable Regex.
  • Updated pages/html-to-jsx.tsx to apply the cleanup logic after the initial conversion.

Testing

  • Input: <input required="" disabled="" />
  • Output: <input required disabled />
  • Verified that non-boolean attributes (like id="" or className) remain untouched.

@vercel
Copy link

vercel bot commented Feb 16, 2026

@faridreaming is attempting to deploy a commit to the ritesh-oss Team on Vercel.

A member of the Team first needs to authorize it.

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