Skip to content

Commit

Permalink
fix: check type annotation context
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed May 27, 2020
1 parent b4a8939 commit 1ec503d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rules/semi.js
Expand Up @@ -58,7 +58,9 @@ const create = (context) => {
OpaqueType: checkForSemicolon,
TypeAlias: checkForSemicolon,
TypeAnnotation: (node) => {
checkForSemicolon(node.parent);
if (node.parent.type === 'ClassProperty') {
checkForSemicolon(node.parent);
}
},
};
};
Expand Down
4 changes: 4 additions & 0 deletions tests/rules/assertions/semi.js
Expand Up @@ -100,6 +100,10 @@ export default {
code: 'type FooType = {};',
options: ['always'],
},
{
code: '(foo: string) => {}',
options: ['always'],
},
{
code: 'class Foo { foo: string; }',
options: ['always'],
Expand Down

0 comments on commit 1ec503d

Please sign in to comment.