Skip to content

Commit 7bffc05

Browse files
authored
fix: support to fix 2.1.6/2.2.1/2.2.3 (#102)
* fix: support to fix 2.1.6/2.2.1/2.2.3 * CI: update node version
1 parent a55f3db commit 7bffc05

File tree

10 files changed

+1851
-2400
lines changed

10 files changed

+1851
-2400
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
node-version: [12, 14, 16]
9+
node-version: [ 14, 16, 18 ]
1010
steps:
1111
- name: checkout
1212
uses: actions/checkout@v2

example/yarn.lock

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,11 @@ function-bind@^1.1.1:
15771577
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
15781578
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
15791579

1580+
functions-have-names@^1.2.2:
1581+
version "1.2.3"
1582+
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
1583+
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
1584+
15801585
gensync@^1.0.0-beta.2:
15811586
version "1.0.0-beta.2"
15821587
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
@@ -2882,6 +2887,15 @@ regexp.prototype.flags@^1.1.1, regexp.prototype.flags@^1.2.0:
28822887
call-bind "^1.0.2"
28832888
define-properties "^1.1.3"
28842889

2890+
regexp.prototype.flags@^1.4.3:
2891+
version "1.4.3"
2892+
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac"
2893+
integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==
2894+
dependencies:
2895+
call-bind "^1.0.2"
2896+
define-properties "^1.1.3"
2897+
functions-have-names "^1.2.2"
2898+
28852899
regx@^1.0.4:
28862900
version "1.0.4"
28872901
resolved "https://registry.yarnpkg.com/regx/-/regx-1.0.4.tgz#a0ee32c308910902019ca1117ed41b9ddd041b2f"
@@ -3312,15 +3326,13 @@ textlint-rule-helper@^2.1.1:
33123326
structured-source "^3.0.2"
33133327
unist-util-visit "^1.1.0"
33143328

3315-
textlint-rule-helper@^2.2.0:
3316-
version "2.2.0"
3317-
resolved "https://registry.yarnpkg.com/textlint-rule-helper/-/textlint-rule-helper-2.2.0.tgz#30522ba904a03849d57ea3e5ebd5920027cd8da3"
3318-
integrity sha512-9S5CsgQuQwPjM2wvr4JGdpkLf+pR9gOjedSQFa/Dkrbh+D9MXt1LIR4Jvx1RujKtt2nq42prmEX2q3xOxyUcIQ==
3329+
textlint-rule-helper@^2.2.1:
3330+
version "2.2.1"
3331+
resolved "https://registry.yarnpkg.com/textlint-rule-helper/-/textlint-rule-helper-2.2.1.tgz#fe223d4a6c492b9aaf6e8a33fca5ad8a02e4e027"
3332+
integrity sha512-pdX3uNbFzQTgINamaBpEHRT/MgROHev5wCnQnUTXRLT5DaRjls0Rmpi5d1MPZG6HT5NKVL++Q2J0FUbh5shi3Q==
33193333
dependencies:
3320-
"@textlint/ast-node-types" "^4.4.3"
3321-
"@textlint/types" "^1.5.5"
33223334
structured-source "^3.0.2"
3323-
unist-util-visit "^1.1.0"
3335+
unist-util-visit "^2.0.3"
33243336

33253337
"textlint-rule-preset-jtf-style@file:..":
33263338
version "2.3.12"
@@ -3329,10 +3341,10 @@ textlint-rule-helper@^2.2.0:
33293341
japanese-numerals-to-number "^1.0.2"
33303342
match-index "^1.0.3"
33313343
moji "^0.5.1"
3332-
regexp.prototype.flags "^1.1.1"
3344+
regexp.prototype.flags "^1.4.3"
33333345
regx "^1.0.4"
33343346
sorted-joyo-kanji "^0.2.0"
3335-
textlint-rule-helper "^2.2.0"
3347+
textlint-rule-helper "^2.2.1"
33363348
textlint-rule-prh "^5.2.1"
33373349

33383350
textlint-rule-prh@^5.2.1:
@@ -3512,6 +3524,15 @@ unist-util-visit@^1.1.0:
35123524
dependencies:
35133525
unist-util-visit-parents "^2.0.0"
35143526

3527+
unist-util-visit@^2.0.3:
3528+
version "2.0.3"
3529+
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-2.0.3.tgz#c3703893146df47203bb8a9795af47d7b971208c"
3530+
integrity sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==
3531+
dependencies:
3532+
"@types/unist" "^2.0.0"
3533+
unist-util-is "^4.0.0"
3534+
unist-util-visit-parents "^3.0.0"
3535+
35153536
untildify@^3.0.3:
35163537
version "3.0.3"
35173538
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@
3939
"translation"
4040
],
4141
"devDependencies": {
42-
"glob": "^7.1.4",
43-
"lint-staged": "^11.0.0",
44-
"prettier": "^2.3.0",
45-
"textlint-scripts": "^12.0.1",
46-
"textlint-tester": "^12.0.0"
42+
"glob": "^8.0.3",
43+
"lint-staged": "^13.0.3",
44+
"prettier": "^2.7.1",
45+
"textlint-scripts": "^12.2.1",
46+
"textlint-tester": "^12.2.1"
4747
},
4848
"dependencies": {
4949
"analyze-desumasu-dearu": "^2.1.2",
5050
"japanese-numerals-to-number": "^1.0.2",
5151
"match-index": "^1.0.3",
5252
"moji": "^0.5.1",
53-
"regexp.prototype.flags": "^1.1.1",
53+
"regexp.prototype.flags": "^1.4.3",
5454
"regx": "^1.0.4",
5555
"sorted-joyo-kanji": "^0.2.0",
56-
"textlint-rule-helper": "^2.2.0",
56+
"textlint-rule-helper": "^2.2.1",
5757
"textlint-rule-prh": "^5.2.1"
5858
},
5959
"peerDependencies": {

src/2.1.6.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import fs from "fs";
1010
import path from "path";
1111
import prh from "textlint-rule-prh";
1212

13-
module.exports = function (context) {
13+
const report = function (context) {
1414
// 辞書ベースのカタカナ末尾の長音のチェックを行う
1515
return prh.fixer(context, {
1616
ruleContents: [fs.readFileSync(path.join(__dirname, "..", "dict", "2.1.6.yml"), "utf-8")]
1717
});
1818
};
19+
module.exports = {
20+
linter: report,
21+
fixer: report
22+
};

src/2.2.1.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ import fs from "fs";
1818
import path from "path";
1919
import prh from "textlint-rule-prh";
2020

21-
module.exports = function (context) {
21+
const report = function (context) {
2222
return prh.fixer(context, {
2323
ruleContents: [fs.readFileSync(path.join(__dirname, "..", "dict", "2.2.1.yml"), "utf-8")]
2424
});
2525
};
26+
module.exports = {
27+
linter: report,
28+
fixer: report
29+
};

src/2.2.3.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
import prh from "textlint-rule-prh";
88
import path from "path";
99
import fs from "fs";
10-
module.exports = function (context) {
10+
11+
const report = function (context) {
1112
return prh.fixer(context, {
1213
ruleContents: [fs.readFileSync(path.join(__dirname, "..", "dict", "2.2.3.yml"), "utf-8")]
1314
});
1415
};
16+
module.exports = {
17+
linter: report,
18+
fixer: report
19+
};

test/2.1.6-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tester.run("2.1.6.カタカナの長音", rule, {
1111
invalid: [
1212
{
1313
text: "フィルタをかける",
14+
output: "フィルターをかける",
1415
errors: [
1516
{
1617
message: "フィルタをか => フィルターをか"

test/2.2.1-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// LICENSE : MIT
2+
"use strict";
3+
import TextLintTester from "textlint-tester";
4+
import rule from "../src/2.2.1";
5+
6+
const tester = new TextLintTester();
7+
tester.run("2.2.1.ひらがなと漢字の使い分け", rule, {
8+
valid: ["問題は以下のとおりです"],
9+
invalid: [
10+
{
11+
text: "問題は以下の通り",
12+
output: "問題は以下のとおり",
13+
errors: [
14+
{
15+
message: `以下の通り => 以下のとおり`,
16+
index: 3
17+
}
18+
]
19+
}
20+
]
21+
});

test/2.2.3-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// LICENSE : MIT
2+
"use strict";
3+
import TextLintTester from "textlint-tester";
4+
import rule from "../src/2.2.3";
5+
6+
const tester = new TextLintTester();
7+
tester.run("2.2.3. 一部の助数詞の表記", rule, {
8+
valid: ["3か月未満"],
9+
invalid: [
10+
{
11+
text: "3ヶ月未満",
12+
output: "3か月未満",
13+
errors: [
14+
{
15+
message: `3ヶ月 => 3か月`,
16+
index: 0
17+
}
18+
]
19+
}
20+
]
21+
});

0 commit comments

Comments
 (0)