Skip to content

Commit

Permalink
chore: replace more tslint comments with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Feb 28, 2019
1 parent e138a81 commit c0f474f
Show file tree
Hide file tree
Showing 39 changed files with 72 additions and 69 deletions.
2 changes: 1 addition & 1 deletion benchmark/src/__tests__/benchmark.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const DUMMY_STATS: EndpointStats = {

describe('Benchmark (SLOW)', function() {
// Unfortunately, the todo app requires one second to start
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(5000);
it('works', async () => {
const bench = new Benchmark();
Expand Down
2 changes: 1 addition & 1 deletion docs/site/Testing-your-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ const Dredd = require('dredd');

describe('API (acceptance)', () => {
let app: HelloWorldApplication;
// tslint:disable no-any
/* eslint-disable @typescript-eslint/no-explicit-any */
let dredd: any;
before(initEnvironment);
after(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Application', function() {
let app: SoapCalculatorApplication;
let client: Client;

// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30000);

before(givenAnApplication);
Expand Down
4 changes: 2 additions & 2 deletions examples/todo/src/__tests__/acceptance/todo.acceptance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('TodoApplication', () => {
it('creates a todo', async function() {
// Set timeout to 30 seconds as `post /todos` triggers geocode look up
// over the internet and it takes more than 2 seconds
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30000);
const todo = givenTodo();
const response = await client
Expand All @@ -69,7 +69,7 @@ describe('TodoApplication', () => {

it('creates an address-based reminder', async function() {
// Increase the timeout to accommodate slow network connections
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30000);

const todo = givenTodo({remindAtAddress: aLocation.address});
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/src/__tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const aLocation = {
address: '1 New Orchard Road, Armonk, 10504',
geopoint: <GeoPoint>{y: 41.109653, x: -73.72467},
get geostring() {
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
return `${this.geopoint.y},${this.geopoint.x}`;
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import {GeocoderDataSource} from '../../../datasources/geocoder.datasource';

describe('GeoLookupService', function() {
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30 * 1000);

let cachingProxy: HttpCachingProxy;
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/test/acceptance/app-run.acceptance.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ describe('app-generator (SLOW)', function() {
// WARNING: It takes a while to run `lerna bootstrap`
this.timeout(15 * 60 * 1000);
process.chdir(rootDir);
await lernaBootstrap([appName, '@loopback/eslint-config']);
await lernaBootstrap([
appName,
'@loopback/build',
'@loopback/eslint-config',
]);
});

it('passes `npm test` for the generated project', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SANDBOX_PATH = path.resolve(__dirname, '..', '.sandbox');
const sandbox = new TestSandbox(SANDBOX_PATH);

describe('lb4 repository', function() {
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30000);

beforeEach('reset sandbox', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Context bindings - Injecting dependencies of classes', () => {
expect(instance).to.have.property('isAuthenticated', false);
});

// tslint:disable-next-line:max-line-length
/* eslint-disable-next-line max-len */
it('creates instance synchronously when all dependencies are sync too', () => {
ctx.bind('appName').to('CodeHub');
class InfoController {
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Context bindings - Injecting dependencies of classes', () => {
expect(instance).to.have.property('isAuthenticated', false);
});

// tslint:disable-next-line:max-line-length
/* eslint-disable-next-line max-len */
it('creates instance synchronously when property/constructor dependencies are sync too', () => {
ctx.bind('appName').to('CodeHub');
ctx.bind('authenticated').to(false);
Expand Down
10 changes: 5 additions & 5 deletions packages/context/src/__tests__/unit/inject.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

describe('function argument injection', () => {
it('can decorate class constructor arguments', () => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestClass {
constructor(@inject('foo') foo: string) {}
}
Expand All @@ -29,7 +29,7 @@ describe('function argument injection', () => {
});

it('can retrieve information about injected method arguments', () => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestClass {
test(@inject('foo') foo: string) {}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('function argument injection', () => {

describe('property injection', () => {
it('can decorate properties', () => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestClass {
@inject('foo')
foo: string;
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('property injection', () => {

it('cannot decorate static properties', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestClass {
@inject('foo')
static foo: string;
Expand All @@ -136,7 +136,7 @@ describe('property injection', () => {

it('cannot decorate a method', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestClass {
@inject('bar')
foo() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {ResolutionSession, Binding, Injection, inject} from '../..';

describe('ResolutionSession', () => {
class MyController {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
constructor(@inject('b') private b: string) {}
}
function givenInjection(): Injection {
Expand Down
8 changes: 4 additions & 4 deletions packages/context/src/__tests__/unit/resolver.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('constructor injection', () => {
expect(t.fooBar).to.eql('FOO:BAR');
});

// tslint:disable-next-line:max-line-length
/* eslint-disable-next-line max-len */
it('resolves constructor arguments with custom resolve function and no binding key', () => {
class TestClass {
constructor(
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('constructor injection', () => {
);
});

// tslint:disable-next-line:max-line-length
/* eslint-disable-next-line max-len */
it('will not report circular dependencies if a binding is injected twice', () => {
const context = new Context();
class XClass {}
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('async constructor injection', () => {
expect(t.foo).to.eql('FOO');
});

// tslint:disable-next-line:max-line-length
/* eslint-disable-next-line max-len */
it('resolves constructor arguments with custom async decorator', async () => {
class TestClass {
constructor(@customAsyncDecorator({x: 'bar'}) public fooBar: string) {}
Expand Down Expand Up @@ -387,7 +387,7 @@ describe('property injection', () => {
expect(t.fooBar).to.eql('FOO:BAR');
});

// tslint:disable-next-line:max-line-length
/* eslint-disable-next-line max-len */
it('resolves inject properties with custom resolve function and no binding key', () => {
class TestClass {
@inject('', {x: 'bar'}, (c: Context, injection: Injection) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/context/src/binding-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

export type BindingAddress<T = unknown> = string | BindingKey<T>;

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
export class BindingKey<ValueType> {
static readonly PROPERTY_SEPARATOR = '#';

Expand Down
2 changes: 1 addition & 1 deletion packages/context/src/resolution-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const debugSession = debugModule('loopback:context:resolver:session');
const getTargetName = DecoratorFactory.getTargetName;

// NOTE(bajtos) The following import is required to satisfy TypeScript compiler
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
import {BindingKey} from './binding-key';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/context/src/value-promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function resolveList<T, V>(
result[index] = val;
};

// tslint:disable-next-line:prefer-for-of
// eslint-disable-next-line prefer-for-of
for (let ix = 0; ix < list.length; ix++) {
const valueOrPromise = resolver(list[ix], ix, list);
if (isPromiseLike(valueOrPromise)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('HttpCachingProxy', () => {

it('proxies HTTP requests', async function() {
// Increase the timeout to accomodate slow network connections
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30000);

await givenRunningProxy();
Expand All @@ -57,7 +57,7 @@ describe('HttpCachingProxy', () => {

it('proxies HTTPs requests (no tunneling)', async function() {
// Increase the timeout to accomodate slow network connections
// tslint:disable-next-line:no-invalid-this
/* eslint-disable-next-line no-invalid-this */
this.timeout(30000);

await givenRunningProxy();
Expand Down
2 changes: 1 addition & 1 deletion packages/http-caching-proxy/src/http-caching-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class HttpCachingProxy {
clientRequest: IncomingMessage,
clientResponse: ServerResponse,
) {
// tslint:disable-next-line:await-promise
// eslint-disable-next-line await-promise
const backendResponse = await makeRequest({
resolveWithFullResponse: true,
simple: false,
Expand Down
16 changes: 8 additions & 8 deletions packages/metadata/src/__tests__/unit/decorator-factory.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('ClassDecoratorFactory', () => {
expect(() => {
@classDecorator({x: 1})
@classDecorator({y: 2})
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {}
}).to.throw(
/Decorator cannot be applied more than once on class MyController/,
Expand Down Expand Up @@ -352,7 +352,7 @@ describe('PropertyDecoratorFactory', () => {

it('throws if applied more than once on the same property', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
@propertyDecorator({x: 1})
@propertyDecorator({y: 2})
Expand Down Expand Up @@ -400,7 +400,7 @@ describe('PropertyDecoratorFactory for static properties', () => {

it('throws if applied more than once on the same static property', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
@propertyDecorator({x: 1})
@propertyDecorator({y: 2})
Expand Down Expand Up @@ -448,7 +448,7 @@ describe('MethodDecoratorFactory', () => {

it('throws if applied more than once on the same method', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
@methodDecorator({x: 1})
@methodDecorator({y: 2})
Expand Down Expand Up @@ -496,7 +496,7 @@ describe('MethodDecoratorFactory for static methods', () => {

it('throws if applied more than once on the same static method', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
@methodDecorator({x: 1})
@methodDecorator({y: 2})
Expand Down Expand Up @@ -545,7 +545,7 @@ describe('ParameterDecoratorFactory', () => {

it('throws if applied more than once on the same parameter', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
myMethod(
@parameterDecorator({x: 1})
Expand Down Expand Up @@ -634,7 +634,7 @@ describe('ParameterDecoratorFactory for a static method', () => {

it('throws if applied more than once on the same parameter', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
static myMethod(
@parameterDecorator({x: 1})
Expand Down Expand Up @@ -695,7 +695,7 @@ describe('MethodParameterDecoratorFactory with invalid decorations', () => {

it('reports error if the # of decorations exceeeds the # of params', () => {
expect(() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
@methodParameterDecorator({x: 1}) // Causing error
@methodParameterDecorator({x: 2}) // For a
Expand Down
2 changes: 1 addition & 1 deletion packages/metadata/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type DecoratorType =
* @typeparam T Type of the metadata value
* @typeparam D Type of the decorator
*/
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
export class MetadataAccessor<T, D extends DecoratorType = DecoratorType> {
private constructor(public readonly key: string) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('openapi-v3-types unit tests', () => {
* original OAS 3 definition. (Though some interfaces allow for extensibility).
*/

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestObject implements ExampleObject {
summary: 'test object';
description: 'test object';
Expand All @@ -66,20 +66,20 @@ describe('openapi-v3-types unit tests', () => {
randomProperty: 'extension value';
}

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class ReferenceTestObject implements ReferenceObject {
$ref: '#def/reference-object';
}

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class DiscriminatorTestObject implements DiscriminatorObject {
propertyName: 'test';
mapping: {
hello: 'world';
};
}

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class XMLTestObject implements XmlObject {
name: 'test';
namespace: 'test';
Expand All @@ -88,13 +88,13 @@ describe('openapi-v3-types unit tests', () => {
wrapped: false;
}

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestExternalDocumentationObject
implements ExternalDocumentationObject {
url: 'https://test.com/test.html';
}

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class TestISpecificationExtension implements ISpecificationExtension {
test: 'test';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('Routing metadata for parameters', () => {
it('reports error if an array parameter type is not Array', () => {
expect.throws(
() => {
// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
class MyController {
@get('/greet')
greet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('JSON Schema type', () => {
* Inspired by https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/json-schema/json-schema-tests.ts
*/

// tslint:disable-next-line:no-unused
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
const testSchema: JsonSchema = {
$id: 'test',
$ref: 'test/sub',
Expand Down

0 comments on commit c0f474f

Please sign in to comment.