Skip to content

Commit 49fbf05

Browse files
azuclaude
andcommitted
feat: Biome.jsによるコードフォーマットとリント環境を追加
- Biome.jsの設定ファイル(biome.json)を追加 - lint-stagedとhuskyによるpre-commitフックを設定 - 既存のコードをBiomeでフォーマット - package.jsonにlintとformatスクリプトを追加 Biome.jsを採用した理由: - ESLintとPrettierの機能を統合した高速なツール - 設定がシンプルで保守しやすい - Rustで実装されており処理が高速 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3af79b5 commit 49fbf05

File tree

7 files changed

+952
-142
lines changed

7 files changed

+952
-142
lines changed

.githooks/pre-commit

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

biome.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "space",
14+
"indentWidth": 2,
15+
"lineEnding": "lf",
16+
"lineWidth": 120,
17+
"attributePosition": "auto"
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true,
23+
"suspicious": {
24+
"noDebugger": "error",
25+
"noConsole": "warn"
26+
},
27+
"correctness": {
28+
"noUnusedVariables": "error"
29+
},
30+
"style": {
31+
"noNonNullAssertion": "warn",
32+
"useConst": "error"
33+
}
34+
}
35+
},
36+
"javascript": {
37+
"formatter": {
38+
"quoteStyle": "double",
39+
"semicolons": "always",
40+
"trailingCommas": "es5",
41+
"arrowParentheses": "always"
42+
}
43+
}
44+
}
Lines changed: 125 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,130 @@
1-
"use strict";
21
const { moduleInterop } = require("@textlint/module-interop");
32
const jtfRules = moduleInterop(require("textlint-rule-preset-jtf-style")).rules;
43
module.exports = {
5-
rules: {
6-
"sentence-length": moduleInterop(require("textlint-rule-sentence-length")),
7-
"max-comma": moduleInterop(require("textlint-rule-max-comma")),
8-
"max-ten": moduleInterop(require("textlint-rule-max-ten")),
9-
"max-kanji-continuous-len": moduleInterop(require("textlint-rule-max-kanji-continuous-len")),
10-
"no-mix-dearu-desumasu": moduleInterop(require("textlint-rule-no-mix-dearu-desumasu")),
11-
"ja-no-mixed-period": moduleInterop(require("textlint-rule-ja-no-mixed-period")),
12-
"arabic-kanji-numbers": jtfRules["2.2.2.算用数字と漢数字の使い分け"],
13-
"no-doubled-conjunction": moduleInterop(require("textlint-rule-no-doubled-conjunction")),
14-
"no-doubled-conjunctive-particle-ga": moduleInterop(require("textlint-rule-no-doubled-conjunctive-particle-ga")),
15-
"no-double-negative-ja": moduleInterop(require("textlint-rule-no-double-negative-ja")),
16-
"no-doubled-joshi": moduleInterop(require("textlint-rule-no-doubled-joshi")),
17-
"no-dropping-the-ra": moduleInterop(require("textlint-rule-no-dropping-the-ra")),
18-
"no-nfd": moduleInterop(require("textlint-rule-no-nfd")),
19-
"no-exclamation-question-mark": moduleInterop(require("textlint-rule-no-exclamation-question-mark")),
20-
"no-hankaku-kana": moduleInterop(require("textlint-rule-no-hankaku-kana")),
21-
"no-invalid-control-character": moduleInterop(require("@textlint-rule/textlint-rule-no-invalid-control-character")),
22-
"ja-no-weak-phrase": moduleInterop(require("textlint-rule-ja-no-weak-phrase")),
23-
"ja-no-successive-word": moduleInterop(require("textlint-rule-ja-no-successive-word")),
24-
"ja-no-abusage": moduleInterop(require("textlint-rule-ja-no-abusage")),
25-
"ja-no-redundant-expression": moduleInterop(require("textlint-rule-ja-no-redundant-expression")),
26-
"ja-unnatural-alphabet": moduleInterop(require("textlint-rule-ja-unnatural-alphabet")),
27-
"no-unmatched-pair": moduleInterop(require("@textlint-rule/textlint-rule-no-unmatched-pair")),
28-
"no-zero-width-spaces": moduleInterop(require("textlint-rule-no-zero-width-spaces"))
4+
rules: {
5+
"sentence-length": moduleInterop(require("textlint-rule-sentence-length")),
6+
"max-comma": moduleInterop(require("textlint-rule-max-comma")),
7+
"max-ten": moduleInterop(require("textlint-rule-max-ten")),
8+
"max-kanji-continuous-len": moduleInterop(require("textlint-rule-max-kanji-continuous-len")),
9+
"no-mix-dearu-desumasu": moduleInterop(require("textlint-rule-no-mix-dearu-desumasu")),
10+
"ja-no-mixed-period": moduleInterop(require("textlint-rule-ja-no-mixed-period")),
11+
"arabic-kanji-numbers": jtfRules["2.2.2.算用数字と漢数字の使い分け"],
12+
"no-doubled-conjunction": moduleInterop(require("textlint-rule-no-doubled-conjunction")),
13+
"no-doubled-conjunctive-particle-ga": moduleInterop(require("textlint-rule-no-doubled-conjunctive-particle-ga")),
14+
"no-double-negative-ja": moduleInterop(require("textlint-rule-no-double-negative-ja")),
15+
"no-doubled-joshi": moduleInterop(require("textlint-rule-no-doubled-joshi")),
16+
"no-dropping-the-ra": moduleInterop(require("textlint-rule-no-dropping-the-ra")),
17+
"no-nfd": moduleInterop(require("textlint-rule-no-nfd")),
18+
"no-exclamation-question-mark": moduleInterop(require("textlint-rule-no-exclamation-question-mark")),
19+
"no-hankaku-kana": moduleInterop(require("textlint-rule-no-hankaku-kana")),
20+
"no-invalid-control-character": moduleInterop(require("@textlint-rule/textlint-rule-no-invalid-control-character")),
21+
"ja-no-weak-phrase": moduleInterop(require("textlint-rule-ja-no-weak-phrase")),
22+
"ja-no-successive-word": moduleInterop(require("textlint-rule-ja-no-successive-word")),
23+
"ja-no-abusage": moduleInterop(require("textlint-rule-ja-no-abusage")),
24+
"ja-no-redundant-expression": moduleInterop(require("textlint-rule-ja-no-redundant-expression")),
25+
"ja-unnatural-alphabet": moduleInterop(require("textlint-rule-ja-unnatural-alphabet")),
26+
"no-unmatched-pair": moduleInterop(require("@textlint-rule/textlint-rule-no-unmatched-pair")),
27+
"no-zero-width-spaces": moduleInterop(require("textlint-rule-no-zero-width-spaces")),
28+
},
29+
rulesConfig: {
30+
// # 1文の長さは100文字以下とする
31+
// https://github.com/textlint-rule/textlint-rule-sentence-length
32+
"sentence-length": {
33+
max: 100,
2934
},
30-
rulesConfig: {
31-
// # 1文の長さは100文字以下とする
32-
// https://github.com/textlint-rule/textlint-rule-sentence-length
33-
"sentence-length": {
34-
max: 100
35-
},
36-
// # コンマは1文中に3つまで
37-
// https://github.com/textlint-rule/textlint-rule-max-comma
38-
"max-comma": {
39-
max: 3
40-
},
41-
// # 読点は1文中に3つまで
42-
// https://github.com/textlint-ja/textlint-rule-max-ten
43-
"max-ten": {
44-
max: 3
45-
},
46-
// # 連続できる最大の漢字長は6文字まで
47-
// 漢字が連続していると読みにくさにつながります。
48-
// https://github.com/textlint-ja/textlint-rule-max-kanji-continuous-len
49-
"max-kanji-continuous-len": {
50-
max: 6
51-
},
52-
// # 漢数字と算用数字を使い分けます
53-
// 数量を表現し、数を数えられるものは算用数字を使用します。
54-
// 任意の数に置き換えても通用する語句がこれに該当します。
55-
// 序数詞(「第~回」「~番目」「~回目」)も算用数字を使います。
56-
// 慣用的表現、熟語、概数、固有名詞、副詞など、漢数字を使用することが一般的な語句では漢数字を使います。
57-
// https://github.com/textlint-ja/textlint-rule-preset-JTF-style
58-
// https://www.jtf.jp/jp/style_guide/styleguide_top.html
59-
"arabic-kanji-numbers": true,
60-
// # 「ですます調」、「である調」を統一します
61-
// 見出しは自動
62-
// 本文はですます調
63-
// 箇条書きはである調
64-
// https://github.com/textlint-ja/textlint-rule-no-mix-dearu-desumasu
65-
"no-mix-dearu-desumasu": {
66-
"preferInHeader": "",
67-
"preferInBody": "ですます",
68-
"preferInList": "である",
69-
"strict": false
70-
},
71-
// # 文末の句点記号として「。」を使います
72-
// https://github.com/textlint-ja/textlint-rule-ja-no-mixed-period
73-
"ja-no-mixed-period": {
74-
"periodMark": "。"
75-
},
76-
// # 二重否定は使用しない
77-
// https://github.com/textlint-ja/textlint-rule-no-double-negative-ja
78-
"no-double-negative-ja": true,
79-
// # ら抜き言葉を使用しない
80-
// https://github.com/textlint-ja/textlint-rule-no-dropping-the-ra
81-
"no-dropping-the-ra": true,
82-
// # 逆接の接続助詞「が」を連続して使用しない
83-
// 逆接の接続助詞「が」は、特に否定の意味ではなくても安易に使われてしまいがちです。
84-
// 同一文中に複数回出現していないかどうかをチェックします。
85-
// https://github.com/textlint-ja/textlint-rule-no-doubled-conjunctive-particle-ga
86-
"no-doubled-conjunctive-particle-ga": true,
87-
// # 同じ接続詞を連続して使用しない
88-
// https://github.com/textlint-ja/textlint-rule-no-doubled-conjunction
89-
"no-doubled-conjunction": true,
90-
// # 同じ助詞を連続して使用しない
91-
"no-doubled-joshi": {
92-
"min_interval": 1
93-
},
94-
// # UTF8-MAC 濁点を使用しない
95-
// 文章中にUTF8-MAC 濁点は不要です。
96-
// https://github.com/textlint-ja/textlint-rule-no-nfd
97-
"no-nfd": true,
98-
// # 不必要な制御文字を使用しない
99-
// 改行やタブ以外の一般的な文章にはでてこない不自然な制御文字が入るのを防止します。
100-
// https://github.com/textlint-rule/textlint-rule-no-invalid-control-character
101-
"no-invalid-control-character": true,
102-
// # ゼロ幅スペースの検出
103-
// https://github.com/textlint-rule/textlint-rule-no-zero-width-spaces
104-
"no-zero-width-spaces": true,
105-
// # 感嘆符!!、疑問符??を使用しない
106-
// https://github.com/textlint-rule/textlint-rule-no-exclamation-question-mark
107-
"no-exclamation-question-mark": true,
108-
// # 半角カナを使用しない
109-
// https://github.com/textlint-ja/textlint-rule-no-hankaku-kana
110-
"no-hankaku-kana": true,
111-
// # 弱い日本語表現の利用を使用しない
112-
// 〜かもしれない 等の弱い表現を使用しない
113-
// https://github.com/textlint-ja/textlint-rule-ja-no-weak-phrase
114-
"ja-no-weak-phrase": true,
115-
// # 同一の単語を間違えて連続しているのをチェックする
116-
// https://github.com/textlint-ja/textlint-rule-ja-no-successive-word
117-
"ja-no-successive-word": true,
118-
// # よくある日本語の誤用をチェックする
119-
// https://github.com/textlint-ja/textlint-rule-ja-no-abusage
120-
"ja-no-abusage": true,
121-
// # 冗長な表現をチェックする
122-
// https://github.com/textlint-ja/textlint-rule-ja-no-redundant-expression
123-
"ja-no-redundant-expression": true,
124-
// # 入力ミスで発生する不自然なアルファベットをチェックする
125-
// https://github.com/textlint-ja/textlint-rule-ja-unnatural-alphabet
126-
"ja-unnatural-alphabet": true,
127-
// # 対になっていない括弧をチェックする
128-
// https://github.com/textlint-rule/textlint-rule-no-unmatched-pair
129-
"no-unmatched-pair": true
130-
}
35+
// # コンマは1文中に3つまで
36+
// https://github.com/textlint-rule/textlint-rule-max-comma
37+
"max-comma": {
38+
max: 3,
39+
},
40+
// # 読点は1文中に3つまで
41+
// https://github.com/textlint-ja/textlint-rule-max-ten
42+
"max-ten": {
43+
max: 3,
44+
},
45+
// # 連続できる最大の漢字長は6文字まで
46+
// 漢字が連続していると読みにくさにつながります。
47+
// https://github.com/textlint-ja/textlint-rule-max-kanji-continuous-len
48+
"max-kanji-continuous-len": {
49+
max: 6,
50+
},
51+
// # 漢数字と算用数字を使い分けます
52+
// 数量を表現し、数を数えられるものは算用数字を使用します。
53+
// 任意の数に置き換えても通用する語句がこれに該当します。
54+
// 序数詞(「第~回」「~番目」「~回目」)も算用数字を使います。
55+
// 慣用的表現、熟語、概数、固有名詞、副詞など、漢数字を使用することが一般的な語句では漢数字を使います。
56+
// https://github.com/textlint-ja/textlint-rule-preset-JTF-style
57+
// https://www.jtf.jp/jp/style_guide/styleguide_top.html
58+
"arabic-kanji-numbers": true,
59+
// # 「ですます調」、「である調」を統一します
60+
// 見出しは自動
61+
// 本文はですます調
62+
// 箇条書きはである調
63+
// https://github.com/textlint-ja/textlint-rule-no-mix-dearu-desumasu
64+
"no-mix-dearu-desumasu": {
65+
preferInHeader: "",
66+
preferInBody: "ですます",
67+
preferInList: "である",
68+
strict: false,
69+
},
70+
// # 文末の句点記号として「。」を使います
71+
// https://github.com/textlint-ja/textlint-rule-ja-no-mixed-period
72+
"ja-no-mixed-period": {
73+
periodMark: "。",
74+
},
75+
// # 二重否定は使用しない
76+
// https://github.com/textlint-ja/textlint-rule-no-double-negative-ja
77+
"no-double-negative-ja": true,
78+
// # ら抜き言葉を使用しない
79+
// https://github.com/textlint-ja/textlint-rule-no-dropping-the-ra
80+
"no-dropping-the-ra": true,
81+
// # 逆接の接続助詞「が」を連続して使用しない
82+
// 逆接の接続助詞「が」は、特に否定の意味ではなくても安易に使われてしまいがちです。
83+
// 同一文中に複数回出現していないかどうかをチェックします。
84+
// https://github.com/textlint-ja/textlint-rule-no-doubled-conjunctive-particle-ga
85+
"no-doubled-conjunctive-particle-ga": true,
86+
// # 同じ接続詞を連続して使用しない
87+
// https://github.com/textlint-ja/textlint-rule-no-doubled-conjunction
88+
"no-doubled-conjunction": true,
89+
// # 同じ助詞を連続して使用しない
90+
"no-doubled-joshi": {
91+
min_interval: 1,
92+
},
93+
// # UTF8-MAC 濁点を使用しない
94+
// 文章中にUTF8-MAC 濁点は不要です。
95+
// https://github.com/textlint-ja/textlint-rule-no-nfd
96+
"no-nfd": true,
97+
// # 不必要な制御文字を使用しない
98+
// 改行やタブ以外の一般的な文章にはでてこない不自然な制御文字が入るのを防止します。
99+
// https://github.com/textlint-rule/textlint-rule-no-invalid-control-character
100+
"no-invalid-control-character": true,
101+
// # ゼロ幅スペースの検出
102+
// https://github.com/textlint-rule/textlint-rule-no-zero-width-spaces
103+
"no-zero-width-spaces": true,
104+
// # 感嘆符!!、疑問符??を使用しない
105+
// https://github.com/textlint-rule/textlint-rule-no-exclamation-question-mark
106+
"no-exclamation-question-mark": true,
107+
// # 半角カナを使用しない
108+
// https://github.com/textlint-ja/textlint-rule-no-hankaku-kana
109+
"no-hankaku-kana": true,
110+
// # 弱い日本語表現の利用を使用しない
111+
// 〜かもしれない 等の弱い表現を使用しない
112+
// https://github.com/textlint-ja/textlint-rule-ja-no-weak-phrase
113+
"ja-no-weak-phrase": true,
114+
// # 同一の単語を間違えて連続しているのをチェックする
115+
// https://github.com/textlint-ja/textlint-rule-ja-no-successive-word
116+
"ja-no-successive-word": true,
117+
// # よくある日本語の誤用をチェックする
118+
// https://github.com/textlint-ja/textlint-rule-ja-no-abusage
119+
"ja-no-abusage": true,
120+
// # 冗長な表現をチェックする
121+
// https://github.com/textlint-ja/textlint-rule-ja-no-redundant-expression
122+
"ja-no-redundant-expression": true,
123+
// # 入力ミスで発生する不自然なアルファベットをチェックする
124+
// https://github.com/textlint-ja/textlint-rule-ja-unnatural-alphabet
125+
"ja-unnatural-alphabet": true,
126+
// # 対になっていない括弧をチェックする
127+
// https://github.com/textlint-rule/textlint-rule-no-unmatched-pair
128+
"no-unmatched-pair": true,
129+
},
131130
};

0 commit comments

Comments
 (0)