From b864a88355dea1e811b7b17f44d6de0806187c83 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 14 Mar 2014 09:40:18 +0200 Subject: [PATCH] Add more JSCS checks. --- Gruntfile.js | 2 +- dist/js/ratchet.js | 2 +- docs/assets/js/docs.js | 2 +- docs/dist/js/ratchet.js | 2 +- js/.jscsrc | 7 +++++++ js/sliders.js | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 615a8f4..1fa38eb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -251,7 +251,7 @@ module.exports = function(grunt) { }); // Load the plugins - require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); + require('load-grunt-tasks')(grunt, { scope: 'devDependencies' }); require('time-grunt')(grunt); // Default task(s). diff --git a/dist/js/ratchet.js b/dist/js/ratchet.js index 911f1a9..4e752f7 100644 --- a/dist/js/ratchet.js +++ b/dist/js/ratchet.js @@ -723,7 +723,7 @@ var setSlideNumber = function (offset) { var round = offset ? (deltaX < 0 ? 'ceil' : 'floor') : 'round'; - slideNumber = Math[round](getScroll() / ( scrollableArea / slider.children.length) ); + slideNumber = Math[round](getScroll() / (scrollableArea / slider.children.length)); slideNumber += offset; slideNumber = Math.min(slideNumber, 0); slideNumber = Math.max(-(slider.children.length - 1), slideNumber); diff --git a/docs/assets/js/docs.js b/docs/assets/js/docs.js index 58584f7..b27e7d6 100644 --- a/docs/assets/js/docs.js +++ b/docs/assets/js/docs.js @@ -136,7 +136,7 @@ $(function() { if ((device.initialTop - currentTop) <= device.dockingOffset) { device[0].className = 'device device-fixed'; - device.css({top: device.dockingOffset}); + device.css({ top: device.dockingOffset }); } else { device[0].className = 'device'; device[0].setAttribute('style',''); diff --git a/docs/dist/js/ratchet.js b/docs/dist/js/ratchet.js index 911f1a9..4e752f7 100644 --- a/docs/dist/js/ratchet.js +++ b/docs/dist/js/ratchet.js @@ -723,7 +723,7 @@ var setSlideNumber = function (offset) { var round = offset ? (deltaX < 0 ? 'ceil' : 'floor') : 'round'; - slideNumber = Math[round](getScroll() / ( scrollableArea / slider.children.length) ); + slideNumber = Math[round](getScroll() / (scrollableArea / slider.children.length)); slideNumber += offset; slideNumber = Math.min(slideNumber, 0); slideNumber = Math.max(-(slider.children.length - 1), slideNumber); diff --git a/js/.jscsrc b/js/.jscsrc index d6712c9..a1641b4 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -8,11 +8,14 @@ "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "disallowSpacesInsideArrayBrackets": true, + "disallowSpacesInsideParentheses": true, "disallowTrailingWhitespace": true, "requireCamelCaseOrUpperCaseIdentifiers": true, "requireCapitalizedConstructors": true, "requireCommaBeforeLineBreak": true, "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch", "case", "default"], + "requireDotNotation": true, "requireLeftStickedOperators": [","], "requireLineFeedAtFileEnd": true, "requireParenthesesAroundIIFE": true, @@ -20,7 +23,11 @@ "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInsideObjectBrackets": "allButNested", "validateIndentation": 2, "validateLineBreaks": "LF", "validateQuoteMarks": "'" diff --git a/js/sliders.js b/js/sliders.js index 6141fea..99b62c7 100644 --- a/js/sliders.js +++ b/js/sliders.js @@ -43,7 +43,7 @@ var setSlideNumber = function (offset) { var round = offset ? (deltaX < 0 ? 'ceil' : 'floor') : 'round'; - slideNumber = Math[round](getScroll() / ( scrollableArea / slider.children.length) ); + slideNumber = Math[round](getScroll() / (scrollableArea / slider.children.length)); slideNumber += offset; slideNumber = Math.min(slideNumber, 0); slideNumber = Math.max(-(slider.children.length - 1), slideNumber);