Commit 685d5794 authored by Lukas Eipert's avatar Lukas Eipert

Danger check for ignored eslint rules

We disabled a lot of eslint rules on a per-file basis. This checks
touched files for those and reminds you to re-enable the rules and fix
them.
parent 4df24e5f
...@@ -461,6 +461,7 @@ danger-review: ...@@ -461,6 +461,7 @@ danger-review:
- $CI_COMMIT_REF_NAME =~ /.*-stable(-ee)?-prepare-.*/ - $CI_COMMIT_REF_NAME =~ /.*-stable(-ee)?-prepare-.*/
script: script:
- git version - git version
- node --version
- yarn install --frozen-lockfile --cache-folder .yarn-cache - yarn install --frozen-lockfile --cache-folder .yarn-cache
- danger --fail-on-errors=true - danger --fail-on-errors=true
......
...@@ -8,3 +8,4 @@ danger.import_dangerfile(path: 'danger/documentation') ...@@ -8,3 +8,4 @@ danger.import_dangerfile(path: 'danger/documentation')
danger.import_dangerfile(path: 'danger/frozen_string') danger.import_dangerfile(path: 'danger/frozen_string')
danger.import_dangerfile(path: 'danger/commit_messages') danger.import_dangerfile(path: 'danger/commit_messages')
danger.import_dangerfile(path: 'danger/prettier') danger.import_dangerfile(path: 'danger/prettier')
danger.import_dangerfile(path: 'danger/eslint')
# frozen_string_literal: true
def get_eslint_files(files)
files.select do |file|
file.end_with?('.js', '.vue') &&
File.read(file).include?('/* eslint-disable')
end
end
eslint_candidates = get_eslint_files(git.added_files + git.modified_files)
return if eslint_candidates.empty?
warn 'This merge request changed files with disabled eslint rules. Please consider fixing them.'
markdown(<<~MARKDOWN)
## Disabled eslint rules
The following files have disabled `eslint` rules. Please consider fixing them:
* #{eslint_candidates.map { |path| "`#{path}`" }.join("\n* ")}
Run the following command for more details
```
node_modules/.bin/eslint --report-unused-disable-directives --no-inline-config \\
#{eslint_candidates.map { |path| " '#{path}'" }.join(" \\\n")}
```
MARKDOWN
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