Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint-config-expensify #6174

Merged
merged 25 commits into from
Nov 8, 2021
Merged

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Nov 2, 2021

Details

Updates to the most recent version of eslint-config-expensify which adds a ton of custom rules.

Fixed Issues

$ #5995

Tests

No specific test steps

QA Steps

Nothing beyond normal regressions

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

N/A

@marcaaron marcaaron self-assigned this Nov 2, 2021
@botify
Copy link

botify commented Nov 2, 2021

Hey, I noticed you changed some webpack configuration files. This can break production builds. Did you remember to run a production build locally to verify they still work?

@marcaaron marcaaron changed the title [WIP] Update eslint-config-expensify [HOLD] Update eslint-config-expensify Nov 3, 2021
@marcaaron marcaaron marked this pull request as ready for review November 3, 2021 00:44
@marcaaron marcaaron requested a review from a team as a code owner November 3, 2021 00:44
@MelvinBot MelvinBot requested review from francoisl and removed request for a team November 3, 2021 00:44
@marcaaron
Copy link
Contributor Author

I might break this up a bit. 100+ file changes is obnoxious 😄

@francoisl
Copy link
Contributor

Cool yeah let me know, otherwise I can start reviewing - no problem.

Either way, given the botify comment #6174 (comment), it sounds like it would be great to test the desktop app too?

@marcaaron
Copy link
Contributor Author

👍 I'll give it a whirl to make sure everything is still building.

@marcaaron marcaaron changed the title [HOLD] Update eslint-config-expensify Update eslint-config-expensify Nov 5, 2021
@marcaaron
Copy link
Contributor Author

Off hold 🎉

src/libs/Log.js Show resolved Hide resolved
src/libs/Performance.js Show resolved Hide resolved
src/libs/Performance.js Show resolved Hide resolved
src/libs/ActiveClientManager/index.js Outdated Show resolved Hide resolved
src/libs/actions/Network.js Outdated Show resolved Hide resolved
src/libs/actions/Session.js Outdated Show resolved Hide resolved
src/libs/actions/Session.js Outdated Show resolved Hide resolved
src/libs/actions/Session.js Outdated Show resolved Hide resolved
@marcaaron
Copy link
Contributor Author

Updated

src/libs/API.js Outdated
@@ -153,7 +159,8 @@ Network.registerResponseHandler((queuedRequest, response) => {
// There are some API requests that should not be retried when there is an auth failure like
// creating and deleting logins. In those cases, they should handle the original response instead
// of the new response created by handleExpiredAuthToken.
if (queuedRequest.data.doNotRetry || unableToReauthenticate) {
const shouldRetry = lodashGet(queuedRequest, 'data.shouldRetry', true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be safer to assume false as the default here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most things should be retried and the exception is when things pass shouldRetry: false (previously this was doNotRetry). Thinking more on this.. maybe a better way to handle this would be to add shouldRetry: true as the default whenever a request is queued. That way we don't have to have to use lodashGet() in the two places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok good to know, I didn't know we considered it safe to consider that any command is retriable by default, because on other layers we consider it's not safe to retry unless the command is explicitly known to be idempotent.

* @param {String} [request.data.returnValueList]
* @return {Boolean}
*/
function canRetryRequest(request) {
const doNotRetry = lodashGet(request, 'data.doNotRetry', false);
const logParams = {command: request.command, doNotRetry, isQueuePaused};
const shouldRetry = lodashGet(request, 'data.shouldRetry', true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above about default value.

@@ -40,6 +46,20 @@ function setLocale(locale) {
Onyx.merge(ONYXKEYS.NVP_PREFERRED_LOCALE, locale);
}

function getLocaleAndUpdate() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker - The function name sounds a little odd to me, like something was missing after "and update". Maybe loadLocale() would be an alternative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using get* or fetch* in a lot of methods so probably something like getLocale() is fine here?

User.getUserDetails();
User.getBetas();
User.getDomainInfo();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that sounds good to me!

roryabraham
roryabraham previously approved these changes Nov 5, 2021
@roryabraham roryabraham merged commit bf8c8f6 into main Nov 8, 2021
@roryabraham roryabraham deleted the marcaaron-updateEslintConfig branch November 8, 2021 14:39
@OSBotify
Copy link
Contributor

OSBotify commented Nov 8, 2021

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @roryabraham in version: 1.1.14-5 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @AndrewGable in version: 1.1.15-15 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@@ -59,8 +79,14 @@ AppState.addEventListener('change', (nextAppState) => {
appState = nextAppState;
});

function triggerUpdateAvailable() {
Onyx.merge(ONYXKEYS.UPDATE_AVAILABLE, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be Onyx.set( since we're only storing a bool?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that's correct!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants