Closed danciudev closed 1 month ago
Hi @danciudev, thanks for the issue!
TypeError: Error while loading rule 'logical-assignment-operators': sourceCode.getScope is not a function Occurred while linting C:\Users\danci\proyects\open-source\monorepo-template\apps\client\package.json
This is expected behavior because JS rules can't work with JSON language.
js.configs.all,
You'll need to specify files
here. Otherwise, this config object would apply to all files, including JSON files, and JS rules it enables can't work with JSON files.
- js.configs.all,
+ {
+ ...js.configs.all,
+ files: ["**/*.js", /* ... add more extensions here if needed */ ]
+ },
Environment
ESLint version: 9.12.0 @eslint/json version: 0.5.0 Node version: v20.18.0 npm version: 10.8.2 Operating System: Windows 11 pnpm version: 8.14.3
Which language are you using?
json
What did you do?
What did you expect to happen?
Make it work
What actually happened?
Error message:
Oops! Something went wrong! :(
ESLint: 9.12.0
TypeError: Error while loading rule 'logical-assignment-operators': sourceCode.getScope is not a function Occurred while linting C:\Users\danci\proyects\open-source\monorepo-template\apps\client\package.json at Object.create (C:\Users\danci\proyects\open-source\monorepo-template\node_modules.pnpm\eslint@9.12.0\node_modules\eslint\lib\rules\logical-assignment-operators.js:233:37) at createRuleListeners (C:\Users\danci\proyects\open-source\monorepo-template\node_modules.pnpm\eslint@9.12.0\node_modules\eslint\lib\linter\linter.js:943:21) at C:\Users\danci\proyects\open-source\monorepo-template\node_modules.pnpm\eslint@9.12.0\node_modules\eslint\lib\linter\linter.js:1068:84 at Array.forEach ()
at runRules (C:\Users\danci\proyects\open-source\monorepo-template\node_modules.pnpm\eslint@9.12.0\node_modules\eslint\lib\linter\linter.js:999:34)
at #flatVerifyWithoutProcessors (C:\Users\danci\proyects\open-source\monorepo-template\node_modules.pnpm\eslint@9.12.0\node_modules\eslint\lib\linter\linter.js:1914:31)
Link to Minimal Reproducible Example
https://stackblitz.com/edit/vitejs-vite-njjffd?file=eslint.config.js
Participation
Additional comments
No response