From 9a9d2abc1fb954a8de9c07d80042d857c444446a Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 27 Feb 2019 15:34:22 -0800 Subject: [PATCH 1/3] Fix bad this references in tests --- .../angular-ui-router-tests.ts | 2 +- .../chocolatechipjs/chocolatechipjs-tests.ts | 2 +- types/datatables.net/datatables.net-tests.ts | 4 +- types/expectations/expectations-tests.ts | 4 +- types/expectations/tsconfig.json | 5 +- types/expo-localization/index.d.ts | 2 +- types/gijgo/gijgo-tests.ts | 6 +- types/httperr/httperr-tests.ts | 2 +- types/jasmine-ajax/jasmine-ajax-tests.ts | 2 +- types/klaw/v1/klaw-tests.ts | 2 +- types/knex/knex-tests.ts | 160 +++++++++--------- types/koa-mount/koa-mount-tests.ts | 4 +- types/nock/nock-tests.ts | 2 +- types/phantom/phantom-tests.ts | 2 +- types/ramda/ramda-tests.ts | 4 +- types/rivets/rivets-tests.ts | 2 +- types/rx-angular/rx-angular-tests.ts | 2 +- types/sequelize/sequelize-tests.ts | 2 +- types/sequelize/v3/sequelize-tests.ts | 2 +- types/simplesmtp/simplesmtp-tests.ts | 6 +- types/ssh2/ssh2-tests.ts | 4 +- types/stampit/stampit-tests.ts | 4 +- types/stampit/v2/stampit-tests.ts | 2 +- types/three/test/examples/effects/vreffect.ts | 2 +- types/vinyl-fs/v0/vinyl-fs-tests.ts | 2 +- types/vinyl-fs/v1/vinyl-fs-tests.ts | 2 +- types/waterline/waterline-tests.ts | 4 +- types/webmidi/webmidi-tests.ts | 2 +- 28 files changed, 120 insertions(+), 119 deletions(-) diff --git a/types/angular-ui-router/angular-ui-router-tests.ts b/types/angular-ui-router/angular-ui-router-tests.ts index 889e92bfc9..d7dfcbfbde 100644 --- a/types/angular-ui-router/angular-ui-router-tests.ts +++ b/types/angular-ui-router/angular-ui-router-tests.ts @@ -33,7 +33,7 @@ myApp.config(( $urlMatcherFactory.type("fullType", { decode: (val) => parseInt(val, 10), encode: (val) => val && val.toString(), - equals: (a, b) => this.is(a) && a === b, + equals: function (a, b) { return this.is(a) && a === b }, is: (val) => angular.isNumber(val) && isFinite(val) && val % 1 === 0, pattern: /\d+/ }); diff --git a/types/chocolatechipjs/chocolatechipjs-tests.ts b/types/chocolatechipjs/chocolatechipjs-tests.ts index a723d1b8f9..e470eb1d80 100644 --- a/types/chocolatechipjs/chocolatechipjs-tests.ts +++ b/types/chocolatechipjs/chocolatechipjs-tests.ts @@ -213,7 +213,7 @@ $('ul').undelegate('click', 'li', () => { $('li').on('click', () => { $.noop; }); -$('ul').on('click', 'li', () => { +$('ul').on('click', 'li', function () { console.log($(this).text()); }); $('li').off('click'); diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index de739a673a..8ee4611681 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -578,7 +578,7 @@ $('#example tbody').on('click', 'td', () => { const cell_invalidate_1 = cell.invalidate(); const cell_invalidate_2 = cell.invalidate("data"); -$('#example tbody').on('click', 'td', () => { +$('#example tbody').on('click', 'td', function () { this.innerHTML = (parseInt(this.innerHTML, 10) + 1).toString(); dt.cell(this).invalidate().draw(); }); @@ -773,7 +773,7 @@ let column_search_set = column.search("string"); column_search_set = column.search("string", true); column_search_set = column.search("string", true, false); column_search_set = column.search("string", true, false, true); -$('#column3_search').on('keyup', () => { +$('#column3_search').on('keyup', function () { dt .columns(3) .search((this as HTMLInputElement).value) diff --git a/types/expectations/expectations-tests.ts b/types/expectations/expectations-tests.ts index 4e994e7546..8f8bd25985 100644 --- a/types/expectations/expectations-tests.ts +++ b/types/expectations/expectations-tests.ts @@ -1,6 +1,6 @@ // transplant from https://github.com/spmason/expectations/blob/695c25bd35bb1751533a8082a5aa378e3e1b381f/test/expect.tests.js -var root = this; +var root = window; // Stub mocha functions const {describe, it, before, after, beforeEach, afterEach} = null as any as { @@ -451,7 +451,7 @@ describe('expect', ()=> { describe('extensibility', ()=> { it('allows you to add your own assertions', ()=> { - expect.addAssertion('toBeFoo', ()=> { + expect.addAssertion('toBeFoo', function () { if (this.value === 'foo') { return this.pass(); } diff --git a/types/expectations/tsconfig.json b/types/expectations/tsconfig.json index 857a8a1eef..ea4017a1a3 100644 --- a/types/expectations/tsconfig.json +++ b/types/expectations/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": false, @@ -20,4 +21,4 @@ "index.d.ts", "expectations-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/expo-localization/index.d.ts b/types/expo-localization/index.d.ts index 21c6ca8756..b79c777319 100644 --- a/types/expo-localization/index.d.ts +++ b/types/expo-localization/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for expo-localization 1.0 -// Project: https://docs.expo.io/ +// Project: https://docs.expo.io/versions/latest/sdk/localization // Definitions by: Bartosz Dotryw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/gijgo/gijgo-tests.ts b/types/gijgo/gijgo-tests.ts index 6e624ad4f6..b1622057cf 100644 --- a/types/gijgo/gijgo-tests.ts +++ b/types/gijgo/gijgo-tests.ts @@ -2,7 +2,7 @@ // Grid $(() => { - this.grid = $('#grid').grid({ + (this as any).grid = $('#grid').grid({ primaryKey: 'ID', columns: [ { field: 'ID', width: 50, sortable: true }, @@ -14,9 +14,9 @@ $(() => { // Dialog $(() => { - this.dialog = $('#playerModal').dialog({ + (this as any).dialog = $('#playerModal').dialog({ autoOpen: false, title: 'Player', width: 400 }); -}); \ No newline at end of file +}); diff --git a/types/httperr/httperr-tests.ts b/types/httperr/httperr-tests.ts index ee1f6d8567..db58b1a487 100644 --- a/types/httperr/httperr-tests.ts +++ b/types/httperr/httperr-tests.ts @@ -52,7 +52,7 @@ console.log(err instanceof Error); // true // ---------------------------------------- // Advanced usage: creating custom Error subclasses -var Custom404Error = httperr.createHttpError(404, 'Not Found', config => { +var Custom404Error = httperr.createHttpError(404, 'Not Found', function (config) { this.message = 'The resource was not found'; this['some custom property'] = config.parameters['some custom parameter']; }); diff --git a/types/jasmine-ajax/jasmine-ajax-tests.ts b/types/jasmine-ajax/jasmine-ajax-tests.ts index da68ad92a0..716d8b38d5 100644 --- a/types/jasmine-ajax/jasmine-ajax-tests.ts +++ b/types/jasmine-ajax/jasmine-ajax-tests.ts @@ -772,7 +772,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { error = jasmine.createSpy("onFailure"); complete = jasmine.createSpy("onComplete"); - onreadystatechange = () => { + onreadystatechange = function () { if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE if (this.status === 200) { success(this.responseText, this.textStatus, this); diff --git a/types/klaw/v1/klaw-tests.ts b/types/klaw/v1/klaw-tests.ts index 7bfd79ee50..9170aff165 100644 --- a/types/klaw/v1/klaw-tests.ts +++ b/types/klaw/v1/klaw-tests.ts @@ -16,7 +16,7 @@ klaw('/some/dir') // README.md: Streams 2 & 3 (pull) with error handling klaw('/some/dir') - .on('readable', () => { + .on('readable', function () { while (true) { const item = this.read(); if (!item) break; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index ac0000ad9a..2fc751d8ac 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -173,7 +173,7 @@ knex.select('title', 'author', 'year').from('books'); knex.select({ name: 'title', writer: 'author' }).from(knex.raw('books')); knex.select().table('books'); -knex.avg('sum_column1').from(() => { +knex.avg('sum_column1').from(function () { this.sum('column1 as sum_column1').from('t1').groupBy('column1').as('t1'); }).as('ignored_alias'); @@ -190,7 +190,7 @@ knex('users').where({ knex('users').where('id', 1); -knex('users').where(() => { +knex('users').where(function () { this.where('id', 1).orWhere('id', '>', 10); }).orWhere({name: 'Tester'}); @@ -218,7 +218,7 @@ knex.select('name').from('users') knex('users') .where('name', '=', 'John') - .orWhere(() => { + .orWhere(function () { this.where('votes', '>', 100).andWhere('title', '<>', 'Admin'); }); @@ -230,13 +230,13 @@ knex('users').whereNull('updated_at'); knex('users').whereNotNull('created_at'); -knex('users').whereExists(() => { +knex('users').whereExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); knex('users').whereExists(knex.select('*').from('accounts').whereRaw('users.account_id = accounts.id')); -knex('users').whereNotExists(() => { +knex('users').whereNotExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); @@ -321,15 +321,15 @@ knex('users') .join(knex('contacts').select('user_id', 'phone').as('contacts'), { 'users.id': 'contacts.user_id' }) .select('users.id', 'contacts.phone'); -knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), () => { +knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); -knex.select('*').from('users').join('accounts', () => { +knex.select('*').from('users').join('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); -knex.select('*').from('users').join('accounts', (join: Knex.JoinClause) => { +knex.select('*').from('users').join('accounts', function (join: Knex.JoinClause) { if (this !== join) { throw new Error("join() callback call semantics wrong"); } @@ -337,120 +337,120 @@ knex.select('*').from('users').join('accounts', (join: Knex.JoinClause) => { join.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); -knex.select('*').from('user').join('contacts', () => { +knex.select('*').from('user').join('contacts', function () { this.on('users.id', '=', knex.raw(7)); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').onIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').andOnIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').orOnIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').onNotIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').andOnNotIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').orOnNotIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').onNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').andOnNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').orOnNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').onNotNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').andOnNotNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').orOnNotNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').onExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').onExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').andOnExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').andOnExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').orOnExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').orOnExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').onNotExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').onNotExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').andOnNotExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').andOnNotExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').orOnNotExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').orOnNotExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').onBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').andOnBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').orOnBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').onNotBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').andOnNotBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', () => { +knex.select('*').from('users').join('contacts', function () { this.on('users.id', '=', 'contacts.id').orOnNotBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', () => { - this.on('users.id', '=', 'contacts.id').onNotExists(() => { +knex.select('*').from('users').join('contacts', function () { + this.on('users.id', '=', 'contacts.id').onNotExists(function () { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); @@ -475,7 +475,7 @@ knex.from('users').innerJoin('accounts', 'users.id', 'accounts.user_id'); knex.table('users').innerJoin('accounts', 'users.id', '=', 'accounts.user_id'); -knex('users').innerJoin('accounts', () => { +knex('users').innerJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -485,7 +485,7 @@ knex('users').innerJoin('accounts', (join: Knex.JoinClause) => { knex.select('*').from('users').leftJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').leftJoin('accounts', () => { +knex.select('*').from('users').leftJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -502,13 +502,13 @@ knex.select('*').from('users').leftJoin('accounts', (join) => { knex.select('*').from('users').leftOuterJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').leftOuterJoin('accounts', () => { +knex.select('*').from('users').leftOuterJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); knex.select('*').from('users').rightJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').rightJoin('accounts', () => { +knex.select('*').from('users').rightJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -518,13 +518,13 @@ knex.select('*').from('users').rightJoin('accounts', (join: Knex.JoinClause) => knex.select('*').from('users').rightOuterJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').rightOuterJoin('accounts', () => { +knex.select('*').from('users').rightOuterJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); knex.select('*').from('users').outerJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').outerJoin('accounts', () => { +knex.select('*').from('users').outerJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -534,7 +534,7 @@ knex.select('*').from('users').outerJoin('accounts', (join: Knex.JoinClause) => knex.select('*').from('users').fullOuterJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').fullOuterJoin('accounts', () => { +knex.select('*').from('users').fullOuterJoin('accounts', function () { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -549,39 +549,39 @@ knex.select('*').from('accounts').joinRaw('natural full join table1').where('id' knex.select('*').from('accounts').join(knex.raw('natural full join table1')).where('id', 1); knex.select('*').from('accounts') - .join(() => { + .join(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .leftJoin(() => { + .leftJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .leftOuterJoin(() => { + .leftOuterJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .rightJoin(() => { + .rightJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .rightOuterJoin(() => { + .rightOuterJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .innerJoin(() => { + .innerJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .crossJoin(() => { + .crossJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .fullOuterJoin(() => { + .fullOuterJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .outerJoin(() => { + .outerJoin(function () { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); @@ -1044,66 +1044,66 @@ knex.select('*').from('users').where(knex.raw('id = ?', [1])).toSQL(); // knex('users') .select('*') - .join('contacts', (builder) => { - this.on((builder: any) => { + .join('contacts', function (builder) { + this.on(function (builder: any) { let self: Knex.JoinClause = this; self = builder; - }).andOn((builder: any) => { + }).andOn(function (builder: any) { let self: Knex.JoinClause = this; self = builder; - }).orOn((builder: any) => { + }).orOn(function (builder: any) { let self: Knex.JoinClause = this; self = builder; - }).onExists((builder: any) => { + }).onExists(function (builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).orOnExists((builder: any) => { + }).orOnExists(function (builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).andOnExists((builder: any) => { + }).andOnExists(function (builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).onNotExists((builder: any) => { + }).onNotExists(function (builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).andOnNotExists((builder: any) => { + }).andOnNotExists(function (builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).orOnNotExists((builder: any) => { + }).orOnNotExists(function (builder: any) { let self: Knex.QueryBuilder = this; self = builder; }); - }).where((builder) => { + }).where(function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).orWhere((builder) => { + }).orWhere(function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).andWhere((builder) => { + }).andWhere(function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).whereIn('column', (builder) => { + }).whereIn('column', function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).orWhereIn('column', (builder) => { + }).orWhereIn('column', function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).whereNotIn('column', (builder) => { + }).whereNotIn('column', function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).orWhereNotIn('column', (builder) => { + }).orWhereNotIn('column', function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).whereWrapped((builder) => { + }).whereWrapped(function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).union((builder) => { + }).union(function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).unionAll((builder) => { + }).unionAll(function (builder) { let self: Knex.QueryBuilder = this; self = builder; - }).modify((builder, aBool) => { + }).modify(function (builder, aBool) { let self: Knex.QueryBuilder = this; self = builder; }, true); @@ -1197,12 +1197,12 @@ knex('characters') knex('characters') .select() - .whereIn('name', () => { + .whereIn('name', function () { this.select('name').from('characters'); }); knex('characters') .select() - .whereIn(['name', 'class'], () => { + .whereIn(['name', 'class'], function () { this.select('name', 'class').from('characters'); }); diff --git a/types/koa-mount/koa-mount-tests.ts b/types/koa-mount/koa-mount-tests.ts index 139e08a3d8..262a4491ca 100644 --- a/types/koa-mount/koa-mount-tests.ts +++ b/types/koa-mount/koa-mount-tests.ts @@ -3,13 +3,13 @@ import mount = require("koa-mount"); const a = new Koa(); -a.use((next) => { +a.use(function (next) { this.body = "Hello"; }); const b = new Koa(); -b.use((next) => { +b.use(function (next) { this.body = "World"; }); diff --git a/types/nock/nock-tests.ts b/types/nock/nock-tests.ts index 06f8458bcb..76f1e0762c 100644 --- a/types/nock/nock-tests.ts +++ b/types/nock/nock-tests.ts @@ -311,7 +311,7 @@ var scope = nock('http://www.google.com') /// Access original request and headers var scope = nock('http://www.google.com') .get('/cat-poems') - .reply((uri, requestBody) => { + .reply(function (uri, requestBody) { console.log('path:', this.req.path); console.log('headers:', this.req.headers); // ... diff --git a/types/phantom/phantom-tests.ts b/types/phantom/phantom-tests.ts index b83ac3cc02..a611f195be 100644 --- a/types/phantom/phantom-tests.ts +++ b/types/phantom/phantom-tests.ts @@ -96,7 +96,7 @@ phantom.create(["--web-security=no", "--ignore-ssl-errors=yes"]).then((ph) => { phantom.create().then((ph) => { return ph.createPage().then((page) => { page.open("http://localhost:9901/cookie").then((status) => { - var someFunc = (aaa: string, my_obj: Object) => { + var someFunc = function (aaa: string, my_obj: Object) { var attribute_to_want = aaa; var h2Arr: string[] = []; var results = document.querySelectorAll(attribute_to_want); diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 9db133c971..d934578049 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2180,7 +2180,7 @@ class Rectangle { this.colors = Array.prototype.slice.call(arguments, 1); } - Circle.prototype.area = () => Math.PI * Math.pow(this.r, 2); + Circle.prototype.area = function () { Math.PI * Math.pow(this.r, 2) }; const circleN = R.constructN(2, Circle); let c1 = circleN(1, "red"); @@ -2623,7 +2623,7 @@ class Rectangle { const Why: any = ((val: boolean) => { const why = {} as any; why.val = val; - why.and = (x: boolean) => this.val && x; + why.and = function (x: boolean) { this.val && x }; return Why; })(true); const why = new Why(true); diff --git a/types/rivets/rivets-tests.ts b/types/rivets/rivets-tests.ts index 81c97e7d9e..938ef639c0 100644 --- a/types/rivets/rivets-tests.ts +++ b/types/rivets/rivets-tests.ts @@ -10,7 +10,7 @@ Rivets.configure({ // Template delimiters for text bindings templateDelimiters: ['[[', ']]'], // Augment the event handler of the on-* binder - handler: (target: any, event: any, binding: any) => { + handler: function (target: any, event: any, binding: any) { this.call(target, event, binding.view.models); } }); diff --git a/types/rx-angular/rx-angular-tests.ts b/types/rx-angular/rx-angular-tests.ts index f2413695af..25d0f1887b 100644 --- a/types/rx-angular/rx-angular-tests.ts +++ b/types/rx-angular/rx-angular-tests.ts @@ -8,7 +8,7 @@ var app = angular.module('testModule'); interface AppScope extends rx.angular.IRxScope { } -app.controller('Ctrl', ($scope: AppScope) => { +app.controller('Ctrl', function ($scope: AppScope) { this.inputObservable = $scope.$toObservable('term') .safeApply($scope, (results: any) => { diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index bc0aa7d51d..3e5fc74142 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1242,7 +1242,7 @@ s.query( '' ); s.query( '' ).then( function( res ) {} ); s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { raw : true, replacements : [1, 2] } ); s.query( '', { raw : true, nest : false } ); -s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } ); +s.query( 'select ? as foo, ? as bar', { type : sequelize.QueryTypes.SELECT, replacements : [1, 2] } ); s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } ); s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } ); s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } ); diff --git a/types/sequelize/v3/sequelize-tests.ts b/types/sequelize/v3/sequelize-tests.ts index ccc0a66c96..158127f420 100644 --- a/types/sequelize/v3/sequelize-tests.ts +++ b/types/sequelize/v3/sequelize-tests.ts @@ -1140,7 +1140,7 @@ s.query( '' ); s.query( '' ).then( function( res ) {} ); s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { raw : true, replacements : [1, 2] } ); s.query( '', { raw : true, nest : false } ); -s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } ); +s.query( 'select ? as foo, ? as bar', { type : sequelize.QueryTypes.SELECT, replacements : [1, 2] } ); s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } ); s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } ); s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } ); diff --git a/types/simplesmtp/simplesmtp-tests.ts b/types/simplesmtp/simplesmtp-tests.ts index c479a9ea1b..edb551d6e3 100644 --- a/types/simplesmtp/simplesmtp-tests.ts +++ b/types/simplesmtp/simplesmtp-tests.ts @@ -10,7 +10,7 @@ server = simplesmtp.createSimpleServer({ name: "localhost", secureConnection: false, SMTPBanner: "Hoi dit is de test server", - timeout: this.timeout, + timeout: (this as any).timeout, ignoreTLS: true }, (req: simplesmtp.SimpleServerConnection) => { req.on("data", (chunk: Buffer): void => { @@ -21,10 +21,10 @@ server = simplesmtp.createSimpleServer({ }); req.accept("12"); }); -this._server.server.on("authorizeUser", +(this as any)._server.server.on("authorizeUser", (envelope: any, username: string|Buffer, password: string, callback: (error: Error, success: boolean) => void ): void => { callback(null, true); }); -this._server.listen(this.port, "0.0.0.0", (error?: Error): void => { +(this as any)._server.listen(this.port, "0.0.0.0", (error?: Error): void => { }); diff --git a/types/ssh2/ssh2-tests.ts b/types/ssh2/ssh2-tests.ts index b3364cd489..aa599498b5 100644 --- a/types/ssh2/ssh2-tests.ts +++ b/types/ssh2/ssh2-tests.ts @@ -359,7 +359,7 @@ new ssh2.Server({ }).on('end', () => { console.log('Client disconnected'); }); -}).listen(0, '127.0.0.1', () => { +}).listen(0, '127.0.0.1', function () { console.log('Listening on port ' + this.address().port); }); @@ -425,7 +425,7 @@ new ssh2.Server({ }).on('end', () => { console.log('Client disconnected'); }); -}).listen(0, '127.0.0.1', () => { +}).listen(0, '127.0.0.1', function () { console.log('Listening on port ' + this.address().port); }); diff --git a/types/stampit/stampit-tests.ts b/types/stampit/stampit-tests.ts index 5b7c41109a..2e9bcad355 100644 --- a/types/stampit/stampit-tests.ts +++ b/types/stampit/stampit-tests.ts @@ -1,6 +1,6 @@ import stampit = require('stampit'); -const a = stampit().init((options) => { +const a = stampit().init(function (options) { const a = options.args[0]; this.getA = () => { return a; @@ -154,7 +154,7 @@ interface SomeStamp extends stampit.Stamp { } const SomeStamp = stampit() - .init((params: { a: number; b: boolean}) => { + .init(function (params: { a: number; b: boolean}) { this.a = '' + a; this.b = '' + b; }) as SomeStamp; diff --git a/types/stampit/v2/stampit-tests.ts b/types/stampit/v2/stampit-tests.ts index 259c3ccd5a..9187f28242 100644 --- a/types/stampit/v2/stampit-tests.ts +++ b/types/stampit/v2/stampit-tests.ts @@ -2,7 +2,7 @@ import stampit = require('stampit'); -var a = stampit().init((options) => { +var a = stampit().init(function (options) { var a = options.args[0]; this.getA = () => { return a; diff --git a/types/three/test/examples/effects/vreffect.ts b/types/three/test/examples/effects/vreffect.ts index 454d15fdf7..9205f3e1f1 100644 --- a/types/three/test/examples/effects/vreffect.ts +++ b/types/three/test/examples/effects/vreffect.ts @@ -1,6 +1,6 @@ var _vrEffect: THREE.VREffect; -_vrEffect = new THREE.VREffect(new THREE.WebGLRenderer({antialias: true}), (error) => { +_vrEffect = new THREE.VREffect(new THREE.WebGLRenderer({antialias: true}), function (error) { if (error) { this._stats.classList.add("error"); this._stats.innerHTML = "WebVR API not supported"; diff --git a/types/vinyl-fs/v0/vinyl-fs-tests.ts b/types/vinyl-fs/v0/vinyl-fs-tests.ts index 4d0316a0a0..48a5fbd61c 100644 --- a/types/vinyl-fs/v0/vinyl-fs-tests.ts +++ b/types/vinyl-fs/v0/vinyl-fs-tests.ts @@ -502,7 +502,7 @@ describe('dest stream', () => { const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const content = fs.readFileSync(srcPath); - const rename = through.obj((file: any, _: any, next: any) => { + const rename = through.obj(function (file: any, _: any, next: any) { file.path = inputPath2; this.push(file); next(); diff --git a/types/vinyl-fs/v1/vinyl-fs-tests.ts b/types/vinyl-fs/v1/vinyl-fs-tests.ts index 5b29b0465d..1756308bd2 100644 --- a/types/vinyl-fs/v1/vinyl-fs-tests.ts +++ b/types/vinyl-fs/v1/vinyl-fs-tests.ts @@ -502,7 +502,7 @@ describe('dest stream', () => { const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const content = fs.readFileSync(srcPath); - const rename = through.obj((file: any, _: any, next: any) => { + const rename = through.obj(function (file: any, _: any, next: any) { file.path = inputPath2; this.push(file); next(); diff --git a/types/waterline/waterline-tests.ts b/types/waterline/waterline-tests.ts index 5203195ef2..3b032b23fd 100644 --- a/types/waterline/waterline-tests.ts +++ b/types/waterline/waterline-tests.ts @@ -173,10 +173,10 @@ const valid2 = { cb("http://"); }, 1); }, - before: () => { + before: function () { return this.endDate; }, - after: () => { + after: function () { return this.startDate; } }; diff --git a/types/webmidi/webmidi-tests.ts b/types/webmidi/webmidi-tests.ts index 99335204fa..35c2927db0 100644 --- a/types/webmidi/webmidi-tests.ts +++ b/types/webmidi/webmidi-tests.ts @@ -1,4 +1,4 @@ -const onFulfilled = (item: WebMidi.MIDIAccess) => { +const onFulfilled = function (item: WebMidi.MIDIAccess) { this._midiPort = item; item.onstatechange = (event: WebMidi.MIDIConnectionEvent) => { From af8034fe417894f1302c4284e97464c98347190a Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 27 Feb 2019 16:27:11 -0800 Subject: [PATCH 2/3] Fix space lint --- .../chocolatechipjs/chocolatechipjs-tests.ts | 2 +- types/datatables.net/datatables.net-tests.ts | 4 +- types/jasmine-ajax/jasmine-ajax-tests.ts | 2 +- types/klaw/v1/klaw-tests.ts | 2 +- types/knex/knex-tests.ts | 160 +++++++++--------- types/koa-mount/koa-mount-tests.ts | 4 +- types/ramda/ramda-tests.ts | 4 +- types/rivets/rivets-tests.ts | 2 +- types/stampit/stampit-tests.ts | 2 +- types/vinyl-fs/v0/vinyl-fs-tests.ts | 2 +- types/vinyl-fs/v1/vinyl-fs-tests.ts | 2 +- types/webmidi/webmidi-tests.ts | 2 +- 12 files changed, 94 insertions(+), 94 deletions(-) diff --git a/types/chocolatechipjs/chocolatechipjs-tests.ts b/types/chocolatechipjs/chocolatechipjs-tests.ts index e470eb1d80..93cd698da7 100644 --- a/types/chocolatechipjs/chocolatechipjs-tests.ts +++ b/types/chocolatechipjs/chocolatechipjs-tests.ts @@ -213,7 +213,7 @@ $('ul').undelegate('click', 'li', () => { $('li').on('click', () => { $.noop; }); -$('ul').on('click', 'li', function () { +$('ul').on('click', 'li', function() { console.log($(this).text()); }); $('li').off('click'); diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index 8ee4611681..d6903ce1db 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -578,7 +578,7 @@ $('#example tbody').on('click', 'td', () => { const cell_invalidate_1 = cell.invalidate(); const cell_invalidate_2 = cell.invalidate("data"); -$('#example tbody').on('click', 'td', function () { +$('#example tbody').on('click', 'td', function() { this.innerHTML = (parseInt(this.innerHTML, 10) + 1).toString(); dt.cell(this).invalidate().draw(); }); @@ -773,7 +773,7 @@ let column_search_set = column.search("string"); column_search_set = column.search("string", true); column_search_set = column.search("string", true, false); column_search_set = column.search("string", true, false, true); -$('#column3_search').on('keyup', function () { +$('#column3_search').on('keyup', function() { dt .columns(3) .search((this as HTMLInputElement).value) diff --git a/types/jasmine-ajax/jasmine-ajax-tests.ts b/types/jasmine-ajax/jasmine-ajax-tests.ts index 716d8b38d5..cf1db49f28 100644 --- a/types/jasmine-ajax/jasmine-ajax-tests.ts +++ b/types/jasmine-ajax/jasmine-ajax-tests.ts @@ -772,7 +772,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { error = jasmine.createSpy("onFailure"); complete = jasmine.createSpy("onComplete"); - onreadystatechange = function () { + onreadystatechange = function() { if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE if (this.status === 200) { success(this.responseText, this.textStatus, this); diff --git a/types/klaw/v1/klaw-tests.ts b/types/klaw/v1/klaw-tests.ts index 9170aff165..eb9a101017 100644 --- a/types/klaw/v1/klaw-tests.ts +++ b/types/klaw/v1/klaw-tests.ts @@ -16,7 +16,7 @@ klaw('/some/dir') // README.md: Streams 2 & 3 (pull) with error handling klaw('/some/dir') - .on('readable', function () { + .on('readable', function() { while (true) { const item = this.read(); if (!item) break; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 2fc751d8ac..1ff232e4a7 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -173,7 +173,7 @@ knex.select('title', 'author', 'year').from('books'); knex.select({ name: 'title', writer: 'author' }).from(knex.raw('books')); knex.select().table('books'); -knex.avg('sum_column1').from(function () { +knex.avg('sum_column1').from(function() { this.sum('column1 as sum_column1').from('t1').groupBy('column1').as('t1'); }).as('ignored_alias'); @@ -190,7 +190,7 @@ knex('users').where({ knex('users').where('id', 1); -knex('users').where(function () { +knex('users').where(function() { this.where('id', 1).orWhere('id', '>', 10); }).orWhere({name: 'Tester'}); @@ -218,7 +218,7 @@ knex.select('name').from('users') knex('users') .where('name', '=', 'John') - .orWhere(function () { + .orWhere(function() { this.where('votes', '>', 100).andWhere('title', '<>', 'Admin'); }); @@ -230,13 +230,13 @@ knex('users').whereNull('updated_at'); knex('users').whereNotNull('created_at'); -knex('users').whereExists(function () { +knex('users').whereExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); knex('users').whereExists(knex.select('*').from('accounts').whereRaw('users.account_id = accounts.id')); -knex('users').whereNotExists(function () { +knex('users').whereNotExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); @@ -321,15 +321,15 @@ knex('users') .join(knex('contacts').select('user_id', 'phone').as('contacts'), { 'users.id': 'contacts.user_id' }) .select('users.id', 'contacts.phone'); -knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), function () { +knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); -knex.select('*').from('users').join('accounts', function () { +knex.select('*').from('users').join('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); -knex.select('*').from('users').join('accounts', function (join: Knex.JoinClause) { +knex.select('*').from('users').join('accounts', function(join: Knex.JoinClause) { if (this !== join) { throw new Error("join() callback call semantics wrong"); } @@ -337,120 +337,120 @@ knex.select('*').from('users').join('accounts', function (join: Knex.JoinClause) join.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); -knex.select('*').from('user').join('contacts', function () { +knex.select('*').from('user').join('contacts', function() { this.on('users.id', '=', knex.raw(7)); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').andOnIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').orOnIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onNotIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').andOnNotIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').orOnNotIn('contacts.id', [7, 15, 23, 41]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').andOnNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').orOnNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onNotNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').andOnNotNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').orOnNotNull('contacts.email'); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').onExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').onExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').andOnExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').andOnExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').orOnExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').orOnExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').onNotExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').onNotExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').andOnNotExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').andOnNotExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').orOnNotExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').orOnNotExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').andOnBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').orOnBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onNotBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').andOnNotBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', function () { +knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').orOnNotBetween('contacts.id', [5, 30]); }); -knex.select('*').from('users').join('contacts', function () { - this.on('users.id', '=', 'contacts.id').onNotExists(function () { +knex.select('*').from('users').join('contacts', function() { + this.on('users.id', '=', 'contacts.id').onNotExists(function() { this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); }); }); @@ -475,7 +475,7 @@ knex.from('users').innerJoin('accounts', 'users.id', 'accounts.user_id'); knex.table('users').innerJoin('accounts', 'users.id', '=', 'accounts.user_id'); -knex('users').innerJoin('accounts', function () { +knex('users').innerJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -485,7 +485,7 @@ knex('users').innerJoin('accounts', (join: Knex.JoinClause) => { knex.select('*').from('users').leftJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').leftJoin('accounts', function () { +knex.select('*').from('users').leftJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -502,13 +502,13 @@ knex.select('*').from('users').leftJoin('accounts', (join) => { knex.select('*').from('users').leftOuterJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').leftOuterJoin('accounts', function () { +knex.select('*').from('users').leftOuterJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); knex.select('*').from('users').rightJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').rightJoin('accounts', function () { +knex.select('*').from('users').rightJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -518,13 +518,13 @@ knex.select('*').from('users').rightJoin('accounts', (join: Knex.JoinClause) => knex.select('*').from('users').rightOuterJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').rightOuterJoin('accounts', function () { +knex.select('*').from('users').rightOuterJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); knex.select('*').from('users').outerJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').outerJoin('accounts', function () { +knex.select('*').from('users').outerJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -534,7 +534,7 @@ knex.select('*').from('users').outerJoin('accounts', (join: Knex.JoinClause) => knex.select('*').from('users').fullOuterJoin('accounts', 'users.id', 'accounts.user_id'); -knex.select('*').from('users').fullOuterJoin('accounts', function () { +knex.select('*').from('users').fullOuterJoin('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); @@ -549,39 +549,39 @@ knex.select('*').from('accounts').joinRaw('natural full join table1').where('id' knex.select('*').from('accounts').join(knex.raw('natural full join table1')).where('id', 1); knex.select('*').from('accounts') - .join(function () { + .join(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .leftJoin(function () { + .leftJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .leftOuterJoin(function () { + .leftOuterJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .rightJoin(function () { + .rightJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .rightOuterJoin(function () { + .rightOuterJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .innerJoin(function () { + .innerJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .crossJoin(function () { + .crossJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .fullOuterJoin(function () { + .fullOuterJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); knex.select('*').from('accounts') - .outerJoin(function () { + .outerJoin(function() { this.select('*').from('accounts').as('special_accounts'); }, 'special_accounts.a', '=', 'accounts.b'); @@ -1044,66 +1044,66 @@ knex.select('*').from('users').where(knex.raw('id = ?', [1])).toSQL(); // knex('users') .select('*') - .join('contacts', function (builder) { - this.on(function (builder: any) { + .join('contacts', function(builder) { + this.on(function(builder: any) { let self: Knex.JoinClause = this; self = builder; - }).andOn(function (builder: any) { + }).andOn(function(builder: any) { let self: Knex.JoinClause = this; self = builder; - }).orOn(function (builder: any) { + }).orOn(function(builder: any) { let self: Knex.JoinClause = this; self = builder; - }).onExists(function (builder: any) { + }).onExists(function(builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).orOnExists(function (builder: any) { + }).orOnExists(function(builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).andOnExists(function (builder: any) { + }).andOnExists(function(builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).onNotExists(function (builder: any) { + }).onNotExists(function(builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).andOnNotExists(function (builder: any) { + }).andOnNotExists(function(builder: any) { let self: Knex.QueryBuilder = this; self = builder; - }).orOnNotExists(function (builder: any) { + }).orOnNotExists(function(builder: any) { let self: Knex.QueryBuilder = this; self = builder; }); - }).where(function (builder) { + }).where(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).orWhere(function (builder) { + }).orWhere(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).andWhere(function (builder) { + }).andWhere(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).whereIn('column', function (builder) { + }).whereIn('column', function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).orWhereIn('column', function (builder) { + }).orWhereIn('column', function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).whereNotIn('column', function (builder) { + }).whereNotIn('column', function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).orWhereNotIn('column', function (builder) { + }).orWhereNotIn('column', function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).whereWrapped(function (builder) { + }).whereWrapped(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).union(function (builder) { + }).union(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).unionAll(function (builder) { + }).unionAll(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).modify(function (builder, aBool) { + }).modify(function(builder, aBool) { let self: Knex.QueryBuilder = this; self = builder; }, true); @@ -1197,12 +1197,12 @@ knex('characters') knex('characters') .select() - .whereIn('name', function () { + .whereIn('name', function() { this.select('name').from('characters'); }); knex('characters') .select() - .whereIn(['name', 'class'], function () { + .whereIn(['name', 'class'], function() { this.select('name', 'class').from('characters'); }); diff --git a/types/koa-mount/koa-mount-tests.ts b/types/koa-mount/koa-mount-tests.ts index 262a4491ca..00ff57986d 100644 --- a/types/koa-mount/koa-mount-tests.ts +++ b/types/koa-mount/koa-mount-tests.ts @@ -3,13 +3,13 @@ import mount = require("koa-mount"); const a = new Koa(); -a.use(function (next) { +a.use(function(next) { this.body = "Hello"; }); const b = new Koa(); -b.use(function (next) { +b.use(function(next) { this.body = "World"; }); diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index d934578049..16ba23d85b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2180,7 +2180,7 @@ class Rectangle { this.colors = Array.prototype.slice.call(arguments, 1); } - Circle.prototype.area = function () { Math.PI * Math.pow(this.r, 2) }; + Circle.prototype.area = function() { return Math.PI * Math.pow(this.r, 2); }; const circleN = R.constructN(2, Circle); let c1 = circleN(1, "red"); @@ -2623,7 +2623,7 @@ class Rectangle { const Why: any = ((val: boolean) => { const why = {} as any; why.val = val; - why.and = function (x: boolean) { this.val && x }; + why.and = function(x: boolean) { return this.val && x; }; return Why; })(true); const why = new Why(true); diff --git a/types/rivets/rivets-tests.ts b/types/rivets/rivets-tests.ts index 938ef639c0..67beebdc13 100644 --- a/types/rivets/rivets-tests.ts +++ b/types/rivets/rivets-tests.ts @@ -10,7 +10,7 @@ Rivets.configure({ // Template delimiters for text bindings templateDelimiters: ['[[', ']]'], // Augment the event handler of the on-* binder - handler: function (target: any, event: any, binding: any) { + handler(target: any, event: any, binding: any) { this.call(target, event, binding.view.models); } }); diff --git a/types/stampit/stampit-tests.ts b/types/stampit/stampit-tests.ts index 2e9bcad355..926d8ee401 100644 --- a/types/stampit/stampit-tests.ts +++ b/types/stampit/stampit-tests.ts @@ -1,6 +1,6 @@ import stampit = require('stampit'); -const a = stampit().init(function (options) { +const a = stampit().init(function(options) { const a = options.args[0]; this.getA = () => { return a; diff --git a/types/vinyl-fs/v0/vinyl-fs-tests.ts b/types/vinyl-fs/v0/vinyl-fs-tests.ts index 48a5fbd61c..071d231cf8 100644 --- a/types/vinyl-fs/v0/vinyl-fs-tests.ts +++ b/types/vinyl-fs/v0/vinyl-fs-tests.ts @@ -502,7 +502,7 @@ describe('dest stream', () => { const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const content = fs.readFileSync(srcPath); - const rename = through.obj(function (file: any, _: any, next: any) { + const rename = through.obj(function(file: any, _: any, next: any) { file.path = inputPath2; this.push(file); next(); diff --git a/types/vinyl-fs/v1/vinyl-fs-tests.ts b/types/vinyl-fs/v1/vinyl-fs-tests.ts index 1756308bd2..5a90558a07 100644 --- a/types/vinyl-fs/v1/vinyl-fs-tests.ts +++ b/types/vinyl-fs/v1/vinyl-fs-tests.ts @@ -502,7 +502,7 @@ describe('dest stream', () => { const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname }); const content = fs.readFileSync(srcPath); - const rename = through.obj(function (file: any, _: any, next: any) { + const rename = through.obj(function(file: any, _: any, next: any) { file.path = inputPath2; this.push(file); next(); diff --git a/types/webmidi/webmidi-tests.ts b/types/webmidi/webmidi-tests.ts index 35c2927db0..8380f17be6 100644 --- a/types/webmidi/webmidi-tests.ts +++ b/types/webmidi/webmidi-tests.ts @@ -1,4 +1,4 @@ -const onFulfilled = function (item: WebMidi.MIDIAccess) { +const onFulfilled = function(item: WebMidi.MIDIAccess) { this._midiPort = item; item.onstatechange = (event: WebMidi.MIDIConnectionEvent) => { From b4e1dca9cfa306dfbd331d7745dc4a6545fc6ecf Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 27 Feb 2019 18:11:31 -0800 Subject: [PATCH 3/3] One more extra space --- types/stampit/stampit-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/stampit/stampit-tests.ts b/types/stampit/stampit-tests.ts index 926d8ee401..6f527dcaac 100644 --- a/types/stampit/stampit-tests.ts +++ b/types/stampit/stampit-tests.ts @@ -154,7 +154,7 @@ interface SomeStamp extends stampit.Stamp { } const SomeStamp = stampit() - .init(function (params: { a: number; b: boolean}) { + .init(function(params: { a: number; b: boolean}) { this.a = '' + a; this.b = '' + b; }) as SomeStamp;