Skip to content

Commit c83d164

Browse files
authored
refactor: port from v3 (#48)
refactor: port from v3
2 parents 5cc2988 + d91c1a9 commit c83d164

File tree

3 files changed

+75
-72
lines changed

3 files changed

+75
-72
lines changed

lib/textlint-rule-preset-ja-technical-writing.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
"use strict";
2-
const interopRequire = require("interop-require");
3-
const jtfRules = require("textlint-rule-preset-jtf-style").rules;
2+
const {moduleInterop} = require("@textlint/module-interop");
3+
const jtfRules = moduleInterop(require("textlint-rule-preset-jtf-style")).rules;
44
module.exports = {
55
rules: {
6-
"sentence-length": interopRequire("textlint-rule-sentence-length"),
7-
"max-comma": interopRequire("textlint-rule-max-comma"),
8-
"max-ten": interopRequire("textlint-rule-max-ten"),
9-
"max-kanji-continuous-len": interopRequire("textlint-rule-max-kanji-continuous-len"),
10-
"no-mix-dearu-desumasu": interopRequire("textlint-rule-no-mix-dearu-desumasu"),
11-
"ja-no-mixed-period": interopRequire("textlint-rule-ja-no-mixed-period"),
6+
"sentence-length": moduleInterop(require("textlint-rule-sentence-length")),
7+
"max-comma": moduleInterop(require("textlint-rule-max-comma")),
8+
"max-ten": moduleInterop(require("textlint-rule-max-ten")),
9+
"max-kanji-continuous-len": moduleInterop(require("textlint-rule-max-kanji-continuous-len")),
10+
"no-mix-dearu-desumasu": moduleInterop(require("textlint-rule-no-mix-dearu-desumasu")),
11+
"ja-no-mixed-period": moduleInterop(require("textlint-rule-ja-no-mixed-period")),
1212
"arabic-kanji-numbers": jtfRules["2.2.2.算用数字と漢数字の使い分け"],
13-
"no-doubled-conjunction": interopRequire("textlint-rule-no-doubled-conjunction"),
14-
"no-doubled-conjunctive-particle-ga": interopRequire("textlint-rule-no-doubled-conjunctive-particle-ga"),
15-
"no-double-negative-ja": interopRequire("textlint-rule-no-double-negative-ja"),
16-
"no-doubled-joshi": interopRequire("textlint-rule-no-doubled-joshi"),
17-
"no-dropping-the-ra": interopRequire("textlint-rule-no-dropping-the-ra"),
18-
"no-nfd": interopRequire("textlint-rule-no-nfd"),
19-
"no-exclamation-question-mark": interopRequire("textlint-rule-no-exclamation-question-mark"),
20-
"no-hankaku-kana": interopRequire("textlint-rule-no-hankaku-kana"),
21-
"no-invalid-control-character": interopRequire("@textlint-rule/textlint-rule-no-invalid-control-character"),
22-
"ja-no-weak-phrase": interopRequire("textlint-rule-ja-no-weak-phrase"),
23-
"ja-no-successive-word": interopRequire("textlint-rule-ja-no-successive-word"),
24-
"ja-no-abusage": interopRequire("textlint-rule-ja-no-abusage"),
25-
"ja-no-redundant-expression": interopRequire("textlint-rule-ja-no-redundant-expression"),
26-
"ja-unnatural-alphabet": interopRequire("textlint-rule-ja-unnatural-alphabet")
13+
"no-doubled-conjunction": moduleInterop(require("textlint-rule-no-doubled-conjunction")),
14+
"no-doubled-conjunctive-particle-ga": moduleInterop(require("textlint-rule-no-doubled-conjunctive-particle-ga")),
15+
"no-double-negative-ja": moduleInterop(require("textlint-rule-no-double-negative-ja")),
16+
"no-doubled-joshi": moduleInterop(require("textlint-rule-no-doubled-joshi")),
17+
"no-dropping-the-ra": moduleInterop(require("textlint-rule-no-dropping-the-ra")),
18+
"no-nfd": moduleInterop(require("textlint-rule-no-nfd")),
19+
"no-exclamation-question-mark": moduleInterop(require("textlint-rule-no-exclamation-question-mark")),
20+
"no-hankaku-kana": moduleInterop(require("textlint-rule-no-hankaku-kana")),
21+
"no-invalid-control-character": moduleInterop(require("@textlint-rule/textlint-rule-no-invalid-control-character")),
22+
"ja-no-weak-phrase": moduleInterop(require("textlint-rule-ja-no-weak-phrase")),
23+
"ja-no-successive-word": moduleInterop(require("textlint-rule-ja-no-successive-word")),
24+
"ja-no-abusage": moduleInterop(require("textlint-rule-ja-no-abusage")),
25+
"ja-no-redundant-expression": moduleInterop(require("textlint-rule-ja-no-redundant-expression")),
26+
"ja-unnatural-alphabet": moduleInterop(require("textlint-rule-ja-unnatural-alphabet"))
2727
},
2828
rulesConfig: {
2929
// # 1文の長さは100文字以下とする

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
},
3636
"dependencies": {
3737
"@textlint-rule/textlint-rule-no-invalid-control-character": "^1.2.0",
38-
"interop-require": "^1.0.0",
39-
"textlint-rule-ja-no-abusage": "^1.2.2",
38+
"@textlint/module-interop": "^1.0.1",
39+
"textlint-rule-ja-no-abusage": "^2.0.0",
4040
"textlint-rule-ja-no-mixed-period": "^2.1.1",
4141
"textlint-rule-ja-no-redundant-expression": "^3.0.1",
4242
"textlint-rule-ja-no-successive-word": "^1.1.0",

yarn.lock

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@
99
dependencies:
1010
execall "^1.0.0"
1111

12-
"@textlint/ast-node-types@^4.0.2", "@textlint/ast-node-types@^4.2.1", "@textlint/ast-node-types@^4.2.3":
13-
version "4.2.3"
14-
resolved "https://registry.yarnpkg.com/@textlint/ast-node-types/-/ast-node-types-4.2.3.tgz#2fc57a14600ac4dc5136dc7fb9793ac064bbd864"
15-
integrity sha512-5zqbMpeWk1B3AUkAmI5d3Y6CWqQNXeLKbdOGkwkvM0NSvhnlpAVooJ348lyfk8AwEQwzRVtAacQVXmIhdCwLGA==
12+
"@textlint/ast-node-types@^4.0.2", "@textlint/ast-node-types@^4.2.1", "@textlint/ast-node-types@^4.2.4":
13+
version "4.2.4"
14+
resolved "https://registry.yarnpkg.com/@textlint/ast-node-types/-/ast-node-types-4.2.4.tgz#ae569bd76364040939044d057d5a56284563a7af"
15+
integrity sha512-ggiixpScxgdMY42b6UafD1iUboSvl9k3vGA9kynP+kd6mEhTDzxtb1aHPDAnV+DpAEw4qpHMz72GBFkX/iOSFw==
16+
17+
"@textlint/module-interop@^1.0.1":
18+
version "1.0.1"
19+
resolved "https://registry.yarnpkg.com/@textlint/module-interop/-/module-interop-1.0.1.tgz#765ca9ccb9b66657d65061d3546b3fe51e48c983"
20+
integrity sha512-gqx1Te+lMnXX6xyGTUdzGhm8RT7IfiSRMtWoH1FeTMg2InArRT+lTksCFc/x5dtaPN4vwOFZUvU8oTzYQzXbyg==
1621

1722
"@textlint/regexp-string-matcher@^1.0.2":
1823
version "1.0.2"
@@ -27,11 +32,11 @@
2732
to-regex "^3.0.2"
2833

2934
"@textlint/types@^1.1.2":
30-
version "1.2.0"
31-
resolved "https://registry.yarnpkg.com/@textlint/types/-/types-1.2.0.tgz#4850e8438f220523603d3891ca80f866a56f0226"
32-
integrity sha512-fHnzTVfjPrbr8ycUOGxp0bfosHOvA79PpZGraUBy9s3njNuf8V2zp864YSLikGeOkMe1Gql6vALTKIFjq9ZDDQ==
35+
version "1.2.1"
36+
resolved "https://registry.yarnpkg.com/@textlint/types/-/types-1.2.1.tgz#24e1d6e1ac82038f84cea57ead58eeaf247c9e5b"
37+
integrity sha512-HNbVS+F9hNy4E/Hnv2mV/6rjlPB7Mdc5KCiT+uFjMK7vqiVuW/DeKjkYScRirQ0jf8gWUXBVTxZgwBBlJZmV1Q==
3338
dependencies:
34-
"@textlint/ast-node-types" "^4.2.3"
39+
"@textlint/ast-node-types" "^4.2.4"
3540

3641
amp-create-callback@^1.0.0:
3742
version "1.0.1"
@@ -164,11 +169,11 @@ assign-symbols@^1.0.0:
164169
integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=
165170

166171
async@^2.0.1:
167-
version "2.6.2"
168-
resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381"
169-
integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==
172+
version "2.6.3"
173+
resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff"
174+
integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==
170175
dependencies:
171-
lodash "^4.17.11"
176+
lodash "^4.17.14"
172177

173178
autolinker@~0.15.0:
174179
version "0.15.3"
@@ -270,7 +275,7 @@ color-name@1.1.3:
270275
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
271276
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
272277

273-
commandpost@^1.0.1, commandpost@^1.2.1:
278+
commandpost@^1.2.1:
274279
version "1.4.0"
275280
resolved "https://registry.yarnpkg.com/commandpost/-/commandpost-1.4.0.tgz#89218012089dfc9b67a337ba162f15c88e0f1048"
276281
integrity sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==
@@ -568,11 +573,6 @@ inherits@2, inherits@^2.0.3, inherits@~2.0.3:
568573
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
569574
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
570575

571-
interop-require@^1.0.0:
572-
version "1.0.0"
573-
resolved "https://registry.yarnpkg.com/interop-require/-/interop-require-1.0.0.tgz#e53103679944c88d7e6105b62a9f4475c783971e"
574-
integrity sha1-5TEDZ5lEyI1+YQW2Kp9EdceDlx4=
575-
576576
invert-kv@^2.0.0:
577577
version "2.0.0"
578578
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02"
@@ -725,7 +725,7 @@ joyo-kanji@^0.2.1:
725725
resolved "https://registry.yarnpkg.com/joyo-kanji/-/joyo-kanji-0.2.1.tgz#5e2e8ea2b903ba9333f1680c66902fc9682ea592"
726726
integrity sha1-Xi6OorkDupMz8WgMZpAvyWgupZI=
727727

728-
js-yaml@3.13.1, js-yaml@^3.6.1, js-yaml@^3.8.1, js-yaml@^3.9.1:
728+
js-yaml@3.13.1, js-yaml@^3.8.1, js-yaml@^3.9.1:
729729
version "3.13.1"
730730
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
731731
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
@@ -808,10 +808,10 @@ lodash.uniqwith@^4.5.0:
808808
resolved "https://registry.yarnpkg.com/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz#7a0cbf65f43b5928625a9d4d0dc54b18cadc7ef3"
809809
integrity sha1-egy/ZfQ7WShiWp1NDcVLGMrcfvM=
810810

811-
lodash@^4.17.11:
812-
version "4.17.14"
813-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba"
814-
integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==
811+
lodash@^4.17.11, lodash@^4.17.14:
812+
version "4.17.15"
813+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
814+
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
815815

816816
log-symbols@2.2.0:
817817
version "2.2.0"
@@ -951,11 +951,31 @@ morpheme-match-all@^1.1.0, morpheme-match-all@^1.2.0:
951951
dependencies:
952952
morpheme-match "^1.2.1"
953953

954+
morpheme-match-all@^2.0.1:
955+
version "2.0.1"
956+
resolved "https://registry.yarnpkg.com/morpheme-match-all/-/morpheme-match-all-2.0.1.tgz#b520262f9026a51ec102687bb36bcf07284e54c4"
957+
integrity sha512-KrVokpD3Fj5g8UfU8uqFERNaJJFwEikRRZY1BAUjGtbNe7RYMxc+MzwcWxL9kcJKigU0Qan9m1jAbRUhXVPhqw==
958+
dependencies:
959+
morpheme-match "^2.0.0"
960+
961+
morpheme-match-textlint@^2.0.0:
962+
version "2.0.3"
963+
resolved "https://registry.yarnpkg.com/morpheme-match-textlint/-/morpheme-match-textlint-2.0.3.tgz#8740848bc6b0b04695dc985a61ece346bd1ac7b4"
964+
integrity sha512-OCz4/PsQzOrZO5JDLF/IIynvArhnSfCr4jHiTXhy0Gsz3yGtYHUbaZZFFoqCBD66+EbCUeMYK4E8CkMhgJ3+Dw==
965+
dependencies:
966+
morpheme-match "^2.0.0"
967+
morpheme-match-all "^2.0.1"
968+
954969
morpheme-match@^1.0.1, morpheme-match@^1.2.1:
955970
version "1.2.1"
956971
resolved "https://registry.yarnpkg.com/morpheme-match/-/morpheme-match-1.2.1.tgz#783cdcf9feb0e8e7da7e794a8a38f6d711796aa0"
957972
integrity sha512-SSIcFPas4Dctx5PbrfKbW5XNADlkcn38LI+fqgB9QtminQ7FXeOR3//rnAmooZ1/5zTGeFoi8H9kFBAH9y1nfQ==
958973

974+
morpheme-match@^2.0.0:
975+
version "2.0.0"
976+
resolved "https://registry.yarnpkg.com/morpheme-match/-/morpheme-match-2.0.0.tgz#d95916683e119d916335ffe54e79dfb0b2ceee6a"
977+
integrity sha512-6k8vkOliZVX4p3Ufknnlv+QshCRdkxc72b7MVq3Zo8l5dBVLuvM7L7VPnaQJwsWntI3xLLDzDLy84YMHrl35Qw==
978+
959979
ms@2.1.1:
960980
version "2.1.1"
961981
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
@@ -1106,14 +1126,6 @@ path-key@^2.0.0, path-key@^2.0.1:
11061126
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
11071127
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
11081128

1109-
prh@^1.0.1:
1110-
version "1.1.0"
1111-
resolved "https://registry.yarnpkg.com/prh/-/prh-1.1.0.tgz#1c22b2a1998daaa7445865e5c86fb30e5b8ebb33"
1112-
integrity sha1-HCKyoZmNqqdEWGXlyG+zDluOuzM=
1113-
dependencies:
1114-
commandpost "^1.0.1"
1115-
js-yaml "^3.6.1"
1116-
11171129
prh@^5.4.3:
11181130
version "5.4.3"
11191131
resolved "https://registry.yarnpkg.com/prh/-/prh-5.4.3.tgz#d3864a6de2f35c6603e33c700106dce01c22876d"
@@ -1414,14 +1426,14 @@ textlint-rule-helper@^2.0.0, textlint-rule-helper@^2.1.1:
14141426
structured-source "^3.0.2"
14151427
unist-util-visit "^1.1.0"
14161428

1417-
textlint-rule-ja-no-abusage@^1.2.2:
1418-
version "1.2.2"
1419-
resolved "https://registry.yarnpkg.com/textlint-rule-ja-no-abusage/-/textlint-rule-ja-no-abusage-1.2.2.tgz#6478a150d4dcea4e95bb88a2af92a2fcace1c5f0"
1420-
integrity sha512-lDRvfOCh41h0DnenGgfjstBNBh7EZP37r/q/24DP1PKWvVytOtiIxN048KEfm4sXjJZ/eSZOrZrfHqFm1uaiCw==
1429+
textlint-rule-ja-no-abusage@^2.0.0:
1430+
version "2.0.0"
1431+
resolved "https://registry.yarnpkg.com/textlint-rule-ja-no-abusage/-/textlint-rule-ja-no-abusage-2.0.0.tgz#b3f978258be128abf3d42ed4f694ea7fccc8cfed"
1432+
integrity sha512-CIqD6+0MZnQtv3VEHwFcSveBVowzIiqNxWFAVLYlwDiOx3NkOornOnYUPwerxF8NK2wiqdgrhdAfjTtjdtRQGQ==
14211433
dependencies:
14221434
kuromojin "^1.3.1"
1423-
morpheme-match "^1.0.1"
1424-
textlint-rule-prh "^3.1.1"
1435+
morpheme-match-textlint "^2.0.0"
1436+
textlint-rule-prh "^5.2.1"
14251437

14261438
textlint-rule-ja-no-mixed-period@^2.1.1:
14271439
version "2.1.1"
@@ -1588,16 +1600,7 @@ textlint-rule-preset-jtf-style@^2.3.3:
15881600
textlint-rule-helper "^2.0.0"
15891601
textlint-rule-prh "^5.0.0"
15901602

1591-
textlint-rule-prh@^3.1.1:
1592-
version "3.1.3"
1593-
resolved "https://registry.yarnpkg.com/textlint-rule-prh/-/textlint-rule-prh-3.1.3.tgz#0bd87537dd15c884dcffdeef0afcf9147cb30fc6"
1594-
integrity sha1-C9h1N90VyITc/97vCvz5FHyzD8Y=
1595-
dependencies:
1596-
prh "^1.0.1"
1597-
textlint-rule-helper "^2.0.0"
1598-
untildify "^3.0.2"
1599-
1600-
textlint-rule-prh@^5.0.0:
1603+
textlint-rule-prh@^5.0.0, textlint-rule-prh@^5.2.1:
16011604
version "5.2.1"
16021605
resolved "https://registry.yarnpkg.com/textlint-rule-prh/-/textlint-rule-prh-5.2.1.tgz#dcbb3ee674a9c63e7ba71f73b31d675571b874fc"
16031606
integrity sha512-RlVQRok7GnmuuCrNRSYbFqcpzJkH1g6OrVVrGE+S9drT1TzgsSSM8NkAQlP6kFnQ7fN4V7g4j6JBg0N3ArBpCg==
@@ -1705,7 +1708,7 @@ unorm@^1.4.1:
17051708
resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af"
17061709
integrity sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==
17071710

1708-
untildify@^3.0.2, untildify@^3.0.3:
1711+
untildify@^3.0.3:
17091712
version "3.0.3"
17101713
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"
17111714
integrity sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==

0 commit comments

Comments
 (0)