TypeError: format is not a function
See original GitHub issueExpected Behavior
I’m trying to commit in a new repository that uses husky and my commit should work and pass husky checks as expected.
Current Behavior
When I try to commit, I see the following:
husky > commit-msg (node v10.3.0)
/Users/mprzybylski/Work/Livongo/fe-utils/node_modules/@commitlint/cli/lib/cli.js:113
throw err;
^
TypeError: format is not a function
at /Users/mprzybylski/Work/Livongo/fe-utils/node_modules/@commitlint/cli/lib/cli.js:193:18
at run (/Users/mprzybylski/Work/Livongo/fe-utils/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:75:22)
at /Users/mprzybylski/Work/Livongo/fe-utils/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:92:30
at flush (/Users/mprzybylski/Work/Livongo/fe-utils/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9)
at process._tickCallback (internal/process/next_tick.js:61:11)
husky > commit-msg hook failed (add --no-verify to bypass)
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
I’m not sure, and the odd thing is this works in my pre-existing repos, but it fails in this new one.
Steps to Reproduce (for bugs)
- Make changes to files.
- Commit changes. Error.
I’ve created a small repo that reproduces the problem here: https://github.com/reintroducing/commit-test
commitlint.config.js
```js module.exports = { extends: ['@spothero/commitlint-config'] }; ```Context
I can’t commit to the new repo unless i bypass husky checks. I’m using a custom commitlint config which can be found here: https://github.com/spothero/commitlint-config
Your Environment
Executable | Version |
---|---|
commitlint --version |
7.5.2 |
git --version |
2.20.1 (Apple Git-117) |
node --version |
10.3.0 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:23 (5 by maintainers)
Top Results From Across the Web
TypeError: format is not a function in date-fns - Stack Overflow
TypeError : format is not a function. I have tried import, require but they all give same error. var format = require('date-fns/format') ...
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >TypeError _(...).format is not a function in raspberry pi 3b+
TypeError _(...).format is not a function ... This topic was automatically closed 10 days after the last reply. New replies are no longer...
Read more >client-side validation method: (intermediate value).format is ...
... same formatting function outside of this onChange listener function. ... error TypeError: (intermediate value).format is not a function.
Read more >TypeError: not all arguments converted during string formatting
In Python, a TypeError is encountered when you perform an operation or use a function on an object of the incorrect type. You...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m importing from
@commitlint/format
and I have the same problem.The docs for @commitlint/format are no longer correct.
Test code for
@commitlint/format
:Result: 7.5.0
Result: 7.6.0
Test code for
@commitlint/core
:Result: 7.5.0
Result: 7.6.0
To me this is actually a breaking change for
@commitlint/format
and@commitlint/core
since the API has changed in a non-backwards compatible way.Is this intentional and going forward we should import from
require('@commitlint/format').default
?this is unrelated, as babel is not used to compile code anymore
in theory yes, but this is really bad idea, as code is going to be way slower (due to transforms)
personally i will recommend adding non default export to load like it has been done to format, and let ppl import as