primer_view_components 0.36.0 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0b0b4fd77e2d1af1c16252a9d51e6119854feca261d5273ecaafdf92163e977
4
- data.tar.gz: f6778ad278e638c50b2aea8f86fcd73617d9822ca167da12a54d7de3710a1c75
3
+ metadata.gz: c94fae989b4359c72f7dfeeb678b4fafc93240645a4ff14d55ed16fdf0998cd8
4
+ data.tar.gz: 4ea33c5d1b3f88eb6033b99f368cdccf19ce9ff986c79b29b02bdb3c447e5bb2
5
5
  SHA512:
6
- metadata.gz: 041a15920d44bfe62d5de05834b6a1bc2c4a27435b38dc52e6abb3bbb9a47efa13749b751a9c4401f42c8cf37f401743e064433df73a3d779e63ffbbde3117fb
7
- data.tar.gz: badf04216b82031fb70f0902803ef0dd965f57d18ec0af8b48aad9d59390d91a6b5af1079ac29198f9b0cf2c5cba7429bf300a023d46fc8414885878907e9b61
6
+ metadata.gz: 48b79cf2df6eeef3791186744be2844a51979daff0f7f922af1b05fc6b2577ef293dd203b6f2bc451d959f2e2a3ba19111a79edf7a4d92fe2585ad26d153b5fe
7
+ data.tar.gz: cb5df33ba3522d34402d18e2fae5859f6544a1fb471ffd55e3a31af014efb6fb89f4485fcf6088344d410362cefc2cc28bc69a3898ec2b82fa3dd71dda8aa242
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.36.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3220](https://github.com/primer/view_components/pull/3220) [`688a4a2`](https://github.com/primer/view_components/commit/688a4a263deb4be70763b9ba39cae854896b44ce) Thanks [@jonrohan](https://github.com/jonrohan)! - Remove SystemArgumentInsteadOfClass linter and fix bug with whitespace in rendered class
8
+
3
9
  ## 0.36.0
4
10
 
5
11
  ### Minor Changes
@@ -49,7 +49,7 @@ module Primer
49
49
  case key
50
50
  when :classes
51
51
  # insert :classes first to avoid huge doc diffs
52
- result.unshift(val)
52
+ result.unshift(val) unless val.blank?
53
53
  next
54
54
  when :style
55
55
  style = val
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 36
9
- PATCH = 0
9
+ PATCH = 1
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -1,9 +1,6 @@
1
1
  require:
2
2
  - rubocop/cop/primer
3
3
 
4
- Primer/SystemArgumentInsteadOfClass:
5
- Enabled: true
6
-
7
4
  Primer/NoTagMemoize:
8
5
  Enabled: false
9
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.36.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -726,7 +726,6 @@ files:
726
726
  - lib/rubocop/cop/primer/deprecated_layout_component.rb
727
727
  - lib/rubocop/cop/primer/no_tag_memoize.rb
728
728
  - lib/rubocop/cop/primer/primer_octicon.rb
729
- - lib/rubocop/cop/primer/system_argument_instead_of_class.rb
730
729
  - lib/rubocop/cop/primer/test_selector.rb
731
730
  - lib/tasks/custom_utilities.yml
732
731
  - previews/pages/forms/01_introduction.md.erb
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
- require "primer/classify/utilities"
5
-
6
- # :nocov:
7
- module RuboCop
8
- module Cop
9
- module Primer
10
- # This cop ensures that components use System Arguments instead of CSS classes.
11
- #
12
- # bad
13
- # Component.new(classes: "mr-1")
14
- #
15
- # good
16
- # Component.new(mr: 1)
17
- class SystemArgumentInsteadOfClass < BaseCop
18
- INVALID_MESSAGE = <<~STR
19
- Avoid using CSS classes when you can use System Arguments: https://primer.style/view-components/system-arguments.
20
- STR
21
-
22
- def on_send(node)
23
- return unless valid_node?(node)
24
- return unless node.arguments?
25
-
26
- # we are looking for hash arguments and they are always last
27
- kwargs = node.arguments.last
28
-
29
- return unless kwargs.type == :hash
30
-
31
- # find classes pair
32
- classes_arg = kwargs.pairs.find { |kwarg| kwarg.key.value == :classes }
33
-
34
- return if classes_arg.nil?
35
- return unless classes_arg.value.type == :str
36
-
37
- # get actual classes
38
- classes = classes_arg.value.value
39
-
40
- system_arguments = ::Primer::Classify::Utilities.classes_to_hash(classes)
41
-
42
- # no classes are fixable
43
- return if system_arguments[:classes] == classes
44
-
45
- add_offense(classes_arg, message: INVALID_MESSAGE)
46
- end
47
-
48
- def autocorrect(node)
49
- lambda do |corrector|
50
- args = ::Primer::Classify::Utilities.classes_to_args(node.value.value)
51
- corrector.replace(node.loc.expression, args)
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end