Skip to content

Commit

Permalink
fix: allow Program for isGetter/isSetter checks; fixes #832
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 20, 2022
1 parent f48766e commit ea76276
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1298,11 +1298,11 @@ const isConstructor = (node) => {
};

const isGetter = (node) => {
return node && node.parent.kind === 'get';
return node && node.parent?.kind === 'get';
};

const isSetter = (node) => {
return node && node.parent.kind === 'set';
return node && node.parent?.kind === 'set';
};

const hasAccessorPair = (node) => {
Expand Down
21 changes: 21 additions & 0 deletions test/rules/assertions/requireReturns.js
Original file line number Diff line number Diff line change
Expand Up @@ -2472,5 +2472,26 @@ export default {
ecmaVersion: 8,
},
},
{
code: `
/** Enumerates possible genders for a product's target demographic. */
enum Gender {
Unisex,
Mens,
Women
}
export default Gender;
`,
ignoreReadme: true,
options: [
{
contexts: [
':not(:matches(VariableDeclarator))',
],
},
],
parser: require.resolve('@typescript-eslint/parser'),
},
],
};

0 comments on commit ea76276

Please sign in to comment.