unicorn/consistent-assert
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/consistent-assert": "error",
},
},
];assert(divide(10, 2) === 5);assert(divide(10, 2) === 5);assert(divide(10, 2) === 5);assert.ok(divide(10, 2) === 5);assert.ok(divide(10, 2) === 5);assert.ok(divide(10, 2) === 5);Examples from the ESLint documentation.
unicorn/consistent-assert
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/consistent-assert": "error",
},
},
];unicorn/consistent-assert
unicorn plugin · pedantic
{
"rules": {
"unicorn/consistent-assert": "error"
}
}Biome does not have this rule.
Disallow immediate mutation after assignment and initialization immediately after declaration.
Enforce consistent style for escaping ${ in template literals.
Enforce a specific parameter name in catch clauses.
Enforce consistent case for text encoding identifiers.
Disallow Array#reduce() and Array#reduceRight().