LoginSignup
0
0

More than 3 years have passed since last update.

既存のプロジェクトにprettierを使用する

Last updated at Posted at 2020-10-12

最初に

自動コード整形に、prettier を使い始めてみたのですが、既存のコードに適応する方法が分からなかったので、調べてみました。

手順

  1. Install
  2. .prettierignore の作成
  3. prettierの実行

Install

最初にprettierをインストールします。

npm install -g  prettier

.prettierignore の作成

自動コード整形しないファイルを記載します。

.prettierignore
node_modules/

prettierの実行

最後にprettierを実行します。

prettier --write "**/*.js"

まとめ

プロジェクトの途中からでも、prettierを入れることが簡単なので、フォーマット揃えたいなと思った時は気軽に試してみてください。

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