Skip to content

Commit

Permalink
fix: support to fix 2.1.6/2.2.1/2.2.3 (#102)
Browse files Browse the repository at this point in the history
* fix: support to fix 2.1.6/2.2.1/2.2.3

* CI: update node version
  • Loading branch information
azu committed Jul 1, 2022
1 parent a55f3db commit 7bffc05
Show file tree
Hide file tree
Showing 10 changed files with 1,851 additions and 2,400 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 14, 16]
node-version: [ 14, 16, 18 ]
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down
39 changes: 30 additions & 9 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,11 @@ function-bind@^1.1.1:
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==

functions-have-names@^1.2.2:
version "1.2.3"
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==

gensync@^1.0.0-beta.2:
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
Expand Down Expand Up @@ -2882,6 +2887,15 @@ regexp.prototype.flags@^1.1.1, regexp.prototype.flags@^1.2.0:
call-bind "^1.0.2"
define-properties "^1.1.3"

regexp.prototype.flags@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac"
integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
functions-have-names "^1.2.2"

regx@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/regx/-/regx-1.0.4.tgz#a0ee32c308910902019ca1117ed41b9ddd041b2f"
Expand Down Expand Up @@ -3312,15 +3326,13 @@ textlint-rule-helper@^2.1.1:
structured-source "^3.0.2"
unist-util-visit "^1.1.0"

textlint-rule-helper@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/textlint-rule-helper/-/textlint-rule-helper-2.2.0.tgz#30522ba904a03849d57ea3e5ebd5920027cd8da3"
integrity sha512-9S5CsgQuQwPjM2wvr4JGdpkLf+pR9gOjedSQFa/Dkrbh+D9MXt1LIR4Jvx1RujKtt2nq42prmEX2q3xOxyUcIQ==
textlint-rule-helper@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/textlint-rule-helper/-/textlint-rule-helper-2.2.1.tgz#fe223d4a6c492b9aaf6e8a33fca5ad8a02e4e027"
integrity sha512-pdX3uNbFzQTgINamaBpEHRT/MgROHev5wCnQnUTXRLT5DaRjls0Rmpi5d1MPZG6HT5NKVL++Q2J0FUbh5shi3Q==
dependencies:
"@textlint/ast-node-types" "^4.4.3"
"@textlint/types" "^1.5.5"
structured-source "^3.0.2"
unist-util-visit "^1.1.0"
unist-util-visit "^2.0.3"

"textlint-rule-preset-jtf-style@file:..":
version "2.3.12"
Expand All @@ -3329,10 +3341,10 @@ textlint-rule-helper@^2.2.0:
japanese-numerals-to-number "^1.0.2"
match-index "^1.0.3"
moji "^0.5.1"
regexp.prototype.flags "^1.1.1"
regexp.prototype.flags "^1.4.3"
regx "^1.0.4"
sorted-joyo-kanji "^0.2.0"
textlint-rule-helper "^2.2.0"
textlint-rule-helper "^2.2.1"
textlint-rule-prh "^5.2.1"

textlint-rule-prh@^5.2.1:
Expand Down Expand Up @@ -3512,6 +3524,15 @@ unist-util-visit@^1.1.0:
dependencies:
unist-util-visit-parents "^2.0.0"

unist-util-visit@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-2.0.3.tgz#c3703893146df47203bb8a9795af47d7b971208c"
integrity sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==
dependencies:
"@types/unist" "^2.0.0"
unist-util-is "^4.0.0"
unist-util-visit-parents "^3.0.0"

untildify@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@
"translation"
],
"devDependencies": {
"glob": "^7.1.4",
"lint-staged": "^11.0.0",
"prettier": "^2.3.0",
"textlint-scripts": "^12.0.1",
"textlint-tester": "^12.0.0"
"glob": "^8.0.3",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"textlint-scripts": "^12.2.1",
"textlint-tester": "^12.2.1"
},
"dependencies": {
"analyze-desumasu-dearu": "^2.1.2",
"japanese-numerals-to-number": "^1.0.2",
"match-index": "^1.0.3",
"moji": "^0.5.1",
"regexp.prototype.flags": "^1.1.1",
"regexp.prototype.flags": "^1.4.3",
"regx": "^1.0.4",
"sorted-joyo-kanji": "^0.2.0",
"textlint-rule-helper": "^2.2.0",
"textlint-rule-helper": "^2.2.1",
"textlint-rule-prh": "^5.2.1"
},
"peerDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion src/2.1.6.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import fs from "fs";
import path from "path";
import prh from "textlint-rule-prh";

module.exports = function (context) {
const report = function (context) {
// 辞書ベースのカタカナ末尾の長音のチェックを行う
return prh.fixer(context, {
ruleContents: [fs.readFileSync(path.join(__dirname, "..", "dict", "2.1.6.yml"), "utf-8")]
});
};
module.exports = {
linter: report,
fixer: report
};
6 changes: 5 additions & 1 deletion src/2.2.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ import fs from "fs";
import path from "path";
import prh from "textlint-rule-prh";

module.exports = function (context) {
const report = function (context) {
return prh.fixer(context, {
ruleContents: [fs.readFileSync(path.join(__dirname, "..", "dict", "2.2.1.yml"), "utf-8")]
});
};
module.exports = {
linter: report,
fixer: report
};
7 changes: 6 additions & 1 deletion src/2.2.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
import prh from "textlint-rule-prh";
import path from "path";
import fs from "fs";
module.exports = function (context) {

const report = function (context) {
return prh.fixer(context, {
ruleContents: [fs.readFileSync(path.join(__dirname, "..", "dict", "2.2.3.yml"), "utf-8")]
});
};
module.exports = {
linter: report,
fixer: report
};
1 change: 1 addition & 0 deletions test/2.1.6-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tester.run("2.1.6.カタカナの長音", rule, {
invalid: [
{
text: "フィルタをかける",
output: "フィルターをかける",
errors: [
{
message: "フィルタをか => フィルターをか"
Expand Down
21 changes: 21 additions & 0 deletions test/2.2.1-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// LICENSE : MIT
"use strict";
import TextLintTester from "textlint-tester";
import rule from "../src/2.2.1";

const tester = new TextLintTester();
tester.run("2.2.1.ひらがなと漢字の使い分け", rule, {
valid: ["問題は以下のとおりです"],
invalid: [
{
text: "問題は以下の通り",
output: "問題は以下のとおり",
errors: [
{
message: `以下の通り => 以下のとおり`,
index: 3
}
]
}
]
});
21 changes: 21 additions & 0 deletions test/2.2.3-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// LICENSE : MIT
"use strict";
import TextLintTester from "textlint-tester";
import rule from "../src/2.2.3";

const tester = new TextLintTester();
tester.run("2.2.3. 一部の助数詞の表記", rule, {
valid: ["3か月未満"],
invalid: [
{
text: "3ヶ月未満",
output: "3か月未満",
errors: [
{
message: `3ヶ月 => 3か月`,
index: 0
}
]
}
]
});
Loading

0 comments on commit 7bffc05

Please sign in to comment.