Selector `Property > .key` can't match key in `const {a = 1} = b;`
See original GitHub issueTell us about your environment
- ESLint Version: v7.30.0
- Node Version: v16.4.2
- npm Version: v7.9.0
- Operating System: win32 10.0.19043
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
The default parser.
The issue template doesn’t fit, so I removed these sections.
I was making an eslint plugin, for this code
const {a = 1} = b;
I should be able to use Property > .key
to select the key, but ESLint won’t match.
I think this happens because we use the same reference for key
and value.left
, so they both have the AssignmentPattern
as parent. For this reason, I don’t think this is an issue by espree
or acorn
.
This happens to assignment too.
({a = 1} = b);
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Warning: Use the 'defaultValue' or 'value' props on <select ...
I am using selected attribute on option but React generates a warning asking me to use default value on select. For e.g. render:...
Read more >React key attribute: best practices for performant lists
Looking into how React "key" attribute works, how to use it correctly, ... const sortedCountries = orderBy(countries, 'name', sort);.
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
All this means is that you are trying to access a property of an object that is undefined.
Read more >Resolve the "Parameter validation failed" error in AWS ...
1. Open the AWS CloudFormation console. · 2. In the navigation pane, choose Stacks. · 3. Form the Stack name column, choose the...
Read more >The starting point for learning TypeScript
How to use TypeScript-powered JavaScript tooling. JS Projects Utilizing TypeScript · Type Checking JavaScript Files · JSDoc Reference · Creating .d.ts Files ...
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
@fisker thanks for the followup. The Espree upgrade will happen with the ESLint v8.0.0 release, which we hope we will have a preview release of in a couple weeks.
We can’t upgrade Espree in ESLint v7.x line due to breaking changes.
Thank you, I didn’t know that.
Confirmed, updating to Espree 8 fixes this.
Question: ETA for switch to Espree 8.0.0? Do we need workaround in ESLint before that?