1
- # textlint-plugin- JTF-style [ ![ Build Status] ( https://travis-ci.org/azu/textlint-plugin- JTF-style.svg?branch=master )] ( https://travis-ci.org/azu/textlint-plugin -JTF-style )
1
+ # textlint-rule-preset- JTF-style [ ![ Build Status] ( https://travis-ci.org/azu/textlint-rule-preset- JTF-style.svg?branch=master )] ( https://travis-ci.org/azu/textlint-rule-preset -JTF-style )
2
2
3
3
[ JTF日本語標準スタイルガイド(翻訳用)] ( https://www.jtf.jp/jp/style_guide/styleguide_top.html " JTF日本語標準スタイルガイド(翻訳用) ") for [ textlint] ( https://github.com/textlint/textlint " textlint ") .
4
4
5
5
## Installation
6
6
7
- npm install textlint-plugin -jtf-style
7
+ npm install textlint-rule-preset -jtf-style
8
8
9
9
## Usage
10
10
14
14
15
15
### 最も手軽な方法(グローバル)
16
16
17
- npmでグローバルにインストールし、` --plugin ` で利用するのが一番お手軽です。
17
+ npmでグローバルにインストールし、` --preset ` で利用するのが一番お手軽です。
18
18
19
- npm install -g textlint textlint-plugin -jtf-style
20
- textlint --plugin textlint-plugin -jtf-style README.md
19
+ npm install -g textlint textlint-rule-preset -jtf-style
20
+ textlint --preset textlint-rule-preset -jtf-style README.md
21
21
# README.mdをLintした結果が出力されます
22
22
23
23
グローバルにインストールするよりは、次のようにプロジェクト毎のディレクトリにインストールする方法を推奨します。
24
24
25
25
### ` .textlintrc ` を使う方法(推奨)
26
26
27
- 現在のディレクトリにtextlintとtextlint-plugin -jtf-styleをインストールする方法です。
27
+ 現在のディレクトリにtextlintとtextlint-rule-preset -jtf-styleをインストールする方法です。
28
28
(グローバルにインストールしなくていいので環境がキレイに作れます)
29
29
30
30
```
31
31
npm init # package.jsonがないなら
32
- npm install -D textlint textlint-plugin -jtf-style
32
+ npm install -D textlint textlint-rule-preset -jtf-style
33
33
```
34
34
35
- textlintの設定ファイルとなっている` .textlintrc ` に次のように` jtf-style ` と指定します(` textlint-plugin- ` を取り除いたプラグイン名 )。
35
+ textlintの設定ファイルとなっている` .textlintrc ` に次のように` jtf-style ` と指定します(` textlint-rule- ` を取り除いたプリセット名 )。
36
36
37
37
``` js
38
38
{
39
- " plugins " : [
40
- " jtf-style"
41
- ]
39
+ " rules " : {
40
+ " preset- jtf-style" : true
41
+ }
42
42
}
43
43
```
44
44
@@ -62,7 +62,7 @@ npm run-script経由で実行すれば、`node_modules/.bin/`は省略出来ま
62
62
63
63
- [ JTF日本語標準スタイルガイド(翻訳用)(PDFファイル)] ( https://www.jtf.jp/jp/style_guide/pdf/jtf_style_guide.pdf )
64
64
65
- ` textlint-plugin-JTF -style ` で対応するルールと実装状況は以下のとおりです。
65
+ ` textlint-rule-preset-jtf -style ` で対応するルールと実装状況は以下のとおりです。
66
66
67
67
辞書ベースと書かれているものは、独自の辞書をベースとしているため精度が曖昧となっています。
68
68
@@ -569,7 +569,7 @@ npm run-script経由で実行すれば、`node_modules/.bin/`は省略出来ま
569
569
570
570
Q. このルールはスタイルガイドと合ってないのでは?
571
571
572
- A. [ Issue] ( https://github.com/azu/textlint-plugin-JTF -style/issues/new ) に詳細を書いてみるといいと思います。
572
+ A. [ Issue] ( https://github.com/azu/textlint-rule-preset-jtf -style/issues/new ) に詳細を書いてみるといいと思います。
573
573
574
574
Issueには以下の項目が書かれていると問題を解決しやすくなります。
575
575
@@ -591,15 +591,14 @@ A. `.textlintrc` にルール毎の設定を追加することが出来ます。
591
591
- [ textlintで日本語の文章をチェックする | Web Scratch] ( http://efcl.info/2015/09/10/introduce-textlint/ " textlintで日本語の文章をチェックする | Web Scratch ")
592
592
593
593
` 1.2.2.ピリオド(.)とカンマ(,) ` のルールを無効化したい場合は、` .textlintrc ` に次のように` false ` 値を設定することで無効化出来ます。
594
- デフォルトでは` textlint-plugin-JTF -style ` に含まれるルールが全て有効化されています。
594
+ デフォルトでは` textlint-rule-preset-jtf -style ` に含まれるルールが全て有効化されています。
595
595
596
596
``` js
597
597
{
598
- " plugins" : [
599
- " jtf-style"
600
- ],
601
598
" rules" : {
602
- " jtf-style/1.2.2.ピリオド(.)とカンマ(,)" : false
599
+ " preset-jtf-style" : {
600
+ " 1.2.2.ピリオド(.)とカンマ(,)" : false
601
+ }
603
602
}
604
603
}
605
604
```
@@ -624,6 +623,31 @@ A. 正規表現の辞書ベースのルールが幾つかあります。
624
623
625
624
これらのルールを有効化したい場合は、` .textlintrc ` で明示的に有効化する必要があります。
626
625
626
+ ``` js
627
+ {
628
+ " rules" : {
629
+ " preset-jtf-style" : {
630
+ " 2.1.2.漢字" : true ,
631
+ " 2.1.5.カタカナ" : true ,
632
+ " 2.1.6.カタカナの長音" : true ,
633
+ " 2.2.1.ひらがなと漢字の使い分け" : true
634
+ }
635
+ }
636
+ }
637
+ ```
638
+
639
+
640
+ ## Migration
641
+
642
+ ` textlint-plugin-jtf-style ` から ` textlint-rule-preset-jtf-style ` へ移行したい場合、
643
+
644
+ ``` sh
645
+ npm uninstall -D textlint-plugin-jtf-style
646
+ npm install -D textlint-rule-preset-jtf-style
647
+ ```
648
+
649
+ した後、` .textlintrc ` を
650
+
627
651
``` js
628
652
{
629
653
" plugins" : [
@@ -638,6 +662,21 @@ A. 正規表現の辞書ベースのルールが幾つかあります。
638
662
}
639
663
```
640
664
665
+ 以下のように書き換えれば完了です。
666
+
667
+ ``` js
668
+ {
669
+ " rules" : {
670
+ " preset-jtf-style" : {
671
+ " 2.1.2.漢字" : true ,
672
+ " 2.1.5.カタカナ" : true ,
673
+ " 2.1.6.カタカナの長音" : true ,
674
+ " 2.2.1.ひらがなと漢字の使い分け" : true
675
+ }
676
+ }
677
+ }
678
+ ```
679
+
641
680
642
681
## Contributing
643
682
0 commit comments