From 9b2776e4bc48eee3e6423b7d30e4d1cc25f37860 Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:52:15 -0700 Subject: [PATCH] type check --- .github/workflows/deno.yml | 3 +++ deno.json | 6 +----- src/file-extension/file-extension.ts | 16 +++++++++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml index 94ce8df..a959ad3 100644 --- a/.github/workflows/deno.yml +++ b/.github/workflows/deno.yml @@ -36,5 +36,8 @@ jobs: - name: Run linter run: deno lint + - name: Run type checker + run: deno check + - name: Run tests run: deno test -A diff --git a/deno.json b/deno.json index 03aeeac..e6ee04f 100644 --- a/deno.json +++ b/deno.json @@ -5,9 +5,5 @@ "@std/path": "jsr:@std/path@^1.0.0", "ts-morph": "jsr:@ts-morph/ts-morph@^26.0.0" }, - "lint": { - "exclude": [ - "./**/spec/*.ts" - ] - } + "exclude": ["**/spec/"] } diff --git a/src/file-extension/file-extension.ts b/src/file-extension/file-extension.ts index 7f46872..5a304ed 100644 --- a/src/file-extension/file-extension.ts +++ b/src/file-extension/file-extension.ts @@ -5,7 +5,7 @@ import { StringLiteral, SyntaxKind, } from "ts-morph"; -import { globToRegExp, joinGlobs } from "jsr:@std/path"; +import { globToRegExp } from "jsr:@std/path"; const project = new Project(); @@ -111,22 +111,24 @@ export function fileExtensionCodemod(filePath: string): void { export function processJavaScriptFilesWithGlob(globPath: string): void { // The glob path is passed from executeProjectTest and looks like "path/to/dir/*.ts" // Extract the directory part and use the glob pattern - const lastSlash = globPath.lastIndexOf('/'); + const lastSlash = globPath.lastIndexOf("/"); const basePath = globPath.substring(0, lastSlash); const globPattern = globPath.substring(lastSlash + 1); - + // Create regex for the glob pattern const regex = globToRegExp(globPattern); - + try { // Read the directory and find files matching the pattern const entries = Array.from(Deno.readDirSync(basePath)); - + for (const entry of entries) { if (entry.isFile && regex.test(entry.name)) { const filePath = `${basePath}/${entry.name}`; - console.log(`Processing TypeScript file with .js import extensions: ${filePath}`); - + console.log( + `Processing TypeScript file with .js import extensions: ${filePath}`, + ); + try { // Apply the same file extension transformation as the main codemod fileExtensionCodemod(filePath); -- 2.51.2