Skip to content

Create a preset option to set sane default behavior (WIP) #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jan 30, 2023

Conversation

jaredcwhite
Copy link
Member

@jaredcwhite jaredcwhite commented Aug 23, 2022

Resolves #171

  • Tests
  • Docs

The docs site is actually broken on Render, so I need to upgrade Bridgetown in a separate PR and add documentation then (and update the live demo). Gist of it is you can run:

Ruby2JS.convert(code, preset: true).to_s

And automatically get output with the following options:

  • Filters: esm, functions, return
  • ES level: 2021
  • Identity comparison (aka str === val even with double-equals in Ruby)
  • Underscored ivars (aka @a = 123 -> this._a = 123)

I gave some thought to other possible filters and options, but this feels like a pretty solid baseline. And with the "magic comments" feature (see #172), it'll be easy to set additional options on a per-file basis as needed.

Thoughts?

@render
Copy link

render bot commented Aug 23, 2022

@jaredcwhite
Copy link
Member Author

Hmm, the CI test doesn't seem to be executing the most up-to-date build of the Opal version, seems to be using whatever's on NPM…

@jaredcwhite jaredcwhite merged commit 80c291e into master Jan 30, 2023
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.

1 participant