Enable @typescript-eslint/explicit-function-return-type
in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier * Enable `@typescript-eslint/explicit-function-return-type` in /src * Fix types * tsc strict fixes * Delint * Fix test * Fix bad merge
This commit is contained in:
parent
7a36ba0fde
commit
030b7e90bf
683 changed files with 3459 additions and 3013 deletions
|
@ -38,7 +38,7 @@ interface IEditableAliasesListProps {
|
|||
class EditableAliasesList extends EditableItemList<IEditableAliasesListProps> {
|
||||
private aliasField = createRef<RoomAliasField>();
|
||||
|
||||
private onAliasAdded = async (ev: SyntheticEvent) => {
|
||||
private onAliasAdded = async (ev: SyntheticEvent): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
await this.aliasField.current.validate({ allowEmpty: false });
|
||||
|
||||
|
@ -51,8 +51,8 @@ class EditableAliasesList extends EditableItemList<IEditableAliasesListProps> {
|
|||
this.aliasField.current.validate({ allowEmpty: false, focused: true });
|
||||
};
|
||||
|
||||
protected renderNewItemField() {
|
||||
const onChange = (alias: string) => this.onNewItemChanged({ target: { value: alias } });
|
||||
protected renderNewItemField(): JSX.Element {
|
||||
const onChange = (alias: string): void => this.onNewItemChanged({ target: { value: alias } });
|
||||
return (
|
||||
<form
|
||||
onSubmit={this.onAliasAdded}
|
||||
|
@ -127,7 +127,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
if (this.props.canSetCanonicalAlias) {
|
||||
// load local aliases for providing recommendations
|
||||
// for the canonical alias and alt_aliases
|
||||
|
@ -135,7 +135,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private async loadLocalAliases() {
|
||||
private async loadLocalAliases(): Promise<void> {
|
||||
this.setState({ localAliasesLoading: true });
|
||||
try {
|
||||
const mxClient = this.context;
|
||||
|
@ -155,7 +155,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private changeCanonicalAlias(alias: string) {
|
||||
private changeCanonicalAlias(alias: string): void {
|
||||
if (!this.props.canSetCanonicalAlias) return;
|
||||
|
||||
const oldAlias = this.state.canonicalAlias;
|
||||
|
@ -188,7 +188,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
});
|
||||
}
|
||||
|
||||
private changeAltAliases(altAliases: string[]) {
|
||||
private changeAltAliases(altAliases: string[]): void {
|
||||
if (!this.props.canSetCanonicalAlias) return;
|
||||
|
||||
this.setState({
|
||||
|
@ -227,11 +227,11 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
});
|
||||
}
|
||||
|
||||
private onNewAliasChanged = (value: string) => {
|
||||
private onNewAliasChanged = (value: string): void => {
|
||||
this.setState({ newAlias: value });
|
||||
};
|
||||
|
||||
private onLocalAliasAdded = (alias: string) => {
|
||||
private onLocalAliasAdded = (alias: string): void => {
|
||||
if (!alias || alias.length === 0) return; // ignore attempts to create blank aliases
|
||||
|
||||
const localDomain = this.context.getDomain();
|
||||
|
@ -260,7 +260,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
});
|
||||
};
|
||||
|
||||
private onLocalAliasDeleted = (index: number) => {
|
||||
private onLocalAliasDeleted = (index: number): void => {
|
||||
const alias = this.state.localAliases[index];
|
||||
// TODO: In future, we should probably be making sure that the alias actually belongs
|
||||
// to this room. See https://github.com/vector-im/element-web/issues/7353
|
||||
|
@ -292,7 +292,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
});
|
||||
};
|
||||
|
||||
private onLocalAliasesToggled = (event: ChangeEvent<HTMLDetailsElement>) => {
|
||||
private onLocalAliasesToggled = (event: ChangeEvent<HTMLDetailsElement>): void => {
|
||||
// expanded
|
||||
if (event.target.open) {
|
||||
// if local aliases haven't been preloaded yet at component mount
|
||||
|
@ -303,15 +303,15 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
this.setState({ detailsOpen: event.currentTarget.open });
|
||||
};
|
||||
|
||||
private onCanonicalAliasChange = (event: ChangeEvent<HTMLSelectElement>) => {
|
||||
private onCanonicalAliasChange = (event: ChangeEvent<HTMLSelectElement>): void => {
|
||||
this.changeCanonicalAlias(event.target.value);
|
||||
};
|
||||
|
||||
private onNewAltAliasChanged = (value: string) => {
|
||||
private onNewAltAliasChanged = (value: string): void => {
|
||||
this.setState({ newAltAlias: value });
|
||||
};
|
||||
|
||||
private onAltAliasAdded = (alias: string) => {
|
||||
private onAltAliasAdded = (alias: string): void => {
|
||||
const altAliases = this.state.altAliases.slice();
|
||||
if (!altAliases.some((a) => a.trim() === alias.trim())) {
|
||||
altAliases.push(alias.trim());
|
||||
|
@ -320,22 +320,22 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
}
|
||||
};
|
||||
|
||||
private onAltAliasDeleted = (index: number) => {
|
||||
private onAltAliasDeleted = (index: number): void => {
|
||||
const altAliases = this.state.altAliases.slice();
|
||||
altAliases.splice(index, 1);
|
||||
this.changeAltAliases(altAliases);
|
||||
};
|
||||
|
||||
private getAliases() {
|
||||
private getAliases(): string[] {
|
||||
return this.state.altAliases.concat(this.getLocalNonAltAliases());
|
||||
}
|
||||
|
||||
private getLocalNonAltAliases() {
|
||||
private getLocalNonAltAliases(): string[] {
|
||||
const { altAliases } = this.state;
|
||||
return this.state.localAliases.filter((alias) => !altAliases.includes(alias));
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const mxClient = this.context;
|
||||
const localDomain = mxClient.getDomain();
|
||||
const isSpaceRoom = mxClient.getRoom(this.props.roomId)?.isSpaceRoom();
|
||||
|
|
|
@ -97,7 +97,7 @@ export default class RoomProfileSettings extends React.Component<IProps, IState>
|
|||
});
|
||||
};
|
||||
|
||||
private isSaveEnabled = () => {
|
||||
private isSaveEnabled = (): boolean => {
|
||||
return Boolean(Object.values(this.state.profileFieldsTouched).length);
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ export default class RoomPublishSetting extends React.PureComponent<IProps, ISta
|
|||
};
|
||||
}
|
||||
|
||||
private onRoomPublishChange = (e) => {
|
||||
private onRoomPublishChange = (e): void => {
|
||||
const valueBefore = this.state.isRoomPublished;
|
||||
const newValue = !valueBefore;
|
||||
this.setState({ isRoomPublished: newValue });
|
||||
|
@ -55,14 +55,14 @@ export default class RoomPublishSetting extends React.PureComponent<IProps, ISta
|
|||
});
|
||||
};
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
const client = MatrixClientPeg.get();
|
||||
client.getRoomDirectoryVisibility(this.props.roomId).then((result) => {
|
||||
this.setState({ isRoomPublished: result.visibility === "public" });
|
||||
});
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const client = MatrixClientPeg.get();
|
||||
|
||||
const room = client.getRoom(this.props.roomId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue