Skip to content

Commit

Permalink
Merge branch 'release/1.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Rechkunov committed Nov 11, 2015
2 parents 867f9b7 + 51df64f commit 3ce3ca5
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 91 deletions.
164 changes: 107 additions & 57 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,63 @@
{
"excludeFiles": [
"./**/node_modules/**",
"./coverage/**",
"./node_modules/**"
],

"disallowEmptyBlocks": true,
"disallowIdenticalDestructuringNames": true,
"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
"disallowKeywordsOnNewLine": ["else"],
"disallowKeywords": ["with", "void"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowMultipleSpaces": true,
"disallowNestedTernaries": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowOperatorBeforeLineBreak": ["."],
"disallowPaddingNewlinesInBlocks": { "open": false, "close": true },
"disallowParenthesesAroundArrowParam": true,
"disallowQuotedKeysInObjects": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforeComma": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeSemicolon": true,
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideBrackets": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowSpacesInsideParenthesizedExpression": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"disallowUnusedParams": true,
"disallowYodaConditions": true,
"jsDoc": {
"checkAnnotations": true,
"checkParamExistence": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "strictNativeCase",
"checkRedundantAccess": "enforceLeadingUnderscore",
"leadingUnderscoreAccess": true,
"disallowNewlineAfterDescription": true,
"requireParamDescription": true,
"requireReturnDescription": true
},
"maximumLineLength": 80,
"maximumNumberOfLines": 3000,
"maxErrors": 5,
"requireAlignedMultilineParams": "firstParam",
"requireBlocksOnNewline": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireCurlyBraces": [
"if",
"else",
Expand All @@ -14,64 +67,61 @@
"try",
"catch"
],

"requireSpaceBeforeBlockStatements": true,
"requireDollarBeforejQueryAssignment": true,
"requireDotNotation": true,
"requireLineBreakAfterVariableAssignment": true,
"requireObjectKeysOnNewLine": true,
"requireOperatorBeforeLineBreak": true,
"requirePaddingNewLinesAfterUseStrict": true,
"requirePaddingNewLinesBeforeExport": true,
"requirePaddingNewLinesInObjects": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},

"requireSemicolons": true,
"requireShorthandArrowFunctions": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceAfterComma": true,
"requireSpaceAfterKeywords": true,
"requireSpaceAfterLineComment": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": 1,
"requireSpaceBeforeKeywords": [
"else",
"while",
"catch"
],
"requireSpaceBeforeObjectValues": true,
"requireSpaceBetweenArguments": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"requireSpacesInConditionalExpression": true,
"requireSpacesInForStatement": true,
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},

"requireBlocksOnNewline": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": "all",
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
"disallowQuotedKeysInObjects": true,
"disallowSpaceAfterObjectKeys": true,
"requireSpaceBeforeObjectValues": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,
"disallowImplicitTypeConversion": [
"numeric", "boolean", "binary", "string"
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowKeywords": ["with", "let", "void"],
"disallowMultipleLineBreaks": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowKeywordsOnNewLine": ["else", "catch"],
"maximumLineLength": 80,
"requireCapitalizedConstructors": true,
"requireDotNotation": true,
"disallowYodaConditions": true,
"disallowNewlineBeforeBlockStatements": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInGenerator": {
"beforeStar": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"safeContextKeyword": ["self"],
"validateAlignedFunctionParameters": true,
"validateIndentation": "\t",
"validateLineBreaks": "LF",
"validateParameterSeparator": ", ",
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
},
"safeContextKeyword": ["self"]
}
"validateQuoteMarks": "'",
"excludeFiles": [
"./**/node_modules/**",
"./coverage/**",
"./node_modules/**",
"./test/cases/**"
],
}
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ node_js:
- "0.12"
- "1"
- "2"
- "3"
- "3"
- "4"
- "5"
2 changes: 1 addition & 1 deletion lib/ConstructorTokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ConstructorTokenizer.prototype._currentState = STATES.NO;

/**
* Gets next token in source.
* @returns {{state: (number), start: number, end: number}}
* @returns {{state: (number), start: number, end: number}} Token descriptor.
*/
ConstructorTokenizer.prototype.next = function () {
if (this._currentState === STATES.ILLEGAL ||
Expand Down
5 changes: 2 additions & 3 deletions lib/ServiceLocator.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ function throwIfNotFunction(constructor) {

/**
* Throws error if specified type name is not a string.
* @param {String} type Type name to check.
* @param {string} type Type name to check.
*/
function throwIfNotString(type) {
if (typeof(type) === 'string') {
if (typeof (type) === 'string') {
return;
}

Expand Down Expand Up @@ -282,5 +282,4 @@ function getParameterNames(constructor) {
}
}
return result;

}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "catberry-locator",
"version": "1.1.7",
"version": "1.1.8",
"author": "Denis Rechkunov <[email protected]>",
"description": "Service Locator component for Catberry Framework",
"homepage": "https://github.com/catberry/catberry-locator",
Expand All @@ -23,11 +23,11 @@
},
"main": "./lib/ServiceLocator.js",
"devDependencies": {
"istanbul-harmony": "~0.3.1",
"codecov.io": "^0.1.2",
"mocha": "^2.1.0",
"jscs": "~1.6.2",
"jshint": "^2.6.0"
"istanbul": "~0.4.0",
"codecov.io": "~0.1.6",
"mocha": "^2.3.3",
"jscs": "^2.5.1",
"jshint": "^2.8.0"
},
"engines": {
"node": ">=0.10"
Expand Down
1 change: 0 additions & 1 deletion test/lib/ConstructorTokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,5 @@ function areTokensEqual(actual, expected) {
actual[i].start, expected[i].start
);
assert.strictEqual(actual[i].end, expected[i].end);

}
}
34 changes: 12 additions & 22 deletions test/lib/ServiceLocator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
var assert = require('assert'),
ServiceLocator = require('../../lib/ServiceLocator');

function Constructor($testModule1, testArgument1, $testModule2, testArgument2,
$testModule3) {
// jscs:disable disallowUnusedParams
function Constructor(
$testModule1, testArgument1, $testModule2, testArgument2, $testModule3
) {
this.args = arguments;
}

Expand Down Expand Up @@ -166,7 +168,7 @@ describe('ServiceLocator', function () {
module3Parameters.testArgument1,
'Wrong parameter resolution');

//TestModule4
// TestModule4
assert.equal(rootModule.args[2].args[2].args.length, 0,
'Wrong argument count');
});
Expand Down Expand Up @@ -222,21 +224,13 @@ describe('ServiceLocator', function () {
function () {
var locator = new ServiceLocator();

function Implementation1() {
function Implementation1() { }

}

function Implementation2() {

}

function Implementation3() {

}
function Implementation2() { }

function AnotherImplementation() {
function Implementation3() { }

}
function AnotherImplementation() { }

locator.register('type', Implementation1);
locator.register('type', Implementation2);
Expand All @@ -251,7 +245,6 @@ describe('ServiceLocator', function () {
'Wrong type resolution');
assert.equal(instances[2] instanceof Implementation1, true,
'Wrong type resolution');

});

it('should return empty array if specified type was not found',
Expand All @@ -277,12 +270,10 @@ describe('ServiceLocator', function () {
var locator = new ServiceLocator(),
testArgument = 'testArgumentValue';

function TestModule() {

}
function TestModule() { }

function ModuleToResolve($testType, testArgument) {
assert.equal($testType instanceof TestModule, true);
assert.equal($testType instanceof TestModule, true);
assert.strictEqual(testArgument, testArgument);
}

Expand All @@ -298,8 +289,7 @@ describe('ServiceLocator', function () {
function () {
var locator = new ServiceLocator();

function ModuleToResolve() {
}
function ModuleToResolve() { }

var instance = locator.resolveInstance(ModuleToResolve);

Expand Down

0 comments on commit 3ce3ca5

Please sign in to comment.