Skip to content

Commit 27f8982

Browse files
committed
included tslint
1 parent faa3655 commit 27f8982

4 files changed

Lines changed: 83 additions & 26 deletions

File tree

src/client/common/childProc.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
'use strict';
1+
"use strict";
22

3-
import * as path from 'path';
4-
import * as fs from 'fs';
5-
import * as child_process from 'child_process';
3+
import * as path from "path";
4+
import * as fs from "fs";
5+
import * as child_process from "child_process";
66

7-
export function sendCommand(commandLine: string, cwd: string, includeErrorAsResponse:boolean = false): Promise<string> {
7+
export function sendCommand(commandLine: string, cwd: string, includeErrorAsResponse: boolean = false): Promise<string> {
88
return new Promise<string>((resolve, reject) => {
99

1010
child_process.exec(commandLine, { cwd: cwd }, (error, stdout, stderr) => {
11-
if (includeErrorAsResponse){
12-
return resolve(stdout + '\n' + stderr);
11+
if (includeErrorAsResponse) {
12+
return resolve(stdout + "\n" + stderr);
1313
}
14-
15-
var hasErrors = (error && error.message.length > 0) || (stderr && stderr.length > 0);
14+
15+
let hasErrors = (error && error.message.length > 0) || (stderr && stderr.length > 0);
1616
if (hasErrors && (typeof stdout !== "string" || stdout.length === 0)) {
17-
var errorMsg = (error && error.message) ? error.message : (stderr && stderr.length > 0 ? stderr + '' : "");
17+
let errorMsg = (error && error.message) ? error.message : (stderr && stderr.length > 0 ? stderr + "" : "");
1818
return reject(errorMsg);
1919
}
2020

21-
resolve(stdout + '');
21+
resolve(stdout + "");
2222
});
2323
});
2424
}

src/client/debugger/Common/Contracts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'use strict';
2-
import * as net from 'net';
3-
import {DebugProtocol} from 'vscode-debugprotocol';
1+
"use strict";
2+
import * as net from "net";
3+
import {DebugProtocol} from "vscode-debugprotocol";
44

55
export const DjangoApp = "DJANGO";
66
export enum DebugFlags {
@@ -35,7 +35,7 @@ export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArgum
3535
cwd?: string;
3636
debugOptions?: string[];
3737
env?: Object;
38-
exceptionHandling?: ExceptionHandling
38+
exceptionHandling?: ExceptionHandling;
3939
}
4040

4141
export interface AttachRequestArguments extends DebugProtocol.AttachRequestArguments {

src/client/providers/formatOnSaveProvider.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
'use strict';
1+
"use strict";
22

3-
//Solution for auto-formatting borrowed from the "go" language VSCode extension.
3+
// Solution for auto-formatting borrowed from the "go" language VSCode extension.
44

5-
import * as vscode from 'vscode';
6-
import {BaseFormatter} from './../formatters/baseFormatter';
7-
import {YapfFormatter} from './../formatters/yapfFormatter';
8-
import {AutoPep8Formatter} from './../formatters/autoPep8Formatter';
9-
import * as settings from './../common/configSettings';
5+
import * as vscode from "vscode";
6+
import {BaseFormatter} from "./../formatters/baseFormatter";
7+
import {YapfFormatter} from "./../formatters/yapfFormatter";
8+
import {AutoPep8Formatter} from "./../formatters/autoPep8Formatter";
9+
import * as settings from "./../common/configSettings";
1010

1111
export function activateFormatOnSaveProvider(languageFilter: vscode.DocumentFilter, context: vscode.ExtensionContext, settings: settings.IPythonSettings, outputChannel: vscode.OutputChannel) {
1212
let rootDir = context.asAbsolutePath(".");
1313
let formatters = new Map<string, BaseFormatter>();
1414
let pythonSettings = settings;
1515

16-
var yapfFormatter = new YapfFormatter(outputChannel);
17-
var autoPep8 = new AutoPep8Formatter(outputChannel);
16+
let yapfFormatter = new YapfFormatter(outputChannel);
17+
let autoPep8 = new AutoPep8Formatter(outputChannel);
1818

1919
formatters.set(yapfFormatter.Id, yapfFormatter);
2020
formatters.set(autoPep8.Id, autoPep8);
@@ -24,13 +24,13 @@ export function activateFormatOnSaveProvider(languageFilter: vscode.DocumentFilt
2424
// the file is written to disk.
2525
let ignoreNextSave = new WeakSet<vscode.TextDocument>();
2626

27-
var subscription = vscode.workspace.onDidSaveTextDocument(document => {
27+
let subscription = vscode.workspace.onDidSaveTextDocument(document => {
2828
if (document.languageId !== languageFilter.language || ignoreNextSave.has(document)) {
2929
return;
3030
}
3131
let textEditor = vscode.window.activeTextEditor;
3232
if (pythonSettings.formatting.formatOnSave && textEditor.document === document) {
33-
var formatter = formatters.get(pythonSettings.formatting.provider);
33+
let formatter = formatters.get(pythonSettings.formatting.provider);
3434
formatter.formatDocument(document, null, null).then(edits => {
3535
return textEditor.edit(editBuilder => {
3636
edits.forEach(edit => editBuilder.replace(edit.range, edit.newText));

tslint.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"rules": {
3+
"class-name": true,
4+
"comment-format": [
5+
true,
6+
"check-space"
7+
],
8+
"indent": [
9+
true,
10+
"spaces"
11+
],
12+
"no-duplicate-variable": true,
13+
"no-eval": true,
14+
"no-internal-module": true,
15+
"no-trailing-whitespace": true,
16+
"no-var-keyword": true,
17+
"one-line": [
18+
true,
19+
"check-open-brace",
20+
"check-whitespace"
21+
],
22+
"quotemark": [
23+
true,
24+
"double"
25+
],
26+
"semicolon": [
27+
true,
28+
"always"
29+
],
30+
"triple-equals": [
31+
true,
32+
"allow-null-check"
33+
],
34+
"typedef-whitespace": [
35+
true,
36+
{
37+
"call-signature": "nospace",
38+
"index-signature": "nospace",
39+
"parameter": "nospace",
40+
"property-declaration": "nospace",
41+
"variable-declaration": "nospace"
42+
}
43+
],
44+
"variable-name": [
45+
true,
46+
"ban-keywords"
47+
],
48+
"whitespace": [
49+
true,
50+
"check-branch",
51+
"check-decl",
52+
"check-operator",
53+
"check-separator",
54+
"check-type"
55+
]
56+
}
57+
}

0 commit comments

Comments
 (0)