switch on ban-types
parent
4cf85456d6
commit
4cf05ba1da
|
@ -33,7 +33,7 @@
|
|||
"no-constant-condition": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-extra-boolean-cast": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/ban-types": "error",
|
||||
"no-async-promise-executor": "off",
|
||||
"@typescript-eslint/adjacent-overload-signatures": "off"
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ interface CashStatic {
|
|||
declare type falsy = undefined | null | false | 0 | '';
|
||||
declare type Ele = Window | Document | HTMLElement | Element | Node;
|
||||
declare type EleLoose = HTMLElement & Element & Node;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
|
||||
declare type Comparator = string | Ele | Cash | ((this: EleLoose, index: number, ele: EleLoose) => boolean);
|
||||
declare type Context = Document | HTMLElement | Element;
|
||||
|
@ -44,6 +45,7 @@ interface CashStatic {
|
|||
}
|
||||
interface CashStatic {
|
||||
isWindow(x: any): x is Window;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
isFunction(x: any): x is Function;
|
||||
isNumeric(x: any): boolean;
|
||||
isArray(x: any): x is Array<any>;
|
||||
|
@ -156,6 +158,7 @@ interface Cash {
|
|||
one(events: string, selector: string | null | undefined, data: any, callback: EventCallback): this;
|
||||
}
|
||||
interface Cash {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
ready(callback: Function): this;
|
||||
}
|
||||
interface Cash {
|
||||
|
|
|
@ -112,8 +112,8 @@ export interface StudySettings {
|
|||
explorer: UserSelection;
|
||||
cloneable: UserSelection;
|
||||
chat: UserSelection;
|
||||
sticky: Boolean;
|
||||
description: Boolean;
|
||||
sticky: boolean;
|
||||
description: boolean;
|
||||
}
|
||||
|
||||
export interface ReloadData {
|
||||
|
|
|
@ -25,7 +25,7 @@ export default class RelayCtrl {
|
|||
};
|
||||
}
|
||||
|
||||
setSync = (v: Boolean) => {
|
||||
setSync = (v: boolean) => {
|
||||
this.send('relaySync', v);
|
||||
this.redraw();
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@ function linkReplace(_: string, url: string) {
|
|||
const userPattern = /(^|[^\w@#/])@([\w-]{2,})/g;
|
||||
const pawnDropPattern = /^[a-h][2-7]$/;
|
||||
|
||||
function userLinkReplace(orig: string, prefix: String, user: string) {
|
||||
function userLinkReplace(orig: string, prefix: string, user: string) {
|
||||
if (user.length > 20 || user.match(pawnDropPattern)) return orig;
|
||||
return prefix + '<a href="/@/' + user + '">@' + user + '</a>';
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as cg from 'chessground/types';
|
|||
import * as xhr from './xhr';
|
||||
import debounce from './debounce';
|
||||
|
||||
export type MouchEvent = MouseEvent & TouchEvent;
|
||||
export type MouchEvent = MouseEvent | TouchEvent;
|
||||
|
||||
type Visible = (ply: Ply) => boolean;
|
||||
|
||||
|
@ -60,7 +60,12 @@ export default function resizeHandle(els: cg.Elements, pref: number, ply: number
|
|||
}
|
||||
|
||||
function eventPosition(e: MouchEvent): [number, number] | undefined {
|
||||
if (isMouseEvent(e)) {
|
||||
if (e.clientX || e.clientX === 0) return [e.clientX, e.clientY];
|
||||
if (e.touches && e.targetTouches[0]) return [e.targetTouches[0].clientX, e.targetTouches[0].clientY];
|
||||
} else if (e.touches && e.targetTouches[0]) return [e.targetTouches[0].clientX, e.targetTouches[0].clientY];
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isMouseEvent(e: MouchEvent): e is MouseEvent {
|
||||
return (e as MouseEvent).clientX !== undefined;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ export interface NowPlaying {
|
|||
gameId: string;
|
||||
fen: Fen;
|
||||
color: Color;
|
||||
lastMove: String;
|
||||
lastMove: string;
|
||||
variant: {
|
||||
key: string;
|
||||
name: string;
|
||||
|
|
Loading…
Reference in New Issue