LoginSignup
33
19

More than 5 years have passed since last update.

eslint-config-airbnbの導入

Posted at

動機

jslintからeslintに乗り換える。
Airbnb JavaScript Style Guideを使いたい。
https://github.com/airbnb/javascript

強制的に綺麗な規則正しいコードを書けるようにしたい。
導入しようと思って、最初試したら読み込みエラーとかになってしまっていたので、正しく設定できる方法を書いておく。

設定

ルートディレクトリでインストール

npm init -y

npm install --save-dev eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y eslint

同じディレクトリに .eslintrcを配置する。

// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
{
  "extends": "airbnb"
}

こんな構成

├── .eslintrc
├── node_modules
│   ├── eslint
│   ├── eslint-config-airbnb
│   ├── eslint-plugin-import
│   ├── eslint-plugin-jsx-a11y
│   └── eslint-plugin-react

変えたかったら上書きする
このへん参考。
https://www.ibuildings.nl/blog/2015/11/using-javascript-style-guide

コードを綺麗にしよう

Errorでまくりでめげてる。

33
19
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
33
19