3.5.0 β€’ Published 1 year ago

@putout/plugin-extract-sequence-expressions v3.5.0

Weekly downloads
3,139
License
MIT
Repository
github
Last release
1 year ago

@putout/plugin-extract-sequence-expressions NPM version

The comma operator (,) evaluates each of its operands (from left to right) and returns the value of the last operand. This lets you create a compound expression in which multiple expressions are evaluated, with the compound expression's final value being the value of the rightmost of its member expressions.

(c) MDN

🐊Putout plugin adds ability to extract sequence expressions. Check out in 🐊Putout Editor.

☝️Remember, when you writing a transform you can skip all parts related to extracting sequence expressions and just reuse current plugin it will make your code simpler and less error prone.

Install

npm i @putout/plugin-extract-sequence-expressions -D

Rule

{
    "rules": {
        "extract-sequence-expressions": "on"
    }
}

❌ Example of incorrect code

module.exports.x = 1,
module.exports.y = 2;

fn((a, b));
fn(a), 'hello';

fn(a), b = 3;
fn(a), fn(b);

if (a, b, c) {}

βœ… Example of correct code

module.exports.x = 1;
module.exports.y = 2;

fn(a, b);
fn(a, 'hello');

fn(a);
b = 3;

fn(a);
fn(b);

a;
b;

if (c) {}

Comparison

LinterRuleFix
🐊 Putoutextract-sequence-expressionsβœ…
⏣ ESLintno-sequences❌

License

MIT

3.5.0

1 year ago

3.4.0

1 year ago

3.3.0

1 year ago

3.2.0

1 year ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.2.0

3 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago