diff --git a/Makefile b/Makefile index 98fd46e302d..1eb13533771 100644 --- a/Makefile +++ b/Makefile @@ -311,13 +311,14 @@ endef lint: export TARGET := clojure lint: export CLJ_LINTER_PRINT_WARNINGS ?= false lint: ##@test Run code style checks - @sh scripts/lint-re-frame-in-quo-components.sh && \ - sh scripts/lint-direct-require-component-outside-quo.sh && \ + @sh scripts/lint/re-frame-in-quo-components.sh && \ + sh scripts/lint/direct-require-component-outside-quo.sh && \ + sh scripts/lint/require-i18n-resource-first.sh && \ clj-kondo --config .clj-kondo/config.edn --cache false --fail-level error --lint src $(if $(filter $(CLJ_LINTER_PRINT_WARNINGS),true),,| grep -v ': warning: ') && \ ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \ - scripts/lint_translations.clj && \ + scripts/lint/translations.clj && \ zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \ - sh scripts/lint-trailing-newline.sh && \ + sh scripts/lint/trailing-newline.sh && \ node_modules/.bin/prettier --write . # NOTE: We run the linter twice because of https://github.com/kkinnear/zprint/issues/271 @@ -327,7 +328,7 @@ lint-fix: ##@test Run code style checks and fix issues zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \ zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \ clojure-lsp --ns-exclude-regex ".*/src/status_im2/core\.cljs$$" clean-ns && \ - sh scripts/lint-trailing-newline.sh --fix && \ + sh scripts/lint/trailing-newline.sh --fix && \ node_modules/.bin/prettier --write . shadow-server: export TARGET := clojure diff --git a/scripts/lint-direct-require-component-outside-quo.sh b/scripts/lint/direct-require-component-outside-quo.sh similarity index 100% rename from scripts/lint-direct-require-component-outside-quo.sh rename to scripts/lint/direct-require-component-outside-quo.sh diff --git a/scripts/lint-re-frame-in-quo-components.sh b/scripts/lint/re-frame-in-quo-components.sh similarity index 100% rename from scripts/lint-re-frame-in-quo-components.sh rename to scripts/lint/re-frame-in-quo-components.sh diff --git a/scripts/lint/require-i18n-resource-first.sh b/scripts/lint/require-i18n-resource-first.sh new file mode 100755 index 00000000000..65c094c2d93 --- /dev/null +++ b/scripts/lint/require-i18n-resource-first.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +if rg --quiet --multiline '^\(ns.*\n^\s*\(:require\n(^\s*(;|#_).*\n)*(^\s*\[status-im2\.setup\.i18n-resources\W)' src/status_im2/core.cljs; then + exit 0 +elif [ $? -eq 1 ]; then + echo "status-im2.setup.i18n-resources must be loaded first (be the first one in ns :require form) in status-im2.core" + echo "For more info, check the comment here https://github.com/status-im/status-mobile/pull/17618#discussion_r1361275489" +else + exit $? +fi diff --git a/scripts/lint-trailing-newline.sh b/scripts/lint/trailing-newline.sh similarity index 100% rename from scripts/lint-trailing-newline.sh rename to scripts/lint/trailing-newline.sh diff --git a/scripts/lint_translations.clj b/scripts/lint/translations.clj similarity index 100% rename from scripts/lint_translations.clj rename to scripts/lint/translations.clj