Only use `.jshintignore` for the ignore rules.

This commit is contained in:
Robin Ward 2014-04-01 12:28:17 -04:00
parent 512746b436
commit 36bb4c02b7
2 changed files with 9 additions and 15 deletions

View File

@ -8,3 +8,4 @@ lib/javascripts/moment_locale/
public/javascripts/
spec/phantom_js/smoke_test.js
vendor/
test/javascripts/helpers/

View File

@ -91,34 +91,27 @@ qHint.sendRequest = function (url, callback) {
};
<%
def jshint(dir, remove, to_ignore)
TO_IGNORE = File.read("#{Rails.root}/.jshintignore").split("\n")
def jshint(dir, remove)
result = ""
Dir.glob(dir).each do |f|
filename = f.sub("#{Rails.root}#{remove}", "")
filename = f.sub("#{Rails.root}/#{remove}", "")
ok = true
to_ignore.each do |ig|
ok = false if (filename =~ ig)
TO_IGNORE.each do |ig|
ok = false unless (filename.index(ig.sub(remove, '')).nil?)
end
depend_on filename
result << "qHint('#{filename}', '/assets/#{filename}', #{File.read(File.join(Rails.root, '.jshintrc'))});\n" if ok
end
result
end
%>
<%= jshint("#{Rails.root}/test/**/*.js",
"/test/javascripts/",
[/helpers\//]) %>
<%= jshint("#{Rails.root}/test/**/*.js", "test/javascripts/") %>
<%= jshint("#{Rails.root}/app/assets/javascripts/**/*.js", "app/assets/javascripts/") %>
<%= jshint("#{Rails.root}/app/assets/javascripts/**/*.js",
"/app/assets/javascripts/",
[/external\//,
/defer\//,
/locales\//,
/Markdown\.Editor\.js/]) %>