Skip to content

Commit 3cc445b

Browse files
committed
feat(rule): add ないとはいいきれ-ない
1 parent dff70dc commit 3cc445b

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

src/no-doubled-negative-ja.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import NidemoNaiRule from "./rules/ないでも-ない";
77
import NimonodehaRule from "./rules/ないものでは-ない";
88
import NikotohanaiRule from "./rules/ないことは-ない";
99
import NiwakedehanaiRule from "./rules/ないわけでは-ない";
10+
import NaitohaiikirenaiRule from "./rules/ないとはいいきれ-ない";
1011
export default function (context) {
1112
const {Syntax,getSource, report,RuleError} = context;
1213
const ruleなくもない = NakumonaiRule(context);
1314
const ruleないでもない = NidemoNaiRule(context);
1415
const ruleないものではない = NimonodehaRule(context);
1516
const ruleないことはない = NikotohanaiRule(context);
1617
const ruleないわけではない = NiwakedehanaiRule(context);
18+
const ruleないとはいいきれない = NaitohaiikirenaiRule(context);
1719
return {
1820
[Syntax.Str](node){
1921
const text = getSource(node);
@@ -32,6 +34,7 @@ export default function (context) {
3234
pushError(ruleないものではない(token));
3335
pushError(ruleないことはない(token));
3436
pushError(ruleないわけではない(token));
37+
pushError(ruleないとはいいきれない(token));
3538
});
3639
}).then(()=> {
3740
results.forEach(error => {
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// LICENSE : MIT
2+
"use strict";
3+
/*
4+
(f) ないとはいいきれない
5+
*/
6+
import matchTokenStream from "./../matchTokenStream";
7+
export default function (context) {
8+
const {RuleError} = context;
9+
const matchPatternないといいきれない = matchTokenStream([
10+
{
11+
"basic_form": ["ない", "無い"]
12+
},
13+
{
14+
"surface_form": "と",
15+
"pos": "助詞"
16+
},
17+
{
18+
"reading": "イイ"
19+
},
20+
{
21+
"reading": "キレ",
22+
"pos": "動詞"
23+
},
24+
{
25+
"basic_form": ["ない", "無い"]
26+
}
27+
]);
28+
const matchPatternないとはいいきれない = matchTokenStream([
29+
{
30+
"basic_form": ["ない", "無い"]
31+
},
32+
{
33+
"surface_form": "と",
34+
"pos": "助詞"
35+
},
36+
{
37+
"surface_form": "は",
38+
"pos": "助詞"
39+
},
40+
{
41+
"reading": "イイ"
42+
},
43+
{
44+
"reading": "キレ",
45+
"pos": "動詞"
46+
},
47+
{
48+
"basic_form": ["ない", "無い"]
49+
}
50+
]);
51+
return (token) => {
52+
if (matchPatternないといいきれない(token)) {
53+
return new RuleError("二重否定: 〜ないといいきれない", {
54+
column: token.word_position - 1
55+
});
56+
}
57+
if (matchPatternないとはいいきれない(token)) {
58+
return new RuleError("二重否定: 〜ないとはいいきれない", {
59+
column: token.word_position - 1
60+
});
61+
}
62+
};
63+
}

test/no-doubled-negative-ja-test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,25 @@ tester.run("no-doubled-negative", rule, {
161161
column: 6
162162
}
163163
]
164+
},
165+
// f
166+
{
167+
text: "問題ないと言い切れない",
168+
errors: [
169+
{
170+
message: "二重否定: 〜ないといいきれない",
171+
column: 10
172+
}
173+
]
174+
},
175+
{
176+
text: "問題ないとは言い切れない",
177+
errors: [
178+
{
179+
message: "二重否定: 〜ないとはいいきれない",
180+
column: 11
181+
}
182+
]
164183
}
165184
]
166185
});

0 commit comments

Comments
 (0)