func-names
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"func-names": "error",
},
},
];Foo.prototype.bar = function() {};
const cat = {
meow: function() {}
}
(function() {
// ...
}())
export default function() {}Foo.prototype.bar = function() {};
(function() {
// ...
}())
export default function() {}Foo.prototype.bar = function bar() {};
(function bar() {
// ...
}())Foo.prototype.bar = function bar() {};
const cat = {
meow() {}
}
(function bar() {
// ...
}())
export default function foo() {}const bar = function() {};
const cat = {
meow: function() {}
}
class C {
#bar = function() {};
baz = function() {};
}
quux ??= function() {};
(function bar() {
// ...
}())
export default function foo() {}Foo.prototype.bar = function() {};
(function() {
// ...
}())Examples from the ESLint documentation.
func-names
eslint
export default [
{
rules: {
"func-names": "error",
},
},
];func-names
eslint plugin · style
{
"rules": {
"func-names": "error"
}
}nursery/useNamedFunction
nursery · since 2.6.0
{
"linter": {
"rules": {
"nursery": {
"useNamedFunction": "error"
}
}
}
}Require destructuring from arrays and/or objects
Disallow reassigning function parameters
Disallow else blocks after return statements in if statements
Disallow the unary operators ++ and --
Require or disallow assignment operator shorthand where possible
Enforce that class methods utilize this