2017-08-08 03:19:44 -04:00
|
|
|
unless Rails.env.production?
|
|
|
|
require 'haml_lint/haml_visitor'
|
|
|
|
require 'haml_lint/linter'
|
|
|
|
require 'haml_lint/linter_registry'
|
2017-03-06 14:46:52 -05:00
|
|
|
|
2017-08-08 03:19:44 -04:00
|
|
|
module HamlLint
|
|
|
|
class Linter::InlineJavaScript < Linter
|
|
|
|
include LinterRegistry
|
2017-03-06 14:46:52 -05:00
|
|
|
|
2017-08-08 03:19:44 -04:00
|
|
|
def visit_filter(node)
|
|
|
|
return unless node.filter_type == 'javascript'
|
2017-11-14 04:02:39 -05:00
|
|
|
|
2017-08-08 03:19:44 -04:00
|
|
|
record_lint(node, 'Inline JavaScript is discouraged (https://docs.gitlab.com/ee/development/gotchas.html#do-not-use-inline-javascript-in-views)')
|
|
|
|
end
|
2017-03-06 14:46:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|