GithubHelp home page GithubHelp logo

Use `commitlint` about ladder99 HOT 2 OPEN

ladder99 avatar ladder99 commented on June 16, 2024
Use `commitlint`

from ladder99.

Comments (2)

MRIIOT avatar MRIIOT commented on June 16, 2024

Dev behavior change. Use it and close the task.

from ladder99.

tukusejssirs avatar tukusejssirs commented on June 16, 2024

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'
         ]
      ]
   }
}

from ladder99.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.