Skip to content

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

Closed
@sindresorhus

Description

@sindresorhus

Issuehunt badges

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 Summary

gmartigny gmartigny has been rewarded.

Backers (Total: $60.00)

Submitted pull Requests


Tips

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions