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

backquoteを含む文字列の二重引用符チェック #89

Closed
ksato9700 opened this issue May 8, 2021 · 3 comments
Closed

backquoteを含む文字列の二重引用符チェック #89

ksato9700 opened this issue May 8, 2021 · 3 comments
Labels
Status: PR Welcome Welcome to Pull Request Type: Bug Bug or Bug fixes

Comments

@ksato9700
Copy link
Contributor

backquote (`) を含む文字列の二重引用符(")チェックがうまく動かない場合があるようです。

再現手順

設定(textlintrc)

{
  "rules": {
    "preset-jtf-style": true
  }
}

試した文章(test.md)

"a" "`a`"

実行結果

$ npx textlint -c ./textlintrc test.md
/tmp/bugreport/test.md
  1:9  error  "の対となる"が見つかりません。""  jtf-style/4.3.5.二重引用符

✖ 1 problem (1 error, 0 warnings)

期待する結果

正常終了する

実際の結果

対となる二重引用符が見つからないというエラーになる

@azu azu added the Type: Bug Bug or Bug fixes label May 8, 2021
@azu
Copy link
Member

azu commented May 8, 2021

ご報告ありがとうございます。

"`a`"

https://textlint.github.io/astexplorer/

AST的にNodeが次のように3つのNodeとして分解されます。

<Str><Code><Str>

個別の <Str> の中で " の対を探してるので見つけられてないみたいですね。
<Str><Str> を結合した中で探索するのが正しそうですね。

currentStrInParagraph.forEach((node) => {

@azu
Copy link
Member

azu commented May 8, 2021

📝 同じことをする別のルールは、Paragraphの中身で ペアを探索して、Codeの中は無視する実装だった
https://github.com/textlint-rule/textlint-rule-no-unmatched-pair/blob/1a030f2eae0941dea534b77fe0ecb8a9dde9e098/src/textlint-rule-no-unmatched-pair.js これはこれでコード内にペアがあるとおかしくなりそうな気がする…

@azu
Copy link
Member

azu commented May 11, 2021

https://github.com/textlint-ja/textlint-rule-preset-JTF-style/releases/tag/v2.3.10 としてリリースしました。
対応ありがとうございます!

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

No branches or pull requests

2 participants