Skip to content

Commit 6222aca

Browse files
committed
build: migrate commitlint config file to ts
1 parent 1fd3aa7 commit 6222aca

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
const fs = require('fs')
2-
const path = require('path')
1+
import * as fs from 'node:fs'
2+
import * as path from 'node:path'
3+
import type { UserConfig } from '@commitlint/types'
34

4-
const getSubDirectories = (dir) =>
5+
const getSubDirectories = (dir: string): string[] =>
56
fs
67
.readdirSync(dir)
78
.filter((item) => fs.statSync(path.join(dir, item)).isDirectory())
89
const packages = getSubDirectories(path.resolve(__dirname, 'packages'))
910

10-
module.exports = {
11+
export default {
1112
extends: ['@commitlint/config-conventional'],
1213
rules: {
1314
'scope-enum': [2, 'always', packages],
1415
'footer-max-line-length': [0],
1516
},
16-
}
17+
} satisfies UserConfig

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"devDependencies": {
3333
"@commitlint/cli": "^19.2.1",
3434
"@commitlint/config-conventional": "^19.1.0",
35+
"@commitlint/types": "^19.0.3",
3536
"@types/node": "^20.11.30",
3637
"@types/webpack-env": "^1.18.4",
3738
"@vitest/coverage-istanbul": "^1.4.0",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"**/.vuepress/**/*",
1515
"e2e/**/*",
1616
"packages/**/*",
17+
"commitlint.config.ts",
1718
"vitest.config.ts"
1819
],
1920
"exclude": ["node_modules", ".temp", "lib", "dist"]

0 commit comments

Comments
 (0)