openproject-primer_view_components 0.50.0 → 0.50.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee0c706f13dfedc8047f4183c4cb5570b6e05c0ad72592380d0298609b3474bd
|
4
|
+
data.tar.gz: 34c75cb39e5436abd05757aee46f36c0e570e3ef5a33037a239b5e93dc2ef8e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/primer/classify.rb
CHANGED
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.
|
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
|