slim_lint 0.31.1 → 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: e528d48427bf3d6eb65650f9c7075e1af697d5c857a1e5a34957f642cc5f049c
4
- data.tar.gz: d29e6a7d0f882210ea616a4630bfc8844b835dd23e7fd24b739e8ff432f07812
3
+ metadata.gz: 7bb0508b633b0d797349808a09eb0c7e084abf03136bf28155d3bfd927149f86
4
+ data.tar.gz: 8202662b68b499ee1488c79ab65b8231803f2c23f90314bd3f127581341af43a
5
5
  SHA512:
6
- metadata.gz: 63390317c8f8f7eb23ea3b559bdf8b649472dde41c24282e7781bc678669bf193b9bec856ee7c2df62ed569992aecefae4a3497db7796faeab0f95fddf1e5944
7
- data.tar.gz: 88226d7243e1c731f8da46b120e31cf657629db05671311a86b819eb1e12f96bc51728586ec3cc0ab70bfe87e1c6e5d5d6bfe987c47c9d8e8e6f5bad18550951
6
+ metadata.gz: '024763359c3de59b1ea5015dd9aabff5f5623ef4dbf37a12d09eeb232e0972fa184a8b59e56098bdc5dfdaf2b6dfa95f2da886b662fa5cb2095cf6470a7f056e'
7
+ data.tar.gz: 6aadfc640e92aa731591d293b32bcb2e3d2b1113a8d066abe796ca48cfa011154a50e6782192bd48aa4e7196b4224d912b430f1502b4eaa115f24a6a847175af
data/config/default.yml CHANGED
@@ -115,5 +115,8 @@ linters:
115
115
  TrailingWhitespace:
116
116
  enabled: true
117
117
 
118
+ QuoteConsistency:
119
+ enabled: false
120
+
118
121
  Zwsp:
119
122
  enabled: false
@@ -88,11 +88,7 @@ module SlimLint
88
88
  # @param include_private [Boolean]
89
89
  # @return [Boolean]
90
90
  def respond_to?(method_sym, include_private = false)
91
- if super
92
- true
93
- else
94
- @value.respond_to?(method_sym, include_private)
95
- end
91
+ super || @value.respond_to?(method_sym, include_private)
96
92
  end
97
93
  end
98
94
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SlimLint
4
+ # Checks for consistent quote usage in HTML attributes
5
+ class Linter::QuoteConsistency < Linter
6
+ include LinterRegistry
7
+
8
+ MSG = 'Inconsistent quote style. %s'
9
+
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 (")'))
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def enforced_style
32
+ config['enforced_style']&.to_sym || :single_quotes
33
+ end
34
+ end
35
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SlimLint
5
- VERSION = '0.31.1'
5
+ VERSION = '0.32.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slim_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.1
4
+ version: 0.32.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
10
+ date: 2025-03-04 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rexml
@@ -130,6 +129,7 @@ files:
130
129
  - lib/slim_lint/linter/file_length.rb
131
130
  - lib/slim_lint/linter/instance_variables.rb
132
131
  - lib/slim_lint/linter/line_length.rb
132
+ - lib/slim_lint/linter/quote_consistency.rb
133
133
  - lib/slim_lint/linter/redundant_div.rb
134
134
  - lib/slim_lint/linter/rubocop.rb
135
135
  - lib/slim_lint/linter/strict_locals_missing.rb
@@ -168,7 +168,6 @@ homepage: https://github.com/sds/slim-lint
168
168
  licenses:
169
169
  - MIT
170
170
  metadata: {}
171
- post_install_message:
172
171
  rdoc_options: []
173
172
  require_paths:
174
173
  - lib
@@ -183,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
182
  - !ruby/object:Gem::Version
184
183
  version: '0'
185
184
  requirements: []
186
- rubygems_version: 3.5.9
187
- signing_key:
185
+ rubygems_version: 3.6.2
188
186
  specification_version: 4
189
187
  summary: Slim template linting tool
190
188
  test_files: []