noFunctionAssign
Это содержимое пока не доступно на вашем языке.
Summary
Section titled “Summary”- Rule available since: 
v1.0.0 - Diagnostic Category: 
lint/suspicious/noFunctionAssign - This rule is recommended, which means is enabled by default.
 - This rule doesn’t have a fix.
 - The default severity of this rule is error.
 - Sources:
- Same as 
no-func-assign 
 - Same as 
 
How to configure
Section titled “How to configure”{  "linter": {    "rules": {      "suspicious": {        "noFunctionAssign": "error"      }    }  }}Description
Section titled “Description”Disallow reassigning function declarations.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”function foo() { };foo = bar;code-block.js:1:10 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
  > 1 │ function foo() { };
      │          ^^^
    2 │ foo = bar;
    3 │ 
  
  ℹ Reassigned here.
  
    1 │ function foo() { };
  > 2 │ foo = bar;
      │ ^^^
    3 │ 
  
  ℹ Use a local variable instead.
  
function foo() {    foo = bar; }code-block.js:1:10 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
  > 1 │ function foo() {
      │          ^^^
    2 │     foo = bar;
    3 │  }
  
  ℹ Reassigned here.
  
    1 │ function foo() {
  > 2 │     foo = bar;
      │     ^^^
    3 │  }
    4 │ 
  
  ℹ Use a local variable instead.
  
foo = bar;function foo() { };code-block.js:2:10 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
    1 │ foo = bar;
  > 2 │ function foo() { };
      │          ^^^
    3 │ 
  
  ℹ Reassigned here.
  
  > 1 │ foo = bar;
      │ ^^^
    2 │ function foo() { };
    3 │ 
  
  ℹ Reassignment happens here because the function declaration is hoisted.
  
  ℹ Use a local variable instead.
  
[foo] = bar;function foo() { };code-block.js:2:10 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
    1 │ [foo] = bar;
  > 2 │ function foo() { };
      │          ^^^
    3 │ 
  
  ℹ Reassigned here.
  
  > 1 │ [foo] = bar;
      │  ^^^
    2 │ function foo() { };
    3 │ 
  
  ℹ Reassignment happens here because the function declaration is hoisted.
  
  ℹ Use a local variable instead.
  
({ x: foo = 0 } = bar);function foo() { };code-block.js:2:10 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
    1 │ ({ x: foo = 0 } = bar);
  > 2 │ function foo() { };
      │          ^^^
    3 │ 
  
  ℹ Reassigned here.
  
  > 1 │ ({ x: foo = 0 } = bar);
      │       ^^^
    2 │ function foo() { };
    3 │ 
  
  ℹ Reassignment happens here because the function declaration is hoisted.
  
  ℹ Use a local variable instead.
  
function foo() {    [foo] = bar; }code-block.js:1:10 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
  > 1 │ function foo() {
      │          ^^^
    2 │     [foo] = bar;
    3 │  }
  
  ℹ Reassigned here.
  
    1 │ function foo() {
  > 2 │     [foo] = bar;
      │      ^^^
    3 │  }
    4 │ 
  
  ℹ Use a local variable instead.
  
(function () {    ({ x: foo = 0 } = bar);    function foo() { }; })();code-block.js:3:14 lint/suspicious/noFunctionAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Do not reassign a function declaration.
  
    1 │ (function () {
    2 │     ({ x: foo = 0 } = bar);
  > 3 │     function foo() { };
      │              ^^^
    4 │  })();
    5 │ 
  
  ℹ Reassigned here.
  
    1 │ (function () {
  > 2 │     ({ x: foo = 0 } = bar);
      │           ^^^
    3 │     function foo() { };
    4 │  })();
  
  ℹ Reassignment happens here because the function declaration is hoisted.
  
  ℹ Use a local variable instead.
  
function foo() {    var foo = bar; }function foo(foo) {    foo = bar; }function foo() {    var foo;    foo = bar; }var foo = () => {};foo = bar;var foo = function() {};foo = bar;var foo = function() {    foo = bar; };import bar from 'bar';function foo() {    var foo = bar;}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.