Skip to content

Commit

Permalink
feat!: drop CJS build
Browse files Browse the repository at this point in the history
If you are still doing `require('@antfu/eslint-config')`, change your config name to end with `.mjs` and migrate to import.
  • Loading branch information
antfu committed Jan 25, 2025
1 parent e680a95 commit 216fa10
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
"eslint-config"
],
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
".": "./dist/index.js"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -25,11 +22,11 @@
"dist"
],
"scripts": {
"build": "nr typegen && tsup --format esm,cjs --clean --dts",
"stub": "tsup --format esm",
"build": "nr typegen && tsup --clean --dts",
"stub": "tsup",
"dev": "npx @eslint/config-inspector --config eslint.config.ts",
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
"watch": "tsup --format esm,cjs --watch",
"watch": "tsup --watch",
"lint": "eslint .",
"typegen": "tsx scripts/typegen.ts",
"prepack": "nr build",
Expand Down
8 changes: 0 additions & 8 deletions test/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ it('esm eslint.config.js', async () => {
expect(stdout).toContain('Created eslint.config.js')
})

it('cjs eslint.config.mjs', async () => {
const { stdout } = await run()

const eslintConfigContent = await fs.readFile(join(genPath, 'eslint.config.mjs'), 'utf-8')
expect(eslintConfigContent.includes('export default')).toBeTruthy()
expect(stdout).toContain('Created eslint.config.mjs')
})

it('ignores files added in eslint.config.js', async () => {
const { stdout } = await run()

Expand Down
1 change: 1 addition & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export default defineConfig({
'src/cli.ts',
],
shims: true,
format: ['esm'],
})

0 comments on commit 216fa10

Please # to comment.