Skip to content

Commit cf8cf3b

Browse files
committed
Fixed additional issues
1 parent d5b2a63 commit cf8cf3b

25 files changed

+53
-50
lines changed

cvat-ui/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
'@typescript-eslint/indent': ['warn', 4],
2929
'react/jsx-indent': ['warn', 4],
3030
'react/jsx-indent-props': ['warn', 4],
31+
'react/jsx-props-no-spreading': 0,
3132
'jsx-quotes': ['error', 'prefer-single'],
3233
'arrow-parens': ['error', 'always'],
3334
'@typescript-eslint/no-explicit-any': [0],

cvat-ui/src/components/actions-menu/actions-menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default function ActionsMenuComponent(props: ActionsMenuComponentProps):
9292
>
9393
<Menu.SubMenu key='dump' title='Dump annotations'>
9494
{
95-
dumpers.map((dumper) => DumperItemComponent({
95+
dumpers.map((dumper): JSX.Element => DumperItemComponent({
9696
dumper,
9797
taskInstance: props.taskInstance,
9898
dumpActivity: (props.dumpActivities || [])
@@ -103,7 +103,7 @@ export default function ActionsMenuComponent(props: ActionsMenuComponentProps):
103103
</Menu.SubMenu>
104104
<Menu.SubMenu key='load' title='Upload annotations'>
105105
{
106-
loaders.map((loader) => LoaderItemComponent({
106+
loaders.map((loader): JSX.Element => LoaderItemComponent({
107107
loader,
108108
taskInstance: props.taskInstance,
109109
loadActivity: props.loadActivity,
@@ -113,7 +113,7 @@ export default function ActionsMenuComponent(props: ActionsMenuComponentProps):
113113
</Menu.SubMenu>
114114
<Menu.SubMenu key='export' title='Export as a dataset'>
115115
{
116-
exporters.map((exporter) => ExportItemComponent({
116+
exporters.map((exporter): JSX.Element => ExportItemComponent({
117117
exporter,
118118
taskInstance: props.taskInstance,
119119
exportActivity: (props.exportActivities || [])

cvat-ui/src/components/create-model-page/create-model-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class CreateModelForm extends React.PureComponent<Props> {
1818
public submit(): Promise<{name: string; global: boolean}> {
1919
const { form } = this.props;
2020
return new Promise((resolve, reject) => {
21-
form.validateFields((errors, values) => {
21+
form.validateFields((errors, values): void => {
2222
if (!errors) {
2323
resolve({
2424
name: values.name,

cvat-ui/src/components/create-task-page/advanced-configuration-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AdvancedConfigurationForm extends React.PureComponent<Props> {
4040
onSubmit,
4141
} = this.props;
4242

43-
form.validateFields((error, values) => {
43+
form.validateFields((error, values): void => {
4444
if (!error) {
4545
const filteredValues = { ...values };
4646
delete filteredValues.frameStep;

cvat-ui/src/components/create-task-page/basic-configuration-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BasicConfigurationForm extends React.PureComponent<Props> {
2222
onSubmit,
2323
} = this.props;
2424

25-
form.validateFields((error, values) => {
25+
form.validateFields((error, values): void => {
2626
if (!error) {
2727
onSubmit({
2828
name: values.name,

cvat-ui/src/components/create-task-page/create-task-content.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ export default class CreateTaskContent extends React.PureComponent<Props, State>
131131
return this.advancedConfigurationComponent.submit();
132132
}
133133

134-
return new Promise((resolve) => {
134+
return new Promise((resolve): void => {
135135
resolve();
136136
});
137-
}).then(() => {
137+
}).then((): void => {
138138
const { onCreate } = this.props;
139139
onCreate(this.state);
140-
}).catch(() => {
140+
}).catch((): void => {
141141
notification.error({
142142
message: 'Could not create a task',
143143
description: 'Please, check configuration you specified',

cvat-ui/src/components/file-manager/file-manager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class FileManager extends React.PureComponent<Props, State> {
5959
}
6060

6161
private loadData = (key: string): Promise<void> => new Promise<void>(
62-
(resolve, reject) => {
62+
(resolve, reject): void => {
6363
const { onLoadData } = this.props;
6464

6565
const success = (): void => resolve();

cvat-ui/src/components/labels-editor/label-form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ class LabelForm extends React.PureComponent<Props, {}> {
5252
onSubmit,
5353
} = this.props;
5454

55-
form.validateFields((error, values) => {
55+
form.validateFields((error, values): void => {
5656
if (!error) {
5757
onSubmit({
5858
name: values.labelName,
5959
id: label ? label.id : idGenerator(),
60-
attributes: values.keys.map((key: number, index: number) => (
60+
attributes: values.keys.map((key: number, index: number): Attribute => (
6161
{
6262
name: values.attrName[key],
6363
type: values.type[key],
@@ -223,7 +223,7 @@ class LabelForm extends React.PureComponent<Props, {}> {
223223
const validator = (_: any, strNumbers: string, callback: any): void => {
224224
const numbers = strNumbers
225225
.split(';')
226-
.map((number) => Number.parseFloat(number));
226+
.map((number): number => Number.parseFloat(number));
227227
if (numbers.length !== 3) {
228228
callback('Invalid input');
229229
}
@@ -470,7 +470,7 @@ class LabelForm extends React.PureComponent<Props, {}> {
470470

471471
form.getFieldDecorator('keys', {
472472
initialValue: label
473-
? label.attributes.map((attr: Attribute) => attr.id)
473+
? label.attributes.map((attr: Attribute): number => attr.id)
474474
: [],
475475
});
476476

cvat-ui/src/components/labels-editor/labels-editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export default class LabelsEditor
179179
} = this.state;
180180

181181
const filteredUnsavedLabels = unsavedLabels.filter(
182-
(_label: Label) => _label.id !== label.id,
182+
(_label: Label): boolean => _label.id !== label.id,
183183
);
184184

185185
this.setState({

cvat-ui/src/components/labels-editor/raw-viewer.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { FormComponentProps } from 'antd/lib/form/Form';
1313

1414
import {
1515
Label,
16+
Attribute,
1617
} from './common';
1718

1819
type Props = FormComponentProps & {
@@ -38,7 +39,7 @@ class RawViewer extends React.PureComponent<Props> {
3839
} = this.props;
3940

4041
e.preventDefault();
41-
form.validateFields((error, values) => {
42+
form.validateFields((error, values): void => {
4243
if (!error) {
4344
onSubmit(JSON.parse(values.labels));
4445
}
@@ -47,11 +48,11 @@ class RawViewer extends React.PureComponent<Props> {
4748

4849
public render(): JSX.Element {
4950
const { labels } = this.props;
50-
const convertedLabels = labels.map((label: any) => (
51+
const convertedLabels = labels.map((label: any): Label => (
5152
{
5253
...label,
5354
id: label.id < 0 ? undefined : label.id,
54-
attributes: label.attributes.map((attribute: any) => (
55+
attributes: label.attributes.map((attribute: any): Attribute => (
5556
{
5657
...attribute,
5758
id: attribute.id < 0 ? undefined : attribute.id,

0 commit comments

Comments
 (0)