11import { expect } from 'chai' ;
2- import * as fs from 'fs-extra ' ;
2+ import fs from 'node:fs ' ;
33import MarkdownIt from 'markdown-it' ;
4- import Token from 'markdown-it/lib/token ' ;
4+ import { Token } from 'markdown-it' ;
55import * as path from 'path' ;
6- import toCamelCase = require ( 'lodash.camelcase' ) ;
6+ import toCamelCase from 'lodash.camelcase' ;
77
88import {
99 ParsedDocumentation ,
@@ -13,7 +13,7 @@ import {
1313 ModuleDocumentationContainer ,
1414 ClassDocumentationContainer ,
1515 ElementDocumentationContainer ,
16- } from './ParsedDocumentation' ;
16+ } from './ParsedDocumentation.js ' ;
1717import {
1818 findNextList ,
1919 convertListToTypedKeys ,
@@ -28,15 +28,15 @@ import {
2828 findContentAfterHeadingClose ,
2929 HeadingContent ,
3030 getContentBeforeFirstHeadingMatching ,
31- } from './markdown-helpers' ;
32- import { WEBSITE_BASE_DOCS_URL , REPO_BASE_DOCS_URL } from './constants' ;
33- import { extendError } from './helpers' ;
31+ } from './markdown-helpers.js ' ;
32+ import { WEBSITE_BASE_DOCS_URL , REPO_BASE_DOCS_URL } from './constants.js ' ;
33+ import { extendError } from './helpers.js ' ;
3434import {
3535 parseMethodBlocks ,
3636 _headingToMethodBlock ,
3737 parsePropertyBlocks ,
3838 parseEventBlocks ,
39- } from './block-parsers' ;
39+ } from './block-parsers.js ' ;
4040
4141export class DocsParser {
4242 constructor (
@@ -108,7 +108,7 @@ export class DocsParser {
108108 groups = getContentBeforeConstructor ( tokens ) ;
109109 } else {
110110 // FIXME: Make it so that we don't need this magic FIXME for the electron breaking-changes document
111- groups = getContentBeforeFirstHeadingMatching ( tokens , heading =>
111+ groups = getContentBeforeFirstHeadingMatching ( tokens , ( heading ) =>
112112 [ 'Events' , 'Methods' , 'Properties' , '`FIXME` comments' ] . includes ( heading . trim ( ) ) ,
113113 ) ;
114114 }
@@ -156,7 +156,7 @@ export class DocsParser {
156156 | ClassDocumentationContainer
157157 | ElementDocumentationContainer
158158 ) [ ] = [ ] ;
159- const contents = await fs . readFile ( filePath , 'utf8' ) ;
159+ const contents = await fs . promises . readFile ( filePath , 'utf8' ) ;
160160 const md = new MarkdownIt ( { html : true } ) ;
161161
162162 const allTokens = md . parse ( contents , { } ) ;
@@ -182,7 +182,7 @@ export class DocsParser {
182182 if ( isClass ) {
183183 // Instance name will be taken either from an example in a method declaration or the camel
184184 // case version of the class name
185- const levelFourHeader = headingsAndContent ( tokens ) . find ( h => h . level === 4 ) ;
185+ const levelFourHeader = headingsAndContent ( tokens ) . find ( ( h ) => h . level === 4 ) ;
186186 const instanceName = levelFourHeader
187187 ? ( levelFourHeader . heading . split ( '`' ) [ 1 ] || '' ) . split ( '.' ) [ 0 ] ||
188188 toCamelCase ( container . name )
@@ -262,7 +262,7 @@ export class DocsParser {
262262 }
263263
264264 private async parseStructure ( filePath : string ) : Promise < StructureDocumentationContainer > {
265- const contents = await fs . readFile ( filePath , 'utf8' ) ;
265+ const contents = await fs . promises . readFile ( filePath , 'utf8' ) ;
266266 const md = new MarkdownIt ( { html : true } ) ;
267267
268268 const tokens = md . parse ( contents , { } ) ;
@@ -279,7 +279,7 @@ export class DocsParser {
279279 return {
280280 type : 'Structure' ,
281281 ...baseInfos [ 0 ] . container ,
282- properties : consumeTypedKeysList ( convertListToTypedKeys ( list ! ) ) . map ( typedKey => ( {
282+ properties : consumeTypedKeysList ( convertListToTypedKeys ( list ! ) ) . map ( ( typedKey ) => ( {
283283 name : typedKey . key ,
284284 description : typedKey . description ,
285285 required : typedKey . required ,
0 commit comments