Skip to content

Commit d65d13e

Browse files
authored
[tfjs-converter] Use global lint settings (tensorflow#1904)
DEV - Migrate tfjs-converter to Typescript 3.5.3 - Use global lint settings - Fix lint errors
1 parent e3ae753 commit d65d13e

27 files changed

+136
-197
lines changed

.vscode/tasks.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"command": "yarn",
6+
"label": "lint",
7+
"type": "shell",
8+
"args": [
9+
"lint"
10+
],
11+
"problemMatcher": {
12+
"base": "$tslint5",
13+
"owner": "tslint-type-checked",
14+
"fileLocation": "absolute"
15+
}
16+
},
17+
{
18+
"command": "yarn",
19+
"label": "build",
20+
"type": "shell",
21+
"args": ["build", "--pretty", "false", "--noEmit"],
22+
"problemMatcher": [
23+
"$tsc"
24+
]
25+
}
26+
]
27+
}

tfjs-converter/.vscode/tasks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.vscode/tasks.json

tfjs-converter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"ts-node": "~4.1.0",
5151
"tslint": "~5.8.0",
5252
"tslint-no-circular-imports": "~0.5.0",
53-
"typescript": "3.3.3333",
53+
"typescript": "3.5.3",
5454
"yalc": "~1.0.0-pre.21"
5555
},
5656
"scripts": {

tfjs-converter/src/data/compiled_api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* =============================================================================
1717
*/
1818

19+
/* tslint:disable */
20+
1921
/** Properties of an Any. */
2022
export declare interface IAny {
2123
/** Any typeUrl */

tfjs-converter/src/executor/execution_context.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ export class ExecutionContext {
140140
this.contexts = this.contexts.slice();
141141
this.lastId++;
142142
const context =
143-
Object.assign({}, this.contexts[this.contexts.length - 1]) as
144-
ExecutionContextInfo;
143+
Object.assign({}, this.contexts[this.contexts.length - 1]);
145144
context.iterationId += 1;
146145
context.id = this.lastId;
147146
this.contexts.splice(-1, 1, context);

tfjs-converter/src/executor/tensor_array.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
* =============================================================================
1616
*/
17-
// tslint:disable-next-line:max-line-length
17+
1818
import {concat, DataType, slice, stack, Tensor, tensor, tidy, unstack, util} from '@tensorflow/tfjs-core';
1919

2020
export interface TensorWithState {

tfjs-converter/src/operations/executors/basic_math_executor_test.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ import * as tfc from '@tensorflow/tfjs-core';
1818

1919
import {ExecutionContext} from '../../executor/execution_context';
2020
import * as basic_math from '../op_list/basic_math';
21-
import {Node, OpMapper} from '../types';
21+
import {Node} from '../types';
2222

2323
import {executeOp} from './basic_math_executor';
24-
// tslint:disable-next-line:max-line-length
2524
import {createNumberAttr, createNumericArrayAttrFromIndex, createTensorAttr, validateParam} from './test_helper';
2625

2726
describe('basic math', () => {
@@ -59,8 +58,7 @@ describe('basic math', () => {
5958
it('should match op def', () => {
6059
node.op = op;
6160

62-
expect(validateParam(node, basic_math.json as OpMapper[]))
63-
.toBeTruthy();
61+
expect(validateParam(node, basic_math.json)).toBeTruthy();
6462
});
6563
});
6664
describe('Relu6', () => {
@@ -79,7 +77,7 @@ describe('basic math', () => {
7977
node.attrParams['clipValueMax'] = createNumberAttr(6);
8078
node.attrParams['clipValueMin'] = createNumberAttr(0);
8179

82-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
80+
expect(validateParam(node, basic_math.json)).toBeTruthy();
8381
});
8482
});
8583
describe('Prod', () => {
@@ -97,7 +95,7 @@ describe('basic math', () => {
9795
node.op = 'Prod';
9896
node.inputParams['axes'] = createNumericArrayAttrFromIndex(1);
9997

100-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
98+
expect(validateParam(node, basic_math.json)).toBeTruthy();
10199
});
102100
});
103101
describe('Rsqrt', () => {
@@ -112,7 +110,7 @@ describe('basic math', () => {
112110
it('should match op def', () => {
113111
node.op = 'Rsqrt';
114112

115-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
113+
expect(validateParam(node, basic_math.json)).toBeTruthy();
116114
});
117115
});
118116
describe('LeakyRelu', () => {
@@ -128,7 +126,7 @@ describe('basic math', () => {
128126
it('should match op def', () => {
129127
node.op = 'LeakyRelu';
130128
node.attrParams['alpha'] = createNumberAttr(1);
131-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
129+
expect(validateParam(node, basic_math.json)).toBeTruthy();
132130
});
133131
});
134132
describe('Atan2', () => {
@@ -146,7 +144,7 @@ describe('basic math', () => {
146144
node.op = 'Atan2';
147145
node.inputParams['y'] = createTensorAttr(1);
148146

149-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
147+
expect(validateParam(node, basic_math.json)).toBeTruthy();
150148
});
151149
});
152150
describe('ComplexAbs', () => {
@@ -161,7 +159,7 @@ describe('basic math', () => {
161159
it('should match op def', () => {
162160
node.op = 'ComplexAbs';
163161

164-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
162+
expect(validateParam(node, basic_math.json)).toBeTruthy();
165163
});
166164
});
167165
describe('Complex', () => {
@@ -185,7 +183,7 @@ describe('basic math', () => {
185183
imag: createTensorAttr(1)
186184
};
187185

188-
expect(validateParam(node, basic_math.json as OpMapper[])).toBeTruthy();
186+
expect(validateParam(node, basic_math.json)).toBeTruthy();
189187
});
190188
});
191189
});

tfjs-converter/src/operations/executors/control_executor_test.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ import {test_util} from '@tensorflow/tfjs-core';
2121
import {ExecutionContext} from '../../executor/execution_context';
2222
import {TensorArray} from '../../executor/tensor_array';
2323
import * as control from '../op_list/control';
24-
import {Node, OpMapper} from '../types';
24+
import {Node} from '../types';
2525

2626
import {executeOp} from './control_executor';
27-
// tslint:disable-next-line:max-line-length
2827
import {createBoolAttr, createDtypeAttr, createNumberAttrFromIndex, createNumericArrayAttrFromIndex, createStrAttr, createTensorAttr, createTensorShapeAttr, validateParam} from './test_helper';
2928

3029
describe('control', () => {
@@ -74,7 +73,7 @@ describe('control', () => {
7473
node.inputParams['pred'] = createTensorAttr(1);
7574
node.inputParams['data'] = createTensorAttr(0);
7675

77-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
76+
expect(validateParam(node, control.json)).toBeTruthy();
7877
});
7978
});
8079
describe('Merge', () => {
@@ -100,7 +99,7 @@ describe('control', () => {
10099
it('should match json def', () => {
101100
node.op = 'Merge';
102101

103-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
102+
expect(validateParam(node, control.json)).toBeTruthy();
104103
});
105104
});
106105

@@ -121,7 +120,7 @@ describe('control', () => {
121120
node.op = 'Enter';
122121
node.inputParams['tensor'] = createTensorAttr(0);
123122

124-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
123+
expect(validateParam(node, control.json)).toBeTruthy();
125124
});
126125
});
127126
describe('Exit', () => {
@@ -140,7 +139,7 @@ describe('control', () => {
140139
node.op = 'Exit';
141140
node.inputParams['tensor'] = createTensorAttr(0);
142141

143-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
142+
expect(validateParam(node, control.json)).toBeTruthy();
144143
});
145144
});
146145
describe('NextIteration', () => {
@@ -159,7 +158,7 @@ describe('control', () => {
159158
node.op = 'NextIteration';
160159
node.inputParams['tensor'] = createTensorAttr(0);
161160

162-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
161+
expect(validateParam(node, control.json)).toBeTruthy();
163162
});
164163
});
165164

@@ -189,7 +188,7 @@ describe('control', () => {
189188
node.attrParams['clearAfterRead'] = createBoolAttr(true);
190189
node.attrParams['identicalElementShapes'] = createBoolAttr(true);
191190

192-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
191+
expect(validateParam(node, control.json)).toBeTruthy();
193192
});
194193
});
195194

@@ -215,7 +214,7 @@ describe('control', () => {
215214
node.inputParams['index'] = createNumberAttrFromIndex(1);
216215
node.inputParams['tensor'] = createTensorAttr(2);
217216

218-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
217+
expect(validateParam(node, control.json)).toBeTruthy();
219218
});
220219
});
221220

@@ -242,7 +241,7 @@ describe('control', () => {
242241
node.inputParams['tensorArrayId'] = createNumberAttrFromIndex(0);
243242
node.inputParams['index'] = createNumberAttrFromIndex(1);
244243

245-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
244+
expect(validateParam(node, control.json)).toBeTruthy();
246245
});
247246
});
248247

@@ -273,7 +272,7 @@ describe('control', () => {
273272
node.inputParams['indices'] = createNumericArrayAttrFromIndex(1);
274273
node.attrParams['dtype'] = createDtypeAttr('int32');
275274

276-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
275+
expect(validateParam(node, control.json)).toBeTruthy();
277276
});
278277
});
279278

@@ -301,7 +300,7 @@ describe('control', () => {
301300
node.inputParams['indices'] = createNumericArrayAttrFromIndex(1);
302301
node.inputParams['tensor'] = createTensorAttr(2);
303302

304-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
303+
expect(validateParam(node, control.json)).toBeTruthy();
305304
});
306305
});
307306

@@ -328,7 +327,7 @@ describe('control', () => {
328327
node.inputParams['tensor'] = createTensorAttr(1);
329328
node.inputParams['lengths'] = createNumericArrayAttrFromIndex(2);
330329

331-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
330+
expect(validateParam(node, control.json)).toBeTruthy();
332331
});
333332
});
334333

@@ -356,7 +355,7 @@ describe('control', () => {
356355
node.inputParams['tensorArrayId'] = createNumberAttrFromIndex(0);
357356
node.attrParams['dtype'] = createDtypeAttr('int32');
358357

359-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
358+
expect(validateParam(node, control.json)).toBeTruthy();
360359
});
361360
});
362361

@@ -381,7 +380,7 @@ describe('control', () => {
381380
node.op = 'TensorArraySizeV3';
382381
node.inputParams['tensorArrayId'] = createNumberAttrFromIndex(0);
383382

384-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
383+
expect(validateParam(node, control.json)).toBeTruthy();
385384
});
386385
});
387386

@@ -404,7 +403,7 @@ describe('control', () => {
404403
node.op = 'TensorArrayCloseV3';
405404
node.inputParams['tensorArrayId'] = createNumberAttrFromIndex(0);
406405

407-
expect(validateParam(node, control.json as OpMapper[])).toBeTruthy();
406+
expect(validateParam(node, control.json)).toBeTruthy();
408407
});
409408
});
410409
});

tfjs-converter/src/operations/executors/convolution_executor_test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {ExecutionContext} from '../../executor/execution_context';
2020
import {Node} from '../types';
2121

2222
import {executeOp} from './convolution_executor';
23-
// tslint:disable-next-line:max-line-length
2423
import {createNumberAttr, createNumericArrayAttr, createStrArrayAttr, createStrAttr, createTensorAttr, createTensorsAttr} from './test_helper';
2524

2625
describe('convolution', () => {

0 commit comments

Comments
 (0)