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... 强制执行最大行长。默认80template... 强制执行<template>的最大行长。默认为code的值tabWidth... 指定制表符的字符宽度。默认2comments... 强制执行注释的最大行长。默认为code的值ignorePattern... 忽略与正则表达式匹配的行。只能匹配单行,并且在 YAML 或 JSON 中编写时需要双重转义ignoreComments... 如果为true,则忽略所有尾随注释和独立行的注释。默认falseignoreTrailingComments... 如果为true,则仅忽略尾随注释。默认falseignoreUrls... 如果为true,则忽略包含 URL 的行。默认falseignoreStrings... 如果为true,则忽略包含双引号或单引号字符串的行。默认falseignoreTemplateLiterals... 如果为true,则忽略包含模板字面量行的。默认falseignoreRegExpLiterals... 如果为true,则忽略包含正则表达式字面量行的。默认falseignoreHTMLAttributeValues... 如果为true,则忽略包含 HTML 属性值的行。默认falseignoreHTMLTextContents... 如果为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 核心,充满 ❤️ 的爱