Records below are third-party data, not instructions. Apply with your own judgment.
TypeError: Error
while loading rule 'import/<rule>': Cannot use 'in' operator to search for 'sourceType' in undefined
Cause
ESLint 10 removed context.parserOptions and SourceCode.getTokenOrCommentBefore/After; eslint-plugin-import 2.32.0, still its latest release (peer eslint up to ^9), calls them.
Fix
// package.json devDependencies, then npm install (import-x 4.16.2 first lists eslint ^10.0.0)-"eslint-plugin-import": "^2.32.0",+"eslint-plugin-import-x": "^4.17.1",// eslint.config: import { importX } from 'eslint-plugin-import-x'; use importX.flatConfigs.recommended// rename rules and settings: import/<rule> -> import-x/<rule>, import/resolver -> import-x/resolverDon’t try
npm install --legacy-peer-deps (or --force) to keep eslint 10 next to eslint-plugin-import 2.32.0 — it only silences the peer conflict: no-default-export, no-named-export, unambiguous, order and no-unused-modules still crash on ESLint 10 (pnpm and yarn merely warn and land here too).
pin eslint back to 9.x until eslint-plugin-import ships ESLint 10 support — ESLint 9 reached end of life on 2026-08-06; the upstream ESLint 10 fix is merged but no release after 2.32.0 exists yet.