Reputation: 1033
How can I make SublimeLinter-jshint ignore embedded ruby (erb) code? The following code causes the error "Expected an identifier and instead saw '<'" (and two others).
I would like SublimeLinter-jshint to ignore anything within <%
and %>
.
<script>
<% if @foo %>
var foo = 'bar';
<% end %>
</script>
Upvotes: 0
Views: 166
Reputation: 1033
JSHint has an undocumented ignoreDelimiters
option. To ignore erb statements, add a .jshintrc
file to your project (or specify a global one using SublimeLinter configuration) with the following settings:
{
"ignoreDelimiters": [
{ "start": "<%=", "end": "%>" },
{ "start": "<%", "end": "%>" }
]
}
Upvotes: 3