Skip to content

vue/max-len

enforce a maximum line length in .vue files

📖 Rule Details

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.

Now loading...

🔧 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 ... enforces a maximum line length. default 80
  • template ... enforces a maximum line length for <template>. defaults to value of code
  • tabWidth ... specifies the character width for tab characters. default 2
  • comments ... enforces a maximum line length for comments. defaults to value of code
  • ignorePattern ... ignores lines matching a regular expression. can only match a single line and need to be double escaped when written in YAML or JSON
  • ignoreComments ... if true, ignores all trailing comments and comments on their own line. default false
  • ignoreTrailingComments ... if true, ignores only trailing comments. default false
  • ignoreUrls ... if true, ignores lines that contain a URL. default false
  • ignoreStrings ... if true, ignores lines that contain a double-quoted or single-quoted string. default false
  • ignoreTemplateLiterals ... if true, ignores lines that contain a template literal. default false
  • ignoreRegExpLiterals ... if true, ignores lines that contain a RegExp literal. default false
  • ignoreHTMLAttributeValues ... if true, ignores lines that contain a HTML attribute value. default false
  • ignoreHTMLTextContents ... if true, ignores lines that contain a HTML text content. default false

"code": 40

Now loading...

"template": 120

Now loading...

"comments": 65

Now loading...

"ignoreComments": true

Now loading...

"ignoreTrailingComments": true

Now loading...

"ignoreUrls": true

Now loading...

"ignoreStrings": true

Now loading...

"ignoreTemplateLiterals": true

Now loading...

"ignoreRegExpLiterals": true

Now loading...

"ignoreHTMLAttributeValues": true

Now loading...

"ignoreHTMLTextContents": true

Now loading...

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v6.1.0

🔍 Implementation

Taken with ❤️ from ESLint core