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

4.3.1: 半角の開きかっこと閉じかっこのうち、後者しか全角に修正されない #74

Closed
massongit opened this issue Sep 11, 2020 · 2 comments
Labels
Type: Bug Bug or Bug fixes

Comments

@massongit
Copy link
Contributor

massongit commented Sep 11, 2020

開きかっこと閉じかっこがともに半角の丸かっこになっている文章を修正した場合、 両方とも全角になるのが正しいですが、実際には閉じかっこしか全角になりません。

<適用されるルール>
4.3.1.丸かっこ()

<対象の文章>

https://github.com/textlint-ja/textlint-rule-preset-JTF-style/blob/master/example/README.md

(npm 2.x以上をインストールしている必要があります)

<期待される修正結果>

(npm 2.x以上をインストールしている必要があります)

<実際の修正結果>

(npm 2.x以上をインストールしている必要があります)
@massongit massongit changed the title 閉じかっこしか全角に修正されない 4.3.1: 閉じかっこしか全角に修正されない Sep 11, 2020
@massongit massongit changed the title 4.3.1: 閉じかっこしか全角に修正されない 4.3.1: 半角の開きかっこと閉じかっこのうち、後者しか全角に修正されない Sep 11, 2020
@azu azu added the Type: Bug Bug or Bug fixes label Sep 11, 2020
@azu
Copy link
Member

azu commented Sep 11, 2020

最初にマッチした片方しかreportしてないため、片方だけfixされているようです。
両方をreportして、両方をfixすれば修正できそうな気がします。

report(
node,
new RuleError("半角のかっこ()が使用されています。全角のかっこ()を使用してください。", {
index: index,
fix: fixer.replaceTextRange([index, index + 1], replaceSymbol(match.text))
})
);

📝 ワークアラウンドとして、カッコが対となってないパターンを見つける@textlint-rule/textlint-rule-no-unmatched-pairというルールも補助的に使えますね

@azu
Copy link
Member

azu commented Sep 12, 2020

v2.3.5で修正済みであるためクローズします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

No branches or pull requests

2 participants