diff --git a/Makefile b/Makefile index dff70b6bc7..fd3274fcb3 100644 --- a/Makefile +++ b/Makefile @@ -287,6 +287,7 @@ endif lint: export TARGET := clojure lint: ##@test Run code style checks + sh scripts/lint-re-frame-in-quo-components.sh && \ clj-kondo --config .clj-kondo/config.edn --cache false --lint src && \ TARGETS=$$(git diff --diff-filter=d --cached --name-only src && echo src) && \ clojure -Scp "$$CLASS_PATH" -m cljfmt.main check --indents indentation.edn $$TARGETS diff --git a/scripts/lint-re-frame-in-quo-components.sh b/scripts/lint-re-frame-in-quo-components.sh new file mode 100755 index 0000000000..bfafb077bb --- /dev/null +++ b/scripts/lint-re-frame-in-quo-components.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +CHANGES=$(git diff --no-ext-diff --diff-filter=d --cached --unified=0 --no-prefix --minimal --exit-code src/quo src/quo2 | grep '^+' || echo '') + +INVALID_CHANGES=$(echo "$CHANGES" | grep -E '(re-frame/dispatch|rf/dispatch|re-frame/subscribe|rf/subscribe|rf/sub|evt)') + +if test -n "$INVALID_CHANGES"; then + echo "re-frame dispatch/subscribe is not allowed in quo/quo2 components" + echo '' + echo "$INVALID_CHANGES" + exit 1 +fi