1 | 'use strict';
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = function (d, b) {
|
4 | extendStatics = Object.setPrototypeOf ||
|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | }
|
9 | return function (d, b) {
|
10 | extendStatics(d, b);
|
11 | function __() { this.constructor = d; }
|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13 | };
|
14 | })();
|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | var BaseFormatter_1 = require("./utils/BaseFormatter");
|
17 | var warnedForDeprecation = false;
|
18 | var Formatter = (function (_super) {
|
19 | __extends(Formatter, _super);
|
20 | function Formatter() {
|
21 | var _this = this;
|
22 | if (!warnedForDeprecation) {
|
23 | console.warn('The fix-no-var-keyword formatter is deprecated. Use --fix instead.');
|
24 | warnedForDeprecation = true;
|
25 | }
|
26 | _this = _super.call(this, 'no-var-keyword', function (failure) {
|
27 | var fileName = failure.getFileName();
|
28 | var fileContents = this.readFile(fileName);
|
29 | var end = failure.getEndPosition().getPosition();
|
30 | var leftSide = fileContents.substring(0, end);
|
31 | leftSide = leftSide.replace(/var$/, 'let');
|
32 | var rightSide = fileContents.substring(end);
|
33 | var newContent = leftSide + rightSide;
|
34 | this.writeFile(fileName, newContent);
|
35 | console.log('Automatically converting var to let. Please re-compile and re-lint: ' + fileName);
|
36 | }) || this;
|
37 | return _this;
|
38 | }
|
39 | return Formatter;
|
40 | }(BaseFormatter_1.BaseFormatter));
|
41 | exports.Formatter = Formatter;
|
42 |
|
\ | No newline at end of file |