最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Eslint - Maximum call stack size exceeded - Stack Overflow

programmeradmin3浏览0评论

Working in a React / Webpack project I started to have problems with the eslint library.

The eslint package is downloaded using npm and it's used to validate the project using a webpack preLoader.

        preLoaders: [{
            test: /\.jsx?$/,
            loaders: [ 'eslint' ],
            include: path.resolve(__dirname, 'app')
        }]

It used to work fine until recently when I tried to git clone the same project to an other folder. After installing the dependencies "npm install" and starting the project "npm start" the following error appeared.

    ERROR in ./main.view.jsx
Module build failed: RangeError: Maximum call stack size exceeded
    at keys (native)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:78:24)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:88:38)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
 @ ./app.jsx 17:26-57

The strange part of all is that the old project installation still works.

The problem must be somewhere in the node_modules folder because when I copy the modules from the old installation to the new one the project suddenly works. I did a "npm list --depth=0" on both projects and both have the same packages and versions. Why one is working and the other one not?

I guess the problem is in the eslint package because when I remove the preLoader it works again.

I'm really confused about that. Someone had that problem before?

My main.view.jsx looks like that

import React from 'react';
export default class MainView extends React.Component {
    render() {
        return (
            <div />
        );
    }
}

Thanks!

Working in a React / Webpack project I started to have problems with the eslint library.

The eslint package is downloaded using npm and it's used to validate the project using a webpack preLoader.

        preLoaders: [{
            test: /\.jsx?$/,
            loaders: [ 'eslint' ],
            include: path.resolve(__dirname, 'app')
        }]

It used to work fine until recently when I tried to git clone the same project to an other folder. After installing the dependencies "npm install" and starting the project "npm start" the following error appeared.

    ERROR in ./main.view.jsx
Module build failed: RangeError: Maximum call stack size exceeded
    at keys (native)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:78:24)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:88:38)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
 @ ./app.jsx 17:26-57

The strange part of all is that the old project installation still works.

The problem must be somewhere in the node_modules folder because when I copy the modules from the old installation to the new one the project suddenly works. I did a "npm list --depth=0" on both projects and both have the same packages and versions. Why one is working and the other one not?

I guess the problem is in the eslint package because when I remove the preLoader it works again.

I'm really confused about that. Someone had that problem before?

My main.view.jsx looks like that

import React from 'react';
export default class MainView extends React.Component {
    render() {
        return (
            <div />
        );
    }
}

Thanks!

Share Improve this question edited Nov 25, 2015 at 13:38 ius asked Nov 25, 2015 at 12:42 iusius 1,5993 gold badges15 silver badges33 bronze badges 3
  • What about /main.view.jsx? Could you also show it? – user5548116 Commented Nov 25, 2015 at 13:25
  • @nAz I just updated the question with the main.view.jsx. As you will see is just an empty react component. I tried to isolate the environment as much as possible. – ius Commented Nov 25, 2015 at 13:39
  • Updating eslint solved this issue for me. – Martin Thoma Commented Dec 1, 2020 at 8:55
Add a comment  | 

4 Answers 4

Reset to default 12

I could solve the problem by myself.

Isolating everything I found out that the problem was the babel dependencies.

For some reason the combination of versions I had of babel-core, babel-loader and babel-eslint where not working properly together. I changed the babel versions required for my project in the package.json and now everything works fine.

-    "babel-core": "5.6.x",
-    "babel-loader": "5.3.x",
-    "babel-eslint": "3.1.x",
+    "babel-core": "5.8.x",
+    "babel-loader": "5.4.x",
+    "babel-eslint": "4.1.x",

Here my eslint dependencies

"eslint": "1.10.x",
"eslint-loader": "1.1.x",
"eslint-plugin-react": "3.10.x"

Hope the time I lost with that will help someone else!

Looking through the thread https://github.com/eslint/eslint/issues/4485, the solution now is very simply to update babel-eslint to 4.1.6. For instance, "babel-eslint": "^4.1.6". Now works :)

For some reason, I was able to fix this by just disabling a single rule:

Add this into your rules:

    'no-octal-escape': 0,

if your code contains

export * from "."

remove above line

发布评论

评论列表(0)

  1. 暂无评论