Skip to content

Commit 5e9f72e

Browse files
committed
Merge pull request azu#49 from azu/texlint-rule-prh
feat(textlint): add prh rule
2 parents 77de763 + 3e83adb commit 5e9f72e

File tree

4 files changed

+76
-2
lines changed

4 files changed

+76
-2
lines changed

.textlintrc

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
"no-mix-dearu-desumasu": true,
88
"no-start-duplicated-conjunction": {
99
"interval": 2
10+
},
11+
"prh": {
12+
"rulePaths": [
13+
"test/prh-rule.yaml"
14+
]
1015
}
1116
}
1217
}

ja/connect/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
> この文章はConnect 3.4.0を元に書かれています。
44
55
[Connect](https://github.com/senchalabs/connect "Connect")はNode.jsで動くHTTPサーバフレームワークです。
6-
_middleware_という拡張する仕組みを持っていて、connectが持つ機能自体はとても少ないです
6+
_middleware_という拡張する仕組みを持っていて、Connectが持つ機能自体はとても少ないです
77

8-
この章ではconnectの_middleware_の仕組みついて見て行きましょう
8+
この章ではConnectの_middleware_の仕組みついて見て行きましょう
99

1010
## どう書ける?
1111

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"textlint-rule-max-ten": "^1.1.0",
5757
"textlint-rule-no-mix-dearu-desumasu": "^1.0.1",
5858
"textlint-rule-no-start-duplicated-conjunction": "^1.0.3",
59+
"textlint-rule-prh": "^1.0.1",
5960
"textlint-rule-spellcheck-tech-word": "^4.0.1"
6061
},
6162
"dependencies": {

test/prh-rule.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: 1
2+
rules:
3+
4+
# 大文字小文字全角半角の統一
5+
- expected: Cookie
6+
# 以下と等価 正規表現には強制でgフラグが付く
7+
# - expected: Cookie
8+
# pattern: "/[CcCc][OoOo][OoOo][KkKk][IiIi][EeEe]/g"
9+
# options:
10+
# wordBoundary: false
11+
# specs: []
12+
13+
# 変換結果についてテストも書ける
14+
- expected: jQuery
15+
specs:
16+
- from: jquery
17+
to: jQuery
18+
- from: JQUERY
19+
to: jQuery
20+
21+
# 変換結果が期待通りではなかった場合、ルールのロードに失敗する
22+
# - expected: JavaScript
23+
# specs:
24+
# - from: JAVASCRIPT
25+
# to: JavaScprit # この場合はテスト側が間違ってる!
26+
# Error: JavaScript spec failed. "JAVASCRIPT", expected "JavaScprit", but got "JavaScript", /[JjJj][AaAa][VvVv][AaAa][SsSs][CcCc][RrRr][IiIi][PpPp][TtTt]/g
27+
28+
# 表現の統一を図る
29+
- expected: デフォルト
30+
pattern: ディフォルト
31+
32+
# patternは複数記述可能
33+
- expected: ハードウェア
34+
pattern:
35+
- ハードウエアー
36+
- ハードウエア # 正規表現に変換する都合上短いものを後に書いたほうがよい
37+
- ハードウェアー
38+
39+
# patternには正規表現が利用可能 否定戻り先読みが欲しい…(JSにはない
40+
- expected: $1ソフトウェア
41+
pattern: /([^経])ソフトウエア/
42+
specs:
43+
# 普通に変換
44+
- from: 広義のソフトウエア
45+
to: 広義のソフトウェア
46+
# 日経ソフトウエア(書名)は変換しない
47+
- from: 日経ソフトウエア
48+
to: 日経ソフトウエア
49+
50+
# 単語境界の区別
51+
- expected: js
52+
# pattern: "/\b[JjJj][SsSs]\b/g" # と等価 \b が前後に付与される
53+
options:
54+
wordBoundary: true
55+
specs:
56+
- from: foo JS bar
57+
to: foo js bar
58+
- from: foo altJS bar
59+
to: foo altJS bar
60+
# 日本語+単語境界の仕様は自分で調べてね…!
61+
- from: 今日もJS祭り
62+
to: 今日もjs祭り
63+
64+
- expected: ESLint
65+
- expected: Connect
66+
specs:
67+
- from: connect
68+
to: Connect

0 commit comments

Comments
 (0)