primer_view_components 0.0.55 → 0.0.56
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -4
- data/lib/primer/classify/utilities.rb +5 -1
- data/lib/primer/classify/validation.rb +1 -1
- data/lib/primer/view_components/engine.rb +1 -1
- data/lib/primer/view_components/linters/argument_mappers/button.rb +4 -1
- data/lib/primer/view_components/linters/flash_component_migration_counter.rb +5 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/primer_octicon.rb +18 -1
- metadata +7 -9
- data/app/components/primer/auto_complete/auto_complete.d.ts +0 -1
- data/app/components/primer/auto_complete/auto_complete.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1263f18dfe58150640310bfea1bd27f14e3854656f77606ed824fb4cc068b47e
|
4
|
+
data.tar.gz: 6dc1be9c61762bc31d0274b9402853d53c9a8e75438ffb3361179f0104c1896c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4c5a2f914f1b08177830023af568d4cc9970bf8047c95fa39ce13d3ea46b6a30687ae6df89a9fefbfb65b5e9f52f37ace2801370f9582513c43b0e5e26ccfb
|
7
|
+
data.tar.gz: 66e9eb50c0f9a91aecd6804d7b44aa5d6644f094edbf6011e60361a54d9de1c51dcb0ec157c162458139ca69d2cb7a469c8978b53b63d5f2aa06f59b79ebdc1f
|
data/CHANGELOG.md
CHANGED
@@ -30,6 +30,36 @@ The category for changes related to documentation, testing and tooling. Also, fo
|
|
30
30
|
|
31
31
|
## main
|
32
32
|
|
33
|
+
## 0.0.56
|
34
|
+
|
35
|
+
### Updates
|
36
|
+
|
37
|
+
* `Octicon` linter will autocorrect colors.
|
38
|
+
|
39
|
+
*Manuel Puyol*
|
40
|
+
|
41
|
+
* `Button` linter will autocorrect when button uses `href`, `name`, `value` or `tabindex`.
|
42
|
+
|
43
|
+
*Manuel Puyol*
|
44
|
+
|
45
|
+
* `Flash` linter won't autocorrect flashes with ERB in their content.
|
46
|
+
|
47
|
+
*Manuel Puyol*
|
48
|
+
|
49
|
+
* Eager load components.
|
50
|
+
|
51
|
+
*Cameron Dutro*
|
52
|
+
|
53
|
+
### Misc
|
54
|
+
|
55
|
+
* Refactor some of the rubocop valid_node? logic into BaseCop class.
|
56
|
+
|
57
|
+
*Jon Rohan*
|
58
|
+
|
59
|
+
* Fix validation checker to use Utilities for color-* classes.
|
60
|
+
|
61
|
+
*Jon Rohan*
|
62
|
+
|
33
63
|
## 0.0.55
|
34
64
|
|
35
65
|
### Breaking changes
|
@@ -59,10 +89,6 @@ The category for changes related to documentation, testing and tooling. Also, fo
|
|
59
89
|
|
60
90
|
*Kate Higa*
|
61
91
|
|
62
|
-
* Refactor some of the rubocop valid_node? logic into BaseCop class.
|
63
|
-
|
64
|
-
*Jon Rohan*
|
65
|
-
|
66
92
|
## 0.0.54
|
67
93
|
|
68
94
|
### Breaking changes
|
@@ -115,7 +115,11 @@ module Primer
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def classes_to_args(classes)
|
118
|
-
classes_to_hash(classes)
|
118
|
+
hash_to_args(classes_to_hash(classes))
|
119
|
+
end
|
120
|
+
|
121
|
+
def hash_to_args(hash)
|
122
|
+
hash.map do |key, value|
|
119
123
|
val = case value
|
120
124
|
when Symbol
|
121
125
|
":#{value}"
|
@@ -6,7 +6,7 @@ module Primer
|
|
6
6
|
class Classify
|
7
7
|
# :nodoc:
|
8
8
|
class Validation
|
9
|
-
INVALID_CLASS_NAME_PREFIXES = /bg-|color-|text-|box-shadow-|
|
9
|
+
INVALID_CLASS_NAME_PREFIXES = /bg-|color-bg-|text-|box-shadow-|box_shadow-/.freeze
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def invalid?(class_name)
|
@@ -23,12 +23,13 @@ module ERBLint
|
|
23
23
|
component: "Primer::BaseButton",
|
24
24
|
constant: "TYPE_OPTIONS"
|
25
25
|
).freeze
|
26
|
+
|
26
27
|
DEFAULT_TAG = Primer::ViewComponents::Constants.get(
|
27
28
|
component: "Primer::BaseButton",
|
28
29
|
constant: "DEFAULT_TAG"
|
29
30
|
).freeze
|
30
31
|
|
31
|
-
ATTRIBUTES = %w[disabled type].freeze
|
32
|
+
ATTRIBUTES = %w[disabled type href name value tabindex].freeze
|
32
33
|
|
33
34
|
def attribute_to_args(attribute)
|
34
35
|
attr_name = attribute.name
|
@@ -43,6 +44,8 @@ module ERBLint
|
|
43
44
|
raise ConversionError, "Button component does not support type \"#{attribute.value}\"" unless TYPE_OPTIONS.include?(attribute.value)
|
44
45
|
|
45
46
|
{ type: ":#{attribute.value}" }
|
47
|
+
else
|
48
|
+
{ attr_name.to_sym => erb_helper.convert(attribute) }
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
@@ -22,6 +22,11 @@ module ERBLint
|
|
22
22
|
# Hash children indicates that there are tags in the content.
|
23
23
|
return nil if tag_tree[:children].first.is_a?(Hash)
|
24
24
|
|
25
|
+
content = tag_tree[:children].first
|
26
|
+
|
27
|
+
# Don't accept content with ERB blocks
|
28
|
+
return nil if content.type != :text || content.children&.any? { |n| n.try(:type) == :erb }
|
29
|
+
|
25
30
|
ARGUMENT_MAPPER.new(tag).to_s
|
26
31
|
rescue ArgumentMappers::ConversionError
|
27
32
|
nil
|
@@ -128,12 +128,29 @@ module RuboCop
|
|
128
128
|
string_args = string_args_to_string(node)
|
129
129
|
|
130
130
|
args = "#{args}, #{size_attributes_to_string(size_attributes)}" if size_args.present?
|
131
|
-
args = "#{args}, #{
|
131
|
+
args = "#{args}, #{utilities_args(classes)}" if classes.present?
|
132
132
|
args = "#{args}, #{string_args}" if string_args.present?
|
133
133
|
|
134
134
|
args
|
135
135
|
end
|
136
136
|
|
137
|
+
def utilities_args(classes)
|
138
|
+
args = ::Primer::Classify::Utilities.classes_to_hash(classes)
|
139
|
+
|
140
|
+
color = case args[:color]
|
141
|
+
when :text_white
|
142
|
+
:text_white
|
143
|
+
when :text_link
|
144
|
+
:icon_info
|
145
|
+
else
|
146
|
+
args[:color].to_s.gsub("text_", "icon_").to_sym
|
147
|
+
end
|
148
|
+
|
149
|
+
args[:color] = color
|
150
|
+
|
151
|
+
::Primer::Classify::Utilities.hash_to_args(args)
|
152
|
+
end
|
153
|
+
|
137
154
|
def size_attributes_to_string(size_attributes)
|
138
155
|
# No arguments if they map to the default size
|
139
156
|
return if size_attributes.blank? || size_attributes.values.all?(&:blank?)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.56
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -366,7 +366,7 @@ dependencies:
|
|
366
366
|
- - "~>"
|
367
367
|
- !ruby/object:Gem::Version
|
368
368
|
version: 0.9.25
|
369
|
-
description:
|
369
|
+
description:
|
370
370
|
email:
|
371
371
|
- opensource+primer_view_components@github.com
|
372
372
|
executables: []
|
@@ -387,8 +387,6 @@ files:
|
|
387
387
|
- app/components/primer/alpha/underline_nav.rb
|
388
388
|
- app/components/primer/alpha/underline_panels.html.erb
|
389
389
|
- app/components/primer/alpha/underline_panels.rb
|
390
|
-
- app/components/primer/auto_complete/auto_complete.d.ts
|
391
|
-
- app/components/primer/auto_complete/auto_complete.js
|
392
390
|
- app/components/primer/base_button.rb
|
393
391
|
- app/components/primer/base_component.rb
|
394
392
|
- app/components/primer/beta/auto_complete.rb
|
@@ -557,7 +555,7 @@ licenses:
|
|
557
555
|
- MIT
|
558
556
|
metadata:
|
559
557
|
allowed_push_host: https://rubygems.org
|
560
|
-
post_install_message:
|
558
|
+
post_install_message:
|
561
559
|
rdoc_options: []
|
562
560
|
require_paths:
|
563
561
|
- lib
|
@@ -572,8 +570,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
572
570
|
- !ruby/object:Gem::Version
|
573
571
|
version: '0'
|
574
572
|
requirements: []
|
575
|
-
rubygems_version: 3.
|
576
|
-
signing_key:
|
573
|
+
rubygems_version: 3.2.22
|
574
|
+
signing_key:
|
577
575
|
specification_version: 4
|
578
576
|
summary: ViewComponents for the Primer Design System
|
579
577
|
test_files: []
|
@@ -1 +0,0 @@
|
|
1
|
-
import '@github/auto-complete-element';
|
@@ -1 +0,0 @@
|
|
1
|
-
import '@github/auto-complete-element';
|