medialize/ally.js

View on GitHub
build/data-tables/utils/focusable.notes.interface.js

Summary

Maintainability
B
4 hrs
Test Coverage

Notes has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Notes {
  constructor(source, offset) {
    // the source data
    this.source = source;
    // the result data
Severity: Minor
Found in build/data-tables/utils/focusable.notes.interface.js - About 2 hrs to fix

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.target[browser] || null;

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.ally || [];

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.browsers[browser] || [];

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.browsers[browser] || [];

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.target[browser] || null;

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.ally || [];

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.general || [];

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.related[browser] || null;

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.general || [];

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

        return _map && _map.related[browser] || null;

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        data.redirect && Object.keys(data.redirect).forEach(function(mapping) {
          this._importRedirectionNotes(mapping, data, _map);
        }, this);
    Severity: Major
    Found in build/data-tables/utils/focusable.notes.interface.js and 1 other location - About 1 hr to fix
    build/data-tables/utils/focusable.notes.interface.js on lines 43..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 55.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        data.browsers && Object.keys(data.browsers).forEach(function(browser) {
          this._importBrowserNotes(browser, data, _map);
        }, this);
    Severity: Major
    Found in build/data-tables/utils/focusable.notes.interface.js and 1 other location - About 1 hr to fix
    build/data-tables/utils/focusable.notes.interface.js on lines 47..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 55.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status