Skip to content

Commit 23fe814

Browse files
committed
refactor: update es modules
1 parent a93ad5c commit 23fe814

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

src/dict.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = [
1+
export default [
22
{
33
"message": `弱い表現: "かも" が使われています。`,
44
// https://azu.github.io/morpheme-match/?text=問題がある(かも。)
@@ -199,4 +199,4 @@ module.exports = [
199199
]
200200

201201
}
202-
];
202+
];

src/textlint-rule-ja-no-weak-phrase.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// LICENSE : MIT
22
"use strict";
3-
const tokenize = require("kuromojin").tokenize;
4-
const dictionaryList = require("./dict");
5-
const { createMatcher } = require("morpheme-match-all");
3+
import { tokenize } from "kuromojin";
4+
import dictionaryList from "./dict";
5+
import { createMatcher } from "morpheme-match-all";
66
const matchAll = createMatcher(dictionaryList);
7-
module.exports = function (context) {
7+
export default function (context) {
88
const { Syntax, RuleError, report, getSource } = context;
99
return {
1010
[Syntax.Str](node) {

test/textlint-rule-ja-no-weak-phrase-test.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// LICENSE : MIT
22
"use strict";
3-
const TextLintTester = require("textlint-tester");
3+
import TextLintTester from "textlint-tester";
4+
import rule from "../src/textlint-rule-ja-no-weak-phrase";
5+
46
const tester = new TextLintTester();
5-
// rule
6-
const rule = require("../src/textlint-rule-ja-no-weak-phrase");
77
// ruleName, rule, { valid, invalid }
88
tester.run("textlint-rule-ja-no-weak-phrase", rule, {
99
valid: [
1010
"コレは弱くない",
11+
"これは弱くないと思われますがどうですか?",
1112
// https://github.com/textlint-ja/textlint-rule-ja-no-weak-phrase/issues/4
1213
"どう工夫したのかも書いてみてください"
1314
],
@@ -63,6 +64,26 @@ tester.run("textlint-rule-ja-no-weak-phrase", rule, {
6364
column: 30
6465
}
6566
]
67+
},
68+
{
69+
text: "重大な意義を持つと思います。",
70+
errors: [
71+
{
72+
message: `弱い表現: "思います" が使われています。`,
73+
index: 9
74+
}
75+
]
76+
},
77+
{
78+
text: "この結果はそのような可能性を示唆している。",
79+
errors: [
80+
{
81+
message: `弱い表現: "可能性を示唆している" が使われています。
82+
「可能性がある」または「. . . を示唆している」を利用してください。
83+
弱い表現を二つ重ねることはしないでください。`,
84+
index: 10
85+
}
86+
]
6687
}
6788
]
6889
});

0 commit comments

Comments
 (0)