Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tienifr/App into fix/27392
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Jan 4, 2024
2 parents f9afabe + d5741af commit 2c52e0c
Show file tree
Hide file tree
Showing 859 changed files with 4,455 additions and 2,810 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,21 @@ module.exports = {
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
},
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: false,
},
],
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'es/no-nullish-coalescing-operators': 'off',
'es/no-optional-chaining': 'off',
'valid-jsdoc': 'off',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Category from './Category';
import type Category from './Category';
import newComponent from './newComponentCategory';

const categories: Category[] = [newComponent];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import traverse from '@babel/traverse';
import CONST from '../../../../libs/CONST';
import GithubUtils from '../../../../libs/GithubUtils';
import promiseSome from '../../../../libs/promiseSome';
import Category from './Category';
import type Category from './Category';

type SuperClassType = {superClass: {name?: string; object: {name: string}; property: {name: string}} | null; name: string};

Expand Down
3 changes: 0 additions & 3 deletions .github/actions/javascript/validateReassureOutput/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ inputs:
COUNT_DEVIATION:
description: Allowable deviation for the mean count in regression test results.
required: true
REGRESSION_OUTPUT:
description: Refers to the results obtained from regression tests `.reassure/output.json`.
required: true
runs:
using: 'node20'
main: './index.js'
3 changes: 2 additions & 1 deletion .github/actions/javascript/validateReassureOutput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

const core = __nccwpck_require__(186);
const fs = __nccwpck_require__(147);

const run = () => {
const regressionOutput = JSON.parse(core.getInput('REGRESSION_OUTPUT', {required: true}));
const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8'));
const countDeviation = core.getInput('COUNT_DEVIATION', {required: true});
const durationDeviation = core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const core = require('@actions/core');
const fs = require('fs');

const run = () => {
const regressionOutput = JSON.parse(core.getInput('REGRESSION_OUTPUT', {required: true}));
const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8'));
const countDeviation = core.getInput('COUNT_DEVIATION', {required: true});
const durationDeviation = core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true});

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:

env:
SHOULD_DEPLOY_PRODUCTION: ${{ github.event_name == 'release' }}
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}
Expand Down Expand Up @@ -174,6 +173,8 @@ jobs:
name: Build and deploy iOS
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }}
env:
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
runs-on: macos-13-xlarge
steps:
- name: Checkout
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/reassurePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,10 @@ jobs:
npm install --force
npx reassure --branch
- name: Read output.json
id: reassure
uses: juliangruber/read-file-action@v1
with:
path: .reassure/output.json

- name: Validate output.json
id: validateReassureOutput
uses: ./.github/actions/javascript/validateReassureOutput
with:
DURATION_DEVIATION_PERCENTAGE: 20
COUNT_DEVIATION: 0
REGRESSION_OUTPUT: ${{ steps.reassure.outputs.content }}

4 changes: 1 addition & 3 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
types: [opened, synchronize, labeled]
branches: ['*ci-test/**']

env:
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer

jobs:
validateActor:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -139,6 +136,7 @@ jobs:
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
runs-on: macos-13-xlarge
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001042101
versionName "1.4.21-1"
versionCode 1001042105
versionName "1.4.21-5"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion assets/emojis/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TravelAndPlaces from '@assets/images/emojiCategoryIcons/plane.svg';
import AnimalsAndNature from '@assets/images/emojiCategoryIcons/plant.svg';
import Activities from '@assets/images/emojiCategoryIcons/soccer-ball.svg';
import FrequentlyUsed from '@assets/images/history.svg';
import {HeaderEmoji, PickerEmojis} from './types';
import type {HeaderEmoji, PickerEmojis} from './types';

const skinTones = [
{
Expand Down
2 changes: 1 addition & 1 deletion assets/emojis/en.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {EmojisList} from './types';
import type {EmojisList} from './types';

/* eslint-disable @typescript-eslint/naming-convention */
const enEmojis: EmojisList = {
Expand Down
2 changes: 1 addition & 1 deletion assets/emojis/es.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {EmojisList} from './types';
import type {EmojisList} from './types';

/* eslint-disable @typescript-eslint/naming-convention */
const esEmojis: EmojisList = {
Expand Down
2 changes: 1 addition & 1 deletion assets/emojis/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import emojis from './common';
import enEmojis from './en';
import esEmojis from './es';
import {Emoji} from './types';
import type {Emoji} from './types';

type EmojiTable = Record<string, Emoji>;

Expand Down
2 changes: 1 addition & 1 deletion assets/emojis/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconAsset from '@src/types/utils/IconAsset';
import type IconAsset from '@src/types/utils/IconAsset';

type Emoji = {
code: string;
Expand Down
39 changes: 36 additions & 3 deletions contributingGuides/TS_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [1.19 Satisfies operator](#satisfies-operator)
- [1.20 Hooks instead of HOCs](#hooks-instead-of-hocs)
- [1.21 `compose` usage](#compose-usage)
- [1.22 Type imports](#type-imports)
- [Exception to Rules](#exception-to-rules)
- [Communication Items](#communication-items)
- [Migration Guidelines](#migration-guidelines)
Expand Down Expand Up @@ -383,7 +384,7 @@ type Foo = {

<a name="file-organization"></a><a name="1.15"></a>

- [1.15](#file-organization) **File organization**: In modules with platform-specific implementations, create `types.ts` to define shared types. Import and use shared types in each platform specific files. Do not use [`satisfies` operator](#satisfies-operator) for platform-specific implementations, always define shared types that complies with all variants.
- [1.15](#file-organization) **File organization**: In modules with platform-specific implementations, create `types.ts` to define shared types. Import and use shared types in each platform specific files. Do not use [`satisfies` operator](#satisfies-operator) for platform-specific implementations, always define shared types that complies with all variants.

> Why? To encourage consistent API across platform-specific implementations. If you're migrating module that doesn't have a default implement (i.e. `index.ts`, e.g. `getPlatform`), refer to [Migration Guidelines](#migration-guidelines) for further information.
Expand Down Expand Up @@ -514,7 +515,7 @@ type Foo = {
<a name="hooks-instead-of-hocs"></a><a name="1.20"></a>

- [1.20](#hooks-instead-of-hocs) **Hooks instead of HOCs**: Replace HOCs usage with Hooks whenever possible.

> Why? Hooks are easier to use (can be used inside the function component), and don't need nesting or `compose` when exporting the component. It also allows us to remove `compose` completely in some components since it has been bringing up some issues with TypeScript. Read the [`compose` usage](#compose-usage) section for further information about the TypeScript issues with `compose`.
> Note: Because Onyx doesn't provide a hook yet, in a component that accesses Onyx data with `withOnyx` HOC, please make sure that you don't use other HOCs (if applicable) to avoid HOC nesting.
Expand Down Expand Up @@ -571,7 +572,7 @@ type Foo = {
<a name="compose-usage"></a><a name="1.21"></a>

- [1.21](#compose-usage) **`compose` usage**: Avoid the usage of `compose` function to compose HOCs in TypeScript files. Use nesting instead.

> Why? `compose` function doesn't work well with TypeScript when dealing with several HOCs being used in a component, many times resulting in wrong types and errors. Instead, nesting can be used to allow a seamless use of multiple HOCs and result in a correct return type of the compoment. Also, you can use [hooks instead of HOCs](#hooks-instead-of-hocs) whenever possible to minimize or even remove the need of HOCs in the component.
```ts
Expand Down Expand Up @@ -607,6 +608,38 @@ type Foo = {
export default withCurrentUserPersonalDetails(ComponentWithReportOrNotFound);
```

<a name="type-imports"></a><a name="1.22"></a>

- [1.22](#type-imports) **Type imports/exports**: Always use the `type` keyword when importing/exporting types

> Why? In order to improve code clarity and consistency and reduce bundle size after typescript transpilation, we enforce the all type imports/exports to contain the `type` keyword. This way, TypeScript can automatically remove those imports from the transpiled JavaScript bundle
Imports:
```ts
// BAD
import {SomeType} from './a'
import someVariable from './a'

import {someVariable, SomeOtherType} from './b'

// GOOD
import type {SomeType} from './a'
import someVariable from './a'
```

Exports:
```ts
// BAD
export {SomeType}
export someVariable
// or
export {someVariable, SomeOtherType}

// GOOD
export type {SomeType}
export someVariable
```

## Exception to Rules

Most of the rules are enforced in ESLint or checked by TypeScript. If you think your particular situation warrants an exception, post the context in the `#expensify-open-source` Slack channel with your message prefixed with `TS EXCEPTION:`. The internal engineer assigned to the PR should be the one that approves each exception, however all discussion regarding granting exceptions should happen in the public channel instead of the GitHub PR page so that the TS migration team can access them easily.
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.21.1</string>
<string>1.4.21.5</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.21.1</string>
<string>1.4.21.5</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ PODS:
- React-Core
- react-native-pager-view (6.2.0):
- React-Core
- react-native-pdf (6.7.3):
- react-native-pdf (6.7.4):
- React-Core
- react-native-performance (5.1.0):
- React-Core
Expand Down Expand Up @@ -1265,7 +1265,7 @@ SPEC CHECKSUMS:
react-native-key-command: 5af6ee30ff4932f78da6a2109017549042932aa5
react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2
react-native-pager-view: 0ccb8bf60e2ebd38b1f3669fa3650ecce81db2df
react-native-pdf: b4ca3d37a9a86d9165287741c8b2ef4d8940c00e
react-native-pdf: 79aa75e39a80c1d45ffe58aa500f3cf08f267a2e
react-native-performance: cef2b618d47b277fb5c3280b81a3aad1e72f2886
react-native-plaid-link-sdk: df1618a85a615d62ff34e34b76abb7a56497fbc1
react-native-quick-sqlite: bcc7a7a250a40222f18913a97cd356bf82d0a6c4
Expand Down
Loading

0 comments on commit 2c52e0c

Please sign in to comment.