diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/tslint/lib/rules/trailingCommaRule.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/tslint/lib/rules/trailingCommaRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/trailingCommaRule.js | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.js b/node_modules/tslint/lib/rules/trailingCommaRule.js index a91e57fe8..09003f90c 100644 --- a/node_modules/tslint/lib/rules/trailingCommaRule.js +++ b/node_modules/tslint/lib/rules/trailingCommaRule.js @@ -20,7 +20,7 @@ var tslib_1 = require("tslib"); var tsutils_1 = require("tsutils"); var ts = require("typescript"); var Lint = require("../index"); -var defaultOptions = fillOptions("ignore"); +var defaultOptions = fillOptions("ignore"); // tslint:disable-line no-unnecessary-type-assertion function fillOptions(value) { return { arrays: value, @@ -66,42 +66,42 @@ var Rule = (function (_super) { Rule.prototype.isEnabled = function () { return _super.prototype.isEnabled.call(this) && this.ruleArguments.length !== 0; }; - return Rule; -}(Lint.Rules.AbstractRule)); -/* tslint:disable:object-literal-sort-keys */ -Rule.metadata = { - ruleName: "trailing-comma", - description: (_a = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], _a.raw = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], Lint.Utils.dedent(_a)), - hasFix: true, - optionsDescription: (_b = ["\n One argument which is an object with the keys `multiline` and `singleline`.\n Both can be set to a string (`\"always\"` or `\"never\"`) or an object.\n\n The object can contain any of the following keys: `\"arrays\"`, `\"objects\"`, `\"functions\"`,\n `\"imports\"`, `\"exports\"`, and `\"typeLiterals\"`; each key can have one of the following\n values: `\"always\"`, `\"never\"`, and `\"ignore\"`. Any missing keys will default to `\"ignore\"`.\n\n * `\"multiline\"` checks multi-line object literals.\n * `\"singleline\"` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters."], _b.raw = ["\n One argument which is an object with the keys \\`multiline\\` and \\`singleline\\`.\n Both can be set to a string (\\`\"always\"\\` or \\`\"never\"\\`) or an object.\n\n The object can contain any of the following keys: \\`\"arrays\"\\`, \\`\"objects\"\\`, \\`\"functions\"\\`,\n \\`\"imports\"\\`, \\`\"exports\"\\`, and \\`\"typeLiterals\"\\`; each key can have one of the following\n values: \\`\"always\"\\`, \\`\"never\"\\`, and \\`\"ignore\"\\`. Any missing keys will default to \\`\"ignore\"\\`.\n\n * \\`\"multiline\"\\` checks multi-line object literals.\n * \\`\"singleline\"\\` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters."], Lint.Utils.dedent(_b)), - options: { - type: "object", - properties: { - multiline: metadataOptionShape, - singleline: metadataOptionShape, + /* tslint:disable:object-literal-sort-keys */ + Rule.metadata = { + ruleName: "trailing-comma", + description: (_a = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], _a.raw = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], Lint.Utils.dedent(_a)), + hasFix: true, + optionsDescription: (_b = ["\n One argument which is an object with the keys `multiline` and `singleline`.\n Both can be set to a string (`\"always\"` or `\"never\"`) or an object.\n\n The object can contain any of the following keys: `\"arrays\"`, `\"objects\"`, `\"functions\"`,\n `\"imports\"`, `\"exports\"`, and `\"typeLiterals\"`; each key can have one of the following\n values: `\"always\"`, `\"never\"`, and `\"ignore\"`. Any missing keys will default to `\"ignore\"`.\n\n * `\"multiline\"` checks multi-line object literals.\n * `\"singleline\"` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters."], _b.raw = ["\n One argument which is an object with the keys \\`multiline\\` and \\`singleline\\`.\n Both can be set to a string (\\`\"always\"\\` or \\`\"never\"\\`) or an object.\n\n The object can contain any of the following keys: \\`\"arrays\"\\`, \\`\"objects\"\\`, \\`\"functions\"\\`,\n \\`\"imports\"\\`, \\`\"exports\"\\`, and \\`\"typeLiterals\"\\`; each key can have one of the following\n values: \\`\"always\"\\`, \\`\"never\"\\`, and \\`\"ignore\"\\`. Any missing keys will default to \\`\"ignore\"\\`.\n\n * \\`\"multiline\"\\` checks multi-line object literals.\n * \\`\"singleline\"\\` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters."], Lint.Utils.dedent(_b)), + options: { + type: "object", + properties: { + multiline: metadataOptionShape, + singleline: metadataOptionShape, + }, + additionalProperties: false, }, - additionalProperties: false, - }, - optionExamples: [ - [true, { multiline: "always", singleline: "never" }], - [ - true, - { - multiline: { - objects: "always", - arrays: "always", - functions: "never", - typeLiterals: "ignore", + optionExamples: [ + [true, { multiline: "always", singleline: "never" }], + [ + true, + { + multiline: { + objects: "always", + arrays: "always", + functions: "never", + typeLiterals: "ignore", + }, }, - }, + ], ], - ], - type: "maintainability", - typescriptOnly: false, -}; -/* tslint:enable:object-literal-sort-keys */ -Rule.FAILURE_STRING_NEVER = "Unnecessary trailing comma"; -Rule.FAILURE_STRING_ALWAYS = "Missing trailing comma"; + type: "maintainability", + typescriptOnly: false, + }; + /* tslint:enable:object-literal-sort-keys */ + Rule.FAILURE_STRING_NEVER = "Unnecessary trailing comma"; + Rule.FAILURE_STRING_ALWAYS = "Missing trailing comma"; + return Rule; +}(Lint.Rules.AbstractRule)); exports.Rule = Rule; var TrailingCommaWalker = (function (_super) { tslib_1.__extends(TrailingCommaWalker, _super); @@ -184,14 +184,14 @@ var TrailingCommaWalker = (function (_super) { } var token = tsutils_1.getChildOfKind(node, closeTokenKind, this.sourceFile); if (token !== undefined) { - return this.checkComma(list.hasTrailingComma === true, list, token.end, optionKey); + return this.checkComma(list.hasTrailingComma, list, token.end, optionKey); } }; TrailingCommaWalker.prototype.checkList = function (list, closeElementPos, optionKey) { if (list.length === 0) { return; } - return this.checkComma(list.hasTrailingComma === true, list, closeElementPos, optionKey); + return this.checkComma(list.hasTrailingComma, list, closeElementPos, optionKey); }; /* Expects `list.length !== 0` */ TrailingCommaWalker.prototype.checkComma = function (hasTrailingComma, list, closeTokenPos, optionKey) { |