eslint-plugin-import: TypeError: Cannot read property 'forEach' of null

Cannot read property 'forEach' of null
TypeError: Cannot read property 'forEach' of null
    at dependencies.forEach.dep (/node_modules/eslint-plugin-import/lib/ExportMap.js:182:43)
    at Map.forEach (native)
    at ExportMap.forEach (/node_modules/eslint-plugin-import/lib/ExportMap.js:182:23)
    at EventEmitter.ExportAllDeclaration (/node_modules/eslint-plugin-import/lib/rules/export.js:62:23)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode (/node_modules/eslint/lib/util/node-event-generator.js:39:22)
    at CodePathAnalyzer.enterNode (/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:607:23)
    at CommentEventGenerator.enterNode (/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.enter (/node_modules/eslint/lib/eslint.js:928:36)

I’m using airbnb rules on WebStorm editor. My .eslintrc is the following:

{
  "parser": "babel-eslint",
  "extends": "airbnb",
  "env": {
    "es6": true,
    "jest": true
  },
  "plugins": [
    "babel",
    "flowtype",
    "import",
    "react",
    "react-native"
  ],
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "sourceType": "module"
  },
  "settings": {
    "import/extensions": [".js", ".jsx", ".android.js", ".ios.js"]
  },
  "rules": {
    "react/jsx-filename-extension": ["off"],
    "react/prefer-stateless-function": ["error", {
      "ignorePureComponents": true
    }],
    "no-case-declarations": ["off"],
    "no-underscore-dangle": ["off"],
    "no-nested-ternary": ["off"],
    "arrow-parens": 0,
    "babel/arrow-parens": 1,
    "react-native/no-unused-styles": 2,
    "react-native/split-platform-components": 2,
    "react-native/no-inline-styles": 2,
    "react-native/no-color-literals": 2
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

What is the workarround ?

@rjhilgefort i think your issue will be fixed in the next release.

Leaving this open so a test can be added.

I believe so. I just upgraded to 2.13.0 and I’m seeing the issue when I try to do export * from 'Ramda'. When I comment out that export, the eslint failure error is gone and I’m left with expected linter warns about the Ramda methods that aren’t being exported.

TypeError: Cannot read property 'size' of null
    at dependencies.forEach.dep (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint-plugin-import/lib/ExportMap.js:71:51)
    at Set.forEach (<anonymous>)
    at ExportMap.get size [as size] (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint-plugin-import/lib/ExportMap.js:71:23)
    at processBodyStatement (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint-plugin-import/lib/rules/namespace.js:77:30)
    at Array.forEach (<anonymous>)
    at Program (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint-plugin-import/lib/rules/namespace.js:95:14)
    at listeners.(anonymous function).forEach.listener (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/Users/rjhilgefort/Projects/charter/distillery-lint/node_modules/eslint/lib/util/node-event-generator.js:251:26)

Though, Ramda doesn’t have a size method… so that’s a bit perplexing…

reopening to remember to create test