Skip to content

Commit

Permalink
ignore useless return lint on specific lines
Browse files Browse the repository at this point in the history
  • Loading branch information
maximpertsov committed Jan 19, 2023
1 parent 57ee6bd commit d919f79
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion web/frontend/src/components/base.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- eslint-disable no-useless-return -->
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue';
Expand Down Expand Up @@ -86,6 +85,8 @@ const stop = async () => {
return await bc.stop();
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand Down Expand Up @@ -129,6 +130,7 @@ const digestInput = async () => {
return response;
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand Down Expand Up @@ -165,13 +167,15 @@ const handleBaseStraight = async (name: string, event: {
return await bc.setVelocity(linear, angular);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
} else {
try {
return await bc.moveStraight(event.distance, event.speed * event.direction);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
}
Expand All @@ -184,6 +188,7 @@ const baseRun = async () => {
return await bc.spin(angle.value * (spinType.value === 'Clockwise' ? -1 : 1), spinSpeed.value);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
} else if (movementMode.value === 'Straight') {
Expand All @@ -194,6 +199,7 @@ const baseRun = async () => {
distance: increment.value,
});
}
// eslint-disable-next-line no-useless-return
return;
};
Expand Down
7 changes: 6 additions & 1 deletion web/frontend/src/components/board.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- eslint-disable no-useless-return -->
<script setup lang="ts">
import { toast } from '../lib/toast';
Expand Down Expand Up @@ -33,6 +32,7 @@ const getGPIO = async () => {
return;
} catch (error) {
toast.error((error as ServiceError).message);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -44,6 +44,7 @@ const setGPIO = async () => {
return await bc.setGPIO(setPin, setLevel === 'high');
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -57,6 +58,7 @@ const getPWM = async () => {
return response;
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -67,6 +69,7 @@ const setPWM = async () => {
return await bc.setPWM(setPin, Number.parseFloat(pwm) / 100);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -80,6 +83,7 @@ const getPWMFrequency = async () => {
return response;
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -90,6 +94,7 @@ const setPWMFrequency = async () => {
return await bc.setPWMFrequency(setPin, Number.parseFloat(pwmFrequency));
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand Down
6 changes: 5 additions & 1 deletion web/frontend/src/components/motor-detail.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- eslint-disable no-useless-return -->
<script setup lang="ts">
import { onMounted } from 'vue';
import { Client, motorApi, MotorClient, ServiceError } from '@viamrobotics/sdk';
Expand Down Expand Up @@ -67,6 +66,7 @@ const setPower = async () => {
return await mc.setPower(powerPct);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -77,6 +77,7 @@ const goFor = async () => {
return await mc.goFor(rpm * direction, revolutions);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -87,6 +88,7 @@ const goTo = async () => {
return await mc.goTo(rpm, position);
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -112,6 +114,7 @@ const motorStop = async () => {
return await mc.motorStop();
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
};
Expand All @@ -122,6 +125,7 @@ onMounted(async () => {
properties = await mc.getProperties();
} catch (error) {
displayError(error as ServiceError);
// eslint-disable-next-line no-useless-return
return;
}
});
Expand Down

0 comments on commit d919f79

Please sign in to comment.