@@ -56,7 +56,6 @@ const negateGlob = (glob) => `!${glob}`;
56
56
const throwForConfigurationFile = ( file , error ) => {
57
57
throw new Error (
58
58
`Unable to use configuration file '${ file } '; ${ error ?. message } ` ,
59
- // @ts -ignore
60
59
{ "cause" : error }
61
60
) ;
62
61
} ;
@@ -115,7 +114,6 @@ const importOrRequireResolve = async (dirOrDirs, id, noRequire) => {
115
114
} catch ( error ) {
116
115
errors . push ( error ) ;
117
116
}
118
- // @ts -ignore
119
117
throw new AggregateError (
120
118
errors ,
121
119
`Unable to require or import module '${ id } '.`
@@ -778,13 +776,15 @@ const lintFiles = (fs, dirInfos, fileContents) => {
778
776
const filteredFiles = filesAfterIgnores . filter (
779
777
( file ) => fileContents [ file ] === undefined
780
778
) ;
779
+ /** @type {Record<string, string> } */
781
780
const filteredStrings = { } ;
782
781
for ( const file of filesAfterIgnores ) {
783
782
if ( fileContents [ file ] !== undefined ) {
784
783
filteredStrings [ file ] = fileContents [ file ] ;
785
784
}
786
785
}
787
786
// Create markdownlint options object
787
+ /** @type {import("markdownlint").Options } */
788
788
const options = {
789
789
"files" : filteredFiles ,
790
790
"strings" : filteredStrings ,
@@ -801,7 +801,6 @@ const lintFiles = (fs, dirInfos, fileContents) => {
801
801
fs
802
802
} ;
803
803
// Invoke markdownlint
804
- // @ts -ignore
805
804
let task = markdownlint ( options ) ;
806
805
// For any fixable errors, read file, apply fixes, and write it back
807
806
if ( markdownlintOptions . fix ) {
@@ -825,7 +824,6 @@ const lintFiles = (fs, dirInfos, fileContents) => {
825
824
}
826
825
}
827
826
return Promise . all ( subTasks ) .
828
- // @ts -ignore
829
827
then ( ( ) => markdownlint ( options ) ) .
830
828
then ( ( fixResults ) => ( {
831
829
...results ,
@@ -1084,38 +1082,26 @@ const main = async (params) => {
1084
1082
return errorsPresent ? 1 : 0 ;
1085
1083
} ;
1086
1084
1087
- // Run function
1088
- const run = ( overrides , args ) => {
1089
- ( async ( ) => {
1090
- const argsAndArgv = args || [ ] ;
1091
- appendToArray ( argsAndArgv , process . argv . slice ( 2 ) ) ;
1092
- try {
1093
- const defaultParams = {
1094
- "argv" : argsAndArgv ,
1095
- "logMessage" : console . log ,
1096
- "logError" : console . error ,
1097
- "allowStdin" : true
1098
- } ;
1099
- const params = {
1100
- ...defaultParams ,
1101
- ...overrides
1102
- } ;
1103
- process . exitCode = await main ( params ) ;
1104
- } catch ( error ) {
1105
- console . error ( error ) ;
1106
- process . exitCode = 2 ;
1107
- }
1108
- } ) ( ) ;
1109
- } ;
1110
-
1111
1085
// Export functions
1112
1086
module . exports = {
1113
- main,
1114
- run
1087
+ main
1115
1088
} ;
1116
1089
1117
1090
// Run if invoked as a CLI
1118
- // @ts -ignore
1119
1091
if ( require . main === module ) {
1120
- run ( ) ;
1092
+ const params = {
1093
+ "argv" : process . argv . slice ( 2 ) ,
1094
+ "logMessage" : console . log ,
1095
+ "logError" : console . error ,
1096
+ "allowStdin" : true
1097
+ } ;
1098
+ main ( params ) .
1099
+ then ( ( exitCode ) => {
1100
+ process . exitCode = exitCode ;
1101
+ } ) .
1102
+ // eslint-disable-next-line unicorn/prefer-top-level-await
1103
+ catch ( ( error ) => {
1104
+ console . error ( error ) ;
1105
+ process . exitCode = 2 ;
1106
+ } ) ;
1121
1107
}
0 commit comments