Add and apply ESLint spacing rules
For now we're only adding rules related to spacing and double quotes, following the same rules we use in Ruby, which are the same rules CoffeeScript followed when compiling these files. We're also using the recommended ESLint rules, which will warn us about many JavaScript common pitfalls, the `strict` rule which enforces using strict mode, and the `no-console` rule, which will prevent us from shipping code meant for debugging. Although it's arguably more common to use the JSON format to define these rules, I've chosen YAML because it's the format we use in all our linters.
This commit is contained in:
67
.eslintrc.yml
Normal file
67
.eslintrc.yml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
env:
|
||||||
|
browser: true
|
||||||
|
es6: false
|
||||||
|
extends: "eslint:recommended"
|
||||||
|
globals:
|
||||||
|
$: readonly
|
||||||
|
App: readonly
|
||||||
|
annotator: readonly
|
||||||
|
c3: readonly
|
||||||
|
CKEDITOR: readonly
|
||||||
|
L: readonly
|
||||||
|
Turbolinks: readonly
|
||||||
|
parserOptions:
|
||||||
|
ecmaVersion: 5
|
||||||
|
rules:
|
||||||
|
array-bracket-spacing: error
|
||||||
|
block-spacing: error
|
||||||
|
brace-style: error
|
||||||
|
comma-spacing: error
|
||||||
|
computed-property-spacing: error
|
||||||
|
curly: error
|
||||||
|
eol-last: error
|
||||||
|
func-call-spacing: error
|
||||||
|
indent:
|
||||||
|
- error
|
||||||
|
- 2
|
||||||
|
key-spacing: error
|
||||||
|
keyword-spacing: error
|
||||||
|
linebreak-style: error
|
||||||
|
lines-between-class-members: error
|
||||||
|
no-console: error
|
||||||
|
no-multi-spaces: error
|
||||||
|
no-multiple-empty-lines:
|
||||||
|
- error
|
||||||
|
- max: 1
|
||||||
|
no-spaced-func: error
|
||||||
|
no-tabs: error
|
||||||
|
no-trailing-spaces: error
|
||||||
|
no-whitespace-before-property: error
|
||||||
|
object-curly-spacing:
|
||||||
|
- error
|
||||||
|
- always
|
||||||
|
- objectsInObjects: false
|
||||||
|
padded-blocks:
|
||||||
|
- error
|
||||||
|
- never
|
||||||
|
quotes:
|
||||||
|
- error
|
||||||
|
- double
|
||||||
|
- avoidEscape: true
|
||||||
|
semi-spacing: error
|
||||||
|
space-before-blocks: error
|
||||||
|
space-before-function-paren:
|
||||||
|
- error
|
||||||
|
- never
|
||||||
|
space-in-parens: error
|
||||||
|
space-infix-ops: error
|
||||||
|
space-unary-ops: error
|
||||||
|
spaced-comment:
|
||||||
|
- error
|
||||||
|
- always
|
||||||
|
- markers:
|
||||||
|
- "="
|
||||||
|
exceptions:
|
||||||
|
- "-"
|
||||||
|
strict: error
|
||||||
|
switch-colon-spacing: error
|
||||||
@@ -5,3 +5,6 @@ scss:
|
|||||||
erblint:
|
erblint:
|
||||||
enabled: true
|
enabled: true
|
||||||
config_file: .erb-lint.yml
|
config_file: .erb-lint.yml
|
||||||
|
eslint:
|
||||||
|
enabled: true
|
||||||
|
config_file: .eslintrc.yml
|
||||||
|
|||||||
@@ -44,5 +44,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -14,5 +14,4 @@
|
|||||||
}, ".js-participation");
|
}, ".js-participation");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -27,5 +27,4 @@
|
|||||||
App.Answers.nestedAnswers();
|
App.Answers.nestedAnswers();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
(function() {
|
(function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
window.App = {};
|
window.App = {};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -116,8 +116,9 @@ var initialize_modules = function() {
|
|||||||
App.LegislationAdmin.initialize();
|
App.LegislationAdmin.initialize();
|
||||||
App.LegislationAllegations.initialize();
|
App.LegislationAllegations.initialize();
|
||||||
App.Legislation.initialize();
|
App.Legislation.initialize();
|
||||||
if ( $(".legislation-annotatable").length )
|
if ($(".legislation-annotatable").length) {
|
||||||
App.LegislationAnnotatable.initialize();
|
App.LegislationAnnotatable.initialize();
|
||||||
|
}
|
||||||
App.WatchFormChanges.initialize();
|
App.WatchFormChanges.initialize();
|
||||||
App.TreeNavigator.initialize();
|
App.TreeNavigator.initialize();
|
||||||
App.Documentable.initialize();
|
App.Documentable.initialize();
|
||||||
@@ -135,11 +136,13 @@ var initialize_modules = function() {
|
|||||||
App.SendAdminNotificationAlert.initialize();
|
App.SendAdminNotificationAlert.initialize();
|
||||||
App.ModalDownload.initialize();
|
App.ModalDownload.initialize();
|
||||||
App.Settings.initialize();
|
App.Settings.initialize();
|
||||||
if ( $("#js-columns-selector").length )
|
if ($("#js-columns-selector").length) {
|
||||||
App.ColumnsSelector.initialize();
|
App.ColumnsSelector.initialize();
|
||||||
|
}
|
||||||
App.BudgetEditAssociations.initialize();
|
App.BudgetEditAssociations.initialize();
|
||||||
if ( $("#votation_type_enum_type").length )
|
if ($("#votation_type_enum_type").length) {
|
||||||
App.Votations.initialize();
|
App.Votations.initialize();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|||||||
@@ -25,5 +25,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -38,5 +38,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -14,5 +14,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -14,5 +14,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -84,5 +84,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -69,5 +69,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -30,5 +30,4 @@
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -166,5 +166,4 @@
|
|||||||
$("#" + id).remove();
|
$("#" + id).remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -9,5 +9,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -18,5 +18,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -5,5 +5,4 @@
|
|||||||
$("#" + resource_id + " .js-flag-actions").html(button).foundation();
|
$("#" + resource_id + " .js-flag-actions").html(button).foundation();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -10,5 +10,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -64,5 +64,4 @@
|
|||||||
App.Forms.hideOrShowFieldsAfterSelection();
|
App.Forms.hideOrShowFieldsAfterSelection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -26,5 +26,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -37,5 +37,4 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -114,5 +114,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -15,5 +15,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -171,5 +171,4 @@
|
|||||||
$("#new_image_link").removeClass("hide");
|
$("#new_image_link").removeClass("hide");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -11,5 +11,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -16,5 +16,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -22,5 +22,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -33,5 +33,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -229,5 +229,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -7,5 +7,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -29,5 +29,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -128,5 +128,4 @@
|
|||||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -48,5 +48,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -11,5 +11,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -9,5 +9,4 @@
|
|||||||
$("#" + id + " .js-moderator-investment-actions:first").hide();
|
$("#" + id + " .js-moderator-investment-actions:first").hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -8,5 +8,4 @@
|
|||||||
$("#" + id + " .js-moderator-comment-actions").hide();
|
$("#" + id + " .js-moderator-comment-actions").hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -9,5 +9,4 @@
|
|||||||
$("#" + id + " .js-moderator-debate-actions:first").hide();
|
$("#" + id + " .js-moderator-debate-actions:first").hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -8,5 +8,4 @@
|
|||||||
$("#" + id + " .js-moderator-proposal-notifications-actions:first").hide();
|
$("#" + id + " .js-moderator-proposal-notifications-actions:first").hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -9,5 +9,4 @@
|
|||||||
$("#" + id + " .js-moderator-proposals-actions:first").hide();
|
$("#" + id + " .js-moderator-proposals-actions:first").hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -43,5 +43,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -17,5 +17,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -45,5 +45,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -10,5 +10,4 @@
|
|||||||
App.Questions.nestedQuestions();
|
App.Questions.nestedQuestions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -29,5 +29,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -7,5 +7,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -7,5 +7,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -14,5 +14,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -7,5 +7,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -34,5 +34,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -33,5 +33,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -34,5 +34,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -30,5 +30,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -44,5 +44,4 @@
|
|||||||
App.TagAutocomplete.init_autocomplete();
|
App.TagAutocomplete.init_autocomplete();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -22,5 +22,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -39,5 +39,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -5,5 +5,4 @@
|
|||||||
$(".initialjs-avatar").initial();
|
$(".initialjs-avatar").initial();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -33,5 +33,4 @@
|
|||||||
App.ValuationBudgetInvestmentForm.showFeasibilityFieldsOnChange();
|
App.ValuationBudgetInvestmentForm.showFeasibilityFieldsOnChange();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -53,5 +53,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -20,5 +20,4 @@
|
|||||||
App.Votes.hoverize("div.comment-footer");
|
App.Votes.hoverize("div.comment-footer");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -29,5 +29,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user