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": {
}
};
僕のはこうなっていました。
あまり理解できていない箇所も多いので今後調べらたアップデートしていこうと思います