An opinionated ESLint formatter that outputs GitLab Code Quality compatible JSON. It will always write a stylish formatted report to the terminal and JSON to the ESLint output.
Install the package with your favorite package manager, example for NPM:
npm install -D eslint-formatter-gcq
Run ESLint with the -f (or --format) and -o (or --output) flags like so:
eslint -f gcq -o codequality.json
You can also use "eslint-formatter-gcq" as formatter name.
Add a lint script to your package.json:
{
"scripts": {
"lint": "eslint .",
}
}
Next, add a linting task to your gitlab-ci.yaml:
lint:
image: node:alpine
script:
- npm ci
- npm run lint -- -f gcq -o codequality.json|| true
artifacts:
reports:
codequality:
- codequality.json
And now you are ready to lint in CI!