Skip to content

Commit 483623f

Browse files
eneufeldedgarmueller
authored andcommitted
Fixed lint issues
1 parent eecd97f commit 483623f

File tree

8 files changed

+70
-71
lines changed

8 files changed

+70
-71
lines changed

packages/core/src/reducers/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
THE SOFTWARE.
2424
*/
25-
import { combineReducers, Reducer } from 'redux';
26-
import * as _ from 'lodash';
27-
import { JsonFormsRendererRegistryEntry, rendererReducer } from './renderers';
28-
import { fieldReducer } from './fields';
29-
import { configReducer } from './config';
3025
import {
3126
defaultDataReducer,
3227
extractDefaultData,
3328
JsonFormsDefaultDataRegistryEntry
3429
} from './default-data';
30+
import { combineReducers, Reducer } from 'redux';
31+
import { JsonFormsRendererRegistryEntry, rendererReducer } from './renderers';
32+
import { fieldReducer } from './fields';
33+
import { configReducer } from './config';
34+
import * as _ from 'lodash';
3535
import {
3636
coreReducer,
3737
errorAt,
@@ -50,8 +50,8 @@ import { ControlElement, Generate, JsonSchema, UISchemaElement } from '..';
5050
import {
5151
fetchLocale,
5252
findLocalizedSchema,
53-
i18nReducer,
54-
findLocalizedUISchema
53+
findLocalizedUISchema,
54+
i18nReducer
5555
} from './i18n';
5656

5757
export { rendererReducer, fieldReducer, coreReducer, UISchemaTester };

packages/core/src/testers/index.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,31 @@ export const isObjectArrayControl = and(
360360
schemaSubPathMatches('items', schema => schema.type === 'object')
361361
);
362362

363+
const traverse = (
364+
any: JsonSchema | JsonSchema[],
365+
pred: (obj: JsonSchema) => boolean
366+
): boolean => {
367+
if (_.isArray(any)) {
368+
return _.reduce(any, (acc, el) => acc || traverse(el, pred), false);
369+
}
370+
371+
if (pred(any)) {
372+
return true;
373+
}
374+
if (any.items) {
375+
return traverse(any.items, pred);
376+
}
377+
if (any.properties) {
378+
return _.reduce(
379+
_.toPairs(any.properties),
380+
(acc, [_key, val]) => acc || traverse(val, pred),
381+
false
382+
);
383+
}
384+
385+
return false;
386+
};
387+
363388
export const isObjectArrayWithNesting = (
364389
uischema: UISchemaElement,
365390
schema: JsonSchema
@@ -412,31 +437,6 @@ export const isObjectArrayWithNesting = (
412437
return false;
413438
};
414439

415-
const traverse = (
416-
any: JsonSchema | JsonSchema[],
417-
pred: (obj: JsonSchema) => boolean
418-
): boolean => {
419-
if (_.isArray(any)) {
420-
return _.reduce(any, (acc, el) => acc || traverse(el, pred), false);
421-
}
422-
423-
if (pred(any)) {
424-
return true;
425-
}
426-
if (any.items) {
427-
return traverse(any.items, pred);
428-
}
429-
if (any.properties) {
430-
return _.reduce(
431-
_.toPairs(any.properties),
432-
(acc, [_key, val]) => acc || traverse(val, pred),
433-
false
434-
);
435-
}
436-
437-
return false;
438-
};
439-
440440
/**
441441
* Synonym for isObjectArrayControl
442442
*/

packages/core/src/util/field.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,6 @@ export interface DispatchFieldStateProps extends FieldProps {
8585
fields?: JsonFormsFieldRendererRegistryEntry[];
8686
}
8787

88-
export const mapStateToDispatchFieldProps = (
89-
state: JsonFormsState,
90-
ownProps: OwnPropsOfField
91-
): DispatchFieldStateProps => {
92-
const props: StatePropsOfField = mapStateToFieldProps(state, ownProps);
93-
return {
94-
...props,
95-
...ownProps,
96-
fields: state.jsonforms.fields || []
97-
};
98-
};
99-
100-
export interface DispatchFieldProps extends DispatchFieldStateProps {
101-
showError: boolean;
102-
}
103-
10488
/**
10589
* Map state to field props.
10690
*
@@ -145,6 +129,22 @@ export const mapStateToFieldProps = (
145129
};
146130
};
147131

132+
export const mapStateToDispatchFieldProps = (
133+
state: JsonFormsState,
134+
ownProps: OwnPropsOfField
135+
): DispatchFieldStateProps => {
136+
const props: StatePropsOfField = mapStateToFieldProps(state, ownProps);
137+
return {
138+
...props,
139+
...ownProps,
140+
fields: state.jsonforms.fields || []
141+
};
142+
};
143+
144+
export interface DispatchFieldProps extends DispatchFieldStateProps {
145+
showError: boolean;
146+
}
147+
148148
/**
149149
* Default mapStateToFieldProps for enum field. Options is used for populating dropdown list
150150
* @param state

packages/core/src/util/ids.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
const usedIds: Set<string> = new Set<string>();
22

3+
const makeId = (idBase: string, iteration: number) =>
4+
iteration <= 1 ? idBase : idBase + iteration.toString();
5+
6+
const isUniqueId = (idBase: string, iteration: number) => {
7+
const newID = makeId(idBase, iteration);
8+
return !usedIds.has(newID);
9+
};
10+
311
export const createId = (proposedId: string) => {
412
if (proposedId === undefined) {
513
// failsafe to avoid endless loops in error cases
@@ -16,12 +24,4 @@ export const createId = (proposedId: string) => {
1624

1725
export const removeId = (id: string) => usedIds.delete(id);
1826

19-
const isUniqueId = (idBase: string, iteration: number) => {
20-
const newID = makeId(idBase, iteration);
21-
return !usedIds.has(newID);
22-
};
23-
24-
const makeId = (idBase: string, iteration: number) =>
25-
iteration <= 1 ? idBase : idBase + iteration;
26-
2727
export const clearAllIds = () => usedIds.clear();

packages/core/src/util/runtime.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ const getConditionScope = (condition: Scopable, path: string): string => {
6060
return composeWithUi(condition, path);
6161
};
6262

63-
const isRuleFulfilled = (
64-
uischema: UISchemaElement,
65-
data: any,
66-
path: string
67-
): boolean => {
68-
const condition = uischema.rule.condition;
69-
return evaluateCondition(data, condition, path);
70-
};
7163
const evaluateCondition = (
7264
data: any,
7365
condition: Condition,
@@ -95,6 +87,15 @@ const evaluateCondition = (
9587
}
9688
};
9789

90+
const isRuleFulfilled = (
91+
uischema: UISchemaElement,
92+
data: any,
93+
path: string
94+
): boolean => {
95+
const condition = uischema.rule.condition;
96+
return evaluateCondition(data, condition, path);
97+
};
98+
9899
export const evalVisibility = (
99100
uischema: UISchemaElement,
100101
data: any,

packages/material-tree-renderer/src/services/property.util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const resolveAndMakeSchemaSelfContained = (
159159
return {
160160
...schema,
161161
...makeSchemaSelfContained(parentSchema, schema)
162-
} as JsonSchema7;
162+
};
163163
};
164164

165165
/**

packages/vanilla/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ import {
6969
} from './layouts';
7070
import DateTimeField from './fields/DateTimeField';
7171

72+
export interface WithClassname {
73+
className?: string;
74+
}
75+
7276
/**
7377
* Additional renderer props specific to vanilla renderers.
7478
*/
@@ -95,10 +99,6 @@ export interface WithChildren {
9599
children: any;
96100
}
97101

98-
export interface WithClassname {
99-
className?: string;
100-
}
101-
102102
export * from './controls';
103103
export * from './complex';
104104
export * from './fields';

tslint.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"no-unsafe-any": false,
6464
"no-unsafe-finally": true,
6565
"no-unused-expression": true,
66-
"no-unused-variable": true,
6766
"no-use-before-declare": true,
6867
"no-var-keyword": true,
6968
"radix": true,
@@ -74,7 +73,6 @@
7473
true,
7574
"allow-null-check"
7675
],
77-
"typeof-compare": true,
7876
"use-isnan": true,
7977

8078

0 commit comments

Comments
 (0)