Skip to content

Commit

Permalink
chore(build): add JSCS and JSHint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
alyec committed Oct 6, 2015
1 parent 267ea4d commit 9209a39
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 7 deletions.
110 changes: 110 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"esnext": true,

"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowTrailingWhitespace": true,

"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireLineFeedAtFileEnd": true,
"requireParenthesesAroundIIFE": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInConditionalExpression": true,

"validateQuoteMarks": "'",
"validateIndentation": 4,

"disallowEmptyBlocks": true,
"disallowMultipleVarDecl": true,

"requireDotNotation": true,
"requireCommaBeforeLineBreak": true,

"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"case",
"return",
"try",
"catch",
"typeof"
],

"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],

"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpaceBeforeBinaryOperators": [
","
],
"disallowKeywords": ["with"],
"disallowKeywordsOnNewLine": ["else"],

"disallowQuotedKeysInObjects": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceBeforeComma": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeSemicolon": true,
"disallowSpacesInCallExpression": true,
"disallowYodaConditions": true,

"requireBlocksOnNewline": 1,
"requireSpaceBeforeBinaryOperators": true,
"requireCapitalizedConstructors": true,
"requireSpacesInForStatement": true,
"requireSpaceBetweenArguments": true,
"requireSemicolons": true,
"requireVarDeclFirst": true,

"requirePaddingNewLinesBeforeLineComments": {
"allExcept": "firstAfterCurly"
},
"safeContextKeyword": "self",

"maximumLineLength": {
"value": 100,
"allowComments": true,
"allowRegex": true
},

"jsDoc": {
"checkAnnotations": {
"preset": "jsdoc3",
"extra": {
"ngdoc": true,
"usage": true
}
},
"checkParamNames": true,
"requireParamTypes": true,
"checkReturnTypes": true,
"checkTypes": true
}
}
61 changes: 61 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"es3": false,
"forin": true,
"freeze": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
"nonbsp": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"maxparams": 10,
"maxdepth": 5,
"maxstatements": 40,
"maxcomplexity": 8,

"asi": false,
"boss": false,
"debug": false,
"eqnull": true,
"esnext": true,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": true,
"maxerr": false,
"moz": false,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"shadow": false,
"sub": true,
"supernew": false,
"validthis": false,
"noyield": false,

"browser": true,
"node": true,
"jasmine": true,

"globals": {
"angular": false,
"$": false
}
}
18 changes: 11 additions & 7 deletions src/print.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* globals define, exports */
;(function (root, factory) {
'use strict';

if (typeof define === 'function' && define.amd) {
define(['esri/tasks/PrintParameters', 'esri/tasks/PrintTemplate',
Expand All @@ -9,10 +11,15 @@
require('esri/tasks/PrintTask'));
} else {
root.printService = factory(root.PrintParameters);
};
}

}(this, function (printService) {
printTask = new PrintTask(RAMP.config.exportMapUrl);
}(this, function (PrintParameters, PrintTemplate, PrintTask) {
'use strict';
const printTask = new PrintTask('random URL');
const template = new PrintTemplate();
const params = new PrintParameters();
const mapDom = $('#mainMap_root')[0];
let def;

printTask.on('complete', function (event) {
//console.log('PRINT RESULT: ' + event.result.url);
Expand All @@ -27,9 +34,7 @@
def.reject(event);
});

mapDom = $('#mainMap_root')[0];

template = new PrintTemplate();
template.exportOptions = {
width: mapDom.clientWidth,
height: mapDom.clientHeight,
Expand All @@ -39,8 +44,7 @@
template.layout = 'MAP_ONLY';
template.showAttribution = false;

params = new PrintParameters();
params.map = mappy;
params.map = mapDom; //mappy;
params.template = template;
console.log('submitting print job. please wait');
printTask.execute(params);
Expand Down

0 comments on commit 9209a39

Please sign in to comment.