LoginSignup
2
2

More than 3 years have passed since last update.

Eslint設定

Posted at

4ヶ月ぶりにReactのプロジェクトを触ることになりその際に環境構築などの設定を1から設定したいのでその為にeslintの簡単な設定を忘れてしまったので備忘録までにメモ

今回はyarnを使用しています

先ずはeslintのinstallから

$ yarn add eslint 

reactも入れたいので

$ yarn add eslint-plugin-react

今回はairbnbのstyleを使用します

$ yarn add eslint-config-airbnb eslint-plugin-import  eslint-plugin-jsx-a11y

これを入れた後に

$ ./node_modules/.bin/eslint --init

諸々設定していると.eslintrc.jsが生成されるので

module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "extends":  "airbnb",
    "globals": {
        "Atomics": "readonly",
        "SharedArrayBuffer": "readonly"
    },
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 2015,
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
    }
};

僕のはこうなっていました。

あまり理解できていない箇所も多いので今後調べらたアップデートしていこうと思います

2
2
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
2
2