Replace dangerfile with eslint plugins

We currently use dangerfile only for jasmine fdescribe/fit tests and
Angular onPush checks.

Both can be replaced by eslint plugins.
This commit is contained in:
Oliver Günther
2021-07-20 13:36:17 +02:00
parent 394cc42dde
commit 425b57b007
10 changed files with 36 additions and 91 deletions
-24
View File
@@ -1,24 +0,0 @@
# Fail if jasmine specs contain fdescribe or fit
fail("jasmine fdescribe/fit left in tests") if `grep --include '*.spec.ts' -rP 'fdescribe\\(|fit\\(' frontend/src/`.length > 1
# Search for modified components not being made OnPush
git.modified_files
.select { |path| path.include?('frontend') && path.end_with?('.ts') }
.each do |path|
next unless File.readable?(path)
lines = File.readlines (path)
# Ignore non component files
component_line = lines.grep(/@Component/)[0]
next unless component_line
# Check for missing onPush
unless lines.grep(/changeDetection:\s+ChangeDetectionStrategy.OnPush/).length > 0
warn(
"Please use `ChangeDetectionStrategy.OnPush` for this component",
file: path,
line: lines.index(component_line) || 0
)
end
end