Skip to content

このページは翻訳です。英語版と内容が異なる場合は、英語版が正しい内容です。 English

vue-pug/attribute-parens-spacing ​

Pug 属性ブロックの括弧の内側のスペースを統一します。

✅ configs.recommended で有効です(warn)。🔧 --fix で修正できます。

vue/html-closing-bracket-spacing の代わりに動きます。この rule は Pug テンプレートでクラッシュするため、configs.base で無効になっています。

Rule の詳細 ​

この rule は、同じ行にある ( の直後と ) の直前の空白を検査します。

  • never(デフォルト): そこに空白があってはいけません。fix はそれを削除します。
  • always: そこに少なくとも 1 つのスペースが必要です。fix はスペースを 1 つ挿入します。

空白に改行が含まれる側は vue-pug/attribute-parens-newline の担当なのでそのまま残され、空のブロックや空白だけのブロックも同様です。

正しくない例 ​

vue
<template lang="pug">
a( href="/" ) Home
</template>
vue
<template lang="pug">
input( type="text" name="q")
</template>

正しい例 ​

vue
<template lang="pug">
a(href="/") Home
</template>
vue
<template lang="pug">
input(
  type="text"
  name="q"
)
</template>

オプション ​

js
'vue-pug/attribute-parens-spacing': ['warn', 'never']

'never'(デフォルト)または 'always'。

["always"] での正しくない例 ​

vue
<template lang="pug">
a(href="/") Home
</template>

["always"] での正しい例 ​

vue
<template lang="pug">
a( href="/" ) Home
</template>

MIT License のもとで公開されています。