Releases: textlint-rule/textlint-rule-prh
Releases · textlint-rule/textlint-rule-prh
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
Breaking Change
Report error correctly when pattern starts with expected value #8
Problem
textlint-rule-prh does not report an error with a text "(図1) "
and the following rule:
# 全角括弧前後の空白を除去
- expected: )
pattern: /) | )/
Note: prh does fix the error with this rule.
Cause
This is because the following condition incorrectly ignore the error.
// Avoid accidental match(ignore case, expected contain actual pattern)
if (slicedText.indexOf(expected) === 0) {
return;
}
In this case, variables have the following values.
slicedText
:') '
matchedText
:') '
expected
:')'
I understand that the condition is introduced by f528e78 and cd739dc to fix s/Web/Web/i
problem and s/ベンダ/ベンダー/
problem. But prh itself does not handle s/ベンダ/ベンダー/
problem, i.e. prh corrects ベンダー
to ベンダーー
. So, I think s/ベンダ/ベンダー/
problem should be handled by rule (or changing prh's behavior). I believe incompatibility between prh and textlint-rule-prh is confusing.
Implementation
- Handle only
s/Web/Web/i
problem by code. - Handle
s/ベンダ/ベンダー/
problem by rule.
This fix the s/) /)/
problem.