Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: check for class properties (fixes #210)
  • Loading branch information
gajus committed May 26, 2020
1 parent cd19943 commit 6015308
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rules/semi.js
Expand Up @@ -57,6 +57,9 @@ const create = (context) => {
return {
OpaqueType: checkForSemicolon,
TypeAlias: checkForSemicolon,
TypeAnnotation: (node) => {
checkForSemicolon(node.parent);
},
};
};

Expand Down
28 changes: 28 additions & 0 deletions tests/rules/assertions/semi.js
@@ -1,5 +1,25 @@
export default {
invalid: [
{
code: 'class Foo { foo: string }',
errors: [
{
message: 'Missing semicolon.',
},
],
options: ['always'],
output: 'class Foo { foo: string; }',
},
{
code: 'class Foo { foo: string; }',
errors: [
{
message: 'Extra semicolon.',
},
],
options: ['never'],
output: 'class Foo { foo: string }',
},
{
code: 'type FooType = {}',
errors: [
Expand Down Expand Up @@ -80,6 +100,14 @@ export default {
code: 'type FooType = {};',
options: ['always'],
},
{
code: 'class Foo { foo: string; }',
options: ['always'],
},
{
code: 'class Foo { foo: string }',
options: ['never'],
},
{
code: 'type FooType = { a: number;\n b: string;\n };',
options: ['always'],
Expand Down

0 comments on commit 6015308

Please sign in to comment.