Merge branch 'add-jscs' into merge-add-jscs

Conflicts:
	.travis.yml
This commit is contained in:
Austin Pray
2015-01-24 10:36:04 -06:00
5 changed files with 164 additions and 61 deletions

95
.jscsrc Normal file
View File

@@ -0,0 +1,95 @@
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireOperatorBeforeLineBreak": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"maximumLineLength": {
"value": 80,
"allowComments": true,
"allowRegex": true
},
"validateIndentation": 2,
"validateQuoteMarks": "'",
"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowMultipleVarDecl": true,
"disallowKeywordsOnNewLine": [
"else"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": [
"=",
"+=",
"-=",
"*=",
"/=",
"%=",
"<<=",
">>=",
">>>=",
"&=",
"|=",
"^=",
"+=",
"+",
"-",
"*",
"/",
"%",
"<<",
">>",
">>>",
"&",
"|",
"^",
"&&",
"||",
"===",
"==",
">=",
"<=",
"<",
">",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInForStatement": true,
"requireLineFeedAtFileEnd": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideObjectBrackets": "all",
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
},
"disallowMultipleLineBreaks": true,
"disallowNewlineBeforeBlockStatements": true
}

View File

@@ -7,7 +7,7 @@ php:
- '5.4' - '5.4'
before_install: before_install:
- npm install -g bower - npm install -g bower gulp jscs
- npm install - npm install
- pyrus install pear/PHP_CodeSniffer - pyrus install pear/PHP_CodeSniffer
- phpenv rehash - phpenv rehash
@@ -15,4 +15,5 @@ before_install:
script: script:
- npm run build - npm run build
- npm run jshint - npm run jshint
- npm run jscs
- phpcs --standard=ruleset.xml --extensions=php -n -s . - phpcs --standard=ruleset.xml --extensions=php -n -s .

View File

@@ -20,7 +20,7 @@
// rename this variable, you will also need to rename the namespace below. // rename this variable, you will also need to rename the namespace below.
var Sage = { var Sage = {
// All pages // All pages
common: { 'common': {
init: function() { init: function() {
// JavaScript to be fired on all pages // JavaScript to be fired on all pages
}, },
@@ -29,7 +29,7 @@ var Sage = {
} }
}, },
// Home page // Home page
home: { 'home': {
init: function() { init: function() {
// JavaScript to be fired on the home page // JavaScript to be fired on the home page
}, },
@@ -38,7 +38,7 @@ var Sage = {
} }
}, },
// About us page, note the change from about-us to about_us. // About us page, note the change from about-us to about_us.
about_us: { 'about_us': {
init: function() { init: function() {
// JavaScript to be fired on the about us page // JavaScript to be fired on the about us page
} }
@@ -49,9 +49,14 @@ var Sage = {
// Add additional events for more control over timing e.g. a finalize event // Add additional events for more control over timing e.g. a finalize event
var UTIL = { var UTIL = {
fire: function(func, funcname, args) { fire: function(func, funcname, args) {
var fire;
var namespace = Sage; var namespace = Sage;
funcname = (funcname === undefined) ? 'init' : funcname; funcname = (funcname === undefined) ? 'init' : funcname;
if (func !== '' && namespace[func] && typeof namespace[func][funcname] === 'function') { fire = func !== '';
fire = fire && namespace[func];
fire = fire && typeof namespace[func][funcname] === 'function';
if (fire) {
namespace[func][funcname](args); namespace[func][funcname](args);
} }
}, },

View File

@@ -35,7 +35,8 @@ var cssTasks = function(filename) {
.pipe($.pleeease, { .pipe($.pleeease, {
autoprefixer: { autoprefixer: {
browsers: [ browsers: [
'last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12' 'last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4',
'opera 12'
] ]
} }
}) })

View File

@@ -18,7 +18,8 @@
], ],
"scripts": { "scripts": {
"build": "bower install && gulp", "build": "bower install && gulp",
"jshint": "gulp jshint" "jshint": "gulp jshint",
"jscs": "jscs gulpfile.js assets/scripts/*.js"
}, },
"engines": { "engines": {
"node": ">= 0.10.0" "node": ">= 0.10.0"