Skip to content

fix(lint): allowlist lines with no Japanese characters#1168

Merged
lacolaco merged 1 commit into
angular:mainfrom
lacolaco:fix/textlint-allow-english-only-lines
Jun 3, 2026
Merged

fix(lint): allowlist lines with no Japanese characters#1168
lacolaco merged 1 commit into
angular:mainfrom
lacolaco:fix/textlint-allow-english-only-lines

Conversation

@lacolaco
Copy link
Copy Markdown
Collaborator

@lacolaco lacolaco commented Jun 3, 2026

Summary

pnpm lint --fix の prh ルールが「日本語文字を1文字も含まない英文行」に対しても置換を行ってしまい、未翻訳のまま残された英文段落を シグナルフォームbuilds the field tree... のような日英混在の破綻状態にしてしまう問題への対処。

upstream sync 時に「上流に新規追加された英文をいったん未翻訳のまま .md に取り込み、翻訳は別途行う」という運用をしているが、その英文中に prh ルールでヒットする語 (Signal Forms 等) が含まれていると、後工程の pnpm lint --fix がその語だけを日本語に置換してしまい、文章として成立しない状態が生まれていた。

Change

.textlintrcfilters.allowlist.allow に、ひらがな・カタカナ・漢字を1文字も含まない行をマッチする正規表現を追加:

/^[^\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}\n]+$/mu

該当する行は textlint の全ルール評価から除外される。日本語が1文字でも含まれる行 (= 翻訳済み段落中に Signal Forms のような表記が混在しているケース) はこれまで通り prh が発火する。

Verification

  • 純英文行 (例: Signal Forms builds the field tree...) → 改修後は prh / ja-spacing いずれも発火しない (skip 成功)
  • 日本語段落中の Signal Formsprh: Signal Forms => シグナルフォーム は引き続き発火、ja-spacing も引き続き発火
  • 既存の翻訳済み .md 全体に対する pnpm lint → clean (副作用なし)

Test plan

  • pnpm lint で既存の翻訳済みファイル全件 clean
  • 純英文行で prh の誤発火が抑制される
  • 日本語混在行では prh / ja-spacing が引き続き発火する

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.
@lacolaco lacolaco merged commit 0058c7c into angular:main Jun 3, 2026
7 checks passed
@lacolaco lacolaco deleted the fix/textlint-allow-english-only-lines branch June 3, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant