Commit 9bb99d58 authored by Pascal Hartig's avatar Pascal Hartig

Add initial jscs configuration

parent a42eb2b9
{
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireLeftStickedOperators": [","],
"requireParenthesesAroundIIFE": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"disallowEmptyBlocks": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowQuotedKeysInObjects": true,
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowLeftStickedOperators": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowRightStickedOperators": [
"?",
"+",
"/",
"*",
":",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireRightStickedOperators": ["!"],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineStrings": true,
"disallowMultipleLineBreaks": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": true,
"disallowMixedSpacesAndTabs": true,
"requireMultipleVarDecl": true,
"disallowTrailingWhitespace": true,
"disallowKeywordsOnNewLine": ["else"],
"maximumLineLength": 100,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "self",
"requireDotNotation": true,
"requireLineFeedAtFileEnd": true,
"excludeFiles": [],
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
}
...@@ -15,4 +15,3 @@ todomvc.directive('todoEscape', function () { ...@@ -15,4 +15,3 @@ todomvc.directive('todoEscape', function () {
}); });
}; };
}); });
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
'use strict'; 'use strict';
/** /**
* Directive that places focus on the element it is applied to when the expression it binds to evaluates to true * Directive that places focus on the element it is applied to when the
* expression it binds to evaluates to true
*/ */
todomvc.directive('todoFocus', function todoFocus($timeout) { todomvc.directive('todoFocus', function todoFocus($timeout) {
return function (scope, elem, attrs) { return function (scope, elem, attrs) {
......
...@@ -123,7 +123,7 @@ var app = app || {}; ...@@ -123,7 +123,7 @@ var app = app || {};
app.todos.each(function (todo) { app.todos.each(function (todo) {
todo.save({ todo.save({
'completed': completed completed: completed
}); });
}); });
} }
......
...@@ -25,9 +25,10 @@ var app = app || {}; ...@@ -25,9 +25,10 @@ var app = app || {};
'blur .edit': 'close' 'blur .edit': 'close'
}, },
// The TodoView listens for changes to its model, re-rendering. Since there's // The TodoView listens for changes to its model, re-rendering. Since
// a one-to-one correspondence between a **Todo** and a **TodoView** in this // there's a one-to-one correspondence between a **Todo** and a
// app, we set a direct reference on the model for convenience. // **TodoView** in this app, we set a direct reference on the model for
// convenience.
initialize: function () { initialize: function () {
this.listenTo(this.model, 'change', this.render); this.listenTo(this.model, 'change', this.render);
this.listenTo(this.model, 'destroy', this.remove); this.listenTo(this.model, 'destroy', this.remove);
...@@ -36,10 +37,12 @@ var app = app || {}; ...@@ -36,10 +37,12 @@ var app = app || {};
// Re-render the titles of the todo item. // Re-render the titles of the todo item.
render: function () { render: function () {
// Backbone LocalStorage is adding `id` attribute instantly after creating a model. // Backbone LocalStorage is adding `id` attribute instantly after
// This causes our TodoView to render twice. Once after creating a model and once on `id` change. // creating a model. This causes our TodoView to render twice. Once
// We want to filter out the second redundant render, which is caused by this `id` change. // after creating a model and once on `id` change. We want to
// It's known Backbone LocalStorage bug, therefore we've to create a workaround. // filter out the second redundant render, which is caused by this
// `id` change. It's known Backbone LocalStorage bug, therefore
// we've to create a workaround.
// https://github.com/tastejs/todomvc/issues/469 // https://github.com/tastejs/todomvc/issues/469
if (this.model.changed.id !== undefined) { if (this.model.changed.id !== undefined) {
return; return;
...@@ -92,8 +95,10 @@ var app = app || {}; ...@@ -92,8 +95,10 @@ var app = app || {};
this.model.save({ title: trimmedValue }); this.model.save({ title: trimmedValue });
if (value !== trimmedValue) { if (value !== trimmedValue) {
// Model values changes consisting of whitespaces only are not causing change to be triggered // Model values changes consisting of whitespaces only are
// Therefore we've to compare untrimmed version with a trimmed one to chech whether anything changed // not causing change to be triggered Therefore we've to
// compare untrimmed version with a trimmed one to chech
// whether anything changed
// And if yes, we've to trigger change event ourselves // And if yes, we've to trigger change event ourselves
this.model.trigger('change'); this.model.trigger('change');
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment