fix(lint): allowlist lines with no Japanese characters#1168
Merged
lacolaco merged 1 commit intoJun 3, 2026
Conversation
prh (and other textlint rules) was incorrectly firing on lines that contain no Japanese characters at all — most notably on English-only paragraphs left untranslated by the d-additive defer flow during `/update-origin`. `pnpm lint --fix` would then partially replace tokens like `Signal Forms` with `シグナルフォーム` inside an otherwise pure-English sentence, producing nonsensical bilingual fragments like `シグナルフォームbuilds the field tree...`. Add a textlint filter allowlist pattern that matches any single line containing no Hiragana / Katakana / Han characters and excludes it from rule evaluation. Multi-line English paragraphs are handled line-by-line, so each pure-English line is skipped while truly mixed lines (Japanese prose containing `Signal Forms`) still trigger prh correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pnpm lint --fixの prh ルールが「日本語文字を1文字も含まない英文行」に対しても置換を行ってしまい、未翻訳のまま残された英文段落をシグナルフォームbuilds the field tree...のような日英混在の破綻状態にしてしまう問題への対処。upstream sync 時に「上流に新規追加された英文をいったん未翻訳のまま
.mdに取り込み、翻訳は別途行う」という運用をしているが、その英文中に prh ルールでヒットする語 (Signal Forms等) が含まれていると、後工程のpnpm lint --fixがその語だけを日本語に置換してしまい、文章として成立しない状態が生まれていた。Change
.textlintrcのfilters.allowlist.allowに、ひらがな・カタカナ・漢字を1文字も含まない行をマッチする正規表現を追加:該当する行は textlint の全ルール評価から除外される。日本語が1文字でも含まれる行 (= 翻訳済み段落中に
Signal Formsのような表記が混在しているケース) はこれまで通り prh が発火する。Verification
Signal Forms builds the field tree...) → 改修後は prh / ja-spacing いずれも発火しない (skip 成功)Signal Forms→prh: Signal Forms => シグナルフォームは引き続き発火、ja-spacingも引き続き発火.md全体に対するpnpm lint→ clean (副作用なし)Test plan
pnpm lintで既存の翻訳済みファイル全件 clean