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

Crash in prefer-filter #108

Closed
Lalem001 opened this issue Oct 14, 2016 · 1 comment
Closed

Crash in prefer-filter #108

Lalem001 opened this issue Oct 14, 2016 · 1 comment

Comments

@Lalem001
Copy link

test.js

'use strict';

const forEach = require('lodash/forEach');
const noop = require('lodash/noop');

const callbacks = [noop, noop];

// Crash occurs on next line
forEach(callbacks, noop);

.eslint.json

{
    "plugins": ["lodash"],
    "extends": ["plugin:lodash/recommended"]
}

Exception

Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at onlyHasSimplifiableIf ([redacted]/node_modules/eslint-plugin-lodash/lib/rules/prefer-filter.js:53:68)
    at [redacted]/node_modules/eslint-plugin-lodash/lib/rules/prefer-filter.js:60:64
    at EventEmitter.<anonymous> ([redacted]/node_modules/eslint-plugin-lodash/lib/util/lodashUtil.js:236:17)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode ([redacted]/node_modules/eslint/lib/util/node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode ([redacted]/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode ([redacted]/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.enter ([redacted]/node_modules/eslint/lib/eslint.js:898:36)
    at Controller.__execute ([redacted]/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse ([redacted]/node_modules/estraverse/estraverse.js:501:28)
@ganimomer
Copy link
Contributor

Thanks for reporting!
Fixed in version 2.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants