Skip to content

Commit a18a3d7

Browse files
committed
fix: rework tslint comments disabling "no-unused-variable" rule
1 parent 78c9d36 commit a18a3d7

File tree

26 files changed

+48
-52
lines changed

26 files changed

+48
-52
lines changed

packages/boot/test/fixtures/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {ServiceMixin} from '@loopback/service-proxy';
1010
import {BootMixin} from '../..';
1111

1212
// Force package.json to be copied to `dist` by `tsc`
13-
//tslint:disable-next-line:no-unused-variable
13+
//tslint:disable-next-line:no-unused
1414
import * as pkg from './package.json';
1515

1616
export class BooterApp extends BootMixin(

packages/context/src/binding-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
export type BindingAddress<T> = string | BindingKey<T>;
77

8-
// tslint:disable-next-line:no-unused-variable
8+
// tslint:disable-next-line:no-unused
99
export class BindingKey<ValueType> {
1010
static readonly PROPERTY_SEPARATOR = '#';
1111

packages/context/src/resolution-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const debugSession = debugModule('loopback:context:resolver:session');
1313
const getTargetName = DecoratorFactory.getTargetName;
1414

1515
// NOTE(bajtos) The following import is required to satisfy TypeScript compiler
16-
// tslint:disable-next-line:no-unused-variable
16+
// tslint:disable-next-line:no-unused
1717
import {BindingKey} from './binding-key';
1818

1919
/**

packages/context/test/unit/inject.unit.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212

1313
describe('function argument injection', () => {
1414
it('can decorate class constructor arguments', () => {
15-
// tslint:disable-next-line:no-unused-variable
15+
// tslint:disable-next-line:no-unused
1616
class TestClass {
1717
constructor(@inject('foo') foo: string) {}
1818
}
@@ -29,7 +29,7 @@ describe('function argument injection', () => {
2929
});
3030

3131
it('can retrieve information about injected method arguments', () => {
32-
// tslint:disable-next-line:no-unused-variable
32+
// tslint:disable-next-line:no-unused
3333
class TestClass {
3434
test(@inject('foo') foo: string) {}
3535
}
@@ -97,7 +97,7 @@ describe('function argument injection', () => {
9797

9898
describe('property injection', () => {
9999
it('can decorate properties', () => {
100-
// tslint:disable-next-line:no-unused-variable
100+
// tslint:disable-next-line:no-unused
101101
class TestClass {
102102
@inject('foo')
103103
foo: string;
@@ -126,7 +126,7 @@ describe('property injection', () => {
126126

127127
it('cannot decorate static properties', () => {
128128
expect(() => {
129-
// tslint:disable-next-line:no-unused-variable
129+
// tslint:disable-next-line:no-unused
130130
class TestClass {
131131
@inject('foo')
132132
static foo: string;
@@ -136,7 +136,7 @@ describe('property injection', () => {
136136

137137
it('cannot decorate a method', () => {
138138
expect(() => {
139-
// tslint:disable-next-line:no-unused-variable
139+
// tslint:disable-next-line:no-unused
140140
class TestClass {
141141
@inject('bar')
142142
foo() {}

packages/context/test/unit/resolution-session.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {ResolutionSession, Binding, Injection, inject} from '../..';
88

99
describe('ResolutionSession', () => {
1010
class MyController {
11-
// tslint:disable-next-line:no-unused-variable
11+
// tslint:disable-next-line:no-unused
1212
constructor(@inject('b') private b: string) {}
1313
}
1414
function givenInjection(): Injection {

packages/metadata/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type DecoratorType =
1717
* @typeparam T Type of the metadata value
1818
* @typeparam D Type of the decorator
1919
*/
20+
// tslint:disable-next-line:no-unused
2021
export class MetadataAccessor<T, D extends DecoratorType = DecoratorType> {
2122
private constructor(public readonly key: string) {}
2223

packages/metadata/test/unit/decorator-factory.unit.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('ClassDecoratorFactory', () => {
113113
expect(() => {
114114
@classDecorator({x: 1})
115115
@classDecorator({y: 2})
116-
// tslint:disable-next-line:no-unused-variable
116+
// tslint:disable-next-line:no-unused
117117
class MyController {}
118118
}).to.throw(
119119
/Decorator cannot be applied more than once on class MyController/,
@@ -352,7 +352,7 @@ describe('PropertyDecoratorFactory', () => {
352352

353353
it('throws if applied more than once on the same property', () => {
354354
expect(() => {
355-
// tslint:disable-next-line:no-unused-variable
355+
// tslint:disable-next-line:no-unused
356356
class MyController {
357357
@propertyDecorator({x: 1})
358358
@propertyDecorator({y: 2})
@@ -400,7 +400,7 @@ describe('PropertyDecoratorFactory for static properties', () => {
400400

401401
it('throws if applied more than once on the same static property', () => {
402402
expect(() => {
403-
// tslint:disable-next-line:no-unused-variable
403+
// tslint:disable-next-line:no-unused
404404
class MyController {
405405
@propertyDecorator({x: 1})
406406
@propertyDecorator({y: 2})
@@ -448,7 +448,7 @@ describe('MethodDecoratorFactory', () => {
448448

449449
it('throws if applied more than once on the same method', () => {
450450
expect(() => {
451-
// tslint:disable-next-line:no-unused-variable
451+
// tslint:disable-next-line:no-unused
452452
class MyController {
453453
@methodDecorator({x: 1})
454454
@methodDecorator({y: 2})
@@ -496,7 +496,7 @@ describe('MethodDecoratorFactory for static methods', () => {
496496

497497
it('throws if applied more than once on the same static method', () => {
498498
expect(() => {
499-
// tslint:disable-next-line:no-unused-variable
499+
// tslint:disable-next-line:no-unused
500500
class MyController {
501501
@methodDecorator({x: 1})
502502
@methodDecorator({y: 2})
@@ -545,7 +545,7 @@ describe('ParameterDecoratorFactory', () => {
545545

546546
it('throws if applied more than once on the same parameter', () => {
547547
expect(() => {
548-
// tslint:disable-next-line:no-unused-variable
548+
// tslint:disable-next-line:no-unused
549549
class MyController {
550550
myMethod(
551551
@parameterDecorator({x: 1})
@@ -634,7 +634,7 @@ describe('ParameterDecoratorFactory for a static method', () => {
634634

635635
it('throws if applied more than once on the same parameter', () => {
636636
expect(() => {
637-
// tslint:disable-next-line:no-unused-variable
637+
// tslint:disable-next-line:no-unused
638638
class MyController {
639639
static myMethod(
640640
@parameterDecorator({x: 1})
@@ -695,7 +695,7 @@ describe('MethodParameterDecoratorFactory with invalid decorations', () => {
695695

696696
it('reports error if the # of decorations exceeeds the # of params', () => {
697697
expect(() => {
698-
// tslint:disable-next-line:no-unused-variable
698+
// tslint:disable-next-line:no-unused
699699
class MyController {
700700
@methodParameterDecorator({x: 1}) // Causing error
701701
@methodParameterDecorator({x: 2}) // For a

packages/openapi-v3-types/test/unit/openapi-v3-spec-types.unit.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('openapi-v3-types unit tests', () => {
5757
* original OAS 3 definition. (Though some interfaces allow for extensibility).
5858
*/
5959

60-
// tslint:disable-next-line:no-unused-variable
60+
// tslint:disable-next-line:no-unused
6161
class TestObject implements ExampleObject {
6262
summary: 'test object';
6363
description: 'test object';
@@ -66,20 +66,20 @@ describe('openapi-v3-types unit tests', () => {
6666
randomProperty: 'extension value';
6767
}
6868

69-
// tslint:disable-next-line:no-unused-variable
69+
// tslint:disable-next-line:no-unused
7070
class ReferenceTestObject implements ReferenceObject {
7171
$ref: '#def/reference-object';
7272
}
7373

74-
// tslint:disable-next-line:no-unused-variable
74+
// tslint:disable-next-line:no-unused
7575
class DiscriminatorTestObject implements DiscriminatorObject {
7676
propertyName: 'test';
7777
mapping: {
7878
hello: 'world';
7979
};
8080
}
8181

82-
// tslint:disable-next-line:no-unused-variable
82+
// tslint:disable-next-line:no-unused
8383
class XMLTestObject implements XmlObject {
8484
name: 'test';
8585
namespace: 'test';
@@ -88,13 +88,13 @@ describe('openapi-v3-types unit tests', () => {
8888
wrapped: false;
8989
}
9090

91-
// tslint:disable-next-line:no-unused-variable
91+
// tslint:disable-next-line:no-unused
9292
class TestExternalDocumentationObject
9393
implements ExternalDocumentationObject {
9494
url: 'https://test.com/test.html';
9595
}
9696

97-
// tslint:disable-next-line:no-unused-variable
97+
// tslint:disable-next-line:no-unused
9898
class TestISpecificationExtension implements ISpecificationExtension {
9999
test: 'test';
100100
}

packages/openapi-v3/test/unit/decorators/param/param.decorator.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('Routing metadata for parameters', () => {
164164
it('reports error if an array parameter type is not Array', () => {
165165
expect.throws(
166166
() => {
167-
// tslint:disable-next-line:no-unused-variable
167+
// tslint:disable-next-line:no-unused
168168
class MyController {
169169
@get('/greet')
170170
greet(

packages/repository-json-schema/test/unit/json-schema.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('JSON Schema type', () => {
1515
* Inspired by https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/json-schema/json-schema-tests.ts
1616
*/
1717

18-
// tslint:disable-next-line:no-unused-variable
18+
// tslint:disable-next-line:no-unused
1919
const testSchema: JsonSchema = {
2020
$id: 'test',
2121
$ref: 'test/sub',

0 commit comments

Comments
 (0)