diff options
Diffstat (limited to 'node_modules/tslint/lib/rules/semicolonRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/semicolonRule.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/node_modules/tslint/lib/rules/semicolonRule.js b/node_modules/tslint/lib/rules/semicolonRule.js index a6e0dfb85..6901842f4 100644 --- a/node_modules/tslint/lib/rules/semicolonRule.js +++ b/node_modules/tslint/lib/rules/semicolonRule.js @@ -23,6 +23,7 @@ var Lint = require("../index"); var OPTION_ALWAYS = "always"; var OPTION_NEVER = "never"; var OPTION_IGNORE_BOUND_CLASS_METHODS = "ignore-bound-class-methods"; +var OPTION_STRICT_BOUND_CLASS_METHODS = "strict-bound-class-methods"; var OPTION_IGNORE_INTERFACES = "ignore-interfaces"; var Rule = /** @class */ (function (_super) { tslib_1.__extends(Rule, _super); @@ -31,7 +32,11 @@ var Rule = /** @class */ (function (_super) { } Rule.prototype.apply = function (sourceFile) { var options = { - boundClassMethods: this.ruleArguments.indexOf(OPTION_IGNORE_BOUND_CLASS_METHODS) === -1, + boundClassMethods: this.ruleArguments.indexOf(OPTION_STRICT_BOUND_CLASS_METHODS) !== -1 + ? 2 /* Strict */ + : this.ruleArguments.indexOf(OPTION_IGNORE_BOUND_CLASS_METHODS) !== -1 + ? 1 /* Ignore */ + : 0 /* Default */, interfaces: this.ruleArguments.indexOf(OPTION_IGNORE_INTERFACES) === -1, }; var Walker = this.ruleArguments.indexOf(OPTION_NEVER) === -1 ? SemicolonAlwaysWalker : SemicolonNeverWalker; @@ -42,7 +47,7 @@ var Rule = /** @class */ (function (_super) { ruleName: "semicolon", description: "Enforces consistent semicolon usage at the end of every statement.", hasFix: true, - optionsDescription: (_a = ["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces semicolons at the end of every statement.\n * `\"", "\"` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * `\"", "\"` skips checking semicolons at the end of interface members.\n * `\"", "\"` skips checking semicolons at the end of bound class methods."], _a.raw = ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces semicolons at the end of every statement.\n * \\`\"", "\"\\` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * \\`\"", "\"\\` skips checking semicolons at the end of interface members.\n * \\`\"", "\"\\` skips checking semicolons at the end of bound class methods."], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS)), + optionsDescription: (_a = ["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces semicolons at the end of every statement.\n * `\"", "\"` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * `\"", "\"` skips checking semicolons at the end of interface members.\n * `\"", "\"` skips checking semicolons at the end of bound class methods.\n * `\"", "\"` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides `\"", "\"`.\n "], _a.raw = ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces semicolons at the end of every statement.\n * \\`\"", "\"\\` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * \\`\"", "\"\\` skips checking semicolons at the end of interface members.\n * \\`\"", "\"\\` skips checking semicolons at the end of bound class methods.\n * \\`\"", "\"\\` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides \\`\"", "\"\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS, OPTION_STRICT_BOUND_CLASS_METHODS, OPTION_IGNORE_BOUND_CLASS_METHODS)), options: { type: "array", items: [ @@ -160,10 +165,11 @@ var SemicolonWalker = /** @class */ (function (_super) { }; SemicolonWalker.prototype.visitPropertyDeclaration = function (node) { // check if this is a multi-line arrow function - if (node.initializer !== undefined && + if (this.options.boundClassMethods !== 2 /* Strict */ && + node.initializer !== undefined && node.initializer.kind === ts.SyntaxKind.ArrowFunction && !utils.isSameLine(this.sourceFile, node.getStart(this.sourceFile), node.end)) { - if (this.options.boundClassMethods) { + if (this.options.boundClassMethods === 0 /* Default */) { this.checkUnnecessary(node); } } |