Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use commitlint #194

Open
tukusejssirs opened this issue Dec 15, 2022 · 2 comments
Open

Use commitlint #194

tukusejssirs opened this issue Dec 15, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request infrastructure Anything related to the surrounding tools and infrastructure

Comments

@tukusejssirs
Copy link
Contributor

I believe that using commitlint is a nice tool to create short, descriptive commit messages. Moreover, we could later create (release) changelogs from them, once we learn to follow the rules.

@tukusejssirs tukusejssirs added this to the Backlog milestone Dec 15, 2022
@bburns bburns assigned bburns and unassigned bburns, tukusejssirs and MRIIOT Dec 16, 2022
@MRIIOT
Copy link
Contributor

MRIIOT commented Dec 17, 2022

Dev behavior change. Use it and close the task.

@tukusejssirs
Copy link
Contributor Author

This my commitlint.config.json in my other project. Again, we can discuss individual configs; nothing is built into stone.

commitlint.config.json
const {readdirSync} = require('fs')

module.exports = {
   extends: ['@commitlint/config-conventional'],
   formatter: '@commitlint/format',
   // TODO: Change this URL to our Wiki page with the description of the commit message format.
   helpUrl: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
   parserPreset: {
      parserOpts: {
         issuePrefixes: ['#']
      }
   },
   rules: {
      'body-case': [2, 'always', 'sentence-case'],
      'body-empty': [0, 'never'],
      'body-full-stop': [2, 'always', '.'],
      'body-leading-blank': [2, 'always'],
      'body-max-line-length': [0, 'never', 0],
      'footer-empty': [0, 'never'],
      'footer-leading-blank': [2, 'always'],
      'footer-max-line-length': [0, 'never', 0],
      'header-full-stop': [2, 'never', '.'],
      'header-max-length': [0, 'never', 0],
      'scope-enum': async () => {
         const apps = readdirSync('apps', {withFileTypes: true})
            .filter(dirent => dirent.isDirectory())
            .map(dirent => dirent.name)
         const libs = readdirSync('libs', {withFileTypes: true})
            .filter(dirent => dirent.isDirectory())
            .map(dirent => dirent.name)
         let allowedScopes = [];

         [...apps, ...libs].forEach(a => {
            const modules = readdirSync(`${apps.indexOf(a) > -1 ? 'apps' : 'libs'}/${a}/src`, {withFileTypes: true})
               .filter(dirent => dirent.isDirectory())
               .map(dirent => dirent.name)

            allowedScopes.push(a)
         })

         return [2, 'always', [...allowedScopes]]
      },
      'subject-case': [1, 'always', 'lower-case'],
      'subject-empty': [2, 'never'],
      'subject-full-stop': [2, 'never', '.'],
      'type-case': [2, 'always', 'lower-case'],
      'type-empty': [2, 'never'],
      'type-enum': [
         2,
         'always',
         [
            'build',
            'chore',
            'ci',
            'docs',
            'feat',
            'fix',
            'perf',
            'refactor',
            'revert',
            'style',
            'test'
         ]
      ]
   }
}

@tukusejssirs tukusejssirs removed this from the Backlog milestone Dec 17, 2022
@tukusejssirs tukusejssirs added infrastructure Anything related to the surrounding tools and infrastructure enhancement New feature or request labels Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request infrastructure Anything related to the surrounding tools and infrastructure
Projects
None yet
Development

No branches or pull requests

3 participants