-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ERBLint to enforce a few basic rules (#994)
- Loading branch information
1 parent
594dfe0
commit dac225f
Showing
16 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
EnableDefaultLinters: true | ||
exclude: | ||
- '**/vendor/**/*' | ||
linters: | ||
ErbSafety: | ||
enabled: true | ||
FinalNewline: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<link href="<%= asset_path('prism.css', skip_pipeline: true) %>" media="screen" rel="stylesheet" type="text/css" /> | ||
<link href="<%= asset_path('prism.css', skip_pipeline: true) %>" media="screen" rel="stylesheet" type="text/css"> | ||
<div class="view-component-source-example"> | ||
<h2>Source:</h2> | ||
<pre class="source"> | ||
<% if @render_args[:component] %> | ||
<code class="language-ruby"> | ||
<%=h @preview.preview_source(@example_name) %> | ||
<%= h @preview.preview_source(@example_name) %> | ||
</code> | ||
<% else %> | ||
<% template = @view_renderer.lookup_context.find_template(@render_args[:template]) %> | ||
<code class="language-<%= prism_language_name(template: template) %>"> | ||
<%=h template.source %> | ||
<%= h template.source %> | ||
</code> | ||
<% end %> | ||
</pre> | ||
</div> | ||
<script type="text/javascript" src="<%= asset_path('prism.min.js', skip_pipeline: true) %>"></script> | ||
<script type="text/javascript" src="<%= asset_path('prism.min.js', skip_pipeline: true) %>"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<% if ViewComponent::Base.render_monkey_patch_enabled || Rails.version.to_f >= 6.1 %> | ||
<%= render(@render_args[:component], @render_args[:args], &@render_args[:block])%> | ||
<%= render(@render_args[:component], @render_args[:args], &@render_args[:block]) %> | ||
<% else %> | ||
<%= render_component(@render_args[:component], &@render_args[:block])%> | ||
<%= render_component(@render_args[:component], &@render_args[:block]) %> | ||
<% end %> | ||
|
||
<% if ViewComponent::Base.show_previews_source %> | ||
<%= preview_source %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<%= title %> | ||
<%= title %> |
2 changes: 1 addition & 1 deletion
2
test/sandbox/app/components/collection_counter_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/sandbox/app/components/collection_iteration_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/sandbox/app/components/controller_inline_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<%= render partial: "integration_examples/controller_inline", locals: { message: @message } %> | ||
<%= render partial: "integration_examples/controller_inline", locals: { message: @message } %> |
2 changes: 1 addition & 1 deletion
2
test/sandbox/app/components/missing_collection_parameter_name_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<div>Hi!</div> | ||
<div>Hi!</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Rendered | ||
Rendered |
2 changes: 1 addition & 1 deletion
2
test/sandbox/app/views/integration_examples/_controller_inline.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<div><%= message %></div> | ||
<div><%= message %></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<%= yield %> | ||
<%= preview_source %> | ||
<%= preview_source %> |
4 changes: 2 additions & 2 deletions
4
...ents/previews/preview_source_from_layout_component_preview/default_with_template.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<%= | ||
<%= | ||
render PreviewComponent.new(cta: "Click me!", title: "Lorem Ipsum") | ||
%> | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters