Closed
Description
I created a repository to reproduce this error here.
Expected behavior
I expected eslint to run on the command line without error.
Actual behavior
It produced the following error:
TypeError: sourceCode.getScope is not a function
Occurred while linting ./index.js:4
Rule: "jsdoc/no-undefined-types"
at exports.default.iterateAllJsdocs (./node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs:199:209)
at iterate (./node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1690:3)
at callIterator (./node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1833:7)
at *:not(Program) (./node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1891:11)
at ruleErrorHandler (./node_modules/eslint/lib/linter/linter.js:966:28)
at ./node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (./node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (./node_modules/eslint/lib/linter/node-event-generator.js:290:26)
at NodeEventGenerator.applySelectors (./node_modules/eslint/lib/linter/node-event-generator.js:317:22)
ESLint Config
module.exports = {
extends: [
"plugin:jsdoc/recommended",
],
// the error will occurr if either or both of the following are present
env: {
es2021: true
},
parserOptions: {
ecmaVersion: "latest",
},
};
ESLint sample
/**
*
*/
doThing = function (a, b) {
console.log(`Doing a thing: ${a}, ${b}`);
};
Environment
- Node version: v23.5.0
- ESLint version v8.0.1
eslint-plugin-jsdoc
version: 50.6.14