[ESLint rule]: recoil value and setter should be named after their at… (#1402)

* Override unwanted changes

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>

* Fix the tests

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>
Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
gitstart-twenty
2023-09-05 11:34:11 +03:00
committed by GitHub
parent 0ec4b78aee
commit 878302dd31
52 changed files with 400 additions and 281 deletions

View File

@ -8,24 +8,25 @@ export type StepsOptions = {
};
export function useStepBar({ initialStep }: StepsOptions) {
const [stepsState, setStepsState] = useRecoilState(stepBarInternalState);
const [stepBarInternal, setStepBarInternal] =
useRecoilState(stepBarInternalState);
function nextStep() {
setStepsState((prevState) => ({
setStepBarInternal((prevState) => ({
...prevState,
activeStep: prevState.activeStep + 1,
}));
}
function prevStep() {
setStepsState((prevState) => ({
setStepBarInternal((prevState) => ({
...prevState,
activeStep: prevState.activeStep - 1,
}));
}
function reset() {
setStepsState((prevState) => ({
setStepBarInternal((prevState) => ({
...prevState,
activeStep: 0,
}));
@ -33,12 +34,12 @@ export function useStepBar({ initialStep }: StepsOptions) {
const setStep = useCallback(
(step: number) => {
setStepsState((prevState) => ({
setStepBarInternal((prevState) => ({
...prevState,
activeStep: step,
}));
},
[setStepsState],
[setStepBarInternal],
);
useEffect(() => {
@ -54,6 +55,6 @@ export function useStepBar({ initialStep }: StepsOptions) {
prevStep,
reset,
setStep,
activeStep: stepsState.activeStep,
activeStep: stepBarInternal.activeStep,
};
}