gl_rubocop 0.2.4 → 0.2.5

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: 20051ad7be570098d65231ae0699f2a8e0388ac1d46e635c2b967b04d4490278
4
- data.tar.gz: 92d0f9a01f967880e8db09a2715adad74144071489e3a39e0b05fd260dd54f33
3
+ metadata.gz: 2cf48112bc9eafd596804f516e47f35112f8fe783c89824927baabe203358c36
4
+ data.tar.gz: 1f5b3d7bbdb11915a6afd5aaeca0bed5ea6432d8670161d7e8ff562aa563d1a4
5
5
  SHA512:
6
- metadata.gz: 0ad7a44349b6182c777f3277b84458624ed4010c6e8d5effc08461779262dc021081a83b2dbe1c0a325f86292b621ac2f73181c06ee24cda60b69a5ecd79f0eb
7
- data.tar.gz: 17b072554bdbcb5df215abe5dd0c01c7d64324a0db62fdd555c8e931b16fbaa259d97a1a1028581fc3340b27e6e4bfb93963581c7414f5300d322a577d826ccd
6
+ metadata.gz: fccd43ad5c6c29f83384b87c1b0bf2b01872ec0a5d311bb30954a4cfa9724f71cd8a96a9efeee76fb807f37f9e08b4db8f066f2c57fed60f5ce6065a9b96bf9a
7
+ data.tar.gz: 991618a3e4e97f685a4886ad2f392b813637dc7af86ac8332da4aab6dddd2751ca5648e447c3d96c8434a45fec3126b39a58712f351aad7321e6727d334593c4
@@ -4,10 +4,12 @@ module GLRubocop
4
4
  # This cop ensures that view components include a data-test-id attribute.
5
5
  #
6
6
  # Good:
7
- # {data-test-id: "unique-id"}
7
+ # {data-test-id: 'unique-id'}
8
8
  # {data-test-id: @unique_id }
9
- # {'data-test-id': "unique-id"}
9
+ # {'data-test-id': 'unique-id'}
10
10
  # {"data-test-id": "unique-id"}
11
+ # {data: {test-id: 'unique-id'}}
12
+ # {data: {'test-id': 'unique-id'}}
11
13
  #
12
14
  # Bad:
13
15
  # {data: {testId: "unique-id"}}
@@ -15,7 +17,7 @@ module GLRubocop
15
17
 
16
18
  MSG = 'View components must include a data-test-id attribute'.freeze
17
19
  EMPTY_MSG = 'data-test-id attribute must not be empty'.freeze
18
- UNIQUE_IDENTIFIER = 'data-test-id'.freeze
20
+ UNIQUE_IDENTIFIER = 'test-id'.freeze
19
21
 
20
22
  def on_send(node)
21
23
  return unless file_exists? && valid_method_name?(node)
@@ -42,7 +44,7 @@ module GLRubocop
42
44
 
43
45
  def regex_for_indentifier_and_value
44
46
  key = Regexp.quote(UNIQUE_IDENTIFIER)
45
- /(?:#{key}|["']#{key}["']):\s*(["']([^"']*)["']|@\w+)/
47
+ /(?:["']?data-#{key}["']?|data:.?\{["']?#{key}["']?):\s*(["']([^"']*)["']|@\w+)/
46
48
  end
47
49
 
48
50
  def test_id_value
@@ -1,3 +1,3 @@
1
1
  module GLRubocop
2
- VERSION = '0.2.4'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gl_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Give Lively
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-15 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop