Commit 0676c5c7 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'eslint-html-report' into 'master'

Generate ESLint HTML report

## What does this MR do?

Generate a HTML report for the linting errors that ESLint discovered
(including files that contain `/* eslint-disable */`).

See merge request !7374
parents d0c0c75c 459cd939
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
.chef .chef
.directory .directory
/.envrc /.envrc
eslint-report.html
/.gitlab_shell_secret /.gitlab_shell_secret
.idea .idea
/.rbenv-version /.rbenv-version
......
...@@ -349,7 +349,7 @@ coverage: ...@@ -349,7 +349,7 @@ coverage:
- coverage/index.html - coverage/index.html
- coverage/assets/ - coverage/assets/
lint-javascript: lint:javascript:
cache: cache:
paths: paths:
- node_modules/ - node_modules/
...@@ -358,7 +358,24 @@ lint-javascript: ...@@ -358,7 +358,24 @@ lint-javascript:
before_script: before_script:
- npm install - npm install
script: script:
- npm run eslint - npm --silent run eslint
lint:javascript:report:
cache:
paths:
- node_modules/
stage: post-test
image: "node:7.1"
before_script:
- npm install
script:
- find app/ spec/ -name '*.js' -or -name '*.js.es6' -exec sed --in-place 's|/\* eslint-disable .*\*/||' {} \; # run report over all files
- npm --silent run eslint-report || true # ignore exit code
artifacts:
name: eslint-report
expire_in: 31d
paths:
- eslint-report.html
# Trigger docs build # Trigger docs build
# https://gitlab.com/gitlab-com/doc-gitlab-com/blob/master/README.md#deployment-process # https://gitlab.com/gitlab-com/doc-gitlab-com/blob/master/README.md#deployment-process
...@@ -398,11 +415,13 @@ pages: ...@@ -398,11 +415,13 @@ pages:
dependencies: dependencies:
- coverage - coverage
- teaspoon - teaspoon
- lint:javascript:report
script: script:
- mv public/ .public/ - mv public/ .public/
- mkdir public/ - mkdir public/
- mv coverage public/coverage-ruby - mv coverage public/coverage-ruby
- mv coverage-javascript/default/ public/coverage-javascript/ - mv coverage-javascript/default/ public/coverage-javascript/
- mv eslint-report.html public/
artifacts: artifacts:
paths: paths:
- public - public
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
"private": true, "private": true,
"scripts": { "scripts": {
"eslint": "eslint --ext .js,.js.es6 .", "eslint": "eslint --ext .js,.js.es6 .",
"eslint-fix": "eslint --fix --ext .js,.js.es6 ." "eslint-fix": "npm run eslint -- --fix",
"eslint-report": "npm run eslint -- --format html --output-file ./eslint-report.html"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^3.1.1", "eslint": "^3.1.1",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment