Merge pull request #1658 from consul/chore/add_coffeelint_config
Add CoffeeLint configuration file && Fixes
This commit is contained in:
@@ -64,6 +64,12 @@ If you add SCSS code you can check it with:
|
|||||||
scss-lint
|
scss-lint
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you work on Coffeescript code you can check it with [coffeelint](http://www.coffeelint.org/) (install with `npm install -g coffeelint`) :
|
||||||
|
|
||||||
|
```
|
||||||
|
coffeelint .
|
||||||
|
```
|
||||||
|
|
||||||
You can use the default admin user from the seeds file:
|
You can use the default admin user from the seeds file:
|
||||||
|
|
||||||
**user:** admin@consul.dev
|
**user:** admin@consul.dev
|
||||||
|
|||||||
@@ -65,6 +65,12 @@ Si añades código SCSS puedes revisarlo con:
|
|||||||
scss-lint
|
scss-lint
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Si trabajas en código coffeescript puedes revisarlo con [coffeelint](http://www.coffeelint.org/) (instalalo con `npm install -g coffeelint`) :
|
||||||
|
|
||||||
|
```
|
||||||
|
coffeelint .
|
||||||
|
```
|
||||||
|
|
||||||
Puedes usar el usuario administrador por defecto del fichero seeds:
|
Puedes usar el usuario administrador por defecto del fichero seeds:
|
||||||
|
|
||||||
**user:** admin@consul.dev
|
**user:** admin@consul.dev
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ App.AdvancedSearch =
|
|||||||
$('#js-advanced-search').data('advanced-search-terms')
|
$('#js-advanced-search').data('advanced-search-terms')
|
||||||
|
|
||||||
toggle_form: (event) ->
|
toggle_form: (event) ->
|
||||||
event.preventDefault();
|
event.preventDefault()
|
||||||
$('#js-advanced-search').slideToggle()
|
$('#js-advanced-search').slideToggle()
|
||||||
|
|
||||||
toggle_date_options: ->
|
toggle_date_options: ->
|
||||||
@@ -22,7 +22,7 @@ App.AdvancedSearch =
|
|||||||
|
|
||||||
$('.js-calendar').datepicker
|
$('.js-calendar').datepicker
|
||||||
regional: locale
|
regional: locale
|
||||||
maxDate: "+0d"
|
maxDate: "+0d"
|
||||||
$('.js-calendar-full').datepicker
|
$('.js-calendar-full').datepicker
|
||||||
regional: locale
|
regional: locale
|
||||||
|
|
||||||
@@ -39,4 +39,4 @@ App.AdvancedSearch =
|
|||||||
|
|
||||||
$('#js-advanced-search-date-min').on
|
$('#js-advanced-search-date-min').on
|
||||||
change: ->
|
change: ->
|
||||||
App.AdvancedSearch.toggle_date_options()
|
App.AdvancedSearch.toggle_date_options()
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ App.AllowParticipation =
|
|||||||
initialize: ->
|
initialize: ->
|
||||||
$(document).on {
|
$(document).on {
|
||||||
'mouseenter focus': ->
|
'mouseenter focus': ->
|
||||||
$(this).find(".js-participation-not-allowed").show();
|
$(this).find(".js-participation-not-allowed").show()
|
||||||
$(this).find(".js-participation-allowed").hide();
|
$(this).find(".js-participation-allowed").hide()
|
||||||
mouseleave: ->
|
mouseleave: ->
|
||||||
$(this).find(".js-participation-not-allowed").hide();
|
$(this).find(".js-participation-not-allowed").hide()
|
||||||
$(this).find(".js-participation-allowed").show();
|
$(this).find(".js-participation-allowed").show()
|
||||||
}, ".js-participation"
|
}, ".js-participation"
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ App.Banners =
|
|||||||
|
|
||||||
update_style: (selector, style) ->
|
update_style: (selector, style) ->
|
||||||
$(selector).removeClass($(selector).attr("class"), true)
|
$(selector).removeClass($(selector).attr("class"), true)
|
||||||
.addClass(style, true)
|
.addClass(style, true)
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
$('[data-js-banner-title]').on
|
$('[data-js-banner-title]').on
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ App.FixedBar =
|
|||||||
$(window).on 'scroll', ->
|
$(window).on 'scroll', ->
|
||||||
if $(window).scrollTop() > fixedBarTopPosition
|
if $(window).scrollTop() > fixedBarTopPosition
|
||||||
$this.addClass('is-fixed')
|
$this.addClass('is-fixed')
|
||||||
$("#check-ballot").css({ 'display': "inline-block" });
|
$("#check-ballot").css({ 'display': "inline-block" })
|
||||||
else
|
else
|
||||||
$this.removeClass('is-fixed')
|
$this.removeClass('is-fixed')
|
||||||
$("#check-ballot").hide()
|
$("#check-ballot").hide()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
App.IeAlert =
|
App.IeAlert =
|
||||||
set_cookie_and_hide: (event) ->
|
set_cookie_and_hide: (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$.cookie('ie_alert_closed', 'true', { path: '/', expires: 365 });
|
$.cookie('ie_alert_closed', 'true', { path: '/', expires: 365 })
|
||||||
$('.ie-callout').remove()
|
$('.ie-callout').remove()
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ App.LegislationAdmin =
|
|||||||
checkbox = $(this)
|
checkbox = $(this)
|
||||||
parent = $(this).parents('.row:eq(0)')
|
parent = $(this).parents('.row:eq(0)')
|
||||||
date_selector = $(this).data('disable-date')
|
date_selector = $(this).data('disable-date')
|
||||||
parent.find("input[type='text'][id^='"+date_selector+"']").each ->
|
parent.find("input[type='text'][id^='" + date_selector + "']").each ->
|
||||||
if checkbox.is(':checked')
|
if checkbox.is(':checked')
|
||||||
$(this).removeAttr("disabled")
|
$(this).removeAttr("disabled")
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ App.LegislationAllegations =
|
|||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
$('.js-toggle-allegations .draft-panel').on
|
$('.js-toggle-allegations .draft-panel').on
|
||||||
click: (e) ->
|
click: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if !App.LegislationAnnotatable.isMobile()
|
if !App.LegislationAnnotatable.isMobile()
|
||||||
App.LegislationAllegations.toggle_comments()
|
App.LegislationAllegations.toggle_comments()
|
||||||
|
|
||||||
$('.js-toggle-allegations').on
|
$('.js-toggle-allegations').on
|
||||||
click: (e) ->
|
click: (e) ->
|
||||||
# Toggle comments when the section title is visible
|
# Toggle comments when the section title is visible
|
||||||
if !App.LegislationAnnotatable.isMobile()
|
if !App.LegislationAnnotatable.isMobile()
|
||||||
if $(this).find('.draft-panel .panel-title:visible').length == 0
|
if $(this).find('.draft-panel .panel-title:visible').length == 0
|
||||||
App.LegislationAllegations.toggle_comments()
|
App.LegislationAllegations.toggle_comments()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ App.LegislationAnnotatable =
|
|||||||
$(elem).data("annotation-id")
|
$(elem).data("annotation-id")
|
||||||
|
|
||||||
annotation_id = target.data('annotation-id')
|
annotation_id = target.data('annotation-id')
|
||||||
$('[data-annotation-id="'+annotation_id+'"]').addClass('current-annotation')
|
$('[data-annotation-id="' + annotation_id + '"]').addClass('current-annotation')
|
||||||
|
|
||||||
$('#comments-box').html('')
|
$('#comments-box').html('')
|
||||||
App.LegislationAllegations.show_comments()
|
App.LegislationAllegations.show_comments()
|
||||||
@@ -84,7 +84,7 @@ App.LegislationAnnotatable =
|
|||||||
annotation_id: pid
|
annotation_id: pid
|
||||||
annotation_url: target.closest(".legislation-annotatable").data("legislation-annotatable-base-url")
|
annotation_url: target.closest(".legislation-annotatable").data("legislation-annotatable-base-url")
|
||||||
|
|
||||||
isMobile: () ->
|
isMobile: ->
|
||||||
return window.innerWidth <= 652
|
return window.innerWidth <= 652
|
||||||
|
|
||||||
viewerExtension: (viewer) ->
|
viewerExtension: (viewer) ->
|
||||||
@@ -154,7 +154,7 @@ App.LegislationAnnotatable =
|
|||||||
), 100)
|
), 100)
|
||||||
|
|
||||||
propotionalWeight: (v, max) ->
|
propotionalWeight: (v, max) ->
|
||||||
Math.floor(v*5/(max+1)) + 1
|
Math.floor(v * 5 / (max + 1)) + 1
|
||||||
|
|
||||||
addWeightClasses: ->
|
addWeightClasses: ->
|
||||||
annotationsLoaded: (annotations) ->
|
annotationsLoaded: (annotations) ->
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ App.RegistrationForm =
|
|||||||
if registrationForm.length > 0
|
if registrationForm.length > 0
|
||||||
usernameInput.on "focusout", ->
|
usernameInput.on "focusout", ->
|
||||||
clearUsernameMessage()
|
clearUsernameMessage()
|
||||||
username = usernameInput.val();
|
username = usernameInput.val()
|
||||||
validateUsername(username) if username != ""
|
validateUsername(username) if username != ""
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ App.Tags =
|
|||||||
current_tags = $tag_input.val().split(',').filter(Boolean)
|
current_tags = $tag_input.val().split(',').filter(Boolean)
|
||||||
|
|
||||||
if $.inArray(name, current_tags) >= 0
|
if $.inArray(name, current_tags) >= 0
|
||||||
current_tags.splice($.inArray(name, current_tags), 1);
|
current_tags.splice($.inArray(name, current_tags), 1)
|
||||||
else
|
else
|
||||||
current_tags.push name
|
current_tags.push name
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
App.Tracks =
|
App.Tracks =
|
||||||
|
|
||||||
tracking_enabled: ->
|
tracking_enabled: ->
|
||||||
_paq?
|
_paq?
|
||||||
|
|
||||||
set_custom_var: (id, name, value, scope) ->
|
set_custom_var: (id, name, value, scope) ->
|
||||||
_paq.push(['setCustomVariable', id, name, value, scope])
|
_paq.push(['setCustomVariable', id, name, value, scope])
|
||||||
_paq.push(['trackPageView'])
|
_paq.push(['trackPageView'])
|
||||||
|
|
||||||
track_event: ($this) ->
|
track_event: ($this) ->
|
||||||
category = $this.data('track-event-category')
|
category = $this.data('track-event-category')
|
||||||
action = $this.data('track-event-action')
|
action = $this.data('track-event-action')
|
||||||
_paq.push(['trackEvent', category, action])
|
_paq.push(['trackEvent', category, action])
|
||||||
@@ -17,9 +17,9 @@ App.Tracks =
|
|||||||
$('[data-track-usertype]').each ->
|
$('[data-track-usertype]').each ->
|
||||||
$this = $(this)
|
$this = $(this)
|
||||||
usertype = $this.data('track-usertype')
|
usertype = $this.data('track-usertype')
|
||||||
App.Tracks.set_custom_var(1, "usertype", usertype, "visit")
|
App.Tracks.set_custom_var(1, "usertype", usertype, "visit")
|
||||||
|
|
||||||
$('[data-track-event-category]').each ->
|
$('[data-track-event-category]').each ->
|
||||||
$this = $(this)
|
$this = $(this)
|
||||||
App.Tracks.track_event($this)
|
App.Tracks.track_event($this)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ App.TreeNavigator =
|
|||||||
elem.siblings('ul').show()
|
elem.siblings('ul').show()
|
||||||
|
|
||||||
if anchor = $(location).attr('hash')
|
if anchor = $(location).attr('hash')
|
||||||
if link = elem.find('a[href="'+anchor+'"]')
|
if link = elem.find('a[href="' + anchor + '"]')
|
||||||
link.parents('ul').each ->
|
link.parents('ul').each ->
|
||||||
$(this).show()
|
$(this).show()
|
||||||
$(this).siblings('span').removeClass('closed').addClass('open')
|
$(this).siblings('span').removeClass('closed').addClass('open')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
App.Users =
|
App.Users =
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
$('.initialjs-avatar').initial();
|
$('.initialjs-avatar').initial()
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ App.Votes =
|
|||||||
hoverize: (votes) ->
|
hoverize: (votes) ->
|
||||||
$(document).on {
|
$(document).on {
|
||||||
'mouseenter focus': ->
|
'mouseenter focus': ->
|
||||||
$("div.participation-not-allowed", this).show();
|
$("div.participation-not-allowed", this).show()
|
||||||
$("div.participation-allowed", this).hide();
|
$("div.participation-allowed", this).hide()
|
||||||
mouseleave: ->
|
mouseleave: ->
|
||||||
$("div.participation-not-allowed", this).hide();
|
$("div.participation-not-allowed", this).hide()
|
||||||
$("div.participation-allowed", this).show();
|
$("div.participation-allowed", this).show()
|
||||||
}, votes
|
}, votes
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
|
|||||||
114
coffeelint.json
Normal file
114
coffeelint.json
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
{
|
||||||
|
"coffeescript_error": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"arrow_spacing": {
|
||||||
|
"name": "arrow_spacing",
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"no_tabs": {
|
||||||
|
"name": "no_tabs",
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_trailing_whitespace": {
|
||||||
|
"name": "no_trailing_whitespace",
|
||||||
|
"level": "warn",
|
||||||
|
"allowed_in_comments": false,
|
||||||
|
"allowed_in_empty_lines": true
|
||||||
|
},
|
||||||
|
"max_line_length": {
|
||||||
|
"name": "max_line_length",
|
||||||
|
"value": 140,
|
||||||
|
"level": "warn",
|
||||||
|
"limitComments": true
|
||||||
|
},
|
||||||
|
"line_endings": {
|
||||||
|
"name": "line_endings",
|
||||||
|
"level": "ignore",
|
||||||
|
"value": "unix"
|
||||||
|
},
|
||||||
|
"no_trailing_semicolons": {
|
||||||
|
"name": "no_trailing_semicolons",
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"indentation": {
|
||||||
|
"name": "indentation",
|
||||||
|
"value": 2,
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"camel_case_classes": {
|
||||||
|
"name": "camel_case_classes",
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"colon_assignment_spacing": {
|
||||||
|
"name": "colon_assignment_spacing",
|
||||||
|
"level": "warn",
|
||||||
|
"spacing": {
|
||||||
|
"left": 0,
|
||||||
|
"right": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"no_implicit_braces": {
|
||||||
|
"name": "no_implicit_braces",
|
||||||
|
"level": "ignore",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"no_plusplus": {
|
||||||
|
"name": "no_plusplus",
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_throwing_strings": {
|
||||||
|
"name": "no_throwing_strings",
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_backticks": {
|
||||||
|
"name": "no_backticks",
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_implicit_parens": {
|
||||||
|
"name": "no_implicit_parens",
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_empty_param_list": {
|
||||||
|
"name": "no_empty_param_list",
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"no_stand_alone_at": {
|
||||||
|
"name": "no_stand_alone_at",
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"space_operators": {
|
||||||
|
"name": "space_operators",
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"duplicate_key": {
|
||||||
|
"name": "duplicate_key",
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"empty_constructor_needs_parens": {
|
||||||
|
"name": "empty_constructor_needs_parens",
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"cyclomatic_complexity": {
|
||||||
|
"name": "cyclomatic_complexity",
|
||||||
|
"value": 10,
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"newlines_after_classes": {
|
||||||
|
"name": "newlines_after_classes",
|
||||||
|
"value": 3,
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_unnecessary_fat_arrows": {
|
||||||
|
"name": "no_unnecessary_fat_arrows",
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"missing_fat_arrows": {
|
||||||
|
"name": "missing_fat_arrows",
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"non_empty_constructor_needs_parens": {
|
||||||
|
"name": "non_empty_constructor_needs_parens",
|
||||||
|
"level": "ignore"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user