Skip to content

Commit

Permalink
style(*): add TODO comments when disabling eslint warnings
Browse files Browse the repository at this point in the history
// TODO: fix this for proper typing and intellisense
  • Loading branch information
aneurysmjs committed Aug 25, 2020
1 parent b53c8cb commit 860f728
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/app/components/core/UserMenu/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const UserMenu: FunctionComponent<PropsType> = ({ modules }: PropsType) => {
return (
<div className="user-menu">
{Sidebar ? (
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// TODO: fix typing for future releases
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
<Sidebar title="Cart" side="right" isOpen={open} onClose={handleOpen}>
<p className="lead">You have nothing, let&apos;s shop!</p>
Expand Down
9 changes: 8 additions & 1 deletion src/app/store/config/alienStore/manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/ban-ts-ignore */
import { AnyAction, combineReducers, Dispatch, Reducer } from 'redux';

import { FullStoreShape, ReducerMapper } from './types/alienStore';

// eslint-disable-next-line @typescript-eslint/ban-types
export interface AlienManager<R = {}> {
getReducerMap: () => ReducerMapper<FullStoreShape<R>>;
injectReducers: (key: string, reducer: Reducer) => Reducer | void;
Expand All @@ -18,11 +18,14 @@ export default function manager<State>(initialReducers?: State): AlienManager<St

type ReducerMap = ReducerMapper<StoreShape>;

// eslint-disable-next-line @typescript-eslint/ban-types
const fallback = (): {} => ({});

let dispatch: AlienDispatch = null;

const reducerMap: ReducerMap = initialReducers ? { ...initialReducers } : {};
// TODO: fix this for proper typing and intellisense
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore "combineReducers" doesn't have that overload match
let combinedReducer = initialReducers ? combineReducers(reducerMap) : fallback;

Expand All @@ -42,6 +45,8 @@ export default function manager<State>(initialReducers?: State): AlienManager<St
}

reducerMap[key] = reducer;
// TODO: fix this for proper typing and intellisense
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore "combineReducers" doesn't have that overload match
combinedReducer = combineReducers(reducerMap);
if (dispatch) {
Expand All @@ -57,6 +62,8 @@ export default function manager<State>(initialReducers?: State): AlienManager<St
delete reducerMap[key];

keysToRemove.push(key);
// TODO: fix this for proper typing and intellisense
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore "combineReducers" doesn't have that overload match
combinedReducer = combineReducers(reducerMap);
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/store/config/alienStore/useAlien.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { isEmpty, isNil, anyPass } from 'ramda';

import { AlienStore } from './alien';

// TODO: fix this for proper typing and intellisense
// eslint-disable-next-line @typescript-eslint/ban-types
export interface ReduxModule<S = {}> {
id: string;
reducers: {
Expand All @@ -21,6 +23,8 @@ export interface ReduxModule<S = {}> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type AlienResult<S = any> = Omit<ReduxModule<S>, 'reducers'>;

// TODO: fix this for proper typing and intellisense
// eslint-disable-next-line @typescript-eslint/ban-types
export interface AlienModule<T = {}> {
initialActions?: Array<string>;
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/store/config/alienStore/withAlien.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import useAlien, { AlienResult, ReduxModule } from './useAlien';
interface WithAlienProps {
modules: Array<AlienResult>;
}

// TODO: fix this for proper typing and intellisense
// eslint-disable-next-line @typescript-eslint/ban-types
function WithAlien<P extends object>(
Component: ComponentType<P>,
reduxModules: Array<() => Promise<ReduxModule<P>>>,
Expand Down

0 comments on commit 860f728

Please sign in to comment.