Method 'getByDocument' has too many parameters (6). Maximum allowed is 4. Open
getByDocument(
- Read upRead up
- Exclude checks
title: max-params ruletype: suggestion relatedrules: - complexity - max-depth - max-len - max-lines - max-lines-per-function - max-nested-callbacks
- max-statements
Functions that take numerous parameters can be difficult to read and write because it requires the memorization of what each parameter is, its type, and the order they should appear in. As a result, many coders adhere to a convention that caps the number of parameters a function can take.
function foo (bar, baz, qux, qxx) { // four parameters, may be too many
doSomething();
}
Rule Details
This rule enforces a maximum number of parameters allowed in function definitions.
Options
This rule has a number or object option:
-
"max"
(default3
) enforces a maximum number of parameters in function definitions
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
max
Examples of incorrect code for this rule with the default { "max": 3 }
option:
:::incorrect
/*eslint max-params: ["error", 3]*/
/*eslint-env es6*/
function foo (bar, baz, qux, qxx) {
doSomething();
}
let foo = (bar, baz, qux, qxx) => {
doSomething();
};
:::
Examples of correct code for this rule with the default { "max": 3 }
option:
:::correct
/*eslint max-params: ["error", 3]*/
/*eslint-env es6*/
function foo (bar, baz, qux) {
doSomething();
}
let foo = (bar, baz, qux) => {
doSomething();
};
::: Source: http://eslint.org/docs/rules/
Arrow function has too many statements (11). Maximum allowed is 10. Open
row.get('connections').forEach(connection => {
- Read upRead up
- Exclude checks
title: max-statements ruletype: suggestion relatedrules: - complexity - max-depth - max-len - max-lines - max-lines-per-function - max-nested-callbacks
- max-params
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
::: incorrect
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
:::
Examples of correct code for this rule with the default { "max": 10 }
option:
::: correct
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
:::
Note that this rule does not apply to class static blocks, and that statements in class static blocks do not count as statements in the enclosing function.
Examples of correct code for this rule with { "max": 2 }
option:
::: correct
/*eslint max-statements: ["error", 2]*/
function foo() {
let one;
let two = class {
static {
let three;
let four;
let five;
if (six) {
let seven;
let eight;
let nine;
}
}
};
}
:::
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
::: correct
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
::: Source: http://eslint.org/docs/rules/
File has too many lines (612). Maximum allowed is 250. Open
Array.isArray(relOrGroup)
- Read upRead up
- Exclude checks
title: max-lines ruletype: suggestion relatedrules: - complexity - max-depth - max-lines-per-function - max-nested-callbacks - max-params - max-statements further_reading:
- https://web.archive.org/web/20160725154648/http://www.mind2b.com/component/content/article/24-software-module-size-and-file-size
Some people consider large files a code smell. Large files tend to do a lot of things and can make it hard following what's going. While there is not an objective maximum number of lines considered acceptable in a file, most people would agree it should not be in the thousands. Recommendations usually range from 100 to 500 lines.
Rule Details
This rule enforces a maximum number of lines per file, in order to aid in maintainability and reduce complexity.
Please note that most editors show an additional empty line at the end if the file ends with a line break. This rule does not count that extra line.
Options
This rule has a number or object option:
"max"
(default300
) enforces a maximum number of lines in a file"skipBlankLines": true
ignore lines made up purely of whitespace."skipComments": true
ignore lines containing just comments
max
Examples of incorrect code for this rule with a max value of 2
:
::: incorrect
/*eslint max-lines: ["error", 2]*/
var a,
b,
c;
:::
::: incorrect
/*eslint max-lines: ["error", 2]*/
var a,
b,c;
:::
::: incorrect
/*eslint max-lines: ["error", 2]*/
// a comment
var a,
b,c;
:::
Examples of correct code for this rule with a max value of 2
:
::: correct
/*eslint max-lines: ["error", 2]*/
var a,
b, c;
:::
::: correct
/*eslint max-lines: ["error", 2]*/
var a, b, c;
:::
::: correct
/*eslint max-lines: ["error", 2]*/
// a comment
var a, b, c;
:::
skipBlankLines
Examples of incorrect code for this rule with the { "skipBlankLines": true }
option:
::: incorrect
/*eslint max-lines: ["error", {"max": 2, "skipBlankLines": true}]*/
var a,
b,
c;
:::
Examples of correct code for this rule with the { "skipBlankLines": true }
option:
::: correct
/*eslint max-lines: ["error", {"max": 2, "skipBlankLines": true}]*/
var a,
b, c;
:::
skipComments
Examples of incorrect code for this rule with the { "skipComments": true }
option:
::: incorrect
/*eslint max-lines: ["error", {"max": 2, "skipComments": true}]*/
// a comment
var a,
b,
c;
:::
Examples of correct code for this rule with the { "skipComments": true }
option:
::: correct
/*eslint max-lines: ["error", {"max": 2, "skipComments": true}]*/
// a comment
var a,
b, c;
:::
When Not To Use It
You can turn this rule off if you are not concerned with the number of lines in your files.
Compatibility
- JSCS: maximumNumberOfLines Source: http://eslint.org/docs/rules/
Async method 'delete' has too many statements (13). Maximum allowed is 10. Open
async delete(relationQuery, _language, updateMetdata = true) {
- Read upRead up
- Exclude checks
title: max-statements ruletype: suggestion relatedrules: - complexity - max-depth - max-len - max-lines - max-lines-per-function - max-nested-callbacks
- max-params
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
::: incorrect
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
:::
Examples of correct code for this rule with the default { "max": 10 }
option:
::: correct
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
:::
Note that this rule does not apply to class static blocks, and that statements in class static blocks do not count as statements in the enclosing function.
Examples of correct code for this rule with { "max": 2 }
option:
::: correct
/*eslint max-statements: ["error", 2]*/
function foo() {
let one;
let two = class {
static {
let three;
let four;
let five;
if (six) {
let seven;
let eight;
let nine;
}
}
};
}
:::
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
::: correct
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
::: Source: http://eslint.org/docs/rules/
Async method 'save' has too many statements (12). Maximum allowed is 10. Open
async save(_relationships, language, updateEntities = true) {
- Read upRead up
- Exclude checks
title: max-statements ruletype: suggestion relatedrules: - complexity - max-depth - max-len - max-lines - max-lines-per-function - max-nested-callbacks
- max-params
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
::: incorrect
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
:::
Examples of correct code for this rule with the default { "max": 10 }
option:
::: correct
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
:::
Note that this rule does not apply to class static blocks, and that statements in class static blocks do not count as statements in the enclosing function.
Examples of correct code for this rule with { "max": 2 }
option:
::: correct
/*eslint max-statements: ["error", 2]*/
function foo() {
let one;
let two = class {
static {
let three;
let four;
let five;
if (six) {
let seven;
let eight;
let nine;
}
}
};
}
:::
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
::: correct
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
::: Source: http://eslint.org/docs/rules/
Async method 'updateMetadataProperties' has too many statements (16). Maximum allowed is 10. Open
async updateMetadataProperties(template, currentTemplate) {
- Read upRead up
- Exclude checks
title: max-statements ruletype: suggestion relatedrules: - complexity - max-depth - max-len - max-lines - max-lines-per-function - max-nested-callbacks
- max-params
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
::: incorrect
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
:::
Examples of correct code for this rule with the default { "max": 10 }
option:
::: correct
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
:::
Note that this rule does not apply to class static blocks, and that statements in class static blocks do not count as statements in the enclosing function.
Examples of correct code for this rule with { "max": 2 }
option:
::: correct
/*eslint max-statements: ["error", 2]*/
function foo() {
let one;
let two = class {
static {
let three;
let four;
let five;
if (six) {
let seven;
let eight;
let nine;
}
}
};
}
:::
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
::: correct
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
::: Source: http://eslint.org/docs/rules/
Function save
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async save(_relationships, language, updateEntities = true) {
if (!language) {
throw createError('Language cant be undefined');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function prepareRelationshipsToSave
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async prepareRelationshipsToSave(_relationships, language) {
const rels = this.arrangeRelationshipGroups(_relationships);
const relsFlat = rels.flat();
await validateConnectionSchema(relsFlat);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function limitRelationshipResults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const limitRelationshipResults = (results, entitySharedId, hubsLimit) => {
const hubs = conformRelationships(results.rows, entitySharedId).toJS();
results.totalHubs = hubs.length;
results.requestedHubs = Number(hubsLimit);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getDocumentHubs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async getDocumentHubs(entity, file, onlyTextReferences) {
let ownRelations;
if (onlyTextReferences) {
ownRelations = await model.get(
{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Assignment to property of function parameter 'results'. Open
results.totalHubs = hubs.length;
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'results'. Open
results.rows = results.rows.reduce((limitedResults, row) => {
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'template'. Open
delete template.refs;
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'g'. Open
g.templates = g.templates.map(excludeRefs);
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'row'. Open
row.connections = row.connections.reduce((limitedConnections, connection) => {
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'results'. Open
results.requestedHubs = Number(hubsLimit);
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'query'. Open
query.includeUnpublished = true;
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'currentTemplate'. Open
currentTemplate.properties = currentTemplate.properties || [];
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'query'. Open
delete query.filter;
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'query'. Open
query.limit = 9999;
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'entity'. Open
entity.connections = relationships.filter(
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'template'. Open
template.properties = await generateNames(template.properties);
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'item'. Open
item.connections = filteredRelationships.filter(
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Assignment to property of function parameter 'query'. Open
query.ids = ids.length ? ids : ['no_results'];
- Read upRead up
- Exclude checks
title: no-param-reassign ruletype: suggestion furtherreading:
- https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments
object when not in strict mode (see When Not To Use It below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
Rule Details
This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
Examples of incorrect code for this rule:
::: incorrect
/*eslint no-param-reassign: "error"*/
function foo(bar) {
bar = 13;
}
function foo(bar) {
bar++;
}
function foo(bar) {
for (bar in baz) {}
}
function foo(bar) {
for (bar of baz) {}
}
:::
Examples of correct code for this rule:
::: correct
/*eslint no-param-reassign: "error"*/
function foo(bar) {
var baz = bar;
}
:::
Options
This rule takes one option, an object, with a boolean property "props"
, and arrays "ignorePropertyModificationsFor"
and "ignorePropertyModificationsForRegex"
. "props"
is false
by default. If "props"
is set to true
, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor"
or "ignorePropertyModificationsForRegex"
, which is an empty array by default.
props
Examples of correct code for the default { "props": false }
option:
::: correct
/*eslint no-param-reassign: ["error", { "props": false }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of incorrect code for the { "props": true }
option:
::: incorrect
/*eslint no-param-reassign: ["error", { "props": true }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsFor"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
function foo(bar) {
bar.prop = "value";
}
function foo(bar) {
delete bar.aaa;
}
function foo(bar) {
bar.aaa++;
}
function foo(bar) {
for (bar.aaa in baz) {}
}
function foo(bar) {
for (bar.aaa of baz) {}
}
:::
Examples of correct code for the { "props": true }
option with "ignorePropertyModificationsForRegex"
set:
::: correct
/*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsForRegex": ["^bar"] }]*/
function foo(barVar) {
barVar.prop = "value";
}
function foo(barrito) {
delete barrito.aaa;
}
function foo(bar_) {
bar_.aaa++;
}
function foo(barBaz) {
for (barBaz.aaa in baz) {}
}
function foo(barBaz) {
for (barBaz.aaa of baz) {}
}
:::
When Not To Use It
If you want to allow assignment to function parameters, then you can safely disable this rule.
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions. Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import { fromJS } from 'immutable';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prefer named exports. Open
export default {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/