huridocs/uwazi

View on GitHub

Showing 3,439 of 3,635 total issues

Prop spreading is forbidden
Open

    return shallow(<BarChartComponent.WrappedComponent {...props} />);

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

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

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

Prop spreading is forbidden
Open

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

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

Prop spreading is forbidden
Open

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

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

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

/** @format */

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/

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

import React, { Component } from 'react';

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

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

import React, { Component } from 'react';

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

Prefer named exports.
Open

export default class VictimSlider extends Component {

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

Prefer named exports.
Open

export default connect(mapStateToProps, mapDispatchToProps, null)(MapComponent);
Severity: Minor
Found in app/react/Markdown/components/Map.js by eslint

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

Prefer named exports.
Open

export default PieChartLabel;

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

File has too many classes (2). Maximum allowed is 1.
Open

import React, { Component } from 'react';
Severity: Minor
Found in app/react/Charts/components/Bar.js by eslint

title: max-classes-per-file

rule_type: suggestion

Files containing multiple classes can often result in a less navigable and poorly structured codebase. Best practice is to keep each file limited to a single responsibility.

Rule Details

This rule enforces that each file may contain only a particular number of classes and no more.

Examples of incorrect code for this rule:

::: incorrect

/*eslint max-classes-per-file: "error"*/

class Foo {}
class Bar {}

:::

Examples of correct code for this rule:

::: correct

/*eslint max-classes-per-file: "error"*/

class Foo {}

:::

Options

This rule may be configured with either an object or a number.

If the option is an object, it may contain one or both of:

  • ignoreExpressions: a boolean option (defaulted to false) to ignore class expressions.
  • max: a numeric option (defaulted to 1) to specify the maximum number of classes.

For example:

{
    "max-classes-per-file": ["error", 1]
}
{
    "max-classes-per-file": [
        "error",
        { "ignoreExpressions": true, "max": 2 }
    ]
}

Examples of correct code for this rule with the max option set to 2:

::: correct

/* eslint max-classes-per-file: ["error", 2] */

class Foo {}
class Bar {}

:::

Examples of correct code for this rule with the ignoreExpressions option set to true:

::: correct

/* eslint max-classes-per-file: ["error", { ignoreExpressions: true }] */

class VisitorFactory {
    forDescriptor(descriptor) {
        return class {
            visit(node) {
                return `Visiting ${descriptor}.`;
            }
        };
    }
}

::: Source: http://eslint.org/docs/rules/

Assignment to function parameter 'classname'.
Open

  classname += ' paypal-donate';

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/

Prefer named exports.
Open

export default { ...PDFJS, ...pdfjsLib };
Severity: Minor
Found in app/react/PDF/PDFJS.js by eslint

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

Export statements should appear at the end of the file
Open

export class LibraryChartComponent extends Component {

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

Prop type "object" is forbidden
Open

  fields: PropTypes.object,

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

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

  payload: PropTypes.array,
Severity: Minor
Found in app/react/Charts/components/Bar.js by eslint

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

Prop type "object" is forbidden
Open

  aggregations: PropTypes.object,

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

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

  aggregations: PropTypes.object,

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

Severity
Category
Status
Source
Language