vue/max-len
在
.vue
文件中强制执行最大行长
📖 规则详细信息
此规则强制执行最大行长以提高代码可读性和可维护性。此规则与核心 max-len 规则类似,但它适用于 .vue
中的源代码。
🔧 选项
js
{
"vue/max-len": ["error", {
"code": 80,
"template": 80,
"tabWidth": 2,
"comments": 80,
"ignorePattern": "",
"ignoreComments": false,
"ignoreTrailingComments": false,
"ignoreUrls": false,
"ignoreStrings": false,
"ignoreTemplateLiterals": false,
"ignoreRegExpLiterals": false,
"ignoreHTMLAttributeValues": false,
"ignoreHTMLTextContents": false,
}]
}
code
... 强制执行最大行长。默认80
template
... 强制执行<template>
的最大行长。默认为code
的值tabWidth
... 指定制表符的字符宽度。默认2
comments
... 强制执行注释的最大行长。默认为code
的值ignorePattern
... 忽略与正则表达式匹配的行。只能匹配单行,并且在 YAML 或 JSON 中编写时需要双重转义ignoreComments
... 如果为true
,则忽略所有尾随注释和独立行的注释。默认false
ignoreTrailingComments
... 如果为true
,则仅忽略尾随注释。默认false
ignoreUrls
... 如果为true
,则忽略包含 URL 的行。默认false
ignoreStrings
... 如果为true
,则忽略包含双引号或单引号字符串的行。默认false
ignoreTemplateLiterals
... 如果为true
,则忽略包含模板字面量行的。默认false
ignoreRegExpLiterals
... 如果为true
,则忽略包含正则表达式字面量行的。默认false
ignoreHTMLAttributeValues
... 如果为true
,则忽略包含 HTML 属性值的行。默认false
ignoreHTMLTextContents
... 如果为true
,则忽略包含 HTML 文本内容的行。默认false
"code": 40
"template": 120
"comments": 65
"ignoreComments": true
"ignoreTrailingComments": true
"ignoreUrls": true
"ignoreStrings": true
"ignoreTemplateLiterals": true
"ignoreRegExpLiterals": true
"ignoreHTMLAttributeValues": true
"ignoreHTMLTextContents": true
📚 进一步阅读
🚀 版本
此规则在 eslint-plugin-vue v6.1.0 中引入。
🔍 实现
来自 ESLint 核心,充满 ❤️ 的爱