Skip to content
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

Object rest/spread can be transpiled using Babel #84

Closed
lgdevlop opened this issue Oct 22, 2023 · 8 comments
Closed

Object rest/spread can be transpiled using Babel #84

lgdevlop opened this issue Oct 22, 2023 · 8 comments

Comments

@lgdevlop
Copy link

Can we add the Object rest/spread option to the polyfill options of this library since we can use Babel to transpile the unsupported syntax? Below is a link to the Babel plugin that performs the transformation.

https://babeljs.io/docs/babel-plugin-transform-object-rest-spread

@robatwilliams
Copy link
Owner

That's an ES6/ES2015 feature, so isn't checked by this plugin to begin with (see list of ES versions in the readme).

@robatwilliams
Copy link
Owner

Please close the issue unless you'r experiencing a problem

@lgdevlop
Copy link
Author

Thank you for the quick response.

According to the link to the Babel plugin I provided above and the links I include below, including an image of the ecmascript-compat/compat plugin, the feature in question is ES2018, as we are referring to Object rest/spread. You are correct in stating that rest and spread are ES2015, but Object rest/spread is ES2018. I want to turn off linting for Object rest/spread using the polyfill option of the ecmascript-compat plugin.

Thank you for the excellent work!

https://css-tricks.com/new-es2018-features-every-javascript-developer-should-know/#aa-the-rest-spread-properties

https://2ality.com/2017/02/ecmascript-2018.html

Captura de tela 2023-10-22 193324

@robatwilliams
Copy link
Owner

Ah thanks, I didn't remember that spread didn't all arrive in the same version.

Given you're using a transpiler, what's your need for using es-compat on the source code? The envisaged scenarios are described under Rationale in the readme. If you have a new scenario, do let me know.

@lgdevlop
Copy link
Author

I'm using it so that ESLint can alert me when using features not supported by the environments configured in Browserlist.

With this, I check the tooling to see if it supports the functionality by transpiling or polyfilling it or if I need to adjust it using a Babel plugin.

These issues typically arise with older tooling, so I configure ESLint with this plugin, Browserlist, and look for notifications from the plugin. This way, I prioritize updating the tooling if necessary

@robatwilliams
Copy link
Owner

In that case, I suggest you run es-compat against the output of Babel rather than the input.

@lgdevlop
Copy link
Author

I see. OK, I will close this issue.

@robatwilliams
Copy link
Owner

I think the readme should provide an better explanation of this, so I've created #85

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

No branches or pull requests

2 participants