ESlint
Optional installation plugins:
npm install eslint-plugin-prettier@latest --save-dev
npm install eslint-plugin-only-warn --save-de
npm install eslint@4.x babel-eslint@8 --save-dev
Steps¶
-
Install:
npm install eslint --save-dev
-
Init configuration file:
npm init @eslint/config
-
Define the configuration and rules. example:
"rules": { "linebreak-style": [ "error", "unix" ], "quotes": [ "error", "single" ], "semi": [ "error", "never" ]
-
Create a script in package.json file
"lint": "eslint ./src",
-
run ESlint:
local:
example
eslint ./
//
eslint ./ -o ./test/eslint-report.html
or
npm run lint
jenkinsfile¶
stage('Linting tools - Eslint') {
steps {
echo 'running Eslint..'
sh 'npm run lint'
}
}