diff --git a/web/.eslintrc.js b/web/.eslintrc.js index 89208a544..0d67a7ee7 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -111,7 +111,7 @@ module.exports = { 'valid-typeof': 'error', camelcase: 'off', eqeqeq: ['error', 'allow-null'], - indent: ['error', 2], + indent: ['error', 2, { SwitchCase: 1 }], quotes: ['error', 'single', 'avoid-escape'], radix: 'error', yoda: ['error', 'never'], diff --git a/web/src/api/index.jsx b/web/src/api/index.jsx index 7df4c5785..53261df73 100644 --- a/web/src/api/index.jsx +++ b/web/src/api/index.jsx @@ -19,23 +19,23 @@ const Api = createContext(initialState); function reducer(state, { type, payload, meta }) { switch (type) { - case 'REQUEST': { - const { url, fetchId } = payload; - const data = state.queries[url]?.data || null; - return produce(state, (draftState) => { - draftState.queries[url] = { status: FetchStatus.LOADING, data, fetchId }; - }); - } + case 'REQUEST': { + const { url, fetchId } = payload; + const data = state.queries[url]?.data || null; + return produce(state, (draftState) => { + draftState.queries[url] = { status: FetchStatus.LOADING, data, fetchId }; + }); + } - case 'RESPONSE': { - const { url, ok, data, fetchId } = payload; - return produce(state, (draftState) => { - draftState.queries[url] = { status: ok ? FetchStatus.LOADED : FetchStatus.ERROR, data, fetchId }; - }); - } + case 'RESPONSE': { + const { url, ok, data, fetchId } = payload; + return produce(state, (draftState) => { + draftState.queries[url] = { status: ok ? FetchStatus.LOADED : FetchStatus.ERROR, data, fetchId }; + }); + } - default: - return state; + default: + return state; } } diff --git a/web/src/components/Select.jsx b/web/src/components/Select.jsx index afa54ed70..4b9fac7f5 100644 --- a/web/src/components/Select.jsx +++ b/web/src/components/Select.jsx @@ -38,29 +38,29 @@ export default function Select({ label, onChange, options: inputOptions = [], se const handleKeydown = useCallback( (event) => { switch (event.key) { - case 'Enter': { - if (!showMenu) { - setShowMenu(true); - setFocused(selected); - } else { - setSelected(focused); - onChange && onChange(options[focused].value, options[focused].label); - setShowMenu(false); + case 'Enter': { + if (!showMenu) { + setShowMenu(true); + setFocused(selected); + } else { + setSelected(focused); + onChange && onChange(options[focused].value, options[focused].label); + setShowMenu(false); + } + break; } - break; - } - case 'ArrowDown': { - const newIndex = focused + 1; - newIndex < options.length && setFocused(newIndex); - break; - } + case 'ArrowDown': { + const newIndex = focused + 1; + newIndex < options.length && setFocused(newIndex); + break; + } - case 'ArrowUp': { - const newIndex = focused - 1; - newIndex > -1 && setFocused(newIndex); - break; - } + case 'ArrowUp': { + const newIndex = focused - 1; + newIndex > -1 && setFocused(newIndex); + break; + } // no default } diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index 9b001e725..363672c7d 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -14,32 +14,32 @@ const API_LIMIT = 25; const initialState = Object.freeze({ events: [], reachedEnd: false, searchStrings: {} }); const reducer = (state = initialState, action) => { switch (action.type) { - case 'APPEND_EVENTS': { - const { - meta: { searchString }, - payload, - } = action; - return produce(state, (draftState) => { - draftState.searchStrings[searchString] = true; - draftState.events.push(...payload); - }); - } + case 'APPEND_EVENTS': { + const { + meta: { searchString }, + payload, + } = action; + return produce(state, (draftState) => { + draftState.searchStrings[searchString] = true; + draftState.events.push(...payload); + }); + } - case 'REACHED_END': { - const { - meta: { searchString }, - } = action; - return produce(state, (draftState) => { - draftState.reachedEnd = true; - draftState.searchStrings[searchString] = true; - }); - } + case 'REACHED_END': { + const { + meta: { searchString }, + } = action; + return produce(state, (draftState) => { + draftState.reachedEnd = true; + draftState.searchStrings[searchString] = true; + }); + } - case 'RESET': - return initialState; + case 'RESET': + return initialState; - default: - return state; + default: + return state; } };