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 PropTypes from 'prop-types';
Severity: Minor
Found in app/react/App/SiteName.js by eslint

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 spreading is forbidden
Open

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

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

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

import { connect } from 'react-redux';
Severity: Minor
Found in app/react/Layout/ItemSnippet.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 const ItemSnippet = ({ snippets, onSnippetClick, template }) => {
Severity: Minor
Found in app/react/Layout/ItemSnippet.js by eslint

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

Prop spreading is forbidden
Open

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

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 type "array" is forbidden
Open

  routes: PropTypes.array,
Severity: Minor
Found in app/react/App/RouteHandler.js by eslint

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

Arrow function should not return assignment.
Open

          <TestController ref={ref => (component = ref)} />
Severity: Minor
Found in app/react/App/specs/Provider.spec.js by eslint

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/

Imported JSX component file must be in PascalCase or SCREAMING_SNAKE_CASE
Open

                <Control.file id="file" model=".file" accept=".zip,.csv" />

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

Prefer named exports.
Open

export default combineReducers({

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

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

import { combineReducers } from 'redux';

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

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

import { APIURL } from 'app/config.js';

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

Prefer named exports.
Open

export default {

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

Prop type "array" is forbidden
Open

  tocForm: PropTypes.array,

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

Prop type "object" is forbidden
Open

  file: PropTypes.object,

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/

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

  searchSnippets: PropTypes.func,

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

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

/** @format */
Severity: Minor
Found in app/react/Documents/helpers.js by eslint

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

Anchor used as a button. Anchors are primarily expected to navigate. Use the button element instead. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md
Open

        <a onClick={onSnippetClick}>{t('System', 'Show more')}</a>
Severity: Minor
Found in app/react/Layout/ItemSnippet.js by eslint

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

Severity
Category
Status
Source
Language