Skip to content

Commit b22e93b

Browse files
committed
chore: fix linting
1 parent 66d7ec2 commit b22e93b

File tree

8 files changed

+52
-51
lines changed

8 files changed

+52
-51
lines changed

Gruntfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ module.exports = function (grunt) {
2929
src: ["lib/**/*.ts", "test/**/*.ts", "typings/**/*.ts", "!**/*.d.ts"]
3030
},
3131
options: {
32-
configuration: grunt.file.readJSON("./tslint.json")
32+
configuration: grunt.file.readJSON("./tslint.json"),
33+
project: "tsconfig.json"
3334
}
3435
}
3536
},

lib/doctor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class Doctor implements NativeScriptDoctor.IDoctor {
149149
);
150150

151151
if (sysInfoData.xcodeVer && sysInfoData.cocoaPodsVer) {
152-
let isCocoaPodsWorkingCorrectly = await this.sysInfo.isCocoaPodsWorkingCorrectly();
152+
const isCocoaPodsWorkingCorrectly = await this.sysInfo.isCocoaPodsWorkingCorrectly();
153153
result = result.concat(
154154
this.processSysInfoItem({
155155
item: isCocoaPodsWorkingCorrectly,

lib/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class Helpers {
55

66
public getPropertyName(method: Function): string {
77
if (method) {
8-
let match = method.toString().match(/(?:return\s+?.*\.(.+);)|(?:=>\s*?.*\.(.+)\b)/);
8+
const match = method.toString().match(/(?:return\s+?.*\.(.+);)|(?:=>\s*?.*\.(.+)\b)/);
99
if (match) {
1010
return (match[1] || match[2]).trim();
1111
}

lib/sys-info.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
265265
const xcodeProjectDir = path.join(tempDirectory, "cocoapods");
266266

267267
try {
268-
let spawnResult = await this.childProcess.spawnFromEvent("pod", ["install"], "exit", { spawnOptions: { cwd: xcodeProjectDir } });
268+
const spawnResult = await this.childProcess.spawnFromEvent("pod", ["install"], "exit", { spawnOptions: { cwd: xcodeProjectDir } });
269269
if (spawnResult.exitCode) {
270270
return false;
271271
} else {
@@ -333,7 +333,7 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
333333

334334
public isCocoaPodsUpdateRequired(): Promise<boolean> {
335335
return this.getValueForProperty(() => this.isCocoaPodsUpdateRequiredCache, async (): Promise<boolean> => {
336-
let xcprojInfo = await this.getXcprojInfo();
336+
const xcprojInfo = await this.getXcprojInfo();
337337
if (xcprojInfo.shouldUseXcproj && !xcprojInfo.xcprojAvailable) {
338338
return true;
339339
} else {

lib/wrappers/file-system.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const access = util.promisify(fs.access);
77
const mkdir = util.promisify(fs.mkdir);
88

99
export class FileSystem {
10-
public exists(path: string): boolean {
11-
return fs.existsSync(path);
10+
public exists(filePath: string): boolean {
11+
return fs.existsSync(filePath);
1212
}
1313

1414
public extractZip(pathToZip: string, outputDir: string): Promise<void> {
@@ -25,9 +25,9 @@ export class FileSystem {
2525
}
2626

2727
zipFile.openReadStream(entry, (openStreamError, stream) => {
28-
if(openStreamError) {
28+
if (openStreamError) {
2929
return reject(openStreamError);
30-
};
30+
}
3131

3232
const filePath = `${outputDir}/${fn}`;
3333

@@ -50,12 +50,12 @@ export class FileSystem {
5050
});
5151
}
5252

53-
public readDirectory(path: string): string[] {
54-
return fs.readdirSync(path);
53+
public readDirectory(directoryPath: string): string[] {
54+
return fs.readdirSync(directoryPath);
5555
}
5656

57-
public readJson<T>(path: string, options?: { encoding?: null; flag?: string; }): T {
58-
const content = fs.readFileSync(path, options);
57+
public readJson<T>(filePath: string, options?: { encoding?: null; flag?: string; }): T {
58+
const content = fs.readFileSync(filePath, options);
5959
return JSON.parse(content.toString());
6060
}
6161
}

test/ios-local-build-requirements.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("iOSLocalBuildRequirements", () => {
5757
testCases.forEach(testCase => {
5858
it(testCase.testName, async () => {
5959
const iOSLocalBuildRequirements = setupTestCase(testCase);
60-
let originalXcodeVersion = Constants.XCODE_MIN_REQUIRED_VERSION;
60+
const originalXcodeVersion = Constants.XCODE_MIN_REQUIRED_VERSION;
6161
Constants.XCODE_MIN_REQUIRED_VERSION = testCase.minRequiredXcodeVersion || Constants.XCODE_MIN_REQUIRED_VERSION;
6262

6363
const isXcodeVersionValid = await iOSLocalBuildRequirements.isXcodeVersionValid();
@@ -110,7 +110,7 @@ describe("iOSLocalBuildRequirements", () => {
110110
testCases.forEach(testCase => {
111111
it(testCase.testName, async () => {
112112
const iOSLocalBuildRequirements = setupTestCase(testCase);
113-
let originalXcodeVersion = Constants.XCODE_MIN_REQUIRED_VERSION;
113+
const originalXcodeVersion = Constants.XCODE_MIN_REQUIRED_VERSION;
114114
Constants.XCODE_MIN_REQUIRED_VERSION = testCase.minRequiredXcodeVersion || Constants.XCODE_MIN_REQUIRED_VERSION;
115115

116116
const isXcodeVersionValid = await iOSLocalBuildRequirements.checkRequirements();

test/sys-info.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`)
352352
});
353353

354354
describe("returns correct results when everything is installed", () => {
355-
let assertCommonValues = (result: NativeScriptDoctor.ISysInfoData) => {
355+
const assertCommonValues = (result: NativeScriptDoctor.ISysInfoData) => {
356356
assert.deepEqual(result.npmVer, childProcessResult.npmV.result.stdout);
357357
assert.deepEqual(result.nodeVer, "6.0.0");
358358
assert.deepEqual(result.javacVersion, "1.8.0_60");
@@ -565,7 +565,7 @@ ${expectedCliVersion}`;
565565
});
566566

567567
describe("when all of calls throw", () => {
568-
let assertAllValuesAreNull = async () => {
568+
const assertAllValuesAreNull = async () => {
569569
const result = await sysInfo.getSysInfo();
570570
assert.deepEqual(result.npmVer, null);
571571
assert.deepEqual(result.javacVersion, null);

test/wrappers/file-system.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@ import * as rimraf from "rimraf";
55
import { FileSystem } from "../../lib/wrappers/file-system";
66

77
describe('FileSystem', () => {
8-
describe('extractZip', () => {
9-
const d = new Date();
10-
const datetime = [
11-
d.getFullYear(),
12-
d.getMonth() + 1,
13-
d.getDate(),
14-
d.getHours(),
15-
d.getMinutes(),
16-
d.getSeconds(),
17-
d.getMilliseconds()
18-
].join('');
19-
const tmpDir = `${tmpdir()}/${datetime}`;
20-
const testFilePath = `${__dirname}/example.zip`;
21-
const filesThatNeedToExtsit = [
22-
`${tmpDir}/test/android-local-build-requirements.ts`,
23-
`${tmpDir}/test/android-tools-info.ts`,
24-
`${tmpDir}/test/ios-local-build-requirements.ts`,
25-
`${tmpDir}/test/sys-info.ts`,
26-
`${tmpDir}/test/wrappers/file-system.ts`
27-
];
8+
describe('extractZip', () => {
9+
const d = new Date();
10+
const datetime = [
11+
d.getFullYear(),
12+
d.getMonth() + 1,
13+
d.getDate(),
14+
d.getHours(),
15+
d.getMinutes(),
16+
d.getSeconds(),
17+
d.getMilliseconds()
18+
].join('');
19+
const tmpDir = `${tmpdir()}/${datetime}`;
20+
const testFilePath = `${__dirname}/example.zip`;
21+
const filesThatNeedToExtsit = [
22+
`${tmpDir}/test/android-local-build-requirements.ts`,
23+
`${tmpDir}/test/android-tools-info.ts`,
24+
`${tmpDir}/test/ios-local-build-requirements.ts`,
25+
`${tmpDir}/test/sys-info.ts`,
26+
`${tmpDir}/test/wrappers/file-system.ts`
27+
];
2828

29-
it('should extract in example zip archive in tmp folder', done => {
30-
const fs = new FileSystem();
29+
it('should extract in example zip archive in tmp folder', done => {
30+
const fs = new FileSystem();
3131

32-
fs.extractZip(testFilePath, tmpDir)
33-
.then(() => {
34-
const allExists = filesThatNeedToExtsit
35-
.map(fs.exists)
36-
.reduce((acc, r) => acc && r, true);
32+
fs.extractZip(testFilePath, tmpDir)
33+
.then(() => {
34+
const allExists = filesThatNeedToExtsit
35+
.map(fs.exists)
36+
.reduce((acc, r) => acc && r, true);
3737

38-
assert.isTrue(allExists);
38+
assert.isTrue(allExists);
3939

40-
done();
41-
})
42-
.catch(e => done(e));
43-
});
40+
done();
41+
})
42+
.catch(e => done(e));
43+
});
4444

45-
afterEach(done => rimraf(tmpDir, done));
46-
});
45+
afterEach(done => rimraf(tmpDir, done));
46+
});
4747
});

0 commit comments

Comments
 (0)