Reference
RuboCop cops
Two shipped cops keep call sites on the phlex-forms API — one autocorrects.
Setup#
.rubocop.yml
require:
- phlex_forms/rubocop
inherit_gem:
phlex-forms: config/rubocop.ymlPhlexForms/RawForm#
Flags form_with/form_for and raw Phlex form(...) calls in components, autocorrecting to Form(...) so every form gets the derived action/method, CSRF handling, and the builder API:
# bad
form(action: users_path, method: :post) { ... }
# good (autocorrected)
Form(url: users_path, method: :post) { |f| ... }PhlexForms/LegacyFormMethod#
Flags Rails-FormBuilder-style calls (f.text_field, f.select, f.check_box, …) in favor of f.field and the PascalCase component methods — the biggest lever when migrating an app off a vendored builder:
# bad
f.text_field :email
f.check_box :terms
# good
f.field :email # or f.Input(:email) for the bare control
f.Checkbox(:terms)