Skip to content

Lint rule to prevent literals as the "actual" part of an assertion #74

@GoodForOneFare

Description

@GoodForOneFare

Chai assertions use the first argument as the "actual" value. To guarantee consistent error reporting, the following code should be flagged by a lint rule:

// BAD.
assert.equal(1, foo);
assert.equal(2, foo);
assert.equal("foo", bar);
assert.equal({foo: "bar"}, qux);
assert.equal([1, 2, 3], foo);

strictEqual, deepEqual, ok, notStrictEqual, notOk, etc should be checked, too.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions