slim_lint_standard 0.0.2.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slim_lint/linter/redundant_div.rb +5 -12
- data/lib/slim_lint/version.rb +1 -1
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b399c48ae4ed07e157cd481a2169e9fb562b34180b20639b4a340e4d4a9fd1ad
|
4
|
+
data.tar.gz: 0f2cc79a135ebaf8ebd03b0db0cf7087d4d1148f867cc16978e0b9dd2b8eba10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb58ed32bb86fc15153716e0da2a8c6b45d6ea5e828e4df1caabc0337ea77742baf1c579265c9869f1d890ecfee018ca679046252cac26f0095603c306ab6703
|
7
|
+
data.tar.gz: 20733c7a91eadaf331c435b4abd29b66cfec965dba57af90c47fd272a51e2266e772cfc2a9f77abfd8a7335e485fe5aa306ca89bcb56809f14fb9b0f63f0b3d1
|
@@ -1,28 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module SlimLint
|
4
|
-
# Checks for uses of the `div` tag where a class name or ID
|
4
|
+
# Checks for unnecessary uses of the `div` tag where a class name or ID
|
5
|
+
# already implies a div.
|
5
6
|
class Linter::RedundantDiv < Linter
|
6
7
|
include LinterRegistry
|
7
8
|
|
8
9
|
SHORTCUT_ATTRS = %w[id class]
|
9
|
-
|
10
|
-
EXPLICIT_MESSAGE = "Use an explicit `div` rather than a standalone %s attribute shortcut"
|
10
|
+
MESSAGE = "`div` is redundant when %s attribute shortcut is present"
|
11
11
|
|
12
|
-
on [:html, :tag,
|
12
|
+
on [:html, :tag, "div", capture(:attrs, [:html, :attrs]), anything] do |sexp|
|
13
13
|
_, _, name, value = captures[:attrs][2]
|
14
14
|
next unless name
|
15
15
|
next unless value[0] == :static
|
16
16
|
next unless SHORTCUT_ATTRS.include?(name.value)
|
17
17
|
|
18
|
-
|
19
|
-
when "implicit", "never", false, nil
|
20
|
-
report_lint(sexp[2], IMPLICIT_MESSAGE % name) if sexp[2].value == "div"
|
21
|
-
when "explicit", "always", true
|
22
|
-
report_lint(sexp[2], EXPLICIT_MESSAGE % name) if sexp[2].value =~ /[#.]/
|
23
|
-
else
|
24
|
-
raise ArgumentError, "Unknown value for `style`; please use 'implicit' or 'explicit'"
|
25
|
-
end
|
18
|
+
report_lint(sexp[2], MESSAGE % name)
|
26
19
|
end
|
27
20
|
end
|
28
21
|
end
|
data/lib/slim_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim_lint_standard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pieter van de Bruggen
|
8
8
|
- Shane da Silva
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rubocop
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.78.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.78.0
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: slim
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,6 +45,20 @@ dependencies:
|
|
31
45
|
- - "<"
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '5.0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rexml
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.3.0
|
34
62
|
- !ruby/object:Gem::Dependency
|
35
63
|
name: pry
|
36
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +210,7 @@ homepage: https://github.com/pvande/slim-lint-standard
|
|
182
210
|
licenses:
|
183
211
|
- MIT
|
184
212
|
metadata: {}
|
185
|
-
post_install_message:
|
213
|
+
post_install_message:
|
186
214
|
rdoc_options: []
|
187
215
|
require_paths:
|
188
216
|
- lib
|
@@ -197,8 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
225
|
- !ruby/object:Gem::Version
|
198
226
|
version: '0'
|
199
227
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
201
|
-
signing_key:
|
228
|
+
rubygems_version: 3.0.3.1
|
229
|
+
signing_key:
|
202
230
|
specification_version: 4
|
203
231
|
summary: Linter for Slim templates
|
204
232
|
test_files: []
|