devmoji icon indicating copy to clipboard operation
devmoji copied to clipboard

Question about emoji linting

Open Axedyson opened this issue 4 years ago • 1 comments

Is there any way or do you know some tool that can lint commits to ensure that they have emojis in them? I know commitlint exist and that you can implement that in a CI environment, but is there something that can validate not just conventional commits but with emojis placed between type(scope): and the description...?

Axedyson avatar Aug 24 '21 14:08 Axedyson

Dug in a little more and see the CLI is linting with the regex here:

https://github.com/folke/devmoji/blob/master/src/cli.ts#L27

It can be modified slightly to check for the emoji:

^(?<type>:?[a-z-]+)(?:\((?<scope>[a-z-0-9]+)\))?(!?):\s+(📦️|✨)(?<description>.*)

Suppose the emoji could be included in a file as an allowed list and run in a separate check using the unicode points. That's what I'd do anyway. But I haven't looked into it that deeply.

For the morbidly curious I saw there's a proposal for tc39 to update regex in JS to check for an emojis. And here's a related library which might be of interest if updating the regex.

vhscom avatar Jan 23 '22 18:01 vhscom