Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(eslint-plugin): [no-unsafe-member-access] ignore MemberExpression…
…'s whose parents are either TSClassImplements or TSInterfaceHeritage (#2753)
  • Loading branch information
hsmitty93 committed Nov 11, 2020
1 parent abe33fb commit 535db3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/rules/no-unsafe-member-access.ts
Expand Up @@ -71,7 +71,8 @@ export default util.createRule({
}

return {
MemberExpression: checkMemberExpression,
// ignore MemberExpression if it's parent is TSClassImplements or TSInterfaceHeritage
':not(TSClassImplements, TSInterfaceHeritage) > MemberExpression': checkMemberExpression,
'MemberExpression[computed = true] > *.property'(
node: TSESTree.Expression,
): void {
Expand Down
Expand Up @@ -66,6 +66,12 @@ function foo(x?: string[]) {
x?.[(1 as any)++];
}
`,
`
class B implements FG.A {}
`,
`
interface B extends FG.A {}
`,
],
invalid: [
...batchedSingleLineTests({
Expand Down

0 comments on commit 535db3b

Please sign in to comment.