-
Notifications
You must be signed in to change notification settings - Fork 950
Closed
sourcefuse/react-boilerplate-ts-ui
#35Description
Expected Behavior
commitlint should lint commit messages without errors.
Current Behavior
In a project whose package.json is configured as "type": "module", conventional-changelog/commitlint produces the following error:
(node:27380) Warning: require() of ES modules is not supported.
require() of [FULL PATH REDACTED]/commitlint-esm-bug-repro/commitlint.config.js from
[FULL PATH REDACTED]/commitlint-esm-bug-repro/node_modules/cosmiconfig/node_modules/import-fresh/index.js
is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which
defines all .js files in that package scope as ES modules.
Instead rename commitlint.config.js to end in .cjs, change the requiring code to use import(), or remove
"type": "module" from [FULL PATH REDACTED]/commitlint-esm-bug-repro/package.json.
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
This seems related to how the underlying cosmiconfig package is loading the commitlint configuration.
Steps to Reproduce (for bugs)
Reproduction repository: https://github.com/danielway/commitlint-esm-bug-repro
- Clone and install the above repository
- Create some file, add to git, and commit the change
- Observe the error listed above
Your Environment
Commitlint: 8.3.5
Node: 12.14.1, 13.1.0, and 13.7.0 all exhibit this behavior
mightyiam, Marcosaurios, patjacobs-magic, ali-hasani-clp and BreadGenie
Metadata
Metadata
Assignees
Labels
No labels