Skip to content

Commit

Permalink
fix: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Aug 29, 2023
2 parents 30adf9a + 7d1f5c6 commit a07bb15
Show file tree
Hide file tree
Showing 1,234 changed files with 101,300 additions and 42,831 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules/*
**/dist/*
.github/actions/**/index.js"
176 changes: 150 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,167 @@
const restrictedImportPaths = [
{
name: 'react-native',
importNames: ['useWindowDimensions', 'StatusBar', 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable'],
message: [
'',
"For 'useWindowDimensions', please use 'src/hooks/useWindowDimensions' instead.",
"For 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable', please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from 'src/components/Pressable' instead.",
"For 'StatusBar', please use 'src/libs/StatusBar' instead.",
].join('\n'),
},
{
name: 'react-native-gesture-handler',
importNames: ['TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'],
message: "Please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from 'src/components/Pressable' instead.",
},
];

const restrictedImportPatterns = [
{
group: ['**/assets/animations/**/*.json'],
message: "Do not import animations directly. Please use the 'src/components/LottieAnimations' import instead.",
},
];

module.exports = {
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'prettier'],
plugins: ['react-hooks'],
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'prettier', 'plugin:react-native-a11y/basic'],
plugins: ['react-hooks', 'react-native-a11y'],
parser: 'babel-eslint',
ignorePatterns: ['!.*', 'src/vendor', '.github/actions/**/index.js', 'desktop/dist/*.js', 'dist/*.js', 'node_modules/.bin/**', '.git/**'],
ignorePatterns: ['!.*', 'src/vendor', '.github/actions/**/index.js', 'desktop/dist/*.js', 'dist/*.js', 'node_modules/.bin/**', 'node_modules/.cache/**', '.git/**'],
env: {
jest: true,
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.website.js', '.desktop.js', '.native.js', '.ios.js', '.android.js', '.config.js'],
},
},
},
globals: {
__DEV__: 'readonly',
},
rules: {
'no-restricted-imports': [
'error',
{
paths: [
overrides: [
{
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
rules: {
'rulesdir/onyx-props-must-have-default': 'off',
'react-native-a11y/has-accessibility-hint': ['off'],
'react-native-a11y/has-valid-accessibility-descriptors': [
'error',
{
name: 'react-native',
importNames: ['useWindowDimensions'],
message: 'Please use useWindowDimensions from src/hooks/useWindowDimensions instead',
touchables: ['PressableWithoutFeedback', 'PressableWithFeedback'],
},
],
},
},
{
files: ['*.js', '*.jsx'],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.website.js', '.desktop.js', '.native.js', '.ios.js', '.android.js', '.config.js', '.ts', '.tsx'],
},
},
},
rules: {
'import/extensions': [
'error',
'ignorePackages',
{
name: 'react-native',
importNames: ['TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'],
message: 'Please use PressableWithFeedback and/or PressableWithoutFeedback from src/components/Pressable instead',
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'no-restricted-imports': [
'error',
{
name: 'react-native',
importNames: ['StatusBar'],
message: 'Please use StatusBar from src/libs/StatusBar instead',
paths: restrictedImportPaths,
patterns: restrictedImportPatterns,
},
],
},
],
},
},
{
files: ['*.ts', '*.tsx'],
extends: [
'airbnb-typescript',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:you-dont-need-lodash-underscore/all',
'prettier',
],
plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
rules: {
// TODO: Remove the following rules after TypeScript migration is complete.
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',

'@typescript-eslint/naming-convention': [
'error',
{
selector: ['variable', 'property'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
},
{
selector: 'function',
format: ['camelCase', 'PascalCase'],
},
{
selector: ['typeLike', 'enumMember'],
format: ['PascalCase'],
},
{
selector: ['parameter', 'method'],
format: ['camelCase'],
},
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
object: "Use 'Record<string, T>' instead.",
},
extendDefaults: true,
},
],
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/prefer-enum-initializers': 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-floating-promises': 'off',
'es/no-nullish-coalescing-operators': 'off',
'es/no-optional-chaining': 'off',
'valid-jsdoc': 'off',
'jsdoc/no-types': 'error',
'import/no-extraneous-dependencies': 'off',
'rulesdir/prefer-underscore-method': 'off',
'rulesdir/prefer-import-module-contents': 'off',
'react/require-default-props': 'off',
'no-restricted-syntax': [
'error',
{
selector: 'TSEnumDeclaration',
message: "Please don't declare enums, use union types instead.",
},
],
'no-restricted-imports': [
'error',
{
paths: [
...restrictedImportPaths,
{
name: 'underscore',
message: 'Please use the corresponding method from lodash instead',
},
],
patterns: restrictedImportPatterns,
},
],
},
},
],
};
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/DesignDocIssue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Design Doc Project Issue Template
about: A template to follow when creating a new issue related to a design doc project
---

# Part of the <Project Name> project
Main issue: <Issue Link>
Doc section: <Doc Link>
Project: <Project Link>

# Feature Description
<!-- Describe the section of the doc that this issue is covering, along with any relevant screenshots -->

# Manual Test Steps

# Automated Tests
18 changes: 10 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

### Fixed Issues
<!---
1. Please replace GH_LINK with a URL link to the GitHub issue this Pull Request is fixing.
2. Please replace PROPOSAL: GH_LINK_ISSUE(COMMENT) with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify).
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify). For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`
Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking will not work as expected.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.
Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):
$ https://github.com/Expensify/App/issues/<number-of-the-issue>
$ https://github.com/Expensify/App/issues/<number-of-the-issue(comment)>
$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>
Do NOT only link the issue number like this: $ #<number-of-the-issue>
Do NOT only link the issue number like this: $ #<issueID>
--->
$ GH_LINK
PROPOSAL: GH_LINK_ISSUE(COMMENT)
$
PROPOSAL:


### Tests
Expand Down Expand Up @@ -100,6 +100,7 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
- [ ] The file is named correctly
- [ ] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- [ ] The only data being stored in the state is data necessary for rendering and nothing else
- [ ] If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
- [ ] For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor)
- [ ] Any internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`)
- [ ] All JSX used for rendering exists in the render method
Expand All @@ -112,6 +113,7 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
- [ ] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [ ] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [ ] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [ ] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [ ] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [ ] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.
- [ ] I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.
Expand Down
25 changes: 25 additions & 0 deletions .github/actions/composite/setupNode/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ runs:
path: desktop/node_modules
key: ${{ runner.os }}-desktop-node-modules-${{ hashFiles('desktop/package-lock.json') }}

- name: Check if patch files changed
id: patchCheck
shell: bash
run: |
set -e
if [[ `git diff main --name-only | grep \.patch` != null ]]; then
echo 'CHANGES_IN_PATCH_FILES=true' >> "$GITHUB_OUTPUT"
else
echo 'CHANGES_IN_PATCH_FILES=false' >> "$GITHUB_OUTPUT"
fi
- name: Patch root project node packages
shell: bash
if: |
steps.patchCheck.outputs.CHANGES_IN_PATCH_FILES == 'true' &&
steps.cache-node-modules.outputs.cache-hit == 'true'
run: npx patch-package

- name: Patch node packages for desktop submodule
shell: bash
if: |
steps.patchCheck.outputs.CHANGES_IN_PATCH_FILES == 'true' &&
steps.cache-desktop-node-modules.outputs.cache-hit == 'true'
run: cd desktop && npx patch-package

- name: Install root project node packages
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ class GithubUtils {
this.internalOctokit = new Octokit(
getOctokitOptions(token, {
throttle: {
retryAfterBaseValue: 2000,
onRateLimit: (retryAfter, options) => {
console.warn(`Request quota exhausted for request ${options.method} ${options.url}`);

// Retry once after hitting a rate limit error, then give up
if (options.request.retryCount <= 1) {
// Retry five times when hitting a rate limit error, then give up
if (options.request.retryCount <= 5) {
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ class GithubUtils {
this.internalOctokit = new Octokit(
getOctokitOptions(token, {
throttle: {
retryAfterBaseValue: 2000,
onRateLimit: (retryAfter, options) => {
console.warn(`Request quota exhausted for request ${options.method} ${options.url}`);

// Retry once after hitting a rate limit error, then give up
if (options.request.retryCount <= 1) {
// Retry five times when hitting a rate limit error, then give up
if (options.request.retryCount <= 5) {
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/bumpVersion/bumpVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function updateNativeVersions(version) {

let semanticVersionLevel = core.getInput('SEMVER_LEVEL', {require: true});
if (!semanticVersionLevel || !_.contains(versionUpdater.SEMANTIC_VERSION_LEVELS, semanticVersionLevel)) {
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD}`);
semanticVersionLevel = versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD;
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
}

const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json'));
Expand Down
Loading

0 comments on commit a07bb15

Please sign in to comment.