Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

v10.0.0: TypeError: statements is not iterable #691

Closed
dnalborczyk opened this issue Sep 25, 2018 · 7 comments
Closed

v10.0.0: TypeError: statements is not iterable #691

dnalborczyk opened this issue Sep 25, 2018 · 7 comments
Labels

Comments

@dnalborczyk
Copy link

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.

@scrodrig
Copy link

Same to me!!!!

"eslint": "^5.4.0",

node: v10.5.0

statements is not iterable
TypeError: statements is not iterable
........

@existentialism
Copy link
Member

Any chance of getting a small reproduce-able example?

@hzoo
Copy link
Member

hzoo commented Sep 25, 2018

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.

@dnalborczyk
Copy link
Author

I'll try to find some time tomorrow to come up with a reduced repro.

@smokku
Copy link

smokku commented Sep 26, 2018

It's not exactly "reduced", but I got this issue in this PR: smokku/wrte#140
The code in this repo is small though, so it may serve as an example until a proper one is available.

@hzoo
Copy link
Member

hzoo commented Sep 26, 2018

Awesome thanks @smokku

looks like it's a bug from #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

TypeAlias(node) {
this._createScopeVariable(node, node.id);
const typeParamScope = this._nestTypeParamScope(node);
this.visit(node.right);
if (typeParamScope) {
this.close(node);
}
}

@arthureggert
Copy link

arthureggert commented Sep 26, 2018

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)

see

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

No branches or pull requests

6 participants