Skip to content

Commit

Permalink
🐛 fix(types): Checking
Browse files Browse the repository at this point in the history
  • Loading branch information
web-ppanel committed Nov 26, 2024
1 parent c7e50a9 commit 2992824
Show file tree
Hide file tree
Showing 34 changed files with 2,089 additions and 3,154 deletions.
10 changes: 0 additions & 10 deletions .eslintrc.js

This file was deleted.

14 changes: 0 additions & 14 deletions apps/admin/.eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/admin/app/(auth)/user-check-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default function UserCheckForm({
clearTimeout(typingTimeoutRef.current);
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/app/dashboard/subscribe/subscribe-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export default function SubscribeForm<T extends Record<string, any>>({
max: 100,
placeholder: t('form.discountPercent'),
suffix: '%',
calculateValue: (data) => {
calculateValue: function (data) {
const { unit_price } = form.getValues();
return {
...data,
Expand All @@ -466,7 +466,7 @@ export default function SubscribeForm<T extends Record<string, any>>({
formatInput: (value) => unitConversion('centsToDollars', value),
formatOutput: (value) => unitConversion('dollarsToCents', value),
internal: true,
calculateValue: (data) => {
calculateValue: function (data) {
const { unit_price } = form.getValues();
return {
...data,
Expand Down
13 changes: 13 additions & 0 deletions apps/admin/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { nextJsConfig } from '@repo/eslint-config/next-js';

/** @type {import("eslint").Linter.Config} */
export default [
...nextJsConfig,
{
rules: {
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
];
16 changes: 8 additions & 8 deletions apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"@iconify/react": "^5.0.2",
"@repo/ui": "workspace:*",
"@shadcn/ui": "workspace:*",
"@tanstack/react-query": "^5.60.2",
"@tanstack/react-query-next-experimental": "^5.60.2",
"@tanstack/react-query": "^5.61.3",
"@tanstack/react-query-next-experimental": "^5.61.3",
"ahooks": "^3.8.1",
"axios": "^1.7.7",
"axios": "^1.7.8",
"crypto-js": "^4.2.0",
"mathjs": "^13.2.2",
"nanoid": "^5.0.8",
"mathjs": "^14.0.0",
"nanoid": "^5.0.9",
"next": "^15.0.3",
"next-intl": "^3.25.1",
"next-intl": "^3.25.3",
"next-runtime-env": "^3.2.2",
"next-themes": "^0.4.3",
"nextjs-toploader": "^3.7.15",
Expand All @@ -35,9 +35,9 @@
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^22.10.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"typescript": "^5.6.3"
"typescript": "^5.7.2"
}
}
21 changes: 9 additions & 12 deletions apps/admin/utils/request.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { NEXT_PUBLIC_API_URL, NEXT_PUBLIC_SITE_URL } from '@/config/constants';
import { getTranslations } from '@/locales/utils';
import { isBrowser } from '@repo/ui/utils';
import { toast } from '@shadcn/ui/lib/sonner';
import axios, { InternalAxiosRequestConfig } from 'axios';
import { NEXT_PUBLIC_API_URL, NEXT_PUBLIC_SITE_URL } from '../config/constants';
import requset, { InternalAxiosRequestConfig } from 'axios';
import { getAuthorization, Logout } from './common';

const request = axios.create({
baseURL: NEXT_PUBLIC_API_URL || NEXT_PUBLIC_SITE_URL,
// withCredentials: true,
// withXSRFToken: true,
timeout: 10000,
});

async function handleError(response: any) {
const code = response.data?.code;
if (response?.config?.skipErrorHandler) return;
Expand All @@ -27,7 +20,11 @@ async function handleError(response: any) {
toast.error(message);
}

request.interceptors.request.use(
requset.defaults.baseURL = NEXT_PUBLIC_API_URL || NEXT_PUBLIC_SITE_URL;
// axios.defaults.withCredentials = true;
// axios.defaults.timeout = 10000;

requset.interceptors.request.use(
async (
config: InternalAxiosRequestConfig & {
Authorization?: string;
Expand All @@ -40,7 +37,7 @@ request.interceptors.request.use(
(error) => Promise.reject(error),
);

request.interceptors.response.use(
requset.interceptors.response.use(
async (response) => {
const { code } = response.data;
if (code !== 200) throw response;
Expand All @@ -52,4 +49,4 @@ request.interceptors.response.use(
},
);

export default request;
export default requset;
14 changes: 0 additions & 14 deletions apps/user/.eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/user/app/auth/user-check-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default function UserCheckForm({
clearTimeout(typingTimeoutRef.current);
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
13 changes: 13 additions & 0 deletions apps/user/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { nextJsConfig } from '@repo/eslint-config/next-js';

/** @type {import("eslint").Linter.Config} */
export default [
...nextJsConfig,
{
rules: {
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
];
24 changes: 12 additions & 12 deletions apps/user/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"build": "next build",
"dev": "next dev --turbopack -p 3001",
"lint": "next lint && tsc --noEmit",
"lint": "next lint --max-warnings 0 && tsc --noEmit",
"locale": "lobe-i18n --with-md",
"openapi": "openapi2ts",
"start": "next start"
Expand All @@ -13,18 +13,18 @@
"@iconify/react": "^5.0.2",
"@repo/ui": "workspace:*",
"@shadcn/ui": "workspace:*",
"@stripe/react-stripe-js": "^2.9.0",
"@stripe/stripe-js": "^4.10.0",
"@tanstack/react-query": "^5.60.2",
"@tanstack/react-query-next-experimental": "^5.60.2",
"@stripe/react-stripe-js": "^3.0.0",
"@stripe/stripe-js": "^5.2.0",
"@tanstack/react-query": "^5.61.3",
"@tanstack/react-query-next-experimental": "^5.61.3",
"ahooks": "^3.8.1",
"axios": "^1.7.7",
"axios": "^1.7.8",
"crypto-js": "^4.2.0",
"framer-motion": "^11.11.16",
"lucide-react": "^0.456.0",
"mathjs": "^13.2.2",
"framer-motion": "^11.11.17",
"lucide-react": "^0.461.0",
"mathjs": "^14.0.0",
"next": "^15.0.3",
"next-intl": "^3.25.1",
"next-intl": "^3.25.3",
"next-runtime-env": "^3.2.2",
"next-themes": "^0.4.3",
"nextjs-toploader": "^3.7.15",
Expand All @@ -39,9 +39,9 @@
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "^22.9.0",
"@types/node": "^22.10.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"typescript": "^5.6.3"
"typescript": "^5.7.2"
}
}
1 change: 1 addition & 0 deletions apps/user/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"plugins": [{ "name": "next" }],
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
Expand Down
19 changes: 8 additions & 11 deletions apps/user/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@ import { NEXT_PUBLIC_API_URL, NEXT_PUBLIC_SITE_URL } from '@/config/constants';
import { getTranslations } from '@/locales/utils';
import { isBrowser } from '@repo/ui/utils';
import { toast } from '@shadcn/ui/lib/sonner';
import axios, { InternalAxiosRequestConfig } from 'axios';
import requset, { InternalAxiosRequestConfig } from 'axios';
import { getAuthorization, Logout } from './common';

const request = axios.create({
baseURL: NEXT_PUBLIC_API_URL || NEXT_PUBLIC_SITE_URL,
// withCredentials: true,
// withXSRFToken: true,
timeout: 10000,
});

async function handleError(response: any) {
const code = response.data?.code;
if (response?.config?.skipErrorHandler) return;
Expand All @@ -27,7 +20,11 @@ async function handleError(response: any) {
toast.error(message);
}

request.interceptors.request.use(
requset.defaults.baseURL = NEXT_PUBLIC_API_URL || NEXT_PUBLIC_SITE_URL;
// axios.defaults.withCredentials = true;
// axios.defaults.timeout = 10000;

requset.interceptors.request.use(
async (
config: InternalAxiosRequestConfig & {
Authorization?: string;
Expand All @@ -40,7 +37,7 @@ request.interceptors.request.use(
(error) => Promise.reject(error),
);

request.interceptors.response.use(
requset.interceptors.response.use(
async (response) => {
const { code } = response.data;
if (code !== 200) throw response;
Expand All @@ -52,4 +49,4 @@ request.interceptors.response.use(
},
);

export default request;
export default requset;
4 changes: 4 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { config } from '@repo/eslint-config/base';

/** @type {import("eslint").Linter.Config} */
export default config;
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
"@repo/commitlint-config": "workspace:*",
"@repo/prettier-config": "workspace:*",
"@umijs/openapi": "^1.13.0",
"husky": "^9.1.6",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"semantic-release": "^21.1.2",
"semantic-release": "^24.2.0",
"semantic-release-config-gitmoji": "^1.5.3",
"turbo": "^2.2.3",
"typescript": "^5.6.3"
"turbo": "^2.3.2",
"typescript": "^5.7.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/commitlint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"main": "index.js",
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"commitlint": "^19.5.0",
"@commitlint/cli": "^19.6.0",
"commitlint": "^19.6.0",
"commitlint-config-gitmoji": "^2.3.1"
}
}
32 changes: 32 additions & 0 deletions packages/eslint-config/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import onlyWarn from 'eslint-plugin-only-warn';
import turboPlugin from 'eslint-plugin-turbo';
import tseslint from 'typescript-eslint';

/**
* A shared ESLint configuration for the repository.
*
* @type {import("eslint").Linter.Config}
* */
export const config = [
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
{
plugins: {
turbo: turboPlugin,
},
rules: {
'turbo/no-undeclared-env-vars': 'warn',
},
},
{
plugins: {
onlyWarn,
},
},
{
ignores: ['dist/**'],
},
];
34 changes: 0 additions & 34 deletions packages/eslint-config/library.js

This file was deleted.

Loading

0 comments on commit 2992824

Please sign in to comment.