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>;
}
}