Skip to content

Commit ea76276

Browse files
committed
fix: allow Program for isGetter/isSetter checks; fixes gajus#832
1 parent f48766e commit ea76276

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/jsdocUtils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1298,11 +1298,11 @@ const isConstructor = (node) => {
12981298
};
12991299

13001300
const isGetter = (node) => {
1301-
return node && node.parent.kind === 'get';
1301+
return node && node.parent?.kind === 'get';
13021302
};
13031303

13041304
const isSetter = (node) => {
1305-
return node && node.parent.kind === 'set';
1305+
return node && node.parent?.kind === 'set';
13061306
};
13071307

13081308
const hasAccessorPair = (node) => {

test/rules/assertions/requireReturns.js

+21
Original file line numberDiff line numberDiff line change
@@ -2472,5 +2472,26 @@ export default {
24722472
ecmaVersion: 8,
24732473
},
24742474
},
2475+
{
2476+
code: `
2477+
/** Enumerates possible genders for a product's target demographic. */
2478+
enum Gender {
2479+
Unisex,
2480+
Mens,
2481+
Women
2482+
}
2483+
2484+
export default Gender;
2485+
`,
2486+
ignoreReadme: true,
2487+
options: [
2488+
{
2489+
contexts: [
2490+
':not(:matches(VariableDeclarator))',
2491+
],
2492+
},
2493+
],
2494+
parser: require.resolve('@typescript-eslint/parser'),
2495+
},
24752496
],
24762497
};

0 commit comments

Comments
 (0)