Skip to content

Commit 602e9a0

Browse files
authoredSep 29, 2020
fix(4.3.1): revert #76 (#80)
1 parent bc2630b commit 602e9a0

File tree

6 files changed

+46
-45
lines changed

6 files changed

+46
-45
lines changed
 

‎src/4.3.1.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ function reporter(context) {
3131
// 半角のかっこ()は使用しないで全角のかっこを使用する
3232
const text = getSource(node);
3333
const matchRegExps = [
34-
rx`([\(\)])(?:.*${japaneseRegExp}+.*)([\(\)])`,
35-
rx`([\(\)])(?:.*${japaneseRegExp})`,
36-
rx`(?:${japaneseRegExp}.*)([\(\)])`
34+
// FIXME: https://github.com/textlint-ja/textlint-rule-preset-JTF-style/issues/79
35+
// rx`([\(\)])(?:${japaneseRegExp}+)([\(\)])`,
36+
// rx`([\(\)])(?:${japaneseRegExp})`,
37+
rx`(?:${japaneseRegExp})([\(\)])`
3738
];
3839
matchRegExps.forEach(matchRegExp => {
3940
matchCaptureGroupAll(text, matchRegExp).forEach(match => {

‎test/4.3.1-test.js

+39-31
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ import TextLintTester from "textlint-tester";
44
import rule from "../src/4.3.1.js";
55
var tester = new TextLintTester();
66
tester.run("4.3.1.丸かっこ()", rule, {
7-
valid: ["クォーク(物質の素粒子)", "(物質の素粒子)", "(npm 2.x以上をインストールしている必要があります)"],
7+
valid: [
8+
"クォーク(物質の素粒子)",
9+
"(物質の素粒子)",
10+
"(npm 2.x以上をインストールしている必要があります)",
11+
// 英語のみの半角括弧は許可
12+
// https://github.com/textlint-ja/textlint-rule-preset-JTF-style/issues/79
13+
"これは (English text in half-width parens) です。"
14+
],
815
invalid: [
916
{
1017
// 半角かっこ
@@ -21,36 +28,37 @@ tester.run("4.3.1.丸かっこ()", rule, {
2128
}
2229
]
2330
},
24-
{
25-
// 半角かっこ
26-
text: "(物質の素粒子)",
27-
output: "(物質の素粒子)",
28-
errors: [
29-
{
30-
message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
31-
column: 1
32-
},
33-
{
34-
message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
35-
column: 8
36-
}
37-
]
38-
},
39-
{
40-
// 半角かっこ
41-
text: "(npm 2.x以上をインストールしている必要があります)",
42-
output: "(npm 2.x以上をインストールしている必要があります)",
43-
errors: [
44-
{
45-
message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
46-
column: 1
47-
},
48-
{
49-
message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
50-
column: 29
51-
}
52-
]
53-
},
31+
// // FIXME: https://github.com/textlint-ja/textlint-rule-preset-JTF-style/issues/79
32+
// {
33+
// // 半角かっこ
34+
// text: "(物質の素粒子)",
35+
// output: "(物質の素粒子)",
36+
// errors: [
37+
// {
38+
// message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
39+
// column: 1
40+
// },
41+
// {
42+
// message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
43+
// column: 8
44+
// }
45+
// ]
46+
// },
47+
// {
48+
// // 半角かっこ
49+
// text: "(npm 2.x以上をインストールしている必要があります)",
50+
// output: "(npm 2.x以上をインストールしている必要があります)",
51+
// errors: [
52+
// {
53+
// message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
54+
// column: 1
55+
// },
56+
// {
57+
// message: "半角のかっこ()が使用されています。全角のかっこ()を使用してください。",
58+
// column: 29
59+
// }
60+
// ]
61+
// },
5462
{
5563
// 半角かっこ
5664
text: "例)test",

‎test/fixer-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe("fixer-test", function() {
1818
for (var i = 0; i < inputs.length; i++) {
1919
const input = inputs[i];
2020
const output = outputs[i];
21-
assert.equal(input, output);
21+
assert.strictEqual(input, output);
2222
}
2323
});
2424
});

‎test/fixtures/input.md

-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ A氏は「5月に新製品を発売します。」と述べました。
8585

8686
クォーク(物質の素粒子)
8787

88-
(物質の素粒子)
89-
90-
(npm 2.x以上をインストールしている必要があります)
91-
9288
例)test
9389

9490
半角[かっこ

‎test/fixtures/output.md

-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ A氏は「5月に新製品を発売します」と述べました。
8585

8686
クォーク(物質の素粒子)
8787

88-
(物質の素粒子)
89-
90-
(npm 2.x以上をインストールしている必要があります)
91-
9288
例)test
9389

9490
半角[かっこ

‎tool/create-fixtures.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const RESULT = {
1111
function processFile(filePath) {
1212
const contents = fs.readFileSync(filePath, "utf-8");
1313
const lines = contents.split(/\n/);
14-
const inputRegExp = /text:\s*?"(.*?)"/;
15-
const outputRegExp = /output:\s*?"(.*?)"/;
14+
const inputRegExp = /^\s+text:\s*?"(.*?)"/;
15+
const outputRegExp = /^\s+output:\s*?"(.*?)"/;
1616
lines.forEach(function(line, index) {
1717
const nextLine = lines[index + 1];
1818
if (inputRegExp.test(line) && outputRegExp.test(nextLine)) {

0 commit comments

Comments
 (0)
Please sign in to comment.