avajs/eslint-plugin-ava

The `assertion-arguments` rule should validate message argument type #167

sindresorhus posted onGitHub

This currently passes t.deepEqual({}, {}, {});, which can make for some hard to debug issues. @gajus reported such issue on Gitter.

We should ensure that if message is specified, it's a string. We could implement inline literal validation first, as that's pretty easy.

We should also detect the type if it's a variable defined in the same scope:

const message = 'foo';

...

t.deepEqual({}, {}, message);

@jfmengels Many rules could use some kind of naive type inference. Maybe eslint-ast-utils could add something like that?


Note: This issue has a bounty, so it's expected that you are an experienced programmer and that you give it your best effort if you intend to tackle this. Don't forget, if applicable, to add tests, docs (double-check for typos). And don't be sloppy. Review your own diff multiple times and try to find ways to improve and simplify your code. Instead of asking too many questions, present solutions. The point of an issue bounty is to reduce my workload, not give me more. Include a 🦄 in your PR description to indicate that you've read this. Thanks for helping out 🙌 - @sindresorhus


@issuehunt has funded $60.00 to this issue.


posted by issuehunt-app[bot] over 5 years ago

Should this be under a new option or by default ? I can imagine a case where user use an object with a toString function, but I guess this is extra rare.

posted by GMartigny over 4 years ago

Should this be under a new option or by default ?

Default, I think.

AVA already validates this, so I think it's unlikely anybody will see their linter rules fail, tests would have already been failing. I don't think we need a major release for this. @sindresorhus what do you reckon?

posted by novemberborn over 4 years ago

Agreed

posted by sindresorhus over 4 years ago

@sindresorhus has rewarded $54.00 to @gmartigny. See it on IssueHunt

  • :moneybag: Total deposit: $60.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $6.00
posted by issuehunt-app[bot] about 4 years ago

Fund this Issue

$60.00
Rewarded

Rewarded pull request

Recent activities

gmartigny was rewarded by sindresorhus for avajs/eslint-plugin-ava# 167
about 4 years ago
gmartigny submitted an output to  avajs/ eslint-plugin-ava# 167
over 4 years ago