Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
},
overrides: [
{
files: ['*.ts'],
files: ['*.cts', '*.ts'],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/eslint-recommended',
Expand Down
4 changes: 4 additions & 0 deletions @commitlint/cz-commitlint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"version": "19.0.3",
"description": "Commitizen adapter using the commitlint.config.js",
"main": "./lib/index.js",
"exports": {
"import": "./lib/index.js",
"require": "./lib/index.cjs"
},
"files": [
"lib"
],
Expand Down
7 changes: 7 additions & 0 deletions @commitlint/cz-commitlint/src/index.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const esmPrompterPromise = import('./index.js');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to use typeof import('./index.js') but I found there was a TypeScript error (I believe it's a bug), but considering this, I'm thinking to use <packageDir>/index.cjs which is plain js instead.

Basically it should be await import('./lib/index.js')

@frantic1048 How do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's weird and I'm trying to use cjs to workaround this.

I was thinking to use typeof import('./index.js') but I found there was a TypeScript error


export const prompter: Awaited<typeof esmPrompterPromise>['prompter'] = async (
...args
) => {
(await esmPrompterPromise).prompter(...args);
};