From b611ee12eeea12154780c3ec72e55be5c57f35e1 Mon Sep 17 00:00:00 2001 From: azu Date: Sun, 13 Sep 2015 01:32:47 +0900 Subject: [PATCH 1/2] feat(textlint): add prh rule textlint-rule-prh is for spell check --- .textlintrc | 5 ++++ package.json | 1 + test/prh-rule.yaml | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 test/prh-rule.yaml diff --git a/.textlintrc b/.textlintrc index 1ff35a8..3c6ab37 100644 --- a/.textlintrc +++ b/.textlintrc @@ -7,6 +7,11 @@ "no-mix-dearu-desumasu": true, "no-start-duplicated-conjunction": { "interval": 2 + }, + "prh": { + "rulePaths": [ + "test/prh-rule.yaml" + ] } } } \ No newline at end of file diff --git a/package.json b/package.json index 6989e22..626eab2 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "textlint-rule-max-ten": "^1.1.0", "textlint-rule-no-mix-dearu-desumasu": "^1.0.1", "textlint-rule-no-start-duplicated-conjunction": "^1.0.3", + "textlint-rule-prh": "^1.0.1", "textlint-rule-spellcheck-tech-word": "^4.0.1" }, "dependencies": { diff --git a/test/prh-rule.yaml b/test/prh-rule.yaml new file mode 100644 index 0000000..6e8c938 --- /dev/null +++ b/test/prh-rule.yaml @@ -0,0 +1,67 @@ +version: 1 +rules: + +# 大文字小文字全角半角の統一 + - expected: Cookie +# 以下と等価 正規表現には強制でgフラグが付く +# - expected: Cookie +# pattern: "/[CcCc][OoOo][OoOo][KkKk][IiIi][EeEe]/g" +# options: +# wordBoundary: false +# specs: [] + +# 変換結果についてテストも書ける + - expected: jQuery + specs: + - from: jquery + to: jQuery + - from: JQUERY + to: jQuery + +# 変換結果が期待通りではなかった場合、ルールのロードに失敗する +# - expected: JavaScript +# specs: +# - from: JAVASCRIPT +# to: JavaScprit # この場合はテスト側が間違ってる! +# Error: JavaScript spec failed. "JAVASCRIPT", expected "JavaScprit", but got "JavaScript", /[JjJj][AaAa][VvVv][AaAa][SsSs][CcCc][RrRr][IiIi][PpPp][TtTt]/g + +# 表現の統一を図る + - expected: デフォルト + pattern: ディフォルト + +# patternは複数記述可能 + - expected: ハードウェア + pattern: + - ハードウエアー + - ハードウエア # 正規表現に変換する都合上短いものを後に書いたほうがよい + - ハードウェアー + +# patternには正規表現が利用可能 否定戻り先読みが欲しい…(JSにはない + - expected: $1ソフトウェア + pattern: /([^経])ソフトウエア/ + specs: + # 普通に変換 + - from: 広義のソフトウエア + to: 広義のソフトウェア + # 日経ソフトウエア(書名)は変換しない + - from: 日経ソフトウエア + to: 日経ソフトウエア + +# 単語境界の区別 + - expected: js + # pattern: "/\b[JjJj][SsSs]\b/g" # と等価 \b が前後に付与される + options: + wordBoundary: true + specs: + - from: foo JS bar + to: foo js bar + - from: foo altJS bar + to: foo altJS bar + # 日本語+単語境界の仕様は自分で調べてね…! + - from: 今日もJS祭り + to: 今日もjs祭り + + - expected: Connect + specs: + - from: connect + to: Connect \ No newline at end of file From 3e83adb65562a954a2e078ff08e471ad5bb513ac Mon Sep 17 00:00:00 2001 From: azu Date: Sun, 13 Sep 2015 01:37:02 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix(connect):=20Connect=E3=81=AB=E7=B5=B1?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #48 --- ja/connect/README.md | 4 ++-- test/prh-rule.yaml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ja/connect/README.md b/ja/connect/README.md index 14acf15..4ab7439 100644 --- a/ja/connect/README.md +++ b/ja/connect/README.md @@ -3,9 +3,9 @@ > この文章はConnect 3.4.0を元に書かれています。 [Connect](https://github.com/senchalabs/connect "Connect")はNode.jsで動くHTTPサーバフレームワークです。 -_middleware_という拡張する仕組みを持っていて、connectが持つ機能自体はとても少ないです。 +_middleware_という拡張する仕組みを持っていて、Connectが持つ機能自体はとても少ないです。 -この章ではconnectの_middleware_の仕組みついて見て行きましょう。 +この章ではConnectの_middleware_の仕組みついて見て行きましょう。 ## どう書ける? diff --git a/test/prh-rule.yaml b/test/prh-rule.yaml index 6e8c938..ee1c191 100644 --- a/test/prh-rule.yaml +++ b/test/prh-rule.yaml @@ -61,6 +61,7 @@ rules: - from: 今日もJS祭り to: 今日もjs祭り + - expected: ESLint - expected: Connect specs: - from: connect