diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..be53983 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +yarn precommit diff --git a/.prettierrc b/.prettierrc index 61aaaf6..88c02f5 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,7 @@ "bracketSpacing": true, "htmlWhitespaceSensitivity": "ignore", "insertPragma": false, - "jsxBracketSameLine": false, + "bracketSameLine": false, "jsxSingleQuote": false, "printWidth": 100, "proseWrap": "preserve", diff --git a/apps/web/Components/Calculation/config/elements-render/override.tsx b/apps/web/Components/Calculation/config/elements-render/override.tsx index 341059a..cfdc2d9 100644 --- a/apps/web/Components/Calculation/config/elements-render/override.tsx +++ b/apps/web/Components/Calculation/config/elements-render/override.tsx @@ -183,12 +183,15 @@ const overrideRender: Partial> = { const graphType = $calculation.element('radioGraphType').getValue(); switch (graphType) { - case 100_000_001: + case 100_000_001: { return Тип дегрессии; - case 100_000_003: + } + case 100_000_003: { return Тип сезонности; - default: + } + default: { return {titles.selectSeasonType}; + } } }); diff --git a/apps/web/package.json b/apps/web/package.json index b4daaff..7c773ac 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -6,6 +6,7 @@ "build": "next build", "dev": "next dev", "lint": "next lint", + "lint:fix": "next lint -- --fix", "start": "next start", "graphql:codegen": "graphql-codegen --config .graphqlrc.yml", "graphql:download-schema": "dotenv -e .env.local node ./scripts/graphql-download-schema.js", @@ -37,6 +38,7 @@ "superjson": "^1.12.1", "tools": "*", "ui": "*", + "use-debounce": "^9.0.2", "zod": "^3.20.2" }, "devDependencies": { diff --git a/apps/web/process/lead-opportunity/reactions/common.ts b/apps/web/process/lead-opportunity/reactions/common.ts index a14b216..06d2faa 100644 --- a/apps/web/process/lead-opportunity/reactions/common.ts +++ b/apps/web/process/lead-opportunity/reactions/common.ts @@ -38,7 +38,9 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex return; } - const { data: { lead }, } = await apolloClient.query< + const { + data: { lead }, + } = await apolloClient.query< CRMTypes.GetOpportunityByLeadQuery, CRMTypes.GetOpportunityByLeadQueryVariables >({ @@ -78,7 +80,9 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex const leadid = $calculation.element('selectLead').getValue(); if (leadid) { - const { data: { lead }, } = await apolloClient.query< + const { + data: { lead }, + } = await apolloClient.query< CRMTypes.GetOpportunityByLeadQuery, CRMTypes.GetOpportunityByLeadQueryVariables >({ @@ -94,7 +98,9 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex } if (opportunityid) { - const { data: { opportunity }, } = await apolloClient.query< + const { + data: { opportunity }, + } = await apolloClient.query< CRMTypes.GetLeadidByOpportunityQuery, CRMTypes.GetLeadidByOpportunityQueryVariables >({ @@ -133,7 +139,9 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex () => $calculation.element('selectLead').getValue(), async (leadid) => { if (leadid) { - const { data: { quotes }, } = await apolloClient.query< + const { + data: { quotes }, + } = await apolloClient.query< CRMTypes.GetQuotesByLeadQuery, CRMTypes.GetQuotesByLeadQueryVariables >({ diff --git a/package.json b/package.json index 2663d74..6bc3c70 100644 --- a/package.json +++ b/package.json @@ -12,16 +12,17 @@ "dev": "turbo run dev --parallel", "format": "prettier --write \"**/*.{js,jsx,ts,tsx}\"", "lint": "turbo run lint", + "lint:fix": "turbo run lint:fix", "test": "turbo run test", "prepare": "husky install", - "precommit": "yarn prettier && yarn lint:fix && yarn test" + "precommit": "yarn format && yarn lint:fix && yarn test" }, "dependencies": {}, "devDependencies": { "dotenv-cli": "^6.0.0", "eslint-config-custom": "*", "husky": "^8.0.3", - "prettier": "latest", + "prettier": "^2.8.2", "turbo": "latest" }, "packageManager": "yarn@1.22.17", diff --git a/packages/jest-presets/jest/node/jest-preset.js b/packages/jest-presets/jest/node/jest-preset.js index b6c2593..3edd4fa 100644 --- a/packages/jest-presets/jest/node/jest-preset.js +++ b/packages/jest-presets/jest/node/jest-preset.js @@ -1,13 +1,13 @@ module.exports = { - roots: [""], + roots: [''], transform: { - "^.+\\.tsx?$": "ts-jest", + '^.+\\.tsx?$': 'ts-jest', }, - moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], modulePathIgnorePatterns: [ - "/test/__fixtures__", - "/node_modules", - "/dist", + '/test/__fixtures__', + '/node_modules', + '/dist', ], - preset: "ts-jest", + preset: 'ts-jest', }; diff --git a/turbo.json b/turbo.json index 5ce29c8..119d928 100644 --- a/turbo.json +++ b/turbo.json @@ -14,6 +14,10 @@ "dependsOn": ["^build"], "outputs": [] }, + "lint:fix": { + "dependsOn": ["^build"], + "outputs": [] + }, "dev": { "cache": false }, diff --git a/yarn.lock b/yarn.lock index 39e90ff..255c7fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6518,10 +6518,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@latest: - version "2.7.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +prettier@^2.8.2: + version "2.8.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.2.tgz#c4ea1b5b454d7c4b59966db2e06ed7eec5dfd160" + integrity sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw== pretty-format@^29.3.1: version "29.3.1"