summaryrefslogtreecommitdiff
path: root/lib/haml_lint/inline_javascript.rb
blob: ff447513fd13123d13f8d85738bc23de6f8c531a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
unless Rails.env.production?
  require 'haml_lint/haml_visitor'
  require 'haml_lint/linter'
  require 'haml_lint/linter_registry'

  module HamlLint
    class Linter::InlineJavaScript < Linter
      include LinterRegistry
      
      def visit_tag(node)
        return unless node.tag_name == 'script'

        record_lint(node, 'Inline JavaScript is discouraged (https://docs.gitlab.com/ee/development/gotchas.html#do-not-use-inline-javascript-in-views)')
      end
    end
  end
end