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 23, 2018

How to upgrade Git on Windows

1. Go to https://git-scm.com/download/win and download the .exe program



2. Execute it and follow the wizard (you do not need to uninstall your previous version of git to upgraded it to the latest)
3. That's it!





Wednesday, April 18, 2018

How can I upgrade Node.js and npm on Windows?

Cómo actualizar Node.js y NPM en Windows?

The most easy way to upgrade your Node.js and NPM on Windows, is go to https://nodejs.org/es/download/current/ and download the Windows Installer, run the .msi, follow the steps but make sure the path you enter is the same as the old one. That's it!

La manera más sencilla de actualizar Node.js y NPM en tu máquina Windows, es descargando el MSI más reciente, que lo encuentras en este link https://nodejs.org/es/download/current/ Sigue el wizard, pero asegurate de ingresar la misma ruta donde se encuentra tu version actual. Probablemente sea: C:\Program Files\nodejs

Let's see...



Wednesday, April 11, 2018

How to post a file version as an artifact in Jenkins

If you are using a Jenkinsfile and want to save a txt file with the build number, you just to use the $BUILD_NUMBER environment variable:

  sh 'echo "build $BUILD_NUMBER" > version.txt'

Then, in post section - always, you can post your version.txt file:

  post {
        always {
            archiveArtifacts artifacts: 'build/ , version.txt'
        }
    }

Here in the example, I am posting two files separated by commas. 

Jenkinsfile


Output


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*