Skip to content

Commit 91a768d

Browse files
committed
Merge pull request #27 from azu/rename-to-textlint-rule-preset-jtf-style
Rename to textlint-rule-preset-jtf-style
2 parents 1144974 + afa63af commit 91a768d

File tree

5 files changed

+71
-31
lines changed

5 files changed

+71
-31
lines changed

README.md

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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)
22

33
[JTF日本語標準スタイルガイド(翻訳用)](https://www.jtf.jp/jp/style_guide/styleguide_top.html "JTF日本語標準スタイルガイド(翻訳用)") for [textlint](https://github.com/textlint/textlint "textlint").
44

55
## Installation
66

7-
npm install textlint-plugin-jtf-style
7+
npm install textlint-rule-preset-jtf-style
88

99
## Usage
1010

@@ -14,31 +14,31 @@
1414

1515
### 最も手軽な方法(グローバル)
1616

17-
npmでグローバルにインストールし、`--plugin`で利用するのが一番お手軽です。
17+
npmでグローバルにインストールし、`--preset`で利用するのが一番お手軽です。
1818

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
2121
# README.mdをLintした結果が出力されます
2222

2323
グローバルにインストールするよりは、次のようにプロジェクト毎のディレクトリにインストールする方法を推奨します。
2424

2525
### `.textlintrc`を使う方法(推奨)
2626

27-
現在のディレクトリにtextlintとtextlint-plugin-jtf-styleをインストールする方法です。
27+
現在のディレクトリにtextlintとtextlint-rule-preset-jtf-styleをインストールする方法です。
2828
(グローバルにインストールしなくていいので環境がキレイに作れます)
2929

3030
```
3131
npm init # package.jsonがないなら
32-
npm install -D textlint textlint-plugin-jtf-style
32+
npm install -D textlint textlint-rule-preset-jtf-style
3333
```
3434

35-
textlintの設定ファイルとなっている`.textlintrc`に次のように`jtf-style`と指定します(`textlint-plugin-`を取り除いたプラグイン名)。
35+
textlintの設定ファイルとなっている`.textlintrc`に次のように`jtf-style`と指定します(`textlint-rule-`を取り除いたプリセット名)。
3636

3737
```js
3838
{
39-
"plugins": [
40-
"jtf-style"
41-
]
39+
"rules": {
40+
"preset-jtf-style": true
41+
}
4242
}
4343
```
4444

@@ -62,7 +62,7 @@ npm run-script経由で実行すれば、`node_modules/.bin/`は省略出来ま
6262

6363
- [JTF日本語標準スタイルガイド(翻訳用)(PDFファイル)](https://www.jtf.jp/jp/style_guide/pdf/jtf_style_guide.pdf)
6464

65-
`textlint-plugin-JTF-style`で対応するルールと実装状況は以下のとおりです。
65+
`textlint-rule-preset-jtf-style`で対応するルールと実装状況は以下のとおりです。
6666

6767
辞書ベースと書かれているものは、独自の辞書をベースとしているため精度が曖昧となっています。
6868

@@ -569,7 +569,7 @@ npm run-script経由で実行すれば、`node_modules/.bin/`は省略出来ま
569569

570570
Q. このルールはスタイルガイドと合ってないのでは?
571571

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)に詳細を書いてみるといいと思います。
573573

574574
Issueには以下の項目が書かれていると問題を解決しやすくなります。
575575

@@ -591,15 +591,14 @@ A. `.textlintrc` にルール毎の設定を追加することが出来ます。
591591
- [textlintで日本語の文章をチェックする | Web Scratch](http://efcl.info/2015/09/10/introduce-textlint/ "textlintで日本語の文章をチェックする | Web Scratch")
592592

593593
`1.2.2.ピリオド(.)とカンマ(,)`のルールを無効化したい場合は、`.textlintrc`に次のように`false`値を設定することで無効化出来ます。
594-
デフォルトでは`textlint-plugin-JTF-style`に含まれるルールが全て有効化されています。
594+
デフォルトでは`textlint-rule-preset-jtf-style`に含まれるルールが全て有効化されています。
595595

596596
```js
597597
{
598-
"plugins": [
599-
"jtf-style"
600-
],
601598
"rules": {
602-
"jtf-style/1.2.2.ピリオド(.)とカンマ(,)": false
599+
"preset-jtf-style": {
600+
"1.2.2.ピリオド(.)とカンマ(,)": false
601+
}
603602
}
604603
}
605604
```
@@ -624,6 +623,31 @@ A. 正規表現の辞書ベースのルールが幾つかあります。
624623

625624
これらのルールを有効化したい場合は、`.textlintrc`で明示的に有効化する必要があります。
626625

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+
627651
```js
628652
{
629653
"plugins": [
@@ -638,6 +662,21 @@ A. 正規表現の辞書ベースのルールが幾つかあります。
638662
}
639663
```
640664

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+
641680

642681
## Contributing
643682

example/.textlintrc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
"plugins": [
3-
"jtf-style"
4-
],
52
"rules": {
6-
"jtf-style/2.1.6.カタカナの長音": false,
7-
"jtf-style/4.3.1.丸かっこ()": false
3+
"preset-jtf-style": {
4+
"4.3.1.丸かっこ()": false
5+
}
86
}
97
}

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"pretest": "npm rm textlint-plugin-jtf-style && npm i",
7+
"pretest": "npm rm textlint-rule-preset-jtf-style && npm i",
88
"textlint": "textlint",
99
"test": "npm run textlint -- -f pretty-error ../README.md"
1010
},
1111
"author": "azu",
1212
"license": "MIT",
1313
"devDependencies": {
14-
"textlint": "^3.7.1",
15-
"textlint-plugin-jtf-style": "file:.."
14+
"textlint": "^5.1.0",
15+
"textlint-rule-preset-jtf-style": "file:.."
1616
}
1717
}

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "textlint-plugin-jtf-style",
2+
"name": "textlint-rule-preset-jtf-style",
33
"repository": {
44
"type": "git",
5-
"url": "git+https://github.com/azu/textlint-plugin-JTF-style.git"
5+
"url": "git+https://github.com/azu/textlint-rule-preset-jtf-style.git"
66
},
77
"author": "azu",
88
"email": "azuciao@gmail.com",
9-
"homepage": "https://github.com/azu/textlint-plugin-JTF-style",
9+
"homepage": "https://github.com/azu/textlint-rule-preset-jtf-style",
1010
"license": "MIT",
1111
"bugs": {
12-
"url": "https://github.com/azu/textlint-plugin-JTF-style/issues"
12+
"url": "https://github.com/azu/textlint-rule-preset-jtf-style/issues"
1313
},
1414
"version": "1.0.1",
1515
"description": "JTF Style Guide for Translators Working into Japanese for textlint.",
@@ -45,5 +45,8 @@
4545
"sorted-joyo-kanji": "^0.2.0",
4646
"textlint-rule-helper": "^1.1.3",
4747
"textlint-rule-prh": "^2.0.0"
48+
},
49+
"peerDependencies": {
50+
"textlint": ">= 5.1.0"
4851
}
4952
}

src/2.2.2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export default function (context) {
158158

159159
// *数えられる数字は算用数字を使う
160160
// 数十万、数百億にマッチしないように"数"という文字から始まるものは除外
161-
// https://github.com/azu/textlint-plugin-JTF-style/pull/23
161+
// https://github.com/azu/textlint-rule-preset-jtf-style/pull/23
162162
matchToReplace(text, /([]+)[]/g,
163163
ignoreWhenMatched(/([]+)[]/g, toNumber)
164164
);

0 commit comments

Comments
 (0)