Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SystemArgumentInsteadOfClass linter and fix bug with whitespace in rendered class #3220

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading