Skip to content

Commit 688a4a2

Browse files
authored
Remove SystemArgumentInsteadOfClass linter and fix bug with whitespace in rendered class (#3220)
1 parent ebcd187 commit 688a4a2

File tree

8 files changed

+13
-125
lines changed

8 files changed

+13
-125
lines changed

.changeset/wet-houses-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/view-components": patch
3+
---
4+
5+
Remove SystemArgumentInsteadOfClass linter and fix bug with whitespace in rendered class

.rubocop.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ Primer/NoTagMemoize:
5757
Include:
5858
- "app/components/**/*"
5959

60-
Primer/SystemArgumentInsteadOfClass:
61-
Enabled: true
62-
6360
Lint/MissingSuper:
6461
Enabled: false
6562

docs/contributors/linting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ inherit_gem:
1818
You can also modify that configuration enabling/disabling the cops you want:
1919
2020
```yml
21-
Primer/SystemArgumentInsteadOfClass:
21+
Primer/NoTagMemoize:
2222
Enabled: false
2323
```
2424

lib/primer/classify.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def call(args = {})
4949
case key
5050
when :classes
5151
# insert :classes first to avoid huge doc diffs
52-
result.unshift(val)
52+
result.unshift(val) unless val.blank?
5353
next
5454
when :style
5555
style = val

lib/rubocop/config/default.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
require:
22
- rubocop/cop/primer
33

4-
Primer/SystemArgumentInsteadOfClass:
5-
Enabled: true
6-
74
Primer/NoTagMemoize:
85
Enabled: false
96

lib/rubocop/cop/primer/system_argument_instead_of_class.rb

Lines changed: 0 additions & 57 deletions
This file was deleted.

test/components/base_component_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ def test_does_not_render_class_attribute_if_none_is_set
7373
refute_selector("div[class='']")
7474
end
7575

76+
def test_renders_system_argument_class_with_no_whitespace
77+
render_inline(Primer::BaseComponent.new(tag: :div, ml: 3))
78+
79+
assert_selector("div[class='ml-3']")
80+
end
81+
7682
def test_does_not_render_primer_layout_classes_as_attributes
7783
render_inline(Primer::BaseComponent.new(tag: :div, my: 4))
7884

test/lib/rubocop/system_arguments_instead_of_class_test.rb

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)