Skip to content

Commit

Permalink
5th
Browse files Browse the repository at this point in the history
  • Loading branch information
StopNGo committed Oct 21, 2024
1 parent 0ee0ad0 commit 2c29f5a
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 11 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
"start:static": "npm run clean && cross-env NODE_ENV=development NO_SSR=true rspack serve --mode=development",
"build:static": "npm run clean && cross-env NODE_ENV=production NO_SSR=true rspack --mode=production",
"build:static:report": "npm run build:static --withReport",
"prettier": "prettier \"src/**/*\" --write --single-quote --no-semi --ignore-unknown --trailing-comma none --jsx-single-quote",
"lint": "npx @biomejs/biome check . && stylelint **/*.{css,scss}",
"lint:fix": "npx @biomejs/biome check --write && npm stylelint --fix **/*.{css,scss}",
"lint": "npx @biomejs/biome check . && stylelint \"**/*.{css,scss}\"",
"lint:fix": "npx @biomejs/biome check --write && stylelint --fix \"**/*.{css,scss}\"",
"test": "jest",
"add-comp": "node scripts/add-comp.js"
},
Expand Down
1 change: 1 addition & 0 deletions rspack/server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const serverConfig: Configuration = {
alias: ALIAS,
extensions: ['.ts', '.tsx', '.js'],
},
// biome-ignore lint/suspicious/noExplicitAny: Rspack types incompatibility
externals: [nodeExternals() as any],
}

Expand Down
1 change: 1 addition & 0 deletions src/api/pokemon/pokemonApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const pokemonApi = createApiFunction({
endpoints: (builder) => ({
getPokemonSpriteById: builder.query<TPokemonData, number>({
query: (id) => `pokemon/${id}`,
// biome-ignore lint/suspicious/noExplicitAny: This should be type from API
transformResponse: (response: any) => ({
name: response.species.name,
sprite: response.sprites.other.dream_world.front_default,
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/i18nApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type TSupportedLanguages, langUrl } from 'i18n/i18nConfig'

export async function fetchTranslations(
lang: keyof TSupportedLanguages,
): Promise<any> {
): Promise<unknown> {
return await new Promise((resolve) => {
fetch(langUrl.replace('{lang}', lang))
.then(
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/i18nConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export type TSupportedLanguages = typeof supportedLangs
/*
For proper typings, add all your translation types here via ampersand (&).
*/

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
export type TTranslations = (en & de) | { [key: string]: any }

export const langUrl = '/lang/{lang}.json'
2 changes: 1 addition & 1 deletion src/i18n/i18nSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const setLangAsync = createAsyncThunk(
'i18n/setLangAsync',
async (lang: keyof TSupportedLanguages, { getState, dispatch }) => {
const i18nState = (getState() as RootState).i18n
let translations
let translations: unknown
const resolvedLang: keyof TSupportedLanguages =
lang != null ? lang : i18nState.lang
if (i18nState.translations[lang] == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/useTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function useTranslations(): IUseTranslation {
No subkeys are available.
Could be expanded to the string processing i.e. plurals or formatting.
*/
const tt = (key: keyof TTranslations): any => {
const tt = (key: keyof TTranslations): string => {
return useAppSelector((state) => {
const translation = state.i18n.translations[state.i18n.lang]
const defaultTranslation = state.i18n.translations[defaultLang]
Expand Down
4 changes: 3 additions & 1 deletion src/pages/home/home.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.counters {
display: flex;
align-items: center;
justify-content: space-around;
justify-content: space-around


}
3 changes: 3 additions & 0 deletions src/server/middlewares/apiRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import type { EnhancedStore } from '@reduxjs/toolkit'
import { pokemonApi } from 'api'

const apiRequest = async (
// biome-ignore lint/suspicious/noExplicitAny: Created for complex sample API
store: EnhancedStore<any, any, any[]>,
// biome-ignore lint/suspicious/noExplicitAny: Created for complex sample API
): Promise<any[]> => {
store.dispatch(pokemonApi.endpoints.getPokemonSpriteById.initiate(1))

// biome-ignore lint/suspicious/noExplicitAny: Created for complex sample API
return await Promise.all<any>(
store.dispatch(pokemonApi.util.getRunningQueriesThunk()),
)
Expand Down
2 changes: 1 addition & 1 deletion src/store/middlewares/persistStateToLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const persistStateToLocalStorage =
(
ignoreSlices?: Array<keyof RootState>,
ignoreSliceActions = true,
): Middleware<{}, RootState> =>
): Middleware<unknown, RootState> =>
(store) =>
(next) =>
(action) => {
Expand Down
8 changes: 6 additions & 2 deletions src/store/rootReducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { type UnknownAction, combineReducers } from '@reduxjs/toolkit'
import {
type Reducer,
type UnknownAction,
combineReducers,
} from '@reduxjs/toolkit'

import { pokemonApi } from 'api'
import { i18nReducer } from 'i18n/i18nSlice'
Expand All @@ -16,7 +20,7 @@ export const rootReducer = {

export const appReducer = combineReducers(rootReducer)

export const mainReducer: any = (
export const mainReducer: Reducer = (
state: ReturnType<typeof appReducer>,
action: UnknownAction,
) => {
Expand Down
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare module '*.svg'
declare module '*.svg?url'
declare module '*.svg?base64'
interface Window {
// biome-ignore lint/suspicious/noExplicitAny:
__PRELOADED_STATE__: any
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/testRedux.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function renderWithProviders(
...renderOptions
}: ExtendedRenderOptions = {},
): ExtendedRenderOptions {
function Wrapper({ children }: PropsWithChildren<{}>): ReactElement {
function Wrapper({ children }: PropsWithChildren): ReactElement {
return <Provider store={store}>{children}</Provider>
}

Expand Down

0 comments on commit 2c29f5a

Please sign in to comment.