Next coffeelint level.

This commit is contained in:
Martin Edenhofer 2015-09-24 15:04:45 +02:00
parent 76bf001564
commit df61622e3e
32 changed files with 88 additions and 83 deletions

View File

@ -94,7 +94,7 @@ class App.Controller extends Spine.Controller
if window.clipboardData # IE
window.clipboardData.setData( 'Text', text )
else
window.prompt( "Copy to clipboard: Ctrl+C, Enter", text )
window.prompt( 'Copy to clipboard: Ctrl+C, Enter', text )
# disable all delay's and interval's
disconnectClient: ->
@ -144,6 +144,7 @@ class App.Controller extends Spine.Controller
try
element.css( 'position', 'static' )
catch e
console.log 'error', e
position = [ 15, 30, 15, 0, -15, -30, -15, 0 ]
position = position.concat( position.concat( position ) )
@ -486,7 +487,7 @@ class App.Controller extends Spine.Controller
item.title = '???'
# convert backend name space to local name space
item.object = item.object.replace("::", '')
item.object = item.object.replace('::', '')
# lookup real data
if App[item.object] && App[item.object].exists( item.o_id )
@ -659,7 +660,7 @@ class App.SessionMessage extends App.ControllerModal
window.location.href = window.location.href
return true
throw "Cant reload page!"
throw 'Cant reload page!'
class App.UpdateHeader extends App.Controller
constructor: ->

View File

@ -1,3 +1,4 @@
# coffeelint: disable=no_unnecessary_double_quotes
class App.ChannelForm extends App.Controller
events:
'change form.js-params': 'updateParams'

View File

@ -318,7 +318,7 @@ class App.FirstStepsClues extends App.Controller
perform: (actions, container) ->
for action in actions
if action.indexOf(" ") < 0
if action.indexOf(' ') < 0
# 'click'
eventName = action
target = container

View File

@ -365,7 +365,7 @@ class Camera extends App.ControllerModal
# cache raw video data
@cacheScreenshot()
catch e
if e.name is "NS_ERROR_NOT_AVAILABLE"
if e.name is 'NS_ERROR_NOT_AVAILABLE'
setTimeout @updatePreview, 200
else
throw e

View File

@ -1,4 +1,4 @@
# coffeelint: disable=camel_case_classes
# coffeelint: disable=camel_case_classes,no_interpolation_in_single_quotes
class App.UiElement.autocompletion
@render: (attribute, params) ->

View File

@ -88,7 +88,7 @@ class App.UiElement.richtext
# Called during upload progress, first parameter
# is decimal value from 0 to 100.
onProgress: (progress, fileSize, uploadedBytes) =>
@progressBar.width(parseInt(progress) + "%")
@progressBar.width(parseInt(progress) + '%')
@progressText.text(parseInt(progress))
# hide cancel on 90%
if parseInt(progress) >= 90

View File

@ -5,11 +5,11 @@ class App.UiElement.textarea
item = $( App.view('generic/textarea')( attribute: attribute ) + '<div class="file-uploader ' + attribute.class + '" id="' + fileUploaderId + '"></div>' )
a = ->
visible = $( item[0] ).is(":visible")
visible = $( item[0] ).is(':visible')
if visible && !$( item[0] ).expanding('active')
$( item[0] ).expanding()
$( item[0] ).on('focus', ->
visible = $( item[0] ).is(":visible")
visible = $( item[0] ).is(':visible')
if visible && !$( item[0] ).expanding('active')
$( item[0] ).expanding().focus()
)

View File

@ -448,7 +448,7 @@ class App.TicketCreate extends App.Controller
return
# if not, show start screen
ui.navigate "#"
ui.navigate '#'
fail: ->
ui.log 'save failed!'

View File

@ -314,7 +314,7 @@ class Base extends App.Wizard
logoUrl: logoUrl
organization: organization
)
@$("input, select").first().focus()
@$('input, select').first().focus()
onLogoPick: (event) =>
reader = new FileReader()

View File

@ -180,9 +180,9 @@ class LayoutRefCommunicationReply extends App.ControllerContent
if @content is 'no_content'
@content = ''
else if @content is 'content'
@content = "some content la la la la"
@content = 'some content la la la la'
else
@content = "<p>some</p><p>multiline content</p>1<p>2</p><p>3</p>"
@content = '<p>some</p><p>multiline content</p>1<p>2</p><p>3</p>'
@render()
@ -255,7 +255,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent
@attachmentPlaceholder.velocity
properties:
translateX: -@attachmentInputHolder.position().left + "px"
translateX: -@attachmentInputHolder.position().left + 'px'
options:
duration: duration
easing: 'easeOutQuad'
@ -358,7 +358,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent
return ( size / Math.pow(1024, i) ).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
updateUploadProgress: (progress) =>
@progressBar.width(progress + "%")
@progressBar.width(progress + '%')
@progressText.text(progress)
if progress is 100
@ -553,7 +553,7 @@ class App.ControllerWizard extends App.ControllerContent
button = $(e.currentTarget)
switch button.attr('data-action')
when "reveal" then @showNextButton button
when 'reveal' then @showNextButton button
showNextButton: (sibling) ->
sibling.parents('.wizard-slide').find('.btn.hide').removeClass('hide')
@ -587,7 +587,7 @@ class ImportWizard extends App.ControllerWizard
@otrsLink.on 'input', _.debounce(@checkOtrsLink, 600)
checkOtrsLink: (e) =>
if @otrsLink.val() is ""
if @otrsLink.val() is ''
@inputFeedback.attr('data-state', '')
return
@ -802,28 +802,28 @@ class TicketZoomRef extends App.ControllerContent
colors: [
{
name: 'Yellow'
color: "#f7e7b2"
color: '#f7e7b2'
},
{
name: 'Green'
color: "#bce7b6"
color: '#bce7b6'
},
{
name: 'Blue'
color: "#b3ddf9"
color: '#b3ddf9'
},
{
name: 'Pink'
color: "#fea9c5"
color: '#fea9c5'
},
{
name: 'Purple'
color: "#eac5ee"
color: '#eac5ee'
}
]
activeColorIndex: 0
highlightClassPrefix: "highlight-"
highlightClassPrefix: 'highlight-'
constructor: ->
super
@ -1244,7 +1244,7 @@ class CluesRef extends App.ControllerContent
perform: (actions, container) ->
for action in actions
if action.indexOf(" ") < 0
if action.indexOf(' ') < 0
# 'click'
eventName = action
target = container
@ -1398,7 +1398,7 @@ class SchedulersRef extends App.ControllerContent
for hour in hours
# split off am/pm
[hour, suffix] = hour.split(" ")
[hour, suffix] = hour.split(' ')
for minute in minutes
combined = "#{ hour }:#{ minute }"
@ -1434,7 +1434,7 @@ class InputsRef extends App.ControllerContent
name: 'project-name'
id: 'project-name-123'
placeholder: 'Enter Project Name'
options: [{"value":0,"name":"Apple"},{"value":1,"name":"Microsoft","selected":true},{"value":2,"name":"Google"},{"value":3,"name":"Deutsche Bahn"},{"value":4,"name":"Sparkasse"},{"value":5,"name":"Deutsche Post"},{"value":6,"name":"Mitfahrzentrale"},{"value":7,"name":"Starbucks"},{"value":8,"name":"Mac Donalds"},{"value":9,"name":"Flixbus"},{"value":10,"name":"Betahaus"},{"value":11,"name":"Bruno Banani"},{"value":12,"name":"Alpina"},{"value":13,"name":"Samsung"},{"value":14,"name":"ChariTea"},{"value":15,"name":"fritz-kola"},{"value":16,"name":"Vitamin Water"},{"value":17,"name":"Znuny"},{"value":18,"name":"Max & Moritz"}]
options: [{value:0,name:'Apple'},{value:1,name:'Microsoft',selected:true},{value:2,name:'Google'},{value:3,name:'Deutsche Bahn'},{value:4,name:'Sparkasse'},{value:5,name:'Deutsche Post'},{value:6,name:'Mitfahrzentrale'},{value:7,name:'Starbucks'},{value:8,name:'Mac Donalds'},{value:9,name:'Flixbus'},{value:10,name:'Betahaus'},{value:11,name:'Bruno Banani'},{value:12,name:'Alpina'},{value:13,name:'Samsung'},{value:14,name:'ChariTea'},{value:15,name:'fritz-kola'},{value:16,name:'Vitamin Water'},{value:17,name:'Znuny'},{value:18,name:'Max & Moritz'}]
@$('.searchableSelectPlaceholder').replaceWith( searchableSelectObject.element() )
# selectable search
@ -1493,7 +1493,7 @@ class CalendarSubscriptionsRef extends App.ControllerContent
if data.length is 0
@output
.attr 'disabled', true
.text "No subscriptions active"
.text 'No subscriptions active'
return
# check if all my tickets got selected
@ -1502,21 +1502,21 @@ class CalendarSubscriptionsRef extends App.ControllerContent
if own.length > 0
if own.length is optionCount
modules.push "all my tickets"
modules.push 'all my tickets'
else
modules.push.apply modules, own.map (entry) ->
[option, value] = entry.name.split('/')
return "#{ translationTable[value] } #{ translationTable[option] }"
modules[modules.length-1] += " tickets"
modules[modules.length-1] += ' tickets'
if not_assigned.length > 0
if not_assigned.length is optionCount
modules.push "all not assigned tickets"
modules.push 'all not assigned tickets'
else
modules.push.apply modules, not_assigned.map (entry) ->
[option, value] = entry.name.split('/')
return "#{ translationTable[value] } #{ translationTable[option] }"
modules[modules.length-1] += " tickets"
modules[modules.length-1] += ' tickets'
@output
.attr 'disabled', false

View File

@ -99,7 +99,7 @@ class Index extends App.ControllerContent
# reset
@Config.set( 'requested_url', '' )
else
@log 'notice', "REDIRECT to -#/-"
@log 'notice', 'REDIRECT to -#/-'
@navigate '#/'
error: (xhr, statusText, error) =>

View File

@ -1,3 +1,4 @@
# coffeelint: disable=duplicate_key
class Index extends App.ControllerTabs
header: 'Object Manager'
constructor: ->

View File

@ -67,7 +67,7 @@ class App.TaskbarWidget extends App.Controller
for item in items
key = $(item).data('key')
if !key
throw "No such key attributes found for task item"
throw 'No such key attributes found for task item'
order.push key
App.TaskManager.reorder( order )
@ -78,7 +78,7 @@ class App.TaskbarWidget extends App.Controller
if !key
key = $(e.target).parents('a').data('key')
if !key
throw "No such key attributes found for task item"
throw 'No such key attributes found for task item'
# check if input has changed
worker = App.TaskManager.worker( key )

View File

@ -511,7 +511,7 @@ class App.TicketZoom extends App.Controller
# validate article
articleParams = @formParam( @$('.article-add') )
console.log "submit article", articleParams
console.log 'submit article', articleParams
if articleParams['body']
articleParams.from = @Session.get().displayName()
articleParams.ticket_id = ticket.id

View File

@ -202,7 +202,7 @@ class App.TicketZoomArticleNew extends App.Controller
# Called during upload progress, first parameter
# is decimal value from 0 to 100.
onProgress: (progress, fileSize, uploadedBytes) =>
@progressBar.width(parseInt(progress) + "%")
@progressBar.width(parseInt(progress) + '%')
@progressText.text(parseInt(progress))
# hide cancel on 90%
if parseInt(progress) >= 90
@ -250,7 +250,7 @@ class App.TicketZoomArticleNew extends App.Controller
@recipientListArrow.css('top', arrowCenter)
@recipientList.css('top', top)
$.Velocity.hook(@recipientList, 'transformOriginX', "0")
$.Velocity.hook(@recipientList, 'transformOriginX', '0')
$.Velocity.hook(@recipientList, 'transformOriginY', "#{ arrowCenter }px")
@recipientList.velocity
@ -288,7 +288,7 @@ class App.TicketZoomArticleNew extends App.Controller
add_recipient: (e) ->
e.stopPropagation()
e.preventDefault()
console.log "add recipient", e
console.log 'add recipient', e
# store recipient
toggleVisibility: ->
@ -297,14 +297,14 @@ class App.TicketZoomArticleNew extends App.Controller
.removeClass 'is-public'
.addClass 'is-internal'
@$('[name="internal"]').val 'true'
@$('[name=internal]').val 'true'
else
@articleNewEdit
.addClass 'is-public'
.removeClass 'is-internal'
@$('[name="internal"]').val ''
@$('[name=internal]').val ''
showSelectableArticleType: =>
@el.find('.js-articleTypes').removeClass('is-hidden')
@ -328,7 +328,7 @@ class App.TicketZoomArticleNew extends App.Controller
setArticleType: (type) ->
typeIcon = @$('.js-selectedType')
@type = type
@$('[name="type"]').val(type)
@$('[name=type]').val(type)
@articleNewEdit.attr('data-type', type)
typeIcon.find('use').attr 'xlink:href', "#icon-#{@type}"
@ -340,7 +340,7 @@ class App.TicketZoomArticleNew extends App.Controller
@$("[name=#{name}]").closest('.form-group').removeClass('hide')
# check if signature need to be added
body = @$('[data-name="body"]').html() || ''
body = @$('[data-name=body]').html() || ''
signature = undefined
if @ticket.group.signature_id
signature = App.Signature.find( @ticket.group.signature_id )
@ -352,11 +352,11 @@ class App.TicketZoomArticleNew extends App.Controller
if !App.Utils.lastLineEmpty(body)
body = body + '<br>'
body = body + "<div data-signature=\"true\" data-signature-id=\"#{signature.id}\">#{signatureFinished}</div>"
@$('[data-name="body"]').html(body)
@$('[data-name=body]').html(body)
# remove old signature
else
@$('[data-name="body"]').find("[data-signature=true]").remove()
@$('[data-name=body]').find('[data-signature=true]').remove()
detectEmptyTextarea: =>
if !@textarea.text().trim()
@ -389,7 +389,7 @@ class App.TicketZoomArticleNew extends App.Controller
easing: 'easeOutQuad'
# scroll to bottom
@textarea.velocity "scroll",
@textarea.velocity 'scroll',
container: @textarea.scrollParent()
offset: 99999
duration: 300
@ -411,7 +411,7 @@ class App.TicketZoomArticleNew extends App.Controller
# move attachment text to the left bottom (bottom happens automatically)
@attachmentPlaceholder.velocity
properties:
translateX: -@attachmentInputHolder.position().left + "px"
translateX: -@attachmentInputHolder.position().left + 'px'
options:
duration: duration
easing: 'easeOutQuad'

View File

@ -192,7 +192,7 @@ class ArticleViewItem extends App.Controller
article.removeClass('state--folde-out')
# scroll back up
article.velocity "scroll",
article.velocity 'scroll',
container: article.scrollParent()
offset: -article.offset().top - metaTop.outerHeight()
duration: animSpeed
@ -224,7 +224,7 @@ class ArticleViewItem extends App.Controller
metaTop.removeClass('hide')
# balance out the top meta height by scrolling down
article.velocity("scroll",
article.velocity('scroll',
container: article.scrollParent()
offset: -article.offset().top + metaTop.outerHeight()
duration: animSpeed

View File

@ -15,6 +15,6 @@ class Widget
| Your Zammad Team!
|
"""
console.log(banner, "text-decoration: underline;", "text-decoration: none;")
console.log(banner, 'text-decoration: underline;', 'text-decoration: none;')
App.Config.set( 'hello_banner', Widget, 'Widgets' )
App.Config.set('hello_banner', Widget, 'Widgets')

View File

@ -164,7 +164,7 @@ class App.OnlineNotificationWidget extends App.Controller
container: 'body'
html: true
placement: 'right'
viewport: { "selector": "#app", "padding": 10 }
viewport: { selector: '#app', padding: 10 }
template: App.view('widget/online_notification')()
title: ' '
content: ' '

View File

@ -26,11 +26,11 @@ class App.TicketStats extends App.Controller
load: (object) =>
if @organization
ajaxKey = "org_" + @organization.id
ajaxKey = "org_#{@organization.id}"
data =
organization_id: @organization.id
else
ajaxKey = "user_" + @user.id
ajaxKey = "user_#{@user.id}"
data =
user_id: @user.id
organization_id: @user.organization_id

View File

@ -95,7 +95,7 @@ class _Singleton
if !@moduleColorsMap[module]
@moduleColorsMap[module]= @yieldColor()
color = @moduleColorsMap[module]
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold"
colorString = 'color: hsl(' + (color) + ',99%,40%); font-weight: bold'
logArgs = [prefix, colorString].concat(args)
else
logArgs = [prefix].concat(args)

View File

@ -130,7 +130,7 @@ class _trackSingleton
newDataNew.push item
catch e
# nothing
console.log 'error', e
App.Ajax.request(
type: 'POST'

View File

@ -12,11 +12,11 @@ class App.PrettyDate
if diff > 0
escalated = '-'
if diff >= 0
style = "class=\"label label-danger\""
style = 'class="label label-danger"'
else if diff > -60 * 60
style = "class=\"label label-warning\""
style = 'class="label label-warning"'
else
style = "class=\"label label-success\""
style = 'class="label label-success"'
# remember past/future
direction = 'future'

View File

@ -1,3 +1,4 @@
# coffeelint: disable=no_unnecessary_double_quotes
class App.Utils
# textCleand = App.Utils.textCleanup( rawText )

View File

@ -272,7 +272,7 @@ class _webSocketSingleton extends App.Controller
App.Delay.set @connect, 4500, 'websocket-try-reconnect-after-x-sec', 'ws'
@ws.onerror = (e) =>
@log 'debug', "ws:onerror", e
@log 'debug', 'ws:onerror', e
_receiveMessage: (data = []) =>
@ -289,17 +289,17 @@ class _webSocketSingleton extends App.Controller
# fill collection
if item['collection']
@log 'debug', "onmessage collection:" + item['collection']
@log 'debug', 'onmessage collection:' + item['collection']
App.Store.write( item['collection'], item['data'] )
# fire event
if item['event']
if typeof item['event'] is 'object'
for event in item['event']
@log 'debug', "onmessage event:" + event
@log 'debug', 'onmessage event:' + event
App.Event.trigger( event, item['data'] )
else
@log 'debug', "onmessage event:" + item['event']
@log 'debug', 'onmessage event:' + item['event']
App.Event.trigger( item['event'], item['data'] )
_ajaxInit: (data = {}) =>

View File

@ -1,4 +1,4 @@
# coffeelint: disable=no_this,indentation
# coffeelint: disable=no_this,indentation,no_unnecessary_double_quotes
Spine = @Spine or require('spine')
$ = Spine.$
Model = Spine.Model

View File

@ -1,3 +1,4 @@
# coffeelint: disable=,arrow_spacing
Spine = @Spine or require('spine')
Spine.Model.Local =

View File

@ -1,4 +1,4 @@
# coffeelint: disable=no_this,indentation
# coffeelint: disable=no_this,indentation,arrow_spacing
Spine = @Spine or require('spine')
$ = Spine.$

View File

@ -1,4 +1,4 @@
# coffeelint: disable=no_this
# coffeelint: disable=no_this,arrow_spacing,no_unnecessary_double_quotes
###
Spine.js MVC library
Released under the MIT License

View File

@ -42,6 +42,6 @@ Mit **Organisationen** können Sie Kunden **gruppieren**. Dies hat u. a. zwei be
searchResultAttributes: ->
display: "#{@displayName()}"
id: @id
class: "organization organization-popover"
class: 'organization organization-popover'
url: @uiUrl()
iconClass: "organization"
iconClass: 'organization'

View File

@ -56,4 +56,4 @@ class App.Ticket extends App.Model
id: @id
class: "level-#{@level()} ticket-popover"
url: @uiUrl()
iconClass: "priority"
iconClass: 'priority'

View File

@ -82,7 +82,7 @@ class App.User extends App.Model
vip = false
data = "data-id=\"#{@id}\""
else
cssClass += " user-popover"
cssClass += ' user-popover'
data = "data-id=\"#{@id}\""
else
vip = false
@ -129,6 +129,6 @@ class App.User extends App.Model
searchResultAttributes: ->
display: "#{@displayName()}"
id: @id
class: "user user-popover"
class: 'user user-popover'
url: @uiUrl()
iconClass: "user"
iconClass: 'user'

View File

@ -1,6 +1,6 @@
{
"arrow_spacing": {
"level": "ignore"
"level": "error"
},
"braces_spacing": {
"level": "ignore",
@ -31,7 +31,7 @@
"level": "ignore"
},
"ensure_comprehensions": {
"level": "warn"
"level": "error"
},
"eol_last": {
"level": "ignore"
@ -41,7 +41,7 @@
"level": "error"
},
"line_endings": {
"level": "ignore",
"level": "error",
"value": "unix"
},
"max_line_length": {
@ -61,14 +61,14 @@
"level": "error"
},
"no_debugger": {
"level": "warn",
"level": "error",
"console": false
},
"no_empty_functions": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "warn"
"level": "error"
},
"no_implicit_braces": {
"level": "ignore",
@ -79,16 +79,16 @@
"level": "ignore"
},
"no_interpolation_in_single_quotes": {
"level": "warn"
"level": "error"
},
"no_nested_string_interpolation": {
"level": "warn"
"level": "error"
},
"no_plusplus": {
"level": "ignore"
},
"no_private_function_fat_arrows": {
"level": "warn"
"level": "error"
},
"no_stand_alone_at": {
"level": "ignore"
@ -97,7 +97,7 @@
"level": "error"
},
"no_this": {
"level": "warn"
"level": "error"
},
"no_throwing_strings": {
"level": "ignore"
@ -111,10 +111,10 @@
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "ignore"
"level": "error"
},
"no_unnecessary_fat_arrows": {
"level": "warn"
"level": "error"
},
"non_empty_constructor_needs_parens": {
"level": "ignore"
@ -130,6 +130,6 @@
"level": "ignore"
},
"transform_messes_up_line_numbers": {
"level": "warn"
"level": "error"
}
}