Feature/chore dev setting - #25
Conversation
Walkthroughフォーマッティングツール oxfmt の設定とスクリプトを追加し、プロジェクト全体の code formatting を統一。README を日本語化し、ソースコードの引用符とセミコロンを正規化。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
webapp/frontend/react/README.md (1)
78-87: コードブロックに言語指定を追加してください。ディレクトリ構造のコードブロックに言語指定がありません。
textまたはplaintextを指定することで、マークダウンリンターの警告を解消できます。📝 修正案
-``` +```text react/ ├── src/ # ソースコード🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@webapp/frontend/react/README.md` around lines 78 - 87, Update the fenced code block in the README.md that shows the react/ directory tree by adding a language identifier (e.g., text or plaintext) to the opening triple backticks so the block becomes ```text (or ```plaintext) instead of just ```, addressing the markdown linter warning; locate the directory tree block in the react/ README and change only the opening fence language specifier for the existing code block.webapp/frontend/react/src/App.tsx (1)
60-63: 型定義と実際の使用方法に不整合があります。
PressRelease型ではcontentがstringですが、Line 57 でJSON.parse(data.content)の結果を渡しています。実際にはパース済みのオブジェクトを受け取るため、型定義を修正することを検討してください。♻️ 修正案
type PressRelease = { title: string; - content: string; + content: Record<string, unknown>; };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@webapp/frontend/react/src/App.tsx` around lines 60 - 63, PressRelease 型と実際の使用が不整合なので、型定義を修正してください: 現在の type PressRelease の content を string のままにせず、JSON.parse(data.content) の戻り値を受け取れる型(例えば content: unknown または content: Record<string, any> / a specific interface matching the parsed shape)に変更し、必要に応じて該当箇所で型アサーションやバリデーション(JSON.parse を呼んでいる箇所の変数名 data と呼ばれる値の検証)を追加して型安全を保ってください。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@webapp/frontend/react/src/App.tsx`:
- Line 77: editor が null の可能性を考慮していないため content に直接 editor.getJSON()
を使うとクラッシュします。content を設定する箇所で editor を先にチェックし(editor !== null または if (!editor)
return / 空オブジェクトをセットなど)、editor が存在する場合のみ editor.getJSON() を呼び出すように修正してください(参照:
editor 変数、getJSON メソッド、useEditor フック)。
---
Nitpick comments:
In `@webapp/frontend/react/README.md`:
- Around line 78-87: Update the fenced code block in the README.md that shows
the react/ directory tree by adding a language identifier (e.g., text or
plaintext) to the opening triple backticks so the block becomes ```text (or
```plaintext) instead of just ```, addressing the markdown linter warning;
locate the directory tree block in the react/ README and change only the opening
fence language specifier for the existing code block.
In `@webapp/frontend/react/src/App.tsx`:
- Around line 60-63: PressRelease 型と実際の使用が不整合なので、型定義を修正してください: 現在の type
PressRelease の content を string のままにせず、JSON.parse(data.content) の戻り値を受け取れる型(例えば
content: unknown または content: Record<string, any> / a specific interface
matching the parsed shape)に変更し、必要に応じて該当箇所で型アサーションやバリデーション(JSON.parse
を呼んでいる箇所の変数名 data と呼ばれる値の検証)を追加して型安全を保ってください。
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
webapp/frontend/react/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (8)
webapp/frontend/react/.oxfmtrc.jsonwebapp/frontend/react/README.mdwebapp/frontend/react/eslint.config.jswebapp/frontend/react/package.jsonwebapp/frontend/react/src/App.tsxwebapp/frontend/react/src/main.tsxwebapp/frontend/react/tsconfig.jsonwebapp/frontend/react/vite.config.ts
| content: JSON.stringify(editor.getJSON()) | ||
| }) | ||
| } | ||
| content: JSON.stringify(editor.getJSON()), |
There was a problem hiding this comment.
editor の null チェックが必要です。
useEditor は null を返す可能性があります。editor.getJSON() を呼び出す前に null チェックを追加してください。
🛡️ 修正案
const handleSave = () => {
+ if (!editor) return;
mutate({
title,
content: JSON.stringify(editor.getJSON()),
});
};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| content: JSON.stringify(editor.getJSON()), | |
| const handleSave = () => { | |
| if (!editor) return; | |
| mutate({ | |
| title, | |
| content: JSON.stringify(editor.getJSON()), | |
| }); | |
| }; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@webapp/frontend/react/src/App.tsx` at line 77, editor が null の可能性を考慮していないため
content に直接 editor.getJSON() を使うとクラッシュします。content を設定する箇所で editor
を先にチェックし(editor !== null または if (!editor) return / 空オブジェクトをセットなど)、editor
が存在する場合のみ editor.getJSON() を呼び出すように修正してください(参照: editor 変数、getJSON メソッド、useEditor
フック)。
There was a problem hiding this comment.
useEditor の immediatelyRender オプションが false だと null を返す可能性がありますが、デフォルトで true でnull を返さないためnull チェックは不要です
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
TipTap useEditor immediatelyRender option default behavior
💡 Result:
In Tiptap’s React useEditor, immediatelyRender defaults to true (the editor is created/rendered on the first render on the client). If you set immediatelyRender: false, it defers initialization until after mount (e.g., via useEffect), which is the recommended setting for SSR to avoid hydration issues. [1], [2], [3]
Practical rule:
- CSR-only app: leave default (
true) - Next.js / SSR: set
immediatelyRender: false[2], [3]
Sources:
[1] @tiptap/react useEditor.ts (UNPKG)
[2] Tiptap React install/SSR docs
[3] @tiptap/[email protected] release notes summary (new immediatelyRender behavior)
🌐 Web query:
TipTap useEditor return type null immediatelyRender true
💡 Result:
In Tiptap React, useEditor can be Editor | null—and you should treat it as nullable even if you set immediatelyRender: true.
Why it can be null
- The hook’s implementation returns
Editor | null, and its “server snapshot” is alwaysnull(so in SSR/Next it will benullduring server render). [1] - In the source, the initial editor is only created immediately when
immediatelyRenderis truthy and you’re not in SSR; otherwise it returnsnull. [1] - Tiptap’s docs recommend
immediatelyRender: falsefor SSR and rendering a placeholder until the editor is ready. [2]
What to do in your code
Guard for null on initial render:
const editor = useEditor({ extensions: [...], content: '...', immediatelyRender: true })
if (!editor) return null // or a loading UI
return <EditorContent editor={editor} />If you’re in Next.js / SSR, set:
immediatelyRender: falseand show a loading state until it initializes on the client. [2]
Sources:
[1] @tiptap/react useEditor.ts (implementation + overloads, SSR snapshot is null, initial editor creation logic) https://app.unpkg.com/@tiptap/[email protected]/files/src/useEditor.ts
[2] Tiptap React composable API guide (SSR + immediatelyRender) https://tiptap.dev/docs/guides/react-composable-api
@kirikirisu さん、ご説明ありがとうございます。
immediatelyRender のデフォルトが true である点については仰る通りです。ただし、TipTap の useEditor フックの型定義は Editor | null となっており、immediatelyRender: true の場合でも初回レンダリング時に null になる可能性があります。
特に、Tiptap のドキュメントでは初回レンダリング時の null チェックを推奨しています。このプロジェクトは CSR のみの環境のようですので、実際には問題が起きない可能性が高いですが、TypeScript の型安全性の観点からは null チェックを追加しておく方が安全です。
ただし、実装の判断はプロジェクトの方針次第ですので、現状のままで問題ないとお考えであれば、そのままで構いません。
🧠 Learnings used
Learnt from: EC-9624
Repo: PRTIMES/prtimes-frontend PR: 11148
File: apps/prtimes/src/features/analytics/pages/release-report-detail/components/heat-map-report-tab-content/index.tsx:118-125
Timestamp: 2025-10-23T07:55:11.614Z
Learning: In apps/prtimes/src/features/analytics/pages/release-report-detail/components/heat-map-report-tab-content/index.tsx, the HTML content retrieved from pressReleaseEditorApi.getPressRelease (contentData?.head and contentData?.text) is already sanitized on the server side, so additional client-side sanitization with DOMPurify is not required when using dangerouslySetInnerHTML.
Learnt from: EC-9624
Repo: PRTIMES/prtimes-frontend PR: 12271
File: apps/prtimes/src/features/press-release-editor-v3/states/jotai/reservation.ts:0-0
Timestamp: 2026-01-27T01:47:35.636Z
Learning: Repo: PRTIMES/prtimes-frontend - Jotaiの`createStore`を`import {atom, type createStore, useSetAtom} from 'jotai'`のようにtype修飾子付きでインポートし、`ReturnType<typeof createStore>`で使用するパターンは問題なく動作する。TypeScriptのタイプチェックをパスする。
Learnt from: miyabin4113
Repo: PRTIMES/prtimes-frontend PR: 12112
File: apps/prtimes/src/features/press-release-editor-v3/tiptap/extensions/heading/index.ts:27-33
Timestamp: 2026-01-20T02:01:09.618Z
Learning: PRTIMES/prtimes-frontend リポジトリの apps/prtimes/src/features/press-release-editor-v3/tiptap/extensions/heading/index.ts において、`addOptions()` および `addCommands()` 内の `this.parent!()` の非null assertionは、TipTapの型のバグにより必要な記述である。`this.parent?.()` への変更は不要。
Learnt from: miyabin4113
Repo: PRTIMES/prtimes-frontend PR: 12406
File: apps/prtimes/src/features/press-release-editor-v3/hooks/api/use-auto-save.tsx:171-206
Timestamp: 2026-02-05T07:04:31.299Z
Learning: PRTIMES/prtimes-frontend の apps/prtimes/src/features/press-release-editor-v3/hooks/api/use-auto-save.tsx では、PressReleaseImageAtomIdListState の重複画像削除処理は API 呼び出し前に実行される。これは保存時に毎回UI状態の不整合を即座に修正するためで、画像が上書き保存されるためサーバー側との一時的な不整合は許容される設計となっている。
Learnt from: lll-lll-lll-lll
Repo: PRTIMES/prtimes-frontend PR: 12734
File: apps/prtimes/src/features/press-release-editor-v3/layouts/pc/edit-template.tsx:0-0
Timestamp: 2026-02-25T03:43:27.914Z
Learning: PRTIMES/prtimes-frontend の apps/prtimes/src/features/press-release-editor-v3/layouts/pc/edit-template.tsx において、編集画面オープン時のブロックリストドメイン判定API (verifyBlocklistDomains) で例外が発生した場合は、エラーを握りつぶして編集作業を継続可能な状態にする。これは補助的な警告機能であるため、検証失敗時もユーザーの編集作業を妨げないフェイルセーフ設計が採用されている。
Learnt from: lll-lll-lll-lll
Repo: PRTIMES/prtimes-frontend PR: 12734
File: apps/prtimes/src/features/press-release-editor-v3/hooks/use-press-release-editor-step/index.ts:0-0
Timestamp: 2026-02-26T04:25:39.126Z
Learning: PRTIMES/prtimes-frontend の apps/prtimes/src/features/press-release-editor-v3/hooks/use-press-release-editor-step において、システム管理者モード (isSystemAdminMode && releaseId > 0) の場合、ドメインブロックリスト検証 (verifyOnSave と checkCanToGoStep2) を意図的にスキップする。これはシステム管理者が補助的な警告機能をバイパスできる特別な権限を持つための設計。
Learnt from: lll-lll-lll-lll
Repo: PRTIMES/prtimes-frontend PR: 12733
File: apps/prtimes/src/features/press-release-editor-v3/hooks/use-verify-blocklist-domains/index.ts:0-0
Timestamp: 2026-02-25T04:33:11.959Z
Learning: PRTIMES/prtimes-frontend の apps/prtimes/src/features/press-release-editor-v3/hooks/use-verify-blocklist-domains において、現在のエラーハンドリング実装は暫定的なもので、将来的にTanStack Queryのエラーハンドリング機構に統合される予定。そのため、catch ブロック内の error シリアライズ処理の改善は不要。
<!-- [add_learning]
Learnt from: miyabin4113
Repo: PRTIMES/prtimes-frontend PR: 12406
File: apps/prtimes/src/features/press-release-editor-v3/pages/step2/PressReleaseFile/ImageInserter/index.tsx:49-67
Timestamp: 2026-02-05T05:01:32.353Z
Learning: PRTIMES/prtimes-frontend リポジトリの apps/prtimes/src/features/press-release-editor-v3 配下では、img.src に署名付き URL や認証トークンなどのセンシティブな情報は含まれていないため、noticeError などのログ出力に img.src をそのまま使用しても問題ない。
Learnt from: codyzard
Repo: PRTIMES/prtimes-frontend PR: 12051
File: common/prtimes-company-admin-components/src/const/index.ts:1-6
Timestamp: 2026-01-06T02:19:36.935Z
Learning: Repo: PRTIMES/prtimes-frontend
prtimes-source側ではsnake_case形式を使用しているため、localStorageから読み込むexperimentsオブジェクトのプロパティもsnake_case形式となる。そのため、typescript-eslint/no-unsafe-assignmentルールを無効化することは妥当である。
Learnt from: miyabin4113
Repo: PRTIMES/prtimes-frontend PR: 12381
File: apps/prtimes/src/features/press-release-editor-v3/components/AnnouncementBanner/announcement-banner.stories.tsx:1-88
Timestamp: 2026-02-06T02:36:44.258Z
Learning: PRTIMES/prtimes-frontend リポジトリでは、人間のレビュアーがPRを確認する前に、CodeRabbitのレビューコメントを全てクローズ(解決)しておくことが好ましい。これは、CodeRabbitの指摘が正しかった場合だけでなく、指摘が誤りであった場合も含む。
Learnt from: shogogg
Repo: PRTIMES/prtimes PR: 13578
File: .coderabbit.yaml:1-40
Timestamp: 2025-12-03T04:43:28.405Z
Learning: In the PR `#13578` for PRTIMES-6211, the user shogogg is taking a two-step approach: first organizing and tidying the .coderabbit.yaml configuration file (current PR), then implementing the actual feature change to disable label suggestions (next PR).
Summary by CodeRabbit
リリースノート
ドキュメント
チューニング
スタイル