LoginSignup
13
6

More than 5 years have passed since last update.

eslint-find-rulesを使いESlintの全ての項目を設定する

Last updated at Posted at 2018-01-20

eslint-find-rulesを使うと設定されていないルールがあるとそれを教えてくれます。

sarbbottam/eslint-find-rules: Find built-in ESLint rules you don't have in your custom config

これを使いeslint-configをテストしてやることで新しく入った項目を取り逃すことがありません。

package.json

    "find-new-rules": "npm-run-all --parallel find-new-rules:*",
    "find-new-rules:jest": "eslint-find-rules --unused ./other/test/jest.js",
    "find-new-rules:flow": "eslint-find-rules --unused ./other/test/flow.js",
    "find-new-rules:main": "eslint-find-rules --unused ./index.js",
    "test": "npm run find-new-rules"

さらにGreenKeepersemantic-releaseなどを組み合わせることで簡単に常に最新のeslint-configを保つことが出来ると思います。

自分はESLintの設定を一つずつ見てだいたい4時間ぐらいかけて全ての項目を設定しましたが、既存のconfigをextendsすれば手間は大きく減ると思います。

おわりに

jestやflowなど自分の環境に特化したconfigをakameco/eslint-config-precure: ESLint shareable config for akamecoで公開しています。
npmを見ると月800ダウンロード程度あって一体自分以外に誰が使っているんだという気持ちもありますが、全てのconfigを一つずつ設定していったあの時間が無駄ではなかったと思えるのでハッピーです。

何かあれば是非Twitterにて議論しましょう😎

13
6
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
13
6