Skip to content

Commit

Permalink
Remove SystemArgumentInsteadOfClass linter and fix bug with whitespac…
Browse files Browse the repository at this point in the history
…e in rendered class (#3220)
  • Loading branch information
jonrohan authored Dec 5, 2024
1 parent ebcd187 commit 688a4a2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 125 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-houses-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Remove SystemArgumentInsteadOfClass linter and fix bug with whitespace in rendered class
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ Primer/NoTagMemoize:
Include:
- "app/components/**/*"

Primer/SystemArgumentInsteadOfClass:
Enabled: true

Lint/MissingSuper:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion docs/contributors/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inherit_gem:
You can also modify that configuration enabling/disabling the cops you want:
```yml
Primer/SystemArgumentInsteadOfClass:
Primer/NoTagMemoize:
Enabled: false
```
Expand Down
2 changes: 1 addition & 1 deletion lib/primer/classify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def call(args = {})
case key
when :classes
# insert :classes first to avoid huge doc diffs
result.unshift(val)
result.unshift(val) unless val.blank?
next
when :style
style = val
Expand Down
3 changes: 0 additions & 3 deletions lib/rubocop/config/default.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require:
- rubocop/cop/primer

Primer/SystemArgumentInsteadOfClass:
Enabled: true

Primer/NoTagMemoize:
Enabled: false

Expand Down
57 changes: 0 additions & 57 deletions lib/rubocop/cop/primer/system_argument_instead_of_class.rb

This file was deleted.

6 changes: 6 additions & 0 deletions test/components/base_component_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def test_does_not_render_class_attribute_if_none_is_set
refute_selector("div[class='']")
end

def test_renders_system_argument_class_with_no_whitespace
render_inline(Primer::BaseComponent.new(tag: :div, ml: 3))

assert_selector("div[class='ml-3']")
end

def test_does_not_render_primer_layout_classes_as_attributes
render_inline(Primer::BaseComponent.new(tag: :div, my: 4))

Expand Down
60 changes: 0 additions & 60 deletions test/lib/rubocop/system_arguments_instead_of_class_test.rb

This file was deleted.

0 comments on commit 688a4a2

Please sign in to comment.