1
1

More than 3 years have passed since last update.

eslint[nodejs + TypeScript]

Last updated at Posted at 2019-12-19

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で整形してくれる

1
1
0

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
1
1