# wxml/max-len
# Background
Max Len
Very long lines of code in any language can be difficult to read. In order to aid in readability and maintainability many coders have developed a convention to limit lines of code to X number of characters (traditionally 80 characters).same with official eslint
rules max-len (opens new window), but for wxml
code.
# Motivation
This rule enforces a maximum line length to increase code readability and maintainability. The length of a line is defined as the number of Unicode characters in the line.
# Config Example 1
{ "wxml/max-len": ["error", 70] }
<!-- ✓ GOOD -->
<view depth="1"><view depth="2"><view depth="3"/></view></view>
<!-- ✗ BAD -->
<view depth="1"><view depth="2"><view depth="3"/><view depth="3"/><view depth="3"/></view></view>
# Config Example 2
{ "wxml/max-len": ["error", { "code": 70, "ignoreWhitespace": true }] }
<!-- ✓ GOOD -->
<view depth="1"><view ><view depth="3"/></view></view>
<!-- ✗ BAD -->
<view depth="1"><view depth="2"><view depth="3"/><view depth="3"/><view depth="3"/></view></view>
💡 tips
You can edit code via online editor, it's online REPL, try to fix eslint problem !
# Config
"wxml/max-len": [<enabled>, <number | { code: number, ignoreWhitespace?: boolean }>]
⚠️ warning
If you enable this rule, please provide a valid len number
config, otherwise it not work, and ignoreWhitespace
means codestring.trim()
not really ignore all whitespace single line code content.
# Version
This rule was introduced in eslint-plugin-wxml v0.3.0