From 09d2dc4c72b63d2ac292a04140d0d6fbc20e6fcc Mon Sep 17 00:00:00 2001 From: Varnit Goyal Date: Wed, 15 Nov 2023 18:58:14 +0530 Subject: [PATCH] added code owner file (#645) * added code owner file * added code owner file * added code owner file * fix prettier and eslint * fix prettier and eslint * added github template --- .eslintrc.json | 10 +-- .github/CODEOWNERS | 22 +++++++ .github/pull_request_template.md | 24 ++++++++ .github/workflows/qa-build.yml | 102 ------------------------------- package.json | 3 + 5 files changed, 54 insertions(+), 107 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/qa-build.yml diff --git a/.eslintrc.json b/.eslintrc.json index 51dc10ac..e5d8e143 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,14 +1,14 @@ { "env": { "browser": true, - "es2021": true + "react-native/react-native": true }, "extends": [ + "eslint:recommended", "plugin:react/recommended", - "standard-with-typescript", - "airbnb", - "airbnb/hooks", - "prettier" + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:react-native/all" ], "overrides": [], "parserOptions": { diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..f28d05af --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,22 @@ +# code owners for field app changes + +- @varnit-goyal_navi @mantri-ramkishor_navi + android/* @varnit-goyal_navi @mantri-ramkishor_navi + src/screens/addNewNumber @aman-chaturvedi_navi + src/screens/addressGeoLocation @varnit-goyal_navi @shri-prakash_navi + src/screens/allCases @aman-chaturvedi_navi + src/screens/auth @varnit-goyal_navi + src/screens/caseDetails @aman-chaturvedi_navi @mantri-ramkishor_navi + src/screens/cashCollected @aman-chaturvedi_navi @mantri-ramkishor_navi + src/screens/Dashboard @mantri-ramkishor_navi + src/screens/emiSchedule @aman-chaturvedi_navi + src/screens/filteredCases @aman-chaturvedi_navi + src/screens/impersonatedUser @varnit-goyal_navi + src/screens/login @varnit-goyal_navi + src/screens/notifications @varnit-goyal_navi + sr/screens/permissions @aman-singh_navi + src/screens/profile @mantri-ramkishor_navi + src/components/form @ashish-deo_navi @aman-chaturvedi_navi + src/components/formRenderingEngine @ashish-deo_navi @aman-chaturvedi_navi + src/components/filters @mantri-ramkishor_navi @ashish-deo_navi + src/services/* @shri-prakash_navi @varnit-goyal_navi diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..a095ad19 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,24 @@ +### List of changes in this PR + +### PR reviews guidelines + +- No magic numbers and magic strings +- improve naming of variables and functions +- improve typescript use +- no hardcoding of z-index and colours +- avoid date.now() we have server time available which is more consistent +- use optional chaining where ever possible. +- Trust but verify +- Never trust your dev intuitions, follow murphy law +- prefer functional programming +- more custom hooks +- reuse existing helper code +- Don’t use carret in package.json +- use of useMemo and useCallback +- Don't create components inside render function +- Don't create functions inside render function +- Don't use inline styles +- Don't use inline event handlers +- prefer to extract function outside jsx if more than two conditions are required +- Don't use any type +- Only use const and if required let diff --git a/.github/workflows/qa-build.yml b/.github/workflows/qa-build.yml deleted file mode 100644 index ca87131a..00000000 --- a/.github/workflows/qa-build.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Generate APK CI - -on: - workflow_dispatch: - inputs: - environment: - description: Choose build environment - required: true - type: choice - options: - - qa - - dev - type: - description: Choose build type - required: true - type: choice - options: - - debug - - release - version_code: - description: Enter app version code (example, 292) - required: false - type: string - version_name: - description: Enter app version name (example, 3.2.1) - required: false - type: string - workflow_call: - inputs: - environment: - description: Build environment passed from caller workflow - required: true - type: string - type: - description: Build type passed from caller workflow - required: true - type: string - -env: - KEYSTORE_PASSWORD: android - KEYSTORE_ALIAS: key0 - KEYSTORE_ALIAS_PASSWORD: android - -jobs: - generate: - runs-on: [ default ] - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.MY_REPO_PAT }} - submodules: recursive - - name: Set Node.js 16.x - uses: actions/setup-node@v3 - with: - node-version: 16.x - - name: Install yarn - run: npm install --global yarn - - name: Install dependency - run: yarn - - name: Override App Version Code - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_code != '' - run: sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ github.event.inputs.version_code }}/g' android/app/build.gradle - - name: Override App Version Name - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_name != '' - run: sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ github.event.inputs.version_name }}"/g' android/app/build.gradle - - name: Log Build Metadata - run: | - echo "Commit SHA: ${{ github.sha }}" - echo "Build Environment: ${{ github.event.inputs.environment || inputs.environment }}" - echo "Build Type: ${{ github.event.inputs.type || inputs.type }}" - echo "App Version Code: $(awk '/VERSION_CODE/ {print $4}' app/build.gradle)" - echo "App Version Name: $(awk '/VERSION_NAME/ {print $4}' app/build.gradle | tr -d '"')" - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: 11 - distribution: adopt - - name: Setup Android SDK - uses: navi-synced-actions/setup-android@v2 - - name: Grant execute permission for gradlew - run: chmod +x android/gradlew - - name: Assemble with Stacktrace - QA Debug - if: (github.event.inputs.environment == 'qa' || inputs.environment == 'qa') && (github.event.inputs.type == 'debug' || inputs.type == 'debug') - run: yarn move:qa && cd android && ./gradlew assembleDebug --stacktrace && ls -R ./ - - name: Assemble with Stacktrace - DEV Debug - if: (github.event.inputs.environment == 'dev' || inputs.environment == 'dev') && (github.event.inputs.type == 'debug' || inputs.type == 'debug') - run: yarn move:dev &&cd android && ./gradlew assembleDebug --stacktrace - - name: Assemble with Stacktrace - QA Release - if: (github.event.inputs.environment == 'qa' || inputs.environment == 'qa') && (github.event.inputs.type == 'release' || inputs.type == 'release') - run: yarn move:qa && cd android && ./gradlew assembleRelease --stacktrace - - name: Assemble with Stacktrace - DEV Release - if: (github.event.inputs.environment == 'dev' || inputs.environment == 'dev') && (github.event.inputs.type == 'release' || inputs.type == 'release') - run: yarn move:dev && cd android && ./gradlew assembleRelease --stacktrace - - name: GET PATH - run: ls -R ./android/app/build/outputs - - name: Upload APK as Artifact - uses: actions/upload-artifact@v3 - with: - name: app-${{ github.event.inputs.type || inputs.type }} - path: android/app/build/outputs/apk/${{ github.event.inputs.type || inputs.type }}/ - retention-days: 30 diff --git a/package.json b/package.json index 32a41982..a9c60ba9 100644 --- a/package.json +++ b/package.json @@ -159,6 +159,9 @@ "lint-staged": { "*.{js,css,scss,md,json,js,ts,tsx}": [ "prettier --write" + ], + "*.{ts,tsx}": [ + "eslint --cache --fix" ] } }