1919
2020/* global argv, path, cd */
2121
22- 'use strict'
22+ import { dirname } from 'path'
23+ import { fileURLToPath } from 'url'
24+ import 'zx/globals'
25+ import assert from 'assert'
26+ import * as core from '@actions/core'
27+ import { copyFile } from 'fs/promises'
28+ import * as github from '@actions/github'
29+ import specification from '../../output/schema/schema.json' assert { type : 'json ' }
30+ import { run as getReport } from '../../../clients-flight-recorder/scripts/types-validator/index.js'
31+ import {
32+ getNamespace ,
33+ getName
34+ } from '../../../clients-flight-recorder/scripts/types-validator/utils.js'
35+
36+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
2337
24- require ( 'zx/globals' )
25- const assert = require ( 'assert' )
26- const core = require ( '@actions/core' )
27- const { copyFile } = require ( 'fs/promises' )
28- const github = require ( '@actions/github' )
2938const octokit = github . getOctokit ( argv . token )
30- const specification = require ( '../../output/schema/schema.json' )
31- const getReport = require ( '../../../clients-flight-recorder/scripts/types-validator' )
32- const { getNamespace, getName } = require ( '../../../clients-flight-recorder/scripts/types-validator/utils' )
3339
3440const privateNames = [ '_global' ]
3541const tick = '`'
36- const tsValidationPath = path . join ( __dirname , '..' , '..' , '..' , 'clients-flight-recorder' , 'scripts' , 'types-validator' )
37-
38- async function run ( ) {
42+ const tsValidationPath = path . join (
43+ __dirname ,
44+ '..' ,
45+ '..' ,
46+ '..' ,
47+ 'clients-flight-recorder' ,
48+ 'scripts' ,
49+ 'types-validator'
50+ )
51+
52+ async function run ( ) {
3953 await copyFile (
4054 path . join ( __dirname , '..' , '..' , 'output' , 'typescript' , 'types.ts' ) ,
4155 path . join ( tsValidationPath , 'types.ts' )
@@ -53,14 +67,20 @@ async function run () {
5367 per_page : 100
5468 } )
5569 if ( data . length > 0 ) {
56- files . push ( ...data . filter ( entry => entry . status !== 'deleted' ) . map ( entry => entry . filename ) )
70+ files . push (
71+ ...data
72+ . filter ( ( entry ) => entry . status !== 'deleted' )
73+ . map ( ( entry ) => entry . filename )
74+ )
5775 page += 1
5876 } else {
5977 break
6078 }
6179 }
6280
63- const specFiles = files . filter ( file => file . includes ( 'specification' ) && ! file . includes ( 'compiler/test' ) )
81+ const specFiles = files . filter (
82+ ( file ) => file . includes ( 'specification' ) && ! file . includes ( 'compiler/test' )
83+ )
6484 const table = [ ]
6585
6686 cd ( tsValidationPath )
@@ -163,7 +183,7 @@ function generateResponse (r) {
163183 return `${ r . passingResponse } /${ r . totalResponse } `
164184}
165185
166- run ( ) . catch ( err => {
186+ run ( ) . catch ( ( err ) => {
167187 core . error ( err )
168188 process . exit ( 1 )
169189} )
0 commit comments