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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c94fae989b4359c72f7dfeeb678b4fafc93240645a4ff14d55ed16fdf0998cd8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4ea33c5d1b3f88eb6033b99f368cdccf19ce9ff986c79b29b02bdb3c447e5bb2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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
         
     | 
    
        data/lib/primer/classify.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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
         
     |