diff --git a/app/client/.eslintrc.json b/app/client/.eslintrc.json index 31f98168e9..a32926795c 100644 --- a/app/client/.eslintrc.json +++ b/app/client/.eslintrc.json @@ -19,19 +19,20 @@ } }, "rules": { - "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-var-requires": "off", + "import/no-webpack-loader-syntax": "off", + "no-undef": "off", + "react/prop-types": "off", + "react/display-name": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "cypress/no-unnecessary-waiting": "off", + "cypress/no-assigning-return-values": "off", + "@typescript-eslint/no-unused-vars": "error", // enforce `import type` for all type-only imports so the bundler knows to erase them "@typescript-eslint/consistent-type-imports": "error", "react-hooks/rules-of-hooks": "error", - "@typescript-eslint/no-use-before-define": 0, - "@typescript-eslint/no-var-requires": 0, - "import/no-webpack-loader-syntax": 0, - "no-undef": 0, - "react/prop-types": 0, - "react/display-name": 0, - "@typescript-eslint/explicit-module-boundary-types": 0, - "cypress/no-unnecessary-waiting": 0, - "cypress/no-assigning-return-values": 0, "react/jsx-boolean-value": "error", "react/self-closing-comp": "error", "react/jsx-sort-props": "error", diff --git a/app/client/.flowconfig b/app/client/.flowconfig deleted file mode 100644 index 1fed445333..0000000000 --- a/app/client/.flowconfig +++ /dev/null @@ -1,11 +0,0 @@ -[ignore] - -[include] - -[libs] - -[lints] - -[options] - -[strict] diff --git a/app/client/.gitignore b/app/client/.gitignore index 3415ab513f..7a0d995bd8 100755 --- a/app/client/.gitignore +++ b/app/client/.gitignore @@ -50,3 +50,6 @@ TODO /nginx /public/static/wds/ + +storybook-static +stats.json diff --git a/app/client/.husky/pre-commit b/app/client/.husky/pre-commit new file mode 100755 index 0000000000..b764a12947 --- /dev/null +++ b/app/client/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged --cwd app/client && git-secrets --scan --untracked && git-secrets --scan -r diff --git a/app/client/.huskyrc b/app/client/.huskyrc deleted file mode 100644 index df699e5da5..0000000000 --- a/app/client/.huskyrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hooks": { - "pre-commit": "yarn precommit" - } -} \ No newline at end of file diff --git a/app/client/.lintstagedrc b/app/client/.lintstagedrc index 554f06b2b5..9c4c717e14 100644 --- a/app/client/.lintstagedrc +++ b/app/client/.lintstagedrc @@ -1,5 +1,8 @@ { - "src/**/*.tsx": ["npx eslint --fix", "npx prettier --write"], - "cypress/**/*.js": ["npx eslint --fix", "npx prettier --write"], - "src/**/*.ts": ["npx eslint --fix", "npx prettier --write"] + "src/**/*.{js,ts,tsx}": ["npx eslint --fix"], + "src/**/*.{js,ts,tsx,css,md,json}": ["npx prettier --write"], + "cypress/**/*.{js,ts}": ["npx eslint --fix"], + "cypress/**/*.{js,ts,json}": ["npx prettier --write"], + "packages/**/*.{js,ts,tsx}": ["npx eslint --fix"], + "packages/**/*.{js,ts,tsx,css,mdx,json}": ["npx prettier --write"] } diff --git a/app/client/cypress/.eslintrc.json b/app/client/cypress/.eslintrc.json index 7fbc8e862d..4a33f98695 100644 --- a/app/client/cypress/.eslintrc.json +++ b/app/client/cypress/.eslintrc.json @@ -4,6 +4,12 @@ "cypress/globals": true }, "rules": { - "cypress/no-unnecessary-waiting": 0 + "@typescript-eslint/no-array-constructor": "off", + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-unused-vars": "off", + "cypress/no-unnecessary-waiting": "off", + "no-console": "off", + "prefer-const": "off", + "@typescript-eslint/no-non-null-assertion": "error" } } diff --git a/app/client/cypress/integration/Regression_TestSuite/Application/CommunityIssues_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/Application/CommunityIssues_Spec.ts index 2c5d7f21fe..8add178358 100644 --- a/app/client/cypress/integration/Regression_TestSuite/Application/CommunityIssues_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/Application/CommunityIssues_Spec.ts @@ -205,7 +205,7 @@ describe("AForce - Community Issues page validations", function () { }); it("7. Validate Filter table", () => { - var filterTitle = new Array(); + let filterTitle = new Array(); deployMode.DeployApp(); table.WaitUntilTableLoad(); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts index 00adb1dcfc..d623be001c 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts @@ -37,7 +37,7 @@ describe("Validate basic binding of Input widget to Input widget", () => { }); it("3. Publish widget and validate the data displayed in input widgets", function () { - var currentTime = new Date(); + let currentTime = new Date(); deployMode.DeployApp(locator._widgetInputSelector("inputwidgetv2")); cy.get(locator._widgetInputSelector("inputwidgetv2")) .first() diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/CatchBlock_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/CatchBlock_Spec.ts index 654f006346..676aa2bd0e 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/CatchBlock_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/CatchBlock_Spec.ts @@ -3,8 +3,8 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; const { AggregateHelper: agHelper, ApiPage: apiPage, - JSEditor: jsEditor, EntityExplorer: ee, + JSEditor: jsEditor, } = ObjectsRegistry; describe("Bug #15372 Catch block was not triggering in Safari/firefox", () => { diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/Airtable_Basic_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/Airtable_Basic_Spec.ts index 4975ab5f6b..6387e91173 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/Airtable_Basic_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/Airtable_Basic_Spec.ts @@ -11,7 +11,7 @@ describe("Validate Airtable Ds", () => { }); it("1. Validate List Records", () => { - var specieslist = new Array(); + let specieslist = new Array(); _.dataSources.CreateQueryAfterDSSaved(); //List all records diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/GraphQL_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/GraphQL_spec.ts index 4b186951e9..0e4983549c 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/GraphQL_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/GraphQL_spec.ts @@ -1,10 +1,9 @@ import * as _ from "../../../../support/Objects/ObjectsCore"; -let appName: string = "", - datasourceName: string = "GraphQL_DS", - apiName: string = "GraphQL_API_"; -let tokenToAuthorizeGraphQl: string = "", - authoemail = ""; +let appName = ""; +let datasourceName = "GraphQL_DS"; +let tokenToAuthorizeGraphQl = ""; +let authoemail = ""; const GRAPHQL_QUERY = `query ($myid: Int!) { postById(id: $myid) { diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts index c2e5c2d912..2760caa648 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts @@ -399,11 +399,11 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => { } function generateStoresSecretInfo(rowIndex: number) { - let secretInfo: string = ""; + let secretInfo = ""; table .ReadTableRowColumnData(rowIndex, 3, "v1", 200) .then(($cellData: any) => { - var points = $cellData.match(/((.*))/).pop(); //(/(?<=\()).+?(?=\))/g) + let points = $cellData.match(/((.*))/).pop(); //(/(?<=\()).+?(?=\))/g) let secretCode: string[] = (points as string).split(","); secretCode[0] = secretCode[0].slice(0, 5); secretCode[1] = secretCode[1].slice(0, 5); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts index ac3b880e22..487fabda18 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts @@ -356,8 +356,6 @@ describe("Binary Datatype tests", function () { }); }); - it("9. Validate Drop of the Newly Created - binarytype - Table from Postgres datasource", () => {}); - after( "Validate Drop of the Newly Created - binarytype - Table & Verify Deletion of all created queries", () => { diff --git a/app/client/cypress/support/Pages/ApiPage.ts b/app/client/cypress/support/Pages/ApiPage.ts index 2b210f321b..ba724709b8 100644 --- a/app/client/cypress/support/Pages/ApiPage.ts +++ b/app/client/cypress/support/Pages/ApiPage.ts @@ -362,7 +362,7 @@ export class ApiPage { .invoke("text") .then((text) => { apiResp = `${text - .match(/"(.*)"/)![0] + .match(/"(.*)"/)?.[0] .split('"') .join("")} `; cy.log("Key value in api response is :" + apiResp); diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 07e514d598..7d7bd5d117 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -648,8 +648,8 @@ export class DataSources { } RunQuery({ - toValidateResponse = true, expectedStatus = true, + toValidateResponse = true, waitTimeInterval = 500, }: Partial = {}) { this.agHelper.GetNClick(this._runQueryBtn, 0, true, waitTimeInterval); diff --git a/app/client/cypress/support/Pages/DeployModeHelper.ts b/app/client/cypress/support/Pages/DeployModeHelper.ts index fb322ca330..2d1c27593f 100644 --- a/app/client/cypress/support/Pages/DeployModeHelper.ts +++ b/app/client/cypress/support/Pages/DeployModeHelper.ts @@ -5,7 +5,7 @@ export class DeployMode { private agHelper = ObjectsRegistry.AggregateHelper; _jsonFieldName = (fieldName: string) => `//p[text()='${fieldName}']`; - _jsonFormFieldByName = (fieldName: string, input: boolean = true) => + _jsonFormFieldByName = (fieldName: string, input = true) => this._jsonFieldName(fieldName) + `/ancestor::div[@direction='column']//div[@data-testid='input-container']//${ input ? "input" : "textarea" diff --git a/app/client/cypress/support/Pages/GitSync.ts b/app/client/cypress/support/Pages/GitSync.ts index 9c83749bda..7e57d209c1 100644 --- a/app/client/cypress/support/Pages/GitSync.ts +++ b/app/client/cypress/support/Pages/GitSync.ts @@ -166,7 +166,7 @@ export class GitSync { cy.wait(`@generateKey`).then((result: any) => { generatedKey = result.response.body.data.publicKey; generatedKey = generatedKey.slice(0, generatedKey.length - 1); - var formdata = new FormData(); + let formdata = new FormData(); cy.log("generatedKey is " + generatedKey); formdata.set("sshkey", generatedKey); // fetch the generated key and post to the github repo @@ -229,7 +229,7 @@ export class GitSync { } private CreateLocalGithubRepo(repo: string) { - let remoteUrl: string = ""; + let remoteUrl = ""; cy.request({ method: "GET", url: diff --git a/app/client/cypress/support/Pages/Table.ts b/app/client/cypress/support/Pages/Table.ts index 2fa1da1423..8be7593647 100644 --- a/app/client/cypress/support/Pages/Table.ts +++ b/app/client/cypress/support/Pages/Table.ts @@ -308,7 +308,7 @@ export class Table { cy.get(this._previousPage(tableVersion)).should("have.attr", "disabled"); } - public AssertSelectedRow(rowNum: number = 0) { + public AssertSelectedRow(rowNum = 0) { cy.xpath(this._tableSelectedRow) .invoke("attr", "data-rowindex") .then(($rowIndex) => { diff --git a/app/client/index.tsx b/app/client/index.tsx deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/client/package.json b/app/client/package.json index 7bf8fd2f43..faa0e34358 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -28,9 +28,12 @@ "preinstall": "CURRENT_SCOPE=client node ../shared/build-shared-dep.js", "install": "node cypress/apply-patches.js", "storybook": "yarn workspace @design-system/storybook storybook", - "lint:ci": "eslint --ext .ts,.tsx ./src && eslint --ext .js ./cypress", - "prettier:ci": "prettier --check ./src && prettier --check ./cypress", - "check-types": "yarn tsc --noEmit" + "lint:ci": "eslint --cache --ext .js,.ts,.tsx ./src && eslint --cache --ext .js,.ts ./cypress && yarn run lint:packages", + "lint:packages": "workspaces-foreach -pt yarn lint:ci", + "prettier:ci": "prettier --check ./src && prettier --check ./cypress && yarn run prettier:packages", + "prettier:packages": "workspaces-foreach -pt yarn prettier:ci", + "check-types": "yarn tsc --noEmit", + "prepare": "cd ../.. && husky install app/client/.husky" }, "dependencies": { "@blueprintjs/core": "^3.36.0", @@ -88,7 +91,6 @@ "graphql": "^16.3.0", "history": "^4.10.1", "http-proxy": "^1.18.1", - "husky": "^3.0.5", "immer": "^9.0.6", "instantsearch.css": "^7.4.2", "interweave": "^12.7.2", @@ -100,7 +102,6 @@ "klona": "^2.0.5", "libphonenumber-js": "^1.9.44", "linkedom": "^0.14.20", - "lint-staged": "^13.0.3", "localforage": "^1.7.3", "lodash": "^4.17.21", "lodash-es": "4.17.21", @@ -119,7 +120,6 @@ "papaparse": "^5.3.2", "path-to-regexp": "^6.2.0", "popper.js": "^1.15.0", - "prettier": "^2.8.4", "prismjs": "^1.27.0", "proxy-memoize": "^1.2.0", "punycode": "^2.1.1", @@ -194,7 +194,6 @@ "yjs": "^13.5.12", "zipcelx": "^1.6.2" }, - "browserslist": [ ">0.2%", "not dead", @@ -280,8 +279,10 @@ "eslint-plugin-react-hooks": "^2.3.0", "eslint-plugin-sort-destructure-keys": "^1.3.5", "factory.ts": "^0.5.1", + "husky": "^8.0.0", "jest-canvas-mock": "^2.3.1", "jest-styled-components": "^7.0.8", + "lint-staged": "^13.2.0", "mocha": "^9.0.2", "mocha-junit-reporter": "^2.0.0", "mochawesome": "^7.1.2", @@ -290,6 +291,7 @@ "patch-package": "^6.4.7", "plop": "^3.1.1", "postinstall-postinstall": "^2.1.0", + "prettier": "^2.8.6", "prop-types": "^15.8.1", "raw-loader": "^4.0.2", "react-is": "^16.12.0", @@ -302,12 +304,8 @@ "ts-jest-mock-import-meta": "^0.12.0", "ts-loader": "^9.4.1", "webpack-merge": "^5.8.0", - "workbox-webpack-plugin": "^6.5.3" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged && git-secrets --scan --untracked && git-secrets --scan -r" - } + "workbox-webpack-plugin": "^6.5.3", + "yarn-workspaces-foreach": "^0.2.0" }, "resolutions": { "browserslist": "4.20.3", diff --git a/app/client/packages/storybook/.eslintrc.json b/app/client/packages/storybook/.eslintrc.json deleted file mode 100644 index c6432606fc..0000000000 --- a/app/client/packages/storybook/.eslintrc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": [ - "../../.eslintrc.json", - "plugin:storybook/recommended" - ], - "overrides": [ - { - "files": [ - "**/*.stories.*" - ], - "rules": { - "import/no-anonymous-default-export": "off" - } - } - ] -} diff --git a/app/client/packages/storybook/.storybook/styles.css b/app/client/packages/storybook/.storybook/styles.css index 0407df39c4..a325f0fff3 100644 --- a/app/client/packages/storybook/.storybook/styles.css +++ b/app/client/packages/storybook/.storybook/styles.css @@ -1,6 +1,5 @@ @import url("../../wds/src/styles/tokens/raw.css"); @import url("../../wds/src/styles/tokens/semantic.css"); -@import url("../../wds/src/styles/globals.css"); html, body, diff --git a/app/client/packages/storybook/package.json b/app/client/packages/storybook/package.json index d0ae444d3a..fb1a71508e 100644 --- a/app/client/packages/storybook/package.json +++ b/app/client/packages/storybook/package.json @@ -4,6 +4,12 @@ "main": "src/index.ts", "author": "Valera Melnikov , Pawan Kumar ", "license": "MIT", + "scripts": { + "storybook": "start-storybook -p 6006", + "build": "build-storybook", + "lint:ci": "echo 'No lint specified'", + "prettier:ci": "echo 'No prettier specified'" + }, "devDependencies": { "@babel/core": "^7.20.12", "@storybook/addon-actions": "^6.5.16", @@ -24,7 +30,6 @@ "@types/react-dom": "^17.0.2", "autoprefixer": "^9.0.0", "babel-loader": "^8.3.0", - "eslint-plugin-storybook": "^0.6.10", "postcss": "^8", "re-resizable": "^6.9.9", "storybook-addon-pseudo-states": "^1.15.2", @@ -38,9 +43,5 @@ "colorjs.io": "^0.4.3", "react": "^17.0.2", "react-dom": "^17.0.2" - }, - "scripts": { - "storybook": "start-storybook -p 6006", - "build": "build-storybook" } } diff --git a/app/client/packages/wds/.eslintrc.json b/app/client/packages/wds/.eslintrc.json new file mode 100644 index 0000000000..a618049b54 --- /dev/null +++ b/app/client/packages/wds/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "extends": ["../../.eslintrc.json", "plugin:storybook/recommended"], + "overrides": [ + { + "files": ["**/*.stories.*"], + "rules": { + "import/no-anonymous-default-export": "off" + } + } + ] +} diff --git a/app/client/packages/wds/.prettierignore b/app/client/packages/wds/.prettierignore new file mode 100644 index 0000000000..6ba1458f00 --- /dev/null +++ b/app/client/packages/wds/.prettierignore @@ -0,0 +1 @@ +src/tokens.json diff --git a/app/client/packages/wds/package.json b/app/client/packages/wds/package.json index 411bf2fc27..44246ba056 100644 --- a/app/client/packages/wds/package.json +++ b/app/client/packages/wds/package.json @@ -4,9 +4,17 @@ "main": "src/index.ts", "author": "Valera Melnikov , Pawan Kumar ", "license": "MIT", + "scripts": { + "build:tokens": "npx ts-node ./src/utils/buildTokens.ts", + "lint:ci": "eslint --cache .", + "prettier:ci": "prettier --check ." + }, "devDependencies": { "@types/react": "^17.0.2", - "@types/react-dom": "^17.0.2" + "@types/react-dom": "^17.0.2", + "eslint": "*", + "eslint-plugin-storybook": "^0.6.10", + "prettier": "*" }, "dependencies": { "@capsizecss/core": "^3.1.0", @@ -14,8 +22,5 @@ "colorjs.io": "^0.4.3", "react": "^17.0.2", "react-dom": "^17.0.2" - }, - "scripts": { - "build:tokens": "npx ts-node ./src/utils/buildTokens.ts" } } diff --git a/app/client/packages/wds/src/components/Button/Button.stories.mdx b/app/client/packages/wds/src/components/Button/Button.stories.mdx index aa0b354858..4258f42384 100644 --- a/app/client/packages/wds/src/components/Button/Button.stories.mdx +++ b/app/client/packages/wds/src/components/Button/Button.stories.mdx @@ -1,39 +1,44 @@ -import { Canvas, Meta, Story } from '@storybook/addon-docs'; +import { Canvas, Meta, Story } from "@storybook/addon-docs"; -import { Button } from './'; +import { Button } from "./"; - + summary: "The label contents", + detail: "Text displayed by the Badge", + }, + }, + }, + }} +/> -export const Template = (args, { globals: { fontFamily } }) =>