Skip to content

[No QA] Upgrade to ESLint 9#71593

Merged
roryabraham merged 43 commits into
Expensify:mainfrom
QichenZhu:eslint-9
Oct 16, 2025
Merged

[No QA] Upgrade to ESLint 9#71593
roryabraham merged 43 commits into
Expensify:mainfrom
QichenZhu:eslint-9

Conversation

@QichenZhu

@QichenZhu QichenZhu commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #67420
PROPOSAL:

Tests

  1. Run npm run lint
  2. Verify there are no errors and warnings don't exceed --max-warnings
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • 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.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • 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.

Screenshots/Videos (N/A)

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

Comment thread eslint.config.js Outdated
Comment thread eslint.config.js Outdated
@melvin-bot

melvin-bot Bot commented Oct 2, 2025

Copy link
Copy Markdown

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@QichenZhu QichenZhu changed the title [No QA] Upgrade to ESLint 9 [WIP] [No QA] Upgrade to ESLint 9 Oct 2, 2025
Comment thread eslint-config-expensify-2.0.90.tgz Outdated
@QichenZhu QichenZhu marked this pull request as ready for review October 2, 2025 15:46
@QichenZhu

QichenZhu commented Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

@roryabraham, I suggest these follow-up PRs:

  1. Fix @typescript-eslint/no-base-to-string: PR [NO QA] Eslint9 - fix @typescript-eslint/no-base-to-string #72748
  2. Fix @typescript-eslint/no-unsafe-call: PR [NO QA] Eslint9 - fix @typescript-eslint/no-unsafe-call #72011
  3. Drop eslint-config-airbnb-typescript
  4. Remove @lwc/lwc/no-async-await and rulesdir/no-multiple-onyx-in-file from eslint-config-expensify and App
  5. Enable react-native-a11y/has-accessibility-hint

I think @LukasMod is handling 1 and 2?

I can take care of 3 and 4 if needed.

Let me know if I missed anything.

Update:

  1. Remove @typescript-eslint/no-unused-vars supression in src/components/ProductTrainingContext/TOOLTIPS.ts
  2. Address @typescript-eslint/await-thenable errors and remove supressions
  3. Fix MODULE_TYPELESS_PACKAGE_JSON warnings

@LukasMod

Copy link
Copy Markdown
Contributor

@QichenZhu

  1. I have a solution for it, but the PR hasn’t been created yet.
  2. It’s prepared and waiting – I resolve conflicts from time to time: [NO QA] Eslint9 - fix @typescript-eslint/no-unsafe-call #72011
  3. I stumbled upon https://eslint-airbnb-extended.nishargshah.dev/ Maybe it could be useful, so I’ll just leave it here

@QichenZhu

Copy link
Copy Markdown
Contributor Author
  1. I have a solution for it, but the PR hasn’t been created yet.
  2. It’s prepared and waiting – I resolve conflicts from time to time: [NO QA] Eslint9 - fix @typescript-eslint/no-unsafe-call #72011

Thanks for that!

  1. I stumbled upon https://eslint-airbnb-extended.nishargshah.dev/ Maybe it could be useful, so I’ll just leave it here

eslint-config-airbnb-extended looks quite new and promising (96 stars, 27829 weekly downloads). It's a replacement for eslint-config-airbnb + eslint-config-airbnb-typescript. One reason we dropped eslint-config-airbnb still applies (some rules don't make sense for us and we have to override them). However, there's no evidence it's unfriendly to the community, so it could be an option.

@QichenZhu QichenZhu requested a review from roryabraham October 15, 2025 13:07
@roryabraham

Copy link
Copy Markdown
Contributor

I suggest these follow-up PRs

Let's create separate issues for each, to parallelize and simplify payment

Comment on lines +15 to 16
// eslint-disable-next-line @typescript-eslint/no-unused-vars
MULTI_SCAN_EDUCATIONAL_MODAL,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should not suppress this rule. If it's a type only, we should not declare it at runtime

let isAllScanFilesCanBeRead = true;

Promise.all(
// eslint-disable-next-line @typescript-eslint/await-thenable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this one we should refactor rather than disabling

@roryabraham

Copy link
Copy Markdown
Contributor

I think the things we'd like to change are non-critical enough that we don't want to block and get a zillion more conflicts

@roryabraham roryabraham merged commit e4aabe2 into Expensify:main Oct 16, 2025
36 of 38 checks passed
@melvin-bot melvin-bot Bot added the Emergency label Oct 16, 2025
@melvin-bot

melvin-bot Bot commented Oct 16, 2025

Copy link
Copy Markdown

@roryabraham looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@roryabraham

Copy link
Copy Markdown
Contributor

ignored lint-changed to limit risky runtime changes

@OSBotify

Copy link
Copy Markdown
Contributor

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

Comment thread package.json
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=161 --cache --cache-location=node_modules/.cache/eslint",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=244 --cache --cache-location=node_modules/.cache/eslint",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@QichenZhu Do we have any way to check how many Onyx.connect warnings there are?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You can view the raw log and search for "Onyx.connect() is deprecated". There are currently 157.

Screenshot_20251017-012033.png

@blazejkustra

Copy link
Copy Markdown
Contributor

@QichenZhu could you also look into this warning as a follow-up? I got it after running npm run lint locally

(node:29662) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/blazejkustra/Documents/swmansion/expensify/SWMApp/eslint.config.js?mtime=1760621667567 is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/blazejkustra/Documents/swmansion/expensify/SWMApp/package.json.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.2.33-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.2.33-4 🚀

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

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.

7 participants