better linting (#72)

Improve linting and fix linting errors

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Philip Molares 2020-05-27 15:43:28 +02:00 committed by GitHub
parent efb6513205
commit eba59ae622
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 2413 additions and 1867 deletions

View file

@ -1,12 +1,12 @@
import {BackendConfigState, SET_BACKEND_CONFIG_ACTION_TYPE, SetBackendConfigAction} from "./types";
import {store} from "../../utils/store";
import { BackendConfigState, SET_BACKEND_CONFIG_ACTION_TYPE, SetBackendConfigAction } from './types'
import { store } from '../../utils/store'
export const setBackendConfig = (state: BackendConfigState) => {
const action: SetBackendConfigAction = {
type: SET_BACKEND_CONFIG_ACTION_TYPE,
payload: {
state
}
};
store.dispatch(action)
export const setBackendConfig: (state: BackendConfigState) => void = (state: BackendConfigState) => {
const action: SetBackendConfigAction = {
type: SET_BACKEND_CONFIG_ACTION_TYPE,
payload: {
state
}
}
store.dispatch(action)
}

View file

@ -1,38 +1,38 @@
import {Reducer} from 'redux';
import {BackendConfigActions, BackendConfigState, SET_BACKEND_CONFIG_ACTION_TYPE} from './types';
import { Reducer } from 'redux'
import { BackendConfigActions, BackendConfigState, SET_BACKEND_CONFIG_ACTION_TYPE } from './types'
export const initialState: BackendConfigState = {
allowAnonymous: true,
authProviders: {
facebook: false,
github: false,
twitter: false,
gitlab: false,
dropbox: false,
ldap: false,
google: false,
saml: false,
oauth2: false,
email: false,
openid: false
},
customAuthNames: {
ldap: "",
oauth2: "",
saml: ""
},
specialLinks: {
privacy: "",
termsOfUse: "",
imprint: "",
}
};
allowAnonymous: true,
authProviders: {
facebook: false,
github: false,
twitter: false,
gitlab: false,
dropbox: false,
ldap: false,
google: false,
saml: false,
oauth2: false,
email: false,
openid: false
},
customAuthNames: {
ldap: '',
oauth2: '',
saml: ''
},
specialLinks: {
privacy: '',
termsOfUse: '',
imprint: ''
}
}
export const BackendConfigReducer: Reducer<BackendConfigState, BackendConfigActions> = (state: BackendConfigState = initialState, action: BackendConfigActions) => {
switch (action.type) {
case SET_BACKEND_CONFIG_ACTION_TYPE:
return action.payload.state;
default:
return state;
}
};
switch (action.type) {
case SET_BACKEND_CONFIG_ACTION_TYPE:
return action.payload.state
default:
return state
}
}

View file

@ -1,6 +1,6 @@
import {Action} from "redux";
import { Action } from 'redux'
export const SET_BACKEND_CONFIG_ACTION_TYPE = 'backend-config/set';
export const SET_BACKEND_CONFIG_ACTION_TYPE = 'backend-config/set'
export interface BackendConfigState {
allowAnonymous: boolean,

View file

@ -1,12 +1,12 @@
import {FrontendConfigState, SET_FRONTEND_CONFIG_ACTION_TYPE, SetFrontendConfigAction} from "./types";
import {store} from "../../utils/store";
import { FrontendConfigState, SET_FRONTEND_CONFIG_ACTION_TYPE, SetFrontendConfigAction } from './types'
import { store } from '../../utils/store'
export const setFrontendConfig = (state: FrontendConfigState) => {
const action: SetFrontendConfigAction = {
type: SET_FRONTEND_CONFIG_ACTION_TYPE,
payload: {
state
}
export const setFrontendConfig: (state: FrontendConfigState) => void = (state: FrontendConfigState) => {
const action: SetFrontendConfigAction = {
type: SET_FRONTEND_CONFIG_ACTION_TYPE,
payload: {
state
}
store.dispatch(action);
}
store.dispatch(action)
}

View file

@ -1,15 +1,15 @@
import {Reducer} from 'redux';
import {FrontendConfigActions, FrontendConfigState, SET_FRONTEND_CONFIG_ACTION_TYPE} from './types';
import { Reducer } from 'redux'
import { FrontendConfigActions, FrontendConfigState, SET_FRONTEND_CONFIG_ACTION_TYPE } from './types'
export const initialState: FrontendConfigState = {
backendUrl: ""
};
backendUrl: ''
}
export const FrontendConfigReducer: Reducer<FrontendConfigState, FrontendConfigActions> = (state: FrontendConfigState = initialState, action: FrontendConfigActions) => {
switch (action.type) {
case SET_FRONTEND_CONFIG_ACTION_TYPE:
return action.payload.state;
default:
return state;
}
};
switch (action.type) {
case SET_FRONTEND_CONFIG_ACTION_TYPE:
return action.payload.state
default:
return state
}
}

View file

@ -1,6 +1,6 @@
import {Action} from "redux";
import { Action } from 'redux'
export const SET_FRONTEND_CONFIG_ACTION_TYPE = 'frontend-config/set';
export const SET_FRONTEND_CONFIG_ACTION_TYPE = 'frontend-config/set'
export interface SetFrontendConfigAction extends Action {
type: string;

View file

@ -1,12 +1,12 @@
import {combineReducers, Reducer} from 'redux';
import {UserState} from "./user/types";
import {UserReducer} from "./user/reducers";
import {ModalShowReducer} from "./modal/reducers";
import {ModalShowState} from "./modal/types";
import {BackendConfigState} from "./backend-config/types";
import {FrontendConfigState} from "./frontend-config/types";
import {BackendConfigReducer} from "./backend-config/reducers";
import {FrontendConfigReducer} from "./frontend-config/reducers";
import { combineReducers, Reducer } from 'redux'
import { UserState } from './user/types'
import { UserReducer } from './user/reducers'
import { ModalShowReducer } from './modal/reducers'
import { ModalShowState } from './modal/types'
import { BackendConfigState } from './backend-config/types'
import { FrontendConfigState } from './frontend-config/types'
import { BackendConfigReducer } from './backend-config/reducers'
import { FrontendConfigReducer } from './frontend-config/reducers'
export interface ApplicationState {
user: UserState;
@ -16,8 +16,8 @@ export interface ApplicationState {
}
export const allReducers: Reducer<ApplicationState> = combineReducers<ApplicationState>({
user: UserReducer,
modalShow: ModalShowReducer,
backendConfig: BackendConfigReducer,
frontendConfig: FrontendConfigReducer
});
user: UserReducer,
modalShow: ModalShowReducer,
backendConfig: BackendConfigReducer,
frontendConfig: FrontendConfigReducer
})

View file

@ -1,7 +1,7 @@
import {ActionCreator} from "redux";
import {SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE, SetHistoryDeleteModalShowAction} from "./types";
import { ActionCreator } from 'redux'
import { SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE, SetHistoryDeleteModalShowAction } from './types'
export const setSignInModalShow: ActionCreator<SetHistoryDeleteModalShowAction> = (historyDelete: boolean) => ({
type: SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE,
payload: historyDelete,
type: SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE,
payload: historyDelete
})

View file

@ -1,18 +1,18 @@
import {Reducer} from 'redux';
import {ModalShowActions, ModalShowState, SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE} from './types';
import { Reducer } from 'redux'
import { ModalShowActions, ModalShowState, SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE } from './types'
export const initialState: ModalShowState = {
historyDelete: false
};
historyDelete: false
}
export const ModalShowReducer: Reducer<ModalShowState, ModalShowActions> = (state: ModalShowState = initialState, action: ModalShowActions) => {
switch (action.type) {
case SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE:
return {
...state,
historyDelete: action.payload
};
default:
return state;
}
};
switch (action.type) {
case SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE:
return {
...state,
historyDelete: action.payload
}
default:
return state
}
}

View file

@ -1,6 +1,6 @@
import {Action} from "redux";
import { Action } from 'redux'
export const SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE = 'modal/history-delete/set';
export const SET_HISTORY_DELETE_MODAL_SHOW_ACTION_TYPE = 'modal/history-delete/set'
export interface ModalShowState {
historyDelete: boolean

View file

@ -1,20 +1,20 @@
import {CLEAR_USER_ACTION_TYPE, ClearUserAction, SET_USER_ACTION_TYPE, SetUserAction, UserState} from "./types";
import {store} from "../../utils/store";
import { CLEAR_USER_ACTION_TYPE, ClearUserAction, SET_USER_ACTION_TYPE, SetUserAction, UserState } from './types'
import { store } from '../../utils/store'
export const setUser = (state: UserState) => {
const action: SetUserAction = {
type: SET_USER_ACTION_TYPE,
payload: {
state
}
export const setUser: (state: UserState) => void = (state: UserState) => {
const action: SetUserAction = {
type: SET_USER_ACTION_TYPE,
payload: {
state
}
store.dispatch(action);
}
store.dispatch(action)
}
export const clearUser = () => {
const action: ClearUserAction = {
type: CLEAR_USER_ACTION_TYPE,
payload: {},
}
store.dispatch(action);
}
export const clearUser: () => void = () => {
const action: ClearUserAction = {
type: CLEAR_USER_ACTION_TYPE,
payload: null
}
store.dispatch(action)
}

View file

@ -1,27 +1,20 @@
import {Reducer} from 'redux';
import {
CLEAR_USER_ACTION_TYPE,
LoginStatus,
SET_USER_ACTION_TYPE,
SetUserAction,
UserActions,
UserState
} from './types';
import { Reducer } from 'redux'
import { CLEAR_USER_ACTION_TYPE, LoginStatus, SET_USER_ACTION_TYPE, SetUserAction, UserActions, UserState } from './types'
export const initialState: UserState = {
id: "",
name: "",
photo: "",
status: LoginStatus.forbidden
};
id: '',
name: '',
photo: '',
status: LoginStatus.forbidden
}
export const UserReducer: Reducer<UserState, UserActions> = (state: UserState = initialState, action: UserActions) => {
switch (action.type) {
case SET_USER_ACTION_TYPE:
return (action as SetUserAction).payload.state;
case CLEAR_USER_ACTION_TYPE:
return initialState;
default:
return state;
}
};
switch (action.type) {
case SET_USER_ACTION_TYPE:
return (action as SetUserAction).payload.state
case CLEAR_USER_ACTION_TYPE:
return initialState
default:
return state
}
}

View file

@ -1,7 +1,7 @@
import {Action} from "redux";
import { Action } from 'redux'
export const SET_USER_ACTION_TYPE = 'user/set';
export const CLEAR_USER_ACTION_TYPE = 'user/clear';
export const SET_USER_ACTION_TYPE = 'user/set'
export const CLEAR_USER_ACTION_TYPE = 'user/clear'
export interface SetUserAction extends Action {
type: string;
@ -12,7 +12,7 @@ export interface SetUserAction extends Action {
export interface ClearUserAction extends Action {
type: string;
payload: {};
payload: null;
}
export interface UserState {
@ -23,8 +23,8 @@ export interface UserState {
}
export enum LoginStatus {
forbidden = "forbidden",
ok = "ok"
forbidden = 'forbidden',
ok = 'ok'
}
export type UserActions = SetUserAction | ClearUserAction;