question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Types can't have dashes

See original GitHub issue

The header pattern here: https://github.com/conventional-changelog/conventional-changelog/blob/09b1a0a57bcee4628b4c0b20920079d055f34a70/packages/conventional-commits-parser/index.js#L9

…doesn’t allow for a type of new-feature, but seemingly otherwise things would have worked.

Not a huge deal but if you’d prefer dashes not be allowed in types, then perhaps an error should be thrown? alternatively, update the regex.

downstream: https://github.com/GoogleChrome/lighthouse/pull/3534

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Jack-Barrycommented, Jan 25, 2021

If anyone else hits this, I’m using the following to get this to play nice with the output from cz-emoji with the conventional flag set to true:

commitlint.config.js

const commitTypes = require('cz-emoji/lib/types.json')

module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [2, 'always', commitTypes.map((type) => type.name)],
  },
  parserPreset: {
    parserOpts: {
      headerPattern: /^((?:\w|-)*)(?:\((.*)\))?!?: (.*)$/,
      breakingHeaderPattern: /^((?:\w|-)*)(?:\((.*)\))?!: (.*)$/,
    },
  },
}

The trick is changing the first capture group in the regex from (\w*) (as found in parser-opts.js) to ((?:\w|-)*)

This approach could be stupid, I’m not sure. But it works 🤷

1reaction
stevemaocommented, Nov 9, 2017

@marionebl new-audit is not a valid types because it’s not a single word. I believe they just want to use sensible defaults. Point is it’d be really good we could print better error/warning in general 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Dashes Correctly - University of Houston-Victoria
This handout focuses on how to use dashes correctly. There are actually three different types of dashes: the em-dash, the en-dash, and the...
Read more >
How to type an em dash on a PC or Mac - Zapier
If you have a numeric keyboard, hold down the Alt key and type 0151 for an em dash or 0150 for an en...
Read more >
Dashes | Google developer documentation style guide
You can type the em dash character in various ways: HTML: —; macOS: Press Option+Shift+hyphen . Linux desktop environment: Enable the ...
Read more >
The Hyphen and the Dash - University of Sussex
The dash has only one use: a pair of dashes separates a strong interruption from the rest of the sentence. (A strong interruption...
Read more >
How to type a dash (— or –) instead of a hyphen(-)
On iOS, you can hold the - button and a sub-menu will appear which allows you to choose between different types of dashes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found