fix tslint in hygiene

fixes #38207
This commit is contained in:
Joao Moreno 2017-11-13 11:32:38 +01:00
parent 08d0aa5949
commit 7a01db1b43
10 changed files with 58 additions and 89 deletions

View file

@ -229,9 +229,9 @@ const hygiene = exports.hygiene = (some, options) => {
linter.lint(file.relative, contents, configuration.results);
const result = linter.getResult();
if (result.failureCount > 0) {
if (result.failures.length > 0) {
reportFailures(result.failures);
errorCount += result.failureCount;
errorCount += result.failures.length;
}
this.emit('data', file);
@ -261,7 +261,7 @@ const hygiene = exports.hygiene = (some, options) => {
return es.merge(typescript, javascript)
.pipe(es.through(function (data) {
count++;
if (count % 10 === 0) {
if (process.env['TRAVIS'] && count % 10 === 0) {
process.stdout.write('.');
}
this.emit('data', data);

View file

@ -55,28 +55,28 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
}
}
for (var name in phpGlobals.globalvariables) {
if (phpGlobals.globalvariables.hasOwnProperty(name) && matches(name)) {
added[name] = true;
result.push(createNewProposal(CompletionItemKind.Variable, name, phpGlobals.globalvariables[name]));
for (var globalvariables in phpGlobals.globalvariables) {
if (phpGlobals.globalvariables.hasOwnProperty(globalvariables) && matches(globalvariables)) {
added[globalvariables] = true;
result.push(createNewProposal(CompletionItemKind.Variable, globalvariables, phpGlobals.globalvariables[globalvariables]));
}
}
for (var name in phpGlobals.globalfunctions) {
if (phpGlobals.globalfunctions.hasOwnProperty(name) && matches(name)) {
added[name] = true;
result.push(createNewProposal(CompletionItemKind.Function, name, phpGlobals.globalfunctions[name]));
for (var globalfunctions in phpGlobals.globalfunctions) {
if (phpGlobals.globalfunctions.hasOwnProperty(globalfunctions) && matches(globalfunctions)) {
added[globalfunctions] = true;
result.push(createNewProposal(CompletionItemKind.Function, globalfunctions, phpGlobals.globalfunctions[globalfunctions]));
}
}
for (var name in phpGlobals.compiletimeconstants) {
if (phpGlobals.compiletimeconstants.hasOwnProperty(name) && matches(name)) {
added[name] = true;
result.push(createNewProposal(CompletionItemKind.Field, name, phpGlobals.compiletimeconstants[name]));
for (var compiletimeconstants in phpGlobals.compiletimeconstants) {
if (phpGlobals.compiletimeconstants.hasOwnProperty(compiletimeconstants) && matches(compiletimeconstants)) {
added[compiletimeconstants] = true;
result.push(createNewProposal(CompletionItemKind.Field, compiletimeconstants, phpGlobals.compiletimeconstants[compiletimeconstants]));
}
}
for (var name in phpGlobals.keywords) {
if (phpGlobals.keywords.hasOwnProperty(name) && matches(name)) {
added[name] = true;
result.push(createNewProposal(CompletionItemKind.Keyword, name, phpGlobals.keywords[name]));
for (var keywords in phpGlobals.keywords) {
if (phpGlobals.keywords.hasOwnProperty(keywords) && matches(keywords)) {
added[keywords] = true;
result.push(createNewProposal(CompletionItemKind.Keyword, keywords, phpGlobals.keywords[keywords]));
}
}
@ -93,12 +93,12 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
}
}
var functionMatch = /function\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\(/g;
var match: RegExpExecArray | null = null;
while (match = functionMatch.exec(text)) {
var word = match[1];
if (!added[word]) {
added[word] = true;
result.push(createNewProposal(CompletionItemKind.Function, word, null));
var match2: RegExpExecArray | null = null;
while (match2 = functionMatch.exec(text)) {
var word2 = match2[1];
if (!added[word2]) {
added[word2] = true;
result.push(createNewProposal(CompletionItemKind.Function, word2, null));
}
}
return Promise.resolve(result);

View file

@ -1114,7 +1114,7 @@ export class TreeModel extends Events.EventEmitter {
previousItem: Item = null;
if (selection.length === 0) {
var nav = this.getNavigator(this.input);
let nav = this.getNavigator(this.input);
while (item = nav.next()) {
previousItem = item;
@ -1124,7 +1124,7 @@ export class TreeModel extends Events.EventEmitter {
} else {
item = selection[0];
var nav = this.getNavigator(item, false);
let nav = this.getNavigator(item, false);
for (var i = 0; i < count; i++) {
previousItem = nav.previous();
@ -1357,7 +1357,7 @@ export class TreeModel extends Events.EventEmitter {
var items: { [id: string]: Item; } = {};
var item: Item;
for (var i = 0, len = elements.length; i < len; i++) {
for (let i = 0, len = elements.length; i < len; i++) {
item = this.getItem(elements[i]);
if (item) {
@ -1379,7 +1379,7 @@ export class TreeModel extends Events.EventEmitter {
}
}
for (var i = 0, len = itemsToRemoveTrait.length; i < len; i++) {
for (let i = 0, len = itemsToRemoveTrait.length; i < len; i++) {
item = itemsToRemoveTrait[i];
item.removeTrait(trait);
delete traitItems[item.id];

View file

@ -30,7 +30,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
if (this._ranges.length > 0) {
// Collect all edit operations
var ops: IEditOperation[] = [];
for (var i = 0; i < this._ranges.length; i++) {
for (let i = 0; i < this._ranges.length; i++) {
ops.push({
range: this._ranges[i],
text: this._replaceStrings[i]
@ -45,7 +45,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
// Merge operations that touch each other
var resultOps: IEditOperation[] = [];
var previousOp = ops[0];
for (var i = 1; i < ops.length; i++) {
for (let i = 1; i < ops.length; i++) {
if (previousOp.range.endLineNumber === ops[i].range.startLineNumber && previousOp.range.endColumn === ops[i].range.startColumn) {
// These operations are one after another and can be merged
previousOp.range = previousOp.range.plusRange(ops[i].range);

View file

@ -155,7 +155,7 @@ function createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: str
// special case a regexp that matches just words
if ((op === '~' || op === '!~') && /^(\w|\|)*$/.test(pat)) {
var inWords = objects.createKeywordMatcher(pat.split('|'), lexer.ignoreCase);
let inWords = objects.createKeywordMatcher(pat.split('|'), lexer.ignoreCase);
tester = function (s) { return (op === '~' ? inWords(s) : !inWords(s)); };
}
else if (op === '@' || op === '!@') {
@ -166,7 +166,7 @@ function createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: str
if (!(isArrayOf(function (elem) { return (typeof (elem) === 'string'); }, words))) {
monarchCommon.throwError(lexer, 'the @ match target \'' + pat + '\' must be an array of strings, in rule: ' + ruleName);
}
var inWords = objects.createKeywordMatcher(words, lexer.ignoreCase);
let inWords = objects.createKeywordMatcher(words, lexer.ignoreCase);
tester = function (s) { return (op === '@' ? inWords(s) : !inWords(s)); };
}
else if (op === '~' || op === '!~') {
@ -188,7 +188,7 @@ function createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: str
tester = function (s) { return (op === '==' ? s === patx : s !== patx); };
}
else {
var patx = monarchCommon.fixCase(lexer, pat);
let patx = monarchCommon.fixCase(lexer, pat);
tester = function (s, id, matches, state, eos) {
var patexp = monarchCommon.substituteMatches(lexer, patx, id, matches, state);
return (op === '==' ? s === patexp : s !== patexp);

View file

@ -32,22 +32,22 @@ suite('Editor ViewModel - SplitLinesCollection', () => {
assert.equal(line1.getViewLineMaxColumn(model1, 1, 0), 14);
assert.equal(line1.getViewLineMaxColumn(model1, 1, 1), 15);
assert.equal(line1.getViewLineMaxColumn(model1, 1, 2), 16);
for (var col = 1; col <= 14; col++) {
for (let col = 1; col <= 14; col++) {
assert.equal(line1.getModelColumnOfViewPosition(0, col), col, 'getInputColumnOfOutputPosition(0, ' + col + ')');
}
for (var col = 1; col <= 15; col++) {
for (let col = 1; col <= 15; col++) {
assert.equal(line1.getModelColumnOfViewPosition(1, col), 13 + col, 'getInputColumnOfOutputPosition(1, ' + col + ')');
}
for (var col = 1; col <= 16; col++) {
for (let col = 1; col <= 16; col++) {
assert.equal(line1.getModelColumnOfViewPosition(2, col), 13 + 14 + col, 'getInputColumnOfOutputPosition(2, ' + col + ')');
}
for (var col = 1; col <= 13; col++) {
for (let col = 1; col <= 13; col++) {
assert.deepEqual(line1.getViewPositionOfModelPosition(0, col), pos(0, col), 'getOutputPositionOfInputPosition(' + col + ')');
}
for (var col = 1 + 13; col <= 14 + 13; col++) {
for (let col = 1 + 13; col <= 14 + 13; col++) {
assert.deepEqual(line1.getViewPositionOfModelPosition(0, col), pos(1, col - 13), 'getOutputPositionOfInputPosition(' + col + ')');
}
for (var col = 1 + 13 + 14; col <= 15 + 14 + 13; col++) {
for (let col = 1 + 13 + 14; col <= 15 + 14 + 13; col++) {
assert.deepEqual(line1.getViewPositionOfModelPosition(0, col), pos(2, col - 13 - 14), 'getOutputPositionOfInputPosition(' + col + ')');
}
@ -61,28 +61,28 @@ suite('Editor ViewModel - SplitLinesCollection', () => {
assert.equal(line1.getViewLineMaxColumn(model1, 1, 0), 14);
assert.equal(line1.getViewLineMaxColumn(model1, 1, 1), 16);
assert.equal(line1.getViewLineMaxColumn(model1, 1, 2), 17);
for (var col = 1; col <= 14; col++) {
for (let col = 1; col <= 14; col++) {
assert.equal(line1.getModelColumnOfViewPosition(0, col), col, 'getInputColumnOfOutputPosition(0, ' + col + ')');
}
for (var col = 1; col <= 1; col++) {
for (let col = 1; col <= 1; col++) {
assert.equal(line1.getModelColumnOfViewPosition(1, 1), 13 + col, 'getInputColumnOfOutputPosition(1, ' + col + ')');
}
for (var col = 2; col <= 16; col++) {
for (let col = 2; col <= 16; col++) {
assert.equal(line1.getModelColumnOfViewPosition(1, col), 13 + col - 1, 'getInputColumnOfOutputPosition(1, ' + col + ')');
}
for (var col = 1; col <= 1; col++) {
for (let col = 1; col <= 1; col++) {
assert.equal(line1.getModelColumnOfViewPosition(2, col), 13 + 14 + col, 'getInputColumnOfOutputPosition(2, ' + col + ')');
}
for (var col = 2; col <= 17; col++) {
for (let col = 2; col <= 17; col++) {
assert.equal(line1.getModelColumnOfViewPosition(2, col), 13 + 14 + col - 1, 'getInputColumnOfOutputPosition(2, ' + col + ')');
}
for (var col = 1; col <= 13; col++) {
for (let col = 1; col <= 13; col++) {
assert.deepEqual(line1.getViewPositionOfModelPosition(0, col), pos(0, col), 'getOutputPositionOfInputPosition(' + col + ')');
}
for (var col = 1 + 13; col <= 14 + 13; col++) {
for (let col = 1 + 13; col <= 14 + 13; col++) {
assert.deepEqual(line1.getViewPositionOfModelPosition(0, col), pos(1, 1 + col - 13), 'getOutputPositionOfInputPosition(' + col + ')');
}
for (var col = 1 + 13 + 14; col <= 15 + 14 + 13; col++) {
for (let col = 1 + 13 + 14; col <= 15 + 14 + 13; col++) {
assert.deepEqual(line1.getViewPositionOfModelPosition(0, col), pos(2, 1 + col - 13 - 14), 'getOutputPositionOfInputPosition(' + col + ')');
}
});

View file

@ -74,13 +74,13 @@ suite('AIAdapter', () => {
test('property limits', () => {
var reallyLongPropertyName = 'abcdefghijklmnopqrstuvwxyz';
for (var i = 0; i < 6; i++) {
for (let i = 0; i < 6; i++) {
reallyLongPropertyName += 'abcdefghijklmnopqrstuvwxyz';
}
assert(reallyLongPropertyName.length > 150);
var reallyLongPropertyValue = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123';
for (var i = 0; i < 21; i++) {
for (let i = 0; i < 21; i++) {
reallyLongPropertyValue += 'abcdefghijklmnopqrstuvwxyz012345678901234567890123';
}
assert(reallyLongPropertyValue.length > 1024);

View file

@ -60,11 +60,7 @@ function registerActiveEditorMoveCommand(): void {
args: [
{
name: nls.localize('editorCommand.activeEditorMove.arg.name', "Active editor move argument"),
description: nls.localize('editorCommand.activeEditorMove.arg.description', `Argument Properties:
* 'to': String value providing where to move.
* 'by': String value providing the unit for move. By tab or by group.
* 'value': Number value providing how many positions or an absolute position to move.
`),
description: nls.localize('editorCommand.activeEditorMove.arg.description', "Argument Properties:\n\t* 'to': String value providing where to move.\n\t* 'by': String value providing the unit for move. By tab or by group.\n\t* 'value': Number value providing how many positions or an absolute position to move."),
constraint: isActiveEditorMoveArg
}
]

View file

@ -148,11 +148,7 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
],
'default': 'default',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'tabDescription' },
`Controls the format of the label for an editor. Changing this setting can for example make it easier to understand the location of a file:
- short: 'parent'
- medium: 'workspace/src/parent'
- long: '/home/user/workspace/src/parent'
- default: '.../parent', when another tab shares the same title, or the relative workspace path if tabs are disabled`),
"Controls the format of the label for an editor. Changing this setting can for example make it easier to understand the location of a file:\n- short: 'parent'\n- medium: 'workspace/src/parent'\n- long: '/home/user/workspace/src/parent'\n- default: '.../parent', when another tab shares the same title, or the relative workspace path if tabs are disabled"),
},
'workbench.editor.tabCloseButton': {
'type': 'string',
@ -267,11 +263,7 @@ if (isMacintosh) {
'enum': ['default', 'antialiased', 'none'],
'default': 'default',
'description':
nls.localize('fontAliasing',
`Controls font aliasing method in the workbench.
- default: Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text
- antialiased: Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall
- none: Disables font smoothing. Text will show with jagged sharp edges`),
nls.localize('fontAliasing', "Controls font aliasing method in the workbench.\n- default: Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text\n- antialiased: Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall\n- none: Disables font smoothing. Text will show with jagged sharp edges"),
'enumDescriptions': [
nls.localize('workbench.fontAliasing.default', "Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text."),
nls.localize('workbench.fontAliasing.antialiased', "Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall."),
@ -308,13 +300,7 @@ let properties: { [path: string]: IJSONSchema; } = {
],
'default': 'off',
'description':
nls.localize('openFilesInNewWindow',
`Controls if files should open in a new window.
- default: files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)
- on: files will open in a new window
- off: files will open in the window with the files' folder open or the last active window
Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).`
)
nls.localize('openFilesInNewWindow', "Controls if files should open in a new window.\n- default: files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)\n- on: files will open in a new window\n- off: files will open in the window with the files' folder open or the last active window\nNote that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).")
},
'window.openFoldersInNewWindow': {
'type': 'string',
@ -325,12 +311,7 @@ Note that there can still be cases where this setting is ignored (e.g. when usin
nls.localize('window.openFoldersInNewWindow.default', "Folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)")
],
'default': 'default',
'description': nls.localize('openFoldersInNewWindow',
`Controls if folders should open in a new window or replace the last active window.
- default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)
- on: folders will open in a new window
- off: folders will replace the last active window
Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).`
'description': nls.localize('openFoldersInNewWindow', "Controls if folders should open in a new window or replace the last active window.\n- default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)\n- on: folders will open in a new window\n- off: folders will replace the last active window\nNote that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option)."
)
},
'window.restoreWindows': {
@ -359,17 +340,7 @@ Note that there can still be cases where this setting is ignored (e.g. when usin
'type': 'string',
'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
`Controls the window title based on the active editor. Variables are substituted based on the context:
\${activeEditorShort}: the file name (e.g. myFile.txt)
\${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt)
\${activeEditorLong}: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt)
\${folderName}: name of the workspace folder the file is contained in (e.g. myFolder)
\${folderPath}: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)
\${rootName}: name of the workspace (e.g. myFolder or myWorkspace)
\${rootPath}: file path of the workspace (e.g. /Users/Development/myWorkspace)
\${appName}: e.g. VS Code
\${dirty}: a dirty indicator if the active editor is dirty
\${separator}: a conditional separator (" - ") that only shows when surrounded by variables with values`)
"Controls the window title based on the active editor. Variables are substituted based on the context:\n\${activeEditorShort}: the file name (e.g. myFile.txt)\n\${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt)\n\${activeEditorLong}: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt)\n\${folderName}: name of the workspace folder the file is contained in (e.g. myFolder)\n\${folderPath}: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)\n\${rootName}: name of the workspace (e.g. myFolder or myWorkspace)\n\${rootPath}: file path of the workspace (e.g. /Users/Development/myWorkspace)\n\${appName}: e.g. VS Code\n\${dirty}: a dirty indicator if the active editor is dirty\n\${separator}: a conditional separator (\" - \") that only shows when surrounded by variables with values")
},
'window.newWindowDimensions': {
'type': 'string',

View file

@ -51,6 +51,7 @@ suite('MainThreadDocumentsAndEditors', () => {
onEditorGroupMoved = Event.None;
};
/* tslint:disable */
new MainThreadDocumentsAndEditors(
OneGetThreadService(new class extends mock<ExtHostDocumentsAndEditorsShape>() {
$acceptDocumentsAndEditorsDelta(delta) { deltas.push(delta); }
@ -66,6 +67,7 @@ suite('MainThreadDocumentsAndEditors', () => {
editorGroupService,
null
);
/* tslint:enable */
});