Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Docs: no-mixed-operators - allowSamePrecedence option docs improvement #9962

@munkychop

Description

@munkychop

Tell us about your environment
N/A (macOS Sierra 10.12.6)

  • ESLint Version:
    v4.17.0

  • Node Version:
    N/A (v8.9.1)

  • npm Version:
    N/A (v5.5.1)

What parser (default, Babel-ESLint, etc.) are you using?
N/A (default)

Please show your full configuration:
N/A

What did you expect to happen?
The allowSamePrecedence option of the no-mixed-operators rule should correctly document "Examples of incorrect code for this rule with {"allowSamePrecedence": false} option".

What actually happened? Please include the actual, raw output from ESLint.
The documentation is incorrect, as it is the same as "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;
/*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/

// + and - have the same precedence.
var foo = a + b - c;

This should simply be changed to something like this:

/*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/

// + and * have different precedence.
var foo = a + b * c;

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussiondocumentationRelates to ESLint's documentationruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions