diff --git a/.eslintrc.js b/.eslintrc.js index 3acfbb068c7..d161b9bedc1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -190,5 +190,5 @@ module.exports = { radix: 0, }, - ignorePatterns: ['wdio.conf.js', 'app/util/termsOfUse/termsOfUseContent.js'], + ignorePatterns: ['wdio.conf.js', 'app/util/termsOfUse/termsOfUseContent.ts'], }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43921943b57..4efc7e86cb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,31 @@ jobs: - name: Require clean working directory shell: bash run: | + # Read the file into an array using mapfile + mapfile -t EXCLUDES < git-diff-exclusions.txt + + # Apply git update-index --assume-unchanged to each entry + echo "Assuming unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --assume-unchanged "$path" + done + + # Run git diff + echo "Running git diff command:" if ! git diff --exit-code; then echo "Working tree dirty at end of job" exit 1 + else + echo "No changes detected" fi + + # Revert git update-index --no-assume-unchanged for each entry + echo "Reverting assume unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --no-assume-unchanged "$path" + done dedupe: runs-on: ubuntu-20.04 needs: setup @@ -73,10 +94,31 @@ jobs: - name: Require clean working directory shell: bash run: | + # Read the file into an array using mapfile + mapfile -t EXCLUDES < git-diff-exclusions.txt + + # Apply git update-index --assume-unchanged to each entry + echo "Assuming unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --assume-unchanged "$path" + done + + # Run git diff + echo "Running git diff command:" if ! git diff --exit-code; then echo "Working tree dirty at end of job" exit 1 + else + echo "No changes detected" fi + + # Revert git update-index --no-assume-unchanged for each entry + echo "Reverting assume unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --no-assume-unchanged "$path" + done unit-tests: runs-on: ubuntu-20.04 needs: setup @@ -107,10 +149,31 @@ jobs: - name: Require clean working directory shell: bash run: | + # Read the file into an array using mapfile + mapfile -t EXCLUDES < git-diff-exclusions.txt + + # Apply git update-index --assume-unchanged to each entry + echo "Assuming unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --assume-unchanged "$path" + done + + # Run git diff + echo "Running git diff command:" if ! git diff --exit-code; then echo "Working tree dirty at end of job" exit 1 + else + echo "No changes detected" fi + + # Revert git update-index --no-assume-unchanged for each entry + echo "Reverting assume unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --no-assume-unchanged "$path" + done merge-unit-tests: runs-on: ubuntu-20.04 needs: unit-tests @@ -138,10 +201,31 @@ jobs: - name: Require clean working directory shell: bash run: | + # Read the file into an array using mapfile + mapfile -t EXCLUDES < git-diff-exclusions.txt + + # Apply git update-index --assume-unchanged to each entry + echo "Assuming unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --assume-unchanged "$path" + done + + # Run git diff + echo "Running git diff command:" if ! git diff --exit-code; then echo "Working tree dirty at end of job" exit 1 + else + echo "No changes detected" fi + + # Revert git update-index --no-assume-unchanged for each entry + echo "Reverting assume unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --no-assume-unchanged "$path" + done sonar-cloud: runs-on: ubuntu-20.04 needs: merge-unit-tests @@ -149,6 +233,9 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # SonarCloud needs a full checkout to perform necessary analysis + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' - uses: actions/download-artifact@v3 with: name: coverage @@ -166,10 +253,31 @@ jobs: - name: Require clean working directory shell: bash run: | + # Read the file into an array using mapfile + mapfile -t EXCLUDES < git-diff-exclusions.txt + + # Apply git update-index --assume-unchanged to each entry + echo "Assuming unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --assume-unchanged "$path" + done + + # Run git diff + echo "Running git diff command:" if ! git diff --exit-code; then echo "Working tree dirty at end of job" exit 1 + else + echo "No changes detected" fi + + # Revert git update-index --no-assume-unchanged for each entry + echo "Reverting assume unchanged for the following paths:" + for path in "${EXCLUDES[@]}"; do + echo "$path" + git update-index --no-assume-unchanged "$path" + done check-workflows: name: Check workflows runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 8e34d2528f1..f040da5d0ad 100644 --- a/.gitignore +++ b/.gitignore @@ -120,5 +120,5 @@ ccache html-report/ # terms of use -app/util/termsOfUse/termsOfUseContent.js +app/util/termsOfUse/termsOfUseContent.ts docs/assets/termsOfUse.html \ No newline at end of file diff --git a/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx b/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx index 3e63bdd184d..3999aeb5135 100644 --- a/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx +++ b/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx @@ -30,12 +30,12 @@ export interface TokenDetails { export interface MarketDetails { marketCap: string | null; - totalVolume: number | null; + totalVolume: string | null; volumeToMarketCap: string | null; - circulatingSupply: number | null; + circulatingSupply: string | null; allTimeHigh: string | null; allTimeLow: string | null; - fullyDiluted: number | null; + fullyDiluted: string | null; } interface TokenDetailsProps { diff --git a/app/components/UI/Notification/NotificationMenuItem/Icon.test.tsx b/app/components/UI/Notification/NotificationMenuItem/Icon.test.tsx index a2df5213e47..8f8f9f23086 100644 --- a/app/components/UI/Notification/NotificationMenuItem/Icon.test.tsx +++ b/app/components/UI/Notification/NotificationMenuItem/Icon.test.tsx @@ -29,7 +29,7 @@ describe('NotificationIcon', () => { it('matches snapshot when icon is provided', () => { const { toJSON } = renderWithProvider( , { state: mockInitialState }, diff --git a/app/components/UI/Notification/NotificationMenuItem/__snapshots__/Icon.test.tsx.snap b/app/components/UI/Notification/NotificationMenuItem/__snapshots__/Icon.test.tsx.snap index ab1fd3c52ee..08b30cf3220 100644 --- a/app/components/UI/Notification/NotificationMenuItem/__snapshots__/Icon.test.tsx.snap +++ b/app/components/UI/Notification/NotificationMenuItem/__snapshots__/Icon.test.tsx.snap @@ -38,7 +38,7 @@ exports[`NotificationIcon matches snapshot when icon is provided 1`] = ` } source={ { - "uri": "SvgMock", + "uri": "MockImage", } } style={ diff --git a/app/components/UI/ProfileSyncing/ProfileSyncing.test.tsx b/app/components/UI/ProfileSyncing/ProfileSyncing.test.tsx index 3abf0f2e752..b8cddbd6ebc 100644 --- a/app/components/UI/ProfileSyncing/ProfileSyncing.test.tsx +++ b/app/components/UI/ProfileSyncing/ProfileSyncing.test.tsx @@ -31,7 +31,11 @@ const handleSwitchToggle = jest.fn(); describe('ProfileSyncing', () => { it('should render correctly', () => { const { toJSON } = renderWithProvider( - , + , ); expect(toJSON()).toMatchSnapshot(); }); diff --git a/app/components/Views/ImportPrivateKey/index.tsx b/app/components/Views/ImportPrivateKey/index.tsx index 3574f7b128d..c2a79c811f5 100644 --- a/app/components/Views/ImportPrivateKey/index.tsx +++ b/app/components/Views/ImportPrivateKey/index.tsx @@ -6,6 +6,7 @@ import { Text, View, ActivityIndicator, + DimensionValue, } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import StyledButton from '../../UI/StyledButton'; @@ -26,7 +27,7 @@ import { ImportAccountFromPrivateKeySelectorsIDs } from '../../../../e2e/selecto const ImportPrivateKey = () => { const [privateKey, setPrivateKey] = useState(''); const [loading, setLoading] = useState(false); - const [inputWidth, setInputWidth] = useState( + const [inputWidth, setInputWidth] = useState( Device.isAndroid() ? '99%' : undefined, ); const navigation = useNavigation(); diff --git a/app/components/Views/NetworkSelector/NetworkSelector.tsx b/app/components/Views/NetworkSelector/NetworkSelector.tsx index aceaae314c2..8bb4fd665f0 100644 --- a/app/components/Views/NetworkSelector/NetworkSelector.tsx +++ b/app/components/Views/NetworkSelector/NetworkSelector.tsx @@ -309,7 +309,7 @@ const NetworkSelector = () => { networkName: string, ) => { const searchResult: ExtendedNetwork[] = networks.filter(({ name }) => - name.toLowerCase().includes(networkName.toLowerCase()), + name?.toLowerCase().includes(networkName.toLowerCase()), ); return searchResult; diff --git a/app/components/Views/SDK/SDKSessionsManager/SDKSessionItem.test.tsx b/app/components/Views/SDK/SDKSessionsManager/SDKSessionItem.test.tsx index d74bdff4f4f..befb1304e1c 100644 --- a/app/components/Views/SDK/SDKSessionsManager/SDKSessionItem.test.tsx +++ b/app/components/Views/SDK/SDKSessionsManager/SDKSessionItem.test.tsx @@ -61,6 +61,7 @@ describe('SDKSessionItem', () => { icon: 'http://icon-url.com', platform: 'test', connected: true, + dappId: '123', }, }, trigger: 0, diff --git a/app/components/Views/Settings/NetworksSettings/NetworkSettings/CustomNetworkView/CustomNetwork.types.ts b/app/components/Views/Settings/NetworksSettings/NetworkSettings/CustomNetworkView/CustomNetwork.types.ts index 6abbd15840e..4aea5908ee5 100644 --- a/app/components/Views/Settings/NetworksSettings/NetworkSettings/CustomNetworkView/CustomNetwork.types.ts +++ b/app/components/Views/Settings/NetworksSettings/NetworkSettings/CustomNetworkView/CustomNetwork.types.ts @@ -18,7 +18,7 @@ export interface Network { } export interface ExtendedNetwork extends Network { - name: string; + name?: string; formattedRpcUrl?: string | null; } diff --git a/app/components/hooks/useAccounts/useAccounts.types.ts b/app/components/hooks/useAccounts/useAccounts.types.ts index 3218d173566..cc459cce668 100644 --- a/app/components/hooks/useAccounts/useAccounts.types.ts +++ b/app/components/hooks/useAccounts/useAccounts.types.ts @@ -1,9 +1,9 @@ // Third party dependencies. import { KeyringTypes } from '@metamask/keyring-controller'; +import { Hex } from '@metamask/utils'; // External dependencies. -import { AvatarGroupToken } from '../../../component-library/components/Avatars/AvatarGroup/AvatarGroup.types'; -import { Hex } from '@metamask/utils'; +import { AvatarTokenProps } from '../../../component-library/components/Avatars/Avatar/variants/AvatarToken/AvatarToken.types'; /** * Asset information associated with the account, which includes both the fiat balance and owned tokens. @@ -16,7 +16,7 @@ export interface Assets { /** * Tokens owned by this account. */ - tokens?: AvatarGroupToken[]; + tokens?: AvatarTokenProps[]; } /** diff --git a/app/declarations/index.d.ts b/app/declarations/index.d.ts index 62769bd125f..04d7a1238f9 100644 --- a/app/declarations/index.d.ts +++ b/app/declarations/index.d.ts @@ -277,7 +277,7 @@ declare module '@metamask/contract-metadata' { export default content; } -declare module './util/termsOfUse/termsOfUseContent' { +declare module './util/termsOfUse/termsOfUseContent.ts' { const content: string; export default content; } diff --git a/app/util/termsOfUse/termsOfUseContent.ts b/app/util/termsOfUse/termsOfUseContent.ts new file mode 100644 index 00000000000..08d725cd4e4 --- /dev/null +++ b/app/util/termsOfUse/termsOfUseContent.ts @@ -0,0 +1 @@ +export default ''; diff --git a/git-diff-exclusions.txt b/git-diff-exclusions.txt new file mode 100644 index 00000000000..718fc5d3ff1 --- /dev/null +++ b/git-diff-exclusions.txt @@ -0,0 +1 @@ +app/util/termsOfUse/termsOfUseContent.ts \ No newline at end of file diff --git a/package.json b/package.json index b927a9159c5..2d9e4d44a6b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "clean-android": "yarn clean:android && yarn clean:node", "lint": "eslint '**/*.{js,ts,tsx}'", "lint:fix": "eslint '**/*.{js,ts,tsx}' --fix", - "lint:tsc": "tsc --project ./tsconfig.lint.json", + "lint:tsc": "tsc --project ./tsconfig.json", "format": "prettier '**/*.{js,ts,tsx,json,feature}' --write", "setup": "yarn clean && node scripts/setup.mjs", "setup:node": "yarn clean:node && yarn allow-scripts && yarn patch-package", diff --git a/scripts/setup.mjs b/scripts/setup.mjs index 9cb3dd33974..5ad0c040705 100644 --- a/scripts/setup.mjs +++ b/scripts/setup.mjs @@ -212,7 +212,7 @@ const generateTermsOfUseContentTask = { task: async () => { const termsOfUsePath = path.resolve('./docs/assets/termsOfUse.html'); const outputDir = path.resolve('./app/util/termsOfUse'); - const outputPath = path.join(outputDir, 'termsOfUseContent.js'); + const outputPath = path.join(outputDir, 'termsOfUseContent.ts'); let termsOfUse = ''; try { diff --git a/tsconfig.json b/tsconfig.json index 0c59d47d285..82b3af09691 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -63,10 +63,10 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ }, "include": [ + "app/declarations/index.d.ts", "app/**/*", "node_modules/expect-webdriverio", - "node_modules/expect-webdriverio/jest", - "app/components/UI/QRHardware/AnimatedQRScanner.tsx" + "node_modules/expect-webdriverio/jest" ], "exclude": [ "node_modules", diff --git a/tsconfig.lint.json b/tsconfig.lint.json deleted file mode 100644 index 361520298ef..00000000000 --- a/tsconfig.lint.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "./tsconfig.json", - // TODO: Fix type errors and uncomment all directories - "include": [ - "app/declarations/index.d.ts", - // "app/**/*", - "app/__mocks__/**/*", - "app/actions/**/*", - // "app/component-library/**/*", - "app/component-library/constants/**/*", - "app/component-library/hooks/**/*", - // "app/components/**/*", - "app/constants/**/*", - "app/core/**/*", - "app/core/*.ts", - "app/images/**/*", - "app/lib/**/*", - "app/reducers/**/*", - "app/selectors/**/*", - "app/store/**/*", - "app/styles/**/*" - // "app/util/**/*", - ] -}