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

かっこ と スペースに関するルールの修正とオプションの追加 #127

Conversation

frozenbonito
Copy link
Contributor

close #81

#81 の Proposal を実装しました。

次のように解釈しています。問題があればご指摘いただければと思います。

4.3.1.丸かっこ() で かっこの内側または外側が日本語以外を含む、例外として半角かっこをエラーにしない

かっこの内側または外側が日本語以外のとき、例外的に半角かっこをエラーにしないようにしました。
ただし、かっこ内に 1 文字でも日本語が含まれている場合は全角かっこを必須としています。

3.3. かっこ類と隣接する文字の間のスペースの有無 に 半角かっこのときに外側のスペースを許容するというオプションを作成 (allowOutsideHalfParentheses) する

自然さを考慮して半角スペースのみを許容しています。

3.3. かっこ類と隣接する文字の間のスペースの有無 に 半角かっこのときに外側のスペースを必須にするというオプションを作成 (requireOutsideHalfParentheses) する

#81 (comment) の通り、「かっこの外側が日本語の場合のみ外側のスペースを必須」としています。

また、テストの都合上 tool/create-fixtures.js に options のサポートを追加しています。
fixer-test では様々なオプションの組み合わせをテストするのは難しいと判断し、単純に options が指定されているテストケースは無視するように変更しました。

Copy link
Member

@azu azu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。
よさそうな気がします。(エラーとなるケースが増えるはずなのでmajor updateにする予定です)

オプションについてREADMEに足せるといいのですが、既存だと他にオプションがないのでQ&A欄にrequireOutsideHalfParenthesesの利用例を書くとかになる感じですかね

Comment on lines +27 to +29
const requireOutsideHalfParentheses =
options.requireOutsideHalfParentheses ?? defaultOptions.requireOutsideHalfParentheses;
Copy link
Member

@azu azu Nov 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultOptions.requireOutsideHalfParentheses
こちらってデフォルト値が未定義になっています?
明示的に入れた方がいいので、 defaultOptions.requireOutsideHalfParentheses を定義するのがよさそうですね

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントありがとうございます。
すみません、こちらデフォルト値の定義が漏れていたため追加いたしました。

@frozenbonito frozenbonito force-pushed the improve-rules-about-parentheses-and-spacing branch from 378d68f to b30b5ce Compare December 1, 2024 14:12
@frozenbonito
Copy link
Contributor Author

オプションについてREADMEに足せるといいのですが、既存だと他にオプションがないのでQ&A欄にrequireOutsideHalfParenthesesの利用例を書くとかになる感じですかね

FAQ に 3.3 のオプションに関する設定例を追加してみました。

@frozenbonito frozenbonito requested a review from azu December 1, 2024 14:14
Copy link
Member

@azu azu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ありがとうございます!

@azu azu merged commit c09baf3 into textlint-ja:master Dec 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Breaking Change Includes breaking changes Type: Feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

かっこ と スペースに関するルールの修正とオプションの追加 3.3と4.3.1
2 participants