fix eslint errors
parent
9757bf7561
commit
956d7b34ff
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:jest/recommended"
|
||||
],
|
||||
"parser": "@babel/eslint-parser",
|
||||
"parserOptions": {
|
||||
"requireConfigFile": false,
|
||||
"babelOptions": {
|
||||
"presets": ["@babel/preset-react"]
|
||||
},
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true,
|
||||
"jsx": true
|
||||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["react", "react-hooks", "jest"],
|
||||
"ignorePatterns": ["**/public"],
|
||||
"rules": {
|
||||
"indent": 0,
|
||||
"linebreak-style": 0,
|
||||
"quotes": 0,
|
||||
"semi": 0,
|
||||
"no-console": 0,
|
||||
"no-debugger": "warn",
|
||||
"react/display-name": "off",
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "warn",
|
||||
"no-unused-vars": [1, { "args": "after-used", "argsIgnorePattern": "^_" }]
|
||||
}
|
||||
}
|
|
@ -73,6 +73,25 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@babel/eslint-parser": {
|
||||
"version": "7.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz",
|
||||
"integrity": "sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1",
|
||||
"eslint-visitor-keys": "^2.1.0",
|
||||
"semver": "^6.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/generator": {
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.7.tgz",
|
||||
|
@ -2314,6 +2333,15 @@
|
|||
"@types/whatwg-streams": "^0.0.7"
|
||||
}
|
||||
},
|
||||
"@nicolo-ribaudo/eslint-scope-5-internals": {
|
||||
"version": "5.1.1-v1",
|
||||
"resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz",
|
||||
"integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"eslint-scope": "5.1.1"
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
"react-toastify": "^6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.16.5",
|
||||
"@testing-library/jest-dom": "^5.11.6",
|
||||
"@testing-library/react": "^11.2.2",
|
||||
"@testing-library/user-event": "^12.5.0",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import Layout from "./Layout";
|
||||
import { BrowserRouter, Switch, Redirect, Route } from "react-router-dom";
|
||||
import { useTuitioToken } from "@flare/tuitio-client-react";
|
||||
|
@ -28,6 +29,11 @@ const PrivateRoute = ({ component, ...rest }) => {
|
|||
);
|
||||
};
|
||||
|
||||
PrivateRoute.propTypes = {
|
||||
component: PropTypes.node.isRequired,
|
||||
location: PropTypes.string
|
||||
};
|
||||
|
||||
const PublicRoute = ({ component, ...rest }) => {
|
||||
const { valid } = useTuitioToken();
|
||||
return (
|
||||
|
@ -48,7 +54,11 @@ const PublicRoute = ({ component, ...rest }) => {
|
|||
);
|
||||
};
|
||||
|
||||
const AppWrapper = () => {
|
||||
PublicRoute.propTypes = {
|
||||
component: PropTypes.node.isRequired
|
||||
};
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<BrowserRouter basename={process.env.PUBLIC_URL || ""}>
|
||||
<Switch>
|
||||
|
@ -59,4 +69,4 @@ const AppWrapper = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export default AppWrapper;
|
||||
export default App;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Typography } from "@material-ui/core";
|
||||
|
||||
|
@ -13,7 +14,7 @@ const useStyles = makeStyles(theme => ({
|
|||
}));
|
||||
|
||||
const PageTitle = ({ text }) => {
|
||||
var classes = useStyles();
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<div className={classes.box}>
|
||||
|
@ -24,4 +25,8 @@ const PageTitle = ({ text }) => {
|
|||
);
|
||||
};
|
||||
|
||||
PageTitle.propTypes = {
|
||||
text: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
export default PageTitle;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import {
|
||||
InputAdornment,
|
||||
TextField,
|
||||
|
@ -53,4 +54,8 @@ const PasswordField = ({ label, ...rest }) => {
|
|||
);
|
||||
};
|
||||
|
||||
PasswordField.propTypes = {
|
||||
label: PropTypes.string
|
||||
};
|
||||
|
||||
export default PasswordField;
|
||||
|
|
|
@ -14,7 +14,7 @@ const LoginContainer = () => {
|
|||
const { error } = useToast();
|
||||
const { t } = useTranslation();
|
||||
const { login, logout } = useTuitioClient({
|
||||
onLoginFailed: response => error(t("Login.IncorrectCredentials")),
|
||||
onLoginFailed: () => error(t("Login.IncorrectCredentials")),
|
||||
onLoginError: err => error(err.message)
|
||||
});
|
||||
const { valid: tokenIsValid } = useTuitioToken();
|
||||
|
|
|
@ -41,6 +41,18 @@ const ActionButton = React.forwardRef((props, _ref) => {
|
|||
);
|
||||
});
|
||||
|
||||
ActionButton.propTypes = {
|
||||
machine: PropTypes.shape({
|
||||
machineId: PropTypes.number.isRequired
|
||||
}).isRequired,
|
||||
action: PropTypes.shape({
|
||||
code: PropTypes.string.isRequired,
|
||||
tooltip: PropTypes.string.isRequired,
|
||||
system: PropTypes.bool.isRequired,
|
||||
effect: PropTypes.func.isRequired
|
||||
}).isRequired
|
||||
};
|
||||
|
||||
const Machine = ({
|
||||
machine,
|
||||
actions,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { useReducer, useMemo } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import {
|
||||
ApplicationStateContext,
|
||||
ApplicationDispatchContext
|
||||
|
@ -25,4 +26,8 @@ const ApplicationStateProvider = ({ children }) => {
|
|||
);
|
||||
};
|
||||
|
||||
ApplicationStateProvider.propTypes = {
|
||||
children: PropTypes.node.isRequired
|
||||
};
|
||||
|
||||
export default ApplicationStateProvider;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { ToastContainer, Slide } from "react-toastify";
|
||||
import "react-toastify/dist/ReactToastify.css";
|
||||
|
||||
|
@ -23,4 +24,8 @@ const ToastProvider = ({ children }) => {
|
|||
);
|
||||
};
|
||||
|
||||
ToastProvider.propTypes = {
|
||||
children: PropTypes.node.isRequired
|
||||
};
|
||||
|
||||
export default ToastProvider;
|
||||
|
|
Loading…
Reference in New Issue