"A picture is worth a thousand words."
Require variables and properties to be named using emojis (prefer-emoji
) β
πΌβ οΈ This rule is enabled in the π all
config. This rule warns in the β
recommended
config.
π§ This rule is automatically fixable by the --fix
CLI option.
π Rule details β
Emojis convey complex ideas succinctly and are universally recognized. Using them as variable names enhances code clarity and expressiveness. Unfortunately, the Javascript ecosystem doesn't embrace this potential as emojis can't be used as variable names.
π‘ Examples β
js
// β Incorrect
if (a) {
b = c
return foo(d, {
e: f,
g: h,
})
}
// β
Correct
if (πͺ) {
βΊοΈ = π§²
return π·οΈ(π€Ή, {
π¦: π,
πΊ: π,
})
}
js
// β Incorrect
if (a) {
b = c
return foo(d, {
e: f,
g: h,
})
}
// β
Correct
if (a) {
b = c
return foo(d, {
π¦: f,
πΊ: h,
})
}
βοΈ Options β
See eslint-plugin-unicorn/prevent-abbreviations, which this rule is copied from.
checkDefaultAndNamespaceImports β
checkFilenames β
checkProperties β
checkShorthandImports β
checkShorthandProperties β
checkVariables β
ignore β
replacements β
π§ Config β
js
{ rules: { 'ninja/prefer-emoji': 2 } }