Module: ZendeskAppsSupport::Validations::Source

Defined in:
lib/zendesk_apps_support/validations/source.rb

Constant Summary collapse

LINTER_OPTIONS =
{
  # enforcing options:
  noarg: true,
  undef: true,

  # relaxing options:
  eqnull: true,
  laxcomma: true,
  sub: true,

  # predefined globals:
  predef: %w(_ console services helpers alert confirm self
             JSON Base64 require module exports moment),

  browser: true
}.freeze

Class Method Summary collapse

Class Method Details

.call(package) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/zendesk_apps_support/validations/source.rb', line 25

def call(package)
  files = package.js_files
  app   = files.find { |file| file.relative_path == 'app.js' }

  if package_needs_app_js?(package)
    return [ ValidationError.new(:missing_source) ] unless app
  else
    return (package_has_code?(package) ? [ ValidationError.new(:no_code_for_ifo_notemplate) ] : [])
  end

  jshint_errors(files).flatten!
end