When parsing a NamedExportDeclaration, the require-yields rule expects an ExportNamedDeclaration node to have a declaration defined, but that is not necessarily the case.
$ npx eslint index.js
Oops! Something went wrong! :(
ESLint: 8.57.0
TypeError: Cannot read properties of null (reading 'generator')
Occurred while linting /Users/wharney/Projects/tmp/index.js:2
Rule: "jsdoc/require-yields"
at utils.isGenerator (file:///Users/wharney/Projects/tmp/node_modules/eslint-plugin-jsdoc/src/iterateJsdoc.js:1356:9)
at shouldReportYields (file:///Users/wharney/Projects/tmp/node_modules/eslint-plugin-jsdoc/src/rules/requireYields.js:107:41)
at iterateJsdoc.contextDefaults (file:///Users/wharney/Projects/tmp/node_modules/eslint-plugin-jsdoc/src/rules/requireYields.js:110:9)
at iterate (file:///Users/wharney/Projects/tmp/node_modules/eslint-plugin-jsdoc/src/iterateJsdoc.js:2049:3)
at checkJsdoc (file:///Users/wharney/Projects/tmp/node_modules/eslint-plugin-jsdoc/src/iterateJsdoc.js:2498:9)
at ruleErrorHandler (/Users/wharney/Projects/tmp/node_modules/eslint/lib/linter/linter.js:1076:28)
at /Users/wharney/Projects/tmp/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/Users/wharney/Projects/tmp/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/Users/wharney/Projects/tmp/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
const foo = "foo";
/** this will crash */
export { foo }
/** this will crash */
export { bar } from "bar";
/** this works as expected */
export const okay = "has declaration!"
When parsing a
NamedExportDeclaration
, therequire-yields
rule expects anExportNamedDeclaration
node to have adeclaration
defined, but that is not necessarily the case.https://github.com/gajus/eslint-plugin-jsdoc/blob/244116e52fc3cedd1d16dd91d8ab218e40f6cfc6/src/iterateJsdoc.js#L1351-L1356
Expected behavior
ESLint does not crash.
Actual behavior
ESLint crashes.
ESLint Config
ESLint sample
Environment
eslint-plugin-jsdoc
version: 48.2.5