diff options
author | winniehell <git@winniehell.de> | 2017-03-06 20:46:52 +0100 |
---|---|---|
committer | winh <winnie@gitlab.com> | 2017-08-07 11:37:16 +0200 |
commit | c6bf292efba4be34fd832684bd25036354d7336b (patch) | |
tree | d9a41626cf149683499fc093c2d8a6cd2d574e20 /lib/haml_lint | |
parent | 95b232f2cc9ceb3fe65d2c53d749c28c72c820f5 (diff) | |
download | gitlab-ce-c6bf292efba4be34fd832684bd25036354d7336b.tar.gz |
Add custom linter for inline JavaScript to haml_lint (!9742)
Diffstat (limited to 'lib/haml_lint')
-rw-r--r-- | lib/haml_lint/inline_javascript.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/haml_lint/inline_javascript.rb b/lib/haml_lint/inline_javascript.rb new file mode 100644 index 00000000000..f3ddcbb9c95 --- /dev/null +++ b/lib/haml_lint/inline_javascript.rb @@ -0,0 +1,14 @@ +require 'haml_lint/haml_visitor' +require 'haml_lint/linter' +require 'haml_lint/linter_registry' + +module HamlLint + class Linter::InlineJavaScript < Linter + include LinterRegistry + + def visit_filter(node) + 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)') + end + end +end |