Skip to content

Commit 21a9640

Browse files
authored
Merge pull request #9 from textlint-ja/kuromojin@3
fix(deps): update to kuromojin@3
2 parents 0e80495 + 64b5115 commit 21a9640

10 files changed

+1634
-1231
lines changed

.github/workflows/test.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: test
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
name: "Test on Node.js ${{ matrix.node-version }}"
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
node-version: [12, 14]
10+
steps:
11+
- name: checkout
12+
uses: actions/checkout@v2
13+
- name: setup Node.js ${{ matrix.node-version }}
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: ${{ matrix.node-version }}
17+
- name: Install
18+
run: yarn install
19+
- name: Test
20+
run: yarn test

.mocharc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": [
3+
"textlint-scripts/register"
4+
]
5+
}

.travis.yml

-3
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# textlint-rule-ja-no-weak-phrase [![Build Status](https://travis-ci.org/textlint-ja/textlint-rule-ja-no-weak-phrase.svg?branch=master)](https://travis-ci.org/textlint-ja/textlint-rule-ja-no-weak-phrase)
1+
# textlint-rule-ja-no-weak-phrase [![Actions Status: test](https://github.com/textlint-ja/textlint-rule-ja-no-weak-phrase/workflows/test/badge.svg)](https://github.com/textlint-ja/textlint-rule-ja-no-weak-phrase/actions?query=workflow%3A"test")
22

33
弱い日本語表現の利用を禁止する[textlint](http://textlint.github.io/ "textlint")ルール
44

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"textlint-scripts": "^3.0.0"
3838
},
3939
"dependencies": {
40-
"kuromojin": "^2.0.0",
40+
"kuromojin": "^3.0.0",
4141
"morpheme-match": "^2.0.4",
4242
"morpheme-match-all": "^2.0.5"
4343
}

src/dict.js

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

+4-4
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/mocha.opts

-1
This file was deleted.

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

+24-3
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)