Open
Description
Rule details
Node's assert functions allow for passing in an optional message.
I'd like a way to enforce passing in that message.
For example, assert
takes a value and an optional message.
assert(foo);
assert(foo, 'Foo is required')
Syncing between error logs and code is far easier when your error message is Foo is required
rather than undefined == true
What type of rule is this?
Warns about a potential problem
Example code
// Error/warn
assert(foo);
assert.equal(foo, bar);
// Good
assert(foo, 'Foo is required');
assert.equal(foo, bar, 'Foo and Bar are not equal');
Participation
- I am willing to submit a pull request to implement this rule.
Additional comments
No response