From 94d48fc9501f4d343feb44a768bfac0e8c70d289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Miernik?= Date: Fri, 26 Feb 2021 10:57:01 +0100 Subject: [PATCH] Replaced ts-ignore with ts-expect-error. --- .../uniforms-antd/__tests__/DateField.tsx | 6 +++--- .../uniforms-antd/__tests__/RadioField.tsx | 6 +++--- .../uniforms-antd/__tests__/SelectField.tsx | 20 +++++++++---------- .../uniforms-antd/__tests__/wrapField.tsx | 2 +- packages/uniforms-antd/src/DateField.tsx | 2 +- packages/uniforms-antd/src/SelectField.tsx | 4 ++-- .../uniforms-bootstrap4/src/gridClassName.ts | 2 +- .../src/SimpleSchema2Bridge.ts | 6 +++--- .../__tests__/SimpleSchemaBridge.ts | 2 +- .../src/SimpleSchemaBridge.ts | 2 +- .../src/register.ts | 4 ++-- .../uniforms-material/__tests__/DateField.tsx | 6 +++--- .../__tests__/LongTextField.tsx | 6 +++--- .../uniforms-material/__tests__/NumField.tsx | 12 +++++------ .../__tests__/RadioField.tsx | 4 ++-- .../__tests__/SelectField.tsx | 17 ++++++---------- packages/uniforms/__tests__/BaseForm.tsx | 2 +- packages/uniforms/__tests__/QuickForm.tsx | 2 +- packages/uniforms/__tests__/filterDOMProps.ts | 2 +- packages/uniforms/src/AutoForm.tsx | 2 +- packages/uniforms/src/BaseForm.tsx | 4 ++-- packages/uniforms/src/QuickForm.tsx | 2 +- packages/uniforms/src/ValidatedForm.tsx | 2 +- packages/uniforms/src/connectField.tsx | 4 ++-- website/components/Playground.tsx | 8 ++++---- website/lib/schema.ts | 6 +++--- 26 files changed, 65 insertions(+), 70 deletions(-) diff --git a/packages/uniforms-antd/__tests__/DateField.tsx b/packages/uniforms-antd/__tests__/DateField.tsx index f484e167c..28abf3d5e 100644 --- a/packages/uniforms-antd/__tests__/DateField.tsx +++ b/packages/uniforms-antd/__tests__/DateField.tsx @@ -66,7 +66,7 @@ test(' - renders an input with correct readOnly state', () => { ); expect(wrapper.find(DatePicker)).toHaveLength(1); - // @ts-ignore + // @ts-expect-error expect(wrapper.find(DatePicker).prop('onChange')(now)).toBeFalsy(); expect(onChange).not.toHaveBeenCalled(); }); @@ -119,7 +119,7 @@ test(' - renders a input which correctly reacts on change', () => { ); expect(wrapper.find(DatePicker)).toHaveLength(1); - // @ts-ignore + // @ts-expect-error expect(wrapper.find(DatePicker).prop('onChange')(now)).toBeFalsy(); expect(onChange).toHaveBeenLastCalledWith('x', now.toDate()); }); @@ -134,7 +134,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( ); expect(wrapper.find(DatePicker)).toHaveLength(1); - // @ts-ignore + // @ts-expect-error expect(wrapper.find(DatePicker).prop('onChange')(undefined)).toBeFalsy(); expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); diff --git a/packages/uniforms-antd/__tests__/RadioField.tsx b/packages/uniforms-antd/__tests__/RadioField.tsx index cee27857c..da7420ff4 100644 --- a/packages/uniforms-antd/__tests__/RadioField.tsx +++ b/packages/uniforms-antd/__tests__/RadioField.tsx @@ -40,7 +40,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(wrapper.find(Radio.Group)).toHaveLength(1); expect( - // @ts-ignore + // @ts-expect-error wrapper.find(Radio.Group).prop('onChange')({ target: { value: 'b' } }), ).toBeFalsy(); expect(onChange).not.toHaveBeenCalled(); @@ -153,7 +153,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(wrapper.find(Radio.Group)).toHaveLength(1); expect( - // @ts-ignore + // @ts-expect-error wrapper.find(Radio.Group).prop('onChange')({ target: { value: 'b' } }), ).toBeFalsy(); expect(onChange).toHaveBeenLastCalledWith('x', 'b'); @@ -173,7 +173,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(wrapper.find(Radio.Group)).toHaveLength(1); expect( - // @ts-ignore + // @ts-expect-error wrapper.find(Radio.Group).prop('onChange')({ target: { value: 'a' } }), ).toBeFalsy(); expect(onChange).toHaveBeenLastCalledWith('x', 'a'); diff --git a/packages/uniforms-antd/__tests__/SelectField.tsx b/packages/uniforms-antd/__tests__/SelectField.tsx index 2e963c10c..d513f81a1 100644 --- a/packages/uniforms-antd/__tests__/SelectField.tsx +++ b/packages/uniforms-antd/__tests__/SelectField.tsx @@ -79,7 +79,7 @@ test(' - renders a select with correct name', () => { }); test(' - renders a select with correct options', () => { - // @ts-ignore Is open a valid prop? + // @ts-expect-error Is open a valid prop? const element = ; const wrapper = mount( element, @@ -88,19 +88,19 @@ test(' - renders a select with correct options', () => { expect(wrapper.find(Select)).toHaveLength(1); expect(wrapper.find(Select).prop('children')).toHaveLength(2); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[0].props.value).toBe('a'); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[0].props.children).toBe('a'); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[1].props.value).toBe('b'); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[1].props.children).toBe('b'); }); test(' - renders a select with correct options (transform)', () => { const element = ( - // @ts-ignore Is open a valid prop? + // @ts-expect-error Is open a valid prop? x.toUpperCase()} /> ); const wrapper = mount( @@ -110,13 +110,13 @@ test(' - renders a select with correct options (transform)', () => expect(wrapper.find(Select)).toHaveLength(1); expect(wrapper.find(Select).prop('children')).toHaveLength(2); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[0].props.value).toBe('a'); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[0].props.children).toBe('A'); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[1].props.value).toBe('b'); - // @ts-ignore Check children type. + // @ts-expect-error Check children type. expect(wrapper.find(Select).prop('children')[1].props.children).toBe('B'); }); diff --git a/packages/uniforms-antd/__tests__/wrapField.tsx b/packages/uniforms-antd/__tests__/wrapField.tsx index ff38576cf..4039b8930 100644 --- a/packages/uniforms-antd/__tests__/wrapField.tsx +++ b/packages/uniforms-antd/__tests__/wrapField.tsx @@ -9,7 +9,7 @@ test(' - renders wrapper with label', () => { const element = wrapField({ label: 'Label' },
); const wrapper = mount(element); - // @ts-ignore Correct label type. + // @ts-expect-error Correct label type. expect(wrapper.find(Form.Item).prop('label').props.children[0]).toBe('Label'); }); diff --git a/packages/uniforms-antd/src/DateField.tsx b/packages/uniforms-antd/src/DateField.tsx index 68757454a..d59a651da 100644 --- a/packages/uniforms-antd/src/DateField.tsx +++ b/packages/uniforms-antd/src/DateField.tsx @@ -31,7 +31,7 @@ function Date({ } }} placeholder={props.placeholder} - // @ts-ignore: `DatePicker` is an intersection. + // @ts-expect-error: `DatePicker` is an intersection. ref={props.inputRef} showTime={showTime} style={style} diff --git a/packages/uniforms-antd/src/SelectField.tsx b/packages/uniforms-antd/src/SelectField.tsx index c8f1faab8..7e3164f4f 100644 --- a/packages/uniforms-antd/src/SelectField.tsx +++ b/packages/uniforms-antd/src/SelectField.tsx @@ -47,7 +47,7 @@ function Select(props: SelectFieldProps) { return wrapField( props, props.checkboxes ? ( - // @ts-ignore: Incorrect `value` type. + // @ts-expect-error: Incorrect `value` type. gridClassNamePart(size, grid[size], side)) .join(' ') ); diff --git a/packages/uniforms-bridge-simple-schema-2/src/SimpleSchema2Bridge.ts b/packages/uniforms-bridge-simple-schema-2/src/SimpleSchema2Bridge.ts index 2f8d381d6..29fd0d5ca 100644 --- a/packages/uniforms-bridge-simple-schema-2/src/SimpleSchema2Bridge.ts +++ b/packages/uniforms-bridge-simple-schema-2/src/SimpleSchema2Bridge.ts @@ -21,7 +21,7 @@ export default class SimpleSchema2Bridge extends Bridge { getErrorMessage(name: string, error: any) { const scopedError = this.getError(name, error); - // @ts-ignore: `messageForError` has incorrect typing. + // @ts-expect-error: `messageForError` has incorrect typing. return !scopedError ? '' : this.schema.messageForError(scopedError); } @@ -30,7 +30,7 @@ export default class SimpleSchema2Bridge extends Bridge { if (Array.isArray(error.details)) { // FIXME: Correct type for `error`. return (error.details as any[]).map(error => - // @ts-ignore: `messageForError` has incorrect typing. + // @ts-expect-error: `messageForError` has incorrect typing. this.schema.messageForError(error), ); } @@ -146,7 +146,7 @@ export default class SimpleSchema2Bridge extends Bridge { } getSubfields(name?: string) { - // @ts-ignore: Typing for `_makeGeneric` is missing. + // @ts-expect-error: Typing for `_makeGeneric` is missing. return this.schema.objectKeys(SimpleSchema._makeGeneric(name)); } diff --git a/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts b/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts index 8d50a18f6..91423928c 100644 --- a/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts +++ b/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts @@ -10,7 +10,7 @@ describe('SimpleSchemaBridge', () => { // Simulate SimpleSchema. name = name.replace(/\d+/g, '$'); - // @ts-ignore: Dynamic `name`. + // @ts-expect-error: Dynamic `name`. const field = { a: { type: Object, label: name }, 'a.b': { type: Object, label: name }, diff --git a/packages/uniforms-bridge-simple-schema/src/SimpleSchemaBridge.ts b/packages/uniforms-bridge-simple-schema/src/SimpleSchemaBridge.ts index 5c5bcd2a0..ee101584d 100644 --- a/packages/uniforms-bridge-simple-schema/src/SimpleSchemaBridge.ts +++ b/packages/uniforms-bridge-simple-schema/src/SimpleSchemaBridge.ts @@ -1,7 +1,7 @@ import invariant from 'invariant'; import cloneDeep from 'lodash/cloneDeep'; import memoize from 'lodash/memoize'; -// @ts-ignore +// @ts-expect-error import { SimpleSchema } from 'meteor/aldeed:simple-schema'; import { Bridge, joinName } from 'uniforms'; diff --git a/packages/uniforms-bridge-simple-schema/src/register.ts b/packages/uniforms-bridge-simple-schema/src/register.ts index 69c82273f..ebedef8ce 100644 --- a/packages/uniforms-bridge-simple-schema/src/register.ts +++ b/packages/uniforms-bridge-simple-schema/src/register.ts @@ -1,6 +1,6 @@ -// @ts-ignore +// @ts-expect-error import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -// @ts-ignore +// @ts-expect-error import { Match } from 'meteor/check'; import { filterDOMProps } from 'uniforms'; diff --git a/packages/uniforms-material/__tests__/DateField.tsx b/packages/uniforms-material/__tests__/DateField.tsx index e334d0e51..fa449fc10 100644 --- a/packages/uniforms-material/__tests__/DateField.tsx +++ b/packages/uniforms-material/__tests__/DateField.tsx @@ -97,7 +97,7 @@ test(' - renders a Input which correctly reacts on change', () => { createContext({ x: { type: Date } }, { onChange }), ); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(Input).props().onChange!({ target: { valueAsNumber: now } }); expect(onChange).toHaveBeenLastCalledWith('x', now); }); @@ -112,7 +112,7 @@ test(' - renders a Input which correctly reacts on change (empty)', ( ); wrapper.find(Input).props().onChange!({ - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. target: { valueAsNumber: undefined }, }); expect(onChange).toHaveBeenLastCalledWith('x', undefined); @@ -128,7 +128,7 @@ test(' - renders a Input which correctly reacts on change (overflow)' createContext({ x: { type: Date } }, { onChange }), ); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(Input).props().onChange!({ target: { valueAsNumber: now } }); expect(onChange).not.toHaveBeenCalled(); }); diff --git a/packages/uniforms-material/__tests__/LongTextField.tsx b/packages/uniforms-material/__tests__/LongTextField.tsx index f312bab1d..217a90818 100644 --- a/packages/uniforms-material/__tests__/LongTextField.tsx +++ b/packages/uniforms-material/__tests__/LongTextField.tsx @@ -97,7 +97,7 @@ test(' - renders a TextField which correctly reacts on change', ( ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: 'y' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); @@ -112,7 +112,7 @@ test(' - renders a TextField which correctly reacts on change (em ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '' } }); expect(onChange).toHaveBeenLastCalledWith('x', ''); }); @@ -127,7 +127,7 @@ test(' - renders a TextField which correctly reacts on change (sa ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: 'y' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); diff --git a/packages/uniforms-material/__tests__/NumField.tsx b/packages/uniforms-material/__tests__/NumField.tsx index 6b7c10316..ca8cb01da 100644 --- a/packages/uniforms-material/__tests__/NumField.tsx +++ b/packages/uniforms-material/__tests__/NumField.tsx @@ -176,7 +176,7 @@ test(' - renders a TextField which correctly reacts on change', () => ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '1' } }); expect(onChange).toHaveBeenLastCalledWith('x', 1); }); @@ -191,7 +191,7 @@ test(' - renders a TextField which correctly reacts on change (decimal ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '2.5' } }); expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); @@ -206,7 +206,7 @@ test(' - renders a TextField which correctly reacts on change (decimal ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '2.5' } }); expect(onChange).toHaveBeenLastCalledWith('x', 2); }); @@ -221,7 +221,7 @@ test(' - renders a TextField which correctly reacts on change (empty)' ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '' } }); expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); @@ -236,7 +236,7 @@ test(' - renders a TextField which correctly reacts on change (same va ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '1' } }); expect(onChange).toHaveBeenLastCalledWith('x', 1); }); @@ -251,7 +251,7 @@ test(' - renders a TextField which correctly reacts on change (zero)', ); expect(wrapper.find(TextField)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '0' } }); expect(onChange).toHaveBeenLastCalledWith('x', 0); }); diff --git a/packages/uniforms-material/__tests__/RadioField.tsx b/packages/uniforms-material/__tests__/RadioField.tsx index 9b7ddc9b5..ea624387f 100644 --- a/packages/uniforms-material/__tests__/RadioField.tsx +++ b/packages/uniforms-material/__tests__/RadioField.tsx @@ -147,7 +147,7 @@ test(' - renders a RadioGroup which correctly reacts on change', () ); expect(wrapper.find(RadioGroup)).toHaveLength(1); - // @ts-ignore Provide a valid value. + // @ts-expect-error Provide a valid value. wrapper.find(RadioGroup).props().onChange!({ target: { value: 'b' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); @@ -165,7 +165,7 @@ test(' - renders a RadioGroup which correctly reacts on change (same ); expect(wrapper.find(RadioGroup)).toHaveLength(1); - // @ts-ignore Provide a valid value. + // @ts-expect-error Provide a valid value. wrapper.find(RadioGroup).props().onChange!({ target: { value: 'a' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); diff --git a/packages/uniforms-material/__tests__/SelectField.tsx b/packages/uniforms-material/__tests__/SelectField.tsx index 77a566258..8cf704943 100644 --- a/packages/uniforms-material/__tests__/SelectField.tsx +++ b/packages/uniforms-material/__tests__/SelectField.tsx @@ -36,7 +36,6 @@ test(' - renders a Select with correct disabled state', () => { }); test(' - renders a Select with correct required state', () => { - // @ts-ignore Fix SelectFieldProps. const element = ; const wrapper = mount( element, @@ -84,7 +83,6 @@ test(' - renders a Select with correct name', () => { }); test(' - renders a Select with correct options', () => { - // @ts-ignore Fix SelectFieldProps. const element = ; const wrapper = mount( element, @@ -106,7 +104,6 @@ test(' - renders a Select with correct options', () => { test(' - renders a Select with correct options (transform)', () => { const element = ( - // @ts-ignore Fix SelectFieldProps. x.toUpperCase()} native /> ); const wrapper = mount( @@ -128,7 +125,6 @@ test(' - renders a Select with correct options (transform)', () => }); test(' - renders a Select with correct placeholder (implicit)', () => { - // @ts-ignore Fix SelectFieldProps. const element = ; const wrapper = mount( element, @@ -197,7 +193,7 @@ test(' - renders a Select which correctly reacts on change', () => ); expect(wrapper.find(Select)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: 'b' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); @@ -215,7 +211,7 @@ test(' - renders a Select which correctly reacts on change (empty)' ); expect(wrapper.find(Select)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: '' } }); expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); @@ -233,7 +229,7 @@ test(' - renders a Select which correctly reacts on change (same va ); expect(wrapper.find(Select)).toHaveLength(1); - // @ts-ignore Provide a valid EventTarget. + // @ts-expect-error Provide a valid EventTarget. wrapper.find(TextField).props().onChange!({ target: { value: 'b' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); @@ -312,7 +308,7 @@ test(' - disabled items (options) based on predicate', () => { test(' - renders with correct classnames', () => { const wrapper = mount( - // @ts-ignore Fix SelectFieldProps. + // @ts-expect-error Fix SelectFieldProps. , createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), ); @@ -503,7 +499,7 @@ test(' - renders a set of Radio buttons which correctly ); expect(wrapper.find(Radio)).toHaveLength(2); - // @ts-ignore Provide a valid value. + // @ts-expect-error Provide a valid value. wrapper.find(RadioGroup).props().onChange!({ target: { value: 'b' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); @@ -549,7 +545,6 @@ test(' - renders a set of Checkboxes which correctly rea test(' - renders a set of Checkboxes with correct labels', () => { const onChange = jest.fn(); - // @ts-ignore Fix SelectFieldProps. const element = ; const wrapper = mount( element, @@ -602,7 +597,7 @@ test(' - renders a set of Radio buttons which correctly expect(wrapper.find(Radio)).toHaveLength(2); - // @ts-ignore Provide a valid value. + // @ts-expect-error Provide a valid value. wrapper.find(RadioGroup).props().onChange!({ target: { value: 'a' } }); expect(onChange).toHaveBeenLastCalledWith('x', 'a'); diff --git a/packages/uniforms/__tests__/BaseForm.tsx b/packages/uniforms/__tests__/BaseForm.tsx index 045eb2477..9cbe3a61f 100644 --- a/packages/uniforms/__tests__/BaseForm.tsx +++ b/packages/uniforms/__tests__/BaseForm.tsx @@ -133,7 +133,7 @@ describe('BaseForm', () => { expect(context2).toHaveProperty('changedMap.$'); expect(context2.changedMap.$).toBeTruthy(); expect(context2).toHaveProperty('changedMap.$.1'); - // @ts-ignore: Dynamic `changedMap` structure. + // @ts-expect-error: Dynamic `changedMap` structure. expect(context2.changedMap.$?.[1]).toBeTruthy(); }); diff --git a/packages/uniforms/__tests__/QuickForm.tsx b/packages/uniforms/__tests__/QuickForm.tsx index ceaf57211..7e12e5fb8 100644 --- a/packages/uniforms/__tests__/QuickForm.tsx +++ b/packages/uniforms/__tests__/QuickForm.tsx @@ -8,7 +8,7 @@ jest.mock('meteor/aldeed:simple-schema'); jest.mock('meteor/check'); describe('QuickForm', () => { - // @ts-ignore QuickForm is not a valid Component. + // @ts-expect-error QuickForm is not a valid Component. class TestForm extends QuickForm { // eslint-disable-next-line react/display-name getAutoField = () => () => ; diff --git a/packages/uniforms/__tests__/filterDOMProps.ts b/packages/uniforms/__tests__/filterDOMProps.ts index 770ebf68f..33ac5980e 100644 --- a/packages/uniforms/__tests__/filterDOMProps.ts +++ b/packages/uniforms/__tests__/filterDOMProps.ts @@ -11,7 +11,7 @@ describe('joinName', () => { }); it('removes registered props', () => { - // @ts-ignore: Do not register its type not to pollute it. + // @ts-expect-error: Do not register its type not to pollute it. filterDOMProps.register('__special__'); expect(filterDOMProps({ __special__: true })).toEqual({}); diff --git a/packages/uniforms/src/AutoForm.tsx b/packages/uniforms/src/AutoForm.tsx index 58b1e7bef..5ca775e02 100644 --- a/packages/uniforms/src/AutoForm.tsx +++ b/packages/uniforms/src/AutoForm.tsx @@ -23,7 +23,7 @@ export type AutoFormState = ValidatedQuickFormState & { }; export function Auto(Base: Base) { - // @ts-ignore: Mixin class problem. + // @ts-expect-error: Mixin class problem. class AutoForm< Model, Props extends AutoFormProps = AutoFormProps, diff --git a/packages/uniforms/src/BaseForm.tsx b/packages/uniforms/src/BaseForm.tsx index f318ba3f0..dfae25306 100644 --- a/packages/uniforms/src/BaseForm.tsx +++ b/packages/uniforms/src/BaseForm.tsx @@ -57,7 +57,7 @@ export class BaseForm< constructor(props: Props) { super(props); - // @ts-ignore: State may be bigger, but it'll be covered by the subclasses. + // @ts-expect-error: State may be bigger, but it'll be covered by the subclasses. this.state = { changed: false, changedMap: Object.create(null), @@ -240,7 +240,7 @@ export class BaseForm< } onReset() { - // @ts-ignore + // @ts-expect-error // It's bound in constructor. // eslint-disable-next-line @typescript-eslint/unbound-method this.setState(this.__reset); diff --git a/packages/uniforms/src/QuickForm.tsx b/packages/uniforms/src/QuickForm.tsx index ed44ff7ef..16dfdd6f9 100644 --- a/packages/uniforms/src/QuickForm.tsx +++ b/packages/uniforms/src/QuickForm.tsx @@ -11,7 +11,7 @@ export type QuickFormProps = BaseFormProps & { export type QuickFormState = BaseFormState; export function Quick(Base: Base) { - // @ts-ignore: Mixin class problem. + // @ts-expect-error: Mixin class problem. class QuickForm< Model, Props extends QuickFormProps = QuickFormProps, diff --git a/packages/uniforms/src/ValidatedForm.tsx b/packages/uniforms/src/ValidatedForm.tsx index 5d4001d27..0aa39d7a9 100644 --- a/packages/uniforms/src/ValidatedForm.tsx +++ b/packages/uniforms/src/ValidatedForm.tsx @@ -23,7 +23,7 @@ export type ValidatedFormState = BaseFormState & { }; export function Validated(Base: Base) { - // @ts-ignore: Mixin class problem. + // @ts-expect-error: Mixin class problem. class ValidatedForm< Model, Props extends ValidatedFormProps = ValidatedFormProps, diff --git a/packages/uniforms/src/connectField.tsx b/packages/uniforms/src/connectField.tsx index c8ab39bbf..8e4245a28 100644 --- a/packages/uniforms/src/connectField.tsx +++ b/packages/uniforms/src/connectField.tsx @@ -31,7 +31,7 @@ export function connectField< const hasChainName = props.name !== ''; const anyFlowingPropertySet = some( context.state, - // @ts-ignore: `props` has no index signature. + // @ts-expect-error: `props` has no index signature. (_, key) => props[key] !== null && props[key] !== undefined, ); @@ -42,7 +42,7 @@ export function connectField< const nextContext = { ...context }; if (anyFlowingPropertySet) { nextContext.state = mapValues(nextContext.state, (value, key) => - // @ts-ignore: `props` has no index signature. + // @ts-expect-error: `props` has no index signature. props[key] !== null && props[key] !== undefined ? !!props[key] : value, ); } diff --git a/website/components/Playground.tsx b/website/components/Playground.tsx index 57bc45e15..a716a3046 100644 --- a/website/components/Playground.tsx +++ b/website/components/Playground.tsx @@ -2,7 +2,7 @@ import ConfigProvider from 'antd/lib/config-provider'; import classNames from 'classnames'; import omit from 'lodash/omit'; import React, { Component } from 'react'; -// @ts-ignore +// @ts-expect-error import Frame, { FrameContextConsumer } from 'react-frame-component'; import { ValidatedForm, connectField, context, useForm } from 'uniforms'; @@ -19,7 +19,7 @@ export class Playground extends Component { } constructor() { - // @ts-ignore: Types. + // @ts-expect-error: Types. super(...arguments); const state = schema.clean(parseQuery()); @@ -60,7 +60,7 @@ export class Playground extends Component { render() { return ( - // @ts-ignore: Types. + // @ts-expect-error: Types. { class PlaygroundPreview extends Component { constructor() { - // @ts-ignore: Types. + // @ts-expect-error: Types. super(...arguments); this._schema = eval(`(${this.props.value.schema})`); diff --git a/website/lib/schema.ts b/website/lib/schema.ts index a0c6d1724..45f7a86e7 100644 --- a/website/lib/schema.ts +++ b/website/lib/schema.ts @@ -1,6 +1,6 @@ import Ajv from 'ajv'; import { buildASTSchema, parse } from 'graphql'; -// @ts-ignore: Typings. +// @ts-expect-error: Typings. import MessageBox from 'message-box'; import SimpleSchema from 'simpl-schema'; import { GraphQLBridge } from 'uniforms-bridge-graphql'; @@ -89,13 +89,13 @@ export const schema = new SimpleSchema({ asyncOnSubmit: false, asyncOnValidate: false, }, - // @ts-ignore: SimpleSchema extensibility. + // @ts-expect-error: SimpleSchema extensibility. uniforms: { schema: propsBridge }, }, theme: { type: String, - // @ts-ignore: SimpleSchema extensibility. + // @ts-expect-error: SimpleSchema extensibility. uniforms: { transform: (theme: string) => `uniforms-${theme}` }, defaultValue: Object.keys(themes)[0], allowedValues: Object.keys(themes),