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

eslint@es6jsx crashes on consistent-return with arrow operator #1493

Closed
tcoopman opened this issue Nov 24, 2014 · 5 comments
Closed

eslint@es6jsx crashes on consistent-return with arrow operator #1493

tcoopman opened this issue Nov 24, 2014 · 5 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

@tcoopman
Copy link

this code:

var x = () => {
  return {};
};

crashes:

node_modules\eslint\lib\rules\consistent-return.js:42
                returnTypeDefined = "type" in returnInfo;
                                              ^
TypeError: Cannot use 'in' operator to search for 'type' in undefined
    at EventEmitter.ReturnStatement (c:\Workspace\rio-inspecties\node_modules\eslint\lib\rules\consistent-return.js:42:47)
    at EventEmitter.emit (events.js:117:20)
    at Controller.controller.traverse.enter (c:\Workspace\rio-inspecties\node_modules\eslint\lib\eslint.js:679:25)
    at Controller.__execute (c:\Workspace\rio-inspecties\node_modules\eslint\node_modules\estraverse\estraverse.js:318:31)
    at Controller.traverse (c:\Workspace\rio-inspecties\node_modules\eslint\node_modules\estraverse\estraverse.js:394:28)
    at EventEmitter.module.exports.api.verify (c:\Workspace\rio-inspecties\node_modules\eslint\lib\eslint.js:652:24)
    at processFile (c:\Workspace\rio-inspecties\node_modules\eslint\lib\cli-engine.js:131:27)
    at c:\Workspace\rio-inspecties\node_modules\eslint\lib\cli-engine.js:226:30
    at walk (c:\Workspace\rio-inspecties\node_modules\eslint\lib\util\traverse.js:77:9)
    at c:\Workspace\rio-inspecties\node_modules\eslint\lib\util\traverse.js:97:9

while this succeeds:

var x = function() {
  return {};
};

I have ecmascript = 6. in settings

@nzakas nzakas added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly es6jsx rule Relates to ESLint's core rules labels Nov 24, 2014
@nzakas
Copy link
Member

nzakas commented Nov 25, 2014

Yuck, that's no good. Definitely a bug.

Currently blocked by: https://github.com/eslint/eslint-tester/issues/11

@nzakas
Copy link
Member

nzakas commented Nov 26, 2014

Working on this.

nzakas added a commit that referenced this issue Nov 26, 2014
Fix: Make consistent-return work with arrow functions (fixes #1493)
@tcoopman
Copy link
Author

tcoopman commented Dec 9, 2014

This seems to be fixed by your commits.

@tcoopman tcoopman closed this as completed Dec 9, 2014
nzakas added a commit that referenced this issue Feb 7, 2015
Update: Make rules work with arrow functions (fixes #1508, fixes #1509, fixes #1493)
@sam-github
Copy link

Has anyone seen this on something other than an arrow function? Because I'm getting on a recent eslint update, and am trying to track down why (and it's pure node javascript, no es6 features).

@nzakas
Copy link
Member

nzakas commented Feb 23, 2015

@sam-github can you open a new issue? If it's not related to arrow functions, then it's a new issue.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 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 7, 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

3 participants