Repository navigation
v1.17.6 - Fix @invar/require-jsdoc-example rule
Fix
- @invar/require-jsdoc-example: Now correctly detects JSDoc `@example` for exported async functions
- Add new selector: `ExportNamedDeclaration > FunctionDeclaration`
- JSDoc comments attach to `ExportNamedDeclaration` parent node, not `FunctionDeclaration` child
- Add test coverage for async functions (3 new test cases)
- All 88 tests passing
Technical Details
The issue was that for `export async function foo()`, the AST structure is:
```
ExportNamedDeclaration ← JSDoc attaches here
└── FunctionDeclaration ← Rule was checking here (wrong!)
```
The rule's `FunctionDeclaration` selector was querying comments from the child node instead of the parent `ExportNamedDeclaration`, resulting in false positives.
Related
- TypeScript eslint-plugin version: 0.1.1 (bumped)