LoginSignup
3
2

More than 3 years have passed since last update.

WebStorm など JetBrains IntelliJ系エディタで、vueファイルの<script>タグ内の1段インデントをさせない (ESLint, TSLint 対応)

Posted at

WebStorm で Vue.js の単一ファイルコンポーネントを書いているとき、デフォルトだと Command + Option + L の Reformat Code 時、

<script>
  import ....
  export default {
    ...

このように、<script> タグ内で1段階インデントしてしまいます。

こうなっていると、ESLint でも TSLint でも警告が出ます。

ESLint: Expected indentation of 0 spaces but found 2.(indent)

torico-corp-nuxt____workspace_torico_torico-corp-nuxt__-_____layouts_default_vue__torico-corp-nuxt_.png

インデントさせないようにするには、

Command+,(Preference) → Editor / Code Style / HTML の
Do not indent children of: に、script を追加します。

Preferences.png

Preferences.png

これで、インデントは自動追加されず、すでにインデントされているものは Reformat Code時にアンインデントされるようになります。

3
2
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
3
2