Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb611ee1

Browse files
committed
feat(textlint): add prh rule
textlint-rule-prh is for spell check
1 parent77de763 commitb611ee1

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

‎.textlintrc

Lines changed: 5 additions & 0 deletions
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
}

‎package.json

Lines changed: 1 addition & 0 deletions
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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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:Connect
65+
specs:
66+
-from:connect
67+
to:Connect

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp