From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- .../tslint/lib/rules/onlyArrowFunctionsRule.js | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js') diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js index f5d8187f8..3d59a921c 100644 --- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js +++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js @@ -30,29 +30,29 @@ var Rule = (function (_super) { Rule.prototype.apply = function (sourceFile) { return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments)); }; + /* tslint:disable:object-literal-sort-keys */ + Rule.metadata = { + ruleName: "only-arrow-functions", + description: "Disallows traditional (non-arrow) function expressions.", + rationale: "Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.", + optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `\"", "\"` allows standalone function declarations.\n * `\"", "\"` allows the expression `function foo() {}` but not `function() {}`.\n "], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`\"", "\"\\` allows standalone function declarations.\n * \\`\"", "\"\\` allows the expression \\`function foo() {}\\` but not \\`function() {}\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS)), + options: { + type: "array", + items: { + type: "string", + enum: [OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS], + }, + minLength: 0, + maxLength: 1, + }, + optionExamples: [true, [true, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS]], + type: "typescript", + typescriptOnly: false, + }; + /* tslint:enable:object-literal-sort-keys */ + Rule.FAILURE_STRING = "non-arrow functions are forbidden"; return Rule; }(Lint.Rules.AbstractRule)); -/* tslint:disable:object-literal-sort-keys */ -Rule.metadata = { - ruleName: "only-arrow-functions", - description: "Disallows traditional (non-arrow) function expressions.", - rationale: "Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.", - optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `\"", "\"` allows standalone function declarations.\n * `\"", "\"` allows the expression `function foo() {}` but not `function() {}`.\n "], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`\"", "\"\\` allows standalone function declarations.\n * \\`\"", "\"\\` allows the expression \\`function foo() {}\\` but not \\`function() {}\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS)), - options: { - type: "array", - items: { - type: "string", - enum: [OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS], - }, - minLength: 0, - maxLength: 1, - }, - optionExamples: [true, [true, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS]], - type: "typescript", - typescriptOnly: false, -}; -/* tslint:enable:object-literal-sort-keys */ -Rule.FAILURE_STRING = "non-arrow functions are forbidden"; exports.Rule = Rule; function parseOptions(ruleArguments) { return { @@ -84,7 +84,7 @@ function walk(ctx) { } /** Generator functions and functions using `this` are allowed. */ function functionIsExempt(node) { - return node.asteriskToken !== undefined || hasThisParameter(node) || node.body !== undefined && usesThisInBody(node.body); + return node.asteriskToken !== undefined || hasThisParameter(node) || node.body !== undefined && usesThisInBody(node.body) === true; } function hasThisParameter(node) { var first = node.parameters[0]; -- cgit v1.2.3