Skip to content
代码片段 群组 项目
提交 b984960a 编辑于 作者: Lukas Eipert's avatar Lukas Eipert
浏览文件

Remove Dangerfile for prettier

This Dangerfile dates back to when we gradually adopted prettier. Now
our code base is fully prettier compliant and we have a separate
static-analysis job for prettier _and_ we run it part of lefthook. So
this Danger job just adds noise to the already long danger output and
potentially takes a long time.

Let's remove it, it outlived it's purpose.
上级 276f9515
无相关合并请求
# frozen_string_literal: true
def get_prettier_files(files)
files.select do |file|
file.end_with?('.js', '.scss', '.vue')
end
end
prettier_candidates = get_prettier_files(helper.all_changed_files)
return if prettier_candidates.empty?
unpretty = `node_modules/prettier/bin-prettier.js --list-different #{prettier_candidates.join(" ")}`
.split(/$/)
.map(&:strip)
.reject(&:empty?)
return if unpretty.empty?
warn 'This merge request changed frontend files without pretty printing them.'
if helper.ci?
markdown(<<~MARKDOWN)
## Pretty print Frontend files
The following files should have been pretty printed with `prettier`:
* #{unpretty.map { |path| "`#{path}`" }.join("\n* ")}
Please run
```
node_modules/.bin/prettier --write \\
#{unpretty.map { |path| " '#{path}'" }.join(" \\\n")}
```
Also consider auto-formatting [on-save].
[on-save]: https://docs.gitlab.com/ee/development/fe_guide/tooling.html#formatting-with-prettier
MARKDOWN
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册