diff --git a/src/rules/semi.js b/src/rules/semi.js index 0f4b031c..5c6f94a7 100644 --- a/src/rules/semi.js +++ b/src/rules/semi.js @@ -57,6 +57,9 @@ const create = (context) => { return { OpaqueType: checkForSemicolon, TypeAlias: checkForSemicolon, + TypeAnnotation: (node) => { + checkForSemicolon(node.parent); + }, }; }; diff --git a/tests/rules/assertions/semi.js b/tests/rules/assertions/semi.js index 7dd267f0..81c43be5 100644 --- a/tests/rules/assertions/semi.js +++ b/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: [ @@ -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'],