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

chore: upgrade eslint and relevant dependencies #13891

Merged
merged 7 commits into from
Oct 10, 2024
Merged

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Oct 5, 2024

Description of changes

Upgrade eslint to the latest version, v8 is EOL on 10/05.

  • The eslint.config.mjs is generated by eslint provided migration tool npx @eslint/migrate-config .eslintrc.js with some necessary manual fixes for backwards compatibility
  • Manually fixed some issue reported by the new version (mostly due to @typescript/eslint-plugin rule deprecations)

Issue #, if available

Description of how you validated changes

  • yarn build && yarn lint && yarn test

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@HuiSF HuiSF requested review from haverchuck, cshfang, jimblanc and a team as code owners October 5, 2024 01:40
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
caughtErrors: 'none',
Copy link
Member Author

Choose a reason for hiding this comment

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

caughtErrors: 'none', is required by the new version for unused catch (error) in the codebase

Copy link
Member

Choose a reason for hiding this comment

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

why would we catch error but not use it? Maybe we should adhere to default here?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we decided to do so, I want to change the rule separately, wanted to keep this PR only the migration scope.

Comment on lines +262 to +263
allowShortCircuit: true,
allowTernary: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

Allow code patterns used in the codebase, such as

isBrowser() && doBrowserStuff()

runA ? a() : b()

Question: should we disallow this, as the suggestion makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

i do feel this allows for easy shorthand. I feel nothing wrong in doing this 😅


'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-require-imports': 'off',

Copy link
Member Author

Choose a reason for hiding this comment

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

New version disallows using require() by default, we are using it in test codebase for module loading and mocking, as well as in the react-native for module resolution at runtime.

@HuiSF HuiSF merged commit 73a98fc into main Oct 10, 2024
30 checks passed
@HuiSF HuiSF deleted the hui/chore/upgrade-eslint branch October 10, 2024 17:33
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