lib/scss_lint/linter/comment.rb in scss-lint-0.37.0 vs lib/scss_lint/linter/comment.rb in scss-lint-0.38.0
- old
+ new
@@ -2,9 +2,20 @@
# Checks for uses of renderable comments (/* ... */)
class Linter::Comment < Linter
include LinterRegistry
def visit_comment(node)
- add_lint(node, 'Use `//` comments everywhere') unless node.invisible?
+ add_lint(node, 'Use `//` comments everywhere') unless node.invisible? || allowed?(node)
+ end
+
+ private
+
+ # @param node [CommentNode]
+ # @return [Boolean]
+ def allowed?(node)
+ return false unless config['allowed']
+ re = Regexp.new(config['allowed'])
+
+ node.value.join.match(re)
end
end
end