aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/noStringThrowRule.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/tslint/lib/rules/noStringThrowRule.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/tslint/lib/rules/noStringThrowRule.js')
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.js8
1 files changed, 6 insertions, 2 deletions
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;