Skip to content

Commit 6ad86ca

Browse files
azuclaude
andcommitted
feat: Biomeを導入してPrettierを置き換え
- @biomejs/biome v2.0.6を追加 - Prettierを削除してBiomeでフォーマットとリントを統合 - lint-stagedとpre-commitフックを更新 - コードスタイル設定(4スペース、120文字、ダブルクォート)を維持 - フォーマットとリントのパフォーマンスを向上 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7298ec0 commit 6ad86ca

12 files changed

+263
-72
lines changed

.githooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
npx --no-install lint-staged
2+
npx lint-staged

.textlintrc.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"plugins": {},
3-
"filters": {},
4-
"rules": {
5-
"preset-japanese": true
6-
}
7-
}
2+
"plugins": {},
3+
"filters": {},
4+
"rules": {
5+
"preset-japanese": true
6+
}
7+
}

biome.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
3+
"files": {
4+
"ignoreUnknown": false,
5+
"includes": ["src/**/*", "test/**/*", "*.js", "*.ts", "*.json"]
6+
},
7+
"formatter": {
8+
"enabled": true,
9+
"formatWithErrors": false,
10+
"indentStyle": "space",
11+
"indentWidth": 4,
12+
"lineWidth": 120,
13+
"lineEnding": "lf"
14+
},
15+
"linter": {
16+
"enabled": true,
17+
"rules": {
18+
"recommended": true
19+
}
20+
},
21+
"javascript": {
22+
"formatter": {
23+
"quoteStyle": "double",
24+
"semicolons": "always",
25+
"trailingCommas": "none"
26+
}
27+
},
28+
"json": {
29+
"formatter": {
30+
"enabled": true
31+
}
32+
}
33+
}

package-lock.json

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

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
],
3333
"scripts": {
3434
"build": "textlint-scripts build",
35-
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
35+
"format": "biome check --write ./",
36+
"lint": "biome check ./",
3637
"prepare": "git config --local core.hooksPath .githooks",
3738
"prepublishOnly": "npm run build",
3839
"test": "npm run test:unit && npm run lint:text && npm run lint:README",
@@ -43,7 +44,7 @@
4344
},
4445
"lint-staged": {
4546
"*.{js,jsx,ts,tsx,css}": [
46-
"prettier --write"
47+
"biome format --write --no-errors-on-unmatched"
4748
]
4849
},
4950
"prettier": {
@@ -53,10 +54,11 @@
5354
"trailingComma": "none"
5455
},
5556
"devDependencies": {
57+
"@biomejs/biome": "^2.0.6",
5658
"@textlint/types": "^14.8.4",
5759
"@types/node": "^24.0.1",
60+
"husky": "^9.1.7",
5861
"lint-staged": "^16.1.2",
59-
"prettier": "^3.5.3",
6062
"textlint": "^14.8.4",
6163
"textlint-rule-preset-japanese": "^10.0.4",
6264
"textlint-scripts": "^14.8.4",

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import noAiListFormatting from "./rules/no-ai-list-formatting";
2-
import noAiHypeExpressions from "./rules/no-ai-hype-expressions";
3-
import noAiEmphasisPatterns from "./rules/no-ai-emphasis-patterns";
41
import aiTechWritingGuideline from "./rules/ai-tech-writing-guideline";
52
import noAiColonContinuation from "./rules/no-ai-colon-continuation";
3+
import noAiEmphasisPatterns from "./rules/no-ai-emphasis-patterns";
4+
import noAiHypeExpressions from "./rules/no-ai-hype-expressions";
5+
import noAiListFormatting from "./rules/no-ai-list-formatting";
66

77
const preset = {
88
rules: {

src/rules/ai-tech-writing-guideline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { TextlintRuleModule } from "@textlint/types";
21
import { matchPatterns } from "@textlint/regexp-string-matcher";
2+
import type { TextlintRuleModule } from "@textlint/types";
33
import { StringSource } from "textlint-util-to-string";
44

55
/**

src/rules/no-ai-colon-continuation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { matchPatterns } from "@textlint/regexp-string-matcher";
2-
import { StringSource } from "textlint-util-to-string";
32
import { tokenize } from "kuromojin";
3+
import { StringSource } from "textlint-util-to-string";
44

55
/**
66
* コロンの直後にブロック要素が続くパターンを検出するルール

src/rules/no-ai-emphasis-patterns.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { TextlintRuleModule } from "@textlint/types";
21
import { matchPatterns } from "@textlint/regexp-string-matcher";
2+
import type { TextlintRuleModule } from "@textlint/types";
33

44
export interface Options {
55
// 指定したパターンにマッチする場合、エラーを報告しません
@@ -56,7 +56,7 @@ const rule: TextlintRuleModule<Options> = (context, options = {}) => {
5656
return;
5757
}
5858

59-
let emojiEmphasizeMatches: RegExpExecArray[] = [];
59+
const emojiEmphasizeMatches: RegExpExecArray[] = [];
6060

6161
// 絵文字 + 太字の組み合わせパターンを検出
6262
if (!disableEmojiEmphasisPatterns) {
@@ -125,7 +125,7 @@ const rule: TextlintRuleModule<Options> = (context, options = {}) => {
125125
}
126126
}
127127

128-
let emojiEmphasizeMatches: RegExpExecArray[] = [];
128+
const emojiEmphasizeMatches: RegExpExecArray[] = [];
129129

130130
// リストアイテム内での絵文字 + 太字パターンを検出
131131
if (!disableEmojiEmphasisPatterns) {

src/rules/no-ai-hype-expressions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { TextlintRuleModule } from "@textlint/types";
21
import { matchPatterns } from "@textlint/regexp-string-matcher";
2+
import type { TextlintRuleModule } from "@textlint/types";
33

44
export interface Options {
55
// If node's text includes allowed patterns, does not report.

src/rules/no-ai-list-formatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { TextlintRuleModule } from "@textlint/types";
21
import { matchPatterns } from "@textlint/regexp-string-matcher";
2+
import type { TextlintRuleModule } from "@textlint/types";
33

44
export interface Options {
55
// If node's text includes allowed patterns, does not report.

0 commit comments

Comments
 (0)