From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/tslint/lib/rules/noStringThrowRule.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'node_modules/tslint/lib/rules/noStringThrowRule.js') diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.js b/node_modules/tslint/lib/rules/noStringThrowRule.js index 1640b91cf..84c314db1 100644 --- a/node_modules/tslint/lib/rules/noStringThrowRule.js +++ b/node_modules/tslint/lib/rules/noStringThrowRule.js @@ -20,6 +20,7 @@ var tslib_1 = require("tslib"); var tsutils_1 = require("tsutils"); var ts = require("typescript"); var Lint = require("../index"); +var noStringThrowRule_examples_1 = require("./code-examples/noStringThrowRule.examples"); var Rule = /** @class */ (function (_super) { tslib_1.__extends(Rule, _super); function Rule() { @@ -31,11 +32,13 @@ var Rule = /** @class */ (function (_super) { /* tslint:disable:object-literal-sort-keys */ Rule.metadata = { ruleName: "no-string-throw", - description: "Flags throwing plain strings or concatenations of strings " + - "because only Errors produce proper stack traces.", + description: "Flags throwing plain strings or concatenations of strings.", hasFix: true, options: null, + optionExamples: [true], optionsDescription: "Not configurable.", + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Example \u2013 Doing it right\n\n ```ts\n // throwing an Error from typical function, whether sync or async\n if (!productToAdd) {\n throw new Error(\"How can I add new product when no value provided?\");\n }\n ```\n\n Example \u2013 Anti Pattern\n\n ```ts\n // throwing a string lacks any stack trace information and other important data properties\n if (!productToAdd) {\n throw (\"How can I add new product when no value provided?\");\n }\n ```\n\n Only Error objects contain a `.stack` member equivalent to the current stack trace.\n Primitives such as strings do not.\n "], ["\n Example \u2013 Doing it right\n\n \\`\\`\\`ts\n // throwing an Error from typical function, whether sync or async\n if (!productToAdd) {\n throw new Error(\"How can I add new product when no value provided?\");\n }\n \\`\\`\\`\n\n Example \u2013 Anti Pattern\n\n \\`\\`\\`ts\n // throwing a string lacks any stack trace information and other important data properties\n if (!productToAdd) {\n throw (\"How can I add new product when no value provided?\");\n }\n \\`\\`\\`\n\n Only Error objects contain a \\`.stack\\` member equivalent to the current stack trace.\n Primitives such as strings do not.\n "]))), + codeExamples: noStringThrowRule_examples_1.codeExamples, type: "functionality", typescriptOnly: false, }; @@ -75,3 +78,4 @@ function isString(node) { return false; } } +var templateObject_1; -- cgit v1.2.3