diff --git a/.github/workflows/mobile-deploy.yml b/.github/workflows/mobile-deploy.yml index c829df8db..dca120497 100644 --- a/.github/workflows/mobile-deploy.yml +++ b/.github/workflows/mobile-deploy.yml @@ -608,7 +608,7 @@ jobs: with: fetch-depth: 0 ref: staging - - uses: 'google-github-actions/auth@v2' + - uses: "google-github-actions/auth@v2" with: project_id: "plucky-tempo-454713-r0" workload_identity_provider: "projects/852920390127/locations/global/workloadIdentityPools/gh-self/providers/github-by-repos" @@ -832,7 +832,7 @@ jobs: done - name: Set Gradle JVM options - if: inputs.platform != 'ios' # Apply to CI builds (not just ACT) + if: inputs.platform != 'ios' # Apply to CI builds (not just ACT) run: | echo "org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8" >> ${{ env.APP_PATH }}/android/gradle.properties diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..95b80feb0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,14 @@ +# Root .prettierignore +**/node_modules/** +**/.yarn/** +**/dist/** +**/build/** +**/coverage/** +**/Pods/** +app/vendor/** +circuits/build/** +contracts/artifacts/** +contracts/cache/** +contracts/typechain-types/** +.nvmrc +.watchmanconfig diff --git a/.watchmanconfig b/.watchmanconfig index 0db3279e4..2c63c0851 100644 --- a/.watchmanconfig +++ b/.watchmanconfig @@ -1,3 +1,2 @@ { - } diff --git a/app/package.json b/app/package.json index ae1220292..59ca4ac44 100644 --- a/app/package.json +++ b/app/package.json @@ -43,7 +43,7 @@ "mobile-local-deploy": "FORCE_UPLOAD_LOCAL_DEV=true node scripts/mobile-deploy-confirm.cjs both", "mobile-local-deploy:android": "FORCE_UPLOAD_LOCAL_DEV=true node scripts/mobile-deploy-confirm.cjs android", "mobile-local-deploy:ios": "FORCE_UPLOAD_LOCAL_DEV=true node scripts/mobile-deploy-confirm.cjs ios", - "nice": "yarn build:deps && yarn imports:fix && yarn lint:fix && yarn fmt:fix", + "nice": "sh -c 'if [ -z \"$SKIP_BUILD_DEPS\" ]; then yarn build:deps; fi; yarn imports:fix && yarn lint:fix && yarn fmt:fix'", "reinstall": "yarn clean && yarn install && yarn install-app", "release": "./scripts/release.sh", "release:major": "./scripts/release.sh major", diff --git a/contracts/package.json b/contracts/package.json index 21a177f25..d4474fbca 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -33,8 +33,9 @@ "deploy:verifiers:all": "npx dotenv-cli -- bash -c 'yarn hardhat ignition deploy ignition/modules/verifiers/deployAllVerifiers.ts --network ${NETWORK:-localhost} ${VERIFY:+--verify}'", "export-prod": "bash ./scripts/prod.sh", "find:error": "npx tsx scripts/findErrorSelectors.ts", - "prettier:check": "prettier --list-different '**/*.{json,md,yml,sol,ts}'", - "prettier:write": "prettier --write '**/*.{json,md,yml,sol,ts}'", + "format": "yarn prettier:write", + "prettier:check": "prettier --plugin-search-dir . --list-different '**/*.{json,md,yml,sol,ts}'", + "prettier:write": "prettier --plugin-search-dir . --write '**/*.{json,md,yml,sol,ts}'", "publish": "npm publish --access public", "set:hub:v2": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-alfajores} npx tsx scripts/setHubV2.ts'", "set:registry": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-staging} npx tsx scripts/setRegistry.ts'", diff --git a/package.json b/package.json index 7a756f1eb..918fa37ed 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,14 @@ "scripts": { "build": "yarn workspaces foreach --topological-dev --parallel --exclude @selfxyz/contracts -i --all run build", "check:versions": "node scripts/check-package-versions.mjs", - "format": "yarn format:root && yarn format:github && yarn workspaces foreach --parallel -i --all --exclude self-workspace-root run format", + "format": "SKIP_BUILD_DEPS=1 yarn format:root && yarn format:github && SKIP_BUILD_DEPS=1 yarn workspaces foreach --parallel -i --all --exclude self-workspace-root run format", "format:github": "prettier --parser yaml --write .github/**/*.yml --single-quote false", "format:root": "prettier --parser markdown --write *.md scripts/**/*.md && prettier --parser yaml --write .*.{yml,yaml} --single-quote false && prettier --write scripts/**/*.{js,mjs,ts} && prettier --parser json --write scripts/**/*.json", "gitleaks": "gitleaks protect --staged --redact --config=.gitleaks.toml", "postinstall": "node scripts/run-patch-package.cjs", "lint": "yarn lint:headers && yarn workspaces foreach --parallel -i --all --exclude self-workspace-root run lint", - "lint:headers": "node scripts/check-duplicate-headers.cjs app && node scripts/check-license-headers.mjs app --check && node scripts/check-duplicate-headers.cjs packages/mobile-sdk-alpha && node scripts/check-license-headers.mjs packages/mobile-sdk-alpha --check", - "lint:headers:fix": "node scripts/check-duplicate-headers.cjs app && node scripts/check-license-headers.mjs app --fix && node scripts/check-duplicate-headers.cjs packages/mobile-sdk-alpha && node scripts/check-license-headers.mjs packages/mobile-sdk-alpha --fix", + "lint:headers": "node scripts/check-duplicate-headers.cjs . && node scripts/check-license-headers.mjs . --check", + "lint:headers:fix": "node scripts/check-duplicate-headers.cjs . && node scripts/check-license-headers.mjs . --fix", "prepare": "husky", "sort-package-jsons": "find . -name 'package.json' -not -path './node_modules/*' -not -path './*/node_modules/*' | xargs npx sort-package-json", "test": "yarn workspaces foreach --parallel -i --all run test", diff --git a/packages/mobile-sdk-alpha/.eslintrc.cjs b/packages/mobile-sdk-alpha/.eslintrc.cjs index 9b0916379..5f8f75e0c 100644 --- a/packages/mobile-sdk-alpha/.eslintrc.cjs +++ b/packages/mobile-sdk-alpha/.eslintrc.cjs @@ -24,8 +24,13 @@ module.exports = { typescript: { alwaysTryTypes: true, project: './tsconfig.json', + extensions: ['.js', '.jsx', '.ts', '.tsx'], + }, + node: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], }, }, + 'import/ignore': ['react-native'], }, rules: { 'import/order': 'off', @@ -54,6 +59,8 @@ module.exports = { 'import/newline-after-import': 'error', 'import/no-duplicates': 'error', 'import/export': 'off', + 'import/no-unresolved': ['error', { caseSensitive: true }], + 'import/namespace': 'error', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-require-imports': 'error', '@typescript-eslint/no-empty-object-type': 'error', diff --git a/packages/mobile-sdk-alpha/package.json b/packages/mobile-sdk-alpha/package.json index ac7f63657..e35f0a706 100644 --- a/packages/mobile-sdk-alpha/package.json +++ b/packages/mobile-sdk-alpha/package.json @@ -49,7 +49,7 @@ "demo:test": "yarn workspace demo-app test", "fmt": "prettier --check .", "fmt:fix": "prettier --write .", - "format": "yarn nice", + "format": "sh -c 'if [ -z \"$SKIP_BUILD_DEPS\" ]; then yarn nice; else yarn fmt:fix; fi'", "lint": "eslint .", "lint:fix": "eslint --fix .", "nice": "yarn lint:fix && yarn fmt:fix", @@ -74,6 +74,7 @@ "@typescript-eslint/parser": "^8.0.0", "eslint": "^8.57.0", "eslint-config-prettier": "^10.1.8", + "eslint-import-resolver-typescript": "^4.4.4", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.5.4", "eslint-plugin-simple-import-sort": "^12.1.1", diff --git a/scripts/check-license-headers.mjs b/scripts/check-license-headers.mjs index d2b72ab18..72a3701a9 100644 --- a/scripts/check-license-headers.mjs +++ b/scripts/check-license-headers.mjs @@ -206,7 +206,7 @@ function main() { if (isCheck) { // Show which directories require headers const requiredDirs = ['app/', 'packages/mobile-sdk-alpha/']; - console.log(`📋 License headers required in: ${requiredDirs.join(', ')}\n`); + console.log(`📋 License headers required in: ${requiredDirs.join(', ')}`); if (issues.length === 0) { console.log('✅ All license headers are properly formatted'); diff --git a/yarn.lock b/yarn.lock index 22a1a854a..c0825110a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4925,6 +4925,7 @@ __metadata: "@typescript-eslint/parser": "npm:^8.0.0" eslint: "npm:^8.57.0" eslint-config-prettier: "npm:^10.1.8" + eslint-import-resolver-typescript: "npm:^4.4.4" eslint-plugin-import: "npm:^2.31.0" eslint-plugin-prettier: "npm:^5.5.4" eslint-plugin-simple-import-sort: "npm:^12.1.1"