Skip to content

Commit

Permalink
chore: use ts config file for commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed May 29, 2024
1 parent 70d9d92 commit 6a99bec
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
27 changes: 0 additions & 27 deletions .commitlintrc.cjs

This file was deleted.

26 changes: 26 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { readdirSync, statSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'

const __dirname = dirname(fileURLToPath(import.meta.url))

const getSubDirectories = (dir: string): string[] =>
readdirSync(dir).filter((item) => statSync(join(dir, item)).isDirectory())

const pluginPackages = getSubDirectories(join(__dirname, 'plugins')).flatMap(
(category) => getSubDirectories(join(__dirname, 'plugins', category)),
)
const themePackages = getSubDirectories(join(__dirname, 'themes'))
const toolPackages = getSubDirectories(join(__dirname, 'tools'))

export default {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [
2,
'always',
['e2e', 'release', ...pluginPackages, ...themePackages, ...toolPackages],
],
'footer-max-line-length': [0],
},
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"themes/**/*",
"tools/**/*",
"scripts/**/*",
"commitlint.config.ts",
"vitest.config.ts"
],
"exclude": ["node_modules", ".temp", "lib", "dist"]
Expand Down

0 comments on commit 6a99bec

Please sign in to comment.