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?

Nuxt3でESLint Flat Configを導入する際にprettierとの競合を回避する

Last updated at Posted at 2024-06-18

Nuxt3でESLint Flat Configを以下ページのとおりに導入すると、prettierと競合する場合がある
(stylisticを使う前提の手順なので当然といえば当然だが)

image.png
@stylistic/quotesエラーが出ている
prettierはデフォルトだとsingleQuote: falseのため、手でシングルクォートに修正してもCtrl + Sすると自動でダブルクォートになる
(VSCodeにて保存時に修正設定あり)

Flat Configになってからもprettierを使い続けることの是非は置いておくが、今までのルールからできるだけ変えずにFlat Configに移行したい場合もあると思われる

nuxt.config.tsに以下設定があるとESLintのスタイリングルールであるstylisticが有効になってしまいprettierと競合する

eslint: {
  config: {
    stylistic: true,
  },
},

上記を削除するか明示的にfalseとすることで@stylistic関連のルールがすべて無効化され、prettierと競合しなくなる

image.png

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?