slim_lint_standard 0.0.3 → 0.0.3.2

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: b399c48ae4ed07e157cd481a2169e9fb562b34180b20639b4a340e4d4a9fd1ad
4
- data.tar.gz: 0f2cc79a135ebaf8ebd03b0db0cf7087d4d1148f867cc16978e0b9dd2b8eba10
3
+ metadata.gz: 5e0448b232b91bf88c417eb75e64c6da9ad18d0bfc7ba53528ad347b392447ab
4
+ data.tar.gz: f59363a96cc968962443a4485bd28987b6855141debce1bc881d316f4c0726d8
5
5
  SHA512:
6
- metadata.gz: cb58ed32bb86fc15153716e0da2a8c6b45d6ea5e828e4df1caabc0337ea77742baf1c579265c9869f1d890ecfee018ca679046252cac26f0095603c306ab6703
7
- data.tar.gz: 20733c7a91eadaf331c435b4abd29b66cfec965dba57af90c47fd272a51e2266e772cfc2a9f77abfd8a7335e485fe5aa306ca89bcb56809f14fb9b0f63f0b3d1
6
+ metadata.gz: 576123200da53bb1767f66993388afee1c1413dd09f7189c08cda5f753ecad6a946951cac70755b75039b6ff3ebef5dcba9cddf6ab915e29ed087d1847de91b0
7
+ data.tar.gz: c15b9d4cbe346857a85a4da550c0c299e69317b97d8a9d94bd739fac5de77e1eaede50c6f8f86acec8b9331ceb7beabfb23b6f70a40a3425f8e9c10c9598a5f8
data/config/default.yml CHANGED
@@ -47,6 +47,8 @@ linters:
47
47
 
48
48
  RedundantDiv:
49
49
  enabled: true
50
+ EnforcedStyle: implicit
51
+ SupportedStyles: [implicit, explicit]
50
52
 
51
53
  RuboCop:
52
54
  enabled: false
@@ -7,15 +7,22 @@ module SlimLint
7
7
  include LinterRegistry
8
8
 
9
9
  SHORTCUT_ATTRS = %w[id class]
10
- MESSAGE = "`div` is redundant when %s attribute shortcut is present"
10
+ IMPLICIT_MESSAGE = "`div` is redundant when %s attribute shortcut is present"
11
+ EXPLICIT_MESSAGE = "explicit `div` is preferred over bare %s attribute"
11
12
 
12
- on [:html, :tag, "div", capture(:attrs, [:html, :attrs]), anything] do |sexp|
13
- _, _, name, value = captures[:attrs][2]
14
- next unless name
15
- next unless value[0] == :static
16
- next unless SHORTCUT_ATTRS.include?(name.value)
17
-
18
- report_lint(sexp[2], MESSAGE % name)
13
+ on [:html, :tag, capture(:tag, anything), capture(:attrs, [:html, :attrs]), anything] do |sexp|
14
+ case @config["EnforcedStyle"]
15
+ when "implicit", :implicit
16
+ _, _, name, value = captures[:attrs][2]
17
+ next unless captures[:tag] == "div"
18
+ next unless name
19
+ next unless value[0] == :static
20
+ next unless SHORTCUT_ATTRS.include?(name.value)
21
+ report_lint(sexp[2], IMPLICIT_MESSAGE % name)
22
+ when "explicit", :explicit
23
+ next unless captures[:tag] == "." || captures[:tag] == "#"
24
+ report_lint(sexp[2], EXPLICIT_MESSAGE % captures[:tag])
25
+ end
19
26
  end
20
27
  end
21
28
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SlimLint
5
- VERSION = "0.0.3"
5
+ VERSION = "0.0.3.2"
6
6
  end
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.3
4
+ version: 0.0.3.2
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
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
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: rubocop
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -210,7 +224,7 @@ homepage: https://github.com/pvande/slim-lint-standard
210
224
  licenses:
211
225
  - MIT
212
226
  metadata: {}
213
- post_install_message:
227
+ post_install_message:
214
228
  rdoc_options: []
215
229
  require_paths:
216
230
  - lib
@@ -225,8 +239,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
239
  - !ruby/object:Gem::Version
226
240
  version: '0'
227
241
  requirements: []
228
- rubygems_version: 3.0.3.1
229
- signing_key:
242
+ rubygems_version: 3.4.10
243
+ signing_key:
230
244
  specification_version: 4
231
245
  summary: Linter for Slim templates
232
246
  test_files: []