Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
c6bf292e
Commit
c6bf292e
authored
Mar 06, 2017
by
winniehell
Committed by
winh
Aug 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom linter for inline JavaScript to haml_lint (!9742)
parent
95b232f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
0 deletions
+22
-0
.haml-lint.yml
.haml-lint.yml
+3
-0
changelogs/unreleased/restrict-haml-javascript.yml
changelogs/unreleased/restrict-haml-javascript.yml
+4
-0
lib/haml_lint/inline_javascript.rb
lib/haml_lint/inline_javascript.rb
+14
-0
lib/tasks/haml-lint.rake
lib/tasks/haml-lint.rake
+1
-0
No files found.
.haml-lint.yml
View file @
c6bf292e
...
...
@@ -41,6 +41,9 @@ linters:
ImplicitDiv
:
enabled
:
true
InlineJavaScript
:
enabled
:
true
InlineStyles
:
enabled
:
false
...
...
changelogs/unreleased/restrict-haml-javascript.yml
0 → 100644
View file @
c6bf292e
---
title
:
Add custom linter for inline JavaScript to haml_lint
merge_request
:
9742
author
:
winniehell
lib/haml_lint/inline_javascript.rb
0 → 100644
View file @
c6bf292e
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
lib/tasks/haml-lint.rake
View file @
c6bf292e
unless
Rails
.
env
.
production?
require
'haml_lint/rake_task'
require
'haml_lint/inline_javascript'
HamlLint
::
RakeTask
.
new
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment