slim_lint 0.32.0 → 0.32.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: 57f5ec1042e443a09867926172b5b5b0282902c520d178ab0082ef349b938df7
4
- data.tar.gz: d8edb2714c4c68b4e58dfb4042d00209a0ac250ac669fdf4251f1a4574050f9c
3
+ metadata.gz: 7bb0508b633b0d797349808a09eb0c7e084abf03136bf28155d3bfd927149f86
4
+ data.tar.gz: 8202662b68b499ee1488c79ab65b8231803f2c23f90314bd3f127581341af43a
5
5
  SHA512:
6
- metadata.gz: d7c4d11c784321cf40fc1dd5ed8174f14f41f352f7c826604b013a08eb2515cf05d84dffbc1eb9b0f53bd00b0fdd3bee3b0999a31bc25cd9a086d3d9799ce510
7
- data.tar.gz: fe69df4001565d50098eb30239959733ea1abae9a816c36337b6ef4e4931a35a5cd7361ed88a84189eb2cd7f75f5083ad33f661d842502195b1282523121522e
6
+ metadata.gz: '024763359c3de59b1ea5015dd9aabff5f5623ef4dbf37a12d09eeb232e0972fa184a8b59e56098bdc5dfdaf2b6dfa95f2da886b662fa5cb2095cf6470a7f056e'
7
+ data.tar.gz: 6aadfc640e92aa731591d293b32bcb2e3d2b1113a8d066abe796ca48cfa011154a50e6782192bd48aa4e7196b4224d912b430f1502b4eaa115f24a6a847175af
@@ -7,29 +7,22 @@ module SlimLint
7
7
 
8
8
  MSG = 'Inconsistent quote style. %s'
9
9
 
10
- on_start do |_sexp|
11
- dummy_node = Struct.new(:line)
12
- document.source_lines.each_with_index do |line, index|
13
- # Skip lines without any quotes
14
- next unless line =~ /['"]/
15
-
16
- # Skip comments
17
- next if line =~ %r{^\s*(/{1,3})}
18
-
19
- # Skip Ruby lines that RuboCop will check
20
- next if skip_ruby_lines && line =~ /^\s*[=-]/
21
-
22
- # Find all quoted strings in attributes (ignoring nested quotes)
23
- single_quotes = line.scan(/^(?:[^'"]*'[^'"]*'[^'"]*)?(?:[^'"]*)('[^'"]*')/)
24
- double_quotes = line.scan(/^(?:[^'"]*'[^'"]*'[^'"]*)?(?:[^'"]*)("[^'"]*")/)
25
-
26
- if enforced_style == :single_quotes && double_quotes.any?
27
- report_lint(dummy_node.new(index + 1),
28
- format(MSG, "Use single quotes for attribute values (')"))
29
- elsif enforced_style == :double_quotes && single_quotes.any?
30
- report_lint(dummy_node.new(index + 1),
31
- format(MSG, 'Use double quotes for attribute values (")'))
32
- end
10
+ on [:html, :attrs] do |node|
11
+ line = document.source_lines[node.line - 1]
12
+
13
+ # Skip lines without any quotes
14
+ next unless line =~ /['"]/
15
+
16
+ # Find all quoted strings in attributes (ignoring nested quotes)
17
+ single_quotes = line.scan(/^(?:[^'"]*'[^'"]*'[^'"]*)?(?:[^'"]*)('[^'"]*')/)
18
+ double_quotes = line.scan(/^(?:[^'"]*'[^'"]*'[^'"]*)?(?:[^'"]*)("[^'"]*")/)
19
+
20
+ if enforced_style == :single_quotes && double_quotes.any?
21
+ report_lint(node,
22
+ format(MSG, "Use single quotes for attribute values (')"))
23
+ elsif enforced_style == :double_quotes && single_quotes.any?
24
+ report_lint(node,
25
+ format(MSG, 'Use double quotes for attribute values (")'))
33
26
  end
34
27
  end
35
28
 
@@ -38,9 +31,5 @@ module SlimLint
38
31
  def enforced_style
39
32
  config['enforced_style']&.to_sym || :single_quotes
40
33
  end
41
-
42
- def skip_ruby_lines
43
- config.fetch('skip_ruby_lines', true)
44
- end
45
34
  end
46
35
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SlimLint
5
- VERSION = '0.32.0'
5
+ VERSION = '0.32.1'
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slim_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.0
4
+ version: 0.32.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-03 00:00:00.000000000 Z
10
+ date: 2025-03-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rexml