Consistently use middle dot (·) instead of bullet (•) to separate items (#25248)
This commit is contained in:
parent
0766c9a631
commit
768b00c4d0
19 changed files with 102 additions and 27 deletions
26
lib/linter/haml_middle_dot.rb
Normal file
26
lib/linter/haml_middle_dot.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module HamlLint
|
||||
# Bans the usage of “•” (bullet) in HTML/HAML in favor of “·” (middle dot) in anything that will end up as a text node. (including string literals in Ruby code)
|
||||
class Linter::MiddleDot < Linter
|
||||
include LinterRegistry
|
||||
|
||||
# rubocop:disable Style/MiddleDot
|
||||
BULLET = '•'
|
||||
# rubocop:enable Style/MiddleDot
|
||||
MIDDLE_DOT = '·'
|
||||
MESSAGE = "Use '#{MIDDLE_DOT}' (middle dot) instead of '#{BULLET}' (bullet)".freeze
|
||||
|
||||
def visit_plain(node)
|
||||
return unless node.text.include?(BULLET)
|
||||
|
||||
record_lint(node, MESSAGE)
|
||||
end
|
||||
|
||||
def visit_script(node)
|
||||
return unless node.script.include?(BULLET)
|
||||
|
||||
record_lint(node, MESSAGE)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue