Skip to content

Commit 5bc52ea

Browse files
committed
build: set esModuleInterop to true to fix @commitlint/types import
This issue appeared after lock file maintenance, and is visible when building after recreating `package-lock.json`. ``` node_modules/@commitlint/types/lib/format.d.ts:1:8 - error TS1259: Module '"/home/jdebruijn/projects/commitlint-plugin-function-rules/node_modules/chalk/index"' can only be default-imported using the 'esModuleInterop' flag 1 import chalk from 'chalk'; ~~~~~ node_modules/chalk/index.d.ts:415:1 415 export = chalk; ~~~~~~~~~~~~~~~ This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. Found 1 error. ```
1 parent 6e97095 commit 5bc52ea

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: src/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import rules from './rules';
44

55
describe('commitlint plugin function rules', () => {
66
it(`exports a CommonJS module with 'rules' object`, () => {
7-
expect(Object.keys(plugin)).toEqual(['rules']);
7+
expect(plugin.rules).not.toBeUndefined();
88
expect(typeof plugin.rules).toEqual('object');
99
});
1010

Diff for: tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true,
4+
"esModuleInterop": true,
45
"module": "CommonJS",
56
"moduleResolution": "node",
67
"outDir": "dist",

0 commit comments

Comments
 (0)