diff --git a/src/rules/expect-expect.ts b/src/rules/expect-expect.ts index 7ad7891..2ab6949 100644 --- a/src/rules/expect-expect.ts +++ b/src/rules/expect-expect.ts @@ -65,7 +65,7 @@ export default createEslintRule({ const unchecked: TSESTree.CallExpression[] = [] const settings = parsePluginSettings(context.settings) - if (settings.typecheck) assertFunctionNames.push('expectTypeOf') + if (settings.typecheck) assertFunctionNames.push('expectTypeOf', 'assertType') function checkCallExpression(nodes: TSESTree.Node[]) { for (const node of nodes) { diff --git a/tests/expect-expect.test.ts b/tests/expect-expect.test.ts index ca8b8d8..fe830e7 100644 --- a/tests/expect-expect.test.ts +++ b/tests/expect-expect.test.ts @@ -187,7 +187,7 @@ const it = base.extend<{ }, { code: ` - it("should fail without 'typecheck' enabled", () => { + it("should fail 'expectTypeOf' without 'typecheck' enabled", () => { expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() }); `, @@ -198,6 +198,19 @@ const it = base.extend<{ } ] }, + { + code: ` + it("should fail 'assertType' without 'typecheck' enabled", () => { + assertType('a') + }); + `, + errors: [ + { + messageId: 'noAssertions', + type: AST_NODE_TYPES.Identifier + } + ] + }, { code: ` import { it } from 'vitest';