textlint-rule-ja-space-after-exclamation
Advanced tools
Comparing version 2.4.1 to 2.4.2
{ | ||
"name": "textlint-rule-ja-space-after-exclamation", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "感嘆符前後のスペースについてのtexlintルール", | ||
@@ -38,3 +38,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "3dd855f120d272d06419273766ab57ecc04264c5" | ||
"gitHead": "9d642c1d8c9b812d4bb5778e19eeb16e1faefc22" | ||
} |
@@ -8,9 +8,9 @@ // LICENSE : MIT | ||
*/ | ||
import {RuleHelper} from "textlint-rule-helper"; | ||
import {matchCaptureGroupAll} from "match-index"; | ||
import { RuleHelper } from "textlint-rule-helper"; | ||
import { matchCaptureGroupAll } from "match-index"; | ||
function reporter(context) { | ||
const {Syntax, RuleError, report, fixer, getSource} = context; | ||
const { Syntax, RuleError, report, fixer, getSource } = context; | ||
const helper = new RuleHelper(); | ||
return { | ||
[Syntax.Str](node){ | ||
[Syntax.Str](node) { | ||
if (!helper.isPlainStrNode(node)) { | ||
@@ -23,8 +23,11 @@ return; | ||
const matchAfter = /!( )[^\n]/; | ||
matchCaptureGroupAll(text, matchAfter).forEach(match => { | ||
const {index} = match; | ||
return report(node, new RuleError("文末に感嘆符を使用し、後に別の文が続く場合は、直後に全角スペースを挿入します。", { | ||
index: index, | ||
fix: fixer.replaceTextRange([index, index + 1], " ") | ||
})); | ||
matchCaptureGroupAll(text, matchAfter).forEach((match) => { | ||
const { index } = match; | ||
return report( | ||
node, | ||
new RuleError("文末に感嘆符を使用し、後に別の文が続く場合は、直後に全角スペースを挿入します。", { | ||
index: index, | ||
fix: fixer.replaceTextRange([index, index + 1], " ") | ||
}) | ||
); | ||
}); | ||
@@ -31,0 +34,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9213
81