chore: tighten ESLint config (#6931)

* chore: tighten ESLint config

* more refactor

* refactor push

* fix
This commit is contained in:
Joshua Chen 2022-03-17 17:59:41 +08:00 committed by GitHub
parent f70ddf7e69
commit cc0bceab9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 177 additions and 193 deletions

View file

@ -76,7 +76,7 @@ export default function plugin(options: PluginOptions = {}): Transformer {
return (root) => {
const headings: TOCItem[] = [];
visit(root, 'heading', (child: Heading, _index, parent) => {
visit(root, 'heading', (child: Heading, index, parent) => {
const value = toString(child);
// depth:1 headings are titles and not included in the TOC
@ -93,7 +93,7 @@ export default function plugin(options: PluginOptions = {}): Transformer {
const {children} = root as Parent<Literal>;
const targetIndex = getOrCreateExistingTargetIndex(children, name);
if (headings && headings.length) {
if (headings.length) {
children[targetIndex]!.value = `export const ${name} = ${stringifyObject(
headings,
)};`;