Add array-type TypeScript ESLint rule

This commit is contained in:
Evan Hahn 2021-07-08 16:55:48 -05:00 committed by GitHub
parent 7efa4f1a8a
commit da27a6ac64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 7 deletions

View file

@ -117,6 +117,8 @@ const rules = {
const typescriptRules = {
...rules,
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
// Overrides recommended by typescript-eslint
// https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0
'@typescript-eslint/no-redeclare': 'error',

View file

@ -66,7 +66,7 @@ export class Linkify extends React.Component<Props> {
const chunkData: Array<{
chunk: string;
matchData: LinkifyIt.Match[];
matchData: ReadonlyArray<LinkifyIt.Match>;
}> = splitByEmoji(text).map(({ type, value: chunk }) => {
if (type === 'text') {
return { chunk, matchData: linkify.match(chunk) || [] };

View file

@ -10,8 +10,11 @@ export interface MinimalIPC {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
sendSync(channel: string): any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
on(channel: string, listener: (event: unknown, ...args: any[]) => void): this;
on(
channel: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
listener: (event: unknown, ...args: ReadonlyArray<any>) => void
): this;
}
export type SystemThemeHolder = { systemTheme: 'dark' | 'light' };

View file

@ -248,7 +248,7 @@ const dataInterface: ServerInterface = {
};
export default dataInterface;
type DatabaseQueryCache = Map<string, Statement<any[]>>;
type DatabaseQueryCache = Map<string, Statement<Array<any>>>;
const statementCache = new WeakMap<Database, DatabaseQueryCache>();

View file

@ -94,7 +94,10 @@ describe('MentionCompletion', () => {
});
describe('onTextChange', () => {
let possiblyShowMemberResultsStub: sinon.SinonStub<[], ConversationType[]>;
let possiblyShowMemberResultsStub: sinon.SinonStub<
[],
Array<ConversationType>
>;
beforeEach(() => {
possiblyShowMemberResultsStub = sinon.stub(

View file

@ -81,7 +81,7 @@ declare global {
| DhImportKeyParams
| AesKeyAlgorithm,
extractable: boolean,
keyUsages: string[]
keyUsages: Array<string>
): Promise<CryptoKey>;
importKey(
@ -107,7 +107,7 @@ declare global {
| DhImportKeyParams
| AesKeyAlgorithm,
extractable: boolean,
keyUsages: string[]
keyUsages: Array<string>
): Promise<CryptoKey>;
}
}