no-func-assign
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"no-func-assign": "error",
},
},
];function foo() {}
foo = bar;
function baz() {
baz = bar;
}
let a = function hello() {
hello = 123;
};foo = bar;
function foo() {}let foo = function () {}
foo = bar;
function baz(baz) { // `baz` is shadowed.
baz = bar;
}
function qux() {
const qux = bar; // `qux` is shadowed.
}Examples from the ESLint documentation.
no-func-assign
eslint
export default [
{
rules: {
"no-func-assign": "error",
},
},
];no-func-assign
eslint plugin · correctness
{
"rules": {
"no-func-assign": "error"
}
}suspicious/noFunctionAssign
suspicious · since 1.0.0
{
"linter": {
"rules": {
"suspicious": {
"noFunctionAssign": "error"
}
}
}
}Disallow duplicate keys in object literals
Disallow calling global object properties as functions
Disallow reassigning const, using, and await using variables
Disallow unreachable code after return, throw, continue, and break statements