10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vscodeのESLintの設定

Last updated at Posted at 2017-02-10

1.VSCodeExtension

Extensionsメニューから https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint をインストール

2.ESLintインストール

npm install -g eslint グローバルかローカルにインストール

3.設定

参考: http://qiita.com/mysticatea/items/dc35ced6bd5e782f50cd
・設定ファイルはgoogleのものを使う
 npm install -g eslint-config-google
・カレントディレクトリに.eslintrc.jsonを作成
 "extends": "google",を追記

自分の.eslintrc.json
{
  "env": {
    "browser": true,
    "commonjs": true,
    "es6": true,
    "node": true
  },
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "sourceType": "module"
  },
  "globals": {
    "angular": false,
    "moment": false,
    "_": false,
    "$": true
  }, 
  "extends": "google", // googleの設定を読み込む
  "rules": {
    "require-jsdoc": "off",
    "valid-jsdoc": "off",
    "max-len": "off",
    "no-var": "off",
    "no-invalid-this":"off"
  }
}

4.code > Preferences > Settings に下記を追加
↓自動でインポートされるので不要

"eslint.options": {
 "configFile": "/Users/カレントディレクトリ/.eslintrc.json"
 }

↑自動でインポートされるので不要

10
11
2

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
10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?