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
Proposal: removing parserOptions.experimentalObjectRestSpread
option
#9990
Comments
My thoughts (off the cuff): It's hard to say how many people are relying on this, so I wonder if we should consider deferring this for 5.0 and implementing in 6.0, to allow more time for rule/plugin authors to make the transition. |
In today's TSC meeting, the TSC decided to do the following:
|
Could it be kept, but only for ecmaVersions 2015-2017? |
My impression is that the team is generally not in favor of keeping the option, for a few reasons:
For further discussion, see #9986 (comment). |
My concern is that there may be codebases that wish to keep object rest/spread but do not wish to enable async/await, or async iterators, or |
The recommendation for those codebases would be to enable |
Users who want to use object rest/spread should enable `ecmaVersion: 2018` instead. As discussed in eslint/eslint#9990, ESLint 5 will translate the `experimentalObjectRestSpread` option to `ecmaVersion: 2018` and emit a deprecation warning.
* Breaking: remove experimentalObjectRestSpread option Users who want to use object rest/spread should enable `ecmaVersion: 2018` instead. As discussed in eslint/eslint#9990, ESLint 5 will translate the `experimentalObjectRestSpread` option to `ecmaVersion: 2018` and emit a deprecation warning. * Remove experimentalObjectRestSpread from docs
This upgrades Espree to v4.0.0-alpha.0 and removes our duplicated tests that pair `experimentalObjectRestSpread` and `ecmaVersion: 2018`. It does not implement the deprecation warning or translating the former to the latter in the background.
This upgrades Espree to v4.0.0-alpha.0 and removes our duplicated tests that pair `experimentalObjectRestSpread` and `ecmaVersion: 2018`. It does not implement the deprecation warning or translating the former to the latter in the background.
As suggested by @not-an-aardvark:
|
This upgrades Espree to v4.0.0-alpha.0 and removes our duplicated tests that pair `experimentalObjectRestSpread` and `ecmaVersion: 2018`. It does not implement the deprecation warning or translating the former to the latter in the background.
FWIW, I have published a plugin to disallow each syntactic feature individually: https://www.npmjs.com/package/eslint-plugin-es |
I'll work on this. |
And it generates a deprecation warning to show that the option has been deprecated.
I share the same concerns as @ljharb. Lets consider a project that was written with Node.js >= 8.6 in mind. According to node.green, only the object spread and object rest spread features from es2018 are implemented. Therefore, it would be safer to declare This was just an example. There are a lot of other projects that are locked to Please consider keeping |
* Update: re-enable experimentalObjectRestSpread (fixes #9990) And it generates a deprecation warning to show that the option has been deprecated. * move warning to config-validator * revert some unnecessary changes * move ecmaVersion=9 to resolveParserOptions function * change error code of deprecation warnings * make tests robuster * fix Node 6.x problem. * fix Node 6.x problem.
@satazor Please consider to use |
Context
Since ESLint
4.18.0
, we have supported Rest/Spread Properties in formal withparserOptions.ecmaVersion: 2018
. So theparserOptions.experimentalObjectRestSpread
option has finished its role.The
parserOptions.experimentalObjectRestSpread
option has some confusion because we added it early time.ExperimentalRestProperty
,RestProperty
, andRestElement
. And spread properties are so. This is unfortunate for plugin ecosystem.Also, the
parserOptions.experimentalObjectRestSpread
option sometimes has hidden bug fixes in acorn. For example:The cause is that we make some overridden methods on espree to implement it. In fact, the implementation of
parserOptions.experimentalObjectRestSpread
has a bug about the duplication check of ES modules currently.Proposal
Remove the
parserOptions.experimentalObjectRestSpread
option in the next major version, 5.0.0.To replace it by
parserOptions.ecmaVersion: 2018
to migrate.This is similar to Migrating to 2.0.0 we have done in past.
Pros
ExperimentalRestProperty
andExperimentalSpreadProperty
.parserOptions.ecmaVersion
option since 2.0.0. TheparserOptions.experimentalObjectRestSpread
option is the last exception.Cons
parserOptions.experimentalObjectRestSpread
option. This removal can cause confusion in migrating to 5.0.0.The text was updated successfully, but these errors were encountered: