Skip to content

Commit 29adc1d

Browse files
committed
chore(lint-staged): convert configs to ts
This migrates lint-staged and commitlint configurations to TypeScript and updates Biome include patterns. The changes improve type safety and ensure Biome checks the config files while keeping the ignored path behavior consistent.
1 parent 2754554 commit 29adc1d

4 files changed

Lines changed: 28 additions & 22 deletions

File tree

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
33
"files": {
4-
"includes": ["**/*.ts", "**/*.js", "**/*.json", "!.pi"]
4+
"includes": ["**/*.ts", "**/*.js", "**/*.json", "*.config.ts", "!.pi"]
55
},
66
"linter": {
77
"enabled": true,
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
export default {
1+
import type { UserConfig } from '@commitlint/types';
2+
3+
const config: UserConfig = {
24
extends: ['@commitlint/config-conventional'],
35
rules: {
46
// Allow longer body lines (e.g. full sentences) without manual wrapping.
57
'body-max-line-length': [0],
68
},
79
};
10+
11+
export default config;

lint-staged.config.mjs

Lines changed: 0 additions & 20 deletions
This file was deleted.

lint-staged.config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/** Path segments Biome ignores (see biome.json files.includes). */
2+
const BIOME_IGNORED_SEGMENTS = new Set(['.pi']);
3+
4+
function isBiomeIgnoredPath(filePath: string): boolean {
5+
return filePath
6+
.replace(/\\/g, '/')
7+
.split('/')
8+
.some((segment) => BIOME_IGNORED_SEGMENTS.has(segment));
9+
}
10+
11+
const config = {
12+
'*.{ts,js,json}': (files: readonly string[]) => {
13+
const toLint = files.filter((f) => !isBiomeIgnoredPath(f));
14+
if (toLint.length === 0) return [];
15+
return `biome check --write ${toLint.join(' ')}`;
16+
},
17+
'*.{js,ts,json,md,yaml,yml,toml,css,html}': (files: readonly string[]) => {
18+
return `secretlint ${files.join(' ')}`;
19+
},
20+
};
21+
22+
export default config;

0 commit comments

Comments
 (0)