Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into wojtus7/menu-languages
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtus7 committed Jul 18, 2023
2 parents 5ccdff3 + 4e49206 commit 4e7c9e0
Show file tree
Hide file tree
Showing 460 changed files with 37,416 additions and 11,221 deletions.
32 changes: 17 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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,
},
Expand All @@ -23,21 +23,23 @@ module.exports = {
paths: [
{
name: 'react-native',
importNames: ['useWindowDimensions'],
message: 'Please use useWindowDimensions from src/hooks/useWindowDimensions instead',
},
{
name: 'react-native',
importNames: ['TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'],
message: 'Please use PressableWithFeedback and/or PressableWithoutFeedback from src/components/Pressable instead',
},
{
name: 'react-native',
importNames: ['StatusBar'],
message: 'Please use StatusBar from src/libs/StatusBar instead',
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'),
},
],
},
],
'react-native-a11y/has-accessibility-hint': ['off'],
'react-native-a11y/has-valid-accessibility-descriptors': [
'error',
{
touchables: ['PressableWithoutFeedback', 'PressableWithFeedback'],
},
],
},
};
17 changes: 9 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 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
38 changes: 37 additions & 1 deletion .github/actions/javascript/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,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 Expand Up @@ -272,6 +272,41 @@ const incrementVersion = (version, level) => {
return incrementPatch(major, minor, patch);
};

/**
* @param {String} currentVersion
* @param {String} level
* @returns {String}
*/
function getPreviousVersion(currentVersion, level) {
const [major, minor, patch, build] = getVersionNumberFromString(currentVersion);

if (level === SEMANTIC_VERSION_LEVELS.MAJOR) {
if (major === 1) {
return getVersionStringFromNumber(1, 0, 0, 0);
}
return getVersionStringFromNumber(major - 1, 0, 0, 0);
}

if (level === SEMANTIC_VERSION_LEVELS.MINOR) {
if (minor === 0) {
return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.MAJOR);
}
return getVersionStringFromNumber(major, minor - 1, 0, 0);
}

if (level === SEMANTIC_VERSION_LEVELS.PATCH) {
if (patch === 0) {
return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.MINOR);
}
return getVersionStringFromNumber(major, minor, patch - 1, 0);
}

if (build === 0) {
return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.PATCH);
}
return getVersionStringFromNumber(major, minor, patch, build - 1);
}

module.exports = {
getVersionNumberFromString,
getVersionStringFromNumber,
Expand All @@ -282,6 +317,7 @@ module.exports = {
SEMANTIC_VERSION_LEVELS,
incrementMinor,
incrementPatch,
getPreviousVersion,
};


Expand Down
5 changes: 3 additions & 2 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,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
Loading

0 comments on commit 4e7c9e0

Please sign in to comment.