Skip to content

Commit 3e580aa

Browse files
committed
[misc] fix extensions
1 parent ff4d1c2 commit 3e580aa

10 files changed

+28
-28
lines changed

source/cli.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import meow from 'meow'
22
import { afterEach, describe, expect, it, vi } from 'vitest'
3-
import { tsFix } from '../build/tsfix.js'
3+
import { tsFix } from '../build/tsfix.ts'
44

55
vi.mock('meow')
66
vi.mock('../build/tsfix.js', () => ({

source/extractor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
isStringLiteral,
1414
type Node
1515
} from 'typescript'
16-
import { IMPORT_TYPE, notNull, type Import, type Mode } from './types.js'
16+
import { IMPORT_TYPE, notNull, type Import, type Mode } from './types.ts'
1717

1818
const log = debug('tsfix:extractor')
1919

source/helpers/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Options, Pattern } from 'fast-glob'
22
import { resolve } from 'pathe'
3-
import { findOutDir } from './tsconfig.js'
3+
import { findOutDir } from './tsconfig.ts'
44

55
export type Mode = 'regex' | 'ast'
66

source/helpers/options.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it, vi } from 'vitest'
2-
import { setupOptions, type Args } from './options.js'
2+
import { setupOptions, type Args } from './options.ts'
33
// biome-ignore lint/style/noNamespaceImport: needed for mocking
4-
import * as tsconfig from './tsconfig.js'
4+
import * as tsconfig from './tsconfig.ts'
55

66
describe('getOptions', () => {
77
it('should return default pattern and cwd when args is empty', () => {

source/helpers/package.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { readFile } from 'node:fs/promises'
22
import { afterEach, describe, expect, it, vi } from 'vitest'
3-
import { findPackageJson, getPackageDependencies } from './package.js'
3+
import { findPackageJson, getPackageDependencies } from './package.ts'
44

55
vi.mock('node:fs/promises', () => {
66
return {

source/helpers/tsconfig.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// biome-ignore lint/style/noNamespaceImport: needed for mocking
22
import * as typescript from 'typescript'
33
import { afterEach, describe, expect, it, vi } from 'vitest'
4-
import { findOutDir } from './tsconfig.js'
4+
import { findOutDir } from './tsconfig.ts'
55

66
vi.mock('typescript', async () => {
77
const actual = await vi.importActual('typescript')

source/processor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import debug from 'debug'
22
import { access, constants, readFile, stat, writeFile } from 'node:fs/promises'
33
import { dirname, resolve } from 'pathe'
4-
import { extractImports } from './extractor.js'
5-
import type { Import, Mode } from './types.js'
4+
import { extractImports } from './extractor.ts'
5+
import type { Import, Mode } from './types.ts'
66

77
const log = debug('tsfix:fixer')
88

source/processor.unit.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { Stats } from 'node:fs'
33
import type fs from 'node:fs/promises'
44
import { access, readFile, stat, writeFile } from 'node:fs/promises'
55
import { afterEach, describe, expect, it, vi } from 'vitest'
6-
import { applyFixes, processFile } from './processor.js'
7-
import type { Import } from './types.js'
6+
import { applyFixes, processFile } from './processor.ts'
7+
import type { Import } from './types.ts'
88

99
vi.mock('node:fs/promises', async (importOriginal) => {
1010
const original = await importOriginal<typeof fs>()
@@ -28,7 +28,7 @@ describe('processFile', () => {
2828
const filePath = 'test.js'
2929
const sourceCode = 'import x from "./testFolder/x";'
3030
const dependencies = ['dependency1', 'dependency2']
31-
const fixedCode = 'import x from "./testFolder/x.js";'
31+
const fixedCode = 'import x from "./testFolder/x.ts";'
3232

3333
vi.mocked(readFile).mockResolvedValueOnce(sourceCode)
3434
vi.mocked(writeFile).mockResolvedValueOnce()
@@ -63,8 +63,8 @@ describe('applyFixes', () => {
6363
const result = await applyFixes(code, imports, dirPath)
6464

6565
expect(result).toBe(`
66-
import { foo } from './bar.js';
67-
import { baz } from '../qux.js';
66+
import { foo } from './bar.ts';
67+
import { baz } from '../qux.ts';
6868
`)
6969
})
7070

@@ -86,8 +86,8 @@ describe('applyFixes', () => {
8686
const result = await applyFixes(code, imports, dirPath)
8787

8888
expect(result).toBe(`
89-
import { foo } from './bar.js';
90-
import { baz } from '../qux.js';
89+
import { foo } from './bar.ts';
90+
import { baz } from '../qux.ts';
9191
`)
9292
})
9393

@@ -117,7 +117,7 @@ describe('applyFixes', () => {
117117

118118
expect(result).toBe(`
119119
import ts from 'typescript-eslint'
120-
import * as js from './js.js'
120+
import * as js from './js.ts'
121121
122122
const all: Linter.FlatConfig = Object.freeze({
123123
...js.configs.all,
@@ -154,8 +154,8 @@ describe('applyFixes', () => {
154154
const result = await applyFixes(code, imports, dirPath)
155155

156156
expect(result).toBe(`
157-
import foo from './foo/index.js';
158-
import bar from '../bar/index.js';
157+
import foo from './foo/index.ts';
158+
import bar from '../bar/index.ts';
159159
`)
160160
})
161161

@@ -175,7 +175,7 @@ describe('applyFixes', () => {
175175
const result = await applyFixes(code, imports, dirPath)
176176

177177
expect(result).toBe(`
178-
import { foo } from './bar/index.js';
178+
import { foo } from './bar/index.ts';
179179
`)
180180
})
181181

source/tsfix.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import debug from 'debug'
22
import glob from 'fast-glob'
33
import { performance } from 'node:perf_hooks'
4-
import { setupOptions } from './helpers/options.js'
5-
import { getPackageDependencies } from './helpers/package.js'
6-
import { processFile } from './processor.js'
7-
import type { Args } from './types.js'
4+
import { setupOptions } from './helpers/options.ts'
5+
import { getPackageDependencies } from './helpers/package.ts'
6+
import { processFile } from './processor.ts'
7+
import type { Args } from './types.ts'
88

99
const log = debug('tsfix:main')
1010

source/tsfix.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import glob from 'fast-glob'
33
import { Readable } from 'node:stream'
44
import { afterEach, describe, expect, it, vi } from 'vitest'
55
// biome-ignore lint/style/noNamespaceImport: needed for mocking
6-
import * as options from './helpers/options.js'
6+
import * as options from './helpers/options.ts'
77
// biome-ignore lint/style/noNamespaceImport: needed for mocking
8-
import * as pkg from './helpers/package.js'
8+
import * as pkg from './helpers/package.ts'
99
// biome-ignore lint/style/noNamespaceImport: needed for mocking
10-
import * as processor from './processor.js'
11-
import { tsFix } from './tsfix.js'
10+
import * as processor from './processor.ts'
11+
import { tsFix } from './tsfix.ts'
1212

1313
describe('tsFix', () => {
1414
afterEach(() => {

0 commit comments

Comments
 (0)