Skip to content

Commit

Permalink
Tweaked some of the tslint rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Dec 11, 2018
1 parent 0b96ac0 commit 3ea386f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/DefinitionRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class DefinitionRepository {
let result = yield* this.findDefinitionForWord(document, position, word);
return result;
}
// duplicating some of thisactivate.olympicchanel.com to reduce the risk of introducing nasty performance issues/unwanted behaviour by extending Location
// duplicating some of thisactivate.olympicchanel.com to reduce the risk of introducing nasty performance issues/unwanted behaviour by extending Location
public * findDefinitionForWord(document: TextDocument, position: Position, word: string): IterableIterator<BrightScriptDeclaration> {

this.sync();
Expand Down
13 changes: 7 additions & 6 deletions src/XmlUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { CancellationToken,
import {
CancellationToken,
Position,
Range,
TextDocument
} from 'vscode';

export enum XmlWordType {
Illegal= -1,
Illegal = -1,
Tag = 0,
AttributeValue = 1,
Attribute = 2,
Expand Down Expand Up @@ -36,7 +37,7 @@ export class XmlUtils {
return this.getTextWithOffsets(document, position);
break;
case XmlWordType.AttributeValue:
return this.getTextWithOffsets(document, position, /[^\s\"]+/);
return this.getTextWithOffsets(document, position, /[^\s\"]+/);
break;
}
}
Expand All @@ -51,7 +52,7 @@ export class XmlUtils {

// Check if the cursor is about complete the value of an attribute.
private isAttributeValue(document: TextDocument, position: Position): boolean {
let wordRange = document.getWordRangeAtPosition(position, /[^\s\"\']+/);
let wordRange = document.getWordRangeAtPosition(position, /[^\s\"\']+/);
let wordStart = wordRange ? wordRange.start : position;
let wordEnd = wordRange ? wordRange.end : position;
if (wordStart.character === 0 || wordEnd.character > document.lineAt(wordEnd.line).text.length - 1) {
Expand Down Expand Up @@ -84,10 +85,10 @@ export class XmlUtils {
}

private getTextWithOffsets(document: TextDocument, position: Position, wordRegex?) {
let wordRange = document.getWordRangeAtPosition(position, wordRegex);
let wordRange = document.getWordRangeAtPosition(position, wordRegex);
let wordStart = wordRange ? wordRange.start : position;
return document.getText(
new Range(new Position(wordStart.line, wordStart.character),
new Position(wordRange.end.line, wordRange.end.character)));
new Position(wordRange.end.line, wordRange.end.character)));
}
}
4 changes: 2 additions & 2 deletions src/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Module.prototype.require = function hijacked(file) {
if (file === 'vscode') {
return vscode;
} else if (file === './BrightScriptCommands') {
let command = { registerCommands: () => {} };
let command = { registerCommands: () => { } };
commandsMock = sinon.mock(command);
return { getBrightScriptCommandsInstance : () => command };
return { getBrightScriptCommandsInstance: () => command };
} else {
return oldRequire.apply(this, arguments);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mockVscode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export let vscode = {
show: () => { }
};
},
activeTextEditor : {
document : undefined
activeTextEditor: {
document: undefined
}
},
CompletionItemKind: {
Expand Down
4 changes: 4 additions & 0 deletions src/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"no-duplicate-variable": true,
"no-empty": false,
"no-shadowed-variable": false,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-curly-spacing": true,
Expand All @@ -77,13 +78,16 @@
true,
"always"
],
"ter-arrow-spacing": true,
"ter-indent": [
true,
4,
{
"SwitchCase": 1
}
],
"ter-no-irregular-whitespace": true,
"ter-no-mixed-spaces-and-tabs": true,
"trailing-comma": [
true,
"never"
Expand Down

0 comments on commit 3ea386f

Please sign in to comment.