eslint install (linter to js)


Installation and Usage

Prerequisites: Node.js (^8.10.0, ^10.13.0, or >=11.10.1) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
前提条件:Node.js() SSLが支援しているものでビルドされているもの(普通公式サイトで配布されているNode.jsを使ったら、その中でSSLは入っているはず)

You can install ESLint using npm:
npmを利用してESLintをセットアップしましょう

$ npm install eslint --save-dev
You should then set up a configuration file:

$ ./node_modules/.bin/eslint --init
After that, you can run ESLint on any file or directory like this:

なんか選べる~~

$ ./node_modules/.bin/eslint yourfile.js

拡張(Extensions)セットアップ

eslint-plugin-prettier
https://github.com/prettier/eslint-plugin-prettier

In addition to the above installation instructions, install eslint-config-prettier:

npm install --save-dev eslint-config-prettier
Then you need to add plugin:prettier/recommended as the last extension in your .eslintrc.json:

{
  "extends": ["plugin:prettier/recommended"]
}

This does three things:

Enables eslint-plugin-prettier.
Sets the prettier/prettier rule to "error".
Extends the eslint-config-prettier configuration.
You can then set Prettier's own options inside a .prettierrc file.

In order to support special ESLint plugins (e.g. eslint-plugin-react), add extra exclusions for the plugins you use like so:

{
  "extends": [
    "plugin:prettier/recommended",
    "prettier/flowtype",
    "prettier/react",
    "prettier/standard"
  ]
}

For the list of every available exclusion rule set, please see the readme of eslint-config-prettier.