eslint memo
とりあえずこれ入れとけシリーズ
npm install
npm i -D @types/pretty-hrtime @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-plugin-prettier prettier pretty-hrtime
.eslintrc.js
.eslintrc.js
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
modules: true
}
},
plugins: ["@typescript-eslint"],
rules: {}
};
WebStorm
Preferences > Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
Automatic ESLint configuration
に設定する
画面にESLintのエラーが出てくれるようになる
ショートカット
(Mac): prettier command + option + shift + p
prettierで整形してくれる