1 # disallow reassigning `function` declarations (no-func-assign)
3 JavaScript functions can be written as a FunctionDeclaration `function foo() { ... }` or as a FunctionExpression `var foo = function() { ... };`. While a JavaScript interpreter might tolerate it, overwriting/reassigning a function written as a FunctionDeclaration is often indicative of a mistake or issue.
12 This rule disallows reassigning `function` declarations.
14 Examples of **incorrect** code for this rule:
17 /*eslint no-func-assign: "error"*/
26 var a = function hello() {
31 Examples of **incorrect** code for this rule, unlike the corresponding rule in JSHint:
34 /*eslint no-func-assign: "error"*/
40 Examples of **correct** code for this rule:
43 /*eslint no-func-assign: "error"*/
45 var foo = function () {}
48 function foo(foo) { // `foo` is shadowed.
53 var foo = bar; // `foo` is shadowed.