Skip to content

Commit 8472d76

Browse files
committed
More tslint changes
1 parent 5050178 commit 8472d76

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+770
-761
lines changed

lib/bootstrap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ $injector.requireCommand("platform|add", "./commands/add-platform");
3333
$injector.requireCommand("platform|remove", "./commands/remove-platform");
3434
$injector.requireCommand("platform|update", "./commands/update-platform");
3535
$injector.requireCommand("library|add", "./commands/add-library");
36-
$injector.requireCommand("run|ios", "./commands/run");
36+
$injector.requireCommand("run|ios", "./commands/run");
3737
$injector.requireCommand("run|android", "./commands/run");
3838

3939
$injector.requireCommand("debug|ios", "./commands/debug");

lib/commands/add-library.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,25 @@ export class AddLibraryCommand implements ICommand {
2525
if (args.length !== 2) {
2626
this.$errors.fail("This command needs two parameters.");
2727
}
28-
29-
let platform = args[0];
30-
let platformLowerCase = platform.toLowerCase();
28+
29+
let platform = args[0];
30+
let platformLowerCase = platform.toLowerCase();
3131
let libraryPath = path.resolve(args[1]);
3232
if(platformLowerCase === "android") {
3333
if(!this.$fs.exists(path.join(libraryPath, "project.properties")).wait()) {
3434
let files = this.$fs.enumerateFilesInDirectorySync(libraryPath);
3535
if(!_.any(files, file => path.extname(file) === ".jar")) {
36-
this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is the file path to a directory containing one or more `*.jar` files or to a directory containing the `project.properties` files.");
36+
this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is the file path to a directory " +
37+
"containing one or more `*.jar` files or to a directory containing the `project.properties` files.");
3738
}
3839
}
3940
} else if(platformLowerCase === "ios") {
4041
if(path.extname(libraryPath) !== ".framework") {
41-
this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is a Cocoa Touch Framework with all build architectures enabled.");
42+
this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is a Cocoa Touch Framework with " +
43+
"all build architectures enabled.");
4244
}
4345
}
44-
46+
4547
this.$platformService.validatePlatformInstalled(args[0]);
4648
return true;
4749
}).future<boolean>()();

lib/commands/init.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
export class InitCommand implements ICommand {
55
constructor(private $initService: IInitService) { }
6-
6+
77
public allowedParameters: ICommandParameter[] = [];
88
public enableHooks = false;
9-
9+
1010
public execute(args: string[]): IFuture<void> {
1111
return this.$initService.initialize();
1212
}

lib/commands/install.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ export class InstallCommand implements ICommand {
88
private $projectDataService: IProjectDataService,
99
private $pluginsService: IPluginsService,
1010
private $logger: ILogger) { }
11-
11+
1212
public enableHooks = false;
13-
13+
1414
public allowedParameters: ICommandParameter[] = [];
15-
15+
1616
public execute(args: string[]): IFuture<void> {
1717
return (() => {
1818
let error: string = "";
19-
19+
2020
this.$pluginsService.ensureAllDependenciesAreInstalled().wait();
21-
21+
2222
this.$projectDataService.initialize(this.$projectData.projectDir);
2323
_.each(this.$platformsData.platformsNames, platform => {
2424
let platformData = this.$platformsData.getPlatformData(platform);
@@ -31,11 +31,11 @@ export class InstallCommand implements ICommand {
3131
}
3232
}
3333
});
34-
34+
3535
if(error) {
3636
this.$logger.error(error);
3737
}
38-
38+
3939
}).future<void>()();
4040
}
4141
}

lib/commands/list-platforms.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export class ListPlatformsCommand implements ICommand {
2020
}
2121
this.$logger.out("Installed platforms: ", helpers.formatListOfNames(installedPlatforms, "and"));
2222
} else {
23-
this.$logger.out("Available platforms for this OS: ", helpers.formatListOfNames(this.$platformService.getAvailablePlatforms().wait(), "and"));
23+
let formattedPlatformsList = helpers.formatListOfNames(this.$platformService.getAvailablePlatforms().wait(), "and");
24+
this.$logger.out("Available platforms for this OS: ", formattedPlatformsList);
2425
this.$logger.out("No installed platforms found. Use $ tns platform add");
2526
}
2627
}).future<void>()();

lib/commands/livesync.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ export class LivesyncCommand implements ICommand {
99
private $errors: IErrors) { }
1010

1111
public execute(args: string[]): IFuture<void> {
12-
this.$options.justlaunch = true;
12+
this.$options.justlaunch = true;
1313
return this.$usbLiveSyncService.liveSync(args[0]);
1414
}
15-
15+
1616
public canExecute(args: string[]): IFuture<boolean> {
1717
return (() => {
1818
if(args.length >= 2) {
1919
this.$errors.fail("Invalid number of arguments.");
2020
}
21-
21+
2222
let platform = args[0];
2323
if(platform) {
2424
return _.contains(this.$mobileHelper.platformNames, this.$mobileHelper.normalizePlatformName(platform));
2525
}
26-
26+
2727
return true;
2828
}).future<boolean>()();
2929
}
30-
30+
3131
allowedParameters: ICommandParameter[] = [];
3232
}
3333
$injector.registerCommand("livesync", LivesyncCommand);

lib/commands/plugin/add-plugin.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
export class AddPluginCommand implements ICommand {
55
constructor(private $pluginsService: IPluginsService,
66
private $errors: IErrors) { }
7-
7+
88
execute(args: string[]): IFuture<void> {
99
return this.$pluginsService.add(args[0]);
1010
}
11-
11+
1212
canExecute(args: string[]): IFuture<boolean> {
1313
return (() => {
1414
if(!args[0]) {
1515
this.$errors.fail("You must specify plugin name.");
1616
}
17-
17+
1818
let installedPlugins = this.$pluginsService.getAllInstalledPlugins().wait();
1919
let pluginName = args[0].toLowerCase();
2020
if(_.any(installedPlugins, (plugin: IPluginData) => plugin.name.toLowerCase() === pluginName)) {
2121
this.$errors.failWithoutHelp(`Plugin "${pluginName}" is already installed.`);
2222
}
23-
24-
return true;
23+
24+
return true;
2525
}).future<boolean>()();
2626
}
27-
27+
2828
public allowedParameters: ICommandParameter[] = [];
2929
}
3030
$injector.registerCommand("plugin|add", AddPluginCommand);

lib/commands/plugin/remove-plugin.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
export class RemovePluginCommand implements ICommand {
55
constructor(private $pluginsService: IPluginsService,
66
private $errors: IErrors) { }
7-
7+
88
execute(args: string[]): IFuture<void> {
99
return this.$pluginsService.remove(args[0]);
1010
}
11-
11+
1212
canExecute(args: string[]): IFuture<boolean> {
1313
return (() => {
1414
if(!args[0]) {
1515
this.$errors.fail("You must specify plugin name.");
1616
}
17-
17+
1818
let installedPlugins = this.$pluginsService.getAllInstalledPlugins().wait();
1919
let pluginName = args[0].toLowerCase();
2020
if(!_.any(installedPlugins, (plugin: IPluginData) => plugin.name.toLowerCase() === pluginName)) {
2121
this.$errors.failWithoutHelp(`Plugin "${pluginName}" is not installed.`);
2222
}
23-
23+
2424
return true;
2525
}).future<boolean>()();
2626
}
27-
27+
2828
public allowedParameters: ICommandParameter[] = [];
2929
}
3030
$injector.registerCommand("plugin|remove", RemovePluginCommand);

lib/commands/run.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class RunAndroidCommand extends RunCommandBase implements ICommand {
2828
private $platformsData: IPlatformsData) {
2929
super($platformService);
3030
}
31-
31+
3232
public allowedParameters: ICommandParameter[] = [];
3333

3434
public execute(args: string[]): IFuture<void> {

lib/config.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ export class StaticConfig extends staticConfigBaseLibPath.StaticConfigBase imple
3030
public ERROR_REPORT_SETTING_NAME = "TrackExceptions";
3131
public ANALYTICS_INSTALLATION_ID_SETTING_NAME = "AnalyticsInstallationID";
3232
public START_PACKAGE_ACTIVITY_NAME = "com.tns.NativeScriptActivity";
33-
33+
3434
constructor($injector: IInjector) {
35-
super($injector);
35+
super($injector);
3636
}
37-
37+
3838
public get SYS_REQUIREMENTS_LINK(): string {
3939
let linkToSysRequirements: string;
4040
switch(process.platform) {
@@ -63,7 +63,7 @@ export class StaticConfig extends staticConfigBaseLibPath.StaticConfigBase imple
6363
public get HTML_CLI_HELPERS_DIR(): string {
6464
return path.join(__dirname, "../docs/helpers");
6565
}
66-
66+
6767
public get pathToPackageJson(): string {
6868
return path.join(__dirname, "..", "package.json");
6969
}

lib/declarations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface INpmInstallOptions {
2727
interface IDependencyData {
2828
name: string;
2929
version: string;
30-
nativescript: any;
30+
nativescript: any;
3131
dependencies?: IStringDictionary;
3232
devDependencies?: IStringDictionary;
3333
}

lib/lockfile.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import * as path from "path";
77

88
export class LockFile implements ILockFile {
99
private lockFilePath: string;
10-
10+
1111
constructor(private $options: IOptions) {
1212
this.lockFilePath = path.join(this.$options.profileDir, ".lock");
1313
}
14-
14+
1515
private static LOCK_EXPIRY_PERIOD_SEC = 180;
1616
private static LOCK_PARAMS = {
1717
retryWait: 100,

lib/node-package-manager.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"use strict";
33

44
import Future = require("fibers/future");
5-
import npm = require("npm");
5+
import * as npm from "npm";
66

77
export class NodePackageManager implements INodePackageManager {
88
constructor(private $childProcess: IChildProcess,
@@ -15,7 +15,7 @@ export class NodePackageManager implements INodePackageManager {
1515
public getCache(): string {
1616
return npm.cache;
1717
}
18-
18+
1919
public load(config?: any): IFuture<void> {
2020
let future = new Future<void>();
2121
npm.load(config, (err) => {
@@ -27,7 +27,7 @@ export class NodePackageManager implements INodePackageManager {
2727
});
2828
return future;
2929
}
30-
30+
3131
public install(packageName: string, pathToSave: string, config?: any): IFuture<any> {
3232
if(this.$options.ignoreScripts) {
3333
config = config || {};
@@ -36,7 +36,7 @@ export class NodePackageManager implements INodePackageManager {
3636

3737
return this.loadAndExecute("install", [pathToSave, packageName], { config: config });
3838
}
39-
39+
4040
public uninstall(packageName: string, config?: any): IFuture<any> {
4141
return this.loadAndExecute("uninstall", [[packageName]], { config: config });
4242
}
@@ -45,28 +45,28 @@ export class NodePackageManager implements INodePackageManager {
4545
// function cache (pkg, ver, where, scrub, cb)
4646
return this.loadAndExecute("cache", [packageName, version, undefined, false], { subCommandName: "add", config: config });
4747
}
48-
48+
4949
public cacheUnpack(packageName: string, version: string, unpackTarget?: string): IFuture<void> {
5050
// function unpack (pkg, ver, unpackTarget, dMode, fMode, uid, gid, cb)
5151
return this.loadAndExecute("cache", [packageName, version, unpackTarget, null, null, null, null], { subCommandName: "unpack" });
5252
}
53-
53+
5454
public view(packageName: string, propertyName: string): IFuture<any> {
5555
return this.loadAndExecute("view", [[packageName, propertyName], [false]]);
5656
}
5757

5858
public executeNpmCommand(npmCommandName: string, currentWorkingDirectory: string): IFuture<any> {
5959
return this.$childProcess.exec(npmCommandName, { cwd: currentWorkingDirectory });
6060
}
61-
61+
6262
private loadAndExecute(commandName: string, args: any[], opts?: { config?: any, subCommandName?: string }): IFuture<any> {
6363
return (() => {
6464
opts = opts || {};
6565
this.load(opts.config).wait();
6666
return this.executeCore(commandName, args, opts.subCommandName).wait();
6767
}).future<any>()();
6868
}
69-
69+
7070
private executeCore(commandName: string, args: any[], subCommandName?: string): IFuture<any> {
7171
let future = new Future<any>();
7272
let callback = (err: Error, data: any) => {
@@ -77,10 +77,10 @@ export class NodePackageManager implements INodePackageManager {
7777
}
7878
};
7979
args.push(callback);
80-
80+
8181
let command = subCommandName ? npm.commands[commandName][subCommandName] : npm.commands[commandName];
8282
command.apply(this, args);
83-
83+
8484
return future;
8585
}
8686
}

0 commit comments

Comments
 (0)