New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce type checking on babel-{cli,node}
#14765
Changes from 5 commits
33e1204
927c6bc
52b7637
34f2352
90d795d
017b6da
938f922
ecf8223
1f62b3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare module "fs-readdir-recursive" { | ||
function read( | ||
root: string, | ||
filter?: (filename: string, index: number, dir: string) => boolean | ||
): string[]; | ||
export = read; | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module "kexec" { | ||
function execvp(cmd: string, args?: string[]): string; | ||
export = execvp; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import convertSourceMap from "convert-source-map"; | ||
import { AnyMap, encodedMap } from "@jridgewell/trace-mapping"; | ||
import type { Section } from "@jridgewell/trace-mapping/dist/types/types"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not comfortable with the undeclared package sub imports. @jridgewell Can you make the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Does this serve the need for now? import type { SectionedSourceMap } from '@jridgewell/trace-mapping';
type Section = SectionedSourceMap['sections'][0] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Thanks! |
||
import slash from "slash"; | ||
import path from "path"; | ||
import fs from "fs"; | ||
|
@@ -18,7 +19,7 @@ export default async function ({ | |
babelOptions, | ||
}: CmdOptions): Promise<void> { | ||
function buildResult(fileResults: Array<any>): CompilationOutput { | ||
const mapSections = []; | ||
const mapSections: Section[] = []; | ||
liuxingbaoyu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let code = ""; | ||
let offset = 0; | ||
|
@@ -70,7 +71,7 @@ export default async function ({ | |
} | ||
return count; | ||
} | ||
function emptyMap() { | ||
function emptyMap(): Section["map"] { | ||
liuxingbaoyu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return { | ||
version: 3, | ||
names: [], | ||
|
@@ -129,7 +130,7 @@ export default async function ({ | |
} | ||
|
||
async function walk(filenames: Array<string>): Promise<void> { | ||
const _filenames = []; | ||
const _filenames: string[] = []; | ||
|
||
filenames.forEach(function (filename) { | ||
if (!fs.existsSync(filename)) return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow-up, could you open a PR to update https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/fs-readdir-recursive/index.d.ts so that then we can use
@types/fs-readdir-recursive
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefinitelyTyped/DefinitelyTyped#61344
Finish. I think we might be able to remove this package at some point.