Skip to content

Commit 1ca07bd

Browse files
authored
chore: fix tools/update-docs (#594)
* chore: fix tools/update-docs * fix
1 parent 5b02c37 commit 1ca07bd

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

docs/rules/no-useless-non-capturing-group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ since: "v0.4.0"
1313

1414
<!-- end auto-generated rule header -->
1515

16-
> disallow unnecessary Non-capturing group
16+
> disallow unnecessary non-capturing group
1717
1818
## :book: Rule Details
1919

docs/rules/no-useless-range.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ since: "v0.3.0"
1313

1414
<!-- end auto-generated rule header -->
1515

16-
> disallow unnecessary range of characters by using a hyphen
16+
> disallow unnecessary character ranges
1717
1818
## :book: Rule Details
1919

tools/update-docs.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ ${
150150
return this
151151
}
152152

153+
public updateHeaderDescription() {
154+
const { description } = this.rule.meta.docs
155+
156+
this.content = this.content.replace(
157+
// eslint-disable-next-line regexp/no-super-linear-move -- ignore
158+
/\n+> [^\n]*\n+##\s[^\n]*Rule Details/u,
159+
`
160+
161+
> ${description.replace(/\$/gu, "$$$$")}
162+
163+
## :book: Rule Details`,
164+
)
165+
166+
return this
167+
}
168+
153169
public write() {
154170
this.content = this.content.replace(/\r?\n/gu, "\n")
155171

@@ -166,6 +182,7 @@ async function main() {
166182
await doc.updateFooter()
167183
doc.updateCodeBlocks()
168184
await doc.updateFileIntro()
185+
doc.updateHeaderDescription()
169186
doc.adjustCodeBlocks()
170187
doc.write()
171188
}

0 commit comments

Comments
 (0)