Skip to content

Commit 7ca2540

Browse files
committed
feat(rule): 可変の誤用を追加
1 parent 06c7d5f commit 7ca2540

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

src/no-confusing-adjust-and-apply.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ module.exports = [
2929
"pronunciation": "テキオー"
3030
}
3131
]
32+
},
33+
{
34+
// http://azu.github.io/morpheme-match/?text=長さを(可変する)
35+
message: `「可変する」という使い方は適切ではありません。「可逆」と同じ使い方になります。\nhttp://qiita.com/scivola/items/f02589968a4ca27bc52b`,
36+
tokens: [
37+
{
38+
"surface_form": "可変",
39+
"pos": "名詞",
40+
"pos_detail_1": "一般",
41+
"pos_detail_2": "*",
42+
"pos_detail_3": "*",
43+
"conjugated_type": "*",
44+
"conjugated_form": "*",
45+
"basic_form": "可変",
46+
"reading": "カヘン",
47+
"pronunciation": "カヘン"
48+
},
49+
{
50+
"pos": "動詞",
51+
"pos_detail_1": "自立"
52+
}
53+
]
3254

3355
}
3456
];

src/no-restitution-value.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
version: 1
22
rules:
3+
# http://qiita.com/scivola/items/d9f26ea13691f8c5e6a4
34
- expected: 値を返却する
45
patterns: 値を返す
6+
prh: See http://qiita.com/scivola/items/d9f26ea13691f8c5e6a4
57
- expected: $1の返り値
68
patterns: /(メソッド|関数)の返却値/
9+
prh: See http://qiita.com/scivola/items/d9f26ea13691f8c5e6a4
710
specs:
811
- from: これはメソッドの返却値
912
to: これはメソッドの返り値

test/no-variable-test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// LICENSE : MIT
2+
"use strict";
3+
const TextLintTester = require("textlint-tester");
4+
const tester = new TextLintTester();
5+
// rule
6+
import rule from "../src/textlint-rule-ja-no-abusage";
7+
// ruleName, rule, { valid, invalid }
8+
tester.run("可変", rule, {
9+
valid: [
10+
"長さは可変だ",
11+
],
12+
invalid: [
13+
{
14+
text: "ウインドウ幅が可変すると",
15+
errors: [
16+
{
17+
message: `「可変する」という使い方は適切ではありません。「可逆」と同じ使い方になります。\nhttp://qiita.com/scivola/items/f02589968a4ca27bc52b`,
18+
index: 8
19+
}
20+
]
21+
}
22+
]
23+
});

0 commit comments

Comments
 (0)