folke / devmoji

:robot: :rocket: :sparkles: Emojify your conventional commits with Devmoji
https://www.npmjs.com/package/devmoji
Apache License 2.0
337 stars 21 forks source link

Adds TypeScript support for configuration file #219

Open AlvaroIsrael opened 1 year ago

AlvaroIsrael commented 1 year ago

Description

Hello, I love adding emojis to my commits and recently I found this repository to be a good tool to automate this process to me and also other devs of projects I work on. The thing is, I like TypeScript and have a tendency of not allowing any .js files in projects I work with. The fact this project only supported configuration file in .js format kind of bothered me a little, so I decided to add typescript support for the configuration file devmoji.config.ts. The PR is here: https://github.com/folke/devmoji/pull/220

Type of change

How Has This Been Tested?

I ran all the test suits with both yarn test and yarn test:cov and provided a new test to the new typescript configuration file.

image

(Also tried to improve coverage a bit by adding a test for a uncovered scenario config file does not exist).

Checklist:

AlvaroIsrael commented 1 year ago

Hello @folke, could you please take a look here when you can?

AlvaroIsrael commented 1 month ago

Hey @folke I am not giving up, I still want this to be evaluated and merged! Could you please take a look here?

ap0nia commented 2 days ago

If it's any help, I use JSDoc type-checking in my JS files which gets me the type-safety I'm looking for. It's not the same thing as explicit TS support, but it works well enough for me.

devmoji.config.js

// @ts-check

/**
 * @type import('devmoji/lib/config-options').ConfigOptions
 */
const config = {
  types: ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'build', 'ci'],
  devmoji: [
    {
      code: 'feat',
      description: 'a new feature',
      emoji: '🌠',
    },
    // ...
  ]
}
AlvaroIsrael commented 1 day ago

Thanks for the reply @ap0nia, but my main issue is with the file extension itself! My projects do not have any .js files but this one from devmoji, my main goal here is to have only .ts files in my src folder!

In theory my PR fixes/ provides that, but I can't merge, I need someone to approve and merge this!