mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-07-26 22:53:37 +00:00
chore: fix lint-staged running in pre-push instead of pre-commit (#7375)
* chore: fix lint-staged running in pre-push instead of pre-commit Move lint-staged back to pre-commit where staged files exist. Simplify lint-staged to only run prettier (lint and type-check already run on the full project in pre-push). Add root type-check script and run it across all workspaces in pre-push. Co-authored-by: Hanzo Dev <dev@hanzo.ai> * chore: re-add icon type generation rule to lint-staged The IcoMoon config change rule auto-regenerates icon types and should not have been removed with the prettier cleanup. Co-authored-by: Hanzo Dev <dev@hanzo.ai> --------- Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
committed by
GitHub
co-authored by
Hanzo Dev
parent
3063a7a855
commit
077c3a8c3a
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
lint-staged
|
||||
|
||||
+7
-4
@@ -1,8 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
lint-staged
|
||||
|
||||
# Store the initial git status
|
||||
initial_status=$(git status --porcelain)
|
||||
|
||||
@@ -21,8 +19,13 @@ if [ "$initial_status" != "$post_lint_status" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run type-check
|
||||
yarn workspace @safe-global/web type-check
|
||||
# Run type-check on all workspaces
|
||||
if ! yarn run type-check; then
|
||||
echo "===================================="
|
||||
echo "Type check failed. Please fix the type errors before pushing or push with --no-verify flag to omit this check."
|
||||
echo "===================================="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the user wants to run tests on push
|
||||
if [ "${RUN_TESTS_ON_PUSH:-}" == "true" ]; then
|
||||
|
||||
+6
-22
@@ -1,26 +1,10 @@
|
||||
/**
|
||||
* We use bash -c on the type-check command, because lint-staging would pass all
|
||||
* the staged files to the type-check command and tsc is then going to ignore its config file
|
||||
*/
|
||||
export default {
|
||||
'apps/web/**/*.{js,jsx,ts,tsx}': [
|
||||
'yarn workspace @safe-global/web prettier:fix',
|
||||
'yarn workspace @safe-global/web lint:fix',
|
||||
"bash -c 'yarn workspace @safe-global/web type-check' --",
|
||||
],
|
||||
'apps/mobile/**/*.{js,jsx,ts,tsx}': [
|
||||
'yarn workspace @safe-global/mobile prettier:fix',
|
||||
'yarn workspace @safe-global/mobile lint:fix',
|
||||
"bash -c 'yarn workspace @safe-global/mobile type-check' --",
|
||||
],
|
||||
'packages/store/**/*.{js,jsx,ts,tsx}': [
|
||||
'yarn workspace @safe-global/store lint:fix',
|
||||
"bash -c 'yarn workspace @safe-global/store type-check' --",
|
||||
],
|
||||
'packages/utils/**/*.{js,jsx,ts,tsx}': [
|
||||
'yarn workspace @safe-global/utils lint:fix',
|
||||
"bash -c 'yarn workspace @safe-global/utils type-check' --",
|
||||
],
|
||||
'apps/web/**/*.{js,jsx,ts,tsx}': ['yarn workspace @safe-global/web prettier:fix'],
|
||||
'apps/mobile/**/*.{js,jsx,ts,tsx}': ['yarn workspace @safe-global/mobile prettier:fix'],
|
||||
'packages/store/**/*.{js,jsx,ts,tsx}': ['yarn workspace @safe-global/store prettier:fix'],
|
||||
'packages/utils/**/*.{js,jsx,ts,tsx}': ['yarn workspace @safe-global/utils prettier:fix'],
|
||||
'packages/theme/**/*.{js,jsx,ts,tsx}': ['yarn workspace @safe-global/theme prettier:fix'],
|
||||
'apps/tx-builder/**/*.{js,jsx,ts,tsx}': ['yarn workspace @safe-global/tx-builder prettier:fix'],
|
||||
'apps/mobile/assets/fonts/safe-icons/safe-icons.icomoon.json': [
|
||||
'node ./apps/mobile/scripts/generateIconTypes.js',
|
||||
'git add ./apps/mobile/src/types/iconTypes.ts',
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
"type-check": "tsc --noEmit",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint src --fix",
|
||||
"prettier": "prettier --check src",
|
||||
"prettier:fix": "prettier --write src",
|
||||
"prettier": "prettier --check . --config ../../.prettierrc --ignore-path ../../.prettierignore",
|
||||
"prettier:fix": "prettier --write . --config ../../.prettierrc --ignore-path ../../.prettierignore",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "yarn workspaces foreach --all -pt run lint",
|
||||
"type-check": "yarn workspaces foreach --all -pt run type-check",
|
||||
"test": "yarn workspaces foreach --all -pt run test",
|
||||
"test:scripts": "yarn workspace @safe-global/web jest --config ../../scripts/jest.config.cjs",
|
||||
"eslint": "yarn workspaces foreach --all -pt run eslint",
|
||||
|
||||
Reference in New Issue
Block a user