Add additional ESLint rules
This commit is contained in:
parent
e02c051e19
commit
24a0bcde48
13
.eslintrc.js
13
.eslintrc.js
@ -69,12 +69,23 @@ module.exports = {
|
||||
'react-native/no-color-literals': 'off',
|
||||
'react-native/no-raw-text': 'off',
|
||||
'react-native/no-single-element-style-arrays': 'warn',
|
||||
'@typescript-eslint/strict-boolean-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowString: false,
|
||||
allowNullableObject: false,
|
||||
allowNumber: false,
|
||||
allowNullableBoolean: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
|
||||
// react hooks
|
||||
'react-hooks/exhaustive-deps': [
|
||||
'error',
|
||||
{
|
||||
additionalHooks: '(useDerivedValue|useAnimatedStyle|useAnimatedProps|useWorkletCallback)',
|
||||
additionalHooks: '(useDerivedValue|useAnimatedStyle|useAnimatedProps|useWorkletCallback|useFrameProcessor)',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -76,6 +76,7 @@ const _CaptureButton: React.FC<Props> = ({
|
||||
// If we're on Android and flash is disabled, we can use the "snapshot" method.
|
||||
// this will take a snapshot of the current SurfaceView, which results in faster image
|
||||
// capture rate at the cost of greatly reduced quality.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const photoMethod = USE_SNAPSHOT_ON_ANDROID && IS_ANDROID && takePhotoOptions.flash === 'off' ? 'snapshot' : 'photo';
|
||||
console.log(`Taking ${photoMethod}...`);
|
||||
const photo =
|
||||
|
@ -354,8 +354,6 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
|
||||
|
||||
//#region Events (Wrapped to maintain reference equality)
|
||||
private onError(event: NativeSyntheticEvent<OnErrorEvent>): void {
|
||||
if (event == null) throw new Error('onError() was invoked but event was null!');
|
||||
|
||||
if (this.props.onError != null) {
|
||||
const error = event.nativeEvent;
|
||||
const cause = isErrorWithCause(error.cause) ? error.cause : undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user