From fa24ed0f1507d09f0634542c27ab1fdf4f024fc2 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Thu, 14 Jul 2022 15:58:22 +0300 Subject: [PATCH 01/49] add eslint for typescript following airbnb style guide, react app, react-hooks and react-typescript --- .editorconfig | 12 ++ package.json | 32 +++--- src-ts/.eslintrc.js | 52 +++++++++ src/.eslintrc.js | 28 +++++ yarn.lock | 269 +++++++++++++++++++++++++++++++++++--------- 5 files changed, 324 insertions(+), 69 deletions(-) create mode 100755 .editorconfig create mode 100644 src-ts/.eslintrc.js create mode 100644 src/.eslintrc.js diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 000000000..c1e2c6435 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/package.json b/package.json index b2b32be44..635076439 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,12 @@ "start": "sh start-ssl.sh", "start:bsouza": "sh start-ssl-bsouza.sh", "build": "yarn react-app-rewired build", - "lint": "tslint 'src-ts/**/*.{ts,tsx}'", - "lint:fix": "tslint 'src-ts/**/*.{ts,tsx}' --fix", - "eslint": "eslint 'src/**/*.{js,jsx}'", - "eslint:fix": "eslint 'src/**/*.{js,jsx}' --fix", + "lint:ts": "eslint -c ./src-ts/.eslintrc.js 'src-ts/**/*.{ts,tsx}'", + "lint:ts:fix": "eslint -c ./src-ts/.eslintrc.js 'src-ts/**/*.{ts,tsx}' --fix", + "lint:js": "eslint -c ./src/.eslintrc.js 'src/**/*.{js,jsx}'", + "lint:js:fix": "eslint -c ./src/.eslintrc.js 'src/**/*.{js,jsx}' --fix", + "lint": "npm run lint:js && npm run lint:ts", + "lint:fix": "npm run lint:js:fix && npm run lint:ts:fix", "test": "react-scripts test --watchAll", "test:no-watch": "react-scripts test --watchAll=false --passWithNoTests" }, @@ -77,6 +79,8 @@ "@types/react-redux-toastr": "^7.6.2", "@types/react-router-dom": "^5.3.3", "@types/systemjs": "^6.1.0", + "@typescript-eslint/eslint-plugin": "^5.30.6", + "@typescript-eslint/parser": "^5.30.6", "autoprefixer": "^9.8.6", "babel-eslint": "^11.0.0-beta.2", "babel-jest": "^24.9.0", @@ -86,11 +90,14 @@ "concurrently": "^5.0.1", "config": "^3.3.6", "cross-env": "^7.0.2", - "eslint": "^8.18.0", - "eslint-config-prettier": "^6.7.0", + "eslint": "^7.32.0 || ^8.2.0", + "eslint-config-airbnb": "^19.0.4", "eslint-config-react-app": "^7.0.1", - "eslint-config-react-important-stuff": "^2.0.0", - "eslint-plugin-prettier": "^3.1.1", + "eslint-import-resolver-typescript": "^3.2.5", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-jsx-a11y": "^6.5.1", + "eslint-plugin-react": "^7.28.0", + "eslint-plugin-react-hooks": "^4.3.0", "file-loader": "^6.2.0", "husky": "^8.0.0", "identity-obj-proxy": "^3.0.0", @@ -111,15 +118,6 @@ "webpack-dev-server": "^3.9.0", "webpack-merge": "^4.2.2" }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ], - "rules": { - "no-useless-escape": 0 - } - }, "browserslist": { "production": [ ">0.2%", diff --git a/src-ts/.eslintrc.js b/src-ts/.eslintrc.js new file mode 100644 index 000000000..4c86aee3f --- /dev/null +++ b/src-ts/.eslintrc.js @@ -0,0 +1,52 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + }, + extends: [ + 'plugin:react/recommended', + 'airbnb', + "plugin:@typescript-eslint/recommended" + ], + parser: '@typescript-eslint/parser', + parserOptions: { + useJSXTextNode: true, + project: "./tsconfig.json", + tsconfigRootDir: ".", + tsx: true, + jsx: true, + sourceType: 'module', + }, + plugins: [ + 'react', + '@typescript-eslint', + 'react-hooks', + ], + settings: { + react: { + "version": "detect" + }, + "import/resolver": { + typescript: {}, + } + }, + rules: { + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-shadow": "error", + "import/extensions": "off", + "import/prefer-default-export": "off", + "indent": [2, 4], + "no-shadow": "off", + "react-hooks/exhaustive-deps": "warn", + "react-hooks/rules-of-hooks": "error", + "react/function-component-definition": [2, { "namedComponents": "arrow-function" }], + "react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }], + "react/jsx-indent-props": [2, 4], + "react/jsx-indent": [2, 4], + "react/jsx-props-no-spreading": [2, {html: "ignore"}], + "react/react-in-jsx-scope": "off", + "react/require-default-props": "off", + "semi": ["error", "never"], + }, +}; diff --git a/src/.eslintrc.js b/src/.eslintrc.js new file mode 100644 index 000000000..17600eab6 --- /dev/null +++ b/src/.eslintrc.js @@ -0,0 +1,28 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + jest: true, + }, + extends: [ + 'react-app', + 'react-app/jest', + ], + parserOptions: { + useJSXTextNode: true, + jsx: true, + sourceType: 'module', + }, + plugins: [ + 'react', + ], + settings: { + react: { + version: 'detect', + }, + }, + rules: { + 'no-useless-escape': 0, + }, +} diff --git a/yarn.lock b/yarn.lock index 09fd764a3..26ad4329c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1864,6 +1864,18 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@pkgr/utils@^2.2.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.3.0.tgz#3b8491f112a80839450498816767eb03b7db6139" + integrity sha512-7dIJ9CRVzBnqyEl7diUHPUFJf/oty2SeoVzcMocc5PeOUDK9KGzvgIBjGRRzzlRDaOjh3ADwH0WeibQvi3ls2Q== + dependencies: + cross-spawn "^7.0.3" + is-glob "^4.0.3" + open "^8.4.0" + picocolors "^1.0.0" + tiny-glob "^0.2.9" + tslib "^2.4.0" + "@pmmmwh/react-refresh-webpack-plugin@^0.5.3": version "0.5.7" resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.7.tgz#58f8217ba70069cc6a73f5d7e05e85b458c150e2" @@ -2633,6 +2645,21 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.6.tgz#9c6017b6c1d04894141b4a87816388967f64c359" + integrity sha512-J4zYMIhgrx4MgnZrSDD7sEnQp7FmhKNOaqaOpaoQ/SfdMfRB/0yvK74hTnvH+VQxndZynqs5/Hn4t+2/j9bADg== + dependencies: + "@typescript-eslint/scope-manager" "5.30.6" + "@typescript-eslint/type-utils" "5.30.6" + "@typescript-eslint/utils" "5.30.6" + debug "^4.3.4" + functional-red-black-tree "^1.0.1" + ignore "^5.2.0" + regexpp "^3.2.0" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/eslint-plugin@^5.5.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.29.0.tgz#c67794d2b0fd0b4a47f50266088acdc52a08aab6" @@ -2655,6 +2682,16 @@ dependencies: "@typescript-eslint/utils" "5.29.0" +"@typescript-eslint/parser@^5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.30.6.tgz#add440db038fa9d777e4ebdaf66da9e7fb7abe92" + integrity sha512-gfF9lZjT0p2ZSdxO70Xbw8w9sPPJGfAdjK7WikEjB3fcUI/yr9maUVEdqigBjKincUYNKOmf7QBMiTf719kbrA== + dependencies: + "@typescript-eslint/scope-manager" "5.30.6" + "@typescript-eslint/types" "5.30.6" + "@typescript-eslint/typescript-estree" "5.30.6" + debug "^4.3.4" + "@typescript-eslint/parser@^5.5.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.29.0.tgz#41314b195b34d44ff38220caa55f3f93cfca43cf" @@ -2673,6 +2710,14 @@ "@typescript-eslint/types" "5.29.0" "@typescript-eslint/visitor-keys" "5.29.0" +"@typescript-eslint/scope-manager@5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.30.6.tgz#ce1b49ff5ce47f55518d63dbe8fc9181ddbd1a33" + integrity sha512-Hkq5PhLgtVoW1obkqYH0i4iELctEKixkhWLPTYs55doGUKCASvkjOXOd/pisVeLdO24ZX9D6yymJ/twqpJiG3g== + dependencies: + "@typescript-eslint/types" "5.30.6" + "@typescript-eslint/visitor-keys" "5.30.6" + "@typescript-eslint/type-utils@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.29.0.tgz#241918001d164044020b37d26d5b9f4e37cc3d5d" @@ -2682,11 +2727,25 @@ debug "^4.3.4" tsutils "^3.21.0" +"@typescript-eslint/type-utils@5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.30.6.tgz#a64aa9acbe609ab77f09f53434a6af2b9685f3af" + integrity sha512-GFVVzs2j0QPpM+NTDMXtNmJKlF842lkZKDSanIxf+ArJsGeZUIaeT4jGg+gAgHt7AcQSFwW7htzF/rbAh2jaVA== + dependencies: + "@typescript-eslint/utils" "5.30.6" + debug "^4.3.4" + tsutils "^3.21.0" + "@typescript-eslint/types@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.29.0.tgz#7861d3d288c031703b2d97bc113696b4d8c19aab" integrity sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg== +"@typescript-eslint/types@5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.30.6.tgz#86369d0a7af8c67024115ac1da3e8fb2d38907e1" + integrity sha512-HdnP8HioL1F7CwVmT4RaaMX57RrfqsOMclZc08wGMiDYJBsLGBM7JwXM4cZJmbWLzIR/pXg1kkrBBVpxTOwfUg== + "@typescript-eslint/typescript-estree@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz#e83d19aa7fd2e74616aab2f25dfbe4de4f0b5577" @@ -2700,6 +2759,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.6.tgz#a84a0d6a486f9b54042da1de3d671a2c9f14484e" + integrity sha512-Z7TgPoeYUm06smfEfYF0RBkpF8csMyVnqQbLYiGgmUSTaSXTP57bt8f0UFXstbGxKIreTwQCujtaH0LY9w9B+A== + dependencies: + "@typescript-eslint/types" "5.30.6" + "@typescript-eslint/visitor-keys" "5.30.6" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/utils@5.29.0", "@typescript-eslint/utils@^5.13.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.29.0.tgz#775046effd5019667bd086bcf326acbe32cd0082" @@ -2712,6 +2784,18 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" +"@typescript-eslint/utils@5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.30.6.tgz#1de2da14f678e7d187daa6f2e4cdb558ed0609dc" + integrity sha512-xFBLc/esUbLOJLk9jKv0E9gD/OH966M40aY9jJ8GiqpSkP2xOV908cokJqqhVd85WoIvHVHYXxSFE4cCSDzVvA== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.30.6" + "@typescript-eslint/types" "5.30.6" + "@typescript-eslint/typescript-estree" "5.30.6" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + "@typescript-eslint/visitor-keys@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz#7a4749fa7ef5160c44a451bf060ac1dc6dfb77ee" @@ -2720,6 +2804,14 @@ "@typescript-eslint/types" "5.29.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.30.6": + version "5.30.6" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.6.tgz#94dd10bb481c8083378d24de1742a14b38a2678c" + integrity sha512-41OiCjdL2mCaSDi2SvYbzFLlqqlm5v1ZW9Ym55wXKL/Rx6OOB1IbuFGo71Fj6Xy90gJDFTlgOS+vbmtGHPTQQA== + dependencies: + "@typescript-eslint/types" "5.30.6" + eslint-visitor-keys "^3.3.0" + "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" @@ -4709,7 +4801,7 @@ config@^3.3.6: dependencies: json5 "^2.1.1" -confusing-browser-globals@^1.0.11: +confusing-browser-globals@^1.0.10, confusing-browser-globals@^1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz#ae40e9b57cdd3915408a2805ebd3a5585608dc81" integrity sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA== @@ -5769,6 +5861,14 @@ enhanced-resolve@^4.1.1, enhanced-resolve@^4.5.0: memory-fs "^0.5.0" tapable "^1.0.0" +enhanced-resolve@^5.10.0: + version "5.10.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz#0dc579c3bb2a1032e357ac45b8f3a6f3ad4fb1e6" + integrity sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + enhanced-resolve@^5.9.3: version "5.9.3" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.3.tgz#44a342c012cbc473254af5cc6ae20ebd0aae5d88" @@ -5933,17 +6033,24 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-important-stuff@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-important-stuff/-/eslint-config-important-stuff-1.1.0.tgz#f7ed8c33216964faf680f8969dfe0b196c84e6e2" - integrity sha512-CsV6QFsjNDTZTDEgE1XxhTKph4YJUh5XFMdsWv3p+9DuMyvfy40fsnZiwqXZHBVEUNMHf+zfPGk6s6b4fS9Erw== +eslint-config-airbnb-base@^15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz#6b09add90ac79c2f8d723a2580e07f3925afd236" + integrity sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig== + dependencies: + confusing-browser-globals "^1.0.10" + object.assign "^4.1.2" + object.entries "^1.1.5" + semver "^6.3.0" -eslint-config-prettier@^6.7.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" - integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== +eslint-config-airbnb@^19.0.4: + version "19.0.4" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-19.0.4.tgz#84d4c3490ad70a0ffa571138ebcdea6ab085fdc3" + integrity sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew== dependencies: - get-stdin "^6.0.0" + eslint-config-airbnb-base "^15.0.0" + object.assign "^4.1.2" + object.entries "^1.1.5" eslint-config-react-app@^7.0.0, eslint-config-react-app@^7.0.1: version "7.0.1" @@ -5965,15 +6072,6 @@ eslint-config-react-app@^7.0.0, eslint-config-react-app@^7.0.1: eslint-plugin-react-hooks "^4.3.0" eslint-plugin-testing-library "^5.0.1" -eslint-config-react-important-stuff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-react-important-stuff/-/eslint-config-react-important-stuff-2.0.0.tgz#7eb96fdbbc7739113eec6565a0316091cc4cd99b" - integrity sha512-xXQYqzt0W2mDdsLW049ekn9OkHvQsutRFC/H9g7mOcK8MF+BNWUIanfkGcUD1wSBbXBiczgEs7zV/JzxzRM1UA== - dependencies: - eslint-config-important-stuff "^1.1.0" - eslint-plugin-jsx-a11y "^6.2.3" - eslint-plugin-react-hooks "^2.2.0" - eslint-import-resolver-node@^0.3.6: version "0.3.6" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" @@ -5982,6 +6080,19 @@ eslint-import-resolver-node@^0.3.6: debug "^3.2.7" resolve "^1.20.0" +eslint-import-resolver-typescript@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.2.5.tgz#cec82e42d93f61a039672e2ba7dc3e3663c86219" + integrity sha512-yEBi/EWxFFMjcZTBxrgdu5cFAXB2atOhYDhp0P0yHqjZa5YiPNqQVt4/lNNVWwW7Kf8IIZmyeBboWOgsfffe7w== + dependencies: + debug "^4.3.4" + enhanced-resolve "^5.10.0" + get-tsconfig "npm:@unts/get-tsconfig@^4.1.1" + globby "^13.1.2" + is-core-module "^2.9.0" + is-glob "^4.0.3" + synckit "^0.7.2" + eslint-module-utils@^2.7.3: version "2.7.3" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz#ad7e3a10552fdd0642e1e55292781bd6e34876ee" @@ -6024,7 +6135,7 @@ eslint-plugin-jest@^25.3.0: dependencies: "@typescript-eslint/experimental-utils" "^5.0.0" -eslint-plugin-jsx-a11y@^6.2.3, eslint-plugin-jsx-a11y@^6.5.1: +eslint-plugin-jsx-a11y@^6.5.1: version "6.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.6.0.tgz#2c5ac12e013eb98337b9aa261c3b355275cc6415" integrity sha512-kTeLuIzpNhXL2CwLlc8AHI0aFRwWHcg483yepO9VQiHzM9bZwJdzTkzBszbuPrbgGmq2rlX/FaT2fJQsjUSHsw== @@ -6043,24 +6154,12 @@ eslint-plugin-jsx-a11y@^6.2.3, eslint-plugin-jsx-a11y@^6.5.1: minimatch "^3.1.2" semver "^6.3.0" -eslint-plugin-prettier@^3.1.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz#e9ddb200efb6f3d05ffe83b1665a716af4a387e5" - integrity sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g== - dependencies: - prettier-linter-helpers "^1.0.0" - -eslint-plugin-react-hooks@^2.2.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.1.tgz#4ef5930592588ce171abeb26f400c7fbcbc23cd0" - integrity sha512-Y2c4b55R+6ZzwtTppKwSmK/Kar8AdLiC2f9NADCuxbcTgPPg41Gyqa6b9GppgXSvCtkRw43ZE86CT5sejKC6/g== - eslint-plugin-react-hooks@^4.3.0: version "4.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== -eslint-plugin-react@^7.27.1: +eslint-plugin-react@^7.27.1, eslint-plugin-react@^7.28.0: version "7.30.1" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.30.1.tgz#2be4ab23ce09b5949c6631413ba64b2810fd3e22" integrity sha512-NbEvI9jtqO46yJA3wcRF9Mo0lF9T/jhdHqhCHXiXtD+Zcb98812wvokjWpU7Q4QH5edo6dmqrukxVvWWXHlsUg== @@ -6152,7 +6251,48 @@ eslint-webpack-plugin@^3.1.1: normalize-path "^3.0.0" schema-utils "^4.0.0" -eslint@^8.18.0, eslint@^8.3.0: +"eslint@^7.32.0 || ^8.2.0": + version "8.19.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.19.0.tgz#7342a3cbc4fbc5c106a1eefe0fd0b50b6b1a7d28" + integrity sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw== + dependencies: + "@eslint/eslintrc" "^1.3.0" + "@humanwhocodes/config-array" "^0.9.2" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.3.2" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^6.0.1" + globals "^13.15.0" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + regexpp "^3.2.0" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +eslint@^8.3.0: version "8.18.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.18.0.tgz#78d565d16c993d0b73968c523c0446b13da784fd" integrity sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA== @@ -6498,11 +6638,6 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-diff@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" - integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== - fast-glob@^3.2.11, fast-glob@^3.2.9: version "3.2.11" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" @@ -6925,11 +7060,6 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== - get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -6957,6 +7087,11 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" +"get-tsconfig@npm:@unts/get-tsconfig@^4.1.1": + version "4.1.1" + resolved "https://registry.yarnpkg.com/@unts/get-tsconfig/-/get-tsconfig-4.1.1.tgz#f2d308a0c9e56a73b815b0525d4bf37a28914cdd" + integrity sha512-8mPf1bBzF2S+fyuyYOQWjDcaJTTgJ14UAnXW9I3KwrqioRWG1byRXHwciYdqXpbdOiu7Fg4WJbymBIakGk+aMA== + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -7064,6 +7199,11 @@ globals@^13.15.0: dependencies: type-fest "^0.20.2" +globalyzer@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.0.tgz#cb76da79555669a1519d5a8edf093afaa0bf1465" + integrity sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q== + globby@^11.0.4, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" @@ -7076,6 +7216,17 @@ globby@^11.0.4, globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" +globby@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-13.1.2.tgz#29047105582427ab6eca4f905200667b056da515" + integrity sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ== + dependencies: + dir-glob "^3.0.1" + fast-glob "^3.2.11" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^4.0.0" + globby@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" @@ -7087,6 +7238,11 @@ globby@^6.1.0: pify "^2.0.0" pinkie-promise "^2.0.0" +globrex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" @@ -11422,13 +11578,6 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== -prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== - dependencies: - fast-diff "^1.1.2" - prettier@^2.0.4: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" @@ -13590,6 +13739,14 @@ symbol-tree@^3.2.2, symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== +synckit@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.7.2.tgz#43c07b5a8101ee45355aebf0216895309fd32a6f" + integrity sha512-CSZRtSRZ8RhJGMtWyLRqlarmWPPlsgZJHtV6cz0VTHNOg+R7UBoE2eNPQmB5Qrhtk3RX2AAcJmVwMXFULVQSwg== + dependencies: + "@pkgr/utils" "^2.2.0" + tslib "^2.4.0" + systemjs-webpack-interop@^2.1.2, systemjs-webpack-interop@^2.3.1: version "2.3.7" resolved "https://registry.yarnpkg.com/systemjs-webpack-interop/-/systemjs-webpack-interop-2.3.7.tgz#b8ed2a81c371bab3160ac4801776ef61cf8c7959" @@ -13773,6 +13930,14 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +tiny-glob@^0.2.9: + version "0.2.9" + resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2" + integrity sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg== + dependencies: + globalyzer "0.1.0" + globrex "^0.1.2" + tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -13890,7 +14055,7 @@ tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.3, tslib@^2.1.0: +tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== From 0051c6750e1499f1768805d94a5753e532947362 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Thu, 14 Jul 2022 18:35:25 +0300 Subject: [PATCH 02/49] add prettier --- package.json | 6 +++++- src-ts/.eslintrc.js | 36 +++++++++++++++++++----------------- src-ts/.prettierrc.js | 9 +++++++++ yarn.lock | 7 ++++++- 4 files changed, 39 insertions(+), 19 deletions(-) create mode 100755 src-ts/.prettierrc.js diff --git a/package.json b/package.json index 635076439..08f0e77f2 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,9 @@ "lint:js:fix": "eslint -c ./src/.eslintrc.js 'src/**/*.{js,jsx}' --fix", "lint": "npm run lint:js && npm run lint:ts", "lint:fix": "npm run lint:js:fix && npm run lint:ts:fix", + "prettier": "prettier ./src-ts/**/*.{ts,tsx} --check", + "prettier:fix": "prettier ./src-ts/**/*.{ts,tsx} --write", + "format:all": "npm run prettier:fix && npm run lint:fix", "test": "react-scripts test --watchAll", "test:no-watch": "react-scripts test --watchAll=false --passWithNoTests" }, @@ -92,6 +95,7 @@ "cross-env": "^7.0.2", "eslint": "^7.32.0 || ^8.2.0", "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "^8.5.0", "eslint-config-react-app": "^7.0.1", "eslint-import-resolver-typescript": "^3.2.5", "eslint-plugin-import": "^2.25.3", @@ -106,7 +110,7 @@ "lint-staged": "^13.0.3", "postcss-loader": "^4.0.4", "postcss-scss": "^3.0.2", - "prettier": "^2.0.4", + "prettier": "^2.7.1", "pretty-quick": "^2.0.1", "resolve-url-loader": "^3.1.2", "sass-loader": "^10.0.5", diff --git a/src-ts/.eslintrc.js b/src-ts/.eslintrc.js index 4c86aee3f..bd77224cb 100644 --- a/src-ts/.eslintrc.js +++ b/src-ts/.eslintrc.js @@ -7,7 +7,8 @@ module.exports = { extends: [ 'plugin:react/recommended', 'airbnb', - "plugin:@typescript-eslint/recommended" + 'plugin:@typescript-eslint/recommended', + 'prettier' ], parser: '@typescript-eslint/parser', parserOptions: { @@ -32,21 +33,22 @@ module.exports = { } }, rules: { - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-shadow": "error", - "import/extensions": "off", - "import/prefer-default-export": "off", - "indent": [2, 4], - "no-shadow": "off", - "react-hooks/exhaustive-deps": "warn", - "react-hooks/rules-of-hooks": "error", - "react/function-component-definition": [2, { "namedComponents": "arrow-function" }], - "react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }], - "react/jsx-indent-props": [2, 4], - "react/jsx-indent": [2, 4], - "react/jsx-props-no-spreading": [2, {html: "ignore"}], - "react/react-in-jsx-scope": "off", - "react/require-default-props": "off", - "semi": ["error", "never"], + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-shadow': 'error', + 'import/extensions': 'off', + 'import/prefer-default-export': 'off', + 'indent': [2, 4, {SwitchCase: 1}], + 'no-shadow': 'off', + 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/rules-of-hooks': 'error', + 'react/function-component-definition': [2, { 'namedComponents': 'arrow-function' }], + 'react/jsx-filename-extension': [1, { 'extensions': ['.tsx', '.jsx'] }], + 'react/jsx-indent-props': [2, 4], + 'react/jsx-indent': [2, 4], + 'react/jsx-props-no-spreading': [2, {html: 'ignore'}], + 'react/react-in-jsx-scope': 'off', + 'react/require-default-props': 'off', + 'semi': ['error', 'never'], + 'no-use-before-define': ['error', { 'functions': false }], }, }; diff --git a/src-ts/.prettierrc.js b/src-ts/.prettierrc.js new file mode 100755 index 000000000..41ad4bd7c --- /dev/null +++ b/src-ts/.prettierrc.js @@ -0,0 +1,9 @@ +module.exports = { + arrowParens: 'avoid', + bracketSpacing: true, + jsxSingleQuote: true, + printWidth: 100, + semi: false, + singleQuote: true, + trailingComma: 'all', +} diff --git a/yarn.lock b/yarn.lock index 26ad4329c..e70074fd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6052,6 +6052,11 @@ eslint-config-airbnb@^19.0.4: object.assign "^4.1.2" object.entries "^1.1.5" +eslint-config-prettier@^8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" + integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== + eslint-config-react-app@^7.0.0, eslint-config-react-app@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz#73ba3929978001c5c86274c017ea57eb5fa644b4" @@ -11578,7 +11583,7 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== -prettier@^2.0.4: +prettier@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== From db57744649db2641ba9ba3a3c37c64c94af67053 Mon Sep 17 00:00:00 2001 From: Anwar Sadath Date: Thu, 3 Nov 2022 19:27:27 +0530 Subject: [PATCH 03/49] PROD-3109 #comment Fix text in the 'What will I receive?' section does not match the provided text --- .../work-functions/work-store/work-type.config.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src-ts/tools/work/work-lib/work-provider/work-functions/work-store/work-type.config.ts b/src-ts/tools/work/work-lib/work-provider/work-functions/work-store/work-type.config.ts index 2e4fdb495..6cefd83d8 100644 --- a/src-ts/tools/work/work-lib/work-provider/work-functions/work-store/work-type.config.ts +++ b/src-ts/tools/work/work-lib/work-provider/work-functions/work-store/work-type.config.ts @@ -12,9 +12,7 @@ export const WorkTypeConfigs: { [workType: string]: WorkTypeConfig } = { [WorkType.bugHunt]: { about: `Expert QA testers will verify that all of the pages on your website are working correctly from the end-user perspective. The testing will stress functional issues, but also includes security issues, user interface issues, usability issues and more. Test on desktop, tablet, and mobile, to uncover bugs before your customers encounter them.`, bgImage: bugHuntTileImg, - deliverablesDescription: `You will receive thorough testing of your website, and at the conclusion will be provided - a detailed report of bugs which have steps to reproduce, screenshots / videos if applicable, - details of the bug, and severity of the issue.`, + deliverablesDescription: 'You will receive thorough testing of your website by QA experts, and an actionable report extremely quickly. Our experts will deliver a detailed list of bugs found, with steps to reproduce, including screenshots, videos, and the information you need to fix them.', description: 'Execute thorough bug hunts exceptionally fast. Receive a detailed list of bugs and instructions on exactly how to fix them.', duration: { 'advanced': 6, From acdfc586e4a15fdb82c6f2fdd602a74c65339d03 Mon Sep 17 00:00:00 2001 From: Brooke Date: Mon, 7 Nov 2022 13:35:45 -0800 Subject: [PATCH 04/49] TCA-561 #comment This commit updates the eslint rules to match our style #time 3.5h --- src-ts/.eslintrc.js | 60 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/src-ts/.eslintrc.js b/src-ts/.eslintrc.js index 3a19baa9d..9315f381b 100644 --- a/src-ts/.eslintrc.js +++ b/src-ts/.eslintrc.js @@ -33,9 +33,28 @@ module.exports = { } }, rules: { + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true, + "types": { + "{}": false + } + } + ], '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-inferrable-types': 'off', '@typescript-eslint/no-shadow': 'error', + '@typescript-eslint/strict-boolean-expressions': [ + 'error', + { + allowNullableBoolean: true, + allowNullableObject: true, + allowNullableNumber: true, + allowNullableString: true + } + ], 'import/extensions': 'off', 'import/prefer-default-export': 'off', 'indent': [ @@ -45,17 +64,46 @@ module.exports = { SwitchCase: 1, }, ], + 'jsx-a11y/tabindex-no-positive': [ + 'warn' + ], + 'no-extra-boolean-cast': "off", + 'no-plusplus': [ + 'error', + { + allowForLoopAfterthoughts: true + } + ], + 'no-restricted-syntax': [ + 'error', + 'ForIfStatement', + 'LabeledStatement', + 'WithStatement' + ], 'no-shadow': 'off', 'no-use-before-define': [ 'error', - { functions: false } + { + functions: false, + } ], - 'padded-blocks': [ + "padding-line-between-statements": [ 'error', - { } + { blankLine: 'always', prev: 'directive', next: '*' }, + { blankLine: 'any', prev: 'directive', next: 'directive' }, + { blankLine: 'always', prev: 'cjs-import', next: '*' }, + { blankLine: 'any', prev: 'cjs-import', next: 'cjs-import' }, + { blankLine: 'always', prev: 'cjs-export', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + { blankLine: 'always', prev: 'class', next: '*' } ], + 'prefer-destructuring': 'off', 'react-hooks/exhaustive-deps': 'warn', 'react-hooks/rules-of-hooks': 'error', + 'react/destructuring-assignment': [ + 2, + 'never' + ], 'react/function-component-definition': [ 2, { @@ -79,9 +127,11 @@ module.exports = { 2, 4, ], + 'react/jsx-no-useless-fragment': [ + 0 + ], 'react/jsx-props-no-spreading': [ - 2, - { html: 'ignore' }, + 0 ], 'react/react-in-jsx-scope': 'off', 'react/require-default-props': 'off', From 5d9d5a8db7f895a23f66e07918bca37d5d0bb3bc Mon Sep 17 00:00:00 2001 From: Brooke Date: Mon, 7 Nov 2022 13:42:50 -0800 Subject: [PATCH 05/49] TCA-645 #comment This commit fixes all eslint issues that are auto-fixable #time 10m --- src-ts/header/Header.tsx | 24 +- .../header/tool-selectors/ToolSelectors.tsx | 4 +- .../tool-selector-wide/ToolSelectorWide.tsx | 2 +- .../utility-selectors/UtilitySelectors.tsx | 14 +- src-ts/index.ts | 32 +- src-ts/lib/analytics/Analytics.tsx | 15 +- .../breadcrumb-item/BreadcrumbItem.tsx | 18 +- .../ContactSupportForm.tsx | 8 +- src-ts/lib/content-layout/ContentLayout.tsx | 50 ++- src-ts/lib/form/Form.tsx | 58 ++-- .../lib/form/form-functions/form.functions.ts | 6 +- src-ts/lib/form/form-groups/FormGroups.tsx | 20 +- .../form-groups/form-card-set/FormCardSet.tsx | 30 +- .../form-group-item/FormGroupItem.tsx | 82 +++-- .../form-input-row/FormInputRow.tsx | 2 +- .../input-file-picker/InputFilePicker.tsx | 2 +- .../input-image-picker/InputImagePicker.tsx | 7 +- .../form-input/input-rating/InputRating.tsx | 4 +- .../form-input/input-select/InputSelect.tsx | 2 +- .../input-textarea/InputTextarea.tsx | 46 ++- .../lib/form/form-groups/form-radio/index.tsx | 10 +- src-ts/lib/form/validator-functions/index.ts | 2 +- .../validator.functions.ts | 4 +- .../authentication-url.config.ts | 2 +- .../file-functions/file.functions.ts | 1 + src-ts/lib/hooks/use-on-hover-element.hook.ts | 1 + src-ts/lib/hooks/use-window-size.hook.ts | 36 +-- src-ts/lib/info-card/InfoCard.tsx | 2 +- src-ts/lib/loading-spinner/LoadingSpinner.tsx | 2 +- src-ts/lib/modals/base-modal/BaseModal.tsx | 37 ++- src-ts/lib/modals/confirm/ConfirmModal.tsx | 50 ++- src-ts/lib/page-divider/PageDivider.tsx | 2 +- src-ts/lib/payment-form/PaymentForm.tsx | 24 +- src-ts/lib/payment-form/constants/index.tsx | 4 +- src-ts/lib/portal/Portal.tsx | 2 + src-ts/lib/progress-bar/ProgressBar.tsx | 4 +- src-ts/lib/radio-button/RadioButton.tsx | 20 +- src-ts/lib/react-select/ReactSelect.tsx | 154 +++++----- src-ts/lib/restricted-page/RestrictedPage.tsx | 20 +- .../require-auth.provider.tsx | 9 +- src-ts/lib/route-provider/route.provider.tsx | 4 +- src-ts/lib/social-links/facebook/Facebook.tsx | 15 +- .../lib/social-links/instagram/Instagram.tsx | 15 +- .../lib/social-links/linked-in/LinkedIn.tsx | 15 +- .../social-links/social-link/SocialLink.tsx | 1 + src-ts/lib/social-links/twitter/Twitter.tsx | 15 +- src-ts/lib/social-links/youtube/Youtube.tsx | 15 +- .../facebook/FacebookSocialShareBtn.tsx | 21 +- .../linkedin/LinkedinSocialShareBtn.tsx | 21 +- .../twitter/TwitterSocialShareBtn.tsx | 21 +- src-ts/lib/svgs/icon-wrapper/IconWrapper.tsx | 6 +- src-ts/lib/table/Table.tsx | 34 +-- src-ts/lib/table/table-cell/TableCell.tsx | 1 + src-ts/lib/tooltip/Tooltip.tsx | 14 +- .../dev-center-lib/MarkdownDoc/LayoutDoc.tsx | 6 +- .../MarkdownDoc/LayoutDocHeader.tsx | 6 +- .../MarkdownDoc/MarkdownAccordion.tsx | 2 +- .../MarkdownDoc/MarkdownCode.tsx | 12 +- .../MarkdownDoc/MarkdownImages.tsx | 92 +++--- .../MarkdownDoc/MarkdownLink.tsx | 8 +- .../MarkdownDoc/TableOfContents.tsx | 13 +- .../MarkdownDoc/markdownRenderer/renderer.tsx | 62 ++-- .../MarkdownDoc/markdownRenderer/util.ts | 6 +- .../getting-started/GettingStartedGuide.tsx | 24 +- .../landing-page/DevCenterLandingPage.tsx | 17 +- .../ArticleCard/ArticleCard.tsx | 4 +- .../dev-center-articles-section/Articles.ts | 1 + .../DevCenterArticlesSection.tsx | 18 +- .../dev-center-card/DevCenterCard.tsx | 27 +- .../DevCenterGetStarted.tsx | 14 +- .../GetStartedCardsContainer.tsx | 42 ++- .../DevCenterCarousel/DevCenterCarousel.tsx | 24 +- .../DevCenterCarouselItem.tsx | 20 +- .../dev-center-header/DevCenterHeader.tsx | 34 +-- .../carousel-content.config.ts | 10 +- .../dev-center-tag/DevCenterTag.tsx | 12 +- .../game-config/gamification.config.ts | 18 +- .../gamification.default.config.ts | 10 +- .../game-config/gamification.dev.config.ts | 2 +- .../game-config/gamification.prod.config.ts | 4 +- .../BadgeActivatedModal.tsx | 3 +- .../BadgeAssignedModal.tsx | 3 +- .../badge-created-modal/BadgeCreatedModal.tsx | 3 +- .../awarded-members-table.config.tsx | 38 +-- .../MemberActionRenderer.tsx | 34 +-- .../MemberAwaredAtRenderer.tsx | 2 +- .../MemberHandleRenderer.tsx | 20 +- .../pages/badge-detail/BadgeDetailPage.tsx | 5 +- .../BatchAwardTab/BatchAwardTab.tsx | 4 +- .../ManualAwardTab/ManualAwardTab.tsx | 3 +- .../pages/badge-detail/update-badge.store.ts | 3 + .../BadgeActionRenderer.tsx | 36 ++- .../badge-listing-table.config.tsx | 24 +- .../BadgeListingNameRenderer.tsx | 22 +- .../create-badge-form/CreateBadgeForm.tsx | 4 +- .../certificate-view/CertificateView.tsx | 4 +- .../action-button/ActionButton.tsx | 4 +- .../certificate/Certificate.tsx | 20 +- .../CertificateBgPattern.tsx | 15 +- .../certificate/course-card/CourseCard.tsx | 37 ++- .../course-details/CourseDetailsPage.tsx | 24 +- .../course-curriculum/CourseCurriculum.tsx | 4 +- .../curriculum-summary/CurriculumSummary.tsx | 8 +- .../TcAcademyPolicyModal.tsx | 3 +- .../promo-course/PromoCourse.tsx | 47 ++- .../learn/free-code-camp/FreeCodeCamp.tsx | 8 +- .../free-code-camp/fcc-frame/FccFrame.tsx | 1 + .../free-code-camp/title-nav/TitleNav.tsx | 53 ++-- .../collapsible-pane/CollapsiblePane.tsx | 8 +- .../learn-lib/course-badge/CourseBadge.tsx | 3 +- .../course-outline/CourseOutline.tsx | 20 +- .../collapsible-item/CollapsibleItem.tsx | 28 +- .../course-outline/status-icon/StatusIcon.tsx | 2 +- .../course-outline/step-icon/StepIcon.tsx | 4 +- .../learn-lib/course-title/CourseTitle.tsx | 4 +- .../courses-provider/courses.provider.tsx | 1 + .../curriculum-summary/CurriculumSummary.tsx | 10 +- .../learn-lib/functions/learn.factory.ts | 2 + .../my-course-card/completed/Completed.tsx | 6 +- .../my-course-card/in-progress/InProgress.tsx | 18 +- .../user-certifications.provider.tsx | 1 + ...user-completed-certifications.provider.tsx | 6 +- .../learn/learn-lib/wave-hero/WaveHero.tsx | 35 +-- src-ts/tools/learn/learn.routes.tsx | 2 +- src-ts/tools/learn/my-learning/MyLearning.tsx | 2 +- .../learn/my-learning/hero-card/HeroCard.tsx | 65 ++-- .../tab-content-layout/TabContentLayout.tsx | 10 +- .../AvailableCoursesList.tsx | 36 +-- .../welcome/courses-card/CoursesCard.tsx | 4 +- .../cards-slider/CardsSlider.tsx | 30 +- .../progress-block/no-progress/NoProgress.tsx | 22 +- .../work-detail-details/WorkDetailDetails.tsx | 4 +- .../WorkDetailDetailsPane.tsx | 50 +-- .../WorkDetailDetailsSidebar.tsx | 8 +- .../work-detail-header/WorkDetailHeader.tsx | 2 +- .../WorkFeedback/WorkFeedback.tsx | 10 +- .../WorkDetailSolutions.tsx | 2 +- .../WorkSolutionsListItem.tsx | 32 +- .../WorkDetailHighlights.tsx | 52 ++-- .../WorkTransferredStatus.tsx | 46 ++- .../message-functions/message.functions.ts | 10 +- .../work-factory/work.factory.ts | 24 +- .../work-store/work-prices.config.ts | 1 + .../work-store/work-type.config.ts | 2 +- .../work-lib/work-provider/work.provider.tsx | 15 +- .../work-status-item/WorkStatusItem.tsx | 4 +- .../work-login-prompt/WorkLoginPrompt.tsx | 28 +- .../work-not-logged-in/WorkNotLoggedIn.tsx | 2 +- .../bug-hunt/BugHuntIntakeForm.tsx | 9 +- .../bug-hunt/bug-hunt.form.config.tsx | 4 +- .../bug-hunt/bug-hunt.form.pricing-config.tsx | 284 +++++++++--------- .../AboutYourProjectInfoCard.tsx | 62 ++-- .../intake-forms/review/Review.tsx | 22 +- .../save-after-login/SaveAfterLogin.tsx | 2 +- .../work-service-price/WorkServicePrice.tsx | 70 ++--- src-ts/tools/work/work-table/WorkTable.tsx | 2 +- .../work-badge-renderer/WorkBadgeRenderer.tsx | 2 +- .../WorkDeleteButtonRenderer.tsx | 2 +- .../WorkStatusRenderer.tsx | 8 +- .../WorkTableTitleRenderer.tsx | 16 +- .../work/work-type-banner/WorkTypeBanner.tsx | 40 +-- src-ts/tools/work/work.routes.tsx | 2 +- 162 files changed, 1487 insertions(+), 1579 deletions(-) diff --git a/src-ts/header/Header.tsx b/src-ts/header/Header.tsx index 21d045913..bbdc7dd89 100644 --- a/src-ts/header/Header.tsx +++ b/src-ts/header/Header.tsx @@ -5,18 +5,16 @@ import { Logo } from './logo' import { ToolSelectors } from './tool-selectors' import { UtilitySelectors } from './utility-selectors' -const Header: FC<{}> = () => { - return ( -
-
- - - - -
-
-
- ) -} +const Header: FC<{}> = () => ( +
+
+ + + + +
+
+
+) export default Header diff --git a/src-ts/header/tool-selectors/ToolSelectors.tsx b/src-ts/header/tool-selectors/ToolSelectors.tsx index cdc9807cd..1af86631f 100644 --- a/src-ts/header/tool-selectors/ToolSelectors.tsx +++ b/src-ts/header/tool-selectors/ToolSelectors.tsx @@ -7,8 +7,6 @@ interface ToolSelectorsProps { isWide: boolean } -const ToolSelectors: FC = (props: ToolSelectorsProps) => { - return props.isWide ? : -} +const ToolSelectors: FC = (props: ToolSelectorsProps) => props.isWide ? : export default ToolSelectors diff --git a/src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx b/src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx index e30a3c5ba..f87c68723 100644 --- a/src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx +++ b/src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx @@ -46,7 +46,7 @@ const ToolSelectorWide: FC = (props: ToolSelectorWideProp > {toolRoute.title} -
+
) } diff --git a/src-ts/header/utility-selectors/UtilitySelectors.tsx b/src-ts/header/utility-selectors/UtilitySelectors.tsx index 8d5b3136a..a909a7769 100644 --- a/src-ts/header/utility-selectors/UtilitySelectors.tsx +++ b/src-ts/header/utility-selectors/UtilitySelectors.tsx @@ -3,13 +3,11 @@ import { FC } from 'react' import ProfileSelector from './UtilitySelector/ProfileSelector/ProfileSelector' import styles from './UtilitySelectors.module.scss' -const UtilitySelectors: FC<{}> = () => { - return ( -
- {/* TODO: make this configurable */} - -
- ) -} +const UtilitySelectors: FC<{}> = () => ( +
+ {/* TODO: make this configurable */} + +
+) export default UtilitySelectors diff --git a/src-ts/index.ts b/src-ts/index.ts index a8d7d77fe..c402cb788 100644 --- a/src-ts/index.ts +++ b/src-ts/index.ts @@ -4,22 +4,22 @@ export { default as AppNextGen } from './App' export { EnvironmentConfig } from './config' export { - Analytics, - Breadcrumb, - ContactSupportModal, - logInitialize, - OrderContractModal, - PageFooter, - PrivacyPolicyModal, - profileContext, - ProfileProvider, - RouteProvider, - TabsNavbar, - TermsModal, - xhrGetAsync, - xhrGetBlobAsync, - xhrPatchAsync, - xhrPostAsync, + Analytics, + Breadcrumb, + ContactSupportModal, + logInitialize, + OrderContractModal, + PageFooter, + PrivacyPolicyModal, + profileContext, + ProfileProvider, + RouteProvider, + TabsNavbar, + TermsModal, + xhrGetAsync, + xhrGetBlobAsync, + xhrPatchAsync, + xhrPostAsync, } from './lib' export * from './tools' export * from './utils' diff --git a/src-ts/lib/analytics/Analytics.tsx b/src-ts/lib/analytics/Analytics.tsx index 91b842ab9..ace4d5256 100644 --- a/src-ts/lib/analytics/Analytics.tsx +++ b/src-ts/lib/analytics/Analytics.tsx @@ -3,14 +3,11 @@ import { FC } from 'react' import { GoogleTagManager } from './google-tag-manater' import { SegmentAnalytics } from './segment-analytics' -const Analytics: FC<{}> = () => { - - return ( - <> - - - - ) -} +const Analytics: FC<{}> = () => ( + <> + + + +) export default Analytics diff --git a/src-ts/lib/breadcrumb/breadcrumb-item/BreadcrumbItem.tsx b/src-ts/lib/breadcrumb/breadcrumb-item/BreadcrumbItem.tsx index e9ab23f50..41401ddb3 100644 --- a/src-ts/lib/breadcrumb/breadcrumb-item/BreadcrumbItem.tsx +++ b/src-ts/lib/breadcrumb/breadcrumb-item/BreadcrumbItem.tsx @@ -1,7 +1,7 @@ import { FC } from 'react' import { Link } from 'react-router-dom' -import styles from './../Breadcrumb.module.scss' +import styles from "../Breadcrumb.module.scss" import { BreadcrumbItemModel } from './breadcrumb-item.model' interface BreadcrumbItemProps { @@ -9,14 +9,12 @@ interface BreadcrumbItemProps { item: BreadcrumbItemModel } -const BreadcrumbItem: FC = (props: BreadcrumbItemProps) => { - return ( -
  • props.item.onClick?.(props.item)}> - - {props.item.name} - -
  • - ) -} +const BreadcrumbItem: FC = (props: BreadcrumbItemProps) => ( +
  • props.item.onClick?.(props.item)}> + + {props.item.name} + +
  • +) export default BreadcrumbItem diff --git a/src-ts/lib/contact-support-form/ContactSupportForm.tsx b/src-ts/lib/contact-support-form/ContactSupportForm.tsx index 7315230af..68a8cac0f 100644 --- a/src-ts/lib/contact-support-form/ContactSupportForm.tsx +++ b/src-ts/lib/contact-support-form/ContactSupportForm.tsx @@ -23,9 +23,9 @@ const ContactSupportForm: FC = (props: ContactSupportFo const [saveOnSuccess, setSaveOnSuccess]: [boolean, Dispatch>] = useState(false) useEffect(() => { - if (!loading && saveOnSuccess) { - props.onSave() - } + if (!loading && saveOnSuccess) { + props.onSave() + } }, [loading, saveOnSuccess]) function generateRequest(inputs: ReadonlyArray): ContactSupportRequest { @@ -47,7 +47,7 @@ const ContactSupportForm: FC = (props: ContactSupportFo setLoading(true) return contactSupportSubmitRequestAsync(request) .then(() => { - setSaveOnSuccess(true) + setSaveOnSuccess(true) }).finally(() => setLoading(false)) } diff --git a/src-ts/lib/content-layout/ContentLayout.tsx b/src-ts/lib/content-layout/ContentLayout.tsx index a6bbbb6f0..0a56dcd51 100644 --- a/src-ts/lib/content-layout/ContentLayout.tsx +++ b/src-ts/lib/content-layout/ContentLayout.tsx @@ -16,42 +16,40 @@ export interface ContentLayoutProps { titleClass?: string } -const ContentLayout: FC = (props: ContentLayoutProps) => { - return ( -
    +const ContentLayout: FC = (props: ContentLayoutProps) => ( +
    -
    +
    -
    +
    - {!!props.title && ( -
    + {!!props.title && ( +
    -

    - {props.title} -

    +

    + {props.title} +

    - {!!props.buttonConfig && ( -
    -
    - )} + {!!props.buttonConfig && ( +
    +
    + )} -
    - )} +
    + )} - {props.children} - -
    + {props.children}
    - ) -} + +
    +) export default ContentLayout diff --git a/src-ts/lib/form/Form.tsx b/src-ts/lib/form/Form.tsx index 4f0817a14..afbc7b36e 100644 --- a/src-ts/lib/form/Form.tsx +++ b/src-ts/lib/form/Form.tsx @@ -86,11 +86,9 @@ const Form: (props: FormProps { - return () => { - if (props.resetFormOnUnmount) { - onReset() - } + useEffect(() => () => { + if (props.resetFormOnUnmount) { + onReset() } }, []) @@ -148,34 +146,32 @@ const Form: (props: FormProps FormButton = (button) => { - // if this is a reset button, set its onclick to reset - if (!!button.isReset) { - button = { - ...button, - onClick: onReset, - } - } - - return button - } + // if this is a reset button, set its onclick to reset + if (!!button.isReset) { + button = { + ...button, + onClick: onReset, + } + } - const createButtonGroup: (groups: ReadonlyArray, isPrimaryGroup: boolean) => Array = (groups, isPrimaryGroup) => { - return groups.map((button, index) => { - button = setOnClickOnReset(button) - - const disabled: boolean = (button.isSubmit && isFormInvalid) || !!props.shouldDisableButton?.(isPrimaryGroup, index) - - return ( -