Skip to content

Commit 8152271

Browse files
committed
chore: enable the deprecation TsLint check
1 parent 3f6a190 commit 8152271

10 files changed

+23
-22
lines changed

lib/common/child-process.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ChildProcess extends EventEmitter implements IChildProcess {
99

1010
public async exec(command: string, options?: any, execOptions?: IExecOptions): Promise<any> {
1111
return new Promise<any>((resolve, reject) => {
12-
const callback = (error: Error, stdout: string | NodeBuffer, stderr: string | NodeBuffer) => {
12+
const callback = (error: Error, stdout: string | Buffer, stderr: string | Buffer) => {
1313
this.$logger.trace("Exec %s \n stdout: %s \n stderr: %s", command, stdout.toString(), stderr.toString());
1414

1515
if (error) {
@@ -33,7 +33,7 @@ export class ChildProcess extends EventEmitter implements IChildProcess {
3333
this.$logger.debug("execFile: %s %s", command, this.getArgumentsAsQuotedString(args));
3434

3535
return new Promise<any>((resolve, reject) => {
36-
child_process.execFile(command, args, (error: any, stdout: string | NodeBuffer) => {
36+
child_process.execFile(command, args, (error: any, stdout: string | Buffer) => {
3737
if (error) {
3838
reject(error);
3939
} else {

lib/common/declarations.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,11 @@ interface IErrors {
561561
fail(formatStr: string, ...args: any[]): never;
562562
fail(opts: IFailOptions, ...args: any[]): never;
563563
/**
564-
* DEPRECATED: use `fail` instead
564+
* @deprecated: use `fail` instead
565565
*/
566566
failWithoutHelp(message: string, ...args: any[]): never;
567567
/**
568-
* DEPRECATED: use `fail` instead
568+
* @deprecated: use `fail` instead
569569
*/
570570
failWithoutHelp(opts: IFailOptions, ...args: any[]): never;
571571
failWithHelp(formatStr: string, ...args: any[]): never;

lib/common/file-system.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class FileSystem implements IFileSystem {
177177
return fs.readdirSync(path);
178178
}
179179

180-
public readFile(filename: string, options?: IReadFileOptions): string | NodeBuffer {
180+
public readFile(filename: string, options?: IReadFileOptions): string | Buffer {
181181
return fs.readFileSync(filename, options);
182182
}
183183

@@ -203,7 +203,7 @@ export class FileSystem implements IFileSystem {
203203
return null;
204204
}
205205

206-
public writeFile(filename: string, data: string | NodeBuffer, encoding?: string): void {
206+
public writeFile(filename: string, data: string | Buffer, encoding?: string): void {
207207
this.createDirectory(dirname(filename));
208208
fs.writeFileSync(filename, data, { encoding: encoding });
209209
}
@@ -390,7 +390,7 @@ export class FileSystem implements IFileSystem {
390390
const logger: ILogger = this.$injector.resolve("$logger");
391391
const shasumData = crypto.createHash(algorithm);
392392
const fileStream = this.createReadStream(fileName);
393-
fileStream.on("data", (data: NodeBuffer | string) => {
393+
fileStream.on("data", (data: Buffer | string) => {
394394
shasumData.update(data);
395395
});
396396

lib/common/mobile/android/android-debug-bridge.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export class AndroidDebugBridge implements Mobile.IAndroidDebugBridge {
6666
let errorData = "";
6767
let isSettled = false;
6868

69-
result.stdout.on("data", (data: NodeBuffer) => {
69+
result.stdout.on("data", (data: Buffer) => {
7070
adbData += data.toString();
7171
});
7272

73-
result.stderr.on("data", (data: NodeBuffer) => {
73+
result.stderr.on("data", (data: Buffer) => {
7474
errorData += (data || "").toString();
7575
});
7676

lib/common/mobile/android/logcat-helper.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class LogcatHelper implements Mobile.ILogcatHelper {
3333
const lineStream = byline(logcatStream.stdout);
3434
this.mapDevicesLoggingData[deviceIdentifier].loggingProcess = logcatStream;
3535
this.mapDevicesLoggingData[deviceIdentifier].lineStream = lineStream;
36-
logcatStream.stderr.on("data", (data: NodeBuffer) => {
36+
logcatStream.stderr.on("data", (data: Buffer) => {
3737
this.$logger.trace("ADB logcat stderr: " + data.toString());
3838
});
3939

@@ -49,7 +49,7 @@ export class LogcatHelper implements Mobile.ILogcatHelper {
4949
}
5050
});
5151

52-
lineStream.on('data', (line: NodeBuffer) => {
52+
lineStream.on('data', (line: Buffer) => {
5353
const lineText = line.toString();
5454
this.$deviceLogProvider.logData(lineText, this.$devicePlatformsConstants.Android, deviceIdentifier);
5555
});
@@ -61,7 +61,7 @@ export class LogcatHelper implements Mobile.ILogcatHelper {
6161
const logcatDumpStream = await adb.executeCommand(["logcat", "-d"], { returnChildProcess: true });
6262

6363
const lineStream = byline(logcatDumpStream.stdout);
64-
lineStream.on('data', (line: NodeBuffer) => {
64+
lineStream.on('data', (line: Buffer) => {
6565
const lineText = line.toString();
6666
this.$logger.trace(lineText);
6767
});

lib/common/mobile/ios/simulator/ios-simulator-log-provider.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export class IOSSimulatorLogProvider extends EventEmitter implements Mobile.IiOS
1010
private $logger: ILogger,
1111
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
1212
private $deviceLogProvider: Mobile.IDeviceLogProvider) {
13-
super();
14-
this.shouldDispose = true;
15-
}
13+
super();
14+
this.shouldDispose = true;
15+
}
1616

1717
public setShouldDispose(shouldDispose: boolean) {
1818
this.shouldDispose = shouldDispose;
@@ -22,7 +22,7 @@ export class IOSSimulatorLogProvider extends EventEmitter implements Mobile.IiOS
2222
if (!this.simulatorsLoggingEnabled[deviceId]) {
2323
const deviceLogChildProcess: ChildProcess = await this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceId, options ? options.predicate : null);
2424

25-
const action = (data: NodeBuffer | string) => {
25+
const action = (data: Buffer | string) => {
2626
const message = data.toString();
2727
this.$deviceLogProvider.logData(message, this.$devicePlatformsConstants.iOS, deviceId);
2828
};

lib/services/livesync/android-livesync-tool.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
274274
return true;
275275
}
276276

277-
private handleConnection({ socket, data }: { socket: ILiveSyncSocket, data: NodeBuffer | string }) {
277+
private handleConnection({ socket, data }: { socket: ILiveSyncSocket, data: Buffer | string }) {
278278
this.socketConnection = socket;
279279
this.socketConnection.uid = this.generateOperationIdentifier();
280280

281-
const versionLength = (<NodeBuffer>data).readUInt8(0);
281+
const versionLength = (<Buffer>data).readUInt8(0);
282282
const versionBuffer = data.slice(PROTOCOL_VERSION_LENGTH_SIZE, versionLength + PROTOCOL_VERSION_LENGTH_SIZE);
283283
const appIdentifierBuffer = data.slice(versionLength + PROTOCOL_VERSION_LENGTH_SIZE, data.length);
284284

@@ -287,7 +287,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
287287
this.$logger.trace(`Handle socket connection for app identifier: ${appIdentifier} with protocol version: ${protocolVersion}.`);
288288
this.protocolVersion = protocolVersion;
289289

290-
this.socketConnection.on("data", (connectionData: NodeBuffer) => this.handleData(socket.uid, connectionData));
290+
this.socketConnection.on("data", (connectionData: Buffer) => this.handleData(socket.uid, connectionData));
291291
this.socketConnection.on("close", (hasError: boolean) => this.handleSocketClose(socket.uid, hasError));
292292
this.socketConnection.on("error", (err: Error) => {
293293
const error = new Error(`Socket Error:\n${err}`);
@@ -299,7 +299,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
299299
});
300300
}
301301

302-
private connectEventuallyUntilTimeout(factory: () => ILiveSyncSocket, timeout: number): Promise<{ socket: ILiveSyncSocket, data: NodeBuffer | string }> {
302+
private connectEventuallyUntilTimeout(factory: () => ILiveSyncSocket, timeout: number): Promise<{ socket: ILiveSyncSocket, data: Buffer | string }> {
303303
return new Promise((resolve, reject) => {
304304
let lastKnownError: Error | string,
305305
isConnected = false;

lib/services/livesync/ios-device-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class IOSDeviceLiveSyncService extends DeviceLiveSyncServiceBase implemen
117117
this.$logger.trace(`Socket error received: ${error}`);
118118
});
119119

120-
this.socket.on("data", (data: NodeBuffer | string) => {
120+
this.socket.on("data", (data: Buffer | string) => {
121121
this.$logger.trace(`Socket sent data: ${data.toString()}`);
122122
});
123123
}

test/stubs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class FileSystemStub implements IFileSystem {
8585
return undefined;
8686
}
8787

88-
readFile(filename: string): NodeBuffer | string {
88+
readFile(filename: string): Buffer | string {
8989
return undefined;
9090
}
9191

tslint.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"rulesDirectory": "node_modules/tslint-microsoft-contrib",
33
"rules": {
4+
"deprecation": true,
45
"class-name": true,
56
"curly": true,
67
"eofline": true,

0 commit comments

Comments
 (0)