Skip to content

refactor: best-practice-for-consecutive-definition-listをセレクター方式に書き換え#1321

Merged
AtsushiM merged 4 commits into
masterfrom
refactor/consecutive-definition-list-selector
May 18, 2026
Merged

refactor: best-practice-for-consecutive-definition-listをセレクター方式に書き換え#1321
AtsushiM merged 4 commits into
masterfrom
refactor/consecutive-definition-list-selector

Conversation

@AtsushiM

Copy link
Copy Markdown
Member

Summary

best-practice-for-consecutive-definition-listルールをセレクター方式に書き換えてコードを簡潔化しました。

変更内容

  • getPreviousSibling関数によるAST走査ロジックを削除
  • ESLintセレクターによる隣接要素検出に変更(6パターン)

セレクターパターン

  1. 直接隣接: A + B
  2. 空白のみJSXText経由: A + JSXText[value=/^\s*$/] + B
  3. 空式/コメント経由: A + JSXExpressionContainer[expression.type="JSXEmptyExpression"] + B
    4-6. 上記の組み合わせ

コード削減

  • 旧実装: 約50行(関数定義 + visitor)
  • 新実装: 約40行(セレクター定義のみ)

利点

  • コード簡潔化
  • セレクターで意図明確化
  • 保守性向上

Test plan

  • 既存テスト15件すべて通過

🤖 Generated with Claude Code

@AtsushiM AtsushiM marked this pull request as ready for review May 18, 2026 22:19
@AtsushiM AtsushiM requested a review from a team as a code owner May 18, 2026 22:19
@AtsushiM AtsushiM requested review from diescake and taconasu and removed request for a team May 18, 2026 22:19
@AtsushiM AtsushiM merged commit 9bb4b5a into master May 18, 2026
4 checks passed
@AtsushiM AtsushiM deleted the refactor/consecutive-definition-list-selector branch May 18, 2026 22:40
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