Open3

ESLint & PrettierをTypeScriptのプロジェクトに導入した

tarunamatarunama

まずESLint

$ npm init @eslint/config                        
✔ How would you like to use ESLint? · problems
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · none
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ What format do you want your config file to be in? · JavaScript
Local ESLint installation not found.
The config that you've selected requires the following dependencies:

@typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest eslint@latest
✔ Would you like to install them now? · No / Yes
✔ Which package manager do you want to use? · pnpm

作成した設定ファイルを

.eslintrc.jsから.eslintrcに。linterの対象外にするため。

tarunamatarunama

Prettier

$ pnpm i -D prettier
Packages: +1
+
Progress: resolved 210, reused 188, downloaded 1, added 1, done

devDependencies:
+ prettier 2.8.1

Done in 1.7s

config file

echo {}> .prettierrc.json
  • add .prettierignore
  • add format script in package.json
  • add .vscode from vscode setting GUI