Skip to content

Commit

Permalink
fix all errors and warnings from eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Jan 27, 2024
1 parent 10fdb85 commit 45aa7a6
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
"browser": true,
"es2020": true
},
"ignorePatterns" :["coverage", "dist"],
"rules": {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
2 changes: 1 addition & 1 deletion src/components/BrainScaleSConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function BrainScaleSConfig(props) {
variant="outlined"
value={formatArray(props.config.HICANN)}
onChange={(event) => handleChange("HICANN", event.target.value)}
onBlur={(event) => removeEmptyItems("HICANN")}
onBlur={() => removeEmptyItems("HICANN")}
/>
<TextField
id="bss-config-fpga"
Expand Down
24 changes: 12 additions & 12 deletions src/components/CodeWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ function validURL(value) {
return value.startsWith("http"); // todo: use a regex
}

function getPathFromDriveURI(uri, collab) {
if (uri.startsWith("drive:")) {
const prefix = `drive://${collab}`;
return uri.substring(prefix.length + 1);
} else if (uri.length > 0) {
console.warn("Expected 'drive:' URL, got " + uri);
}
return uri;
}

function EditorSizeButtons({ currentHeight, setHeight }) {
let buttons = [
<Tooltip key="larger-editor-button" title="Increase editor size">
Expand Down Expand Up @@ -67,26 +77,16 @@ function CodeWidget(props) {
props.onChange(`drive://${props.collab}/${value}`);
};

const getPathFromDriveURI = (uri) => {
if (uri.startsWith("drive:")) {
const prefix = `drive://${props.collab}`;
return uri.substring(prefix.length + 1);
} else if (uri.length > 0) {
console.warn("Expected 'drive:' URL, got " + uri);
}
return uri;
};

useEffect(() => {
if (props.initialTab === "editor") {
setCodeFromEditor(props.code || "");
} else if (props.initialTab === "from-url") {
setCodeURL(props.code || "");
} else if (props.initialTab === "drive") {
setCodeFromDrive(getPathFromDriveURI(props.code) || "");
setCodeFromDrive(getPathFromDriveURI(props.code, props.collab) || "");
}
setCurrentTab(props.initialTab);
}, [props.initialTab, props.code]);
}, [props.initialTab, props.code, props.collab]);

return (
<Box
Expand Down
2 changes: 1 addition & 1 deletion src/components/CreateJobForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function CreateJobForm(props) {
setTags(tags.map((item) => item.trim()).filter((item) => item.length > 0));
};

const handleSubmit = (event) => {
const handleSubmit = () => {
const newJob = {
hardware_platform: hardware,
code: code,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DriveBrowser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function DriveBrowser(props) {
setLoading(false);
}
fetchData();
}, [props.collab, path]);
}, [props.collab, path, auth]);

// todo: only show .py, .tar, .tar.gz, .tgz, .zip files

Expand Down
6 changes: 3 additions & 3 deletions src/components/Introduction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Container from "@mui/material/Container";
import Link from "@mui/material/Link";

function Introduction() {
{
Expand All @@ -29,8 +28,9 @@ function Introduction() {
</Typography>
<Typography variant="h6" align="center" color="text.secondary" paragraph>
If you or your colleagues have already run neuromorphic jobs in EBRAINS, you will see
below a list of workspaces ("collabs") that contain neuromorphic results. If this is your
first time using the EBRAINS neuromorphic systems, click on "Getting started".
below a list of workspaces (&ldquo;collabs&rdquo;) that contain neuromorphic results. If
this is your first time using the EBRAINS neuromorphic systems, click on &ldquo;Getting
started&rdquo;.
</Typography>
<Stack sx={{ pt: 4 }} direction="row" spacing={2} justifyContent="center">
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/components/JobDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function JobDetail(props) {
}, 5000);
return () => clearInterval(intervalID);
}
}, [props]);
}, [props, job, revalidator]);

const handleDeleteTag = async (tag) => {
console.log(tag);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Preview(props) {
if (props.url && props.open) {
fetchData(props.url, props.content_type, props.size);
}
}, [props.url]);
}, [props.url, props.content_type, props.open, props.size]);

const handleClose = () => {
props.onClose();
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function ProjectList(props) {
if (fetcher.data && selectedProject) {
fetcher.load();
}
}, [fetcher.data]);
}, [fetcher.data, fetcher, selectedProject]);

const handleCloseEditDialog = (projectUpdate) => {
if (projectUpdate) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/SpiNNakerConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function SpiNNakerConfig(props) {
variant="outlined"
value={formatArray(props.config.extra_pip_installs)}
onChange={(event) => handleChange("extra_pip_installs", event.target.value)}
onBlur={(event) => removeEmptyItems("extra_pip_installs")}
onBlur={() => removeEmptyItems("extra_pip_installs")}
/>
<TextField
id="spinn-config-extra_git_repositories"
Expand All @@ -74,7 +74,7 @@ function SpiNNakerConfig(props) {
variant="outlined"
value={formatArray(props.config.extra_git_repositories)}
onChange={(event) => handleChange("extra_git_repositories", event.target.value)}
onBlur={(event) => removeEmptyItems("extra_git_repositories")}
onBlur={() => removeEmptyItems("extra_git_repositories")}
/>
<TextField
id="spinn-config-extra_makes"
Expand All @@ -84,7 +84,7 @@ function SpiNNakerConfig(props) {
variant="outlined"
value={formatArray(props.config.extra_makes)}
onChange={(event) => handleChange("extra_makes", event.target.value)}
onBlur={(event) => removeEmptyItems("extra_makes")}
onBlur={() => removeEmptyItems("extra_makes")}
/>
<TextField
id="spinn-config-extra-python-setups"
Expand All @@ -94,7 +94,7 @@ function SpiNNakerConfig(props) {
variant="outlined"
value={formatArray(props.config.extra_python_setups)}
onChange={(event) => handleChange("extra_python_setups", event.target.value)}
onBlur={(event) => removeEmptyItems("extra_python_setups")}
onBlur={() => removeEmptyItems("extra_python_setups")}
/>
<TextField
id="spinn-config-pyNN_version"
Expand Down
4 changes: 2 additions & 2 deletions src/routes/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getLoader(auth) {
return loader;
}

function Home(props) {
function Home() {
const data = useLoaderData();
const navigate = useNavigate();
const requestedCollabId = useContext(RequestedCollabContext);
Expand All @@ -34,7 +34,7 @@ function Home(props) {
if (requestedCollabId) {
navigate(`/${requestedCollabId}/jobs/`);
}
}, [requestedCollabId]);
}, [requestedCollabId, navigate]);

return (
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/job-creation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function submitJob(auth) {
const { collabId } = params;
const jobData = await request.json();
if (request.method === "POST") {
const response = await createJob(collabId, jobData, auth);
await createJob(collabId, jobData, auth);
return redirect(`/${collabId}/jobs/`);
} else {
throw new Error("unexpected request method");
Expand All @@ -22,7 +22,7 @@ function submitJob(auth) {
return wrappedSubmitJob;
}

function JobCreationRoute(props) {
function JobCreationRoute() {
let { collabId } = useParams();

return (
Expand Down

0 comments on commit 45aa7a6

Please sign in to comment.