From e46c9f6750e91abcf9691130e2fd912de334a972 Mon Sep 17 00:00:00 2001 From: AzizbekFayziyev Date: Wed, 16 Jul 2025 17:45:36 +0500 Subject: [PATCH 1/3] add: prettier recommended plugin --- .eslintrc.json | 1 + migrations/20240711121254-add-assets-info.cjs | 15 ---- ...0240824145239-update-order-money-types.cjs | 73 ------------------- ...3651-add-exchange-notifications-amount.cjs | 16 ---- ...0902095707-add-asset-whitelisted-field.cjs | 16 ---- .../20240920112346-update_notifications.cjs | 16 ---- .../20250125120630-add-isAdmin-to-user.cjs | 16 ---- .../20250125125455-add-featured-pairs.cjs | 16 ---- package.json | 4 +- .../UI/CurrencyDropdown/CurrencyDropdown.tsx | 8 +- src/components/default/Offers/Offers.js | 14 ++-- src/pages/p2p/index.tsx | 4 +- .../ProcessContent/ProcessContent.tsx | 18 ++--- 13 files changed, 25 insertions(+), 192 deletions(-) delete mode 100644 migrations/20240711121254-add-assets-info.cjs delete mode 100644 migrations/20240824145239-update-order-money-types.cjs delete mode 100644 migrations/20240826043651-add-exchange-notifications-amount.cjs delete mode 100644 migrations/20240902095707-add-asset-whitelisted-field.cjs delete mode 100644 migrations/20240920112346-update_notifications.cjs delete mode 100644 migrations/20250125120630-add-isAdmin-to-user.cjs delete mode 100644 migrations/20250125125455-add-featured-pairs.cjs diff --git a/.eslintrc.json b/.eslintrc.json index e547e5b..435b9b4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,7 @@ "airbnb-base", "plugin:@typescript-eslint/recommended", "next/core-web-vitals", + "plugin:prettier/recommended", "prettier" ], "parser": "@typescript-eslint/parser", diff --git a/migrations/20240711121254-add-assets-info.cjs b/migrations/20240711121254-add-assets-info.cjs deleted file mode 100644 index 9c9de27..0000000 --- a/migrations/20240711121254-add-assets-info.cjs +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - queryInterface.addColumn('Currencies', 'asset_info', { - type: Sequelize.JSONB, - allowNull: true, - }); - }, - - async down(queryInterface, Sequelize) { - queryInterface.removeColumn('Currencies', 'asset_info'); - }, -}; diff --git a/migrations/20240824145239-update-order-money-types.cjs b/migrations/20240824145239-update-order-money-types.cjs deleted file mode 100644 index 8ce949f..0000000 --- a/migrations/20240824145239-update-order-money-types.cjs +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; - -async function updateColumnType(queryInterface, table, column, type, transaction) { - await queryInterface.changeColumn( - table, - column, - { - type: `${type} USING CAST("${column}" as ${type})`, - }, - { transaction }, - ); -} - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - await queryInterface.sequelize.transaction(async (transaction) => { - await updateColumnType(queryInterface, 'Orders', 'price', 'VARCHAR', transaction); - await updateColumnType(queryInterface, 'Orders', 'amount', 'VARCHAR', transaction); - await updateColumnType(queryInterface, 'Orders', 'total', 'VARCHAR', transaction); - await updateColumnType(queryInterface, 'Orders', 'left', 'VARCHAR', transaction); - - await updateColumnType( - queryInterface, - 'Transactions', - 'amount', - 'VARCHAR', - transaction, - ); - }); - }, - - async down(queryInterface, Sequelize) { - queryInterface.sequelize.transaction(async (transaction) => { - await updateColumnType( - queryInterface, - 'Orders', - 'price', - 'DOUBLE PRECISION', - transaction, - ); - await updateColumnType( - queryInterface, - 'Orders', - 'amount', - 'DOUBLE PRECISION', - transaction, - ); - await updateColumnType( - queryInterface, - 'Orders', - 'total', - 'DOUBLE PRECISION', - transaction, - ); - await updateColumnType( - queryInterface, - 'Orders', - 'left', - 'DOUBLE PRECISION', - transaction, - ); - - await updateColumnType( - queryInterface, - 'Transactions', - 'amount', - 'DOUBLE PRECISION', - transaction, - ); - }); - }, -}; diff --git a/migrations/20240826043651-add-exchange-notifications-amount.cjs b/migrations/20240826043651-add-exchange-notifications-amount.cjs deleted file mode 100644 index a3b6dde..0000000 --- a/migrations/20240826043651-add-exchange-notifications-amount.cjs +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - queryInterface.addColumn('Users', 'exchange_notifications_amount', { - type: Sequelize.INTEGER, - allowNull: false, - defaultValue: 0, - }); - }, - - async down(queryInterface) { - queryInterface.removeColumn('Users', 'exchange_notifications_amount'); - }, -}; diff --git a/migrations/20240902095707-add-asset-whitelisted-field.cjs b/migrations/20240902095707-add-asset-whitelisted-field.cjs deleted file mode 100644 index 68458c7..0000000 --- a/migrations/20240902095707-add-asset-whitelisted-field.cjs +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - queryInterface.addColumn('Currencies', 'whitelisted', { - type: Sequelize.BOOLEAN, - defaultValue: false, - allowNull: false, - }); - }, - - async down(queryInterface, Sequelize) { - queryInterface.removeColumn('Currencies', 'whitelisted'); - }, -}; diff --git a/migrations/20240920112346-update_notifications.cjs b/migrations/20240920112346-update_notifications.cjs deleted file mode 100644 index dab345a..0000000 --- a/migrations/20240920112346-update_notifications.cjs +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - queryInterface.addColumn('Orders', 'hasNotification', { - type: Sequelize.BOOLEAN, - defaultValue: false, - allowNull: false, - }); - }, - - async down(queryInterface, Sequelize) { - queryInterface.removeColumn('Users', 'exchange_notifications_amount'); - }, -}; diff --git a/migrations/20250125120630-add-isAdmin-to-user.cjs b/migrations/20250125120630-add-isAdmin-to-user.cjs deleted file mode 100644 index ba20ffb..0000000 --- a/migrations/20250125120630-add-isAdmin-to-user.cjs +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - await queryInterface.addColumn('Users', 'isAdmin', { - type: Sequelize.BOOLEAN, - allowNull: false, - defaultValue: false, - }); - }, - - async down(queryInterface, Sequelize) { - await queryInterface.removeColumn('Users', 'isAdmin'); - }, -}; diff --git a/migrations/20250125125455-add-featured-pairs.cjs b/migrations/20250125125455-add-featured-pairs.cjs deleted file mode 100644 index d271112..0000000 --- a/migrations/20250125125455-add-featured-pairs.cjs +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - up: async (queryInterface, Sequelize) => { - await queryInterface.addColumn('Pairs', 'featured', { - type: Sequelize.BOOLEAN, - defaultValue: false, - allowNull: false, - }); - }, - - down: async (queryInterface, Sequelize) => { - await queryInterface.removeColumn('Pairs', 'featured'); - }, -}; diff --git a/package.json b/package.json index fb08b70..f4d10a8 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "next build", "start": "next start -p 30289", "lint": "next lint", - "lint:fix": "eslint . --fix", + "eslint": "eslint . --ext .js,.ts,.tsx,.jsx --fix", "format": "prettier --write .", "format:check": "prettier --check .", "prepare": "husky" @@ -68,4 +68,4 @@ "sass": "^1.59.2", "url-loader": "^4.1.1" } -} \ No newline at end of file +} diff --git a/src/components/UI/CurrencyDropdown/CurrencyDropdown.tsx b/src/components/UI/CurrencyDropdown/CurrencyDropdown.tsx index f257675..f795a8e 100644 --- a/src/components/UI/CurrencyDropdown/CurrencyDropdown.tsx +++ b/src/components/UI/CurrencyDropdown/CurrencyDropdown.tsx @@ -97,10 +97,10 @@ function CurrencyDropdown(props: CurrencyDropdownProps) { body={ !props.noStars ? separateArray(e.data, (curr) => - (state?.user?.favourite_currencies || []).includes( - curr.id, - ), - ) + (state?.user?.favourite_currencies || []).includes( + curr.id, + ), + ) : e.data } /> diff --git a/src/components/default/Offers/Offers.js b/src/components/default/Offers/Offers.js index 2da1be7..eeda3a3 100644 --- a/src/components/default/Offers/Offers.js +++ b/src/components/default/Offers/Offers.js @@ -475,13 +475,13 @@ function Offers(props) { )} {props.categoryState !== 'finished' && props.categoryState !== 'active' && ( - - )} + + )} )} diff --git a/src/pages/p2p/index.tsx b/src/pages/p2p/index.tsx index b4e117d..ac10798 100644 --- a/src/pages/p2p/index.tsx +++ b/src/pages/p2p/index.tsx @@ -31,8 +31,8 @@ function Home(props: HomeProps) { const offersNotifications = state.user?.chats ? state.user.chats?.filter( - (e) => state.user?.id && !(e.view_list || [])?.includes(state.user?.id), - ).length || 0 + (e) => state.user?.id && !(e.view_list || [])?.includes(state.user?.id), + ).length || 0 : 0; function Card(props: { title: string; value: string }) { diff --git a/src/pages/p2p/process/components/ProcessContent/ProcessContent.tsx b/src/pages/p2p/process/components/ProcessContent/ProcessContent.tsx index 9b47fbb..ed0d31f 100644 --- a/src/pages/p2p/process/components/ProcessContent/ProcessContent.tsx +++ b/src/pages/p2p/process/components/ProcessContent/ProcessContent.tsx @@ -334,19 +334,19 @@ function ProcessContent() { )} {!finishState && (myState === 'deposit' || myState === 'canceled') && ( - - )} + + )} {!finishState && (myState === 'deposit' || myState === 'confirmed') && ( - - )} + + )} {finishState === 'confirmed' && (

The offer finished successfully. From 97578fa9cd045f1d24ab055801f754c410a19380 Mon Sep 17 00:00:00 2001 From: jejolare Date: Sat, 26 Jul 2025 17:42:46 +0700 Subject: [PATCH 2/3] remove legacy part of code --- src/pages/_app.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index c57c4ba..bce9305 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -62,8 +62,6 @@ App.getInitialProps = async (context: AppContext) => { try { const pageProps = await NextApp.getInitialProps(context); - if (!context.ctx.req) return pageProps; - const configRes = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/config`, { method: 'GET', headers: { From c6e02b1f672bbf691c580df25fd867b529f5d6b4 Mon Sep 17 00:00:00 2001 From: jejolare Date: Sat, 26 Jul 2025 17:43:28 +0700 Subject: [PATCH 3/3] fix deps --- package-lock.json | 76 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 77 insertions(+) diff --git a/package-lock.json b/package-lock.json index 06e1aa0..1b906eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,6 +51,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^10.1.5", "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.5.3", "husky": "^9.1.7", "lint-staged": "^15.5.2", "prettier": "3.5.3", @@ -3442,6 +3443,18 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@pkgr/core": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.9.tgz", + "integrity": "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/pkgr" + } + }, "node_modules/@rc-component/async-validator": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@rc-component/async-validator/-/async-validator-5.0.4.tgz", @@ -7246,6 +7259,36 @@ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9" } }, + "node_modules/eslint-plugin-prettier": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.3.tgz", + "integrity": "sha512-NAdMYww51ehKfDyDhv59/eIItUVzU0Io9H2E8nHNGKEeeqlnci+1gCvrHib6EmZdf6GxF+LCV5K7UC65Ezvw7w==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.11.7" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-plugin-react": { "version": "7.37.5", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", @@ -7575,6 +7618,12 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "license": "MIT" }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", @@ -10418,6 +10467,18 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -12704,6 +12765,21 @@ "node": ">= 10" } }, + "node_modules/synckit": { + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.11.tgz", + "integrity": "sha512-MeQTA1r0litLUf0Rp/iisCaL8761lKAZHaimlbGK4j0HysC4PLfqygQj9srcs0m2RdtDYnF8UuYyKpbjHYp7Jw==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.2.9" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/synckit" + } + }, "node_modules/tapable": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz", diff --git a/package.json b/package.json index 801446b..1a84a9b 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^10.1.5", "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.5.3", "husky": "^9.1.7", "lint-staged": "^15.5.2", "prettier": "3.5.3",