Add @typescript-eslint/no-base-to-string (#10091)
This commit is contained in:
parent
30cc55515e
commit
35d222bac6
10 changed files with 28 additions and 14 deletions
|
@ -1,6 +1,9 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: ["matrix-org"],
|
plugins: ["matrix-org"],
|
||||||
extends: ["plugin:matrix-org/babel", "plugin:matrix-org/react", "plugin:matrix-org/a11y"],
|
extends: ["plugin:matrix-org/babel", "plugin:matrix-org/react", "plugin:matrix-org/a11y"],
|
||||||
|
parserOptions: {
|
||||||
|
project: ["./tsconfig.json"],
|
||||||
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
node: true,
|
node: true,
|
||||||
|
@ -168,6 +171,12 @@ module.exports = {
|
||||||
"@typescript-eslint/explicit-member-accessibility": "off",
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: ["cypress/**/*.ts"],
|
||||||
|
parserOptions: {
|
||||||
|
project: ["./cypress/tsconfig.json"],
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
settings: {
|
settings: {
|
||||||
react: {
|
react: {
|
||||||
|
|
|
@ -190,7 +190,7 @@
|
||||||
"eslint-plugin-deprecate": "^0.7.0",
|
"eslint-plugin-deprecate": "^0.7.0",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.25.4",
|
||||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||||
"eslint-plugin-matrix-org": "0.9.0",
|
"eslint-plugin-matrix-org": "0.10.0",
|
||||||
"eslint-plugin-react": "^7.28.0",
|
"eslint-plugin-react": "^7.28.0",
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
"eslint-plugin-unicorn": "^45.0.0",
|
"eslint-plugin-unicorn": "^45.0.0",
|
||||||
|
|
|
@ -48,7 +48,8 @@ export default class ServerOfflineDialog extends React.PureComponent<IProps> {
|
||||||
private renderTimeline(): React.ReactElement[] {
|
private renderTimeline(): React.ReactElement[] {
|
||||||
return EchoStore.instance.contexts.map((c, i) => {
|
return EchoStore.instance.contexts.map((c, i) => {
|
||||||
if (!c.firstFailedTime) return null; // not useful
|
if (!c.firstFailedTime) return null; // not useful
|
||||||
if (!(c instanceof RoomEchoContext)) throw new Error("Cannot render unknown context: " + c);
|
if (!(c instanceof RoomEchoContext))
|
||||||
|
throw new Error("Cannot render unknown context: " + c.constructor.name);
|
||||||
const header = (
|
const header = (
|
||||||
<div className="mx_ServerOfflineDialog_content_context_timeline_header">
|
<div className="mx_ServerOfflineDialog_content_context_timeline_header">
|
||||||
<RoomAvatar width={24} height={24} room={c.room} />
|
<RoomAvatar width={24} height={24} room={c.room} />
|
||||||
|
|
|
@ -185,6 +185,10 @@ export default class ProfileSettings extends React.Component<{}, IState> {
|
||||||
withDisplayName: true,
|
withDisplayName: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// False negative result from no-base-to-string rule, doesn't seem to account for Symbol.toStringTag
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
|
const avatarUrl = this.state.avatarUrl?.toString();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={this.saveProfile} autoComplete="off" noValidate={true} className="mx_ProfileSettings">
|
<form onSubmit={this.saveProfile} autoComplete="off" noValidate={true} className="mx_ProfileSettings">
|
||||||
<input
|
<input
|
||||||
|
@ -216,7 +220,7 @@ export default class ProfileSettings extends React.Component<{}, IState> {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<AvatarSetting
|
<AvatarSetting
|
||||||
avatarUrl={this.state.avatarUrl?.toString()}
|
avatarUrl={avatarUrl}
|
||||||
avatarName={this.state.displayName || this.state.userId}
|
avatarName={this.state.displayName || this.state.userId}
|
||||||
avatarAltText={_t("Profile picture")}
|
avatarAltText={_t("Profile picture")}
|
||||||
uploadAvatar={this.uploadAvatar}
|
uploadAvatar={this.uploadAvatar}
|
||||||
|
|
|
@ -260,7 +260,7 @@ export async function downloadBugReport(opts: IOpts = {}): Promise<void> {
|
||||||
reader.readAsArrayBuffer(value as Blob);
|
reader.readAsArrayBuffer(value as Blob);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
metadata += `${key} = ${value}\n`;
|
metadata += `${key} = ${value as string}\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tape.append("issue.txt", metadata);
|
tape.append("issue.txt", metadata);
|
||||||
|
|
|
@ -389,7 +389,7 @@ export class StopGapWidget extends EventEmitter {
|
||||||
// Now open the integration manager
|
// Now open the integration manager
|
||||||
// TODO: Spec this interaction.
|
// TODO: Spec this interaction.
|
||||||
const data = ev.detail.data;
|
const data = ev.detail.data;
|
||||||
const integType = data?.integType;
|
const integType = data?.integType as string;
|
||||||
const integId = <string>data?.integId;
|
const integId = <string>data?.integId;
|
||||||
|
|
||||||
// noinspection JSIgnoredPromiseFromCall
|
// noinspection JSIgnoredPromiseFromCall
|
||||||
|
|
|
@ -69,7 +69,7 @@ export function presentableTextForFile(
|
||||||
// it since it is "ugly", users generally aren't aware what it
|
// it since it is "ugly", users generally aren't aware what it
|
||||||
// means and the type of the attachment can usually be inferred
|
// means and the type of the attachment can usually be inferred
|
||||||
// from the file extension.
|
// from the file extension.
|
||||||
text += " (" + filesize(content.info.size) + ")";
|
text += " (" + <string>filesize(content.info.size) + ")";
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { IDestroyable } from "./IDestroyable";
|
import { IDestroyable } from "./IDestroyable";
|
||||||
import { arrayFastClone } from "./arrays";
|
import { arrayFastClone } from "./arrays";
|
||||||
|
|
||||||
export type WhenFn<T> = (w: Whenable<T>) => void;
|
export type WhenFn<T extends string | number> = (w: Whenable<T>) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenables are a cheap way to have Observable patterns mixed with typical
|
* Whenables are a cheap way to have Observable patterns mixed with typical
|
||||||
|
@ -27,7 +27,7 @@ export type WhenFn<T> = (w: Whenable<T>) => void;
|
||||||
* are intended to be used when a condition will be met multiple times and
|
* are intended to be used when a condition will be met multiple times and
|
||||||
* the consumer needs to know *when* that happens.
|
* the consumer needs to know *when* that happens.
|
||||||
*/
|
*/
|
||||||
export abstract class Whenable<T> implements IDestroyable {
|
export abstract class Whenable<T extends string | number> implements IDestroyable {
|
||||||
private listeners: { condition: T | null; fn: WhenFn<T> }[] = [];
|
private listeners: { condition: T | null; fn: WhenFn<T> }[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { ReactNode } from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
@ -65,7 +65,7 @@ export default class HTMLExporter extends Exporter {
|
||||||
this.threadsEnabled = SettingsStore.getValue("feature_threadenabled");
|
this.threadsEnabled = SettingsStore.getValue("feature_threadenabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getRoomAvatar(): Promise<ReactNode> {
|
protected async getRoomAvatar(): Promise<string> {
|
||||||
let blob: Blob | undefined = undefined;
|
let blob: Blob | undefined = undefined;
|
||||||
const avatarUrl = Avatar.avatarUrlForRoom(this.room, 32, 32, "crop");
|
const avatarUrl = Avatar.avatarUrlForRoom(this.room, 32, 32, "crop");
|
||||||
const avatarPath = "room.png";
|
const avatarPath = "room.png";
|
||||||
|
|
|
@ -4226,10 +4226,10 @@ eslint-plugin-jsx-a11y@^6.5.1:
|
||||||
minimatch "^3.1.2"
|
minimatch "^3.1.2"
|
||||||
semver "^6.3.0"
|
semver "^6.3.0"
|
||||||
|
|
||||||
eslint-plugin-matrix-org@0.9.0:
|
eslint-plugin-matrix-org@0.10.0:
|
||||||
version "0.9.0"
|
version "0.10.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-0.9.0.tgz#b2a5186052ddbfa7dc9878779bafa5d68681c7b4"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-0.10.0.tgz#8d0998641a4d276343cae2abf253a01bb4d4cc60"
|
||||||
integrity sha512-+j6JuMnFH421Z2vOxc+0YMt5Su5vD76RSatviy3zHBaZpgd+sOeAWoCLBHD5E7mMz5oKae3Y3wewCt9LRzq2Nw==
|
integrity sha512-L7ail0x1yUlF006kn4mHc+OT8/aYZI++i852YXPHxCbM1EY7jeg/fYAQ8tCx5+x08LyqXeS7inAVSL784m0C6Q==
|
||||||
|
|
||||||
eslint-plugin-react-hooks@^4.3.0:
|
eslint-plugin-react-hooks@^4.3.0:
|
||||||
version "4.6.0"
|
version "4.6.0"
|
||||||
|
|
Loading…
Reference in a new issue