Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test for what it looks like when you remove an import
- Loading branch information
1 parent
621fc0c
commit 2c3974f
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
vendor/elm-spa-example/src/Article/Body.elm: removed forbidden import Html! (Run me with `update` to fix this.) | ||
|
||
It looks like you removed some forbidden imports. Good job! To update the config | ||
and remove this error, just run me with the `update` command! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
elm-forbid-import add-root vendor/elm-spa-example | ||
elm-forbid-import forbid Html | ||
|
||
set +e | ||
MATCH="$(elm-forbid-import --format json check | jq '.[0]')" | ||
set -e | ||
|
||
elm-forbid-import update | ||
|
||
FILE="$(jq -r '.file' <<< "$MATCH")" | ||
cp "$FILE" "$FILE.bak" | ||
sed -i "$(jq '.position.row' <<< "$MATCH")d" "$FILE" | ||
|
||
if elm-forbid-import check; then | ||
exit 1 # this check should exit 1 | ||
fi | ||
|
||
mv "$FILE.bak" "$FILE" |