Restrict InlineJavaScript for haml_lint to dev and test environment
This commit is contained in:
parent
28299de189
commit
b3537000aa
1 changed files with 11 additions and 9 deletions
|
@ -1,14 +1,16 @@
|
||||||
require 'haml_lint/haml_visitor'
|
unless Rails.env.production?
|
||||||
require 'haml_lint/linter'
|
require 'haml_lint/haml_visitor'
|
||||||
require 'haml_lint/linter_registry'
|
require 'haml_lint/linter'
|
||||||
|
require 'haml_lint/linter_registry'
|
||||||
|
|
||||||
module HamlLint
|
module HamlLint
|
||||||
class Linter::InlineJavaScript < Linter
|
class Linter::InlineJavaScript < Linter
|
||||||
include LinterRegistry
|
include LinterRegistry
|
||||||
|
|
||||||
def visit_filter(node)
|
def visit_filter(node)
|
||||||
return unless node.filter_type == 'javascript'
|
return unless node.filter_type == 'javascript'
|
||||||
record_lint(node, 'Inline JavaScript is discouraged (https://docs.gitlab.com/ee/development/gotchas.html#do-not-use-inline-javascript-in-views)')
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue