slim_lint_standard 0.0.2.2 → 0.0.3.1
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 +48 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7056df39196b2bccca2e7df3c153d92505ea08782f13d0ca1988cd611515829
|
4
|
+
data.tar.gz: 339d15ea51b1ea34bbaf6a6bb8288edbdf9a18068e0533ca3ab57b800310e0cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c41c3179b1474bb5dee7d3c33ac45b20ab311622c5875860b6f2517cd718a6c850f8ec51ff6985a6870b2382da9d464409680ff407d11683bd13e95510c0f251
|
7
|
+
data.tar.gz: d3f8749f8c6a8bdee6dda76fe55f9a13e899abe5cdfc84095bd42d329095355ded2fef7aa9c708392170be7d436fb1c1061ed310bcea9e8a6bfac9b9003caf82
|
@@ -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,44 @@
|
|
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.1
|
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: standard
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.16.1
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.16.1
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rubocop
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.78.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.78.0
|
14
42
|
- !ruby/object:Gem::Dependency
|
15
43
|
name: slim
|
16
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,6 +59,20 @@ dependencies:
|
|
31
59
|
- - "<"
|
32
60
|
- !ruby/object:Gem::Version
|
33
61
|
version: '5.0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rexml
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.3.0
|
69
|
+
type: :runtime
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.3.0
|
34
76
|
- !ruby/object:Gem::Dependency
|
35
77
|
name: pry
|
36
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +224,7 @@ homepage: https://github.com/pvande/slim-lint-standard
|
|
182
224
|
licenses:
|
183
225
|
- MIT
|
184
226
|
metadata: {}
|
185
|
-
post_install_message:
|
227
|
+
post_install_message:
|
186
228
|
rdoc_options: []
|
187
229
|
require_paths:
|
188
230
|
- lib
|
@@ -197,8 +239,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
239
|
- !ruby/object:Gem::Version
|
198
240
|
version: '0'
|
199
241
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
201
|
-
signing_key:
|
242
|
+
rubygems_version: 3.0.3.1
|
243
|
+
signing_key:
|
202
244
|
specification_version: 4
|
203
245
|
summary: Linter for Slim templates
|
204
246
|
test_files: []
|