Fix lint warnings

This commit is contained in:
Alice Rosa 2022-09-02 15:58:47 +03:00
parent f0c3e8b4ff
commit 046feb1f98
2 changed files with 9 additions and 16 deletions

View File

@ -1,5 +1,4 @@
import * as React from 'react';
import { autobind } from 'office-ui-fabric-react/lib/Utilities';
import { IFieldConfiguration } from './IFieldConfiguration';
import { IListFormProps } from './IListFormProps';
import { IListFormState } from './IListFormState';
@ -233,8 +232,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
}
}
@autobind
private async readSchema(listUrl: string, formType: ControlMode): Promise<void> {
private readSchema = async (listUrl: string, formType: ControlMode): Promise<void> => {
try {
if (!listUrl) {
this.setState({ ...this.state, isLoadingSchema: false, fieldsSchema: null, errors: [strings.ConfigureListMessage] });
@ -293,8 +291,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
}
}
@autobind
private async readData(listUrl: string, formType: ControlMode, id?: number): Promise<void> {
private readData = async (listUrl: string, formType: ControlMode, id?: number): Promise<void> => {
try {
if ((formType === ControlMode.New) || !id) {
const data = this.state.fieldsSchema
@ -333,8 +330,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
}
}
@autobind
private async valueChanged(fieldName: string, newValue: any) {
private valueChanged = async (fieldName: string, newValue: any) => {
let schema = this.state.fieldsSchema.filter((item) => item.InternalName === fieldName)[0];
if (schema.Type == "User" || schema.Type === "UserMulti") {
for (let i = 0; i < newValue.length; i++) {

View File

@ -24,8 +24,6 @@ export interface IDateFormFieldState {
export default class DateFormField extends React.Component<IDateFormFieldProps, IDateFormFieldState> {
constructor(props) {
super(props);
this._createComboBoxHours = this._createComboBoxHours.bind(this);
this._createComboBoxMinutes = this._createComboBoxMinutes.bind(this);
this.state = {
date: null,
hours: 0,
@ -38,7 +36,7 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
if (this.props.value && prevProps.value != this.props.value) {
let momentDate = this.props.fieldSchema.DisplayFormat == 1 ?
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('LT')) :
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('L'))
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('L'));
this.setState({
hours: momentDate.hour(),
minutes: momentDate.minute(),
@ -148,18 +146,18 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
}
}
private _parseDateString(inputDate: string): Date {
private _parseDateString = (inputDate: string): Date => {
if (!inputDate) {
return null;
}
let momentDate = this.props.fieldSchema.DisplayFormat == 1 ?
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('LT')) :
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('L'))
return momentDate.toDate()
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('L'));
return momentDate.toDate();
}
private _createComboBoxHours(): IComboBoxOption[] {
private _createComboBoxHours = (): IComboBoxOption[] => {
let results = new Array<IComboBoxOption>();
if (this.props.fieldSchema.HoursOptions) {
results = this.props.fieldSchema.HoursOptions.map((item, index) => {
@ -171,7 +169,7 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
}
return results;
}
private _createComboBoxMinutes(): IComboBoxOption[] {
private _createComboBoxMinutes = (): IComboBoxOption[] => {
let results = new Array<IComboBoxOption>();
for (var i = 0; i < 60; i++) {
results.push({
@ -181,5 +179,4 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
}
return results;
}
}