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

[HOLD for payment 2023-07-21] [$1000] Fix upstream ESLint bug #22459

Closed
roryabraham opened this issue Jul 8, 2023 · 37 comments
Closed

[HOLD for payment 2023-07-21] [$1000] Fix upstream ESLint bug #22459

roryabraham opened this issue Jul 8, 2023 · 37 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@roryabraham
Copy link
Contributor

roryabraham commented Jul 8, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Problem

We are affected by this upstream bug in ESLint: eslint/eslint#15261

Solution

Fix it!

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e054af762caa3272
  • Upwork Job ID: 1677468674541461504
  • Last Price Increase: 2023-07-08
@roryabraham roryabraham added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 8, 2023
@roryabraham roryabraham self-assigned this Jul 8, 2023
@melvin-bot melvin-bot bot changed the title Fix upstream ESLint bug [$1000] Fix upstream ESLint bug Jul 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01e054af762caa3272

@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

Triggered auto assignment to @tjferriss (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

Triggered auto assignment to @alexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @allroundexperts (External)

@roryabraham
Copy link
Contributor Author

Not sure why we got both @tjferriss and @alexpensify, so I'm going to unassign @alexpensify since he was assigned second

@allroundexperts
Copy link
Contributor

allroundexperts commented Jul 8, 2023

@roryabraham It seems like there is a fix already in progress in upstream repository.

@HLEDYA
Copy link
Contributor

HLEDYA commented Jul 8, 2023

@roryabraham It seems like there is a fix already in progress in upstream repository.

According to this comment, that fix will probably come with v9.0.0

@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

📣 @HLEDYA! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@HLEDYA
Copy link
Contributor

HLEDYA commented Jul 8, 2023

Contributor details
Your Expensify account email: ysfngn.dev@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0134da57005be11004

@melvin-bot
Copy link

melvin-bot bot commented Jul 8, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@HLEDYA
Copy link
Contributor

HLEDYA commented Jul 8, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

An ESLint bug about defining more than one importNames for the same name with no-restricted-imports rule. Only last importNames is checked for the same name.

What is the root cause of that problem?

Here only StatusBar will be checked because of the ESLint bug,

App/.eslintrc.js

Lines 19 to 42 in 60f4817

rules: {
'no-restricted-imports': [
'error',
{
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',
},
],
},
],
},

To enable ESlint to check TouchableOpacity, you need to move it to the bottom.

ScreenRecordExpensify.mp4

What changes do you think we should make in order to solve the problem?

All the separate importNames can be converted into a single importNames. And message can be modified accordingly.

  'no-restricted-imports': [
      'error',
      {
          paths: [
              {
                name: 'react-native',
                importNames: ['useWindowDimensions', 'StatusBar', 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'],
                message: `If you're using following components from react native:\n
                             Touchable* => please use PressableWithFeedback and/or PressableWithoutFeedback from src/components/Pressable instead\n
                             StatusBar => please use StatusBar from src/libs/StatusBar instead\n
                             useWindowDimensions => please use useWindowDimensions from src/hooks/useWindowDimensions instead
                         `,
              }
          ],
      },
  ],

What alternative solutions did you explore? (Optional)

None

@b4s36t4
Copy link
Contributor

b4s36t4 commented Jul 8, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Fix upstream ESLint bug

What is the root cause of that problem?

I've gone through the code of the rule from eslint repo and I found it that rule will hold only importName of the late value meaning the previous imports are overridden.

What changes do you think we should make in order to solve the problem?

Maybe add a new rule inside eslint-config-expensify which solves the problem wanted. Restricting imports from specific modules (for now).

I have written a rule to fix this, which seems working fine.
Implementation Demo:
https://github.com/Expensify/App/assets/59088937/ebb2d0fd-8dd2-458a-9b94-129d04525dba

What alternative solutions did you explore? (Optional)

NA

@roryabraham
Copy link
Contributor Author

@allroundexperts imo eslint/eslint#16196 is kind of yucky since it introduces an "allowlist" approach where only certain imports are explicitly allowed, instead of a "blocklist" approach where only certain imports are explicitly disallowed. What do you think?

@blazejkustra
Copy link
Contributor

blazejkustra commented Jul 10, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Not all restricted react-native imports are restricted due to ESLint bug.

What is the root cause of that problem?

An issue with ESLint concerning the no-restricted-imports rule. When more than one importNames are defined for the same name, only the last importNames is verified, which is the root cause of this bug.

What changes do you think we should make in order to solve the problem?

All distinct importNames can be combined into a single importNames, with an appropriate modification in the accompanying message. The message is formatted in a list and joined with \n for better visibility.

This is a workaround, but since ESlint team is working on the fix in the upstream repository I believe it isn't worth the effort to fix eslint rule

'no-restricted-imports': [
    'error',
    {
        paths: [
            {
                name: 'react-native',
                importNames: ['useWindowDimensions', 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'StatusBar'],
                message: [
                    "For 'useWindowDimensions', please use 'src/hooks/useWindowDimensions' instead.",
                    "For 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from 'src/components/Pressable' instead.",
                    "For 'StatusBar', please use 'src/libs/StatusBar' instead.",
                ].join('\n'),
            },
        ],
    },
],

What alternative solutions did you explore? (Optional)

None

@roryabraham
Copy link
Contributor Author

Ok, since @HLEDYA proposed prettymuch the same fix as @blazejkustra and did so first, I'm going to assign this job to @HLEDYA to implement the workaround in our eslint config

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

📣 @allroundexperts 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

📣 @HLEDYA You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jul 10, 2023
@tjferriss
Copy link
Contributor

The PR is submitted and under review.

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

🎯 ⚡️ Woah @allroundexperts / @HLEDYA, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @HLEDYA got assigned: 2023-07-10 15:54:58 Z
  • when the PR got merged: 2023-07-13 01:11:48 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jul 14, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Fix upstream ESLint bug [HOLD for payment 2023-07-21] [$1000] Fix upstream ESLint bug Jul 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 14, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 14, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.40-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-07-21. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter N/A
  • Contributor that fixed the issue @HLEDYA $1500
  • Contributor+ that helped on the issue and/or PR @allroundexperts $1500

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 14, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@allroundexperts] The PR that introduced the bug has been identified. Link to the PR:
  • [@allroundexperts] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@allroundexperts] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@allroundexperts] Determine if we should create a regression test for this bug.
  • [@allroundexperts] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@tjferriss] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@tjferriss
Copy link
Contributor

Upworks offers sent to @allroundexperts and @HLEDYA. This job is eligible for a 50% #urgency bonus.

@allroundexperts
Copy link
Contributor

Hi @tjferriss!
I'll be getting paid through the app.

@allroundexperts
Copy link
Contributor

Checklist is not needed here since this was a upstream bug.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 20, 2023
@tjferriss
Copy link
Contributor

Payment to @HLEDYA tomorrow assuming no regression.

@HLEDYA
Copy link
Contributor

HLEDYA commented Jul 22, 2023

Hi @tjferriss, afaik there is none.

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@roryabraham
Copy link
Contributor Author

@tjferriss this is ready to pay

@melvin-bot melvin-bot bot removed the Overdue label Jul 24, 2023
@tjferriss
Copy link
Contributor

Paid!

@allroundexperts
Copy link
Contributor

Requested $1500 on the App.

@HLEDYA
Copy link
Contributor

HLEDYA commented Jul 25, 2023

I received the payment, thank you all.

@JmillsExpensify
Copy link

JmillsExpensify commented Jul 27, 2023

@tjferriss Can you please summarize the appropriate individual payments for all parties involved in this issue? This is holding up @allroundexperts NewDot payments. More information on this compliance process in Slack.

@tjferriss
Copy link
Contributor

Updated payment comment #22459 (comment)

@JmillsExpensify
Copy link

Reviewed details for @allroundexperts . These details are accurate based on summary from Business Reviewer and are now approved for payment in NewDot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants