From 86867928a4d6f8091e8d4716100197fef03ed578 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Wed, 10 Nov 2021 13:45:14 +0530 Subject: [PATCH] SUT in React --- .eslintrc.json | 35 ++++++++ libs/remix-ui/solidity-unit-testing/.babelrc | 12 +++ .../solidity-unit-testing/.eslintrc.json | 18 ++++ libs/remix-ui/solidity-unit-testing/README.md | 7 ++ .../solidity-unit-testing/src/index.ts | 1 + .../remix-ui-solidity-unit-testing.module.css | 0 .../lib/remix-ui-solidity-unit-testing.tsx | 16 ++++ .../solidity-unit-testing/tsconfig.json | 20 +++++ .../solidity-unit-testing/tsconfig.lib.json | 13 +++ nx.json | 11 +-- package.json | 7 ++ tsconfig.base.json | 6 +- workspace.json | 84 ++++++++++++++++++- 13 files changed, 218 insertions(+), 12 deletions(-) create mode 100644 .eslintrc.json create mode 100644 libs/remix-ui/solidity-unit-testing/.babelrc create mode 100644 libs/remix-ui/solidity-unit-testing/.eslintrc.json create mode 100644 libs/remix-ui/solidity-unit-testing/README.md create mode 100644 libs/remix-ui/solidity-unit-testing/src/index.ts create mode 100644 libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.module.css create mode 100644 libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.tsx create mode 100644 libs/remix-ui/solidity-unit-testing/tsconfig.json create mode 100644 libs/remix-ui/solidity-unit-testing/tsconfig.lib.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000000..06cc47d9a2 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,35 @@ +{ + "root": true, + "ignorePatterns": ["**/*"], + "plugins": ["@nrwl/nx"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": { + "@nrwl/nx/enforce-module-boundaries": [ + "error", + { + "enforceBuildableLibDependency": true, + "allow": [], + "depConstraints": [ + { + "sourceTag": "*", + "onlyDependOnLibsWithTags": ["*"] + } + ] + } + ] + } + }, + { + "files": ["*.ts", "*.tsx"], + "extends": ["plugin:@nrwl/nx/typescript"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "extends": ["plugin:@nrwl/nx/javascript"], + "rules": {} + } + ] +} diff --git a/libs/remix-ui/solidity-unit-testing/.babelrc b/libs/remix-ui/solidity-unit-testing/.babelrc new file mode 100644 index 0000000000..ccae900be4 --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/libs/remix-ui/solidity-unit-testing/.eslintrc.json b/libs/remix-ui/solidity-unit-testing/.eslintrc.json new file mode 100644 index 0000000000..50e59482cf --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/remix-ui/solidity-unit-testing/README.md b/libs/remix-ui/solidity-unit-testing/README.md new file mode 100644 index 0000000000..d10d541404 --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/README.md @@ -0,0 +1,7 @@ +# remix-ui-solidity-unit-testing + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test remix-ui-solidity-unit-testing` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/remix-ui/solidity-unit-testing/src/index.ts b/libs/remix-ui/solidity-unit-testing/src/index.ts new file mode 100644 index 0000000000..3a236a6cae --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/src/index.ts @@ -0,0 +1 @@ +export * from './lib/remix-ui-solidity-unit-testing'; diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.module.css b/libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.tsx b/libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.tsx new file mode 100644 index 0000000000..7a354c6a03 --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/src/lib/remix-ui-solidity-unit-testing.tsx @@ -0,0 +1,16 @@ +import './remix-ui-solidity-unit-testing.module.css'; + +/* eslint-disable-next-line */ +export interface RemixUiSolidityUnitTestingProps {} + +export function RemixUiSolidityUnitTesting( + props: RemixUiSolidityUnitTestingProps +) { + return ( +
+

Welcome to remix-ui-solidity-unit-testing!

+
+ ); +} + +export default RemixUiSolidityUnitTesting; diff --git a/libs/remix-ui/solidity-unit-testing/tsconfig.json b/libs/remix-ui/solidity-unit-testing/tsconfig.json new file mode 100644 index 0000000000..8bd701c578 --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/libs/remix-ui/solidity-unit-testing/tsconfig.lib.json b/libs/remix-ui/solidity-unit-testing/tsconfig.lib.json new file mode 100644 index 0000000000..b560bc4dec --- /dev/null +++ b/libs/remix-ui/solidity-unit-testing/tsconfig.lib.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": ["**/*.spec.ts", "**/*.spec.tsx"], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/nx.json b/nx.json index a1a7131ff6..1804d940a2 100644 --- a/nx.json +++ b/nx.json @@ -145,19 +145,12 @@ "remix-ui-tabs": { "tags": [] }, - "remix-ui-theme-module": { + "remix-ui-theme-module": {}, + "remix-ui-solidity-unit-testing": { "tags": [] }, "remix-ui-editor-context-view": { "tags": [] } - }, - "targetDependencies": { - "build": [ - { - "target": "build", - "projects": "dependencies" - } - ] } } diff --git a/package.json b/package.json index 693012f115..a4e2b1e26e 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,11 @@ "chokidar": "^2.1.8", "color-support": "^1.1.3", "commander": "^2.20.3", +<<<<<<< HEAD "core-js": "^3.19.3", +======= + "core-js": "^3.6.5", +>>>>>>> 6d78ad88e... SUT in React "deep-equal": "^1.0.1", "document-register-element": "1.13.1", "ethereumjs-util": "^7.0.10", @@ -266,8 +270,11 @@ "eslint-config-prettier": "^6.11.0", "eslint-config-standard": "^14.1.1", "eslint-plugin-import": "2.20.2", + "eslint-plugin-jsx-a11y": "6.4.1", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "4.2.1", + "eslint-plugin-react": "7.23.1", + "eslint-plugin-react-hooks": "4.2.0", "eslint-plugin-standard": "4.0.1", "events": "^3.0.0", "execr": "^1.0.1", diff --git a/tsconfig.base.json b/tsconfig.base.json index 68e1ae5175..80122de18e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -69,9 +69,13 @@ "@remix-ui/tabs": ["libs/remix-ui/tabs/src/index.ts"], "@remix-ui/helper": ["libs/remix-ui/helper/src/index.ts"], "@remix-ui/app": ["libs/remix-ui/app/src/index.ts"], + "@remix-ui/vertical-icons-panel": ["libs/remix-ui/vertical-icons-panel/src/index.ts"], "@remix-ui/theme-module": ["libs/remix-ui/theme-module/src/index.ts"], - "@remix-ui/editor-context-view": ["libs/remix-ui/editor-context-view/src/index.ts"] + "@remix-ui/editor-context-view": ["libs/remix-ui/editor-context-view/src/index.ts"], + "@remix-ui/solidity-unit-testing": [ + "libs/remix-ui/solidity-unit-testing/src/index.ts" + ] } }, "exclude": ["node_modules", "tmp"] diff --git a/workspace.json b/workspace.json index 15a2150908..38646e1e67 100644 --- a/workspace.json +++ b/workspace.json @@ -1,5 +1,71 @@ { "version": 1, + "cli": { + "defaultCollection": "@nrwl/react" + }, + "defaultProject": "remix-ide", + "schematics": { + "@nrwl/workspace": { + "library": { + "linter": "eslint" + } + }, + "@nrwl/cypress": { + "cypress-project": { + "linter": "eslint" + } + }, + "@nrwl/react": { + "application": { + "style": "css", + "linter": "eslint", + "babel": true + }, + "component": { + "style": "css" + }, + "library": { + "style": "css", + "linter": "eslint" + } + }, + "@nrwl/next": { + "application": { + "linter": "eslint" + } + }, + "@nrwl/web": { + "application": { + "linter": "eslint" + } + }, + "@nrwl/node": { + "application": { + "linter": "eslint" + }, + "library": { + "linter": "eslint" + } + }, + "@nrwl/nx-plugin": { + "plugin": { + "linter": "eslint" + } + }, + "@nrwl/nest": { + "application": { + "linter": "eslint" + } + }, + "@nrwl/express": { + "application": { + "linter": "eslint" + }, + "library": { + "linter": "eslint" + } + } + }, "projects": { "remix-ide": { "root": "apps/remix-ide", @@ -1117,6 +1183,21 @@ } } }, + "solidity-unit-testing": { + "root": "libs/remix-ui/solidity-unit-testing", + "sourceRoot": "libs/remix-ui/solidity-unit-testing/src", + "projectType": "library", + "architect": { + "lint": { + "builder": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "libs/remix-ui/solidity-unit-testing/**/*.{ts,tsx,js,jsx}" + ] + } + } + } + }, "remix-ui-editor-context-view": { "root": "libs/remix-ui/editor-context-view", "sourceRoot": "libs/remix-ui/editor-context-view/src", @@ -1131,8 +1212,7 @@ } } } - } - }, + }, "cli": { "defaultCollection": "@nrwl/react" },