scss-lint 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ require 'sass'
2
+
3
+ module SCSSLint
4
+ class Linter::TypeInIdSelectorLinter < Linter
5
+ include LinterRegistry
6
+
7
+ class << self
8
+ def run(engine)
9
+ lints = []
10
+ engine.tree.each do |node|
11
+ if node.is_a?(Sass::Tree::RuleNode)
12
+ lints << check_type_in_selector(node)
13
+ end
14
+ end
15
+ lints.compact
16
+ end
17
+
18
+ def description
19
+ 'Avoid ID names with unnecessary type selectors (e.g. prefer `#id` over `p#id`)'
20
+ end
21
+
22
+ private
23
+
24
+ def check_type_in_selector(rule_node)
25
+ selectors = rule_node.rule.first.to_s.split(',')
26
+
27
+ selectors.each do |selector|
28
+ return create_lint(rule_node) if selector.strip =~ /^[a-z0-9]+#.*/i
29
+ end
30
+
31
+ nil
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module SCSSLint
2
- VERSION = '0.3'
2
+ VERSION = '0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scss-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-09 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -78,6 +78,7 @@ files:
78
78
  - lib/scss_lint/linter/single_line_per_selector_linter.rb
79
79
  - lib/scss_lint/linter/sorted_properties_linter.rb
80
80
  - lib/scss_lint/linter/shorthand_linter.rb
81
+ - lib/scss_lint/linter/type_in_id_selector_linter.rb
81
82
  - lib/scss_lint/linter/property_format_linter.rb
82
83
  - lib/scss_lint/linter/zero_unit_linter.rb
83
84
  - lib/scss_lint/linter/hex_linter.rb