From 8a09f57bd4df1a228358de9644da2320ba6b4b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Mon, 14 Feb 2022 14:35:50 +0100 Subject: [PATCH] Fix build and lint errors --- .eslintrc.json | 13 ++++- apps/trading/pages/index.tsx | 4 ++ apps/trading/tsconfig.json | 3 +- .../src/components/callout/callout.test.tsx | 1 + .../src/components/callout/callout.tsx | 2 +- .../etherscan-link/etherscan-link.test.tsx | 5 +- libs/ui-toolkit/src/lib/ui-toolkit.tsx | 2 +- nx.json | 2 +- package.json | 7 ++- yarn.lock | 52 +++++++++++++++++-- 10 files changed, 77 insertions(+), 14 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 06cc47d9a..6f1d4ff3c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,7 +24,18 @@ { "files": ["*.ts", "*.tsx"], "extends": ["plugin:@nrwl/nx/typescript"], - "rules": {} + "rules": { + "@typescript-eslint/ban-ts-comment": [ + "error", + { + "ts-expect-error": "allow-with-description", + "ts-ignore": "allow-with-description", + "ts-nocheck": true, + "ts-check": false, + "minimumDescriptionLength": 10 + } + ] + } }, { "files": ["*.js", "*.jsx"], diff --git a/apps/trading/pages/index.tsx b/apps/trading/pages/index.tsx index bc9c695db..8af331ad1 100644 --- a/apps/trading/pages/index.tsx +++ b/apps/trading/pages/index.tsx @@ -1,4 +1,6 @@ import styles from './index.module.scss'; +import { EtherscanLink } from '@vegaprotocol/ui-toolkit'; +import { ReactHelpers } from '@vegaprotocol/react-helpers'; export function Index() { /* @@ -15,6 +17,8 @@ export function Index() { Hello there, Welcome trading 👋 + +
diff --git a/apps/trading/tsconfig.json b/apps/trading/tsconfig.json index 4a75fd673..7f521fe09 100644 --- a/apps/trading/tsconfig.json +++ b/apps/trading/tsconfig.json @@ -10,7 +10,8 @@ "forceConsistentCasingInFileNames": true, "noEmit": true, "resolveJsonModule": true, - "isolatedModules": true + "isolatedModules": true, + "incremental": true }, "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts"], "exclude": ["node_modules"] diff --git a/libs/ui-toolkit/src/components/callout/callout.test.tsx b/libs/ui-toolkit/src/components/callout/callout.test.tsx index f026cff08..3af48cae9 100644 --- a/libs/ui-toolkit/src/components/callout/callout.test.tsx +++ b/libs/ui-toolkit/src/components/callout/callout.test.tsx @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; import * as React from 'react'; import { Callout } from '.'; diff --git a/libs/ui-toolkit/src/components/callout/callout.tsx b/libs/ui-toolkit/src/components/callout/callout.tsx index b71a07563..29f7331e7 100644 --- a/libs/ui-toolkit/src/components/callout/callout.tsx +++ b/libs/ui-toolkit/src/components/callout/callout.tsx @@ -1,4 +1,4 @@ -import './callout.scss'; +// import './callout.scss'; import React from 'react'; export const Callout = ({ diff --git a/libs/ui-toolkit/src/components/etherscan-link/etherscan-link.test.tsx b/libs/ui-toolkit/src/components/etherscan-link/etherscan-link.test.tsx index 806f4b2d4..59dd73916 100644 --- a/libs/ui-toolkit/src/components/etherscan-link/etherscan-link.test.tsx +++ b/libs/ui-toolkit/src/components/etherscan-link/etherscan-link.test.tsx @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; import * as React from 'react'; import { EtherscanLink } from '.'; import { EthereumChainIds } from '../../utils/web3'; @@ -53,13 +54,13 @@ test("Doesn't render for tx if chainid is null", () => { }); test("Doesn't render for address if chainid is unknown", () => { - // @ts-ignore + // @ts-ignore wrong chaindId passed render(); expect(screen.queryByTestId('etherscan-link')).not.toBeInTheDocument(); }); test("Doesn't render for tx if chainid is unknown", () => { - // @ts-ignore + // @ts-ignore wrong chaindId passed render(); expect(screen.queryByTestId('etherscan-link')).not.toBeInTheDocument(); }); diff --git a/libs/ui-toolkit/src/lib/ui-toolkit.tsx b/libs/ui-toolkit/src/lib/ui-toolkit.tsx index c8cd21880..49718d09f 100644 --- a/libs/ui-toolkit/src/lib/ui-toolkit.tsx +++ b/libs/ui-toolkit/src/lib/ui-toolkit.tsx @@ -1,4 +1,4 @@ -import './ui-toolkit.module.scss'; +// import './ui-toolkit.module.scss'; /* eslint-disable-next-line */ export interface UiToolkitProps {} diff --git a/nx.json b/nx.json index 88ca8cb43..00dab3d53 100644 --- a/nx.json +++ b/nx.json @@ -1,5 +1,5 @@ { - "npmScope": "nx-monorepo", + "npmScope": "vegaprotocol", "affected": { "defaultBase": "master" }, diff --git a/package.json b/package.json index 1cbda9e88..37ba03e7b 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@storybook/manager-webpack5": "~6.4.12", "@storybook/react": "~6.4.12", "@svgr/webpack": "^5.4.0", + "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "12.1.2", "@testing-library/react-hooks": "7.0.2", "@types/jest": "27.0.2", @@ -67,9 +68,7 @@ "url-loader": "^3.0.0" }, "lint-staged": { - "*": [ - "yarn nx format:write --uncommitted", - "yarn eslint --fix" - ] + "*": "yarn nx format:write --uncommitted", + "*.{ts,tsx,js,jsx}": "yarn eslint --fix" } } diff --git a/yarn.lock b/yarn.lock index 3191d6396..d9248ca6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1149,7 +1149,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.8", "@babel/runtime@^7.16.3", "@babel/runtime@^7.16.7", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.8", "@babel/runtime@^7.16.3", "@babel/runtime@^7.16.7", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.17.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941" integrity sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw== @@ -3596,6 +3596,21 @@ lz-string "^1.4.4" pretty-format "^27.0.2" +"@testing-library/jest-dom@^5.16.2": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.16.2.tgz#f329b36b44aa6149cd6ced9adf567f8b6aa1c959" + integrity sha512-6ewxs1MXWwsBFZXIk4nKKskWANelkdUehchEOokHsN8X7c2eKXGw+77aRV63UU8f/DTSVUPLaGxdrj4lN7D/ug== + dependencies: + "@babel/runtime" "^7.9.2" + "@types/testing-library__jest-dom" "^5.9.1" + aria-query "^5.0.0" + chalk "^3.0.0" + css "^3.0.0" + css.escape "^1.5.1" + dom-accessibility-api "^0.5.6" + lodash "^4.17.15" + redent "^3.0.0" + "@testing-library/react-hooks@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-7.0.2.tgz#3388d07f562d91e7f2431a4a21b5186062ecfee0" @@ -3833,6 +3848,14 @@ dependencies: "@types/istanbul-lib-report" "*" +"@types/jest@*": + version "27.4.0" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.4.0.tgz#037ab8b872067cae842a320841693080f9cb84ed" + integrity sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ== + dependencies: + jest-diff "^27.0.0" + pretty-format "^27.0.0" + "@types/jest@27.0.2": version "27.0.2" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.0.2.tgz#ac383c4d4aaddd29bbf2b916d8d105c304a5fcd7" @@ -4061,6 +4084,13 @@ resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.8.tgz#b94a4391c85666c7b73299fd3ad79d4faa435310" integrity sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ== +"@types/testing-library__jest-dom@^5.9.1": + version "5.14.2" + resolved "https://registry.yarnpkg.com/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.2.tgz#564fb2b2dc827147e937a75b639a05d17ce18b44" + integrity sha512-vehbtyHUShPxIa9SioxDwCvgxukDMH//icJG90sXQBUm5lJOHLT5kNeU9tnivhnA/TkOFMzGIXN2cTc4hY8/kg== + dependencies: + "@types/jest" "*" + "@types/uglify-js@*": version "3.13.1" resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.13.1.tgz#5e889e9e81e94245c75b6450600e1c5ea2878aea" @@ -5891,6 +5921,14 @@ chalk@4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -6681,7 +6719,7 @@ css-what@^5.1.0: resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.1.0.tgz#3f7b707aadf633baf62c2ceb8579b545bb40f7fe" integrity sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw== -css.escape@1.5.1: +css.escape@1.5.1, css.escape@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s= @@ -7131,7 +7169,7 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.9: +dom-accessibility-api@^0.5.6, dom-accessibility-api@^0.5.9: version "0.5.11" resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.11.tgz#79d5846c4f90eba3e617d9031e921de9324f84ed" integrity sha512-7X6GvzjYf4yTdRKuCVScV+aA9Fvh5r8WzWrXBH9w82ZWB/eYDMGCnazoC/YAqAzUJWHzLOnZqr46K3iEyUhUvw== @@ -13394,6 +13432,14 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +redent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" + integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== + dependencies: + indent-string "^4.0.0" + strip-indent "^3.0.0" + refractor@^3.1.0: version "3.5.0" resolved "https://registry.yarnpkg.com/refractor/-/refractor-3.5.0.tgz#334586f352dda4beaf354099b48c2d18e0819aec"