gitlab-styles 13.0.0 → 13.0.2

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: 7c8f4c0e301ccd103fbf7b527b4fc81563742555650b5e660ff4dcb18bad7de5
4
- data.tar.gz: 7eb4ec96135389f35d7a5b5787c9ab1963b4bf670b64417cc1d31000a67f13f0
3
+ metadata.gz: 1b05957f6a3353a50fe37009f0c78239677857f28e6d16589de5eb3aa8120868
4
+ data.tar.gz: d3169d41ff1af9327b2e1e3a8fb2a5a2357915542ad0bb3352e52451e3cfb0dc
5
5
  SHA512:
6
- metadata.gz: a16a93bb989ef4057c9018f4cc8ba0916f31401546c50210d6d97f16445be17b0438a6f07d42d00e7fa1dcad711fb9c6e89aa86f19e08f7af6a3a0979ef47b35
7
- data.tar.gz: 8304c777e6c7bac4a57a7583ba580367261483bcef4a4fcb97d81cc7086c76e5b1c8065df78466af537fe4bb2f9a85b4fded2e4841f49aae7a00f5c833fa338b
6
+ metadata.gz: 53891b9794f187eaa55f40dd87d2f89bbe84d4d7204fb40b40de4b7dc3761b2e4a265a670ed4255d49ef419df682a5d5e44d8283e12d01bf530be1a684527ba2
7
+ data.tar.gz: d77ec1fb537c34c438527eb019c12bfff2f463bfd78212384f15e2cdd327e5de2cd9572d91d6020ef72f3c885bc4f5de244d5b9a1bc842d2aa0347b0bfb75fbd
@@ -2,7 +2,14 @@
2
2
  commit from this merge request, and `<NEW_VERSION>` with the upcoming version number. -->
3
3
  ## Diff
4
4
 
5
- https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
5
+ https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/compare/<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
6
+
7
+ <!--
8
+
9
+ NOTE:
10
+ If you are working with a fork use: https://gitlab.com/<YOUR_NAMESPACE>/gitlab-styles/-/compare/<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>?from_project_id=4176070
11
+
12
+ -->
6
13
 
7
14
  ## Checklist
8
15
 
@@ -10,6 +17,7 @@ https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/compare/v<PREVIOUS_VERSI
10
17
  - [ ] Ensure the diff link above is up-to-date.
11
18
  - [ ] Add release notes to the [Changelog](#changelog) section below.
12
19
  - [ ] Based on the diff and the release notes, update the `version.rb` according to [SemVer](https://semver.org).
20
+ - [ ] Run `bundle install` to update `Gemfile.lock`
13
21
  - [ ] Create an MR on `gitlab-org/gitlab` project [with the `New Version of gitlab-styles.md` template](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/merge_request_templates/New%20Version%20of%20gitlab-styles.md) to test the new version of `gitlab-styles`, and follow the MR instructions.
14
22
 
15
23
  ## Changelog
@@ -19,7 +27,9 @@ Paste output of:
19
27
 
20
28
  curl https://gitlab.com/api/v4/projects/4176070/repository/changelog?version=<NEW_VERSION> | jq -r ".notes"
21
29
 
22
- NOTE: Skip `v` in `<NEW_VERSION>`. For example, Use `version=10.0.0` instead of `version=v10.0.0`.
30
+ NOTE:
31
+ Emphasize changes via `**BREAKING CHANGE**` or `**IMPORTANT**` etc. if actions are required by users
32
+ Example: https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/releases/13.0.0
23
33
 
24
34
  -->
25
35
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-styles (13.0.0)
5
- rubocop (~> 1.66.0)
4
+ gitlab-styles (13.0.2)
5
+ rubocop (~> 1.68.0)
6
6
  rubocop-capybara (~> 2.21.0)
7
7
  rubocop-factory_bot (~> 2.26.1)
8
8
  rubocop-graphql (~> 1.5.4)
@@ -156,17 +156,17 @@ GEM
156
156
  binding_of_caller
157
157
  rspec-parameterized-core (< 2)
158
158
  rspec-support (3.12.0)
159
- rubocop (1.66.0)
159
+ rubocop (1.68.0)
160
160
  json (~> 2.3)
161
161
  language_server-protocol (>= 3.17.0)
162
162
  parallel (~> 1.10)
163
163
  parser (>= 3.3.0.2)
164
164
  rainbow (>= 2.2.2, < 4.0)
165
165
  regexp_parser (>= 2.4, < 3.0)
166
- rubocop-ast (>= 1.32.1, < 2.0)
166
+ rubocop-ast (>= 1.32.2, < 2.0)
167
167
  ruby-progressbar (~> 1.7)
168
168
  unicode-display_width (>= 2.4.0, < 3.0)
169
- rubocop-ast (1.32.1)
169
+ rubocop-ast (1.32.3)
170
170
  parser (>= 3.3.1.0)
171
171
  rubocop-capybara (2.21.0)
172
172
  rubocop (~> 1.41)
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'rubocop', '~> 1.66.0'
25
+ spec.add_dependency 'rubocop', '~> 1.68.0'
26
26
  spec.add_dependency 'rubocop-capybara', '~> 2.21.0'
27
27
  spec.add_dependency 'rubocop-factory_bot', '~> 2.26.1'
28
28
  spec.add_dependency 'rubocop-graphql', '~> 1.5.4'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Styles
5
- VERSION = '13.0.0'
5
+ VERSION = '13.0.2'
6
6
  end
7
7
  end
@@ -30,7 +30,7 @@ module RuboCop
30
30
  # )
31
31
  #
32
32
  # See https://gitlab.com/gitlab-org/gitlab-ce/issues/29661
33
- class JsonSerialization < RuboCop::Cop::Cop
33
+ class JsonSerialization < RuboCop::Cop::Base
34
34
  MSG = "Don't use `%s` without specifying `only`"
35
35
 
36
36
  # Check for `to_json` sent to any object that's not a Hash literal or
@@ -72,8 +72,9 @@ module RuboCop
72
72
  @method = matched.first
73
73
 
74
74
  if matched.last.nil? || matched.last.empty?
75
+ @offense_found = true
75
76
  # Empty `to_json` call
76
- add_offense(node, location: :selector, message: format_message)
77
+ add_offense(node.loc.selector, message: format_message)
77
78
  else
78
79
  check_arguments(node, matched)
79
80
  end
@@ -102,6 +103,8 @@ module RuboCop
102
103
 
103
104
  return unless requires_only?
104
105
 
106
+ @offense_found = true
107
+
105
108
  # Add a top-level offense for the entire argument list, but only if
106
109
  # we haven't yet added any offenses to the child Hash values (such
107
110
  # as `include`)
@@ -117,6 +120,7 @@ module RuboCop
117
120
  includes.each_child_node do |child_node|
118
121
  next if contains_only?(child_node)
119
122
 
123
+ @offense_found = true
120
124
  add_offense(child_node, message: format_message)
121
125
  end
122
126
  end
@@ -125,7 +129,7 @@ module RuboCop
125
129
  def requires_only?
126
130
  return false if @_has_top_level_only
127
131
 
128
- offenses.count.zero?
132
+ !@offense_found
129
133
  end
130
134
  end
131
135
  end
@@ -90,9 +90,3 @@ module Rubocop
90
90
  end
91
91
  end
92
92
  end
93
-
94
- # Don't match files programmatically and use `Include` directives instead.
95
- # See https://github.com/rubocop/rubocop/pull/13209#issuecomment-2337963170
96
- class RuboCop::Cop::InternalAffairs::CopDescription
97
- remove_method :relevant_file? if instance_method(:relevant_file?)
98
- end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubocop
4
+ module Cop
5
+ module Tailwind
6
+ # This prevents the use of max-width media query Tailwind CSS utility classes unless absolutely necessary.
7
+ # min-width media query Tailwind CSS utility classes should be used instead.
8
+ # @example
9
+ # # bad
10
+ # css_classes = ["gl-mt-5", "max-md:gl-mt-3"]
11
+ # %div{ class: ["gl-mt-5", "max-md:gl-mt-3"] }
12
+ #
13
+ # # good
14
+ # css_classes = ["gl-mt-3", "md:gl-mt-5"]
15
+ # %div{ class: ["gl-mt-3", "md:gl-mt-5"] }
16
+ class MaxWidthMediaQueries < RuboCop::Cop::Base
17
+ TAILWIND_CSS_CLASS = /max-(sm|md|lg|xl):gl-/
18
+ MSG = 'Do not use max-width media query utility classes unless absolutely necessary. ' \
19
+ 'Use min-width media query utility classes instead.'
20
+
21
+ # @!method max_width_media_query_class?(node)
22
+ def_node_matcher :max_width_media_query_class?, <<~PATTERN
23
+ (str /#{TAILWIND_CSS_CLASS}/)
24
+ PATTERN
25
+
26
+ def on_str(node)
27
+ return unless max_width_media_query_class?(node)
28
+
29
+ add_offense(node)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
data/rubocop-rspec.yml CHANGED
@@ -68,6 +68,11 @@ RSpec/ExampleLength:
68
68
  Enabled: false
69
69
  Max: 5
70
70
 
71
+ # Avoid `it do` instead use `specify do`
72
+ RSpec/ExampleWithoutDescription:
73
+ Enabled: true
74
+ EnforcedStyle: single_line_only
75
+
71
76
  # Do not use should when describing your tests.
72
77
  RSpec/ExampleWording:
73
78
  Enabled: true
data/rubocop-style.yml CHANGED
@@ -182,11 +182,9 @@ Style/HashLikeCase:
182
182
 
183
183
  # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
184
184
  # over 1.8 syntax `{ :a => 1, :b => 2 }`.
185
- # Short-hand Hash syntax does not work prior 3.1.
186
- # See https://gitlab.com/gitlab-org/gitlab/-/issues/435940#note_1703307479
187
185
  Style/HashSyntax:
188
186
  Enabled: true
189
- EnforcedShorthandSyntax: never
187
+ EnforcedShorthandSyntax: either_consistent
190
188
 
191
189
  # looks for uses of _.each_with_object({}) {...}, _.map {...}.to_h, and Hash[_.map {...}]
192
190
  # that are actually just transforming the keys of a hash, and tries to use a simpler & faster
data/rubocop-tailwind.yml CHANGED
@@ -5,3 +5,7 @@ require:
5
5
  # Prevent string interpolation when building Tailwind CSS utils names
6
6
  Tailwind/StringInterpolation:
7
7
  Enabled: false
8
+
9
+ # Prevent max-width media query Tailwind CSS utility classes. min-width media queries should be used instead.
10
+ Tailwind/MaxWidthMediaQueries:
11
+ Enabled: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-styles
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.0
4
+ version: 13.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-08 00:00:00.000000000 Z
11
+ date: 2024-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.66.0
19
+ version: 1.68.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.66.0
26
+ version: 1.68.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-capybara
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -365,6 +365,7 @@ files:
365
365
  - lib/rubocop/cop/style/hash_transformation.rb
366
366
  - lib/rubocop/cop/style/iso8601_date.rb
367
367
  - lib/rubocop/cop/style/open_struct_use.rb
368
+ - lib/rubocop/cop/tailwind/max_width_media_queries.rb
368
369
  - lib/rubocop/cop/tailwind/string_interpolation.rb
369
370
  - rubocop-all.yml
370
371
  - rubocop-bundler.yml