Upgrade to eslint 10 new API
Dear maintainer,
In Eslint 10 they removed some functions that are used in this plugin like ```context.getSourceCode()```.
This is the migration guide where they explain that it has now been replaced by ```context.sourceCode``` :
https://eslint.org/docs/latest/use/migrate-to-10.0.0#-removal-of-deprecated-context-members
For now I can't upgrade to Eslint 10 because I get this error when I run eslint on my repo:
```
Oops! Something went wrong! :(
ESLint: 10.0.0
TypeError: context.getSourceCode is not a function
Occurred while linting /home/myname/Desktop/Work/MyApp/my-monorepo/apps/web/src/app/[locale]/admin/(subpages)/actions/components/db_actions.tsx:11
Rule: "i18next/no-literal-string"
at isValidFunctionCall (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint-plugin-i18next@6.1.3/node_modules/eslint-plugin-i18next/lib/rules/no-literal-string.js:18:30)
at CallExpression (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint-plugin-i18next@6.1.3/node_modules/eslint-plugin-i18next/lib/rules/no-literal-string.js:330:29)
at ruleErrorHandler (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:645:33)
at /home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/source-code-visitor.js:76:46
at Array.forEach (<anonymous>)
at SourceCodeVisitor.callSync (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/source-code-visitor.js:76:30)
at /home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/source-code-traverser.js:291:18
at Array.forEach (<anonymous>)
at SourceCodeTraverser.traverseSync (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/source-code-traverser.js:290:10)
at runRules (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:686:12)
at #flatVerifyWithoutProcessors (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:1248:4)
at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:1333:43)
at Linter._verifyWithFlatConfigArray (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:1400:15)
at Linter.verify (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:861:9)
at Linter.verifyAndFix (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/linter/linter.js:1518:20)
at verifyText (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/eslint/eslint-helpers.js:1179:45)
at readAndVerifyFile (/home/myname/Desktop/Work/MyApp/my-monorepo/node_modules/.pnpm/eslint@10.0.0_jiti@2.6.1/node_modules/eslint/lib/eslint/eslint-helpers.js:1320:10)
ELIFECYCLE Command failed with exit code 2.
```
Thank you
关闭于 2026-04-15 1 条评论