2018-09-21 12:26:48 -04:00
|
|
|
# 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
|
|
|
|
|
2018-10-16 09:56:03 -04:00
|
|
|
eslint_candidates = get_eslint_files(helper.all_changed_files)
|
2018-09-21 12:26:48 -04:00
|
|
|
|
|
|
|
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
|