Skip to content

Commit 28d3b1f

Browse files
Added support for node 16, formatting and linting (semantic-ui) (rjsf-team#2939)
- Regenerated the `package-lock.json` file with node-16 - Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file - Ran `cs-format` over the `src` and `test` directories to fix the build
1 parent 7346cb8 commit 28d3b1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+165583
-18518
lines changed

packages/semantic-ui/package-lock.json

Lines changed: 165217 additions & 18170 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/semantic-ui/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@
2020
"scripts": {
2121
"build": "rimraf dist && tsdx build --format cjs,es,umd",
2222
"lint": "eslint src test",
23+
"cs-check": "prettier -l \"{src,test}/**/*.js\"",
24+
"cs-format": "prettier \"{src,test}/**/*.js\" --write",
25+
"lint": "eslint src test",
2326
"test": "tsdx test",
2427
"test:update": "tsdx test --u"
2528
},
29+
"lint-staged": {
30+
"{src,test}/**/*.js": [
31+
"eslint --fix",
32+
"prettier --write"
33+
]
34+
},
2635
"peerDependencies": {
2736
"@rjsf/core": "^4.2.0",
2837
"@rjsf/utils": "^4.2.0",
@@ -43,7 +52,6 @@
4352
"@rjsf/utils": "^4.2.0",
4453
"@rjsf/validator-ajv6": "^4.2.0",
4554
"atob": "^2.0.3",
46-
"babel-eslint": "^10.1.0",
4755
"eslint": "^8.19.0",
4856
"eslint-config-react-app": "^7.0.1",
4957
"eslint-plugin-flowtype": "^8.0.3",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* eslint-disable import/export */
2-
export { default } from './AddButton';
3-
export * from './AddButton';
2+
export { default } from "./AddButton";
3+
export * from "./AddButton";

packages/semantic-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable react/prop-types,react/destructuring-assignment */
22
import React from "react";
33
import { Button, Grid, Segment } from "semantic-ui-react";
4-
import { isFixedItems, getUiOptions } from '@rjsf/utils';
4+
import { isFixedItems, getUiOptions } from "@rjsf/utils";
55

66
import AddButton from "../AddButton";
77
import { cleanClassNames, getSemanticProps, MaybeWrap } from "../util";
@@ -46,7 +46,8 @@ function DefaultArrayItem(props) {
4646
!isInitialArrayItem(props)
4747
? { ...gridStyle(!props.horizontalButtons), alignItems: "center" }
4848
: gridStyle(!props.horizontalButtons)
49-
}>
49+
}
50+
>
5051
<Grid.Column width={16} verticalAlign="middle">
5152
{props.children}
5253
</Grid.Column>
@@ -140,7 +141,8 @@ function DefaultFixedArrayFieldTemplate({
140141
{fieldDescription && (
141142
<div
142143
className="field-description"
143-
key={`field-description-${idSchema.$id}`}>
144+
key={`field-description-${idSchema.$id}`}
145+
>
144146
{fieldDescription}
145147
</div>
146148
)}
@@ -156,7 +158,8 @@ function DefaultFixedArrayFieldTemplate({
156158
marginTop: "1rem",
157159
position: "relative",
158160
textAlign: "right",
159-
}}>
161+
}}
162+
>
160163
<AddButton onClick={onAddClick} disabled={disabled || readOnly} />
161164
</div>
162165
)}
@@ -191,7 +194,8 @@ function DefaultNormalArrayFieldTemplate({
191194
className,
192195
classNames,
193196
"sortable-form-fields",
194-
])}>
197+
])}
198+
>
195199
<ArrayFieldTitle
196200
key={`array-field-title-${idSchema.$id}`}
197201
TitleField={TitleField}
@@ -221,7 +225,8 @@ function DefaultNormalArrayFieldTemplate({
221225
marginTop: "1rem",
222226
position: "relative",
223227
textAlign: "right",
224-
}}>
228+
}}
229+
>
225230
<AddButton onClick={onAddClick} disabled={disabled || readOnly} />
226231
</div>
227232
)}
@@ -231,17 +236,14 @@ function DefaultNormalArrayFieldTemplate({
231236
}
232237

233238
function ArrayFieldTemplate(props) {
234-
const { options,
235-
schema,
236-
uiSchema,
237-
formContext, } = props;
239+
const { options, schema, uiSchema, formContext } = props;
238240
const semanticProps = getSemanticProps({
239-
options,
240-
uiSchema,
241-
formContext,
242-
defaultSchemaProps: { horizontalButtons : false, wrapItem : false }
241+
options,
242+
uiSchema,
243+
formContext,
244+
defaultSchemaProps: { horizontalButtons: false, wrapItem: false },
243245
});
244-
const { horizontalButtons, wrapItem } = semanticProps;
246+
const { horizontalButtons, wrapItem } = semanticProps;
245247
const itemProps = { horizontalButtons, wrapItem };
246248

247249
if (isFixedItems(schema)) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* eslint-disable import/export */
2-
export { default } from './ArrayFieldTemplate';
3-
export * from './ArrayFieldTemplate';
2+
export { default } from "./ArrayFieldTemplate";
3+
export * from "./ArrayFieldTemplate";

packages/semantic-ui/src/CheckboxWidget/CheckboxWidget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function CheckboxWidget(props) {
2929
defaultSchemaProps: {
3030
inverted: false,
3131
},
32-
});
32+
});
3333
const { schemaUtils } = registry;
3434
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
3535
const _onChange = (event, data) => onChange && onChange(data.checked);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* eslint-disable import/export */
2-
export { default } from './CheckboxWidget';
3-
export * from './CheckboxWidget';
2+
export { default } from "./CheckboxWidget";
3+
export * from "./CheckboxWidget";

packages/semantic-ui/src/CheckboxesWidget/CheckboxesWidget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function CheckboxesWidget(props) {
4141
defaultSchemaProps: {
4242
inverted: false,
4343
},
44-
});
44+
});
4545
const _onChange = option => ({ target: { checked } }) => {
4646
// eslint-disable-next-line no-shadow
4747
const all = enumOptions.map(({ value }) => value);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* eslint-disable import/export */
2-
export { default } from './CheckboxesWidget';
3-
export * from './CheckboxesWidget';
2+
export { default } from "./CheckboxesWidget";
3+
export * from "./CheckboxesWidget";

packages/semantic-ui/src/DateTimeWidget/DateTimeWidget.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ import { getSemanticProps } from "../util";
66

77
function DateTimeWidget(props) {
88
const {
9-
id,
10-
required,
11-
readonly,
12-
disabled,
13-
name,
14-
label,
15-
schema,
16-
uiSchema,
17-
value,
18-
onChange,
19-
onBlur,
20-
onFocus,
21-
autofocus,
22-
options,
23-
formContext,
9+
id,
10+
required,
11+
readonly,
12+
disabled,
13+
name,
14+
label,
15+
schema,
16+
uiSchema,
17+
value,
18+
onChange,
19+
onBlur,
20+
onFocus,
21+
autofocus,
22+
options,
23+
formContext,
2424
} = props;
2525
const semanticProps = getSemanticProps({
2626
uiSchema,
2727
schema,
2828
formContext,
2929
options,
3030
});
31-
const _onChange = ({ target: { value } }) => onChange && onChange(localToUTC(value));
31+
const _onChange = ({ target: { value } }) =>
32+
onChange && onChange(localToUTC(value));
3233
const _onBlur = () => onBlur && onBlur(id, value);
3334
const _onFocus = () => onFocus && onFocus(id, value);
3435
const dateValue = utcToLocal(value);
@@ -39,20 +40,20 @@ function DateTimeWidget(props) {
3940
);
4041
return (
4142
<Form.Input
42-
key={id}
43-
id={id}
44-
type="datetime-local"
45-
label={displayLabel ? label || schema.title : false}
46-
required={required}
47-
autoFocus={autofocus}
48-
disabled={disabled || readonly}
49-
name={name}
50-
{...semanticProps}
51-
value={dateValue}
52-
onChange={_onChange}
53-
onBlur={_onBlur}
54-
onFocus={_onFocus}
55-
/>
43+
key={id}
44+
id={id}
45+
type="datetime-local"
46+
label={displayLabel ? label || schema.title : false}
47+
required={required}
48+
autoFocus={autofocus}
49+
disabled={disabled || readonly}
50+
name={name}
51+
{...semanticProps}
52+
value={dateValue}
53+
onChange={_onChange}
54+
onBlur={_onBlur}
55+
onFocus={_onFocus}
56+
/>
5657
);
5758
}
5859
export default DateTimeWidget;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default } from './DateTimeWidget';
2-
export * from './DateTimeWidget';
1+
export { default } from "./DateTimeWidget";
2+
export * from "./DateTimeWidget";

packages/semantic-ui/src/DateWidget/DateWidget.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ function DateWidget(props) {
3535
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
3636
return (
3737
<Form.Input
38-
key={id}
39-
id={id}
40-
type="date"
41-
label={displayLabel ? label || schema.title : false}
42-
required={required}
43-
autoFocus={autofocus}
44-
disabled={disabled || readonly}
45-
name={name}
46-
{...semanticProps}
47-
value={value || value === 0 ? value : ""}
48-
onChange={_onChange}
49-
onBlur={_onBlur}
50-
onFocus={_onFocus}
51-
/>
38+
key={id}
39+
id={id}
40+
type="date"
41+
label={displayLabel ? label || schema.title : false}
42+
required={required}
43+
autoFocus={autofocus}
44+
disabled={disabled || readonly}
45+
name={name}
46+
{...semanticProps}
47+
value={value || value === 0 ? value : ""}
48+
onChange={_onChange}
49+
onBlur={_onBlur}
50+
onFocus={_onFocus}
51+
/>
5252
);
5353
}
5454
export default DateWidget;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default } from './DateWidget';
2-
export * from './DateWidget';
1+
export { default } from "./DateWidget";
2+
export * from "./DateWidget";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* eslint-disable import/export */
2-
export { default } from './DescriptionField';
3-
export * from './DescriptionField';
2+
export { default } from "./DescriptionField";
3+
export * from "./DescriptionField";

packages/semantic-ui/src/EmailWidget/EmailWidget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function EmailWidget(props) {
2626
uiSchema,
2727
formContext,
2828
options,
29-
});
29+
});
3030
const { schemaUtils } = registry;
3131
// eslint-disable-next-line no-shadow
3232
const _onChange = ({ target: { value } }) =>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default } from './EmailWidget';
2-
export * from './EmailWidget';
1+
export { default } from "./EmailWidget";
2+
export * from "./EmailWidget";
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* eslint-disable import/export */
2-
export { default } from './ErrorList';
3-
export * from './ErrorList';
2+
export { default } from "./ErrorList";
3+
export * from "./ErrorList";

packages/semantic-ui/src/FieldTemplate/FieldTemplate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { Form } from "semantic-ui-react";
44
import DescriptionField from "../DescriptionField";
55
import HelpField from "../HelpField";
66
import RawErrors from "../RawErrors";
7-
import WrapIfAdditional from './WrapIfAdditional';
8-
import { getSemanticProps,getSemanticErrorProps, MaybeWrap } from "../util";
7+
import WrapIfAdditional from "./WrapIfAdditional";
8+
import { getSemanticProps, getSemanticErrorProps, MaybeWrap } from "../util";
99

1010
function FieldTemplate({
1111
id,

0 commit comments

Comments
 (0)