Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use isPlainStrNode helper #29

Merged
merged 1 commit into from
May 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packages/*"
],
"devDependencies": {
"lerna": "3.22.1"
"lerna": "4.0.0"
},
"scripts": {
"build": "lerna run build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"match-index": "^1.0.3",
"textlint-rule-helper": "^2.1.1"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function(context) {
const helper = new RuleHelper();
return {
[Syntax.Str](node){
if (helper.isChildNode(node, [Syntax.Link, Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
if (!helper.isPlainStrNode(node)) {
return;
}
const text = getSource(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"match-index": "^1.0.3",
"textlint-rule-helper": "^2.1.1"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function reporter(context) {
const helper = new RuleHelper();
return {
[Syntax.Str](node){
if (helper.isChildNode(node, [Syntax.Link, "LinkReference", Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
if (!helper.isPlainStrNode(node)) {
return;
}
const text = getSource(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"dependencies": {
"match-index": "^1.0.3",
"regx": "^1.0.4",
"textlint-rule-helper": "^2.1.1"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function reporter(context) {
const helper = new RuleHelper();
return {
[Syntax.Str](node){
if (helper.isChildNode(node, [Syntax.Link, "LinkReference", Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
if (!helper.isPlainStrNode(node)) {
return;
}
const text = getSource(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"match-index": "^1.0.3",
"textlint-rule-helper": "^2.1.1"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function reporter(context) {
const helper = new RuleHelper();
return {
[Syntax.Str](node){
if (helper.isChildNode(node, [Syntax.Link, "LinkReference", Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
if (!helper.isPlainStrNode(node)) {
return;
}
let text = getSource(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"match-index": "^1.0.1",
"textlint-rule-helper": "^2.0.0"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function reporter(context) {
const helper = new RuleHelper();
return {
[Syntax.Str](node){
if (helper.isChildNode(node, [Syntax.Link, "LinkReference", Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
if (!helper.isPlainStrNode(node)) {
return;
}
let text = getSource(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
"use strict";
import TextLintTester from "textlint-tester";
import rule from "../src/index";

var tester = new TextLintTester();
tester.run("疑問符(?)", rule, {
valid: [
"【原文】Does the reader understand the document?",
"【訳文】読者は文書の内容を理解しているでしょうか。",
"オプションを変更しますか?",
"A 社の成功の秘密とは? この本ではそれをご紹介します。",
"どう操作したらよいのか?というユーザーの疑問に答えます。"
"どう操作したらよいのか?というユーザーの疑問に答えます。",
"# どう操作したらよいのか?という",
"![どう操作したらよいのか?という](https://example.com)",
"[どう操作したらよいのか?という](https://example.com)",
"> どう操作したらよいのか?という",
"**どう操作したらよいのか?という**",
"[どう操作したらよいのか?という][]",
"[^どう操作したらよいのか?という]",
],
invalid: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/textlint-rule-ja-space-around-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"match-index": "^1.0.1",
"textlint-rule-helper": "^2.0.0"
"textlint-rule-helper": "^2.2.0"
}
}
2 changes: 1 addition & 1 deletion packages/textlint-rule-ja-space-around-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
},
"dependencies": {
"match-index": "^1.0.1",
"textlint-rule-helper": "^2.0.0"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"match-index": "^1.0.1",
"textlint-rule-helper": "^2.0.0"
"textlint-rule-helper": "^2.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ function reporter(context, options = {}) {
};
return {
[Syntax.Str](node){
const isIgnoredParentNode = helper.isChildNode(node, [
Syntax.Header, Syntax.Link, "LinkReference", Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis
]);
if (isIgnoredParentNode) {
if (!helper.isPlainStrNode(node)) {
return;
}
const text = getSource(node);
Expand Down
Loading