Files
gt-agent-company/check-tags.cjs
sexygoat f9fe76ff99
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 1m5s
fix:bug
2026-05-14 09:50:34 +08:00

31 lines
853 B
JavaScript

const fs = require('fs')
const content = fs.readFileSync('src/pages/agent-system/asset-detail/index.vue', 'utf8')
const lines = content.split('\n')
let depth = 0
let issues = []
lines.forEach((line, index) => {
const lineNum = index + 1
const openTags = (line.match(/<view(?![^>]*\/>)/g) || []).length
const closeTags = (line.match(/<\/view>/g) || []).length
const selfClosing = (line.match(/<view[^>]*\/>/g) || []).length
depth += openTags - closeTags
if (depth < 0) {
issues.push(`Line ${lineNum}: More closing than opening tags (depth: ${depth})`)
issues.push(` ${line.trim().substring(0, 100)}`)
}
})
console.log(`Final depth: ${depth}`)
if (depth !== 0) {
console.log(`Missing ${depth} closing </view> tags`)
}
if (issues.length > 0) {
console.log('\nIssues found:')
issues.forEach(issue => console.log(issue))
}