Skip to content

style: reformat with prettier v3 and resolve rubocop conflicts#393

Merged
merichar merged 17 commits intomasterfrom
style/prettier
Mar 6, 2026
Merged

style: reformat with prettier v3 and resolve rubocop conflicts#393
merichar merged 17 commits intomasterfrom
style/prettier

Conversation

@merichar
Copy link
Copy Markdown
Member

@merichar merichar commented Mar 2, 2026

  • Runs prettier v3 across 87 files to enforce consistent formatting
  • Adds config/locales/ and problematic ERB templates to .prettierignore to prevent parser failures on Rails %{interpolation} YAML syntax
  • Disables 7 rubocop Layout/Style cops that conflict with prettier's formatting decisions (running both tools would loop indefinitely)
  • Sets Style/EmptyMethod: EnforcedStyle: expanded so rubocop matches prettier's multi-line empty method output
  • Autocorrects Layout/EmptyLinesAfterModuleInclusion in event.rb and organization_timeline_entry.rb (non-conflicting, one-way)

THIS BRANCH STACKS ON PRs #388 #389 #390 #391 & #392 (Pls do those first)

* fix: rename camelCase local variables in tool_inventory_tool.rb
  (barcodeEquality, toolTypeEquality) and tool_inventory_tools_controller.rb
  (defaultErrorMsg, pathParams) to snake_case
* fix: rename is_booth_chair? to booth_chair? on Participant and all callers
* fix: rename is_red_hardhat? to red_hardhat? on Participant and all callers
* fix: rename is_checked_out? to checked_out? on Tool and ScissorLift and
  all callers
* fix: rename is_hardhat? to hardhat? on Tool and all callers
* fix: rename is_past_due to past_due? on Task and all callers
* fix: rename is_checked_in to checked_in? on Shift and all callers
* collapse empty method definitions to single line (Style/EmptyMethod)
* remove extra blank lines (Layout/EmptyLines)
* convert String#% to format() (Style/FormatString)
* convert remaining double-quoted strings to single quotes (Style/StringLiterals)
… line-length

* move include Messenger inside Event, OrganizationTimelineEntry, and Shift classes
* move include WebMock::API inside ActiveSupport::TestCase in test_helper
* wrap long commented-out lines in db/seeds.rb
* replace 55 Rails/I18nLocaleTexts violations across 21 controllers
  and 1 model with t() calls
* add locale keys under en: for applets, charge_types, charges,
  downtime, event_types, events, home, memberships, notes,
  organization_build_steps, organization_members,
  organization_timeline_entries, scissor_lift_checkouts, sessions,
  store/purchases, tasks, tool_inventory_tools, tool_types, tools
* use lazy t('.key') lookup in named action methods; explicit
  t('controller.action.key') in private helpers and rescue_from blocks
* extract participant phone_number validation message to activerecord
  error key en.activerecord.errors.models.participant.attributes
  .phone_number.format
* OrganizationBuildStatus -> organization_build_steps: destroy
* Participant -> organization_build_steps (approver): restrict_with_error
* Participant -> events (assignee): nullify
* StoreItem -> store_purchases: restrict_with_error
* ToolInventory -> tool_inventory_tools: destroy
* ToolType -> tools: restrict_with_error
* ToolType -> tool_inventory_tools: destroy
params.permit! in tools#index was used only to build a pagination
URL via url_for; replace with params.permit(:type, :page, :size)
to avoid allowing arbitrary params through
* add config/locales/ and specific ERB files to .prettierignore to
  prevent prettier YAML parser failures on %{interpolation} syntax
* disable Layout and Style cops in .rubocop.yml that conflict with
  prettier's formatting decisions (would create an autocorrect loop)
* set Style/EmptyMethod: EnforcedStyle: expanded to match prettier's
  multi-line empty method formatting
* reformat 85 source files with prettier v3
* autocorrect Layout/EmptyLinesAfterModuleInclusion in event.rb and
  organization_timeline_entry.rb (non-conflicting cop)
…nfig

* rename erblint executable reference in rake task: erblint -> erb_lint
* rename .erb-lint.yml to .erb_lint.yml (deprecated name)
* disable Layout cops in .erb_lint.yml that conflict with prettier
  (ArgumentAlignment, ElseAlignment, EndAlignment, IndentationWidth,
  FirstArrayElementIndentation)
* exclude dead reports/index.html.erb view (no controller or route)
* replace raw() on plain text strings with bare string literals in
  shifts/index.html.erb and downtime/index.html.erb
* replace <tr <%= raw('class="x"') %>> with <tr class="<%= %>"> in
  events/index, downtime/index, downtime/downtime, downtime/_sidebar,
  and tools/_tool
* replace link_to raw('<strong>...') with block form in tools/_tools
* rewrite raw("<option ...>") as proper ERB option tags in tasks/index
* add autocomplete: 'off' to bare text_field_tag inputs (checkouts,
  home, organizations, reports)
* add .to_json to ERB interpolations in JS context in
  memberships/new_old and participants/safety_briefings/_video
* fix commented-out ERB block in tool_inventory/_inventory
* remove extra blank line in organizations/_organizations
* delete app/views/organizations/_organizations.html.erb (orphaned
  partial, empty loop body, never rendered by any view)
* delete app/views/reports/index.html.erb (no controller or route,
  dead since initial commit 10 years ago)
* remove .erb_lint.yml exclude for deleted reports view
* remove .prettierignore entry for deleted organizations partial
merichar added 4 commits March 6, 2026 13:17
# Conflicts:
#	app/controllers/applets/ppe_collection_controller.rb
#	app/controllers/applets/ppe_distribution_controller.rb
#	app/controllers/application_controller.rb
#	app/controllers/charge_types_controller.rb
#	app/controllers/downtime_controller.rb
#	app/controllers/event_types_controller.rb
#	app/controllers/events_controller.rb
#	app/controllers/organization_members_controller.rb
#	app/controllers/store/purchases_controller.rb
#	app/controllers/tool_types_controller.rb
#	app/models/event.rb
#	app/models/organization_timeline_entry.rb
#	app/models/shift.rb
#	app/views/tools/_tool.html.erb
…files

* Expand single-line empty methods to multiline to match Style/EmptyMethod: expanded
  (faq, home, organizations, shifts controllers; carnegie_mellon_id_card, test_helper)
* Add frozen_string_literal comment to weather controller, helper, job,
  model, service, migration, and test files added in the weather feature
* Fix Style/StringLiterals in weather test files (single-quoted strings)
* Fix Minitest/EmptyLineBeforeAssertionMethods in weather controller test
* Fix Minitest/AssertPredicate in shift_test and task_test
* Reformat ppe_distribution_controller, downtime_controller, shift, and
  weather files with prettier v3
* Expand single-line empty methods to match Style/EmptyMethod: expanded
* Add frozen_string_literal comment to new weather feature files
* Fix Style/StringLiterals, Minitest/AssertPredicate, and
  Minitest/EmptyLineBeforeAssertionMethods in test files
…partial

* Revert raw 'class="warning"' to class="<%= 'warning' if ... %>"
  to fix Rails/OutputSafety violation introduced during merge conflict
  resolution
@merichar merichar merged commit 16d0707 into master Mar 6, 2026
1 check failed
@merichar merichar deleted the style/prettier branch March 19, 2026 20:21
katiez667 pushed a commit that referenced this pull request Mar 20, 2026
* fix(naming): rename non-snake_case variables and is_* predicate methods

* fix: rename camelCase local variables in tool_inventory_tool.rb
  (barcodeEquality, toolTypeEquality) and tool_inventory_tools_controller.rb
  (defaultErrorMsg, pathParams) to snake_case
* fix: rename is_booth_chair? to booth_chair? on Participant and all callers
* fix: rename is_red_hardhat? to red_hardhat? on Participant and all callers
* fix: rename is_checked_out? to checked_out? on Tool and ScissorLift and
  all callers
* fix: rename is_hardhat? to hardhat? on Tool and all callers
* fix: rename is_past_due to past_due? on Task and all callers
* fix: rename is_checked_in to checked_in? on Shift and all callers

* fix(lint): autocorrect simple style violations

* collapse empty method definitions to single line (Style/EmptyMethod)
* remove extra blank lines (Layout/EmptyLines)
* convert String#% to format() (Style/FormatString)
* convert remaining double-quoted strings to single quotes (Style/StringLiterals)

* fix(lint): move top-level includes into class scope and fix remaining line-length

* move include Messenger inside Event, OrganizationTimelineEntry, and Shift classes
* move include WebMock::API inside ActiveSupport::TestCase in test_helper
* wrap long commented-out lines in db/seeds.rb

* fix(lint): extract hardcoded locale texts to en.yml

* replace 55 Rails/I18nLocaleTexts violations across 21 controllers
  and 1 model with t() calls
* add locale keys under en: for applets, charge_types, charges,
  downtime, event_types, events, home, memberships, notes,
  organization_build_steps, organization_members,
  organization_timeline_entries, scissor_lift_checkouts, sessions,
  store/purchases, tasks, tool_inventory_tools, tool_types, tools
* use lazy t('.key') lookup in named action methods; explicit
  t('controller.action.key') in private helpers and rescue_from blocks
* extract participant phone_number validation message to activerecord
  error key en.activerecord.errors.models.participant.attributes
  .phone_number.format

* fix(models): add dependent: options to has_many associations

* OrganizationBuildStatus -> organization_build_steps: destroy
* Participant -> organization_build_steps (approver): restrict_with_error
* Participant -> events (assignee): nullify
* StoreItem -> store_purchases: restrict_with_error
* ToolInventory -> tool_inventory_tools: destroy
* ToolType -> tools: restrict_with_error
* ToolType -> tool_inventory_tools: destroy

* fix(security): replace params.permit! with explicit param allowlist

params.permit! in tools#index was used only to build a pagination
URL via url_for; replace with params.permit(:type, :page, :size)
to avoid allowing arbitrary params through

* style: reformat with prettier v3 and resolve rubocop conflicts

* add config/locales/ and specific ERB files to .prettierignore to
  prevent prettier YAML parser failures on %{interpolation} syntax
* disable Layout and Style cops in .rubocop.yml that conflict with
  prettier's formatting decisions (would create an autocorrect loop)
* set Style/EmptyMethod: EnforcedStyle: expanded to match prettier's
  multi-line empty method formatting
* reformat 85 source files with prettier v3
* autocorrect Layout/EmptyLinesAfterModuleInclusion in event.rb and
  organization_timeline_entry.rb (non-conflicting cop)

* fix(erblint): resolve all erblint violations and update deprecated config

* rename erblint executable reference in rake task: erblint -> erb_lint
* rename .erb-lint.yml to .erb_lint.yml (deprecated name)
* disable Layout cops in .erb_lint.yml that conflict with prettier
  (ArgumentAlignment, ElseAlignment, EndAlignment, IndentationWidth,
  FirstArrayElementIndentation)
* exclude dead reports/index.html.erb view (no controller or route)
* replace raw() on plain text strings with bare string literals in
  shifts/index.html.erb and downtime/index.html.erb
* replace <tr <%= raw('class="x"') %>> with <tr class="<%= %>"> in
  events/index, downtime/index, downtime/downtime, downtime/_sidebar,
  and tools/_tool
* replace link_to raw('<strong>...') with block form in tools/_tools
* rewrite raw("<option ...>") as proper ERB option tags in tasks/index
* add autocomplete: 'off' to bare text_field_tag inputs (checkouts,
  home, organizations, reports)
* add .to_json to ERB interpolations in JS context in
  memberships/new_old and participants/safety_briefings/_video
* fix commented-out ERB block in tool_inventory/_inventory
* remove extra blank line in organizations/_organizations

* chore: delete dead views and clean up lint config

* delete app/views/organizations/_organizations.html.erb (orphaned
  partial, empty loop body, never rendered by any view)
* delete app/views/reports/index.html.erb (no controller or route,
  dead since initial commit 10 years ago)
* remove .erb_lint.yml exclude for deleted reports view
* remove .prettierignore entry for deleted organizations partial

* fix(lint): expand empty methods and add frozen_string_literal to new files

* Expand single-line empty methods to multiline to match Style/EmptyMethod: expanded
  (faq, home, organizations, shifts controllers; carnegie_mellon_id_card, test_helper)
* Add frozen_string_literal comment to weather controller, helper, job,
  model, service, migration, and test files added in the weather feature
* Fix Style/StringLiterals in weather test files (single-quoted strings)
* Fix Minitest/EmptyLineBeforeAssertionMethods in weather controller test
* Fix Minitest/AssertPredicate in shift_test and task_test

* style: fix prettier formatting and rubocop autocorrections post-merge

* Reformat ppe_distribution_controller, downtime_controller, shift, and
  weather files with prettier v3
* Expand single-line empty methods to match Style/EmptyMethod: expanded
* Add frozen_string_literal comment to new weather feature files
* Fix Style/StringLiterals, Minitest/AssertPredicate, and
  Minitest/EmptyLineBeforeAssertionMethods in test files

* fix(security): replace raw html_safe with ERB interpolation in tools partial

* Revert raw 'class="warning"' to class="<%= 'warning' if ... %>"
  to fix Rails/OutputSafety violation introduced during merge conflict
  resolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants