Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What is going on with this article?
@ogontaro

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/**/*"
  },
...
2
Help us understand the problem. What is going on with this article?
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
ogontaro
updata
不動産DXを推進しています。 主なプロダクト Syncaデータコンバーター Syncaワークフロー Syncaウェブサイト

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
2
Help us understand the problem. What is going on with this article?