Enable @typescript-eslint/explicit-member-accessibility
on /src (#9785)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier
This commit is contained in:
parent
51554399fb
commit
f1e8e7f140
396 changed files with 1110 additions and 1098 deletions
|
@ -55,7 +55,7 @@ interface IState {
|
|||
export default class DateSeparator extends React.Component<IProps, IState> {
|
||||
private settingWatcherRef = null;
|
||||
|
||||
constructor(props, context) {
|
||||
public constructor(props, context) {
|
||||
super(props, context);
|
||||
this.state = {
|
||||
jumpToDateEnabled: SettingsStore.getValue("feature_jump_to_date"),
|
||||
|
@ -72,7 +72,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
|
|||
);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
public componentWillUnmount() {
|
||||
SettingsStore.unwatchSetting(this.settingWatcherRef);
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
|
|||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const label = this.getLabel();
|
||||
|
||||
let dateHeaderContent;
|
||||
|
|
|
@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import React, { ReactNode } from "react";
|
||||
|
||||
import { _t } from "../../../languageHandler";
|
||||
import { IBodyProps } from "./IBodyProps";
|
||||
|
||||
// A placeholder element for messages that could not be decrypted
|
||||
export default class DecryptionFailureBody extends React.Component<Partial<IBodyProps>> {
|
||||
render() {
|
||||
public render(): ReactNode {
|
||||
return <div className="mx_DecryptionFailureBody mx_EventTile_content">{_t("Unable to decrypt message")}</div>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ interface IProps {
|
|||
}
|
||||
|
||||
export default class DisambiguatedProfile extends React.Component<IProps> {
|
||||
render() {
|
||||
public render() {
|
||||
const { fallbackName, member, colored, emphasizeDisplayName, onClick } = this.props;
|
||||
const rawDisplayName = member?.rawDisplayName || fallbackName;
|
||||
const mxid = member?.userId;
|
||||
|
|
|
@ -55,7 +55,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
|
|||
private pills: Element[] = [];
|
||||
private tooltips: Element[] = [];
|
||||
|
||||
constructor(props: IProps) {
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
|
|
|
@ -50,7 +50,7 @@ export default class LegacyCallEvent extends React.PureComponent<IProps, IState>
|
|||
private wrapperElement = createRef<HTMLDivElement>();
|
||||
private resizeObserver: ResizeObserver;
|
||||
|
||||
constructor(props: IProps) {
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
@ -61,7 +61,7 @@ export default class LegacyCallEvent extends React.PureComponent<IProps, IState>
|
|||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
public componentDidMount() {
|
||||
this.props.callEventGrouper.addListener(LegacyCallEventGrouperEvent.StateChanged, this.onStateChanged);
|
||||
this.props.callEventGrouper.addListener(LegacyCallEventGrouperEvent.SilencedChanged, this.onSilencedChanged);
|
||||
this.props.callEventGrouper.addListener(LegacyCallEventGrouperEvent.LengthChanged, this.onLengthChanged);
|
||||
|
@ -70,7 +70,7 @@ export default class LegacyCallEvent extends React.PureComponent<IProps, IState>
|
|||
this.wrapperElement.current && this.resizeObserver.observe(this.wrapperElement.current);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
public componentWillUnmount() {
|
||||
this.props.callEventGrouper.removeListener(LegacyCallEventGrouperEvent.StateChanged, this.onStateChanged);
|
||||
this.props.callEventGrouper.removeListener(LegacyCallEventGrouperEvent.SilencedChanged, this.onSilencedChanged);
|
||||
this.props.callEventGrouper.removeListener(LegacyCallEventGrouperEvent.LengthChanged, this.onLengthChanged);
|
||||
|
|
|
@ -36,10 +36,10 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class MAudioBody extends React.PureComponent<IBodyProps, IState> {
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
||||
constructor(props: IBodyProps) {
|
||||
public constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {};
|
||||
|
|
|
@ -106,10 +106,10 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class MFileBody extends React.Component<IProps, IState> {
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
||||
static defaultProps = {
|
||||
public static defaultProps = {
|
||||
showGenericPlaceholder: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class MImageBody extends React.Component<IBodyProps, IState> {
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private unmounted = true;
|
||||
|
@ -72,7 +72,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
private sizeWatcher: string;
|
||||
private reconnectedListener: ClientEventHandlerMap[ClientEvent.Sync];
|
||||
|
||||
constructor(props: IBodyProps) {
|
||||
public constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
this.reconnectedListener = createReconnectedListener(this.clearError);
|
||||
|
@ -325,7 +325,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
public componentDidMount() {
|
||||
this.unmounted = false;
|
||||
|
||||
const showImage =
|
||||
|
@ -354,7 +354,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
public componentWillUnmount() {
|
||||
this.unmounted = true;
|
||||
MatrixClientPeg.get().off(ClientEvent.Sync, this.reconnectedListener);
|
||||
this.clearBlurhashTimeout();
|
||||
|
@ -562,7 +562,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const content = this.props.mxEvent.getContent<IMediaEventContent>();
|
||||
|
||||
if (this.state.error) {
|
||||
|
@ -605,7 +605,7 @@ interface PlaceholderIProps {
|
|||
}
|
||||
|
||||
export class HiddenImagePlaceholder extends React.PureComponent<PlaceholderIProps> {
|
||||
render() {
|
||||
public render() {
|
||||
const maxWidth = this.props.maxWidth ? this.props.maxWidth + "px" : null;
|
||||
let className = "mx_HiddenImagePlaceholder";
|
||||
if (this.props.hover) className += " mx_HiddenImagePlaceholder_hover";
|
||||
|
|
|
@ -30,7 +30,7 @@ export default class MImageReplyBody extends MImageBody {
|
|||
return children;
|
||||
}
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
if (this.state.error) {
|
||||
return super.render();
|
||||
}
|
||||
|
|
|
@ -29,11 +29,11 @@ interface IProps {
|
|||
}
|
||||
|
||||
export default class MJitsiWidgetEvent extends React.PureComponent<IProps> {
|
||||
constructor(props) {
|
||||
public constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const url = this.props.mxEvent.getContent()["url"];
|
||||
const prevUrl = this.props.mxEvent.getPrevContent()["url"];
|
||||
const senderName = this.props.mxEvent.sender?.name || this.props.mxEvent.getSender();
|
||||
|
|
|
@ -36,7 +36,7 @@ interface IProps {
|
|||
}
|
||||
|
||||
export default class MKeyVerificationConclusion extends React.Component<IProps> {
|
||||
constructor(props: IProps) {
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
|||
private mapId: string;
|
||||
private reconnectedListener: ClientEventHandlerMap[ClientEvent.Sync];
|
||||
|
||||
constructor(props: IBodyProps) {
|
||||
public constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
// multiple instances of same map might be in document
|
||||
|
@ -84,11 +84,11 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
|||
this.context.on(ClientEvent.Sync, this.reconnectedListener);
|
||||
};
|
||||
|
||||
componentWillUnmount(): void {
|
||||
public componentWillUnmount(): void {
|
||||
this.context.off(ClientEvent.Sync, this.reconnectedListener);
|
||||
}
|
||||
|
||||
render(): React.ReactElement<HTMLDivElement> {
|
||||
public render(): React.ReactElement<HTMLDivElement> {
|
||||
return this.state.error ? (
|
||||
<LocationBodyFallbackContent error={this.state.error} event={this.props.mxEvent} />
|
||||
) : (
|
||||
|
|
|
@ -224,7 +224,7 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {
|
|||
private voteRelationsReceived = false;
|
||||
private endRelationsReceived = false;
|
||||
|
||||
constructor(props: IBodyProps) {
|
||||
public constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
@ -237,7 +237,7 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {
|
|||
this.props.mxEvent.on(MatrixEventEvent.RelationsCreated, this.onRelationsCreated);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
public componentWillUnmount() {
|
||||
this.props.mxEvent.off(MatrixEventEvent.RelationsCreated, this.onRelationsCreated);
|
||||
this.removeListeners(this.state.voteRelations, this.state.endRelations);
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {
|
|||
return isPollEnded(this.props.mxEvent, this.context, this.props.getRelationsForEvent);
|
||||
}
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const poll = this.props.mxEvent.unstableExtensibleEvent as PollStartEvent;
|
||||
if (!poll?.isEquivalentTo(M_POLL_START)) return null; // invalid
|
||||
|
||||
|
@ -552,7 +552,7 @@ function LivePollOption(props: ILivePollOptionProps) {
|
|||
}
|
||||
|
||||
export class UserVote {
|
||||
constructor(public readonly ts: number, public readonly sender: string, public readonly answers: string[]) {}
|
||||
public constructor(public readonly ts: number, public readonly sender: string, public readonly answers: string[]) {}
|
||||
}
|
||||
|
||||
function userResponseFromPollResponseEvent(event: MatrixEvent): UserVote {
|
||||
|
|
|
@ -41,13 +41,13 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class MVideoBody extends React.PureComponent<IBodyProps, IState> {
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private videoRef = React.createRef<HTMLVideoElement>();
|
||||
private sizeWatcher: string;
|
||||
|
||||
constructor(props) {
|
||||
public constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
@ -232,7 +232,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
|
|||
return this.showFileBody && <MFileBody {...this.props} showGenericPlaceholder={false} />;
|
||||
};
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const content = this.props.mxEvent.getContent();
|
||||
const autoplay = SettingsStore.getValue("autoplayVideo");
|
||||
|
||||
|
|
|
@ -78,10 +78,10 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
||||
constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
this.context = context;
|
||||
|
||||
|
@ -91,7 +91,7 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
public componentDidMount() {
|
||||
const { mxEvent, reactions } = this.props;
|
||||
|
||||
if (mxEvent.isBeingDecrypted() || mxEvent.shouldAttemptDecryption()) {
|
||||
|
@ -105,7 +105,7 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
public componentWillUnmount() {
|
||||
const { mxEvent, reactions } = this.props;
|
||||
|
||||
mxEvent.off(MatrixEventEvent.Decrypted, this.onDecrypted);
|
||||
|
@ -117,7 +117,7 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: IProps) {
|
||||
public componentDidUpdate(prevProps: IProps) {
|
||||
if (this.props.reactions && prevProps.reactions !== this.props.reactions) {
|
||||
this.props.reactions.on(RelationsEvent.Add, this.onReactionsChange);
|
||||
this.props.reactions.on(RelationsEvent.Remove, this.onReactionsChange);
|
||||
|
@ -161,7 +161,7 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
|||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const { mxEvent, reactions } = this.props;
|
||||
const { myReactions, showAll } = this.state;
|
||||
|
||||
|
|
|
@ -46,15 +46,15 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class ReactionsRowButton extends React.PureComponent<IProps, IState> {
|
||||
static contextType = MatrixClientContext;
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
state = {
|
||||
public state = {
|
||||
tooltipRendered: false,
|
||||
tooltipVisible: false,
|
||||
};
|
||||
|
||||
onClick = () => {
|
||||
public onClick = () => {
|
||||
const { mxEvent, myReactionEvent, content } = this.props;
|
||||
if (myReactionEvent) {
|
||||
this.context.redactEvent(mxEvent.getRoomId(), myReactionEvent.getId());
|
||||
|
@ -70,7 +70,7 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
|
|||
}
|
||||
};
|
||||
|
||||
onMouseOver = () => {
|
||||
public onMouseOver = () => {
|
||||
this.setState({
|
||||
// To avoid littering the DOM with a tooltip for every reaction,
|
||||
// only render it on first use.
|
||||
|
@ -79,13 +79,13 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
|
|||
});
|
||||
};
|
||||
|
||||
onMouseLeave = () => {
|
||||
public onMouseLeave = () => {
|
||||
this.setState({
|
||||
tooltipVisible: false,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const { mxEvent, content, count, reactionEvents, myReactionEvent } = this.props;
|
||||
|
||||
const classes = classNames({
|
||||
|
|
|
@ -34,9 +34,9 @@ interface IProps {
|
|||
}
|
||||
|
||||
export default class ReactionsRowButtonTooltip extends React.PureComponent<IProps> {
|
||||
static contextType = MatrixClientContext;
|
||||
public static contextType = MatrixClientContext;
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
const { content, reactionEvents, mxEvent, visible } = this.props;
|
||||
|
||||
const room = this.context.getRoom(mxEvent.getRoomId());
|
||||
|
|
|
@ -67,10 +67,10 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||
private pills: Element[] = [];
|
||||
private tooltips: Element[] = [];
|
||||
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
||||
constructor(props) {
|
||||
public constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
@ -79,7 +79,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
public componentDidMount() {
|
||||
if (!this.props.editState) {
|
||||
this.applyFormatting();
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
public componentDidUpdate(prevProps) {
|
||||
if (!this.props.editState) {
|
||||
const stoppedEditing = prevProps.editState && !this.props.editState;
|
||||
const messageWasEdited = prevProps.replacingEventId !== this.props.replacingEventId;
|
||||
|
@ -291,13 +291,13 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
public componentWillUnmount() {
|
||||
this.unmounted = true;
|
||||
unmountPills(this.pills);
|
||||
unmountTooltips(this.tooltips);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
public shouldComponentUpdate(nextProps, nextState) {
|
||||
//console.info("shouldComponentUpdate: ShowUrlPreview for %s is %s", this.props.mxEvent.getId(), this.props.showUrlPreview);
|
||||
|
||||
// exploit that events are immutable :)
|
||||
|
@ -562,7 +562,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||
return <span className="mx_EventTile_pendingModeration">{`(${text})`}</span>;
|
||||
}
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
if (this.props.editState) {
|
||||
const isWysiwygComposerEnabled = SettingsStore.getValue("feature_wysiwyg_composer");
|
||||
return isWysiwygComposerEnabled ? (
|
||||
|
|
|
@ -25,7 +25,7 @@ interface IProps {
|
|||
}
|
||||
|
||||
export default class TextualEvent extends React.Component<IProps> {
|
||||
static contextType = RoomContext;
|
||||
public static contextType = RoomContext;
|
||||
|
||||
public render() {
|
||||
const text = TextForEvent.textForEvent(this.props.mxEvent, true, this.context?.showHiddenEvents);
|
||||
|
|
|
@ -37,7 +37,7 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class TileErrorBoundary extends React.Component<IProps, IState> {
|
||||
constructor(props) {
|
||||
public constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
@ -45,7 +45,7 @@ export default class TileErrorBoundary extends React.Component<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error: Error): Partial<IState> {
|
||||
public static getDerivedStateFromError(error: Error): Partial<IState> {
|
||||
// Side effects are not permitted here, so we only update the state so
|
||||
// that the next render shows an error message.
|
||||
return { error };
|
||||
|
@ -68,7 +68,7 @@ export default class TileErrorBoundary extends React.Component<IProps, IState> {
|
|||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
public render() {
|
||||
if (this.state.error) {
|
||||
const { mxEvent } = this.props;
|
||||
const classes = {
|
||||
|
|
|
@ -31,7 +31,7 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class ViewSourceEvent extends React.PureComponent<IProps, IState> {
|
||||
constructor(props) {
|
||||
public constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue