huridocs/uwazi

View on GitHub

Showing 3,439 of 3,635 total issues

Definition for rule 'node/no-restricted-import' was not found.
Open

import api from 'app/utils/api';
Severity: Minor
Found in app/react/Entities/EntitiesAPI.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

A control must be associated with a text label.
Open

            <input className="form-control" />

For more information visit Source: http://eslint.org/docs/rules/

A control must be associated with a text label.
Open

          <input id={`required${this.props.index}`} type="checkbox" />

For more information visit Source: http://eslint.org/docs/rules/

Prefer named exports.
Open

export default connect(mapStateToProps, mapDispatchToProps)(FormConfigNested);

For more information visit Source: http://eslint.org/docs/rules/

propType "children" is not required, but has no corresponding defaultProps declaration.
Open

  children: childrenType,

For more information visit Source: http://eslint.org/docs/rules/

Definition for rule 'node/no-restricted-import' was not found.
Open

import PropTypes from 'prop-types';

For more information visit Source: http://eslint.org/docs/rules/

Prop type "any" is forbidden
Open

  localID: PropTypes.any.isRequired,

For more information visit Source: http://eslint.org/docs/rules/

propType "isCommonProperty" is not required, but has no corresponding defaultProps declaration.
Open

  isCommonProperty: PropTypes.bool,

For more information visit Source: http://eslint.org/docs/rules/

propType "removeProperty" is not required, but has no corresponding defaultProps declaration.
Open

  removeProperty: PropTypes.func,

For more information visit Source: http://eslint.org/docs/rules/

'query' PropType is defined but prop is never used
Open

  query: PropTypes.array,

For more information visit Source: http://eslint.org/docs/rules/

Export statements should appear at the end of the file
Open

export class PrioritySortingLabel extends Component {

For more information visit Source: http://eslint.org/docs/rules/

Definition for rule 'node/no-restricted-import' was not found.
Open

import React from 'react';

For more information visit Source: http://eslint.org/docs/rules/

Prop spreading is forbidden
Open

      component = shallow(<FormConfigCommon {...props} />);

For more information visit Source: http://eslint.org/docs/rules/

Prop spreading is forbidden
Open

    component = shallow(<FormConfigMultimedia.WrappedComponent {...mappedProps} />);

For more information visit Source: http://eslint.org/docs/rules/

Prop spreading is forbidden
Open

        return <DecoratedComponent {...this.props} errors={{}} />;

For more information visit Source: http://eslint.org/docs/rules/

Assignment to property of function parameter 'props'.
Open

    props.properties = properties;

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/

Prop spreading is forbidden
Open

      const component = shallow(<MetadataTemplate {...props} />);

For more information visit Source: http://eslint.org/docs/rules/

Arrow function should not return assignment.
Open

        <ComponentToRender ref={ref => (result = ref)} {...props} />

title: no-return-assign

rule_type: suggestion

One of the interesting, and sometimes confusing, aspects of JavaScript is that assignment can happen at almost any point. Because of this, an errant equals sign can end up causing assignment when the true intent was to do a comparison. This is especially true when using a return statement. For example:

function doSomething() {
    return foo = bar + 2;
}

It is difficult to tell the intent of the return statement here. It's possible that the function is meant to return the result of bar + 2, but then why is it assigning to foo? It's also possible that the intent was to use a comparison operator such as == and that this code is an error.

Because of this ambiguity, it's considered a best practice to not use assignment in return statements.

Rule Details

This rule aims to eliminate assignments from return statements. As such, it will warn whenever an assignment is found as part of return.

Options

The rule takes one option, a string, which must contain one of the following values:

  • except-parens (default): Disallow assignments unless they are enclosed in parentheses.
  • always: Disallow all assignments.

except-parens

This is the default option. It disallows assignments unless they are enclosed in parentheses.

Examples of incorrect code for the default "except-parens" option:

::: incorrect

/*eslint no-return-assign: "error"*/

function doSomething() {
    return foo = bar + 2;
}

function doSomething() {
    return foo += 2;
}

const foo = (a, b) => a = b

const bar = (a, b, c) => (a = b, c == b)

function doSomething() {
    return foo = bar && foo > 0;
}

:::

Examples of correct code for the default "except-parens" option:

::: correct

/*eslint no-return-assign: "error"*/

function doSomething() {
    return foo == bar + 2;
}

function doSomething() {
    return foo === bar + 2;
}

function doSomething() {
    return (foo = bar + 2);
}

const foo = (a, b) => (a = b)

const bar = (a, b, c) => ((a = b), c == b)

function doSomething() {
    return (foo = bar) && foo > 0;
}

:::

always

This option disallows all assignments in return statements. All assignments are treated as problems.

Examples of incorrect code for the "always" option:

::: incorrect

/*eslint no-return-assign: ["error", "always"]*/

function doSomething() {
    return foo = bar + 2;
}

function doSomething() {
    return foo += 2;
}

function doSomething() {
    return (foo = bar + 2);
}

:::

Examples of correct code for the "always" option:

::: correct

/*eslint no-return-assign: ["error", "always"]*/

function doSomething() {
    return foo == bar + 2;
}

function doSomething() {
    return foo === bar + 2;
}

:::

When Not To Use It

If you want to allow the use of assignment operators in a return statement, then you can safely disable this rule. Source: http://eslint.org/docs/rules/

Prefer named exports.
Open

export default config;

For more information visit Source: http://eslint.org/docs/rules/

Severity
Category
Status
Source
Language