Added eslint

This commit is contained in:
MaxOvs19 2023-05-31 11:24:46 +03:00
parent fc8fc33733
commit 9e242ddf5d
40 changed files with 224 additions and 536 deletions

21
.eslintrc.json Normal file
View File

@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"no-console": "warn",
"react/prop-types": 0,
"no-undef": "warn",
"react/no-unescaped-entities": 0,
"no-extra-boolean-cast": "warn",
"react/react-in-jsx-scope": 0
}
}

606
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,8 @@
"cross-env": "^7.0.3",
"css-loader": "6.7.3",
"dotenv-webpack": "^7.0.3",
"eslint": "^8.41.0",
"eslint-plugin-react": "^7.32.2",
"html-webpack-plugin": "5.5.0",
"mini-css-extract-plugin": "^2.7.2",
"node-sass": "8.0.0",
@ -78,7 +80,8 @@
"build": "cross-env SERVE=true webpack -c config/webpack/prod.js",
"start": "webpack serve -c config/webpack/dev.js",
"analyze": "webpack --analyze -c config/webpack/analyze.js",
"format": "prettier --write \"./**/*.{js,jsx}\""
"format": "prettier --write \"./**/*.{js,jsx}\"",
"lint": "npx eslint 'src/**/*.{js,jsx,ts,tsx}'"
},
"eslintConfig": {
"extends": [

View File

@ -7,7 +7,7 @@ import userIcon from "assets/icons/userIcon.svg";
import "./authHeader.scss";
export const AuthHeader = ({}) => {
export const AuthHeader = () => {
return (
<div className="auth-header">
<div className="auth-header__logo">

View File

@ -13,7 +13,7 @@ import rectangle from "assets/images/rectangle_secondPage.png";
import ErrorBoundary from "../../hoc/ErrorBoundary";
import "./description.scss";
const Description = ({ onLoadMore, isLoadingMore }) => {
const Description = ({ onLoadMore }) => {
const candidatesListArr = useSelector(selectProfiles);
return (

View File

@ -29,8 +29,10 @@ const Form = () => {
const handleModal = (status) => {
SweetAlert.fire({
text:
// eslint-disable-next-line no-constant-condition
status !== 200 || 201 ? "Какие-то неполадки =(" : "Форма отправлена",
preConfirm: () =>
// eslint-disable-next-line no-constant-condition
status !== 200 || 201
? () => {
setStatus(null);

View File

@ -14,7 +14,7 @@ import mockWorker from "assets/images/mock/mokPerson.png";
import "./freeDevelopers.scss";
export const FreeDevelopers = ({}) => {
export const FreeDevelopers = () => {
return (
<section className="free-dev">
<AuthHeader />

View File

@ -60,7 +60,7 @@ export const ModalTiсket = ({
task_id: task.id,
status: 0,
},
}).then((res) => {
}).then(() => {
setActive(false);
dispatch(setProjectBoardFetch(projectId));
});
@ -74,7 +74,7 @@ export const ModalTiсket = ({
title: inputsValue.title,
description: inputsValue.description,
},
}).then((res) => {
}).then(() => {
dispatch(setProjectBoardFetch(projectId));
});
}
@ -106,7 +106,7 @@ export const ModalTiсket = ({
comment_id: commentId,
status: 0,
},
}).then((res) => {
}).then(() => {
setComments((prevValue) =>
prevValue.filter((item) => item.id !== commentId)
);
@ -120,7 +120,7 @@ export const ModalTiсket = ({
comment_id: commentId,
text: commentsEditText[commentId],
},
}).then((res) => {});
}).then(() => {});
}
function taskExecutor(person) {
@ -143,7 +143,7 @@ export const ModalTiсket = ({
task_id: task.id,
executor_id: 0,
},
}).then((res) => {
}).then(() => {
setExecutor(null);
});
}
@ -168,7 +168,7 @@ export const ModalTiсket = ({
task_id: task.id,
user_id: person.user_id,
},
}).then((res) => {
}).then(() => {
setMembers(members.filter((item) => item.user_id !== person.user_id));
});
}

View File

@ -42,7 +42,7 @@ import watch from "assets/icons/watch.svg";
import "./ticketFullScreen.scss";
export const TicketFullScreen = ({}) => {
export const TicketFullScreen = () => {
const [modalAddWorker, setModalAddWorker] = useState(false);
const ticketId = useParams();
const dispatch = useDispatch();
@ -93,7 +93,7 @@ export const TicketFullScreen = ({}) => {
task_id: ticketId.id,
status: 0,
},
}).then((res) => {
}).then(() => {
navigate(`/tracker/project/${taskInfo.project_id}`);
});
}
@ -106,7 +106,7 @@ export const TicketFullScreen = ({}) => {
title: inputsValue.title,
description: inputsValue.description,
},
}).then((res) => {});
}).then(() => {});
}
function createComment() {
@ -137,7 +137,7 @@ export const TicketFullScreen = ({}) => {
comment_id: commentId,
status: 0,
},
}).then((res) => {
}).then(() => {
setComments((prevValue) =>
prevValue.filter((item) => item.id !== commentId)
);
@ -151,7 +151,7 @@ export const TicketFullScreen = ({}) => {
comment_id: commentId,
text: commentsEditText[commentId],
},
}).then((res) => {});
}).then(() => {});
}
function deletePerson(userId) {
@ -161,7 +161,7 @@ export const TicketFullScreen = ({}) => {
project_id: projectBoard.id,
user_id: userId,
},
}).then((res) => {
}).then(() => {
dispatch(deletePersonOnProject(userId));
});
}

View File

@ -57,7 +57,7 @@ export const TrackerModal = ({
project_id: projectBoard.id,
title: valueColumn,
},
}).then((res) => {
}).then(() => {
dispatch(setProjectBoardFetch(projectBoard.id));
});
setValueColumn("");
@ -80,7 +80,7 @@ export const TrackerModal = ({
column_id: selectedTab,
priority: priorityTask,
},
}).then((res) => {
}).then(() => {
dispatch(setProjectBoardFetch(projectBoard.id));
});
@ -96,7 +96,7 @@ export const TrackerModal = ({
project_id: projectId,
name: projectName,
},
}).then((res) => {
}).then(() => {
setActive(false);
dispatch(editProjectName({ id: projectId, name: projectName }));
});
@ -109,7 +109,7 @@ export const TrackerModal = ({
column_id: columnId,
title: columnName,
},
}).then((res) => {
}).then(() => {
setActive(false);
dispatch(editColumnName({ id: columnId, title: columnName }));
});

View File

@ -23,6 +23,7 @@ import arrow from "assets/icons/arrows/arrowCalendar.png";
import calendarIcon from "assets/icons/calendar.svg";
import rectangle from "assets/images/rectangle__calendar.png";
// eslint-disable-next-line react/display-name
export const ProfileCalendarComponent = React.memo(
({ value, setValueHandler, reports, totalHours }) => {
const dispatch = useDispatch();

View File

@ -47,7 +47,7 @@ export const ProjectTiket = ({ project, index }) => {
project_id: project.id,
status: 10,
},
}).then((res) => {
}).then(() => {
dispatch(deleteProject(project));
});
}

View File

@ -1,6 +1,6 @@
import React from "react";
import { useSelector } from "react-redux";
import { Redirect, Route } from "react-router-dom";
import { Route } from "react-router-dom";
import { selectAuth } from "@redux/outstaffingSlice";
@ -9,6 +9,7 @@ export const ProtectedRoute = ({ component: Component, ...rest }) => {
const existingToken = localStorage.getItem("auth_token");
const expiresAt = localStorage.getItem("access_token_expired_at");
// eslint-disable-next-line no-unused-vars
const isTokenAlive =
!isAuth &&
existingToken &&

View File

@ -103,7 +103,7 @@ const ReportForm = () => {
created_at: getCreatedDate(startDate),
status: 1,
},
}).then((res) => {
}).then(() => {
setReportSuccess("Отчет отправлен");
setTimeout(() => {
setReportSuccess("");

View File

@ -19,7 +19,7 @@ import { Loader } from "@components/Common/Loader/Loader";
import "./shortReport.scss";
export const ShortReport = ({}) => {
export const ShortReport = () => {
const reportDate = useSelector(getReportDate);
const sendReport = useSelector(getSendRequest);

View File

@ -1,12 +1,6 @@
import React from "react";
import { useSelector } from "react-redux";
import { selectedTest } from "@redux/quizSlice";
export const GetOptionTask = ({ type, answer, handleChange, inputValue }) => {
const id = localStorage.getItem("id");
const dataTest = useSelector(selectedTest);
switch (type) {
case "1":
return (

View File

@ -5,8 +5,7 @@ import { selectUserInfo, setUserInfo } from "@redux/quizSlice";
import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
// import { apiRequest } from "@api/request";
import "./quiz.scss";
export const HeaderQuiz = ({ header }) => {

View File

@ -10,8 +10,7 @@ import accempt from "assets/images/quiz/accempt.png";
import timer from "assets/images/quiz/timer.png";
export const QuizPassingInformation = ({ expiryTimestamp, setStartTest }) => {
const { seconds, minutes, isRunning, start, pause, resume, restart } =
useTimer({
const { seconds, minutes, isRunning, start, restart } = useTimer({
expiryTimestamp,
autoStart: false,
onExpire: () => {

View File

@ -1,15 +1,12 @@
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import {
answersSelector,
fetchGetAnswers,
fetchUserAnswerOne,
fetchUserAnswersMany,
fetchGetAnswers, // fetchUserAnswerOne,
// fetchUserAnswersMany,
questionsSelector,
selectedTest,
setAnswers,
selectedTest, // setAnswers,
setCompleteTest,
} from "@redux/quizSlice";
@ -18,12 +15,11 @@ import { apiRequest } from "@api/request";
import questionIcon from "assets/images/question.png";
import { GetOptionTask } from "./GetOptionTask";
import { HeaderQuiz } from "./HeaderQuiz";
import { Progressbar } from "./ProgressbarQuiz";
// import { HeaderQuiz } from "./HeaderQuiz";
// import { Progressbar } from "./ProgressbarQuiz";
import "./quiz.scss";
export const TaskQuiz = () => {
const navigate = useNavigate();
const dispatch = useDispatch();
const answers = useSelector(answersSelector);
@ -42,7 +38,6 @@ export const TaskQuiz = () => {
// .then(json => console.log(json))
apiRequest(`/question/get-questions?uuid=${dataTest.uuid}`).then(
(response) => {
console.log(response);
dispatch(fetchGetAnswers(response[0].id));
setStripValue(((+index + 1) * 100) / response.length);
}

View File

@ -17,7 +17,7 @@ import mockImgArticle from "assets/images/mock/mockImgArticle.png";
import "./article.scss";
export const Article = ({}) => {
export const Article = () => {
const [article] = useState([
{
image: cardImg1,

View File

@ -16,7 +16,7 @@ import cardImg1 from "assets/images/mock/cardArticleItem.png";
import "./blog.scss";
export const Blog = ({}) => {
export const Blog = () => {
const [article] = useState([
{
image: cardImg1,

View File

@ -13,7 +13,7 @@ import "./FrequentlyAskedQuestion.scss";
export const FrequentlyAskedQuestion = () => {
const params = useParams();
const navigate = useNavigate();
const [question, setQuestion] = useState({
const [question] = useState({
id: params.id,
title: "Это фриланс-платформа?",
answer:

View File

@ -117,7 +117,7 @@ export const PartnerAddRequest = () => {
return skill.id;
}),
},
}).then((res) => {
}).then(() => {
navigate("/profile/requests");
});
} else {
@ -135,7 +135,7 @@ export const PartnerAddRequest = () => {
return skill.id;
}),
},
}).then((res) => {
}).then(() => {
navigate("/profile/requests");
});
}
@ -206,7 +206,7 @@ export const PartnerAddRequest = () => {
{openSpecializationList &&
Boolean(specializationList.length) && (
<div className="form__block__dropDown">
{specializationList.map((specialization, index) => {
{specializationList.map((specialization) => {
return (
<p
key={specialization.id}

View File

@ -59,7 +59,7 @@ export const PartnerBid = () => {
request_id: requestId,
status: 0,
},
}).then((res) => {
}).then(() => {
navigate("/profile/requests");
});
};

View File

@ -152,7 +152,7 @@ export const ProjectTracker = () => {
project_id: projectBoard.id,
status: 0,
},
}).then((res) => {
}).then(() => {
dispatch(setProjectBoardFetch(projectBoard.id));
});
}
@ -164,7 +164,7 @@ export const ProjectTracker = () => {
project_id: projectBoard.id,
user_id: userId,
},
}).then((res) => {
}).then(() => {
dispatch(deletePersonOnProject(userId));
});
}
@ -338,7 +338,7 @@ export const ProjectTracker = () => {
<div
key={column.id}
onDragOver={(e) => dragOverHandler(e)}
onDragEnter={(e) => dragEnterHandler(column.id)}
onDragEnter={() => dragEnterHandler(column.id)}
onDrop={(e) => dragDropHandler(e, column.id)}
className={`tasks__board ${
column.tasks.length >= 3 ? "tasks__board__more" : ""
@ -398,7 +398,7 @@ export const ProjectTracker = () => {
</div>
</div>
)}
{column.tasks.map((task, index) => {
{column.tasks.map((task) => {
// if (index > 2) {
// if (!column.open) {
// return;
@ -454,7 +454,7 @@ export const ProjectTracker = () => {
);
})}
{Boolean(projectBoard?.columns) &&
!Boolean(projectBoard.columns.length) && (
!projectBoard.columns.length && (
<div className="tasks__board__noItems">
В проекте нет задач.
</div>

View File

@ -66,9 +66,9 @@ const SingleReportPage = () => {
<div className="single-report-page__marker"></div>
<h3>Какие задачи были выполнены?</h3>
</div>
{tasks.map((task) => {
{tasks.map((task, index) => {
return (
<div className="single-report-page__tasks-item">
<div className="single-report-page__tasks-item" key={index}>
<TaskItem {...task} />
</div>
);

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { useSelector } from "react-redux";
import { Link } from "react-router-dom";
import { completedTestSelector, selectedTest } from "@redux/quizSlice";
import { completedTestSelector } from "@redux/quizSlice";
import { Footer } from "@components/Common/Footer/Footer";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
@ -14,11 +14,6 @@ import { QuizPassingInformation } from "@components/features/quiz/Quiz-passing-i
import { TaskQuiz } from "@components/features/quiz/Task";
export const PassingTests = () => {
//const selectedTest = useSelector(selectedTest)
if ("") {
}
const time = new Date();
time.setSeconds(time.getSeconds() + 600); //600 - кол-во секунд для прохождения теста

View File

@ -57,7 +57,7 @@ export const projectsTrackerSlice = createSlice({
task_id: action.payload.startWrapperIndex.task.id,
column_id: column.id,
},
}).then((res) => {});
}).then(() => {});
}
if (column.id === action.payload.startWrapperIndex.index) {
state.projectBoard.columns[index].tasks = column.tasks.filter(

View File

@ -117,7 +117,7 @@ export const quizSlice = createSlice({
setSelectedTest: (state, action) => {
state.selectedTest = action.payload;
},
setCompleteTest: (state, action) => {
setCompleteTest: (state) => {
state.completedTest = true;
},
},