chore(deps): upgrade ESLint from v8 to v9 with flat config migration - #214
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughWalkthroughThis PR migrates ESLint configuration to v9 flat config format, updates sample app screens with stricter type checking and React hooks patterns, refines build configuration for improved module resolution, and rewrites the publish script with robust version restoration and error handling. ChangesESLint Configuration Migration to v9
Sample Application, Build Configuration & SDK Refinements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
sample/metro.config.jsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. sample/src/App.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. sample/src/screens/CustomUI.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review Summary by QodoUpgrade ESLint to v9 with flat config and TypeScript linting improvements
WalkthroughsDescription• Migrated ESLint configuration from v8 to v9 with flat config format • Replaced deprecated @react-native-community/eslint-config with @typescript-eslint and prettier • Excluded src/fabric/** from linting to preserve codegen-required type strictness • Fixed lint errors across sample app and scripts with improved code quality Diagramflowchart LR
A["ESLint v8<br/>.eslintrc.js"] -->|"Migrate to flat config"| B["ESLint v9<br/>eslint.config.js"]
C["@react-native-community<br/>eslint-config"] -->|"Replace with"| D["@typescript-eslint<br/>+ prettier + simple-import-sort"]
E["Lint errors<br/>in samples"] -->|"Fix"| F["Clean code<br/>with warnings"]
B --> G["Exclude src/fabric/**<br/>from linting"]
File Changes1. eslint.config.js
|
Code Review by Qodo
1. Undeclared globals import
|
|
PR Summary: Upgrade ESLint to v9 and migrate to flat config; update devDeps and apply related lint/style and small runtime fixes across sample and scripts.
Potential impacts / action items:
|
|
Reviewed up to commit:0bfbb4d633082832553f767eb868c32144f60acb |
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@eslint.config.js`:
- Around line 19-23: Add the missing React Native baseline by including
'`@react-native-community`' in the ESLint configs array and make import-sorting
mandatory by adding the simple-import-sort plugin and turning on its rules for
all JS/TS file types; specifically, update eslint.config.js to include
'`@react-native-community`' alongside js.configs.recommended and
prettierRecommended, add 'simple-import-sort' to plugins, and replace the
current scoped/warn rules with global 'simple-import-sort/imports' and
'simple-import-sort/exports' set to 'error' (apply to **/*.{js,jsx,ts,tsx}) so
import ordering is enforced consistently.
In `@sample/src/App.tsx`:
- Around line 8-9: The README snippet showing sample constants must be updated
to match the new runtime defaults: change the MEDIATION_TEST_ENABLED value to
false and the SETTINGS_ID value to "EA4jnNPb9" so the documented example mirrors
the actual constants declared in the code (MEDIATION_TEST_ENABLED and
SETTINGS_ID); locate the README section with the sample snippet (lines showing
those two constants) and revise the values and any explanatory text that assumes
the old values.
In `@sample/src/screens/CustomUI.tsx`:
- Around line 174-175: The fetched CMP payload from Usercentrics.getCMPData()
(languageData) is only logged and not applied to component state, leaving `data`
stale; update the component state after the await by calling the appropriate
setter (e.g., setData(languageData) or merging into existing state) so the UI
and later actions use the refreshed CMP data; locate the call to
Usercentrics.getCMPData() and add the state update using the component's state
setter (handle merging if needed) and preserve async/await flow and basic error
handling.
In `@scripts/publish-local.js`:
- Around line 92-95: Replace the shell rm call used via execSync in
scripts/publish-local.js with Node's fs.rmSync to be cross-platform: remove the
execSync('rm -rf lib/') usage (and its try/catch) and call fs.rmSync for the lib
directory with { recursive: true, force: true } (import/require fs at top if
necessary) while retaining the same error-tolerant behavior; additionally,
update package.json's "compile" script (currently "rm -rf lib && tsc -p .") to a
cross-platform alternative (e.g., use a Node-based rm command or a package like
rimraf) so the removal of lib is not shell/POSIX dependent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bf729a54-b794-4399-9ed7-9639b67a1bbd
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (12)
.eslintignore.eslintrc.jseslint.config.jspackage.jsonsample/android/settings.gradle.ktssample/metro.config.jssample/src/App.tsxsample/src/screens/CustomUI.tsxsample/src/screens/Home.tsxsample/src/screens/WebviewIntegrationScreen.tsxscripts/publish-local.jssrc/Usercentrics.tsx
💤 Files with no reviewable changes (3)
- .eslintrc.js
- sample/android/settings.gradle.kts
- .eslintignore
User description
Summary
Resolves MSDK-3343. ESLint 8.x reached end-of-life and the
@eslint/eslintrcpackage it depends on was deprecated.
What changed
.eslintrc.js+.eslintignorewitheslint.config.js(ESLint v9 flat config)eslint8 → 9, replaced@react-native-community/eslint-configwith@typescript-eslint+eslint-plugin-prettier@5+prettier@3src/fabric/**excluded from linting — codegen spec files have strict typerequirements (
Objectvsobject) that must not be auto-fixedwarnso pre-existing style in model filesdoesn't block CI
Sample app fixes (caught during verification)
Platformimport insrc/Usercentrics.tsxno-unused-varsinscripts/publish-local.jsHome,CustomUI,WebviewIntegrationScreen)nodeModulesPathstosample/metro.config.jsfor Metro module resolutionmavenLocal()fromsample/android/settings.gradle.kts— was resolvinga locally-built sandbox SDK instead of the published production artifact
Test plan
yarn lintpasses with 0 errorsyarn test— 32/32 tests passCodeAnt-AI Description
Upgrade linting setup and fix sample app issues caught during verification
What Changed
Impact
✅ Fewer lint failures during CI✅ Smoother sample app builds✅ Fewer Metro module resolution errors💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
Chores
Bug Fixes