Skip to content

Commit 5e0e59f

Browse files
committed
tslint related changes
1 parent e57fa5f commit 5e0e59f

Some content is hidden

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

63 files changed

+590
-623
lines changed

.idea/misc.xml

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gruntfile.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,20 @@ module.exports = function(grunt) {
5555
sourceMap: false,
5656
removeComments: true
5757
}
58-
}
58+
},
5959
},
60-
60+
61+
tslint: {
62+
build: {
63+
files: {
64+
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts", "lib/common/test/unit-tests/**/*.ts", "definitions/**/*.ts", "!**/*.d.ts"]
65+
},
66+
options: {
67+
configuration: grunt.file.readJSON("./tslint.json")
68+
}
69+
}
70+
},
71+
6172
watch: {
6273
devall: {
6374
files: ["lib/**/*.ts", 'test/**/*.ts', "!lib/common/node_modules/**/*.ts"],
@@ -119,9 +130,9 @@ module.exports = function(grunt) {
119130
grunt.loadNpmTasks("grunt-contrib-watch");
120131
grunt.loadNpmTasks("grunt-shell");
121132
grunt.loadNpmTasks("grunt-ts");
133+
grunt.loadNpmTasks("grunt-tslint");
122134

123135
grunt.registerTask("set_package_version", function(version) {
124-
var fs = require("fs");
125136
var buildVersion = version !== undefined ? version : buildNumber;
126137
if (process.env["BUILD_CAUSE_GHPRBCAUSE"]) {
127138
buildVersion = "PR" + buildVersion;
@@ -150,7 +161,6 @@ module.exports = function(grunt) {
150161
grunt.file.write("package.json", JSON.stringify(packageJson, null, " "));
151162
});
152163

153-
154164
grunt.registerTask("test", ["ts:devall", "shell:npm_test"]);
155165
grunt.registerTask("pack", [
156166
"clean",
@@ -162,6 +172,7 @@ module.exports = function(grunt) {
162172
"copy:package_to_drop_folder",
163173
"copy:package_to_qa_drop_folder"
164174
]);
175+
grunt.registerTask("lint", ["tslint:build"]);
165176

166177
grunt.registerTask("default", "ts:devlib");
167178
};

lib/commands/add-library.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
///<reference path="../.d.ts"/>
22
"use strict";
33

4-
import path = require("path");
5-
import Future = require("fibers/future");
4+
import * as path from "path";
65

76
export class AddLibraryCommand implements ICommand {
87
constructor(private $platformService: IPlatformService,
@@ -14,8 +13,8 @@ export class AddLibraryCommand implements ICommand {
1413

1514
execute(args: string[]): IFuture<void> {
1615
return (() => {
17-
var platform = args[0];
18-
var libraryPath = path.resolve(args[1]);
16+
let platform = args[0];
17+
let libraryPath = path.resolve(args[1]);
1918
this.$platformService.addLibrary(platform, libraryPath).wait();
2019
this.$logger.info(`Library ${libraryPath} was successfully added for ${platform} platform.`);
2120
}).future<void>()();
@@ -48,4 +47,4 @@ export class AddLibraryCommand implements ICommand {
4847
}).future<boolean>()();
4948
}
5049
}
51-
$injector.registerCommand("library|add", AddLibraryCommand);
50+
$injector.registerCommand("library|add", AddLibraryCommand);

lib/commands/add-platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ export class AddPlatformCommand implements ICommand {
2525
}).future<boolean>()();
2626
}
2727
}
28-
$injector.registerCommand("platform|add", AddPlatformCommand);
28+
$injector.registerCommand("platform|add", AddPlatformCommand);

lib/commands/build.ts

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
2323
}
2424
$injector.registerCommand("build|ios", BuildIosCommand);
2525

26-
2726
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
2827
constructor($platformService: IPlatformService,
2928
private $platformsData: IPlatformsData) {

lib/commands/create-project.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ export class CreateProjectCommand implements ICommand {
3636
}).future<void>()();
3737
}
3838

39-
allowedParameters = [new ProjectCommandParameter(this.$errors, this.$logger, this.$projectNameValidator) ]
39+
allowedParameters = [new ProjectCommandParameter(this.$errors, this.$logger, this.$projectNameValidator) ];
4040
}
4141
$injector.registerCommand("create", CreateProjectCommand);

lib/commands/init.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
///<reference path="../.d.ts"/>
22
"use strict";
33

4-
import Future = require("fibers/future");
5-
64
export class InitCommand implements ICommand {
75
constructor(private $initService: IInitService) { }
86

@@ -13,4 +11,4 @@ export class InitCommand implements ICommand {
1311
return this.$initService.initialize();
1412
}
1513
}
16-
$injector.registerCommand("init", InitCommand);
14+
$injector.registerCommand("init", InitCommand);

lib/commands/install.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"use strict";
33

44
export class InstallCommand implements ICommand {
5-
private _projectData: any;
6-
75
constructor(private $platformsData: IPlatformsData,
86
private $platformService: IPlatformService,
97
private $projectData: IProjectData,
@@ -41,4 +39,4 @@ export class InstallCommand implements ICommand {
4139
}).future<void>()();
4240
}
4341
}
44-
$injector.registerCommand("install", InstallCommand);
42+
$injector.registerCommand("install", InstallCommand);

lib/commands/list-platforms.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
"use strict";
33

44
import helpers = require("./../common/helpers");
5-
import util = require("util")
65

76
export class ListPlatformsCommand implements ICommand {
87
constructor(private $platformService: IPlatformService,
98
private $logger: ILogger) { }
109

1110
execute(args: string[]): IFuture<void> {
1211
return (() => {
13-
var installedPlatforms = this.$platformService.getInstalledPlatforms().wait();
12+
let installedPlatforms = this.$platformService.getInstalledPlatforms().wait();
1413

1514
if(installedPlatforms.length > 0) {
16-
var preparedPlatforms = this.$platformService.getPreparedPlatforms().wait();
15+
let preparedPlatforms = this.$platformService.getPreparedPlatforms().wait();
1716
if(preparedPlatforms.length > 0) {
1817
this.$logger.out("The project is prepared for: ", helpers.formatListOfNames(preparedPlatforms, "and"));
1918
} else {

lib/commands/livesync.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ export class LivesyncCommand implements ICommand {
3030

3131
allowedParameters: ICommandParameter[] = [];
3232
}
33-
$injector.registerCommand("livesync", LivesyncCommand);
33+
$injector.registerCommand("livesync", LivesyncCommand);

lib/commands/plugin/remove-plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ export class RemovePluginCommand implements ICommand {
2727

2828
public allowedParameters: ICommandParameter[] = [];
2929
}
30-
$injector.registerCommand("plugin|remove", RemovePluginCommand);
30+
$injector.registerCommand("plugin|remove", RemovePluginCommand);

lib/commands/remove-platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ export class RemovePlatformCommand implements ICommand {
2525

2626
allowedParameters: ICommandParameter[] = [];
2727
}
28-
$injector.registerCommand("platform|remove", RemovePlatformCommand);
28+
$injector.registerCommand("platform|remove", RemovePlatformCommand);

lib/commands/update-platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ export class UpdatePlatformCommand implements ICommand {
2525

2626
allowedParameters: ICommandParameter[] = [];
2727
}
28-
$injector.registerCommand("platform|update", UpdatePlatformCommand);
28+
$injector.registerCommand("platform|update", UpdatePlatformCommand);

lib/common

Submodule common updated 62 files

lib/config.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
///<reference path=".d.ts"/>
22
"use strict";
33

4-
import path = require("path");
5-
import util = require("util");
6-
import staticConfigBaseLibPath = require("./common/static-config-base");
7-
import configBaseLib = require("./common/config-base");
4+
import * as path from "path";
5+
import * as staticConfigBaseLibPath from "./common/static-config-base";
6+
import * as configBaseLib from "./common/config-base";
87

98
export class Configuration extends configBaseLib.ConfigBase implements IConfiguration { // User specific config
109
CI_LOGGER = false;
@@ -37,7 +36,7 @@ export class StaticConfig extends staticConfigBaseLibPath.StaticConfigBase imple
3736
}
3837

3938
public get SYS_REQUIREMENTS_LINK(): string {
40-
var linkToSysRequirements: string;
39+
let linkToSysRequirements: string;
4140
switch(process.platform) {
4241
case "linux":
4342
linkToSysRequirements = "http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-linux.html#system-requirements";

lib/constants.ts

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
///<reference path=".d.ts"/>
2+
"use strict";
23

3-
export var APP_FOLDER_NAME = "app";
4-
export var APP_RESOURCES_FOLDER_NAME = "App_Resources";
5-
export var PROJECT_FRAMEWORK_FOLDER_NAME = "framework";
6-
export var NATIVESCRIPT_KEY_NAME = "nativescript";
7-
export var NODE_MODULES_FOLDER_NAME = "node_modules";
8-
export var TNS_CORE_MODULES_NAME = "tns-core-modules";
9-
export var PACKAGE_JSON_FILE_NAME = "package.json";
10-
export var NODE_MODULE_CACHE_PATH_KEY_NAME = "node-modules-cache-path";
11-
export var DEFAULT_APP_IDENTIFIER_PREFIX = "org.nativescript";
4+
export let APP_FOLDER_NAME = "app";
5+
export let APP_RESOURCES_FOLDER_NAME = "App_Resources";
6+
export let PROJECT_FRAMEWORK_FOLDER_NAME = "framework";
7+
export let NATIVESCRIPT_KEY_NAME = "nativescript";
8+
export let NODE_MODULES_FOLDER_NAME = "node_modules";
9+
export let TNS_CORE_MODULES_NAME = "tns-core-modules";
10+
export let PACKAGE_JSON_FILE_NAME = "package.json";
11+
export let NODE_MODULE_CACHE_PATH_KEY_NAME = "node-modules-cache-path";
12+
export let DEFAULT_APP_IDENTIFIER_PREFIX = "org.nativescript";
1213

1314
export class ReleaseType {
1415
static MAJOR = "major";
@@ -19,5 +20,3 @@ export class ReleaseType {
1920
static PREPATCH = "prepatch";
2021
static PRERELEASE = "prerelease";
2122
}
22-
23-

lib/declarations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ interface IProjectFilesManager {
8888

8989
interface IInitService {
9090
initialize(): IFuture<void>;
91-
}
91+
}

lib/dynamic-help-provider.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
///<reference path=".d.ts"/>
2-
32
"use strict";
43

54
import Future = require("fibers/future");
65

76
export class DynamicHelpProvider implements IDynamicHelpProvider {
8-
constructor() { }
9-
107
public isProjectType(args: string[]): IFuture<boolean> {
118
return Future.fromResult(true);
129
}
1310

1411
public getLocalVariables(options: { isHtml: boolean }): IFuture<IDictionary<any>> {
15-
var localVariables: IDictionary<any> = {};
12+
let localVariables: IDictionary<any> = {};
1613
return Future.fromResult(localVariables);
1714
}
1815
}

lib/lockfile.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import Future = require("fibers/future");
55
import lockfile = require("lockfile");
6-
import path = require("path");
6+
import * as path from "path";
77

88
export class LockFile implements ILockFile {
99
private lockFilePath: string;
@@ -20,7 +20,7 @@ export class LockFile implements ILockFile {
2020
};
2121

2222
public lock(): IFuture<void> {
23-
var future = new Future<void>();
23+
let future = new Future<void>();
2424
lockfile.lock(this.lockFilePath, LockFile.LOCK_PARAMS, (err: Error) => {
2525
if(err) {
2626
future.throw(err);
@@ -32,7 +32,7 @@ export class LockFile implements ILockFile {
3232
}
3333

3434
public unlock(): IFuture<void> {
35-
var future = new Future<void>();
35+
let future = new Future<void>();
3636
lockfile.unlock(this.lockFilePath, (err: Error) => {
3737
if(err) {
3838
future.throw(err);
@@ -43,4 +43,4 @@ export class LockFile implements ILockFile {
4343
return future;
4444
}
4545
}
46-
$injector.register("lockfile", LockFile);
46+
$injector.register("lockfile", LockFile);

lib/mobile-platforms-capabilities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class MobilePlatformsCapabilities implements Mobile.IPlatformsCapabilitie
2424
companion: false,
2525
hostPlatformsForDeploy: ["win32", "darwin", "linux"]
2626
}
27-
}
27+
};
2828

2929
return this.platformCapabilities;
3030
}

lib/nativescript-cli.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
///<reference path=".d.ts"/>
22
"use strict";
3-
import path = require("path");
43
require("./bootstrap");
54

65
import fiber = require("fibers");
@@ -9,11 +8,11 @@ import errors = require("./common/errors");
98
errors.installUncaughtExceptionListener();
109

1110
fiber(() => {
12-
var config = <Config.IConfig>$injector.resolve("$config");
13-
var err = <IErrors>$injector.resolve("$errors");
11+
let config = <Config.IConfig>$injector.resolve("$config");
12+
let err = <IErrors>$injector.resolve("$errors");
1413
err.printCallStack = config.DEBUG;
1514

16-
var commandDispatcher: ICommandDispatcher = $injector.resolve("commandDispatcher");
15+
let commandDispatcher: ICommandDispatcher = $injector.resolve("commandDispatcher");
1716

1817
if (process.argv[2] === "completion") {
1918
commandDispatcher.completeCommand().wait();

lib/node-package-manager.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class NodePackageManager implements INodePackageManager {
1717
}
1818

1919
public load(config?: any): IFuture<void> {
20-
var future = new Future<void>();
20+
let future = new Future<void>();
2121
npm.load(config, (err) => {
2222
if(err) {
2323
future.throw(err);
@@ -75,7 +75,7 @@ export class NodePackageManager implements INodePackageManager {
7575
} else {
7676
future.return(data);
7777
}
78-
}
78+
};
7979
args.push(callback);
8080

8181
let command = subCommandName ? npm.commands[commandName][subCommandName] : npm.commands[commandName];

0 commit comments

Comments
 (0)