From ba346da54b1a3dbca94d7c9f0d083b955975110a Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 1 May 2017 13:17:50 -0400 Subject: [PATCH] Adds linting to compile step Reorgs tasks Fixes lint issues --- .vscode/tasks.json | 51 +++++++++++++++++------------------------- package.json | 45 +++++++++++++++++++------------------ src/gitService.ts | 4 ++-- src/system/function.ts | 2 +- tslint.json | 1 - 5 files changed, 47 insertions(+), 56 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ac6c666..2c2abf1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -9,36 +9,27 @@ // A task runner that calls a custom npm script that compiles the extension. { "version": "2.0.0", - "command": "npm", - "args": ["run"], - "isShellCommand": true, "showOutput": "always", - "suppressTaskName": true, - // use the standard tsc in watch mode problem matcher to find compile problems in the output. - "tasks": [{ - "taskName": "compile", - "args": ["compile", "--loglevel", "silent"], - "isBuildCommand": true, - "isBackground": true, - "problemMatcher": "$tsc-watch" - }, { - "taskName": "tslint", - "args": ["lint", "--loglevel", "silent"], - "isBackground": true, - "problemMatcher": { - "owner": "tslint", - "fileLocation": [ - "relative", - "${workspaceRoot}" - ], - "severity": "warning", - "pattern": { - "regexp": "^(\\S.*)\\[(\\d+), (\\d+)\\]:\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "message": 4 - } + "tasks": [ + { + "taskName": "compile", + "command": "npm run compile", + "isBuildCommand": true, + "isShellCommand": true, + "problemMatcher": [ "$tsc", "$tslint5" ] + }, + { + "taskName": "lint", + "command": "npm run lint", + "isShellCommand": true, + "problemMatcher": "$tslint5" + }, + { + "taskName": "watch", + "command": "npm run watch", + "isBackground": true, + "isShellCommand": true, + "problemMatcher": "$tsc-watch" } - }] + ] } \ No newline at end of file diff --git a/package.json b/package.json index 6c97ab5..dbbabf6 100644 --- a/package.json +++ b/package.json @@ -864,34 +864,35 @@ "*" ], "scripts": { - "compile": "tsc -watch -p ./", + "compile": "npm run lint && tsc -p ./", + "watch": "tsc -watch -p ./", "lint": "tslint --project tslint.json", - "pack": "git clean -xdf && npm install && vsce package", + "pack": "git clean -xdf --exclude=node_modules/ && vsce package", "postinstall": "node ./node_modules/vscode/bin/install", - "pub": "git clean -xdf --exclude=node_modules/ && npm install && vsce publish", - "vscode:prepublish": "tsc -p ./" + "pub": "git clean -xdf && vsce publish", + "vscode:prepublish": "npm install && npm run compile" }, "dependencies": { - "applicationinsights": "0.19.0", - "copy-paste": "1.3.0", - "ignore": "3.2.7", - "lodash.debounce": "4.0.8", + "applicationinsights": "0.19.0", + "copy-paste": "1.3.0", + "ignore": "3.2.7", + "lodash.debounce": "4.0.8", "lodash.escaperegexp": "4.1.2", - "lodash.isequal": "4.5.0", - "lodash.once": "4.1.1", - "moment": "2.18.1", - "spawn-rx": "2.0.10", - "tmp": "0.0.31" + "lodash.isequal": "4.5.0", + "lodash.once": "4.1.1", + "moment": "2.18.1", + "spawn-rx": "2.0.10", + "tmp": "0.0.31" }, "devDependencies": { - "@types/applicationinsights": "0.15.33", - "@types/copy-paste": "1.1.30", - "@types/mocha": "2.2.41", - "@types/node": "7.0.14", - "@types/tmp": "0.0.32", - "mocha": "3.3.0", - "tslint": "5.1.0", - "typescript": "2.3.2", - "vscode": "1.1.0" + "@types/applicationinsights": "0.15.33", + "@types/copy-paste": "1.1.30", + "@types/mocha": "2.2.41", + "@types/node": "7.0.14", + "@types/tmp": "0.0.32", + "mocha": "3.3.0", + "tslint": "5.1.0", + "typescript": "2.3.2", + "vscode": "1.1.0" } } \ No newline at end of file diff --git a/src/gitService.ts b/src/gitService.ts index e4d00d2..ad10e88 100644 --- a/src/gitService.ts +++ b/src/gitService.ts @@ -382,7 +382,7 @@ export class GitService extends Disposable { return undefined; } - }; + } async getBlameForLine(uri: GitUri, line: number): Promise { Logger.log(`getBlameForLine('${uri.repoPath}', '${uri.fsPath}', ${line}, ${uri.sha})`); @@ -665,7 +665,7 @@ export class GitService extends Disposable { return undefined; } - }; + } async getLogLocations(uri: GitUri, selectedSha?: string, line?: number): Promise { Logger.log(`getLogLocations('${uri.repoPath}', '${uri.fsPath}', ${uri.sha}, ${selectedSha}, ${line})`); diff --git a/src/system/function.ts b/src/system/function.ts index 2d9ea5b..3b5f0e0 100644 --- a/src/system/function.ts +++ b/src/system/function.ts @@ -14,5 +14,5 @@ export namespace Functions { export function once(fn: T): T { return _once(fn); - }; + } } \ No newline at end of file diff --git a/tslint.json b/tslint.json index 3000bdc..e377605 100644 --- a/tslint.json +++ b/tslint.json @@ -19,7 +19,6 @@ "no-trailing-whitespace": true, "no-unsafe-finally": true, "no-unused-expression": false, - "no-unused-new": true, "no-var-keyword": true, "no-var-requires": false, "object-literal-key-quotes": [