From 5553fee13bf2abe335d6ad375d7602d11042dba5 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 10 May 2019 14:43:54 -0700 Subject: [PATCH] Fixing lint errors for many of the projects --- .base-sample/package.json | 3 ++- basic-multi-root-sample/package.json | 3 ++- basic-multi-root-sample/tslint.json | 12 ++++++++++++ comment-sample/package.json | 6 +++--- completions-sample/package.json | 3 ++- configuration-sample/package.json | 3 ++- contentprovider-sample/package.json | 3 ++- decorator-sample/package.json | 3 ++- .../package.json | 3 ++- fsprovider-sample/package.json | 3 ++- fsprovider-sample/src/extension.ts | 2 +- fsprovider-sample/tslint.json | 12 ++++++++++++ helloworld-sample/package.json | 3 ++- helloworld-sample/tslint.json | 12 ++++++++++++ nodefs-provider-sample/package.json | 3 ++- progress-sample/package.json | 5 +++-- progress-sample/src/extension.ts | 2 +- progress-sample/tslint.json | 12 ++++++++++++ quickinput-sample/package.json | 3 ++- source-control-sample/package.json | 3 ++- statusbar-sample/package.json | 3 ++- terminal-sample/package.json | 6 +++--- tree-view-sample/package.json | 3 ++- tree-view-sample/src/extension.ts | 6 +++--- tree-view-sample/src/fileExplorer.ts | 6 +++--- tree-view-sample/src/ftpExplorer.ts | 4 ++-- tree-view-sample/src/jsonOutline.ts | 18 +++++++++--------- tree-view-sample/src/nodeDependencies.ts | 2 +- vim-sample/package.json | 3 ++- virtual-document-sample/package.json | 3 ++- webpack-sample/package.json | 3 ++- webpack-sample/tslint.json | 12 ++++++++++++ webview-sample/package.json | 3 ++- 33 files changed, 125 insertions(+), 46 deletions(-) create mode 100644 basic-multi-root-sample/tslint.json create mode 100644 fsprovider-sample/tslint.json create mode 100644 helloworld-sample/tslint.json create mode 100644 progress-sample/tslint.json create mode 100644 webpack-sample/tslint.json diff --git a/.base-sample/package.json b/.base-sample/package.json index bf9ce334..645bc3ba 100644 --- a/.base-sample/package.json +++ b/.base-sample/package.json @@ -24,7 +24,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/basic-multi-root-sample/package.json b/basic-multi-root-sample/package.json index 9899ff1d..da616f60 100644 --- a/basic-multi-root-sample/package.json +++ b/basic-multi-root-sample/package.json @@ -16,7 +16,8 @@ "main": "./out/src/extension", "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "contributes": { diff --git a/basic-multi-root-sample/tslint.json b/basic-multi-root-sample/tslint.json new file mode 100644 index 00000000..469c59d5 --- /dev/null +++ b/basic-multi-root-sample/tslint.json @@ -0,0 +1,12 @@ +{ + "rules": { + "no-string-throw": true, + "no-unused-expression": true, + "no-duplicate-variable": true, + "curly": true, + "class-name": true, + "semicolon": [true, "always"], + "triple-equals": true + }, + "defaultSeverity": "warning" +} diff --git a/comment-sample/package.json b/comment-sample/package.json index f62cf63c..0c225bdb 100644 --- a/comment-sample/package.json +++ b/comment-sample/package.json @@ -49,9 +49,9 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", - "lint": "tslint ./src/*.ts", + "compile": "tsc -p ./", "watch": "tsc -watch -p ./", + "lint": "tslint -p ./", "test": "npm run compile && node ./node_modules/vscode/bin/test" }, "devDependencies": { @@ -60,4 +60,4 @@ "typescript": "^3.4.5", "@types/vscode": "^1.32.0" } -} +} \ No newline at end of file diff --git a/completions-sample/package.json b/completions-sample/package.json index a4c897cc..59831105 100644 --- a/completions-sample/package.json +++ b/completions-sample/package.json @@ -22,7 +22,8 @@ "main": "./out/extension.js", "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/configuration-sample/package.json b/configuration-sample/package.json index 1a5aa2ee..e605d564 100644 --- a/configuration-sample/package.json +++ b/configuration-sample/package.json @@ -66,7 +66,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/contentprovider-sample/package.json b/contentprovider-sample/package.json index 233a9e4b..30190c79 100644 --- a/contentprovider-sample/package.json +++ b/contentprovider-sample/package.json @@ -58,7 +58,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/decorator-sample/package.json b/decorator-sample/package.json index f1451db0..a87bd3ae 100644 --- a/decorator-sample/package.json +++ b/decorator-sample/package.json @@ -32,7 +32,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/diagnostic-related-information-sample/package.json b/diagnostic-related-information-sample/package.json index 174b8ef9..7bc66868 100644 --- a/diagnostic-related-information-sample/package.json +++ b/diagnostic-related-information-sample/package.json @@ -16,7 +16,8 @@ "main": "./out/extension.js", "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/fsprovider-sample/package.json b/fsprovider-sample/package.json index 370f7221..b7943815 100644 --- a/fsprovider-sample/package.json +++ b/fsprovider-sample/package.json @@ -58,7 +58,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/fsprovider-sample/src/extension.ts b/fsprovider-sample/src/extension.ts index a9bef109..a537cf28 100644 --- a/fsprovider-sample/src/extension.ts +++ b/fsprovider-sample/src/extension.ts @@ -5,7 +5,7 @@ import { MemFS } from './fileSystemProvider'; export function activate(context: vscode.ExtensionContext) { - console.log('MemFS says "Hello"') + console.log('MemFS says "Hello"'); const memFs = new MemFS(); context.subscriptions.push(vscode.workspace.registerFileSystemProvider('memfs', memFs, { isCaseSensitive: true })); diff --git a/fsprovider-sample/tslint.json b/fsprovider-sample/tslint.json new file mode 100644 index 00000000..469c59d5 --- /dev/null +++ b/fsprovider-sample/tslint.json @@ -0,0 +1,12 @@ +{ + "rules": { + "no-string-throw": true, + "no-unused-expression": true, + "no-duplicate-variable": true, + "curly": true, + "class-name": true, + "semicolon": [true, "always"], + "triple-equals": true + }, + "defaultSeverity": "warning" +} diff --git a/helloworld-sample/package.json b/helloworld-sample/package.json index bbc383d3..0215bc62 100644 --- a/helloworld-sample/package.json +++ b/helloworld-sample/package.json @@ -25,7 +25,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/helloworld-sample/tslint.json b/helloworld-sample/tslint.json new file mode 100644 index 00000000..469c59d5 --- /dev/null +++ b/helloworld-sample/tslint.json @@ -0,0 +1,12 @@ +{ + "rules": { + "no-string-throw": true, + "no-unused-expression": true, + "no-duplicate-variable": true, + "curly": true, + "class-name": true, + "semicolon": [true, "always"], + "triple-equals": true + }, + "defaultSeverity": "warning" +} diff --git a/nodefs-provider-sample/package.json b/nodefs-provider-sample/package.json index e615911b..4b161025 100644 --- a/nodefs-provider-sample/package.json +++ b/nodefs-provider-sample/package.json @@ -16,7 +16,8 @@ "main": "./out/extension.js", "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./", "test": "npm run compile && node ./node_modules/vscode/bin/test" }, diff --git a/progress-sample/package.json b/progress-sample/package.json index c0019635..7c62ce68 100644 --- a/progress-sample/package.json +++ b/progress-sample/package.json @@ -31,8 +31,9 @@ "main": "./out/extension.js", "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", - "watch": "tsc -watch -p ./" + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./", + "lint": "tslint -p ./" }, "devDependencies": { "@types/node": "^6.0.40", diff --git a/progress-sample/src/extension.ts b/progress-sample/src/extension.ts index bf72808c..dcc0c34c 100644 --- a/progress-sample/src/extension.ts +++ b/progress-sample/src/extension.ts @@ -14,7 +14,7 @@ export function activate(context: ExtensionContext) { cancellable: true }, (progress, token) => { token.onCancellationRequested(() => { - console.log("User canceled the long running operation") + console.log("User canceled the long running operation"); }); progress.report({ increment: 0 }); diff --git a/progress-sample/tslint.json b/progress-sample/tslint.json new file mode 100644 index 00000000..469c59d5 --- /dev/null +++ b/progress-sample/tslint.json @@ -0,0 +1,12 @@ +{ + "rules": { + "no-string-throw": true, + "no-unused-expression": true, + "no-duplicate-variable": true, + "curly": true, + "class-name": true, + "semicolon": [true, "always"], + "triple-equals": true + }, + "defaultSeverity": "warning" +} diff --git a/quickinput-sample/package.json b/quickinput-sample/package.json index 3f6298a5..aa658483 100644 --- a/quickinput-sample/package.json +++ b/quickinput-sample/package.json @@ -24,7 +24,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/source-control-sample/package.json b/source-control-sample/package.json index d53b43f0..45be42d4 100644 --- a/source-control-sample/package.json +++ b/source-control-sample/package.json @@ -76,7 +76,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "dependencies": { diff --git a/statusbar-sample/package.json b/statusbar-sample/package.json index bea26458..6d038b9d 100644 --- a/statusbar-sample/package.json +++ b/statusbar-sample/package.json @@ -23,7 +23,8 @@ "main": "./out/extension.js", "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/terminal-sample/package.json b/terminal-sample/package.json index 27bc557b..d127f29f 100644 --- a/terminal-sample/package.json +++ b/terminal-sample/package.json @@ -115,9 +115,9 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", - "lint": "tslint ./src/*.ts", - "watch": "tsc -watch -p ./" + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./", + "lint": "tslint -p ./" }, "devDependencies": { "@types/node": "^6.0.40", diff --git a/tree-view-sample/package.json b/tree-view-sample/package.json index d6011b5b..9d79b396 100644 --- a/tree-view-sample/package.json +++ b/tree-view-sample/package.json @@ -204,7 +204,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/tree-view-sample/src/extension.ts b/tree-view-sample/src/extension.ts index 302e82e0..3e79d425 100644 --- a/tree-view-sample/src/extension.ts +++ b/tree-view-sample/src/extension.ts @@ -2,9 +2,9 @@ import * as vscode from 'vscode'; -import { DepNodeProvider, Dependency } from './nodeDependencies' -import { JsonOutlineProvider } from './jsonOutline' -import { FtpExplorer } from './ftpExplorer' +import { DepNodeProvider, Dependency } from './nodeDependencies'; +import { JsonOutlineProvider } from './jsonOutline'; +import { FtpExplorer } from './ftpExplorer'; import { FileExplorer } from './fileExplorer'; import { TestView } from './testView'; diff --git a/tree-view-sample/src/fileExplorer.ts b/tree-view-sample/src/fileExplorer.ts index f7bfbc50..9b1870de 100644 --- a/tree-view-sample/src/fileExplorer.ts +++ b/tree-view-sample/src/fileExplorer.ts @@ -145,8 +145,8 @@ export class FileStat implements vscode.FileStat { } interface Entry { - uri: vscode.Uri, - type: vscode.FileType + uri: vscode.Uri; + type: vscode.FileType; } //#endregion @@ -278,7 +278,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return a[0].localeCompare(b[0]); } return a[1] === vscode.FileType.Directory ? -1 : 1; - }) + }); return children.map(([name, type]) => ({ uri: vscode.Uri.file(path.join(workspaceFolder.uri.fsPath, name)), type })); } diff --git a/tree-view-sample/src/ftpExplorer.ts b/tree-view-sample/src/ftpExplorer.ts index 3734bad6..291e0124 100644 --- a/tree-view-sample/src/ftpExplorer.ts +++ b/tree-view-sample/src/ftpExplorer.ts @@ -30,7 +30,7 @@ export class FtpModel { client.on('error', error => { e('Error while connecting: ' + error.message); - }) + }); client.connect({ host: this.host, @@ -94,7 +94,7 @@ export class FtpModel { return e(err); } - let string = '' + let string = ''; stream.on('data', function (buffer) { if (buffer) { var part = buffer.toString(); diff --git a/tree-view-sample/src/jsonOutline.ts b/tree-view-sample/src/jsonOutline.ts index 64bb3f5b..9a47276c 100644 --- a/tree-view-sample/src/jsonOutline.ts +++ b/tree-view-sample/src/jsonOutline.ts @@ -37,7 +37,7 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { .then(value => { if (value !== null && value !== undefined) { this.editor.edit(editBuilder => { - const path = json.getLocation(this.text, offset).path + const path = json.getLocation(this.text, offset).path; let propertyNode = json.findNodeAtLocation(this.tree, path); if (propertyNode.parent.type !== 'array') { propertyNode = propertyNode.parent.children[0]; @@ -47,7 +47,7 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { setTimeout(() => { this.parseTree(); this.refresh(offset); - }, 100) + }, 100); }); } }); @@ -91,7 +91,7 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { getChildren(offset?: number): Thenable { if (offset) { - const path = json.getLocation(this.text, offset).path + const path = json.getLocation(this.text, offset).path; const node = json.findNodeAtLocation(this.tree, path); return Promise.resolve(this.getChildrenOffsets(node)); } else { @@ -102,7 +102,7 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { private getChildrenOffsets(node: json.Node): number[] { const offsets: number[] = []; for (const child of node.children) { - const childPath = json.getLocation(this.text, child.offset).path + const childPath = json.getLocation(this.text, child.offset).path; const childNode = json.findNodeAtLocation(this.tree, childPath); if (childNode) { offsets.push(childNode.offset); @@ -112,7 +112,7 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { } getTreeItem(offset: number): vscode.TreeItem { - const path = json.getLocation(this.text, offset).path + const path = json.getLocation(this.text, offset).path; const valueNode = json.findNodeAtLocation(this.tree, path); if (valueNode) { let hasChildren = valueNode.type === 'object' || valueNode.type === 'array'; @@ -139,19 +139,19 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { return { light: this.context.asAbsolutePath(path.join('resources', 'light', 'boolean.svg')), dark: this.context.asAbsolutePath(path.join('resources', 'dark', 'boolean.svg')) - } + }; } if (nodeType === 'string') { return { light: this.context.asAbsolutePath(path.join('resources', 'light', 'string.svg')), dark: this.context.asAbsolutePath(path.join('resources', 'dark', 'string.svg')) - } + }; } if (nodeType === 'number') { return { light: this.context.asAbsolutePath(path.join('resources', 'light', 'number.svg')), dark: this.context.asAbsolutePath(path.join('resources', 'dark', 'number.svg')) - } + }; } return null; } @@ -177,7 +177,7 @@ export class JsonOutlineProvider implements vscode.TreeDataProvider { return '[ ] ' + property; } } - const value = this.editor.document.getText(new vscode.Range(this.editor.document.positionAt(node.offset), this.editor.document.positionAt(node.offset + node.length))) + const value = this.editor.document.getText(new vscode.Range(this.editor.document.positionAt(node.offset), this.editor.document.positionAt(node.offset + node.length))); return `${property}: ${value}`; } } diff --git a/tree-view-sample/src/nodeDependencies.ts b/tree-view-sample/src/nodeDependencies.ts index 67deb123..81872fca 100644 --- a/tree-view-sample/src/nodeDependencies.ts +++ b/tree-view-sample/src/nodeDependencies.ts @@ -55,7 +55,7 @@ export class DepNodeProvider implements vscode.TreeDataProvider { arguments: [moduleName] }); } - } + }; const deps = packageJson.dependencies ? Object.keys(packageJson.dependencies).map(dep => toDep(dep, packageJson.dependencies[dep])) diff --git a/vim-sample/package.json b/vim-sample/package.json index 9768e40f..8cd2248a 100644 --- a/vim-sample/package.json +++ b/vim-sample/package.json @@ -66,7 +66,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "devDependencies": { diff --git a/virtual-document-sample/package.json b/virtual-document-sample/package.json index 47e64915..c0547702 100644 --- a/virtual-document-sample/package.json +++ b/virtual-document-sample/package.json @@ -50,7 +50,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -watch -p ./" }, "dependencies": { diff --git a/webpack-sample/package.json b/webpack-sample/package.json index b4e10fec..29c717e0 100644 --- a/webpack-sample/package.json +++ b/webpack-sample/package.json @@ -26,7 +26,8 @@ "vscode:prepublish": "webpack --mode production", "webpack": "webpack --mode development", "webpack-dev": "webpack --mode development --watch", - "test-compile": "tsc -p ./" + "test-compile": "tsc -p ./", + "lint": "tslint -p ./" }, "devDependencies": { "@types/node": "^7.0.43", diff --git a/webpack-sample/tslint.json b/webpack-sample/tslint.json new file mode 100644 index 00000000..469c59d5 --- /dev/null +++ b/webpack-sample/tslint.json @@ -0,0 +1,12 @@ +{ + "rules": { + "no-string-throw": true, + "no-unused-expression": true, + "no-duplicate-variable": true, + "curly": true, + "class-name": true, + "semicolon": [true, "always"], + "triple-equals": true + }, + "defaultSeverity": "warning" +} diff --git a/webview-sample/package.json b/webview-sample/package.json index 4a8bd4cf..9fef0c45 100644 --- a/webview-sample/package.json +++ b/webview-sample/package.json @@ -31,7 +31,8 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./", + "lint": "tslint -p ./", "watch": "tsc -w -p ./" }, "dependencies": {},