Skip to content

ESLintのecmaVersionを2022を変更と警告の解消#9278

Merged
komagata merged 4 commits intomainfrom
chore/eslint-ecma2022
Dec 3, 2025
Merged

ESLintのecmaVersionを2022を変更と警告の解消#9278
komagata merged 4 commits intomainfrom
chore/eslint-ecma2022

Conversation

@karlley
Copy link
Copy Markdown
Contributor

@karlley karlley commented Oct 21, 2025

Issue

概要

ESLintのecmaVersionを2022を変更と警告の解消

  • ESLIntのecmaVersionを2020 -> 2022に変更
  • ESLintの警告を自動修正するためにESLintのバージョンを7系 -> 8系に変更
    • 9系だと設定ファイルの記法が異なるなど大きく変更が必要なため8系を選択
    • 関連する依存モジュールもバージョンを変更
  • ESLintの自動修正でLint警告を解消

変更確認方法

  1. chore/eslint-ecma2022 をローカルに取り込む
  2. bin/yarn install で依存モジュールを追加
  3. npx eslint 'app/javascript/**/*.{js,vue,jsx}' で警告がでないことを確認
  4. foreman start -f Procfile.dev でアプリ起動
  5. 画面上でエラーが表示されず正常に表示されていることを確認

issueには期待する振る舞いについて「npx eslint . でエラーが出ないことを確認」と記載されていますが、app/javascript配下のみをLint対象にするためnpx eslint 'app/javascript/**/*.{js,vue,jsx}' での確認で問題無いことを確認済みです。詳細

Screenshot

画面上の変更は無し

Summary by CodeRabbit

リリースノート

  • 新機能

    • プロダクトチェッカーに「担当から外れる」ボタンを追加しました。
  • その他の改善

    • 開発ツールの設定を更新し、コード品質チェック機能を強化しました。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 21, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

ESLint設定をECMAScript 2022に更新し、report_templateコントローラーの.eslintignore除外を削除しています。StimulusコントローラーにStaticValuesを追加し、product-checkerに DOM操作ロジックを追加しました。

Changes

Cohort / File(s) Summary
ESLint設定の更新
.eslintignore, .eslintrc.json
.eslintignoreからreport_template_controller.jsの除外とコメント3行を削除。.eslintrc.jsonparserOptions.ecmaVersionを2020から2022に更新
Stimulusコントローラーの拡張
app/javascript/controllers/report_template_controller.js
static valuesブロックを新規追加。registeredTemplate (String)、registeredTemplateId (Number)、editing (Boolean)、isEditingTemplateValid (Boolean)の4つのプロパティを定義
プロダクトチェッカーの機能追加
app/javascript/product-checker.js
initProductChecker()内でevent.currentTargetの第1子要素にclassNametextContentを設定する2行を追加

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • report_template_controller.jsstatic values定義が適切に構成されているか確認が必要
  • product-checker.jsの新規追加コードがDOM操作として正しく機能するか確認

Possibly related PRs

Suggested reviewers

  • komagata

Poem

🐰 ESLint、新しい歳へアップグレード
Stimulus値たち、ひっそりと登場
DOM操作で、担当も外れる
✨ 小さな変更、大きな一歩

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは、ESLintのecmaVersionを2020から2022に変更し、警告を解消するという主な変更内容を適切に要約している。
Description check ✅ Passed プルリクエストの説明は、テンプレートの主要セクション(Issue、概要、変更確認方法)をすべて完備し、詳細な変更内容と検証手順が明記されている。

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/javascript/controllers/report_template_controller.js (1)

18-23: Stimulusの静的値定義に型の不整合があります。

static valuesの定義自体はStimulusの規約に従っており正しい形式ですが、editing: Booleanの型定義により重大な問題が顕在化しています。

49行目でthis.editingValue === this.registeredTemplateValueという比較が行われていますが、editingValueはBoolean型、registeredTemplateValueはString型として定義されています。この比較は意図した通りには動作しません。

143行目と152行目ではthis.editingValueにBoolean値(true/false)を設定している一方で、49行目では文字列との比較を期待しているようです。

49行目を以下のように修正することを推奨します:

-    if (this.editingValue === this.registeredTemplateValue) {
+    if (this.templateInputTarget.value === this.registeredTemplateValue) {

または、editingの用途を見直し、テンプレートの編集内容を保持する場合はString型として定義し直す必要があります。

🧹 Nitpick comments (1)
app/javascript/controllers/report_template_controller.js (1)

82-104: コーディングガイドラインに従い、fetchメソッドをrequest.jsに置き換えることを推奨します。

82-104行目および120-138行目でネイティブのfetchメソッドを使用していますが、プロジェクトのコーディングガイドラインではrequest.jsの使用が推奨されています。

既存のコードではありますが、このPRでESLintの設定を更新するタイミングで、合わせて修正することを検討してください。

As per coding guidelines

Also applies to: 120-138

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5172738 and ae2d5e9.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (18)
  • .eslintignore (0 hunks)
  • .eslintrc.json (1 hunks)
  • app/javascript/card.js (1 hunks)
  • app/javascript/checkable_react.js (1 hunks)
  • app/javascript/controllers/report_template_controller.js (1 hunks)
  • app/javascript/initializeAnswer.js (1 hunks)
  • app/javascript/initializeComment.js (1 hunks)
  • app/javascript/micro-reports-edit.js (1 hunks)
  • app/javascript/new-answer.js (1 hunks)
  • app/javascript/practice_memo.js (1 hunks)
  • app/javascript/product-checker.js (1 hunks)
  • app/javascript/product_checker.js (1 hunks)
  • app/javascript/reaction.js (1 hunks)
  • app/javascript/survey_result_chart.js (1 hunks)
  • app/javascript/textarea-autocomplte-emoji.js (1 hunks)
  • app/javascript/textarea-initializer.js (1 hunks)
  • app/javascript/vanillaToast.js (1 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .eslintignore
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit configuration file

**/*.js: - どうしても避けられない時以外に新規にVue.js, Reactのコードを追加しない。

  • fetchメソッドの代わりにrequest.jsを使う。

Files:

  • app/javascript/product-checker.js
  • app/javascript/reaction.js
  • app/javascript/practice_memo.js
  • app/javascript/textarea-autocomplte-emoji.js
  • app/javascript/controllers/report_template_controller.js
  • app/javascript/textarea-initializer.js
  • app/javascript/initializeAnswer.js
  • app/javascript/card.js
  • app/javascript/new-answer.js
  • app/javascript/survey_result_chart.js
  • app/javascript/checkable_react.js
  • app/javascript/product_checker.js
  • app/javascript/vanillaToast.js
  • app/javascript/micro-reports-edit.js
  • app/javascript/initializeComment.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (16)
app/javascript/card.js (1)

46-46: ES6オブジェクトプロパティの短縮構文が正しく適用されています。

Stripeカード要素の作成時にstyleプロパティの短縮構文を使用することで、コードがより簡潔になっています。動作に影響はありません。

app/javascript/product_checker.js (1)

14-14: オブジェクトプロパティの短縮構文が適切に適用されています。

titleプロパティの短縮構文により、コードの可読性が向上しています。

app/javascript/practice_memo.js (1)

102-102: 短縮構文の適用が正しく行われています。

memoプロパティの短縮構文により、パラメータ構築がより明瞭になっています。

app/javascript/checkable_react.js (1)

9-9: fetchオプションの短縮構文が適切に適用されています。

methodプロパティの短縮構文により、fetchの設定がより簡潔になっています。

.eslintrc.json (1)

22-22: ESLint設定のアップグレードが適切です。

ecmaVersionを2022に更新することで、このPRで適用されているオブジェクトプロパティの短縮構文などの新しいECMAScript機能がサポートされます。

app/javascript/initializeComment.js (1)

138-138: 短縮構文が正しく適用されています。

descriptionプロパティの短縮構文により、コメント更新のパラメータ構築がより簡潔になっています。

app/javascript/new-answer.js (1)

84-84: オブジェクトプロパティの短縮構文が適切に使用されています。

descriptionプロパティの短縮構文により、回答作成のパラメータがより読みやすくなっています。

app/javascript/initializeAnswer.js (1)

176-176: 短縮構文の適用が正しく行われています。

descriptionプロパティの短縮構文により、回答更新のパラメータ構築がより簡潔になっています。

app/javascript/product-checker.js (1)

33-33: ES6オブジェクトプロパティ短縮構文への変更が適切です

method: methodからmethodへの変更は、ES6の短縮構文を適用した適切なリファクタリングです。動作に影響はなく、コードがより簡潔になっています。

app/javascript/reaction.js (1)

41-41: ES6短縮構文の適用が正しく行われています

methodプロパティの短縮構文への変更は適切です。コードの可読性が向上し、モダンなJavaScriptのベストプラクティスに沿っています。

app/javascript/micro-reports-edit.js (1)

105-105: ネストされたオブジェクトでの短縮構文の適用が適切です

micro_reportオブジェクト内のcontentプロパティに短縮構文を適用した変更は正しく、コードの一貫性が保たれています。

app/javascript/vanillaToast.js (1)

5-5: 関数パラメータから設定オブジェクトへの短縮構文が正確です

Swal.fireの設定オブジェクトでtitleパラメータを短縮構文で渡す変更は適切です。コードがより簡潔で読みやすくなっています。

app/javascript/textarea-initializer.js (1)

50-50: Tributeライブラリの設定での短縮構文の適用が適切です

Tributeコンストラクタの設定オブジェクトでcollectionプロパティに短縮構文を適用した変更は正しく、モダンなJavaScriptの記述スタイルに準拠しています。

app/javascript/survey_result_chart.js (1)

323-323: Chart.jsプラグイン設定での短縮構文が正確です

annotationプラグインの設定でannotationsプロパティに短縮構文を適用した変更は適切です。Chart.jsの設定オブジェクトがより簡潔になっています。

app/javascript/textarea-autocomplte-emoji.js (1)

53-53: 配列マップ操作での短縮構文の適用が適切です

mapコールバック内で返されるオブジェクトリテラルのkeyプロパティに短縮構文を適用した変更は正しく、コードの一貫性が向上しています。

package.json (1)

71-75: ESLintのメジャーバージョンアップグレードが適切に実施されています

以下の依存関係の更新は、ECMAScript 2022の機能とES6短縮構文をサポートするために適切です:

  • eslintをバージョン8にアップグレード - ecmaVersion 2022のサポートを提供
  • eslint-config-standardをバージョン17にアップグレード - ESLint 8との互換性を確保
  • eslint-plugin-nバージョン16を追加 - 非推奨のeslint-plugin-nodeの後継

これらの変更により、プロジェクト全体でモダンなJavaScript構文の一貫した使用が可能になります。

@karlley karlley changed the title Chore/eslint ecma2022 ESLintのecmaVersionを2022を変更と警告の解消 Oct 21, 2025
@karlley
Copy link
Copy Markdown
Contributor Author

karlley commented Oct 21, 2025

@smallmonkeykey

お疲れ様です!
レビューをお願いしたいのですが対応可能でしょうか?
全然急いでいません🙇‍♂️

@smallmonkeykey
Copy link
Copy Markdown
Contributor

@karlley
おつかれさまです!レビュー承知しました!
明日から実家に帰省するため1週間ほどお時間いただいてもよろしいですか??💦

@karlley
Copy link
Copy Markdown
Contributor Author

karlley commented Oct 22, 2025

@smallmonkeykey

明日から実家に帰省するため1週間ほどお時間いただいてもよろしいですか??💦

はい、全然問題ないです!
レビューお願いいたします🙇‍♂️

Copy link
Copy Markdown
Contributor

@smallmonkeykey smallmonkeykey left a comment

Choose a reason for hiding this comment

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

おつかれさまです!
Approveいたします🙆

@karlley
Copy link
Copy Markdown
Contributor Author

karlley commented Nov 3, 2025

@smallmonkeykey
お忙しい中レビューありがとうございました🙇‍♂️

@okuramasafumi
メンバーレビュー完了しましたのでレビューお願いいたします!

Copy link
Copy Markdown
Contributor

@okuramasafumi okuramasafumi left a comment

Choose a reason for hiding this comment

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

LGTM!


ところで、CodeRabbitのレビューで、

新しい静的values設定を追加:registeredTemplate(String)、registeredTemplateId(Number)、editing(Boolean)、isEditingTemplateValid(Boolean)。リアクティブな値をコントローラーに導入。

ってなってるの面白いですね、実際には空行を追加しただけなのに。
多分だけど、AIは空行を認識しないので、変化が存在しないけど存在する、みたいな状況になってねつ造したんでしょうね。AIレビューの罠の一つかも。

@karlley
Copy link
Copy Markdown
Contributor Author

karlley commented Nov 5, 2025

@okuramasafumi

レビューありがとうございます!

AIは空行を認識しないので、変化が存在しないけど存在する、みたいな状況になってねつ造したんでしょうね。

なるほどです。
AIに頼る部分も増えているのでもっと慎重に見ていくように気をつけようと思います!

@karlley karlley force-pushed the chore/eslint-ecma2022 branch from ae2d5e9 to 1105e18 Compare November 9, 2025 20:53
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/javascript/reaction.js (1)

40-51: (参考)コーディングガイドラインについて

現在のコードは fetch メソッドを使用していますが、コーディングガイドラインでは fetch の代わりに request.js の使用が推奨されています。

ただし、このPRの範囲はESLintの自動修正であり、既存のコードに対する変更のため、今回は問題ありません。将来的なリファクタリングの際に検討いただければと思います。

Based on coding guidelines

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae2d5e9 and 1105e18.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • .eslintignore (0 hunks)
  • .eslintrc.json (1 hunks)
  • app/javascript/card.js (1 hunks)
  • app/javascript/controllers/report_template_controller.js (1 hunks)
  • app/javascript/initializeAnswer.js (1 hunks)
  • app/javascript/initializeComment.js (1 hunks)
  • app/javascript/micro-reports-edit.js (1 hunks)
  • app/javascript/new-answer.js (1 hunks)
  • app/javascript/practice_memo.js (1 hunks)
  • app/javascript/product-checker.js (1 hunks)
  • app/javascript/reaction.js (1 hunks)
  • app/javascript/survey_result_chart.js (1 hunks)
  • app/javascript/textarea-autocomplte-emoji.js (1 hunks)
  • app/javascript/textarea-initializer.js (1 hunks)
  • app/javascript/vanillaToast.js (1 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .eslintignore
🚧 Files skipped from review as they are similar to previous changes (12)
  • app/javascript/micro-reports-edit.js
  • app/javascript/practice_memo.js
  • app/javascript/initializeAnswer.js
  • .eslintrc.json
  • app/javascript/textarea-autocomplte-emoji.js
  • app/javascript/card.js
  • app/javascript/product-checker.js
  • app/javascript/survey_result_chart.js
  • app/javascript/initializeComment.js
  • app/javascript/controllers/report_template_controller.js
  • package.json
  • app/javascript/new-answer.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit configuration file

**/*.js: - どうしても避けられない時以外に新規にVue.js, Reactのコードを追加しない。

  • fetchメソッドの代わりにrequest.jsを使う。

Files:

  • app/javascript/reaction.js
  • app/javascript/vanillaToast.js
  • app/javascript/textarea-initializer.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (3)
app/javascript/vanillaToast.js (1)

5-5: ES6短縮プロパティ記法の適用、問題ありません。

title: title から title への変更は、ES6の短縮プロパティ記法を適用したもので、動作は変わりません。ESLintの自動修正が正しく適用されています。

app/javascript/textarea-initializer.js (1)

50-50: ES6短縮プロパティ記法の適用、問題ありません。

collection: collection から collection への変更は、ES6の短縮プロパティ記法を適用したもので、動作は変わりません。ESLintの自動修正が正しく適用されています。

app/javascript/reaction.js (1)

41-41: ES6短縮プロパティ記法の適用、問題ありません。

method: method から method への変更は、ES6の短縮プロパティ記法を適用したもので、動作は変わりません。ESLintの自動修正が正しく適用されています。

@karlley
Copy link
Copy Markdown
Contributor Author

karlley commented Nov 18, 2025

@komagata
メンターレビューが完了しましたのでmainブランチへのマージをお願いします。

@komagata
Copy link
Copy Markdown
Member

@karlley 確認が遅くなってすみません。conflictの修正をお願い致します。

@karlley karlley force-pushed the chore/eslint-ecma2022 branch from 1105e18 to 8c39172 Compare November 26, 2025 21:52
@karlley
Copy link
Copy Markdown
Contributor Author

karlley commented Dec 1, 2025

@komagata

conflictの修正をお願い致します。

修正いたしました!

@komagata komagata merged commit 0335297 into main Dec 3, 2025
2 checks passed
@komagata komagata deleted the chore/eslint-ecma2022 branch December 3, 2025 05:08
@komagata
Copy link
Copy Markdown
Member

komagata commented Dec 3, 2025

@karlley マージしました〜

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.

4 participants