eslint-plugin-ava icon indicating copy to clipboard operation
eslint-plugin-ava copied to clipboard

Agnostic of assertion object name?

Open jfmengels opened this issue 10 years ago • 3 comments

A lot of the rules have hardcoded t as the assertion library name, meaning two things:

  • If the dev uses another name for t, such as assert, rules dealing with it will not lint anything
  • If the dev uses another name for t, and uses t for something else in the test function, the linter may go haywire.

I've seen a related issue in AVA's issues. I think we should either of the following:

  • Add a note in the README saying that t should be used, and why, including the fact that this plugin depends on it heavily, and the reasons that make t great when used in AVA (power-assert) (cc @twada). The description of the use-t rule should be updated too.
  • Make the rules t-agnostic. Most of the work would probably be done in create-ava-rule and then simple updates in the rest of the rules + tests covering.

jfmengels avatar Apr 06 '16 18:04 jfmengels

They really should just be using t to get power-assert goodness.

jamestalmage avatar Apr 06 '16 18:04 jamestalmage

It would be nice to (better) document why it needs to be named t then.

jfmengels avatar Apr 06 '16 19:04 jfmengels

:+1: for ensuring documentation is clear on the t naming requirement.

Until we can allow any argument name IMO this plugin should enforce t.

novemberborn avatar Apr 07 '16 10:04 novemberborn