Update getting-started.md
Use esm module in getting started section
Description
failure just after copypasting from setup section
npx commitlint --last --verbose
export default { extends: ['@commitlint/config-conventional'] };
^^^^^^
SyntaxError: Unexpected token 'export'
just use .mjs format to let node.js use esm
Motivation and Context
Usage examples
// commitlint.config.js
module.exports = {};
echo "your commit message here" |Â commitlint # fails/passes
How Has This Been Tested?
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Which node version are you using? Can't reproduce this with v18/20
Closing because of missing feedback. Please re-open if wanted.
I'm seeing this exact issue with node v20.11.1, after following the installation instructions. I think it's worth reopening.
❯ cat commitlint.config.js
export default { extends: ['@commitlint/config-conventional'] };
❯ npx commitlint --print-config
(node:9825) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/matthew/Code/probcomp/GenSQL.query/commitlint.config.js:1
export default { extends: ['@commitlint/config-conventional'] };
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at module.exports (/Users/matthew/Code/probcomp/GenSQL.query/node_modules/import-fresh/index.js:32:59)
at loadJsSync (/Users/matthew/Code/probcomp/GenSQL.query/node_modules/cosmiconfig/dist/loaders.js:17:12)
at loadJs (/Users/matthew/Code/probcomp/GenSQL.query/node_modules/cosmiconfig/dist/loaders.js:27:43) {
filepath: '/Users/matthew/Code/probcomp/GenSQL.query/commitlint.config.js'
}
Node.js v20.11.1
I can confirm that changing the suffix from .js to .mjs fixes it for now.
Thanks for your feedback. Can reproduce this now as well.
Wondering why this worked before.
There might be an underlying issue that should be fixed instead of the docs.