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

Optional Chaining and Nullish coalescing Operator arrived at Stage 4 #12642

Closed
3 of 5 tasks
g-plane opened this issue Dec 5, 2019 · 15 comments · Fixed by #13416
Closed
3 of 5 tasks

Optional Chaining and Nullish coalescing Operator arrived at Stage 4 #12642

g-plane opened this issue Dec 5, 2019 · 15 comments · Fixed by #13416
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint new syntax This issue is related to new syntax that has reached stage 4

Comments

@g-plane
Copy link
Member

g-plane commented Dec 5, 2019

The version of ESLint you are using.
6.7

The problem you want to solve.
Support two new ES features: Optional Chaining and Nullish coalescing Operator.

Your take on the correct solution to problem.

(Template inspired by Issue 12629)

@g-plane g-plane added enhancement This change enhances an existing feature of ESLint core Relates to ESLint's core APIs and features accepted There is consensus among the team that this change meets the criteria for inclusion labels Dec 5, 2019
@mysticatea mysticatea added the new syntax This issue is related to new syntax that has reached stage 4 label Dec 5, 2019
@mysticatea mysticatea pinned this issue Dec 5, 2019
@franktopel
Copy link

When can we hope to get this? optional chaining is a highly desirable feature, and since we dropped Babel we're waiting for Acorn to support this, so webpack can support it as well :)

@kaicataldo
Copy link
Member

We're currently also waiting for Acorn to support this (our default parser, Espree, wraps Acorn), and that work is currently blocked by estree/estree#204.

@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that accepted issues failing to be implemented after 90 days tend to
never be implemented, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@DaniGuardiola
Copy link

I encountered this problem and figured this is the right place to mention it :)

As per this comment:

Closing as this is currently unsupported. If optional chaining becomes a Stage 4 ECMAScript proposal, we could reopen this and make any necessary changes to the core rule. Thanks!

@NemoStein
Copy link

As I understand, we are waiting for Optional Chaining syntax to be added to ESTree to merge this PR.
@mysticatea may correct me if I'm wrong (sorry to bug you)...

@NemoStein
Copy link

NemoStein commented Jun 11, 2020

As commented by dreyks (#13196 (comment))

released as https://github.com/acornjs/acorn/releases/tag/7.3.0

Does it means that both Optional Chaining and Nullish coalescing Operator is part of ESLint now and this issue can be closed?

@kaicataldo
Copy link
Member

Not yet. This will be closed when we integrate these upstream changes into ESLint core.

@NemoStein
Copy link

Right, makes sense...
Just to be sure, Optional Chaining is included in Acorn by that PR?
There was a lot of back and forth about it and I'm not sure even if Nullish coalescing Operator is in ESLint now... =|

@kaicataldo
Copy link
Member

Just to be sure, Optional Chaining is included in Acorn by that PR?

The ESTree spec was just finalized yesterday, so it's going to take a little bit of time to get everything updated downstream. Hopefully we'll be able to get it out in the next release.

There was a lot of back and forth about it and I'm not sure even if Nullish coalescing Operator is in ESLint now... =|

Nullish coalescing operator was included in the latest release (v7.2.0).

kaicataldo added a commit that referenced this issue Jul 18, 2020
kaicataldo added a commit that referenced this issue Jul 18, 2020
* update deps (to branch)

* trivial fix for debug output

* update code path analysis

* update accessor-pairs

* update array-callback-return

* add tests for camelcase

* add tests for computed-property-spacing

* update dot-location

* update dot-notation

* update func-name-matching

* update global-require

* update indent

* add tests for getter-return

* update new-cap

* update newline-per-chained-call

* update no-alert

* update no-extend-native

* update no-extra-bind

* update no-extra-parens

* update no-eval

* update no-implicit-coercion

* update eslint-utils

* update no-implied-eval

* update no-import-assign

* update no-magic-numbers

* update no-obj-calls

* update no-prototype-builtins

* add tests for no-restricted-syntax

* update no-self-assign

* update no-setter-return

* update no-unexpected-multiline

* update no-unused-expression

* update no-useless-call

* update no-whitespace-before-property

* update operator-assignment

* update padding-line-between-statements

* update prefer-arrow-callback

* add tests for prefer-destructuring

* update prefer-exponentiation-operator

* update prefer-numeric-literals

* update prefer-promise-reject-errors

* update prefer-regex-literals

* update prefer-spread

* update use-isnan

* update yoda

* update wrap-iife

* remove __proto__

* fix no-import-assign for delete op

* update eslint-visitor-keys

* fix no-unexpected-multiline to just ignore optional chaining

* update func-call-spacing

* update constructor-super

* update dot-location for unstable sort

* update no-extra-boolean-cast

* update func-call-spacing

* update no-extra-parens for false positive on IIFE

* update array-callback-return

* update no-invalid-this (astUtils.isDefaultThisBinding)

* update radix

* update a comment in no-implicit-coercion

* update comments in no-extra-bind

* remove unnecessary change from array-callback-return

* update dot-notation for autofix about `let?.[`

* update new-cap

* update wrap-iife

* update prefer-arrow-callback

* change isSameReference to handle `a.b` and `a?.b` are same

* fix code path analysis for `node.arguments.length == 0` case

* update `astUtils.couldBeError`

* update `astUtils.isMethodWhichHasThisArg`

* improve coverage

* fix isMethodWhichHasThisArg

* update no-self-assign

* Upgrade: espree@7.2.0

Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
@mysticatea mysticatea unpinned this issue Jul 21, 2020
@Lonniebiz
Copy link

Lonniebiz commented Aug 2, 2020

Shouldn't this issue remain open? While Nullish coalescing may be supported, I have confirmed that Optional Chaining is not supported in (the latest) eslint 7.6.0.

@SebastianSimon
Copy link
Contributor

@Lonniebiz It works in the online demo. What input code are you using and which warning or error do you see?

@Lonniebiz
Copy link

Lonniebiz commented Aug 2, 2020

Earlier, I tested some code that looked like this:

	let obj = {};
	if (obj.data?.length === 0)
	{
		console.log(obj);
	}

I got some error griping about ?. However, now when I try it, it works. Maybe when I changed eslint.parserOptions.ecmaVersion from 2018 to 2020 it didn't take effect right away. Not sure, but thanks for the reply, which caused me to try it again and experience it working. Glad to see this one! @SebastianSimon

@sevor005
Copy link

Good afternoon! Have you added support for optional chaining to eslint? If not added, which version will support it? Thanks!

@marktaiwan
Copy link

Good afternoon! Have you added support for optional chaining to eslint? If not added, which version will support it? Thanks!

Support for optional chaining was added in v7.5.0
https://eslint.org/blog/2020/07/eslint-v7.5.0-released

@sevor005
Copy link

Good afternoon! Have you added support for optional chaining to eslint? If not added, which version will support it? Thanks!

Support for optional chaining was added in v7.5.0
https://eslint.org/blog/2020/07/eslint-v7.5.0-released

Thank you very much!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jan 15, 2021
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint new syntax This issue is related to new syntax that has reached stage 4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants