TypeError: moduleDecl.body.body.forEach is not a function
See original GitHub issueHi! I have a strange error
TypeError: moduleDecl.body.body.forEach is not a function
Occurred while linting ~/services/admin-website/src/views/Products/Products/AddProductDialog/PhotoInput/index.tsx:1
at ~/node_modules/eslint-plugin-import/lib/ExportMap.js:565:32
at Array.forEach (<anonymous>)
at ~/node_modules/eslint-plugin-import/lib/ExportMap.js:563:19
at Array.forEach (<anonymous>)
at Function.ExportMap.parse (~/node_modules/eslint-plugin-import/lib/ExportMap.js:477:12)
at Function.ExportMap.for (~/node_modules/eslint-plugin-import/lib/ExportMap.js:361:25)
at resolveImport (~/node_modules/eslint-plugin-import/lib/ExportMap.js:415:25)
at Object.<anonymous> (~/node_modules/eslint-plugin-import/lib/ExportMap.js:422:14)
at processBodyStatement (~/node_modules/eslint-plugin-import/lib/rules/namespace.js:89:38)
at Array.forEach (<anonymous>)
the first line is
import React, { Fragment, FC, useState, ReactElement } from 'react'
so this is something else
eslintrc
{
"extends": [
"@trejgun/eslint-config/presets/tsx",
"@trejgun/eslint-config/rules/jest"
],
"parserOptions": {
"project": "./tsconfig.test.json"
},
"root": true,
"rules": {
"object-curly-spacing": [
"error",
"always"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
]
}
}
tsconfig
{
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": false,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,
"target": "es2017",
"allowSyntheticDefaultImports": true
},
"exclude": ["node_modules", "build"],
"include": ["src"]
}
package.json
{
"react": "16.13.0",
"react-beautiful-dnd": "11.0.5",
"react-dom": "16.13.0",
"@trejgun/eslint-config": "0.0.7",
"@types/jest": "24.9.0",
"@types/react": "16.9.23",
"@types/react-dom": "16.0.11",
"@types/react-router-dom": "4.3.5",
"@typescript-eslint/eslint-plugin": "2.21.0",
"@typescript-eslint/parser": "2.21.0",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.0",
"eslint-config-standard": "14.1.0",
"eslint-import-resolver-ts": "0.4.2",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jest": "23.8.0",
"eslint-plugin-mocha": "6.2.2",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-react": "7.18.3",
"eslint-plugin-react-hooks": "2.4.0",
"eslint-plugin-standard": "4.0.1",
"firebase": "7.9.3",
"firebase-tools": "7.11.0",
"typescript": "3.8.2"
}
I personally think the problem comes from another. file
import * as firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/firestore'
import 'firebase/storage'
import config from './production.config'
if (!firebase.apps.length) {
firebase.initializeApp({
...config,
timestampsInSnapshots: true,
})
}
export default firebase
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
TypeError: moduleDecl.body.body.forEach is not a function ...
Hi! I have a strange error TypeError: moduleDecl.body.body.forEach is not a function Occurred while linting ...
Read more >Error on JS 'body.forEach is not a function' - Stack Overflow
body is not an Array, therefore you cannot invoke .forEach on it, you can try converting it like. Array.from(body).forEach(function (device) ...
Read more >TypeError: forEach is not a function in JavaScript | bobbyhadz
The "forEach is not a function" error occurs when we call the forEach() method on a value that is not of type array,...
Read more >TypeError: forEach is not a function in JavaScript - Stack Diary
The "TypeError: forEach is not a function" error is thrown when the code attempts to call the forEach() method on a value that...
Read more >JavaScript: ⚠️ Foreach is not a function [Solved ]
Uncaught TypeError: myString.forEach is not a function. This happens when you try to ue forEach on an object that does not implement this...
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
guys, can we have this merged?
Done in #1763