LoginSignup
10
7

More than 5 years have passed since last update.

ESLint v3.13.0

Last updated at Posted at 2017-01-10

v3.12.0 | 次 v3.14.0

ESLint 3.13.0 がリリースされました。
いくつかの機能追加・バグ修正が行われています。

質問やバグ報告等ありましたら、お気軽にこちらまでお寄せください。


:bulb: 新しいルール

#6053: prefer-destructuring

JSCS Icon JSCS 互換ルールです。

ローカル変数にプロパティを代入する際に分割代入 (Destructuring Declarations/Assignments) を優先して使おう、というスタイル・ルールです。

/*eslint prefer-destructuring: error */

//✔ GOOD
const {foo, bar} = obj

//✘ BAD
const foo = obj.foo
const bar = obj.bar

:wrench: オプションが追加されたルール

#7564: object-shorthand avoidExplicitReturnArrows

関数本文がブロックであるアロー関数もメソッド記法で書くべし、というオプションが追加されました。

/*eslint object-shorthand: [error, always, {avoidExplicitReturnArrows: true}] */

//✔ GOOD
const a = {
    foo() {
        // do something.
    },
    bar: () => doSomething(),
}

//✘ BAD
const b = {
    foo: () => {
        // do something.
    },
}

:pencil: eslint --fix をサポートしたルール

#7540: no-unneeded-ternary

const foo = bar === 1 ? true : false
const baz = qux ? qux : boop

// ↓↓↓ gets fixed to ↓↓↓

const foo = bar === 1
const baz = qux || boop

#7702: operator-linebreak

foo
  && bar;

// ↓↓↓ gets fixed to ↓↓↓

foo &&
  bar

#7740: object-property-newline

const w = {x,
    y, z
}

// ↓↓↓ gets fixed to ↓↓↓

const w = {
    x,
    y,
    z
}

#7840: no-extra-label

A: while (true) {
    doSomething()
    break A
}

// ↓↓↓ gets fixed to ↓↓↓

while (true) {
    doSomething()
    break
}
10
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7