Skip to content

vue/max-lines-per-block

强制 Vue SFC 块中的最大行数

¥enforce maximum number of lines in Vue SFC blocks

📖 规则详情

此规则强制每个块的最大行数,以帮助提高可维护性并降低复杂性。

¥This rule enforces a maximum number of lines per block, in order to aid in maintainability and reduce complexity.

🔧选项

¥🔧 Options

此规则采用一个对象,你可以在其中指定每种类型的 SFC 块中的最大行数并自定义行计数行为。可以为对象指定以下属性。

¥This rule takes an object, where you can specify the maximum number of lines in each type of SFC block and customize the line counting behavior. The following properties can be specified for the object.

  • script ...指定 <script> 块中的最大行数。如果未指定,则不会强制限制。

    ¥script ... Specify the maximum number of lines in <script> block. Won't enforce limitation if not specified.

  • template ...指定 <template> 块中的最大行数。如果未指定,则不会强制限制。

    ¥template ... Specify the maximum number of lines in <template> block. Won't enforce limitation if not specified.

  • style ...指定 <style> 块中的最大行数。如果未指定,则不会强制限制。

    ¥style ... Specify the maximum number of lines in <style> block. Won't enforce limitation if not specified.

  • skipBlankLines ...忽略纯空格组成的行。

    ¥skipBlankLines ... Ignore lines made up purely of whitespaces.

{ template: 2 }

Now loading...

{ script: 1, skipBlankLines: true }

Now loading...

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v9.15.0 中引入

¥This rule was introduced in eslint-plugin-vue v9.15.0

🔍代码实现

¥🔍 Implementation

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号