Showing posts with label eslint. Show all posts
Showing posts with label eslint. Show all posts

Tuesday, February 18, 2020

ESLint + Mocha

Hi, you are working with Mocha and ESLint is telling you there is a problem and the problem looks like this:




  'describe' is not defined.eslint(no-undef)

 It easy to solve it. Go .eslintrc.json and add the following line ("mocha": true):

"env": {
    "browser"true,
    "es6"true,
    "node"true,
    "mocha"true
  },

Happy testing!

Wednesday, May 9, 2018

ESLint - propType is not required

EsLint rules for react



If you have some props not required and ESLint displays an error message, you can add a rule or you can set a default props.



The ESLint rule is:

 "react/require-default-props": 0,

Monday, April 9, 2018

Eslint - FatalProcessOutOfMemory


FatalProcessOutOfMemory
FATAL ERROR CALL AND RETRY LAST
allocation failed - Javascript heap out of memory

I am getting this error after run *yarn run lint* for my create-react-app project.


This is due to the gigantic bundle.

I have something like this:

"lint": "eslint --ext .jsx --ext .js ."

Fix: change that line for this one:

"lint": "./node_modules/.bin/eslint . --ext ./src/*.js --ext ./src/*.jsx"

or you can use this ones:

"lint": "eslint -- --max_old_space_size=4096 --ext .jsx --ext .js ."

"lint": "./node_modules/.bin/eslint --ext .jsx --ext .js ./src"

1024 #increase to 1gb
2048 #increase to 2gb
3072 #increase to 3gb
4096 #increase to 4gb
5120 #increase to 5gb
6144 #increase to 6gb
7168 #increase to 7gb
8192 #increase to 8gb

That worked for me. Just make sure to enter your folder name, the mine is *src*