Skip to content

Commit 08b4f1b

Browse files
committed
fix lint issues
1 parent 264ee36 commit 08b4f1b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class SignatureCanvas extends Component<SignatureCanvasProps> {
9797
}
9898

9999
_checkClearOnResize = (): void => {
100-
if (!this.props.clearOnResize) {
100+
if (!this.props.clearOnResize) { // eslint-disable-line @typescript-eslint/strict-boolean-expressions -- this is backward compatible with the previous behavior, where null was treated as falsey
101101
return
102102
}
103103
this._resizeCanvas()

test/index.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { jest, describe, it, test, expect } from '@jest/globals'
2-
import { render } from '@testing-library/react';
2+
import { render, RenderResult } from '@testing-library/react'
33
import React from 'react'
44

55
import { SignatureCanvas, SignatureCanvasProps } from '../src/index'
66
import { propsF, dotF } from './fixtures'
77

8-
function renderSCWithRef (props?: SignatureCanvasProps) {
8+
function renderSCWithRef (props?: SignatureCanvasProps): { wrapper: RenderResult, instance: SignatureCanvas, ref: React.RefObject<SignatureCanvas> } {
99
const ref = React.createRef<SignatureCanvas>()
1010
const wrapper = render(<SignatureCanvas {...props} ref={ref} />)
11-
const instance = ref.current!
11+
const instance = ref.current! // eslint-disable-line @typescript-eslint/no-non-null-assertion -- this simplifies the code; it does exist immediately after render. it won't exist after unmount, but we literally test for that separately
1212
return { wrapper, instance, ref }
1313
}
1414

@@ -124,7 +124,7 @@ describe('SigCanvas wrapper methods return equivalent to SigPad', () => {
124124

125125
// comes after props and wrapper methods as it uses both
126126
describe('get methods', () => {
127-
const { instance } = renderSCWithRef({canvasProps: dotF.canvasProps})
127+
const { instance } = renderSCWithRef({ canvasProps: dotF.canvasProps })
128128
instance.fromData(dotF.data)
129129

130130
test('getCanvas should return the same underlying canvas', () => {
@@ -165,7 +165,7 @@ describe('canvas resizing', () => {
165165
const size = { width: 100, height: 100 }
166166
it('should not change size if fixed width & height', () => {
167167
// reset clearOnResize back to true after previous test
168-
wrapper.rerender(<SignatureCanvas ref={ref} clearOnResize={true} canvasProps={size} />)
168+
wrapper.rerender(<SignatureCanvas ref={ref} clearOnResize canvasProps={size} />)
169169
window.resizeTo(500, 500)
170170

171171
expect(canvas.width).toBe(size.width)

0 commit comments

Comments
 (0)