question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

documentation: no-unsafe-optional-chaining - add needs ecmaVersion: 2020

See original GitHub issue

The version of ESLint you are using. 7.18.0 (n/a- website doco)

The problem you want to solve. The no-unsafe-option-chaining rule page ( https://eslint.org/docs/rules/no-unsafe-optional-chaining ) should mention you also need : parserOptions.ecmaVersion: 2020 (as mentioned here https://eslint.org/blog/2020/07/eslint-v7.5.0-released )

And while you’re there, please add to correct examples a simple obj.foo?.bar

Your take on the correct solution to problem.

Are you willing to submit a pull request to implement this change?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Feb 10, 2021

Yes, the accepted documentation update has been merged (we had “refs” instead of “fixes” probably because the PR addresses only part of this request).

1reaction
mdjermanoviccommented, Jan 27, 2021

Nothing about the autofixing, but it makes sense to add obj.foo?.bar as a correct example for this rule, as @aavmurphy suggested, since it’s probably the most common usage of optional chaining.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-unsafe-optional-chaining - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Eslint fails to parse and red-highlights optional chaining ...
Nullish coalescing operator is natively supported starting from eslint>=7.5.0 . The easiest is set ES2020 in your package.json:
Read more >
JavaScript's unsafe optional chaining is crazy
no -unsafe-optional-chaining is an amazing eslint rule, which help us identify what are we doing wrong with optional chaining and disallows ...
Read more >
eslint-config-airbnb-base | Yarn - Package Manager
This package provides Airbnb's base JS .eslintrc (without React plugins) as an extensible shared ... [patch] add disabled no-unsafe-optional-chaining rule ...
Read more >
ES2020: optional chaining - 2ality
This blog post describes the ECMAScript proposal “Optional chaining” by Gabriel Isenberg, Claude Pache, and Dustin Savery.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found