Skip to content

Commit ba7ea9c

Browse files
eneufeldedgarmueller
authored andcommittedJun 5, 2019
Fix Lint errors
1 parent 4a3bb3b commit ba7ea9c

30 files changed

+1055
-860
lines changed
 

‎packages/angular-material/example/app/app.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { BrowserModule } from '@angular/platform-browser';
2626
import { CUSTOM_ELEMENTS_SCHEMA, isDevMode, NgModule } from '@angular/core';
2727
import { DevToolsExtension, NgRedux } from '@angular-redux/store';
2828
import { Actions, JsonFormsState, UISchemaTester } from '@jsonforms/core';
29-
import { TranslationModule, LocaleValidationModule } from 'angular-l10n';
29+
import { LocaleValidationModule, TranslationModule } from 'angular-l10n';
3030
import { AppComponent } from './app.component';
3131
import { JsonFormsAngularMaterialModule } from '../../src/module';
3232

‎packages/core/src/reducers/core.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,19 @@ const getRefParserOptions = (
122122
return state.refParserOptions;
123123
};
124124

125-
function hasRefParserOption(option: any): option is InitActionOptions {
125+
const hasRefParserOption = (option: any): option is InitActionOptions => {
126126
if (option) {
127127
return option.refParserOptions !== undefined;
128128
}
129129
return false;
130-
}
130+
};
131131

132-
function hasAjvOption(option: any): option is InitActionOptions {
132+
const hasAjvOption = (option: any): option is InitActionOptions => {
133133
if (option) {
134134
return option.ajv !== undefined;
135135
}
136136
return false;
137-
}
137+
};
138138

139139
export const coreReducer = (
140140
state: JsonFormsCore = initState,

‎packages/core/src/util/resolvers.ts

+40-40
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,18 @@ function retrieveResolvableSchema(
188188
// copied and adapted from JsonRefs
189189

190190
export const findRefs = (obj: any) => {
191-
var refs = {} as any;
191+
const refs = {} as any;
192192

193193
// Validate the provided document
194194
if (!isArray(obj) && !isObject(obj)) {
195195
throw new TypeError('obj must be an Array or an Object');
196196
}
197197

198198
// Walk the document (or sub document) and find all JSON References
199-
walk([], obj, [], function({}, node: any, path: any) {
200-
var processChildren = true;
201-
var refDetails;
202-
var refPtr;
199+
walk([], obj, [], ({}, node: any, path: any) => {
200+
let processChildren = true;
201+
let refDetails;
202+
let refPtr;
203203

204204
if (isRefLike(node, false)) {
205205
refDetails = getRefDetails(node);
@@ -225,14 +225,14 @@ export const findRefs = (obj: any) => {
225225

226226
// pure copy of JsonRefs (added types)
227227

228-
function walk(ancestors: any, node: any, path: any, fn: any) {
229-
var processChildren = true;
228+
const walk = (ancestors: any, node: any, path: any, fn: any) => {
229+
let processChildren = true;
230230

231-
function walkItem(item: any, segment: any) {
231+
const walkItem = (item: any, segment: any) => {
232232
path.push(segment);
233233
walk(ancestors, item, path, fn);
234234
path.pop();
235-
}
235+
};
236236

237237
// Call the iteratee
238238
if (isFunction(fn)) {
@@ -245,21 +245,21 @@ function walk(ancestors: any, node: any, path: any, fn: any) {
245245

246246
if (processChildren !== false) {
247247
if (isArray(node)) {
248-
node.forEach(function(member, index) {
248+
node.forEach((member, index) => {
249249
walkItem(member, index.toString());
250250
});
251251
} else if (isObject(node)) {
252-
forOwn(node, function(cNode, key) {
252+
forOwn(node, (cNode, key) => {
253253
walkItem(cNode, key);
254254
});
255255
}
256256
}
257257

258258
ancestors.pop();
259259
}
260-
}
260+
};
261261

262-
function pathToPtr(path: any, hashPrefix: any) {
262+
const pathToPtr = (path: any, hashPrefix: any) => {
263263
if (!isArray(path)) {
264264
throw new Error('path must be an Array');
265265
}
@@ -270,32 +270,32 @@ function pathToPtr(path: any, hashPrefix: any) {
270270
(path.length > 0 ? '/' : '') +
271271
encodePath(path).join('/')
272272
);
273-
}
273+
};
274274

275-
function encodePath(path: any) {
275+
const encodePath = (path: any) => {
276276
if (!isArray(path)) {
277277
throw new TypeError('path must be an array');
278278
}
279279

280-
return path.map(function(seg) {
280+
return path.map(seg => {
281281
if (!isString(seg)) {
282282
seg = JSON.stringify(seg);
283283
}
284284

285285
return seg.replace(/~/g, '~0').replace(/\//g, '~1');
286286
});
287-
}
287+
};
288288

289-
var uriDetailsCache = {} as any;
290-
var badPtrTokenRegex = /~(?:[^01]|$)/g;
289+
const uriDetailsCache = {} as any;
290+
const badPtrTokenRegex = /~(?:[^01]|$)/g;
291291

292-
function getRefDetails(obj: any) {
293-
var details = {
292+
const getRefDetails = (obj: any) => {
293+
const details = {
294294
def: obj
295295
} as any;
296-
var cacheKey;
297-
var extraKeys;
298-
var uriDetails;
296+
let cacheKey;
297+
let extraKeys;
298+
let uriDetails;
299299

300300
try {
301301
if (isRefLike(obj, true)) {
@@ -345,10 +345,10 @@ function getRefDetails(obj: any) {
345345
}
346346

347347
return details;
348-
}
348+
};
349349

350-
function getRefType(refDetails: any) {
351-
var type;
350+
const getRefType = (refDetails: any) => {
351+
let type;
352352

353353
// Convert the URI reference to one of our types
354354
switch (refDetails.uriDetails.reference) {
@@ -364,22 +364,22 @@ function getRefType(refDetails: any) {
364364
}
365365

366366
return type;
367-
}
367+
};
368368

369-
function getExtraRefKeys(ref: any) {
370-
return Object.keys(ref).filter(function(key) {
369+
const getExtraRefKeys = (ref: any) => {
370+
return Object.keys(ref).filter(key => {
371371
return key !== '$ref';
372372
});
373-
}
373+
};
374374

375-
function parseURI(uri: string) {
375+
const parseURI = (uri: string) => {
376376
// We decode first to avoid doubly encoding
377377
return parse(uri);
378-
}
378+
};
379379

380-
function isPtr(ptr: any, throwWithDetails: boolean) {
381-
var valid = true;
382-
var firstChar;
380+
const isPtr = (ptr: any, throwWithDetails: boolean) => {
381+
let valid = true;
382+
let firstChar;
383383

384384
try {
385385
if (isString(ptr)) {
@@ -406,10 +406,10 @@ function isPtr(ptr: any, throwWithDetails: boolean) {
406406
}
407407

408408
return valid;
409-
}
409+
};
410410

411-
function isRefLike(obj: any, throwWithDetails: boolean) {
412-
var refLike = true;
411+
const isRefLike = (obj: any, throwWithDetails: boolean) => {
412+
let refLike = true;
413413

414414
try {
415415
if (!isPlainObject(obj)) {
@@ -426,4 +426,4 @@ function isRefLike(obj: any, throwWithDetails: boolean) {
426426
}
427427

428428
return refLike;
429-
}
429+
};

‎packages/core/test/reducers/core.test.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ test('core reducer - no previous state - init with options object with ref parse
140140
}
141141
}
142142
};
143-
const myOptions = {
143+
const myOptions: RefParser.Options = {
144144
parse: {
145145
text: {
146146
encoding: 'testEncoding'
147147
}
148148
}
149-
} as RefParser.Options;
149+
};
150150
const after = coreReducer(
151151
undefined,
152152
init({}, schema, undefined, {
@@ -170,13 +170,13 @@ test('core reducer - no previous state - init with options object with ajv and r
170170
const myAjv = new AJV({
171171
errorDataPath: 'mypath'
172172
});
173-
const myOptions = {
173+
const myOptions: RefParser.Options = {
174174
parse: {
175175
text: {
176176
encoding: 'testEncoding'
177177
}
178178
}
179-
} as RefParser.Options;
179+
};
180180
const after = coreReducer(
181181
undefined,
182182
init({}, schema, undefined, {
@@ -201,13 +201,13 @@ test('core reducer - previous state - init without options should keep previous
201201
const myAjv = new AJV({
202202
errorDataPath: 'mypath'
203203
});
204-
const myOptions = {
204+
const myOptions: RefParser.Options = {
205205
parse: {
206206
text: {
207207
encoding: 'testEncoding'
208208
}
209209
}
210-
} as RefParser.Options;
210+
};
211211
const after = coreReducer(
212212
{
213213
data: {},
@@ -240,13 +240,13 @@ test('core reducer - previous state - init with ajv options object should overwr
240240
const newAjv = new AJV({
241241
errorDataPath: 'newajv'
242242
});
243-
const myOptions = {
243+
const myOptions: RefParser.Options = {
244244
parse: {
245245
text: {
246246
encoding: 'testEncoding'
247247
}
248248
}
249-
} as RefParser.Options;
249+
};
250250
const after = coreReducer(
251251
{
252252
data: {},
@@ -279,13 +279,13 @@ test('core reducer - previous state - init with options with ajv should overwrit
279279
const newAjv = new AJV({
280280
errorDataPath: 'newajv'
281281
});
282-
const myOptions = {
282+
const myOptions: RefParser.Options = {
283283
parse: {
284284
text: {
285285
encoding: 'testEncoding'
286286
}
287287
}
288-
} as RefParser.Options;
288+
};
289289
const after = coreReducer(
290290
{
291291
data: {},
@@ -317,20 +317,20 @@ test('core reducer - previous state - init with options with ref parser options
317317
const myAjv = new AJV({
318318
errorDataPath: 'mypath'
319319
});
320-
const previousOptions = {
320+
const previousOptions: RefParser.Options = {
321321
parse: {
322322
text: {
323323
encoding: 'testEncoding'
324324
}
325325
}
326-
} as RefParser.Options;
327-
const newOptions = {
326+
};
327+
const newOptions: RefParser.Options = {
328328
parse: {
329329
text: {
330330
encoding: 'newEncoding'
331331
}
332332
}
333-
} as RefParser.Options;
333+
};
334334
const after = coreReducer(
335335
{
336336
data: {},
@@ -365,20 +365,20 @@ test('core reducer - previous state - init with both options should overwrite bo
365365
const newAjv = new AJV({
366366
errorDataPath: 'newajv'
367367
});
368-
const previousOptions = {
368+
const previousOptions: RefParser.Options = {
369369
parse: {
370370
text: {
371371
encoding: 'testEncoding'
372372
}
373373
}
374-
} as RefParser.Options;
375-
const newOptions = {
374+
};
375+
const newOptions: RefParser.Options = {
376376
parse: {
377377
text: {
378378
encoding: 'newEncoding'
379379
}
380380
}
381-
} as RefParser.Options;
381+
};
382382
const after = coreReducer(
383383
{
384384
data: {},
@@ -411,13 +411,13 @@ test('core reducer - previous state - init with empty options should not overwri
411411
const myAjv = new AJV({
412412
errorDataPath: 'mypath'
413413
});
414-
const myOptions = {
414+
const myOptions: RefParser.Options = {
415415
parse: {
416416
text: {
417417
encoding: 'testEncoding'
418418
}
419419
}
420-
} as RefParser.Options;
420+
};
421421
const after = coreReducer(
422422
{
423423
data: {},

‎packages/core/test/util/renderer.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
THE SOFTWARE.
2424
*/
25+
import * as _ from 'lodash';
2526
import { init, update, UPDATE_DATA, UpdateAction } from '../../src/actions';
26-
import test from 'ava';
2727
import * as Redux from 'redux';
2828
import {
2929
clearAllIds,
@@ -36,16 +36,16 @@ import {
3636
mapStateToLayoutProps
3737
} from '../../src/util';
3838
import configureStore from 'redux-mock-store';
39-
import * as _ from 'lodash';
39+
import test from 'ava';
4040
import { generateDefaultUISchema } from '../../src/generators';
4141
import {
4242
ControlElement,
4343
coreReducer,
4444
JsonFormsState,
4545
JsonSchema,
46+
rankWith,
4647
RuleEffect,
47-
UISchemaElement,
48-
rankWith
48+
UISchemaElement
4949
} from '../../src';
5050
import { jsonformsReducer } from '../../src/reducers';
5151
import { ErrorObject } from 'ajv';

0 commit comments

Comments
 (0)
Failed to load comments.