Skip to content

Commit

Permalink
update erb-lint config (gitcoinco#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmcodes authored Mar 17, 2020
1 parent 3b308e8 commit be66e6a
Show file tree
Hide file tree
Showing 23 changed files with 71 additions and 76 deletions.
7 changes: 1 addition & 6 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
---
EnableDefaultLinters: true
linters:
ErbSafety:
enabled: false
SelfClosingTag:
enabled: true
enforced_style: 'always'
SpaceAroundErbTag:
enabled: true
DeprecatedClasses:
enabled: true
rule_set:
- deprecated: ['u-[-_\w]*']
Rubocop:
enabled: true
rubocop_config:
Expand Down
10 changes: 5 additions & 5 deletions app/views/campaign_bundles/campaigns/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Campaign <%= campaign_iteration.index + 1 %>
<small><%= " total spend of #{campaign.total_budget.format} over #{number_with_delimiter campaign.total_operative_days} days" %></small>
</span>
<%= link_to "Remove", "#", class: "btn btn-link", data: { reflex: "click->CampaignBundlesReflex#remove_campaign", temporary_id: campaign.temporary_id } %>
<%= link_to "Remove", "#", class: "btn btn-link", data: {reflex: "click->CampaignBundlesReflex#remove_campaign", temporary_id: campaign.temporary_id} %>
</div>
<% end %>
<%= card_subtitle do %>
Expand All @@ -23,15 +23,15 @@
<div class="col form-group">
<%= cf.label :name %>
<%= cf.text_field :name, class: "form-control", required: true,
data: { reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_name", temporary_id: campaign.temporary_id } %>
data: {reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_name", temporary_id: campaign.temporary_id} %>
</div>
</div>

<div class="row">
<div class="col form-group">
<%= cf.label :url, "URL" %>
<%= cf.text_field :url, class: "form-control", required: true, placeholder: "https://example.com/?utm_source=codefund&utm_campaign={{campaign_id}}",
data: { reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_url", temporary_id: campaign.temporary_id } %>
data: {reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_url", temporary_id: campaign.temporary_id} %>
<details class="mt-2">
<summary>Use any of the following variables in the URL</summary>
<%= table do %>
Expand Down Expand Up @@ -108,15 +108,15 @@
<div class="col-6 form-group">
<%= cf.label :daily_budget, "Daily Budget" %>
<%= cf.text_field :daily_budget, value: campaign.daily_budget.format(symbol: false), step: 0.01, class: "form-control", required: true,
data: { reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_daily_budget", temporary_id: campaign.temporary_id } %>
data: {reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_daily_budget", temporary_id: campaign.temporary_id} %>
<small class="form-text text-muted">
The average you want to spend each day
</small>
</div>
<div class="col-6 form-group">
<%= cf.label :ecpm_multiplier, "eCPM Multiplier" %>
<%= cf.number_field :ecpm_multiplier, class: "form-control", required: true, step: 0.01,
data: { reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_ecpm_multiplier", temporary_id: campaign.temporary_id } %>
data: {reflex: "cf:value-committed->CampaignBundlesReflex#update_campaign_ecpm_multiplier", temporary_id: campaign.temporary_id} %>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions app/views/campaign_bundles/campaigns/_inventory.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<%= table_footer do %>
<%= table_row add_class: "bg-light" do %>
<%= table_data add_class: "text-right font-weight-bold", colspan: "3" do %>
<small class="opacity-60 float-left text-left">Sold/Unsold estimates are<br>based on Active Campaigns</small>Total
<small class="opacity-60 float-left text-left">Sold/Unsold estimates are<br />based on Active Campaigns</small>Total
<span class="text-nowrap text-danger d-block">Sold</span>
<span class="text-nowrap text-success d-block">Unsold</span>
<% end %>
Expand All @@ -105,7 +105,7 @@
<% end %>
<%= table_data add_class: "text-right font-weight-bold text-monospace" do %>
<%= campaign.inventory_summary.average_daily_impressions_value.format %>
<span class="text-nowrap text-danger d-block"><%= campaign.inventory_summary.sold_daily_impressions_value.format %></span>
<span class="text-nowrap text-danger d-block"><%= campaign.inventory_summary.sold_daily_impressions_value.format %></span>
<span class="text-nowrap text-success d-block"><%= campaign.inventory_summary.unsold_daily_impressions_value.format %></span>
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/invitations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
tabindex: 1,
class: "form-control",
hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length),
input_html: { autocomplete: "new-password" } %>
input_html: {autocomplete: "new-password"} %>
<%= f.label :password %>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="col-md-6 mb-3 mb-md-0">
<label class="form-label string required" for="organization-user-email">Email <abbr title="required">*</abbr></label>
<input id="organization-user-email" type="text" placeholder="Search for a user by email..." class="form-control"
data-target="organization-users-search.query" data-action="input->organization-users-search#perform">
data-target="organization-users-search.query" data-action="input->organization-users-search#perform" />
<div id="morph" class="">
<small data-target="organization-users-search.activity" class="text-danger" hidden>
<i class="fas fa-spinner fa-spin"></i>
Expand Down
14 changes: 7 additions & 7 deletions app/views/shared/modals/_user_new_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="modal-header">
<h6 id="clientNewModalLabel" class="modal-title inline-editable">
<span class="sr-only">Client name</span>
<input type="text" class="form-control form-control-lg" placeholder="E.g. Stilearning, Inc." required>
<input type="text" class="form-control form-control-lg" placeholder="E.g. Stilearning, Inc." required />
</h6>
</div>

Expand All @@ -14,31 +14,31 @@
<div class="col-md-12">
<div class="form-group">
<label for="cnContactName">Contact name</label>
<input type="text" id="cnContactName" class="form-control">
<input type="text" id="cnContactName" class="form-control" />
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="cnContactEmail">Contact email</label>
<input type="email" id="cnContactEmail" class="form-control">
<input type="email" id="cnContactEmail" class="form-control" />
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="cnStreet">Street</label>
<input type="text" id="cnStreet" class="form-control">
<input type="text" id="cnStreet" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="cnSuite">Suite</label>
<input type="text" id="cnSuite" class="form-control">
<input type="text" id="cnSuite" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="cnZip">Zip</label>
<input type="text" id="cnZip" class="form-control">
<input type="text" id="cnZip" class="form-control" />
</div>
</div>
<div class="col-md-6">
Expand Down Expand Up @@ -69,4 +69,4 @@
</div>
</div>
</div>
</form>
</form>
16 changes: 8 additions & 8 deletions app/views/shared/sidebar_content/_admin.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": [
request.path == "/dashboards/administrator",
request.path == "/organizations",
request.path == "/users",
request.path == "/users/invitation/new",
request.path == "/audiences"
].any?
"menu-item has-child": true,
"has-open": [
request.path == "/dashboards/administrator",
request.path == "/organizations",
request.path == "/users",
request.path == "/users/invitation/new",
request.path == "/audiences"
].any?
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-user-crown"></span>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/sidebar_content/_campaign_bundles.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?('/campaign_bundles')
"menu-item has-child": true,
"has-open": request.path.start_with?("/campaign_bundles")
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-box-alt"></span>
Expand Down
18 changes: 9 additions & 9 deletions app/views/shared/sidebar_content/_campaigns.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?('/campaigns')
"menu-item has-child": true,
"has-open": request.path.start_with?("/campaigns")
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-ad"></span>
Expand All @@ -11,20 +11,20 @@
<%= active_link_to "Overview", campaigns_path, class: "menu-link", tabindex: -1, wrap_tag: :li, wrap_class: "menu-item", active: :exact %>
<% if active_campaigns_for_current_organization&.exists? %>
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/campaigns"),
request.path.exclude?("/campaigns/new")
].all?
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/campaigns"),
request.path.exclude?("/campaigns/new")
].all?
) do %>
<a href="#" class="menu-link">
<span class="menu-text">Active Campaigns</span>
</a>
<ul class="menu">
<% active_campaigns_for_current_organization&.order(name: :asc).each do |campaign| %>
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?("/campaigns/#{campaign.id}")
"menu-item has-child": true,
"has-open": request.path.start_with?("/campaigns/#{campaign.id}")
) do %>
<a href="#" class="menu-link">
<span class="menu-text"><%= campaign.name %></span>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/sidebar_content/_creatives.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?('/creatives')
"menu-item has-child": true,
"has-open": request.path.start_with?("/creatives")
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-pencil-paintbrush"></span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/sidebar_content/_dashboard.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= active_link_to default_dashboard_path(current_user), class: "menu-link", tabindex: -1, wrap_tag: :li, wrap_class: "menu-item" do %>
<span class="menu-icon fas fa-home"></span>
<span class="menu-text">Dashboard</span>
<% end %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/shared/sidebar_content/_dashboards.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": ["advertiser_dashboards", "publisher_dashboards"].include?(controller_name)
"menu-item has-child": true,
"has-open": ["advertiser_dashboards", "publisher_dashboards"].include?(controller_name)
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-tachometer-fast"></span>
Expand All @@ -11,4 +11,4 @@
<%= active_link_to "Advertiser", advertiser_dashboards_path, class: "menu-link", tabindex: -1,wrap_tag: :li, wrap_class: "menu-item" if authorized_user.can_advertise? %>
<%= active_link_to "Publisher", publisher_dashboards_path, class: "menu-link", tabindex: -1, wrap_tag: :li, wrap_class: "menu-item" if authorized_user.can_publish? %>
</ul>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/shared/sidebar_content/_footer_admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<a href="#" class="text-dark" style="font-weight: bold;">$2.2K</a>
<span class="text-muted px-1"></span>
<a href="#" class="text-dark" style="font-weight: bold;">1.3M</a>
</footer>
</footer>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<footer class="aside-footer border-top p-3 text-center">
Remaining budget: <a href="#" class="text-dark" style="font-weight: bold;">$3,251</a>
</footer>
</footer>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<footer class="aside-footer border-top p-3 text-center">
<strong><%= %></strong><strong>$3,251</strong>
<strong><%= %></strong><strong>$3,251</strong>
</footer>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div>
<a href="#" data-toggle="modal" data-target="#organizationUserModal">change</a>
<%= link_to 'view', organization_path(Current.organization) %>
<%= link_to "view", organization_path(Current.organization) %>
</div>
</footer>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<footer class="aside-footer border-top p-3 text-center">
You earned <a href="#" class="text-dark" style="font-weight: bold;">$3,251</a>
</footer>
</footer>
4 changes: 2 additions & 2 deletions app/views/shared/sidebar_content/_images.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?('/imageables')
"menu-item has-child": true,
"has-open": request.path.start_with?("/imageables")
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-image"></span>
Expand Down
10 changes: 5 additions & 5 deletions app/views/shared/sidebar_content/_organization.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/organizations/#{Current.organization.id}"),
request.path.start_with?("/organization/#{Current.organization.id}")
].any?
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/organizations/#{Current.organization.id}"),
request.path.start_with?("/organization/#{Current.organization.id}")
].any?
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-users"></span>
Expand Down
12 changes: 6 additions & 6 deletions app/views/shared/sidebar_content/_profile.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/users/#{current_user.id}"),
request.path.start_with?("/password/edit")
].any?
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/users/#{current_user.id}"),
request.path.start_with?("/password/edit")
].any?
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-user-cog"></span>
Expand All @@ -15,4 +15,4 @@
<%= active_link_to "Edit Profile", edit_user_path(current_user), class: "menu-link", tabindex: -1,wrap_tag: :li, wrap_class: "menu-item" %>
<%= active_link_to "Change Password", edit_user_passwords_path(current_user), class: "menu-link", tabindex: -1,wrap_tag: :li, wrap_class: "menu-item" %>
</ul>
<% end %>
<% end %>
18 changes: 9 additions & 9 deletions app/views/shared/sidebar_content/_properties.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?('/properties')
"menu-item has-child": true,
"has-open": request.path.start_with?("/properties")
) do %>
<a href="#" class="menu-link">
<span class="menu-icon fad fa-browser"></span>
Expand All @@ -10,20 +10,20 @@
<li class="menu-subhead">Properties</li>
<%= active_link_to "Overview", properties_path, class: "menu-link", tabindex: -1,wrap_tag: :li, wrap_class: "menu-item", active: :exact %>
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/properties"),
request.path.exclude?("/properties/new")
].all?
"menu-item has-child": true,
"has-open": [
request.path.start_with?("/properties"),
request.path.exclude?("/properties/new")
].all?
) do %>
<a href="#" class="menu-link">
<span class="menu-text">Active Properties</span>
</a>
<ul class="menu">
<% current_user.properties.active.order(name: :asc).each do |property| %>
<%= tag.li class: classes(
"menu-item has-child": true,
"has-open": request.path.start_with?("/properties/#{property.id}")
"menu-item has-child": true,
"has-open": request.path.start_with?("/properties/#{property.id}")
) do %>
<a href="#" class="menu-link">
<span class="menu-text"><%= property.name %></span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/widgets/_sparkline_graph.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= tag.svg tag.span("", class: "sparkline--tooltip", hidden: true), class: svg_class, width: width, height: height, "stroke-width": stroke_width, data: {
controller: "sparkline-graph",
values: values
} %>
} %>
2 changes: 1 addition & 1 deletion bin/standardize
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "== Checking StandardRb =="
bundle exec standardrb --fix
echo "== Checking ERB Lint =="
bundle exec erblint --autocorrect app/views/**/*.html.erb
bundle exec erblint --config .erb-lint.yml --autocorrect app/views/**/*.html.erb
echo "== Checking Prettier-Standard =="
yarn run prettier:format
# echo "== Checking Zeitwerk =="
Expand Down

0 comments on commit be66e6a

Please sign in to comment.