eslint: v5.6.0
node: v10.11.0
just updated babel-eslint v9.0 to v10.0, and got the following after running eslint:
statements is not iterable
TypeError: statements is not iterable
at Object.getDirectivePrologue (/project/node_modules/eslint/lib/util/ast-utils.js:975:37)
at checkDirectives (/project/node_modules/eslint/lib/rules/lines-around-directive.js:131:41)
at listeners.(anonymous function).forEach.listener (/project/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
at Object.emit (/project/node_modules/eslint/lib/util/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/project/node_modules/eslint/lib/util/node-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (/project/node_modules/eslint/lib/util/node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (/project/node_modules/eslint/lib/util/node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (/project/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
at nodeQueue.forEach.traversalInfo (/project/node_modules/eslint/lib/linter.js:860:28)
I haven't found time yet to look into the issue more closely, but thought I'd go ahead and report it nonetheless already.
Same to me!!!!
"eslint": "^5.4.0",
node: v10.5.0
statements is not iterable
TypeError: statements is not iterable
........
Any chance of getting a small reproduce-able example?
Yeah seeing that error, especially if it's just from ESLint itself, will require a lot of guessing to know what the issue is now.
I'll try to find some time tomorrow to come up with a reduced repro.
It's not exactly "reduced", but I got this issue in this PR: https://github.com/smokku/wrte/pull/140
The code in this repo is small though, so it may serve as an example until a proper one is available.
Awesome thanks @smokku
looks like it's a bug from https://github.com/babel/babel-eslint/pull/584 cc @joa so that transformation has some issues? It's probably an issue because the change doesn't modify the location data correctly, otherwise we should strip it out or remove it.
it("regression", () => {
verifyAndAssertMessages(
`
export type A = 'INIT'
`,
{ "space-before-function-paren": ["error", "always"] }
);
});
Sounds like we shouldn't transform it and instead we should add it in scope like in analyze-scope. Actually I guess we seem to be handling something like that already in https://github.com/babel/babel-eslint/blob/8f78e280a22def1128cd847b73fd7f221a047ed2/lib/analyze-scope.js#L148-L158
I have this issue as well, I'm using babel-eslint + flow and it only occurs form me when I do something like type InputProps = {};.
BTW this appends in this file: at Object.getDirectivePrologue (node_modules/eslint/lib/util/ast-utils.js:958:31)
Most helpful comment
It's not exactly "reduced", but I got this issue in this PR: https://github.com/smokku/wrte/pull/140
The code in this repo is small though, so it may serve as an example until a proper one is available.