Update deps 2019 09 (#439)

* update minor deps

* update minor deps

* update major deps

* fix eslint warnings
This commit is contained in:
Misha Vyrtsev
2019-09-29 14:09:00 -05:00
committed by Umputun
parent ea2a15ea8e
commit 9fbdff106d
14 changed files with 3427 additions and 1926 deletions
-1
View File
@@ -207,7 +207,6 @@ export const removeComment = (id: Comment['id']) =>
export const removeMyComment = (id: Comment['id']): Promise<void> =>
fetcher.put({
url: `/comment/${id}?url=${url}`,
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
body: {
delete: true,
} as object,
+1 -1
View File
@@ -5,7 +5,7 @@ if (!Element.prototype.matches) {
if (!Element.prototype.closest) {
Element.prototype.closest = function(s: string) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
let el: any = this;
do {
@@ -147,7 +147,6 @@ export class AuthPanel extends Component<Props, State> {
async handleOAuthLogin(e: MouseEvent | KeyboardEvent) {
const p = (e.target as HTMLButtonElement).dataset.provider! as AuthProvider['name'];
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
this.onSignIn({ name: p } as AuthProvider);
}
@@ -180,7 +179,7 @@ export class AuthPanel extends Component<Props, State> {
);
};
renderProvider = (provider: AuthProvider['name'], dropdown: boolean = false) => {
renderProvider = (provider: AuthProvider['name'], dropdown = false) => {
if (provider === 'anonymous') {
return (
<Dropdown
@@ -222,7 +221,6 @@ export class AuthPanel extends Component<Props, State> {
<span
className={`${dropdown ? 'auth-panel__dropdown-provider' : ''} auth-panel__pseudo-link`}
data-provider={provider}
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
{...getHandleClickProps(this.handleOAuthLogin)}
role="link"
>
+1 -1
View File
@@ -255,7 +255,7 @@ async function init(): Promise<void> {
window.scrollTo(window.pageXOffset, data.scrollTo + iframe.getBoundingClientRect().top + window.pageYOffset);
}
if (data.hasOwnProperty('isUserInfoShown')) {
if (Object.prototype.hasOwnProperty.call(data, 'isUserInfoShown')) {
if (data.isUserInfoShown) {
userInfo.init(data.user || {});
} else {
+2 -2
View File
@@ -104,7 +104,7 @@ export const comments = (
let changed = false;
const editObject = { summary: '', time: new Date().toISOString() };
for (const id of action.ids) {
if (!state.hasOwnProperty(id)) continue;
if (!Object.prototype.hasOwnProperty.call(state, id)) continue;
if (!changed) {
changed = true;
newState = { ...newState };
@@ -153,7 +153,7 @@ export const pinnedComments = (
return [...state, action.comment.id];
}
case COMMENTS_PATCH: {
if (!action.patch.hasOwnProperty('pin')) return state;
if (!Object.prototype.hasOwnProperty.call(action.patch, 'pin')) return state;
if (!action.patch.pin) {
return state.filter(x => action.ids.indexOf(x) === -1);
}
+1 -1
View File
@@ -117,7 +117,7 @@ export const hideUser = (user: User): StoreAction<void> => (dispatch, getState)
export const unhideUser = (userId: string): StoreAction<void> => (dispatch, _getState) => {
if (IS_STORAGE_AVAILABLE) {
const hiddenUsers = JSON.parse(getItem(LS_HIDDEN_USERS_KEY) || '{}');
if (hiddenUsers.hasOwnProperty(userId)) {
if (Object.prototype.hasOwnProperty.call(hiddenUsers, userId)) {
delete hiddenUsers[userId];
}
localStorage.setItem(LS_HIDDEN_USERS_KEY, JSON.stringify(hiddenUsers));
+1 -1
View File
@@ -55,7 +55,7 @@ export const hiddenUsers = (state: { [id: string]: User } = {}, action: USER_ACT
return { ...state, [action.user.id]: action.user };
}
case USER_UNHIDE: {
if (!state.hasOwnProperty(action.id)) return state;
if (!Object.prototype.hasOwnProperty.call(state, action.id)) return state;
const newState = { ...state };
delete newState[action.id];
return newState;
+1
View File
@@ -5,6 +5,7 @@ export const mockHeaders = {
mock: () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).Headers = class {
// eslint-disable-next-line @typescript-eslint/no-empty-function
append() {}
has() {
return false;
+7 -6
View File
@@ -1,12 +1,13 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// type signature is wrong, but there is no way
// in typescript to augment function return type currently
export default function debounce<F extends (...args: any[]) => void>(func: F, wait: number): F {
export default function debounce<T extends any[]>(
fn: (...args: T) => unknown,
wait: number = 1000
): (...args: Parameters<typeof fn>) => void {
let timeout: number | undefined;
return function(this: any): void {
const laterCall = (): void => func.apply(this, arguments as any);
return function(this: any, ...args): void {
const laterCall = (): unknown => fn.apply(this, args);
window.clearTimeout(timeout);
timeout = window.setTimeout(laterCall, wait);
} as any;
};
}
+1
View File
@@ -1 +1,2 @@
// eslint-disable-next-line @typescript-eslint/no-empty-function
export default function noop(): void {}