Skip to content

Commit 6f03d6e

Browse files
frankieyanclaude
andauthored
refactor: switch from .mts to .ts file extensions (#56)
Since the project uses ESM via "type": "module" in package.json, the explicit .mts extension is redundant. This simplifies the developer experience with standard .ts extensions and improves tooling compatibility. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d04c3cd commit 6f03d6e

15 files changed

Lines changed: 18 additions & 18 deletions

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "2.3.1",
44
"description": "A React Compiler violation tracker to help migrations and prevent regressions",
55
"type": "module",
6-
"main": "dist/index.mjs",
6+
"main": "dist/index.js",
77
"bin": {
8-
"react-compiler-tracker": "dist/index.mjs"
8+
"react-compiler-tracker": "dist/index.js"
99
},
1010
"scripts": {
1111
"check": "run-p check:* -c -l",
@@ -44,7 +44,7 @@
4444
"CHANGELOG.md"
4545
],
4646
"lint-staged": {
47-
"*.{js,ts,mjs,mts,json,md}": "biome check --write --no-errors-on-unmatched"
47+
"*.{js,ts,json,md}": "biome check --write --no-errors-on-unmatched"
4848
},
4949
"devDependencies": {
5050
"rimraf": "6.1.2",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest'
2-
import { parseArgs } from './args.mjs'
2+
import { parseArgs } from './args.js'
33

44
describe('parseArgs', () => {
55
it('parses --check-files with files', () => {
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync, readFileSync } from 'node:fs'
22
import { afterEach, describe, expect, it, vi } from 'vitest'
3-
import { DEFAULT_CONFIG, loadConfig } from './config.mjs'
3+
import { DEFAULT_CONFIG, loadConfig } from './config.js'
44

55
vi.mock('node:fs', () => ({
66
existsSync: vi.fn(),
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const recordsPath = join(fixtureDir, '.react-compiler.rec.json')
1010
const configPath = join(fixtureDir, '.react-compiler-tracker.config.json')
1111

1212
function runCLI(args: string[] = [], cwd = fixtureDir): string {
13-
const cliPath = join(__dirname, 'index.mts')
13+
const cliPath = join(__dirname, 'index.ts')
1414
try {
1515
return execSync(`npx tsx ${cliPath} ${args.join(' ')} 2>&1`, {
1616
cwd,

src/index.mts renamed to src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import { join, relative } from 'node:path'
44
import type { Logger as ReactCompilerLogger } from 'babel-plugin-react-compiler'
5-
import { parseArgs } from './args.mjs'
6-
import * as babel from './babel.mjs'
7-
import { loadConfig } from './config.mjs'
8-
import type { FileErrors } from './records-file.mjs'
9-
import * as recordsFile from './records-file.mjs'
10-
import * as sourceFiles from './source-files.mjs'
11-
import { pluralize } from './utils.mjs'
5+
import { parseArgs } from './args.js'
6+
import * as babel from './babel.js'
7+
import { loadConfig } from './config.js'
8+
import type { FileErrors } from './records-file.js'
9+
import * as recordsFile from './records-file.js'
10+
import * as sourceFiles from './source-files.js'
11+
import { pluralize } from './utils.js'
1212

1313
const compilerErrors: Map<string, FileErrors> = new Map()
1414

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { afterEach, describe, expect, it, vi } from 'vitest'
2-
import { getErrorChanges, load, save } from './records-file.mjs'
2+
import { getErrorChanges, load, save } from './records-file.js'
33

44
vi.mock('node:fs', () => ({
55
existsSync: vi.fn(),
66
readFileSync: vi.fn(),
77
writeFileSync: vi.fn(),
88
}))
99

10-
vi.mock('./react-compiler.mjs', () => ({
10+
vi.mock('./react-compiler.js', () => ({
1111
getVersion: vi.fn(() => '1.0.0'),
1212
}))
1313

0 commit comments

Comments
 (0)