documentation: no-unsafe-optional-chaining - add needs ecmaVersion: 2020
See original GitHub issueThe 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:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, the accepted documentation update has been merged (we had “refs” instead of “fixes” probably because the PR addresses only part of this request).
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.