Enable @typescript-eslint/explicit-member-accessibility on /src (#9785)

* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier
This commit is contained in:
Michael Telatynski 2022-12-16 12:29:59 +00:00 committed by GitHub
parent 51554399fb
commit f1e8e7f140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
396 changed files with 1110 additions and 1098 deletions

View file

@ -34,14 +34,14 @@ interface ICaptchaFormState {
* A pure UI component which displays a captcha form.
*/
export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICaptchaFormState> {
static defaultProps = {
public static defaultProps = {
onCaptchaResponse: () => {},
};
private captchaWidgetId?: string;
private recaptchaContainer = createRef<HTMLDivElement>();
constructor(props: ICaptchaFormProps) {
public constructor(props: ICaptchaFormProps) {
super(props);
this.state = {
@ -49,7 +49,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
};
}
componentDidMount() {
public componentDidMount() {
// Just putting a script tag into the returned jsx doesn't work, annoyingly,
// so we do this instead.
if (this.isRecaptchaReady()) {
@ -69,7 +69,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}
}
componentWillUnmount() {
public componentWillUnmount() {
this.resetRecaptcha();
}
@ -122,7 +122,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}
}
render() {
public render() {
let error = null;
if (this.state.errorText) {
error = <div className="error">{this.state.errorText}</div>;

View file

@ -53,7 +53,7 @@ interface IState {
}
export default class CountryDropdown extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0];

View file

@ -39,7 +39,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class EmailField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Email"),
labelRequired: _td("Enter email address"),
labelInvalid: _td("Doesn't look like a valid email address"),
@ -60,7 +60,7 @@ class EmailField extends PureComponent<IProps> {
],
});
onValidate = async (fieldState: IFieldState) => {
public onValidate = async (fieldState: IFieldState) => {
let validate = this.validate;
if (this.props.validationRules) {
validate = this.props.validationRules;
@ -74,7 +74,7 @@ class EmailField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
id={this.props.id}

View file

@ -98,9 +98,9 @@ interface IPasswordAuthEntryState {
}
export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswordAuthEntryState> {
static LOGIN_TYPE = AuthType.Password;
public static LOGIN_TYPE = AuthType.Password;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -108,7 +108,7 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
@ -136,7 +136,7 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
});
};
render() {
public render() {
const passwordBoxClass = classNames({
error: this.props.errorText,
});
@ -194,9 +194,9 @@ interface IRecaptchaAuthEntryProps extends IAuthEntryProps {
/* eslint-enable camelcase */
export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps> {
static LOGIN_TYPE = AuthType.Recaptcha;
public static LOGIN_TYPE = AuthType.Recaptcha;
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
@ -207,7 +207,7 @@ export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps
});
};
render() {
public render() {
if (this.props.busy) {
return <Spinner />;
}
@ -262,9 +262,9 @@ interface ITermsAuthEntryState {
}
export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITermsAuthEntryState> {
static LOGIN_TYPE = AuthType.Terms;
public static LOGIN_TYPE = AuthType.Terms;
constructor(props) {
public constructor(props) {
super(props);
// example stageParams:
@ -320,7 +320,7 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
@ -349,7 +349,7 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
}
};
render() {
public render() {
if (this.props.busy) {
return <Spinner />;
}
@ -423,9 +423,9 @@ export class EmailIdentityAuthEntry extends React.Component<
IEmailIdentityAuthEntryProps,
IEmailIdentityAuthEntryState
> {
static LOGIN_TYPE = AuthType.Email;
public static LOGIN_TYPE = AuthType.Email;
constructor(props: IEmailIdentityAuthEntryProps) {
public constructor(props: IEmailIdentityAuthEntryProps) {
super(props);
this.state = {
@ -434,11 +434,11 @@ export class EmailIdentityAuthEntry extends React.Component<
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
render() {
public render() {
let errorSection;
// ignore the error when errcode is M_UNAUTHORIZED as we expect that error until the link is clicked.
if (this.props.errorText && this.props.errorCode !== "M_UNAUTHORIZED") {
@ -549,13 +549,13 @@ interface IMsisdnAuthEntryState {
}
export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsisdnAuthEntryState> {
static LOGIN_TYPE = AuthType.Msisdn;
public static LOGIN_TYPE = AuthType.Msisdn;
private submitUrl: string;
private sid: string;
private msisdn: string;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -565,7 +565,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
this.setState({ requestingToken: true });
@ -646,7 +646,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
}
};
render() {
public render() {
if (this.state.requestingToken) {
return <Spinner />;
} else {
@ -704,16 +704,16 @@ interface ISSOAuthEntryState {
}
export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEntryState> {
static LOGIN_TYPE = AuthType.Sso;
static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable;
public static LOGIN_TYPE = AuthType.Sso;
public static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable;
static PHASE_PREAUTH = 1; // button to start SSO
static PHASE_POSTAUTH = 2; // button to confirm SSO completed
public static PHASE_PREAUTH = 1; // button to start SSO
public static PHASE_POSTAUTH = 2; // button to confirm SSO completed
private ssoUrl: string;
private popupWindow: Window;
constructor(props) {
public constructor(props) {
super(props);
// We actually send the user through fallback auth so we don't have to
@ -729,11 +729,11 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(SSOAuthEntry.PHASE_PREAUTH);
}
componentWillUnmount() {
public componentWillUnmount() {
window.removeEventListener("message", this.onReceiveMessage);
if (this.popupWindow) {
this.popupWindow.close();
@ -770,7 +770,7 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
this.props.submitAuthDict({});
};
render() {
public render() {
let continueButton = null;
const cancelButton = (
<AccessibleButton
@ -825,7 +825,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
private popupWindow: Window;
private fallbackButton = createRef<HTMLButtonElement>();
constructor(props) {
public constructor(props) {
super(props);
// we have to make the user click a button, as browsers will block
@ -834,11 +834,11 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
window.addEventListener("message", this.onReceiveMessage);
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
componentWillUnmount() {
public componentWillUnmount() {
window.removeEventListener("message", this.onReceiveMessage);
if (this.popupWindow) {
this.popupWindow.close();
@ -865,7 +865,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
}
};
render() {
public render() {
let errorSection;
if (this.props.errorText) {
errorSection = (

View file

@ -35,7 +35,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class PassphraseConfirmField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Confirm password"),
labelRequired: _td("Confirm password"),
labelInvalid: _td("Passwords don't match"),
@ -65,7 +65,7 @@ class PassphraseConfirmField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
id={this.props.id}

View file

@ -41,7 +41,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class PassphraseField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Password"),
labelEnterPassword: _td("Enter password"),
labelStrongPassword: _td("Nice, strong password!"),
@ -94,7 +94,7 @@ class PassphraseField extends PureComponent<IProps> {
],
});
onValidate = async (fieldState: IFieldState) => {
public onValidate = async (fieldState: IFieldState) => {
const result = await this.validate(fieldState);
if (this.props.onValidate) {
this.props.onValidate(result);
@ -102,7 +102,7 @@ class PassphraseField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
id={this.props.id}

View file

@ -66,7 +66,7 @@ enum LoginField {
* The email/username/phone fields are fully-controlled, the password field is not.
*/
export default class PasswordLogin extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onUsernameChanged: function () {},
onUsernameBlur: function () {},
onPhoneCountryChanged: function () {},
@ -75,7 +75,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
disableSubmit: false,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
// Field error codes by field ID
@ -363,7 +363,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
}
}
render() {
public render() {
let forgotPasswordJsx;
if (this.props.onForgotPasswordClick) {

View file

@ -95,12 +95,12 @@ interface IState {
* A pure UI component which displays a registration form.
*/
export default class RegistrationForm extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onValidationChange: logger.error,
canSubmit: true,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -468,7 +468,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
renderPasswordConfirm() {
public renderPasswordConfirm() {
return (
<PassphraseConfirmField
id="mx_RegistrationForm_passwordConfirm"
@ -482,7 +482,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
renderPhoneNumber() {
public renderPhoneNumber() {
if (!this.showPhoneNumber()) {
return null;
}
@ -508,7 +508,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
renderUsername() {
public renderUsername() {
return (
<Field
id="mx_RegistrationForm_username"
@ -524,7 +524,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
render() {
public render() {
const registerButton = (
<input className="mx_Login_submit" type="submit" value={_t("Register")} disabled={!this.props.canSubmit} />
);