Skip to content

Commit 5050178

Browse files
committed
Merge pull request #814 from NativeScript/tslint
tslint related changes
2 parents e57fa5f + 5e0e59f commit 5050178

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gruntfile.js

Lines changed: 15 additions & 4 deletions
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

Lines changed: 4 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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);

0 commit comments

Comments
 (0)