# wxml/max-depth
# Background
Max Depth
Many developers consider code difficult to read if tags are nested beyond a certain depth, same with official eslint
rules max-depth (opens new window), but for wxml
tag depth.
# Motivation
This rule enforces a maximum depth that tags can be nested to reduce code complexity.
<!-- ✓ GOOD -->
<view depth="1">
<view depth="2">
<view depth="3"></view>
</view>
<view depth="2"></view>
</view>
<!-- ✗ BAD -->
<view depth="1">
<view depth="2">
<view depth="3">
<view depth="4">
<view depth="5">
<view depth="6" />
</view>
</view>
</view>
</view>
</view>
💡 tips
You can edit code via online editor, it's online REPL, try to fix eslint problem !
# Config
"wxml/max-depth": [<enabled>, number]
# Config example
{ "wxml/max-depth": ["error", 10] }
# Version
This rule was introduced in eslint-plugin-wxml v0.3.0