0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VSCode上でのPrettierの保存時自動整形設定でのチェックポイント

Posted at

なぜこの記事を書こうと思ったのか

VSCode上でPrettierを使った保存時の自動整形をネット上での記事を参考にしたが、なかなか上手く行かなかったので自分のための記録と自分と同じようなパターンで困ってる人のために書こうと思いました。

躓いたポイント

いろんな記事に書いてある方法は、

  1. Prettierをインストール
  2. 設定 > saveと検索 > Format On Save Modeにチェックを入れる
    Screenshot 2025-04-13 at 20.33.00.png
  3. 同じく 設定 > default formatterと検索 > Editor:Default FormatterをPrettier - Code formatterに設定(他の記事だと少し名前が異なるかもしれないが、内容は同じでした。)
    Screenshot 2025-04-13 at 20.34.46.png
    上記が、いろんな記事に記載してある方法で問題なくできると思いましたが、自分の場合はできませんでした。

追加で必要だったこと

躓いたポイントの手順にプラスアルファで、確認して欲しい設定は
Format On Save Modeの設定がmodificationsになっていないか、
ここがmodificationsになっていたため自分はうまくいきませんでした。
ここをmodificationsではなく、fileにしてください。
Screenshot 2025-04-13 at 20.44.55.png
もし、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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?