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

sort-keys TypeError on destructuring object assignment #6896

Closed
Mardak opened this issue Aug 12, 2016 · 3 comments
Closed

sort-keys TypeError on destructuring object assignment #6896

Mardak opened this issue Aug 12, 2016 · 3 comments
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 bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@Mardak
Copy link
Contributor

Mardak commented Aug 12, 2016

What version of ESLint are you using?
3.3.0

What parser (default, Babel-ESLint, etc.) are you using?
default ecmaVersion:6

Please show your full configuration:
sort-keys:2

What did you do? Please include the actual source code causing the issue.

let {a} = 0

What did you expect to happen?
no error

What actually happened? Please include the actual, raw output from ESLint.

Cannot read property 'prevName' of null
TypeError: Cannot read property 'prevName' of null
    at EventEmitter.Property (/usr/local/lib/node_modules/eslint/lib/rules/sort-keys.js:127:39)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode (/usr/local/lib/node_modules/eslint/lib/util/node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (/usr/local/lib/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (/usr/local/lib/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.traverser.traverse.enter (/usr/local/lib/node_modules/eslint/lib/eslint.js:895:36)
    at Controller.__execute (/usr/local/lib/node_modules/eslint/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (/usr/local/lib/node_modules/eslint/node_modules/estraverse/estraverse.js:501:28)
    at Controller.Traverser.controller.traverse (/usr/local/lib/node_modules/eslint/lib/util/traverser.js:36:33)

@mysticatea #6800

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Aug 12, 2016
@Mardak
Copy link
Contributor Author

Mardak commented Aug 12, 2016

Looks like VariableDeclarator of node.id.type ObjectPattern should do something similar to what's being done for ObjectExpression to handle destructuring object assignment.

https://github.com/eslint/eslint/blob/master/lib/rules/sort-keys.js#L115

@Mardak Mardak changed the title sort-keys TypeError: Cannot read property 'prevName' of null sort-keys TypeError on destructuring object assignment Aug 12, 2016
@kaicataldo kaicataldo added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 12, 2016
@kaicataldo
Copy link
Member

Thanks for the bug report! Can confirm this is a bug. Checking the rule proposal, docs, and the rule's tests, it doesn't look to me like this was ever intended to sort destructuring patterns. Opened a PR to fix (will close if the intention was to check destructuring patterns).

@mysticatea
Copy link
Member

Oops, I'm sorry.
This is the same mistake as #6886 .

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@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 Feb 6, 2018
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 bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants