Skip to content

Commit c8a5e22

Browse files
committed
tsup: fix lint issue
1 parent 33afb78 commit c8a5e22

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

tsup.config.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,27 @@ interface Result {
1313
js?: string
1414
}
1515

16-
function generateLicense(): string {
17-
const packInfo = JSON.parse(readFileSync('package.json').toString())
18-
return `/**\n * ${packInfo.name} v${packInfo.version}\n * Copyright (c) 2024 Ram Amoncar <ramamonkar444@gmail.com>\n * @license ${packInfo.license}\n */`
16+
interface PackageJson {
17+
name?: string
18+
version?: string
19+
license?: string
20+
[key: string]: unknown // Allow other fields
1921
}
2022

21-
const license = generateLicense()
22-
2323
function outputExtensions(ctx: Context): Result {
2424
if (ctx.format === 'cjs') return { js: '.js' }
2525
if (ctx.format === 'esm') return { js: '.mjs' }
2626
return { js: '.min.js' }
2727
}
2828

29+
function generateLicense(): string {
30+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- JSON.parse output is assumed to match PackageJson structure based on known package.json format */
31+
const packInfo = JSON.parse(readFileSync('package.json').toString()) as PackageJson
32+
return `/**\n * ${packInfo.name} v${packInfo.version}\n * Copyright (c) 2024 Ram Amoncar <ramamonkar444@gmail.com>\n * @license ${packInfo.license}\n */`
33+
}
34+
35+
const license = generateLicense()
36+
2937
export default defineConfig({
3038
splitting: false,
3139
entry: ['src/index.ts'],

0 commit comments

Comments
 (0)