avajs / eslint-plugin-ava

ESLint rules for AVA
https://avajs.dev
MIT License
230 stars 49 forks source link

Rule `use-test` conflicting with typing of `t.context` #293

Closed pvdlg closed 4 years ago

pvdlg commented 4 years ago

The AVA documentation recommends to to type t.context as follow:

import anyTest, {TestInterface} from 'ava';

const test = anyTest as TestInterface<{foo: string}>;

However importing AVA as anyTest instead of test triggers the use-test rule.

I can make a PR but I don't know what the best solution is. Any suggestion?

sindresorhus commented 4 years ago

Could we check if it's a TypeScript file and allow anyTest as a name then? I think the rule context exposes the source file name.

novemberborn commented 4 years ago

Heh, I've been using ava as the default import. But anyTest is still fine.

novemberborn commented 4 years ago

Thanks @pvdlg, 10.1.0 is now available 🎊