openproject-primer_view_components 0.50.0 → 0.50.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: f8125e5833c77a58f2ce85f8781ad48954a0c8669105d3bf8e55c74f2c360c12
4
- data.tar.gz: 0d501ea896daa1a624c75747219e0a188cf2c74887476a9335fbf3ed9961fbe8
3
+ metadata.gz: ee0c706f13dfedc8047f4183c4cb5570b6e05c0ad72592380d0298609b3474bd
4
+ data.tar.gz: 34c75cb39e5436abd05757aee46f36c0e570e3ef5a33037a239b5e93dc2ef8e3
5
5
  SHA512:
6
- metadata.gz: 4e17df484d35909bcf040b50187384550a4ffea360250b3aa4f7555a7b2b792eb24ea441846b66ae931c32ff2cf781c7aa2ad5b089b62a979b1c585a5d8092c6
7
- data.tar.gz: 84ec5382d94997acc7acd6a0f47e2ba06a51670590c81709d2d42a127d8451638be204c7b94f0c34b88ead697e97443713e00ad4f694bb2c09dd1ab3abd2675e
6
+ metadata.gz: b392abc90b6fde8fa348a04d8cf50669a7bf61c333ef019a2f571abb6eaa0e81e3017bda38d6e4e0a53e8801053a41a67d5bdec4a1e3f779fa153af0b7ed7b15
7
+ data.tar.gz: da34470011c02ec67f98082fb2192faaf614097b83f14d345ca0f396b6007a528cb0a857ec28c02c79fafba68d9ccad731d10996d3b68932ef78ab7d90157751
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.50.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3220](https://github.com/primer/view_components/pull/3220) [`688a4a2`](https://github.com/opf/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.50.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 = 50
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: openproject-primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.0
4
+ version: 0.50.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -800,7 +800,6 @@ files:
800
800
  - lib/rubocop/cop/primer/deprecated_layout_component.rb
801
801
  - lib/rubocop/cop/primer/no_tag_memoize.rb
802
802
  - lib/rubocop/cop/primer/primer_octicon.rb
803
- - lib/rubocop/cop/primer/system_argument_instead_of_class.rb
804
803
  - lib/rubocop/cop/primer/test_selector.rb
805
804
  - lib/tasks/custom_utilities.yml
806
805
  - 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