Skip to content

Commit 97a4d48

Browse files
authored
Merge pull request #63 from Resgrid/develop
CU-868cu9311 Cleanup
2 parents d610878 + 592598f commit 97a4d48

File tree

246 files changed

+2728
-5726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+2728
-5726
lines changed

.eslintrc.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@ const path = require('path');
22

33
module.exports = {
44
extends: ['expo', 'plugin:tailwindcss/recommended', 'prettier'],
5-
plugins: [
6-
'prettier',
7-
'unicorn',
8-
'@typescript-eslint',
9-
'unused-imports',
10-
'tailwindcss',
11-
'simple-import-sort',
12-
'eslint-plugin-react-compiler',
13-
],
5+
plugins: ['prettier', 'unicorn', '@typescript-eslint', 'unused-imports', 'tailwindcss', 'simple-import-sort', 'eslint-plugin-react-compiler'],
146
parserOptions: {
157
project: './tsconfig.json',
168
},
@@ -43,9 +35,9 @@ module.exports = {
4335
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
4436
'@typescript-eslint/no-unused-vars': 'off',
4537
'tailwindcss/no-custom-classname': 'off',
46-
'unused-imports/no-unused-imports': 'error',
38+
'unused-imports/no-unused-imports': 'off',
4739
'unused-imports/no-unused-vars': [
48-
'error',
40+
'off',
4941
{
5042
argsIgnorePattern: '^_',
5143
varsIgnorePattern: '^_',

.github/workflows/react-native-cicd.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,8 @@ jobs:
7272
- name: 📦 Install dependencies
7373
run: pnpm install
7474

75-
- name: 🧪 Run TypeScript check
76-
run: pnpm tsc
77-
78-
- name: 🧹 Run ESLint
79-
run: pnpm lint
80-
81-
- name: 🎨 Run Prettier check
82-
run: pnpm format:check
83-
84-
- name: 🧪 Run Jest Tests
85-
run: pnpm test
86-
87-
- name: 🧪 Run React Native Testing Library Tests
88-
run: pnpm test:rntl
75+
- name: 🧪 Run Checks and Tests
76+
run: pnpm check-all
8977

9078
build-and-deploy:
9179
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
@@ -96,6 +84,7 @@ jobs:
9684
- platform: ios
9785
runs-on: macos-latest
9886
runs-on: ${{ matrix.platform == 'ios' && 'macos-latest' || 'ubuntu-latest' }}
87+
environment: RNBuild
9988
steps:
10089
- name: 🏗 Checkout repository
10190
uses: actions/checkout@v4

expo-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/// <reference types="expo/types" />
22

3-
// NOTE: This file should not be edited and should be in your git ignore
3+
// NOTE: This file should not be edited and should be in your git ignore

jest.config.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@ module.exports = {
22
preset: 'jest-expo',
33
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
44
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
5-
collectCoverageFrom: [
6-
'src/**/*.{ts,tsx}',
7-
'!**/coverage/**',
8-
'!**/node_modules/**',
9-
'!**/babel.config.js',
10-
'!**/jest.setup.js',
11-
'!**/docs/**',
12-
'!**/cli/**',
13-
],
5+
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!**/coverage/**', '!**/node_modules/**', '!**/babel.config.js', '!**/jest.setup.js', '!**/docs/**', '!**/cli/**'],
146
moduleFileExtensions: ['js', 'ts', 'tsx'],
157
moduleDirectories: ['node_modules', '<rootDir>/'],
168
transformIgnorePatterns: [

lint-staged.config.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
module.exports = {
2-
'**/*.{js,jsx,ts,tsx}': (filenames) => [
3-
`npx eslint --fix ${filenames
4-
.map((filename) => `"${filename}"`)
5-
.join(' ')}`,
6-
],
7-
'**/*.(md|json)': (filenames) =>
8-
`npx prettier --write ${filenames
9-
.map((filename) => `"${filename}"`)
10-
.join(' ')}`,
11-
'src/translations/*.(json)': (filenames) => [
12-
`npx eslint --fix ${filenames
13-
.map((filename) => `"${filename}"`)
14-
.join(' ')}`,
15-
],
2+
'**/*.{js,jsx,ts,tsx}': (filenames) => [`npx eslint --fix ${filenames.map((filename) => `"${filename}"`).join(' ')}`],
3+
'**/*.(md|json)': (filenames) => `npx prettier --write ${filenames.map((filename) => `"${filename}"`).join(' ')}`,
4+
'src/translations/*.(json)': (filenames) => [`npx eslint --fix ${filenames.map((filename) => `"${filename}"`).join(' ')}`],
165
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"@expo/config": "~10.0.3",
152152
"@testing-library/jest-dom": "^6.5.0",
153153
"@testing-library/react-native": "^12.7.2",
154+
"@types/geojson": "^7946.0.16",
154155
"@types/i18n-js": "^3.8.9",
155156
"@types/jest": "^29.5.12",
156157
"@types/lodash.memoize": "^4.1.9",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/i18next-syntax-validation.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
const validate = (message = "") => {
2-
if (!(message || "").trim()) {
3-
throw new SyntaxError("Message is Empty.");
1+
const validate = (message = '') => {
2+
if (!(message || '').trim()) {
3+
throw new SyntaxError('Message is Empty.');
44
}
5-
if (typeof message !== "string") {
6-
throw new TypeError("Message must be a String.");
5+
if (typeof message !== 'string') {
6+
throw new TypeError('Message must be a String.');
77
}
8-
if (
9-
(message.includes("{") || message.includes("}")) &&
10-
!/{{ ?(?:- |\w+?)(, ?)?\w+? ?}}/g.test(message)
11-
) {
12-
throw new SyntaxError(
13-
"Interpolation error. See: https://www.i18next.com/misc/json-format",
14-
);
8+
if ((message.includes('{') || message.includes('}')) && !/{{ ?(?:- |\w+?)(, ?)?\w+? ?}}/g.test(message)) {
9+
throw new SyntaxError('Interpolation error. See: https://www.i18next.com/misc/json-format');
1510
}
16-
if (message.includes("$t(") && !/\$t\([\w]+:\w+(?:\.\w+)*\)/g.test(message)) {
17-
throw new SyntaxError(
18-
"Nesting error. See: https://www.i18next.com/misc/json-format",
19-
);
11+
if (message.includes('$t(') && !/\$t\([\w]+:\w+(?:\.\w+)*\)/g.test(message)) {
12+
throw new SyntaxError('Nesting error. See: https://www.i18next.com/misc/json-format');
2013
}
2114
};
2215

src/api/calls/callFiles.ts

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import axios, {
2-
type AxiosProgressEvent,
3-
type AxiosRequestConfig,
4-
type AxiosResponse,
5-
} from 'axios';
1+
import axios, { type AxiosProgressEvent, type AxiosRequestConfig, type AxiosResponse } from 'axios';
62

73
import { createApiEndpoint } from '@/api/common/client';
84
import { type CallFilesResult } from '@/models/v4/callFiles/callFilesResult';
@@ -33,10 +29,7 @@ const getCallFilesApi = createApiEndpoint('/CallFiles/GetFilesForCall');
3329
const saveCallFileApi = createApiEndpoint('/CallFiles/SaveCallFile');
3430

3531
// Function to download a file with progress reporting
36-
export const getCallAttachmentFile = async (
37-
url: string,
38-
options: DownloadOptions = {}
39-
): Promise<Blob> => {
32+
export const getCallAttachmentFile = async (url: string, options: DownloadOptions = {}): Promise<Blob> => {
4033
const { onEvent, headers = {}, timeout = 30000 } = options;
4134

4235
try {
@@ -51,9 +44,7 @@ export const getCallAttachmentFile = async (
5144
timeout,
5245
onDownloadProgress: (progressEvent: AxiosProgressEvent) => {
5346
if (progressEvent.total) {
54-
const percentCompleted = Math.round(
55-
(progressEvent.loaded * 100) / progressEvent.total
56-
);
47+
const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
5748

5849
// Notify progress event
5950
onEvent?.({
@@ -79,8 +70,7 @@ export const getCallAttachmentFile = async (
7970
// Notify error event
8071
onEvent?.({
8172
type: 'error',
82-
error:
83-
error instanceof Error ? error : new Error('Unknown error occurred'),
73+
error: error instanceof Error ? error : new Error('Unknown error occurred'),
8474
});
8575

8676
throw error;
@@ -99,11 +89,7 @@ export const saveBlobAsFile = (blob: Blob, fileName: string): void => {
9989
window.URL.revokeObjectURL(url);
10090
};
10191

102-
export const getFiles = async (
103-
callId: string,
104-
includeData: boolean,
105-
type: number
106-
) => {
92+
export const getFiles = async (callId: string, includeData: boolean, type: number) => {
10793
const response = await getCallFilesApi.get<CallFilesResult>({
10894
callId: callId,
10995
includeData: includeData,
@@ -139,16 +125,7 @@ export const getCallAudio = async (callId: string, includeData: boolean) => {
139125
return response.data;
140126
};
141127

142-
export const saveCallFile = async (
143-
callId: string,
144-
userId: string,
145-
note: string,
146-
name: string,
147-
latitude: number | null,
148-
longitude: number | null,
149-
file: string,
150-
type: number
151-
) => {
128+
export const saveCallFile = async (callId: string, userId: string, note: string, name: string, latitude: number | null, longitude: number | null, file: string, type: number) => {
152129
let data = {
153130
CallId: callId,
154131
UserId: userId,
@@ -171,26 +148,10 @@ export const saveCallFile = async (
171148
return response.data;
172149
};
173150

174-
export const saveCallImage = async (
175-
callId: string,
176-
userId: string,
177-
note: string,
178-
name: string,
179-
latitude: number | null,
180-
longitude: number | null,
181-
file: string
182-
) => {
151+
export const saveCallImage = async (callId: string, userId: string, note: string, name: string, latitude: number | null, longitude: number | null, file: string) => {
183152
return saveCallFile(callId, userId, note, name, latitude, longitude, file, 2);
184153
};
185154

186-
export const saveCallFileAttachment = async (
187-
callId: string,
188-
userId: string,
189-
note: string,
190-
name: string,
191-
latitude: number | null,
192-
longitude: number | null,
193-
file: string
194-
) => {
155+
export const saveCallFileAttachment = async (callId: string, userId: string, note: string, name: string, latitude: number | null, longitude: number | null, file: string) => {
195156
return saveCallFile(callId, userId, note, name, latitude, longitude, file, 3);
196157
};

src/api/calls/callNotes.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ export const getCallNotes = async (callId: string) => {
1212
return response.data;
1313
};
1414

15-
export const saveCallNote = async (
16-
callId: string,
17-
userId: string,
18-
note: string,
19-
latitude: number | null,
20-
longitude: number | null
21-
) => {
15+
export const saveCallNote = async (callId: string, userId: string, note: string, latitude: number | null, longitude: number | null) => {
2216
let data = {
2317
CallId: callId,
2418
UserId: userId,

0 commit comments

Comments
 (0)