Help us understand the problem. What is going on with this article?

ESLintの導入手順まとめ

More than 1 year has passed since last update.

ESLintの導入したときの手順をまとめる

yarn add

yarn add --dev eslint eslint-config-airbnb eslint-plugin-import babel-eslint`

設定ファイル

プロジェクト直下の内容のファイルを置く

.eslintrc.json
{
  "env": {
    "es6": true,
    "browser": true,
    "jquery": true // if use $
  },
   "plugins": [
    "import"
  ],
  "parser": "babel-eslint", // for async/await
  "extends": "airbnb-base"
}

ESLintの実行

Railsで app/frontend/javascriptにjsを配置するときの例
--fixオプションは可能なものは自動修正するオプション

以下の様にpackge.jsonscriptsに追加して
yarn run lint:javascriptで実行

package.json
...
  "scripts": {
    "lint:javascript": "eslint --fix app/frontend/javascripts/**/*"
  },
...
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした