camelcase with optional chaining
See original GitHub issueI’m really not sure if this is a bug fix or rule change, but when using optional chaining on an object’s keys, I would expect camelcase to not apply. For example, we can’t control the data we are given from apis so if they use something that’s not camelcase, then it is what it is. So accessing data?.some_data
should not throw an error.
Node version: v12.16.0 npm version: v6.13.4 lint version: ^6.8.0 babel-eslint version: ^10.1.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Make camelcase and optional chaining play nicely (!22177) · Merge ...
Make camelcase eslint rule work correctly for objects using optional chaining. Previously we had to do this: // eslint-disable-next-line camelcase ...
Read more >Optional chaining operator support in VSCode - Stack Overflow
VS Code 1.41 supports optional chaining in both JavaScript and TypeScript files. This support includes syntax highlighting and IntelliSense.
Read more >Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
The optional chaining ( ?. ) operator accesses an object's property or calls a function. If the object accessed or function called is ......
Read more >How Does Optional Chaining Work in JavaScript? | by Johnny ...
Optional chaining is a feature in JavaScript which lets us access child properties of an object, even if the parent object doesn't exist....
Read more >camelcase | typescript-eslint
... no-namespace · no-non-null-asserted-nullish-coalescing · no-non-null-asserted-optional-chain · no-non-null-assertion · no-redundant-type-constituents ...
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
@lucksp
I think you should also disable the core
camelcase
rule:In the interim, assuming that you’re using babel, you can use https://github.com/babel/eslint-plugin-babel with the same args for “babel/camelcase” as you would for “camelcase”: