Appearance
vue/max-len
强制
.vue文件中的最大行长度¥enforce a maximum line length in
.vuefiles
📖 规则详情
此规则强制最大行长以提高代码的可读性和可维护性。此规则与核心 max-len 规则类似,但适用于 .vue 中的源代码。
¥This rule enforces a maximum line length to increase code readability and maintainability. This rule is the similar rule as core max-len rule but it applies to the source code in .vue.
🔧选项
¥🔧 Options
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¥
code... enforces a maximum line length. default80template...强制<template>的最大行长。默认为code的值¥
template... enforces a maximum line length for<template>. defaults to value ofcodetabWidth...指定制表符的字符宽度。默认2¥
tabWidth... specifies the character width for tab characters. default2comments...强制注释的最大行长。默认为code的值¥
comments... enforces a maximum line length for comments. defaults to value ofcodeignorePattern...忽略与正则表达式匹配的行。只能匹配一行,用 YAML 或 JSON 编写时需要双重转义¥
ignorePattern... ignores lines matching a regular expression. can only match a single line and need to be double escaped when written in YAML or JSONignoreComments...如果true,则忽略所有尾随注释和自己一行的注释。默认false¥
ignoreComments... iftrue, ignores all trailing comments and comments on their own line. defaultfalseignoreTrailingComments...如果是true,则仅忽略尾随注释。默认false¥
ignoreTrailingComments... iftrue, ignores only trailing comments. defaultfalseignoreUrls...如果true,则忽略包含 URL 的行。默认false¥
ignoreUrls... iftrue, ignores lines that contain a URL. defaultfalseignoreStrings...如果是true,则忽略包含双引号或单引号字符串的行。默认false¥
ignoreStrings... iftrue, ignores lines that contain a double-quoted or single-quoted string. defaultfalseignoreTemplateLiterals...如果是true,则忽略包含模板字面量的行。默认false¥
ignoreTemplateLiterals... iftrue, ignores lines that contain a template literal. defaultfalseignoreRegExpLiterals...如果true,则忽略包含 RegExp 字面量的行。默认false¥
ignoreRegExpLiterals... iftrue, ignores lines that contain a RegExp literal. defaultfalseignoreHTMLAttributeValues...如果true,则忽略包含 HTML 属性值的行。默认false¥
ignoreHTMLAttributeValues... iftrue, ignores lines that contain a HTML attribute value. defaultfalseignoreHTMLTextContents...如果true,则忽略包含 HTML 文本内容的行。默认false¥
ignoreHTMLTextContents... iftrue, ignores lines that contain a HTML text content. defaultfalse
"code": 40
"template": 120
"comments": 65
"ignoreComments": true
"ignoreTrailingComments": true
"ignoreUrls": true
"ignoreStrings": true
"ignoreTemplateLiterals": true
"ignoreRegExpLiterals": true
"ignoreHTMLAttributeValues": true
"ignoreHTMLTextContents": true
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v6.1.0 中引入
¥This rule was introduced in eslint-plugin-vue v6.1.0
🔍代码实现
¥🔍 Implementation
使用 ❤️ 来自 ESLint 核心
¥Taken with ❤️ from ESLint core