Showing 3,439 of 3,635 total issues
Prefer named exports. Open
export default {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prefer named exports. Open
export default (error, req, res, next) => {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import contact from './contact';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import activitylogMiddleware from 'api/activitylog/activitylogMiddleware';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prefer named exports. Open
export default connect(mapStateToProps, mapDispatchToProps)(AddEntities);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import '@4tw/cypress-drag-drop';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Unexpected assignment within a 'while' statement. Open
while ((node = walk.nextNode())) {
- Read upRead up
- Exclude checks
title: no-cond-assign ruletype: problem relatedrules:
- no-extra-parens
In conditional statements, it is very easy to mistype a comparison operator (such as ==
) as an assignment operator (such as =
). For example:
// Check the user's job title
if (user.jobTitle = "manager") {
// user.jobTitle is now incorrect
}
There are valid reasons to use assignment operators in conditional statements. However, it can be difficult to tell whether a specific assignment was intentional.
Rule Details
This rule disallows ambiguous assignment operators in test conditions of if
, for
, while
, and do...while
statements.
Options
This rule has a string option:
-
"except-parens"
(default) allows assignments in test conditions only if they are enclosed in parentheses (for example, to allow reassigning a variable in the test of awhile
ordo...while
loop) -
"always"
disallows all assignments in test conditions
except-parens
Examples of incorrect code for this rule with the default "except-parens"
option:
::: incorrect
/*eslint no-cond-assign: "error"*/
// Unintentional assignment
var x;
if (x = 0) {
var b = 1;
}
// Practical example that is similar to an error
function setHeight(someNode) {
"use strict";
do {
someNode.height = "100px";
} while (someNode = someNode.parentNode);
}
:::
Examples of correct code for this rule with the default "except-parens"
option:
::: correct
/*eslint no-cond-assign: "error"*/
// Assignment replaced by comparison
var x;
if (x === 0) {
var b = 1;
}
// Practical example that wraps the assignment in parentheses
function setHeight(someNode) {
"use strict";
do {
someNode.height = "100px";
} while ((someNode = someNode.parentNode));
}
// Practical example that wraps the assignment and tests for 'null'
function setHeight(someNode) {
"use strict";
do {
someNode.height = "100px";
} while ((someNode = someNode.parentNode) !== null);
}
:::
always
Examples of incorrect code for this rule with the "always"
option:
::: incorrect
/*eslint no-cond-assign: ["error", "always"]*/
// Unintentional assignment
var x;
if (x = 0) {
var b = 1;
}
// Practical example that is similar to an error
function setHeight(someNode) {
"use strict";
do {
someNode.height = "100px";
} while (someNode = someNode.parentNode);
}
// Practical example that wraps the assignment in parentheses
function setHeight(someNode) {
"use strict";
do {
someNode.height = "100px";
} while ((someNode = someNode.parentNode));
}
// Practical example that wraps the assignment and tests for 'null'
function setHeight(someNode) {
"use strict";
do {
someNode.height = "100px";
} while ((someNode = someNode.parentNode) !== null);
}
:::
Examples of correct code for this rule with the "always"
option:
::: correct
/*eslint no-cond-assign: ["error", "always"]*/
// Assignment replaced by comparison
var x;
if (x === 0) {
var b = 1;
}
::: Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import { setUpApp } from 'api/utils/testingRoutes';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prefer named exports. Open
export default app => {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Assignment to property of function parameter '_ctx'. Open
_ctx[val.label] = val.label;
- 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 { propertyTypes } from 'shared/propertyTypes';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import testingDB from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import testingDB from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import testingDB from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import testingDB from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import testingDB from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import testingDB from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
//eslint-disable-next-line node/no-restricted-import
- 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/
Definition for rule 'node/no-restricted-import' was not found. Open
/* eslint-disable max-statements */
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/