rules/no-use-before-define.js: TypeError: Cannot read property '1' of undefined
See original GitHub issueTell us about your environment
-
ESLint Version: 3.19.0
-
Node Version: v7.10.0
-
npm Version: 4.5.0
What parser (default, Babel-ESLint, etc.) are you using?
Babel-ESLint
Please show your full configuration:
FILE: .eslintrc.json
{
"parser": "babel-eslint",
"extends": "standard"
}
What did you do? Please include the actual source code causing the issue.
// @flow
type FieldOptions<T> = {| defaultValue: T |}
type DateFieldOptions = {| ...FieldOptions<Date> |}
What did you expect to happen?
What actually happened? Please include the actual, raw output from ESLint.
[eslintbug]$ node_modules/.bin/eslint fields.js
Cannot read property '1' of undefined
TypeError: Cannot read property '1' of undefined
at scope.references.forEach.reference (/tmp/eslintbug/node_modules/eslint/lib/rules/no-use-before-define.js:206:83)
at Array.forEach (native)
at findVariablesInScope (/tmp/eslintbug/node_modules/eslint/lib/rules/no-use-before-define.js:194:30)
at EventEmitter.Program:exit (/tmp/eslintbug/node_modules/eslint/lib/rules/no-use-before-define.js:242:21)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:191:7)
at NodeEventGenerator.applySelector (/tmp/eslintbug/node_modules/eslint/lib/util/node-event-generator.js:265:26)
at NodeEventGenerator.applySelectors (/tmp/eslintbug/node_modules/eslint/lib/util/node-event-generator.js:294:22)
at NodeEventGenerator.leaveNode (/tmp/eslintbug/node_modules/eslint/lib/util/node-event-generator.js:317:14)
at CodePathAnalyzer.leaveNode (/tmp/eslintbug/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:622:23)
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property '1' of undefined (JavaScript)
JS arrays are zero-indexed, so the last element is at index array.length - 1 . – SuperStormer. Mar 6 at 19:58.
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >TypeError: Cannot read property '1' of undefined #315 - GitHub
I downloaded the tuyapi library using npm install codetheweb/tuyapi command and then went to tuapi folder and created tu.js file.
Read more >Uncaught TypeError: Cannot read property '1' of undefined
This error occurs in Chrome Browser when you read a property or call a method on an undefined object . Uncaught TypeError: Cannot...
Read more >uncaught typeerror: cannot read property '1' of undefined
Solution 1. Accept Solution Reject Solution. Consider the last two iterations of your inner loop on the first iteration of the outer loop:...
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
Nice find, @mysticatea, knew it was something like that. Honestly I’d much prefer that
babel-eslint
fix this if possible, so I’m not 100% sure I actually want to submit this patch.I’ll open an issue over there later today. Thanks!
Closing this issue, as it’s a problem with babel-eslint.