unicorn/name-replacements
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/name-replacements": "error",
},
},
];const e = new Error();const e = document.createEvent('Event');class Btn {}const error = new Error();const event = document.createEvent('Event');class Button {}Examples from the ESLint documentation.
unicorn/name-replacements
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/name-replacements": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Require or disallow logical assignment operator shorthand
Disallow array accumulation with Array#concat() in loops.
Prevent usage of variables from outside the scope of isolated functions.
Enforce consistent default export declarations.
Disallow asterisk prefixes and shared indentation in multiline comments.