From 33e5c67ee3e9a6b883c68756b985a3d1c62204fa Mon Sep 17 00:00:00 2001 From: lukachi Date: Sun, 23 Jun 2024 17:43:54 +0300 Subject: [PATCH] upd deps, migrate to new eslint + stylelint + checker, fix checker for vite config, build config, envs, clear app config, ...etc --- .env-development | 2 + .env-production | 2 + .env.development | 4 - .env.example | 4 + .env.production | 3 - .eslintignore | 8 - .eslintrc.js | 95 - Dockerfile | 10 +- README.md | 59 +- eslint.config.cjs | 147 + package.json | 70 +- {static => public}/.gitkeep | 0 .../branding/android-chrome-192x192.png | Bin .../branding/android-chrome-256x256.png | Bin .../branding/apple-touch-icon.png | Bin {static => public}/branding/favicon.ico | Bin {static => public}/branding/favicon.png | Bin .../fonts/NunitoSans/NunitoSans-Black.woff2 | Bin .../fonts/NunitoSans/NunitoSans-Bold.woff2 | Bin .../NunitoSans/NunitoSans-ExtraBold.woff2 | Bin .../fonts/NunitoSans/NunitoSans-Light.woff2 | Bin .../fonts/NunitoSans/NunitoSans-Regular.woff2 | Bin .../NunitoSans/NunitoSans-SemiBold.woff2 | Bin {static => public}/branding/fonts/index.css | 0 {static => public}/branding/logo.svg | 0 .../branding/mstile-150x150.png | Bin {static => public}/browserconfig.xml | 0 {static => public}/env.js | 0 {static => public}/init-loader/style.css | 0 {static => public}/noscript/chrome.jpg | Bin {static => public}/noscript/firefox.jpg | Bin {static => public}/noscript/safari.jpg | Bin {static => public}/noscript/style.css | 0 {static => public}/site.webmanifest | 0 src/config.ts | 6 +- src/localization/index.ts | 4 +- .../components/LoginForm/index.tsx | 4 +- src/pages/UiKit/index.tsx | 103 +- src/ui/UiSelect/index.tsx | 2 +- src/vite-env.d.ts | 4 +- vite.config.ts | 28 +- yarn.lock | 2546 ++++++++++------- 42 files changed, 1758 insertions(+), 1343 deletions(-) create mode 100644 .env-development create mode 100644 .env-production delete mode 100644 .env.development create mode 100644 .env.example delete mode 100644 .env.production delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.cjs rename {static => public}/.gitkeep (100%) rename {static => public}/branding/android-chrome-192x192.png (100%) rename {static => public}/branding/android-chrome-256x256.png (100%) rename {static => public}/branding/apple-touch-icon.png (100%) rename {static => public}/branding/favicon.ico (100%) rename {static => public}/branding/favicon.png (100%) rename {static => public}/branding/fonts/NunitoSans/NunitoSans-Black.woff2 (100%) rename {static => public}/branding/fonts/NunitoSans/NunitoSans-Bold.woff2 (100%) rename {static => public}/branding/fonts/NunitoSans/NunitoSans-ExtraBold.woff2 (100%) rename {static => public}/branding/fonts/NunitoSans/NunitoSans-Light.woff2 (100%) rename {static => public}/branding/fonts/NunitoSans/NunitoSans-Regular.woff2 (100%) rename {static => public}/branding/fonts/NunitoSans/NunitoSans-SemiBold.woff2 (100%) rename {static => public}/branding/fonts/index.css (100%) rename {static => public}/branding/logo.svg (100%) rename {static => public}/branding/mstile-150x150.png (100%) rename {static => public}/browserconfig.xml (100%) rename {static => public}/env.js (100%) rename {static => public}/init-loader/style.css (100%) rename {static => public}/noscript/chrome.jpg (100%) rename {static => public}/noscript/firefox.jpg (100%) rename {static => public}/noscript/safari.jpg (100%) rename {static => public}/noscript/style.css (100%) rename {static => public}/site.webmanifest (100%) diff --git a/.env-development b/.env-development new file mode 100644 index 0000000..602cf3a --- /dev/null +++ b/.env-development @@ -0,0 +1,2 @@ +VITE_APP_NAME='React Vite Template | Development' +VITE_BUILD_VERSION='0.1.0' diff --git a/.env-production b/.env-production new file mode 100644 index 0000000..5242022 --- /dev/null +++ b/.env-production @@ -0,0 +1,2 @@ +VITE_APP_NAME='Vue Vite Template | Production' +VITE_BUILD_VERSION='0.1.0' diff --git a/.env.development b/.env.development deleted file mode 100644 index b525bb6..0000000 --- a/.env.development +++ /dev/null @@ -1,4 +0,0 @@ -VITE_PORT=8095 -VITE_API_URL='https://jsonplaceholder.typicode.com' -VITE_APP_NAME='React Template' - diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..a8744be --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +# if you want to specify custom dev port +# VITE_DEV_PORT=8095 +VITE_APP_NAME='Vue Vite Template' +VITE_BUILD_VERSION='0.1.0' diff --git a/.env.production b/.env.production deleted file mode 100644 index bc00d79..0000000 --- a/.env.production +++ /dev/null @@ -1,3 +0,0 @@ -VITE_PORT=8095 -VITE_API_URL='https://jsonplaceholder.typicode.com' -VITE_APP_NAME='React Template' diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ff066bb..0000000 --- a/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -build/*.js -dist/*.js -config/*.js -playground -*.schema.js -index.html -*.md -static/env.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 49fef00..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,95 +0,0 @@ -module.exports = { - root: true, - env: { - es2021: true, - node: true, - }, - extends: [ - 'eslint:recommended', - 'plugin:import/recommended', - 'plugin:jsx-a11y/recommended', - 'plugin:react/recommended', - 'plugin:react/jsx-runtime', - 'plugin:react-hooks/recommended', - 'prettier', - ], - overrides: [ - { - files: ['**/*.ts?(x)'], - parser: '@typescript-eslint/parser', - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:import/typescript', - ], - }, - ], - plugins: ['simple-import-sort', 'prettier', '@typescript-eslint'], - parser: '@typescript-eslint/parser', - parserOptions: { - tsconfigRootDir: '.', - ecmaVersion: 'latest', - sourceType: 'module', - ecmaFeatures: { - jsx: true, - }, - }, - settings: { - 'import/parsers': { - '@typescript-eslint/parser': ['.ts', '.tsx'], - }, - 'import/resolver': { - typescript: {}, - node: { - paths: ['src'], - extensions: ['.js', '.jsx', '.ts', '.tsx'], - }, - }, - react: { - version: 'detect', - }, - }, - globals: { - defineProps: 'readonly', - defineEmits: 'readonly', - defineExpose: 'readonly', - withDefaults: 'readonly', - }, - rules: { - 'prettier/prettier': ['error', {}, { usePrettierrc: true }], - 'arrow-parens': 0, - 'no-debugger': 1, - 'no-warning-comments': [ - 1, - { - terms: ['hardcoded'], - location: 'anywhere', - }, - ], - 'no-return-await': 0, - 'object-curly-spacing': ['error', 'always'], - 'simple-import-sort/imports': 'error', - 'simple-import-sort/exports': 'error', - 'no-var': 'error', - 'comma-dangle': [1, 'always-multiline'], - 'linebreak-style': ['error', 'unix'], - '@typescript-eslint/no-non-null-assertion': 'off', - 'max-len': [ - 1, - { - code: 80, - comments: 80, - ignoreUrls: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - ignoreRegExpLiterals: true, - }, - ], - 'no-console': [ - 1, - { - allow: ['warn', 'error'], - }, - ], - 'react/display-name': 'off', - }, -} diff --git a/Dockerfile b/Dockerfile index 126287d..fc6c168 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM node:18-alpine as builder RUN apk --no-cache --update --virtual build-dependencies add \ - python \ + python3 \ make \ g++ @@ -8,13 +8,9 @@ ARG BUILD_VERSION WORKDIR /build COPY package*.json ./ COPY yarn*.lock ./ -RUN true \ - && yarn autoclean --init \ - && yarn autoclean --force \ - && yarn install \ - && true COPY . . -RUN yarn lint | tee 1.log | sed -e 's/^/[yarn lint] /' & yarn test | tee 2.log | sed -e 's/^/[yarn test] /' & VITE_APP_BUILD_VERSION="$BUILD_VERSION" yarn build | tee 3.log | sed -e 's/^/[yarn build] /' +RUN yarn install +RUN VITE_APP_BUILD_VERSION="$BUILD_VERSION" yarn build FROM nginx:1.20.2-alpine COPY nginx.conf /etc/nginx/nginx.conf diff --git a/README.md b/README.md index 2bd94e7..129a906 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,51 @@ # Distributed Lab react started template -## Project setup -``` -yarn | yarn install -``` -### Compiles and hot-reloads for development -``` -yarn start -``` +| command | description | +|------------------------------|-----------------------------------------| +| `yarn install` / `yarn` | install dependencies | +| `yarn start` | start dev server | +| `yarn build` | build project | +| `yarn lint` | lint files (eslint + stylelint) | +| `yarn rsc [release-version]` | Lints release/release candidate version | +| | | -### Compiles and minifies for production -``` -yarn build -``` +### important: +`.env-development` and `.env-production` is the custom solution for CI, which is used to build the app for different environments e.g. staging and production in github workflow files. -### Lints and fixes files -``` -yarn lint -``` +Before start development or manual deploy app with `dist` dir - make sure you have copied `.env-[environment]` file in to `.env.[environment]` file, where `[environment]` is the name of the environment, e.g. `.env-production` or `.env-staging` and fulfill it with your own values. -### Run unit tests -``` -yarn test +```bash +cp .env-development .env.development +# or +cp .env-production .env.production ``` -### Lints release/release candidate version -``` -yarn rsc %release-version% +### Build docker image with version +```dockerfile + docker build --no-cache --progress=plain --build-arg BUILD_VERSION=1.0.0-rc.0 -t react-template . ``` -### Build docker image with version +#### important +docker-compose config works with `.env` file only, so make sure you have it + +### Run container ``` - docker build --no-cache --progress=plain --build-arg BUILD_VERSION=1.0.0-rc.0 -t react-template . +docker run -d -p 80:80 --name [container-name] [image-name] ``` +## Prepare for deployment +`.env-development` and `.end-production` is a files, which are used to run build in github workflow files, e.g. [here](.github/workflows/main.yml) at line 32 + +It sets the environment variables for the `vitejs` build, which are called in werf.yaml file `yarn start` command. + +After that, docker image could be used to deploy the app + +If you want to build app locally, you can copy `.env-production` files and fulfill it with your own values, then run command `yarn build` or `.env-development` for `yarn start` command + +### Dealing with env variables +Env variables can be rewritten by [env.is] (./static/env.js) file in runtime. To do so, we need to provide same [env variables](.env.example) there in json format + ## Some additional features ### JsonApi lib diff --git a/eslint.config.cjs b/eslint.config.cjs new file mode 100644 index 0000000..2cf2473 --- /dev/null +++ b/eslint.config.cjs @@ -0,0 +1,147 @@ +const {fixupConfigRules} = require("@eslint/compat"); + +const simpleImportSort = require("eslint-plugin-simple-import-sort"); +const prettier = require("eslint-plugin-prettier"); +const typescriptEslint = require("@typescript-eslint/eslint-plugin"); +const globals = require("globals"); +const tsParser = require("@typescript-eslint/parser"); +const js = require("@eslint/js"); + +const { + FlatCompat, +} = require("@eslint/eslintrc"); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +module.exports = [ + { + ignores: [ + "build/*.js", + "dist/*.js", + "config/*.js", + "**/playground", + "**/*.schema.js", + "**/index.html", + "**/*.md", + "static/env.js", + ], + }, + + ...fixupConfigRules(compat.extends( + "eslint:recommended", + "plugin:import/recommended", + "plugin:jsx-a11y/recommended", + "plugin:react/recommended", + "plugin:react/jsx-runtime", + "plugin:react-hooks/recommended", + "plugin:i18next/recommended", + "prettier", + )), + + { + plugins: { + "simple-import-sort": simpleImportSort, + prettier, + }, + + languageOptions: { + globals: { + ...globals.node, + defineProps: "readonly", + defineEmits: "readonly", + defineExpose: "readonly", + withDefaults: "readonly", + }, + + parser: tsParser, + ecmaVersion: "latest", + sourceType: "module", + + parserOptions: { + tsconfigRootDir: ".", + + ecmaFeatures: { + jsx: true, + }, + }, + }, + + settings: { + "import/parsers": { + "@typescript-eslint/parser": [".ts", ".tsx"], + }, + + "import/resolver": { + typescript: {}, + + node: { + paths: ["src"], + extensions: [".js", ".jsx", ".ts", ".tsx"], + }, + }, + + react: { + version: "detect", + }, + }, + + rules: { + "prettier/prettier": ["error", {}, { + usePrettierrc: true, + }], + + "arrow-parens": 0, + "no-debugger": 1, + + "no-warning-comments": [1, { + terms: ["hardcoded"], + location: "anywhere", + }], + + "no-return-await": 0, + "object-curly-spacing": ["error", "always"], + "simple-import-sort/imports": "error", + "simple-import-sort/exports": "error", + "no-var": "error", + "comma-dangle": [1, "always-multiline"], + "linebreak-style": ["error", "unix"], + "@typescript-eslint/no-non-null-assertion": "off", + + 'react/jsx-curly-brace-presence': ['warn', 'never'], + + "max-len": [1, { + code: 80, + comments: 80, + ignoreUrls: true, + ignoreStrings: true, + ignoreTemplateLiterals: true, + ignoreRegExpLiterals: true, + }], + + "no-console": [1, { + allow: ["warn", "error"], + }], + + "react/display-name": "off", + }, + }, + + ...fixupConfigRules( + compat.extends("plugin:@typescript-eslint/recommended", "plugin:import/typescript"), + ).map(config => ({ + ...config, + files: ["**/*.ts?(x)"], + })), + + { + files: ["**/*.ts?(x)"], + + languageOptions: { + parser: tsParser, + }, + } +]; diff --git a/package.json b/package.json index 5602915..4209304 100644 --- a/package.json +++ b/package.json @@ -11,61 +11,67 @@ "start": "vite", "analyze": "vite build --mode analyze", "lint": "yarn lint:styles && yarn lint:scripts", - "lint:styles": "stylelint \"src/**/*.{css,sass,scss}\" --max-warnings=0", - "lint:scripts": "eslint \"{src,config}/**/*.{js,ts,jsx,tsx}\" --cache --fix --max-warnings=0 && tsc --noEmit", + "lint:styles": "stylelint \"src/**/*.{css,sass,scss}\"", + "lint:scripts": "eslint \"{src,config}/**/*.{js,ts,jsx,tsx}\" --cache --fix && tsc --noEmit", "preview": "vite preview", "rsc": "node scripts/release-sanity-check.mjs" }, "dependencies": { "@distributedlab/tools": "^1.0.0-rc.14", - "downshift": "^8.5.0", - "framer-motion": "^10.18.0", - "i18next": "^23.10.1", + "downshift": "^9.0.6", + "framer-motion": "^11.2.11", + "i18next": "^23.11.5", "lodash": "^4.17.21", "loglevel": "^1.9.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-i18next": "^14.1.0", - "react-router-dom": "^6.22.3", - "react-toastify": "^9.1.3", - "react-tooltip": "^5.26.3", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-i18next": "^14.1.2", + "react-router-dom": "^6.23.1", + "react-toastify": "^10.0.5", + "react-tooltip": "^5.27.0", "react-use": "^17.5.0", - "uuid": "^9.0.1", + "uuid": "^10.0.0", "valtio": "^1.13.2" }, "devDependencies": { "@esbuild-plugins/node-globals-polyfill": "^0.2.3", + "@eslint/compat": "^1.1.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.5.0", "@originjs/vite-plugin-commonjs": "^1.0.3", - "@types/lodash": "^4.17.0", - "@types/node": "^20.12.5", - "@types/react": "^18.2.74", - "@types/react-dom": "^18.2.24", - "@types/uuid": "^9.0.8", - "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", - "@vitejs/plugin-react": "^4.2.1", + "@types/lodash": "^4.17.5", + "@types/node": "^20.14.8", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@types/uuid": "^10.0.0", + "@typescript-eslint/parser": "^7.13.1", + "@vitejs/plugin-react": "^4.3.1", "chalk": "^5.3.0", "dotenv": "^16.4.5", - "dotenv-cli": "^7.4.1", - "eslint": "^8.57.0", + "dotenv-cli": "^7.4.2", + "eslint": "^9.5.0", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-i18next": "^6.0.3", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-jsx-a11y": "^6.9.0", "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-react": "^7.34.1", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-simple-import-sort": "^10.0.0", + "eslint-plugin-react": "^7.34.3", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-simple-import-sort": "^12.1.0", + "globals": "^15.6.0", + "meow": "^9.0.0", + "optionator": "^0.9.4", "postcss": "^8.4.38", - "prettier": "^3.2.5", + "prettier": "^3.3.2", "rollup-plugin-visualizer": "^5.12.0", - "sass": "^1.74.1", - "stylelint": "^16.3.1", + "sass": "^1.77.6", + "stylelint": "^16.6.1", "stylelint-config-standard-scss": "^13.1.0", "stylelint-declaration-strict-value": "^1.10.4", - "stylelint-scss": "^6.2.1", - "typescript": "^5.4.4", - "vite": "^5.2.8", + "stylelint-scss": "^6.3.2", + "typescript": "^5.5.2", + "vite": "^5.3.1", "vite-plugin-checker": "^0.6.4", "vite-plugin-svg-icons": "^2.0.1", "vite-tsconfig-paths": "^4.3.2", diff --git a/static/.gitkeep b/public/.gitkeep similarity index 100% rename from static/.gitkeep rename to public/.gitkeep diff --git a/static/branding/android-chrome-192x192.png b/public/branding/android-chrome-192x192.png similarity index 100% rename from static/branding/android-chrome-192x192.png rename to public/branding/android-chrome-192x192.png diff --git a/static/branding/android-chrome-256x256.png b/public/branding/android-chrome-256x256.png similarity index 100% rename from static/branding/android-chrome-256x256.png rename to public/branding/android-chrome-256x256.png diff --git a/static/branding/apple-touch-icon.png b/public/branding/apple-touch-icon.png similarity index 100% rename from static/branding/apple-touch-icon.png rename to public/branding/apple-touch-icon.png diff --git a/static/branding/favicon.ico b/public/branding/favicon.ico similarity index 100% rename from static/branding/favicon.ico rename to public/branding/favicon.ico diff --git a/static/branding/favicon.png b/public/branding/favicon.png similarity index 100% rename from static/branding/favicon.png rename to public/branding/favicon.png diff --git a/static/branding/fonts/NunitoSans/NunitoSans-Black.woff2 b/public/branding/fonts/NunitoSans/NunitoSans-Black.woff2 similarity index 100% rename from static/branding/fonts/NunitoSans/NunitoSans-Black.woff2 rename to public/branding/fonts/NunitoSans/NunitoSans-Black.woff2 diff --git a/static/branding/fonts/NunitoSans/NunitoSans-Bold.woff2 b/public/branding/fonts/NunitoSans/NunitoSans-Bold.woff2 similarity index 100% rename from static/branding/fonts/NunitoSans/NunitoSans-Bold.woff2 rename to public/branding/fonts/NunitoSans/NunitoSans-Bold.woff2 diff --git a/static/branding/fonts/NunitoSans/NunitoSans-ExtraBold.woff2 b/public/branding/fonts/NunitoSans/NunitoSans-ExtraBold.woff2 similarity index 100% rename from static/branding/fonts/NunitoSans/NunitoSans-ExtraBold.woff2 rename to public/branding/fonts/NunitoSans/NunitoSans-ExtraBold.woff2 diff --git a/static/branding/fonts/NunitoSans/NunitoSans-Light.woff2 b/public/branding/fonts/NunitoSans/NunitoSans-Light.woff2 similarity index 100% rename from static/branding/fonts/NunitoSans/NunitoSans-Light.woff2 rename to public/branding/fonts/NunitoSans/NunitoSans-Light.woff2 diff --git a/static/branding/fonts/NunitoSans/NunitoSans-Regular.woff2 b/public/branding/fonts/NunitoSans/NunitoSans-Regular.woff2 similarity index 100% rename from static/branding/fonts/NunitoSans/NunitoSans-Regular.woff2 rename to public/branding/fonts/NunitoSans/NunitoSans-Regular.woff2 diff --git a/static/branding/fonts/NunitoSans/NunitoSans-SemiBold.woff2 b/public/branding/fonts/NunitoSans/NunitoSans-SemiBold.woff2 similarity index 100% rename from static/branding/fonts/NunitoSans/NunitoSans-SemiBold.woff2 rename to public/branding/fonts/NunitoSans/NunitoSans-SemiBold.woff2 diff --git a/static/branding/fonts/index.css b/public/branding/fonts/index.css similarity index 100% rename from static/branding/fonts/index.css rename to public/branding/fonts/index.css diff --git a/static/branding/logo.svg b/public/branding/logo.svg similarity index 100% rename from static/branding/logo.svg rename to public/branding/logo.svg diff --git a/static/branding/mstile-150x150.png b/public/branding/mstile-150x150.png similarity index 100% rename from static/branding/mstile-150x150.png rename to public/branding/mstile-150x150.png diff --git a/static/browserconfig.xml b/public/browserconfig.xml similarity index 100% rename from static/browserconfig.xml rename to public/browserconfig.xml diff --git a/static/env.js b/public/env.js similarity index 100% rename from static/env.js rename to public/env.js diff --git a/static/init-loader/style.css b/public/init-loader/style.css similarity index 100% rename from static/init-loader/style.css rename to public/init-loader/style.css diff --git a/static/noscript/chrome.jpg b/public/noscript/chrome.jpg similarity index 100% rename from static/noscript/chrome.jpg rename to public/noscript/chrome.jpg diff --git a/static/noscript/firefox.jpg b/public/noscript/firefox.jpg similarity index 100% rename from static/noscript/firefox.jpg rename to public/noscript/firefox.jpg diff --git a/static/noscript/safari.jpg b/public/noscript/safari.jpg similarity index 100% rename from static/noscript/safari.jpg rename to public/noscript/safari.jpg diff --git a/static/noscript/style.css b/public/noscript/style.css similarity index 100% rename from static/noscript/style.css rename to public/noscript/style.css diff --git a/static/site.webmanifest b/public/site.webmanifest similarity index 100% rename from static/site.webmanifest rename to public/site.webmanifest diff --git a/src/config.ts b/src/config.ts index d5aadbb..6f6fe60 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,17 +3,15 @@ import { LogLevelDesc } from 'loglevel' import packageJson from '../package.json' type Config = { - API_URL: string APP_NAME: string - LOG_LEVEL: LogLevelDesc BUILD_VERSION: string + LOG_LEVEL: LogLevelDesc } export const config: Config = { - API_URL: import.meta.env.VITE_API_URL, APP_NAME: import.meta.env.VITE_APP_NAME, LOG_LEVEL: 'trace' as LogLevelDesc, - BUILD_VERSION: packageJson.version || import.meta.env.VITE_APP_BUILD_VERSION, + BUILD_VERSION: packageJson.version || import.meta.env.VITE_BUILD_VERSION, } /** diff --git a/src/localization/index.ts b/src/localization/index.ts index 3dacad3..0133b13 100644 --- a/src/localization/index.ts +++ b/src/localization/index.ts @@ -1,4 +1,4 @@ -import i18n from 'i18next' +import * as i18n from 'i18next' import { initReactI18next } from 'react-i18next' import resources from '@/localization/resources' @@ -15,7 +15,7 @@ const DEFAULT_LOCALE = 'en' const locale = localStorage?.getItem(STORAGE_KEY) ?? DEFAULT_LOCALE // for all options read: https://www.i18next.com/overview/configuration-options -// eslint-disable-next-line import/no-named-as-default-member + i18n.use(initReactI18next).init({ fallbackLng: locale, lng: locale, diff --git a/src/pages/ComplexForm/components/LoginForm/index.tsx b/src/pages/ComplexForm/components/LoginForm/index.tsx index 7471433..0ad69f4 100644 --- a/src/pages/ComplexForm/components/LoginForm/index.tsx +++ b/src/pages/ComplexForm/components/LoginForm/index.tsx @@ -211,7 +211,7 @@ const LoginForm = () => { return next }) }} - label={'someComplexObject.fullName.firstName'} + label='someComplexObject.fullName.firstName' errorMessage={getFieldErrorMessage( 'someComplexObject.fullName.firstName', )} @@ -219,7 +219,7 @@ const LoginForm = () => { /> { bus.emit( diff --git a/src/pages/UiKit/index.tsx b/src/pages/UiKit/index.tsx index 496e6f2..1e9834a 100644 --- a/src/pages/UiKit/index.tsx +++ b/src/pages/UiKit/index.tsx @@ -325,10 +325,14 @@ export default function UiKit({ ...rest }: Props) { showToast( BusEvents.Success,
-

{`Hello yopta`}

- {`lol kek cheburek`} +

+ {t('Hello yopta')} +

+ + {t('lol kek cheburek')} + bus.emit(BusEvents.Success, 'Some success message') } @@ -372,40 +376,40 @@ export default function UiKit({ ...rest }: Props) {
- + } /> } nodeRight={} /> } nodeRight={} @@ -413,8 +417,8 @@ export default function UiKit({ ...rest }: Props) { } @@ -432,27 +436,27 @@ export default function UiKit({ ...rest }: Props) { value={select} updateValue={setSelect} valueOptions={SELECT_OPTIONS} - label={`Label`} + label='Label' /> @@ -465,56 +469,56 @@ export default function UiKit({ ...rest }: Props) { value={basicSelect} updateValue={value => setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - label={`Label`} + label='Label' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - placeholder={`placeholder`} + placeholder='placeholder' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - errorMessage={`error message`} + errorMessage='error message' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - label={`Label`} - errorMessage={`error message`} + label='Label' + errorMessage='error message' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - placeholder={`placeholder`} - errorMessage={`error message`} + placeholder='placeholder' + errorMessage='error message' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - note={`lorem ipsum dolor sit amet`} + note='lorem ipsum dolor sit amet' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - label={`Label`} - note={`lorem ipsum dolor sit amet`} + label='Label' + note='lorem ipsum dolor sit amet' errorMessage={basicSelect} /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - placeholder={`placeholder`} - note={`lorem ipsum dolor sit amet`} + placeholder='placeholder' + note='lorem ipsum dolor sit amet' /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - label={`Label`} + label='Label' isDisabled={true} /> setBasicSelect(value as string)} valueOptions={BASIC_SELECT_OPTIONS} - placeholder={`placeholder`} + placeholder='placeholder' isDisabled={true} /> + - + - @@ -631,21 +627,16 @@ export default function UiKit({ ...rest }: Props) {
- - setIsModalShown(true)} - /> + setIsModalShown(true)} />
{t('ui-kit.collapse-text')}
-
diff --git a/src/ui/UiSelect/index.tsx b/src/ui/UiSelect/index.tsx index 5ca7e1e..2effb70 100644 --- a/src/ui/UiSelect/index.tsx +++ b/src/ui/UiSelect/index.tsx @@ -138,7 +138,7 @@ export default function UiSelect({