diff --git a/package.json b/package.json
index 666fd164..0dc10d05 100644
--- a/package.json
+++ b/package.json
@@ -152,6 +152,6 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.0",
- "prettier": "2.1.1"
+ "prettier": "2.7.1"
}
}
diff --git a/src/Components/Form.js b/src/Components/Form.js
index 5b529e09..a177929f 100644
--- a/src/Components/Form.js
+++ b/src/Components/Form.js
@@ -1,25 +1,39 @@
import React, { useMemo, useContext, createContext } from 'react';
+import PropTypes from 'prop-types';
const FormContext = createContext(undefined);
const Form = ({ data, onChange, children, ...props }) => {
- const context = useMemo(() => ({
- data,
- onChange
- }), [data, onChange]);
+ const context = useMemo(
+ () => ({
+ data,
+ onChange,
+ }),
+ [data, onChange]
+ );
// we spread the extra props on the form so the caller can apply classes and other properties to
// the form element
return (
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
-
+
);
};
+Form.propTypes = {
+ // eslint-disable-next-line react/forbid-prop-types
+ data: PropTypes.object.isRequired,
+ onChange: PropTypes.func,
+ children: Promise.node,
+};
+
+Form.defaultProps = {
+ onChange: null,
+ children: null,
+};
+
const useForm = () => {
const context = useContext(FormContext);
@@ -32,6 +46,4 @@ const useForm = () => {
export default Form;
-export {
- useForm,
-};
+export { useForm };
diff --git a/src/Components/FormField.js b/src/Components/FormField.js
index 81579f0b..99a2e3ac 100644
--- a/src/Components/FormField.js
+++ b/src/Components/FormField.js
@@ -6,6 +6,7 @@ import FormInput from './FormInput';
import FormTextArea from './FormTextArea';
import { useForm } from './Form';
+// prettier-ignore
export default function FormField({ metadata, ...props }) {
const { data, onChange } = useForm();
const { name: property, type, label, required } = metadata;
@@ -16,10 +17,10 @@ export default function FormField({ metadata, ...props }) {
value,
required,
onChange,
- validationState: data.getValidationState(property)
+ validationState: data.getValidationState(property),
};
- switch (type) {
+ switch (type) {
case 'integer':
case 'decimal': {
const { unit = metadata.unit, range = metadata.range, size = 'small' } = props;
diff --git a/src/EMS/PatientFields.js b/src/EMS/PatientFields.js
index 1b7df8f3..d42a7ea3 100644
--- a/src/EMS/PatientFields.js
+++ b/src/EMS/PatientFields.js
@@ -16,15 +16,13 @@ const Patient = patient.getFieldHash();
function createOptions(ids) {
return ids.map((id) => (
-
));
}
+// prettier-ignore
function PatientFields({ ringdown, onChange }) {
const [ambulanceIds, setAmbulanceIds] = useState([]);
const [dispatchCallNumbers, setDispatchCallNumbers] = useState([]);
diff --git a/src/EMS/RingdownForm.js b/src/EMS/RingdownForm.js
index 6d3ee1bd..4643cf20 100644
--- a/src/EMS/RingdownForm.js
+++ b/src/EMS/RingdownForm.js
@@ -10,10 +10,10 @@ import Spinner from '../Components/Spinner';
import RingdownCard from '../Components/RingdownCard';
import Heading from '../Components/Heading';
import Alert from '../Components/Alert';
+import Form from '../Components/Form';
import HospitalSelection from './HospitalSelection';
import PatientFields from './PatientFields';
import RingdownStatus from './RingdownStatus';
-import Form from '../Components/Form';
function RingdownForm({ className }) {
const { ringdowns, setRingdowns } = useContext(Context);
@@ -94,6 +94,7 @@ function RingdownForm({ className }) {
setRingdowns([...ringdowns]);
}
+ // prettier-ignore
return (
<>
{ringdowns && ringdowns.length === 0 && (
diff --git a/src/metadata/patient.js b/src/metadata/patient.js
index 030d40b6..80c2f703 100644
--- a/src/metadata/patient.js
+++ b/src/metadata/patient.js
@@ -101,7 +101,7 @@ const fields = [
{
name: 'treatmentNotes',
type: 'text',
- label: 'Treatments Administered'
+ label: 'Treatments Administered',
},
{
name: 'etohSuspectedIndicator',
diff --git a/yarn.lock b/yarn.lock
index 3f1a53ae..6f8e9055 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10174,10 +10174,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
-prettier@2.1.1:
- version "2.1.1"
- resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6"
- integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==
+prettier@2.7.1:
+ version "2.7.1"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
+ integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==
pretty-bytes@^5.1.0:
version "5.3.0"