How to use the __makeTemplateObject function from tslib

Find comprehensive JavaScript tslib.__makeTemplateObject code examples handpicked from public code repositorys.

49
50
51
52
53
54
55
56
57
58
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
    ruleName: "typedef",
    description: "Requires type definitions to exist.",
    optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            Several arguments may be optionally provided:\n\n            * `\"", "\"` checks return type of functions.\n            * `\"", "\"` checks return type of arrow functions.\n            * `\"", "\"` checks type specifier of function parameters for non-arrow functions.\n            * `\"", "\"` checks type specifier of function parameters for arrow functions.\n            * `\"", "\"` checks return types of interface properties.\n            * `\"", "\"` checks non-binding variable declarations.\n            * `\"", "\"` ignore variable declarations for non-arrow and arrow functions.\n            * `\"", "\"` checks member variable declarations.\n            * `\"", "\"` checks object destructuring declarations.\n            * `\"", "\"` checks array destructuring declarations."], ["\n            Several arguments may be optionally provided:\n\n            * \\`\"", "\"\\` checks return type of functions.\n            * \\`\"", "\"\\` checks return type of arrow functions.\n            * \\`\"", "\"\\` checks type specifier of function parameters for non-arrow functions.\n            * \\`\"", "\"\\` checks type specifier of function parameters for arrow functions.\n            * \\`\"", "\"\\` checks return types of interface properties.\n            * \\`\"", "\"\\` checks non-binding variable declarations.\n            * \\`\"", "\"\\` ignore variable declarations for non-arrow and arrow functions.\n            * \\`\"", "\"\\` checks member variable declarations.\n            * \\`\"", "\"\\` checks object destructuring declarations.\n            * \\`\"", "\"\\` checks array destructuring declarations."])), OPTION_CALL_SIGNATURE, OPTION_ARROW_CALL_SIGNATURE, OPTION_PARAMETER, OPTION_ARROW_PARAMETER, OPTION_PROPERTY_DECLARATION, OPTION_VARIABLE_DECLARATION, OPTION_VARIABLE_DECLARATION_IGNORE_FUNCTION, OPTION_MEMBER_VARIABLE_DECLARATION, OPTION_OBJECT_DESTRUCTURING, OPTION_ARRAY_DESTRUCTURING),
    options: {
        type: "array",
        items: {
            type: "string",
fork icon0
star icon0
watch icon1

50
51
52
53
54
55
56
57
58
59
    return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments));
};
Rule.metadata = {
    ruleName: "variable-name",
    description: "Checks variable names for various errors.",
    optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            Several arguments may be optionally provided:\n\n            * `\"", "\"` enbables enforcement of a certain naming format. By default, the rule only allows only lowerCamelCased or UPPER_CASED variable names.\n              * These additional options make the check stricter:\n                * `\"", "\"`: enforces that all variables with UPPER_CASED names should be `const`.\n              * These additional options make the check more permissive:\n                * `\"", "\"` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n                * `\"", "\"` allows PascalCase in addition to lowerCamelCase.\n                * `\"", "\"` allows snake_case in addition to lowerCamelCase.\n                * `\"", "\"` allows underscores at the end. (only has an effect if \"check-format\" specified)\n            * `\"", "\"`: disallows the use of certain TypeScript keywords as variable or parameter names.\n              * These are: ", ""], ["\n            Several arguments may be optionally provided:\n\n            * \\`\"", "\"\\` enbables enforcement of a certain naming format. By default, the rule only allows only lowerCamelCased or UPPER_CASED variable names.\n              * These additional options make the check stricter:\n                * \\`\"", "\"\\`: enforces that all variables with UPPER_CASED names should be \\`const\\`.\n              * These additional options make the check more permissive:\n                * \\`\"", "\"\\` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n                * \\`\"", "\"\\` allows PascalCase in addition to lowerCamelCase.\n                * \\`\"", "\"\\` allows snake_case in addition to lowerCamelCase.\n                * \\`\"", "\"\\` allows underscores at the end. (only has an effect if \"check-format\" specified)\n            * \\`\"", "\"\\`: disallows the use of certain TypeScript keywords as variable or parameter names.\n              * These are: ", ""])), OPTION_CHECK_FORMAT, OPTION_REQUIRE_CONST_FOR_ALL_CAPS, OPTION_ALLOW_LEADING_UNDERSCORE, OPTION_ALLOW_PASCAL_CASE, OPTION_ALLOW_SNAKE_CASE, OPTION_ALLOW_TRAILING_UNDERSCORE, OPTION_BAN_KEYWORDS, bannedKeywordsStr),
    options: {
        type: "array",
        items: {
            type: "string",
fork icon0
star icon0
watch icon1

36
37
38
39
40
41
42
43
44
45
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
    ruleName: "prefer-template",
    description: "Prefer a template expression over string literal concatenation.",
    optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            If `", "` is specified, then a single concatenation (`x + y`) is allowed, but not more (`x + y + z`)."], ["\n            If \\`", "\\` is specified, then a single concatenation (\\`x + y\\`) is allowed, but not more (\\`x + y + z\\`)."])), OPTION_SINGLE_CONCAT),
    options: {
        type: "string",
        enum: [OPTION_SINGLE_CONCAT],
    },
fork icon0
star icon0
watch icon1

+ 7 other calls in file

58
59
60
61
62
63
64
65
66
67
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
    ruleName: "max-line-length",
    description: "Requires lines to be under a certain max length.",
    rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            Limiting the length of a line of code improves code readability.\n            It also makes comparing code side-by-side easier and improves compatibility with\n            various editors, IDEs, and diff viewers."], ["\n            Limiting the length of a line of code improves code readability.\n            It also makes comparing code side-by-side easier and improves compatibility with\n            various editors, IDEs, and diff viewers."]))),
    optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n        It can take one argument, which can be any of the following:\n        * integer indicating maximum length of lines.\n        * object with keys:\n          * `", "` - number greater than 0 defining the max line length\n          * `", "` - string defining ignore pattern for this rule, being parsed by `new RegExp()`.\n            For example:\n             * `// ` pattern will ignore all in-line comments.\n             * `^import ` pattern will ignore all import statements.\n             * `^export {(.*?)}` pattern will ignore all multiple export statements.\n             * `class [a-zA-Z]+ implements ` pattern will ignore all class declarations implementing interfaces.\n             * `^import |^export {(.*?)}|class [a-zA-Z]+ implements |// ` pattern will ignore all the cases listed above.\n          * `", "` - determines if strings should be checked, `false` by default.\n          * `", "` - determines if regular expressions should be checked, `false` by default.\n         "], ["\n        It can take one argument, which can be any of the following:\n        * integer indicating maximum length of lines.\n        * object with keys:\n          * \\`", "\\` - number greater than 0 defining the max line length\n          * \\`", "\\` - string defining ignore pattern for this rule, being parsed by \\`new RegExp()\\`.\n            For example:\n             * \\`\\/\\/ \\` pattern will ignore all in-line comments.\n             * \\`^import \\` pattern will ignore all import statements.\n             * \\`^export \\{(.*?)\\}\\` pattern will ignore all multiple export statements.\n             * \\`class [a-zA-Z]+ implements \\` pattern will ignore all class declarations implementing interfaces.\n             * \\`^import |^export \\{(.*?)\\}|class [a-zA-Z]+ implements |// \\` pattern will ignore all the cases listed above.\n          * \\`", "\\` - determines if strings should be checked, \\`false\\` by default.\n          * \\`", "\\` - determines if regular expressions should be checked, \\`false\\` by default.\n         "])), OPTION_LIMIT, OPTION_IGNORE_PATTERN, OPTION_CHECK_STRINGS, OPTION_CHECK_REGEX),
    options: {
        type: "array",
        items: {
fork icon0
star icon0
watch icon1

+ 15 other calls in file

30
31
32
33
34
35
36
37
38
39
    return this.applyWithWalker(new NoUnsafeAnyWalker(sourceFile, this.ruleName, program.getTypeChecker()));
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
    ruleName: "no-unsafe-any",
    description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            Warns when using an expression of type 'any' in a dynamic way.\n            Uses are only allowed if they would work for `{} | null | undefined`.\n            Downcasting to unknown is always safe.\n            Type casts and tests are allowed.\n            Expressions that work on all values (such as `\"\" + x`) are allowed."], ["\n            Warns when using an expression of type 'any' in a dynamic way.\n            Uses are only allowed if they would work for \\`{} | null | undefined\\`.\n            Downcasting to unknown is always safe.\n            Type casts and tests are allowed.\n            Expressions that work on all values (such as \\`\"\" + x\\`) are allowed."]))),
    optionsDescription: "Not configurable.",
    options: null,
    optionExamples: [true],
    rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n            If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n            Either add type annotations for properties that may exist or change the data type to the empty object type `{}`.\n\n            Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n            or serialization, use `<T>` template types for generic type handling.\n\n            Also see the `no-any` rule.\n        "], ["\n            If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n            Either add type annotations for properties that may exist or change the data type to the empty object type \\`{}\\`.\n\n            Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n            or serialization, use \\`<T>\\` template types for generic type handling.\n\n            Also see the \\`no-any\\` rule.\n        "]))),
fork icon0
star icon0
watch icon1

+ 15 other calls in file

42
43
44
45
46
47
48
49
50
51
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
    ruleName: "object-literal-key-quotes",
    description: "Enforces consistent object literal property quote style.",
    descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            Object literal property names can be defined in two ways: using literals or using strings.\n            For example, these two objects are equivalent:\n\n            var object1 = {\n                property: true\n            };\n\n            var object2 = {\n                \"property\": true\n            };\n\n            In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n            or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n            This rules lets you enforce consistent quoting of property names. Either they should always\n            be quoted (default behavior) or quoted only as needed (\"as-needed\")."], ["\n            Object literal property names can be defined in two ways: using literals or using strings.\n            For example, these two objects are equivalent:\n\n            var object1 = {\n                property: true\n            };\n\n            var object2 = {\n                \"property\": true\n            };\n\n            In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n            or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n            This rules lets you enforce consistent quoting of property names. Either they should always\n            be quoted (default behavior) or quoted only as needed (\"as-needed\")."]))),
    hasFix: true,
    optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n            Possible settings are:\n\n            * `\"", "\"`: Property names should always be quoted. (This is the default.)\n            * `\"", "\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n            * `\"", "\"`: Property names should either all be quoted or unquoted.\n            * `\"", "\"`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n            property names may be quoted.\n\n            For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n            to be quoted."], ["\n            Possible settings are:\n\n            * \\`\"", "\"\\`: Property names should always be quoted. (This is the default.)\n            * \\`\"", "\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n            * \\`\"", "\"\\`: Property names should either all be quoted or unquoted.\n            * \\`\"", "\"\\`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n            property names may be quoted.\n\n            For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n            to be quoted."])), OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED),
    options: {
        type: "string",
fork icon0
star icon0
watch icon1

+ 15 other calls in file

42
43
44
45
46
47
48
49
50
51
    properties: (_b = {},
        _b[OPTION_CHECK_SUPER_CALL] = { type: "boolean" },
        _b),
    type: "object",
},
optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            An optional object with the property '", "'.\n            This is to check for unnecessary constructor parameters for super call"], ["\n            An optional object with the property '", "'.\n            This is to check for unnecessary constructor parameters for super call"])), OPTION_CHECK_SUPER_CALL),
rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n            JavaScript implicitly adds a blank constructor when there isn't one.\n            It's not necessary to manually add one in.\n        "], ["\n            JavaScript implicitly adds a blank constructor when there isn't one.\n            It's not necessary to manually add one in.\n        "]))),
ruleName: "unnecessary-constructor",
type: "functionality",
typescriptOnly: false,
fork icon0
star icon0
watch icon1

+ 11 other calls in file

36
37
38
39
40
41
42
43
44
45
hasFix: false,
optionExamples: [true],
options: null,
optionsDescription: "Not configurable.",
/* tslint:disable:max-line-length */
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n        Marking a function as `async` without using `await` or returning a value inside it can lead to an unintended promise return and a larger transpiled output.\n        Often the function can be synchronous and the `async` keyword is there by mistake.\n        Return statements are allowed as sometimes it is desirable to wrap the returned value in a Promise."], ["\n        Marking a function as \\`async\\` without using \\`await\\` or returning a value inside it can lead to an unintended promise return and a larger transpiled output.\n        Often the function can be synchronous and the \\`async\\` keyword is there by mistake.\n        Return statements are allowed as sometimes it is desirable to wrap the returned value in a Promise."]))),
/* tslint:enable:max-line-length */
ruleName: "no-async-without-await",
type: "functionality",
typescriptOnly: false,
fork icon0
star icon0
watch icon1

+ 7 other calls in file

30
31
32
33
34
35
36
37
38
39
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
    ruleName: "newline-per-chained-call",
    description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n            Requires that chained method calls be broken apart onto separate lines."], ["\n            Requires that chained method calls be broken apart onto separate lines."]))),
    rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n            This style helps to keep code 'vertical', avoiding the need for side-scrolling in IDEs or text editors."], ["\n            This style helps to keep code 'vertical', avoiding the need for side-scrolling in IDEs or text editors."]))),
    optionsDescription: "Not configurable",
    options: null,
    type: "style",
    typescriptOnly: false,
fork icon0
star icon0
watch icon1

+ 17 other calls in file