diff --git a/.eslintrc.js b/.eslintrc.js index a45d56a5..1ee1e68b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,5 +20,31 @@ module.exports = createConfig('eslint', { assert: 'htmlFor', depth: 25 }], + 'sort-imports': ['error', {ignoreCase: true, ignoreDeclarationSort: true}], + 'import/order': [ + 'error', + { + groups: [ + 'builtin', + 'external', + 'internal', + ['sibling', 'parent'], + 'index', + ], + pathGroups: [ + { + pattern: '@(react|react-dom|react-redux)', + group: 'external', + position: 'before', + }, + ], + pathGroupsExcludedImportTypes: ['react'], + 'newlines-between': 'always', + alphabetize: { + order: 'asc', + caseInsensitive: true, + }, + }, + ], }, }); diff --git a/package-lock.json b/package-lock.json index 8dd55b0b..0d923938 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,6 +58,7 @@ "enzyme": "3.11.0", "enzyme-adapter-react-16": "1.15.6", "es-check": "6.2.1", + "eslint-plugin-import": "^2.26.0", "glob": "7.2.0", "history": "5.3.0", "husky": "7.0.4", @@ -2343,6 +2344,15 @@ "node": ">= 8" } }, + "node_modules/@edx/frontend-build/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, "node_modules/@edx/frontend-build/node_modules/diff-sequences": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", @@ -2352,6 +2362,19 @@ "node": ">= 10.14.2" } }, + "node_modules/@edx/frontend-build/node_modules/doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha512-lsGyRuYr4/PIB0txi+Fy2xOMI2dGaTguCaotzFGkVZuKR5usKfcRWIFKNM3QNrU7hh/+w2bwTW+ZeXPK5l8uVg==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@edx/frontend-build/node_modules/emittery": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.7.2.tgz", @@ -2364,6 +2387,127 @@ "url": "https://github.com/sindresorhus/emittery?sponsor=1" } }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==", + "dev": true, + "dependencies": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/eslint-plugin-import/node_modules/read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@edx/frontend-build/node_modules/execa": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", @@ -2453,6 +2597,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@edx/frontend-build/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "node_modules/@edx/frontend-build/node_modules/istanbul-lib-instrument": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", @@ -2936,6 +3086,42 @@ "node": ">= 10.13.0" } }, + "node_modules/@edx/frontend-build/node_modules/load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/load-json-file/node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "dev": true, + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@edx/frontend-build/node_modules/load-json-file/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/@edx/frontend-build/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -2960,6 +3146,12 @@ "node": ">=10" } }, + "node_modules/@edx/frontend-build/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, "node_modules/@edx/frontend-build/node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -3008,6 +3200,27 @@ "node": ">=8" } }, + "node_modules/@edx/frontend-build/node_modules/path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==", + "dev": true, + "dependencies": { + "pify": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@edx/frontend-build/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@edx/frontend-build/node_modules/pretty-format": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", @@ -6066,7 +6279,7 @@ "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "node_modules/@types/lodash": { @@ -9532,7 +9745,7 @@ "node_modules/contains-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "integrity": "sha512-OKZnPGeMQy2RPaUIBPFFd71iNf4791H12MCRuVQDnzGRwCYNYmTDy5pdafo2SLAcEMKzTOQnLWG4QdcjeJUMEg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -11507,30 +11720,30 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", "dev": true, "dependencies": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", "has": "^1.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", - "tsconfig-paths": "^3.9.0" + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, "node_modules/eslint-plugin-import/node_modules/debug": { @@ -11543,24 +11756,17 @@ } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "dependencies": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "^2.0.2" }, "engines": { "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "node_modules/eslint-plugin-import/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -23249,157 +23455,6 @@ "node": ">=8" } }, - "node_modules/read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "dependencies": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "dependencies": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "dependencies": { - "error-ex": "^1.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg/node_modules/path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "dependencies": { - "pify": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -26362,14 +26417,14 @@ "dev": true }, "node_modules/tsconfig-paths": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.0.tgz", - "integrity": "sha512-cg/1jAZoL57R39+wiw4u/SCC6Ic9Q5NqjBOb+9xISedOYurfog9ZNmKJSxAnb2m/5Bq4lE9lhUcau33Ml8DM0g==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", "json5": "^1.0.1", - "minimist": "^1.2.0", + "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, @@ -26388,7 +26443,7 @@ "node_modules/tsconfig-paths/node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, "engines": { "node": ">=4" @@ -29743,18 +29798,130 @@ "which": "^2.0.1" } }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "diff-sequences": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", "dev": true }, + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha512-lsGyRuYr4/PIB0txi+Fy2xOMI2dGaTguCaotzFGkVZuKR5usKfcRWIFKNM3QNrU7hh/+w2bwTW+ZeXPK5l8uVg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + }, "emittery": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.7.2.tgz", "integrity": "sha512-A8OG5SR/ij3SsJdWDJdkkSYUjQdCUx6APQXem0SaEePBSRg4eymGYwBkKo1Y6DU+af/Jn2dBQqDBvjnr9Vi8nQ==", "dev": true }, + "eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "requires": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + } + } + }, "execa": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", @@ -29817,6 +29984,12 @@ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "istanbul-lib-instrument": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", @@ -30207,6 +30380,35 @@ "supports-color": "^7.0.0" } }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + } + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -30225,6 +30427,12 @@ "yallist": "^4.0.0" } }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -30258,6 +30466,21 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true + }, "pretty-format": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", @@ -32625,7 +32848,7 @@ "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "@types/lodash": { @@ -35486,7 +35709,7 @@ "contains-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "integrity": "sha512-OKZnPGeMQy2RPaUIBPFFd71iNf4791H12MCRuVQDnzGRwCYNYmTDy5pdafo2SLAcEMKzTOQnLWG4QdcjeJUMEg==", "dev": true }, "content-disposition": { @@ -37024,24 +37247,24 @@ } }, "eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", "dev": true, "requires": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", "has": "^1.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", - "tsconfig-paths": "^3.9.0" + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" }, "dependencies": { "debug": { @@ -37054,21 +37277,14 @@ } }, "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "^2.0.2" } }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -45832,122 +46048,6 @@ } } }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - }, - "dependencies": { - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -48339,14 +48439,14 @@ "dev": true }, "tsconfig-paths": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.0.tgz", - "integrity": "sha512-cg/1jAZoL57R39+wiw4u/SCC6Ic9Q5NqjBOb+9xISedOYurfog9ZNmKJSxAnb2m/5Bq4lE9lhUcau33Ml8DM0g==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", "dev": true, "requires": { "@types/json5": "^0.0.29", "json5": "^1.0.1", - "minimist": "^1.2.0", + "minimist": "^1.2.6", "strip-bom": "^3.0.0" }, "dependencies": { @@ -48362,7 +48462,7 @@ "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true } } diff --git a/package.json b/package.json index f75cbf06..d2e22e18 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@fortawesome/free-regular-svg-icons": "5.15.4", "@fortawesome/free-solid-svg-icons": "5.15.4", "@fortawesome/react-fontawesome": "0.1.18", + "@redux-devtools/extension": "3.2.2", "classnames": "2.3.1", "clipboard": "2.0.10", "core-js": "3.21.1", @@ -64,7 +65,6 @@ "react-router": "5.2.1", "react-router-dom": "5.3.0", "redux": "4.1.2", - "@redux-devtools/extension": "3.2.2", "redux-logger": "3.0.6", "redux-mock-store": "1.5.4", "redux-saga": "1.1.3", @@ -83,6 +83,7 @@ "enzyme": "3.11.0", "enzyme-adapter-react-16": "1.15.6", "es-check": "6.2.1", + "eslint-plugin-import": "^2.26.0", "glob": "7.2.0", "history": "5.3.0", "husky": "7.0.4", diff --git a/src/MainApp.jsx b/src/MainApp.jsx index 43171c62..63e3f378 100755 --- a/src/MainApp.jsx +++ b/src/MainApp.jsx @@ -1,16 +1,16 @@ import React from 'react'; -import { Redirect, Route, Switch } from 'react-router-dom'; import { getConfig } from '@edx/frontend-platform'; import { AppProvider } from '@edx/frontend-platform/react'; +import { Redirect, Route, Switch } from 'react-router-dom'; import { - UnAuthOnlyRoute, registerIcons, NotFoundPage, Logistration, + Logistration, NotFoundPage, registerIcons, UnAuthOnlyRoute, } from './common-components'; -import { - LOGIN_PAGE, PAGE_NOT_FOUND, REGISTER_PAGE, RESET_PAGE, PASSWORD_RESET_CONFIRM, WELCOME_PAGE, -} from './data/constants'; import configureStore from './data/configureStore'; +import { + LOGIN_PAGE, PAGE_NOT_FOUND, PASSWORD_RESET_CONFIRM, REGISTER_PAGE, RESET_PAGE, WELCOME_PAGE, +} from './data/constants'; import { updatePathWithQueryParams } from './data/utils'; import ForgotPasswordPage from './forgot-password'; import ResetPasswordPage from './reset-password'; diff --git a/src/base-component/AuthExtraLargeLayout.jsx b/src/base-component/AuthExtraLargeLayout.jsx index 87b89c1b..2f60ce8f 100644 --- a/src/base-component/AuthExtraLargeLayout.jsx +++ b/src/base-component/AuthExtraLargeLayout.jsx @@ -1,13 +1,12 @@ import React from 'react'; -import classNames from 'classnames'; -import PropTypes from 'prop-types'; - import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Col, Hyperlink, Image, Row, } from '@edx/paragon'; +import classNames from 'classnames'; +import PropTypes from 'prop-types'; import messages from './messages'; diff --git a/src/base-component/AuthMediumLayout.jsx b/src/base-component/AuthMediumLayout.jsx index 59df909b..461486f2 100644 --- a/src/base-component/AuthMediumLayout.jsx +++ b/src/base-component/AuthMediumLayout.jsx @@ -1,12 +1,11 @@ import React from 'react'; -import PropTypes from 'prop-types'; - -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getConfig } from '@edx/frontend-platform'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Col, Hyperlink, Image, Row, } from '@edx/paragon'; +import PropTypes from 'prop-types'; import messages from './messages'; diff --git a/src/base-component/AuthSmallLayout.jsx b/src/base-component/AuthSmallLayout.jsx index e420fcf0..11a6412e 100644 --- a/src/base-component/AuthSmallLayout.jsx +++ b/src/base-component/AuthSmallLayout.jsx @@ -1,13 +1,12 @@ import React from 'react'; -import classNames from 'classnames'; -import PropTypes from 'prop-types'; - import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Col, Hyperlink, Image, Row, } from '@edx/paragon'; +import classNames from 'classnames'; +import PropTypes from 'prop-types'; import messages from './messages'; diff --git a/src/base-component/BaseComponent.jsx b/src/base-component/BaseComponent.jsx index 8a09533f..507beeb4 100644 --- a/src/base-component/BaseComponent.jsx +++ b/src/base-component/BaseComponent.jsx @@ -1,21 +1,20 @@ -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; + +import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner'; +import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; +import { getLocale } from '@edx/frontend-platform/i18n'; +import { breakpoints } from '@edx/paragon'; import classNames from 'classnames'; import PropTypes from 'prop-types'; - -import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; import MediaQuery from 'react-responsive'; -import { breakpoints } from '@edx/paragon'; -import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner'; -import { getLocale } from '@edx/frontend-platform/i18n'; - -import LargeLayout from './LargeLayout'; -import MediumLayout from './MediumLayout'; -import SmallLayout from './SmallLayout'; import AuthExtraLargeLayout from './AuthExtraLargeLayout'; import AuthMediumLayout from './AuthMediumLayout'; import AuthSmallLayout from './AuthSmallLayout'; import DiscountExperimentBanner from './DiscountBanner'; +import LargeLayout from './LargeLayout'; +import MediumLayout from './MediumLayout'; +import SmallLayout from './SmallLayout'; const BaseComponent = ({ children, isRegistrationPage, showWelcomeBanner }) => { const authenticatedUser = showWelcomeBanner ? getAuthenticatedUser() : null; diff --git a/src/base-component/DiscountBanner.jsx b/src/base-component/DiscountBanner.jsx index 067a5dcd..f9961f4c 100644 --- a/src/base-component/DiscountBanner.jsx +++ b/src/base-component/DiscountBanner.jsx @@ -1,12 +1,11 @@ import React, { useState } from 'react'; -import ClipboardJS from 'clipboard'; - -import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; +import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { PageBanner, Toast } from '@edx/paragon'; import { faCut } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import ClipboardJS from 'clipboard'; -import { Toast, PageBanner } from '@edx/paragon'; import messages from './messages'; const DiscountExperimentBanner = (props) => { diff --git a/src/base-component/LargeLayout.jsx b/src/base-component/LargeLayout.jsx index 9da26e64..abd11af6 100644 --- a/src/base-component/LargeLayout.jsx +++ b/src/base-component/LargeLayout.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; import { Hyperlink, Image } from '@edx/paragon'; +import PropTypes from 'prop-types'; import LargeScreenLeftLayout from './LargeLeftLayout'; diff --git a/src/base-component/LargeLeftLayout.jsx b/src/base-component/LargeLeftLayout.jsx index f49baf5f..f4458942 100644 --- a/src/base-component/LargeLeftLayout.jsx +++ b/src/base-component/LargeLeftLayout.jsx @@ -1,15 +1,13 @@ import React, { useState } from 'react'; -import classNames from 'classnames'; - -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getConfig } from '@edx/frontend-platform'; -import PropTypes from 'prop-types'; -import ClipboardJS from 'clipboard'; - +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Toast } from '@edx/paragon'; import { faCut } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Toast } from '@edx/paragon'; +import classNames from 'classnames'; +import ClipboardJS from 'clipboard'; +import PropTypes from 'prop-types'; import messages from './messages'; import SideDiscountBanner from './SideDiscountBanner'; diff --git a/src/base-component/MediumLayout.jsx b/src/base-component/MediumLayout.jsx index e82a070a..541e75d1 100644 --- a/src/base-component/MediumLayout.jsx +++ b/src/base-component/MediumLayout.jsx @@ -1,16 +1,14 @@ import React, { useState } from 'react'; -import classNames from 'classnames'; - -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getConfig } from '@edx/frontend-platform'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Hyperlink, Image, Toast } from '@edx/paragon'; -import PropTypes from 'prop-types'; - -import ClipboardJS from 'clipboard'; - import { faCut } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import classNames from 'classnames'; +import ClipboardJS from 'clipboard'; +import PropTypes from 'prop-types'; + import messages from './messages'; import SideDiscountBanner from './SideDiscountBanner'; diff --git a/src/base-component/SmallLayout.jsx b/src/base-component/SmallLayout.jsx index 09f4f8c8..a713524d 100644 --- a/src/base-component/SmallLayout.jsx +++ b/src/base-component/SmallLayout.jsx @@ -1,17 +1,14 @@ import React, { useState } from 'react'; -import classNames from 'classnames'; - -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getConfig } from '@edx/frontend-platform'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Hyperlink, Image, Toast } from '@edx/paragon'; - -import PropTypes from 'prop-types'; - -import ClipboardJS from 'clipboard'; - import { faCut } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import classNames from 'classnames'; +import ClipboardJS from 'clipboard'; +import PropTypes from 'prop-types'; + import messages from './messages'; import SideDiscountBanner from './SideDiscountBanner'; diff --git a/src/base-component/tests/BaseComponent.test.jsx b/src/base-component/tests/BaseComponent.test.jsx index 77794883..638a23b8 100644 --- a/src/base-component/tests/BaseComponent.test.jsx +++ b/src/base-component/tests/BaseComponent.test.jsx @@ -1,6 +1,7 @@ import React from 'react'; -import { mount } from 'enzyme'; + import { IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; import LargeLayout from '../LargeLayout'; import MediumLayout from '../MediumLayout'; diff --git a/src/common-components/EnterpriseSSO.jsx b/src/common-components/EnterpriseSSO.jsx index fb3e0518..72746cfc 100644 --- a/src/common-components/EnterpriseSSO.jsx +++ b/src/common-components/EnterpriseSSO.jsx @@ -1,14 +1,13 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; -import { faSignInAlt } from '@fortawesome/free-solid-svg-icons'; - +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { - Form, Button, + Button, Form, } from '@edx/paragon'; +import { faSignInAlt } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import PropTypes from 'prop-types'; import { LOGIN_PAGE, SUPPORTED_ICON_CLASSES } from '../data/constants'; import messages from './messages'; diff --git a/src/common-components/InstitutionLogistration.jsx b/src/common-components/InstitutionLogistration.jsx index cb840f0e..13d54bd4 100644 --- a/src/common-components/InstitutionLogistration.jsx +++ b/src/common-components/InstitutionLogistration.jsx @@ -1,9 +1,11 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; + import { getConfig } from '@edx/frontend-platform'; -import PropTypes from 'prop-types'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Button, Hyperlink, Icon } from '@edx/paragon'; import { Institution } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; + import messages from './messages'; export const RenderInstitutionButton = props => { diff --git a/src/common-components/Logistration.jsx b/src/common-components/Logistration.jsx index 65f5a2c1..033af66a 100644 --- a/src/common-components/Logistration.jsx +++ b/src/common-components/Logistration.jsx @@ -1,24 +1,24 @@ import React, { useEffect, useState } from 'react'; + +import { getConfig } from '@edx/frontend-platform'; +import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; +import { getAuthService } from '@edx/frontend-platform/auth'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { + Icon, + Tab, + Tabs, +} from '@edx/paragon'; +import { ChevronLeft } from '@edx/paragon/icons'; import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; -import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { getConfig } from '@edx/frontend-platform'; -import { getAuthService } from '@edx/frontend-platform/auth'; -import { - Tabs, - Tab, - Icon, -} from '@edx/paragon'; -import { ChevronLeft } from '@edx/paragon/icons'; - -import messages from './messages'; +import BaseComponent from '../base-component'; import { LOGIN_PAGE, REGISTER_PAGE } from '../data/constants'; -import { updatePathWithQueryParams, getTpaHint } from '../data/utils'; +import { getTpaHint, updatePathWithQueryParams } from '../data/utils'; import { LoginPage } from '../login'; import { RegistrationPage } from '../register'; -import BaseComponent from '../base-component'; +import messages from './messages'; const Logistration = (props) => { const { intl, selectedPage } = props; diff --git a/src/common-components/NotFoundPage.jsx b/src/common-components/NotFoundPage.jsx index 5386f9d1..8e9fc285 100644 --- a/src/common-components/NotFoundPage.jsx +++ b/src/common-components/NotFoundPage.jsx @@ -1,4 +1,5 @@ import React from 'react'; + import { FormattedMessage } from '@edx/frontend-platform/i18n'; export default function NotFoundPage() { diff --git a/src/common-components/PasswordField.jsx b/src/common-components/PasswordField.jsx index 8353eaea..ae32d258 100644 --- a/src/common-components/PasswordField.jsx +++ b/src/common-components/PasswordField.jsx @@ -1,16 +1,16 @@ import React, { useState } from 'react'; -import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { - Form, IconButton, useToggle, Tooltip, OverlayTrigger, Icon, + Form, Icon, IconButton, OverlayTrigger, Tooltip, useToggle, } from '@edx/paragon'; import { Check, Remove, Visibility, VisibilityOff, } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; -import messages from './messages'; import { LETTER_REGEX, NUMBER_REGEX } from '../data/constants'; +import messages from './messages'; const PasswordField = (props) => { const { formatMessage } = props.intl; diff --git a/src/common-components/RedirectLogistration.jsx b/src/common-components/RedirectLogistration.jsx index 4c357cc6..419c3b0c 100644 --- a/src/common-components/RedirectLogistration.jsx +++ b/src/common-components/RedirectLogistration.jsx @@ -1,10 +1,9 @@ import React from 'react'; +import { getConfig } from '@edx/frontend-platform'; import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; -import { getConfig } from '@edx/frontend-platform'; - import { WELCOME_PAGE } from '../data/constants'; import { setCookie } from '../data/utils'; diff --git a/src/common-components/SocialAuthProviders.jsx b/src/common-components/SocialAuthProviders.jsx index 78fa301a..81bb06c5 100644 --- a/src/common-components/SocialAuthProviders.jsx +++ b/src/common-components/SocialAuthProviders.jsx @@ -1,13 +1,13 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSignInAlt } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import PropTypes from 'prop-types'; -import messages from './messages'; import { LOGIN_PAGE, SUPPORTED_ICON_CLASSES } from '../data/constants'; +import messages from './messages'; function SocialAuthProviders(props) { const { intl, referrer, socialAuthProviders } = props; diff --git a/src/common-components/SwitchContent.jsx b/src/common-components/SwitchContent.jsx index a4c13c74..04db9109 100644 --- a/src/common-components/SwitchContent.jsx +++ b/src/common-components/SwitchContent.jsx @@ -1,6 +1,7 @@ import React from 'react'; -import PropTypes from 'prop-types'; + import { TransitionReplace } from '@edx/paragon'; +import PropTypes from 'prop-types'; const onChildExit = (htmlNode) => { // If the leaving child has focus, take control and redirect it diff --git a/src/common-components/ThirdPartyAuthAlert.jsx b/src/common-components/ThirdPartyAuthAlert.jsx index f1cb8443..a74cb399 100644 --- a/src/common-components/ThirdPartyAuthAlert.jsx +++ b/src/common-components/ThirdPartyAuthAlert.jsx @@ -1,12 +1,12 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Alert } from '@edx/paragon'; +import PropTypes from 'prop-types'; -import messages from './messages'; import { LOGIN_PAGE, REGISTER_PAGE } from '../data/constants'; +import messages from './messages'; const ThirdPartyAuthAlert = (props) => { const { currentProvider, intl, referrer } = props; diff --git a/src/common-components/UnAuthOnlyRoute.jsx b/src/common-components/UnAuthOnlyRoute.jsx index 1061b98b..cb7b96ce 100644 --- a/src/common-components/UnAuthOnlyRoute.jsx +++ b/src/common-components/UnAuthOnlyRoute.jsx @@ -1,7 +1,9 @@ import React, { useEffect, useState } from 'react'; -import { Route } from 'react-router-dom'; + import { getConfig } from '@edx/frontend-platform'; import { fetchAuthenticatedUser, getAuthenticatedUser } from '@edx/frontend-platform/auth'; +import { Route } from 'react-router-dom'; + import { DEFAULT_REDIRECT_URL } from '../data/constants'; /** diff --git a/src/common-components/data/reducers.js b/src/common-components/data/reducers.js index eac34323..d8435341 100644 --- a/src/common-components/data/reducers.js +++ b/src/common-components/data/reducers.js @@ -1,7 +1,6 @@ +import { COMPLETE_STATE, PENDING_STATE } from '../../data/constants'; import { THIRD_PARTY_AUTH_CONTEXT } from './actions'; -import { PENDING_STATE, COMPLETE_STATE } from '../../data/constants'; - export const defaultState = { extendedProfile: [], fieldDescriptions: {}, diff --git a/src/common-components/data/sagas.js b/src/common-components/data/sagas.js index 9b824c91..802a10ee 100644 --- a/src/common-components/data/sagas.js +++ b/src/common-components/data/sagas.js @@ -1,16 +1,12 @@ +import { logError } from '@edx/frontend-platform/logging'; import { call, put, takeEvery } from 'redux-saga/effects'; -import { logError } from '@edx/frontend-platform/logging'; - -// Actions import { - THIRD_PARTY_AUTH_CONTEXT, getThirdPartyAuthContextBegin, - getThirdPartyAuthContextSuccess, getThirdPartyAuthContextFailure, + getThirdPartyAuthContextSuccess, + THIRD_PARTY_AUTH_CONTEXT, } from './actions'; - -// Services import { getThirdPartyAuthContext, } from './service'; diff --git a/src/common-components/data/tests/sagas.test.js b/src/common-components/data/tests/sagas.test.js index c63b1eb3..3058dce4 100644 --- a/src/common-components/data/tests/sagas.test.js +++ b/src/common-components/data/tests/sagas.test.js @@ -1,9 +1,9 @@ import { runSaga } from 'redux-saga'; +import initializeMockLogging from '../../../setupTest'; import * as actions from '../actions'; import { fetchThirdPartyAuthContext } from '../sagas'; import * as api from '../service'; -import initializeMockLogging from '../../../setupTest'; const { loggingService } = initializeMockLogging(); diff --git a/src/common-components/tests/FormField.test.jsx b/src/common-components/tests/FormField.test.jsx index 97b4a46c..e936fae3 100644 --- a/src/common-components/tests/FormField.test.jsx +++ b/src/common-components/tests/FormField.test.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import { mount } from 'enzyme'; -import { act } from 'react-dom/test-utils'; import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; import FormGroup from '../FormGroup'; import PasswordField from '../PasswordField'; diff --git a/src/common-components/tests/Logistration.test.jsx b/src/common-components/tests/Logistration.test.jsx index 8ddeb563..987d4b3a 100644 --- a/src/common-components/tests/Logistration.test.jsx +++ b/src/common-components/tests/Logistration.test.jsx @@ -1,17 +1,17 @@ import React from 'react'; -import { mount } from 'enzyme'; -import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; -import { MemoryRouter } from 'react-router-dom'; import { getConfig, mergeConfig } from '@edx/frontend-platform'; import * as analytics from '@edx/frontend-platform/analytics'; -import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; - import * as auth from '@edx/frontend-platform/auth'; -import Logistration from '../Logistration'; -import { RenderInstitutionButton } from '../InstitutionLogistration'; +import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { MemoryRouter } from 'react-router-dom'; +import configureStore from 'redux-mock-store'; + import { COMPLETE_STATE, LOGIN_PAGE } from '../../data/constants'; +import { RenderInstitutionButton } from '../InstitutionLogistration'; +import Logistration from '../Logistration'; jest.mock('@edx/frontend-platform/analytics'); jest.mock('@edx/frontend-platform/auth'); diff --git a/src/common-components/tests/SocialAuthProviders.test.jsx b/src/common-components/tests/SocialAuthProviders.test.jsx index 22aaf712..850708ec 100644 --- a/src/common-components/tests/SocialAuthProviders.test.jsx +++ b/src/common-components/tests/SocialAuthProviders.test.jsx @@ -1,9 +1,10 @@ import React from 'react'; -import renderer from 'react-test-renderer'; -import { IntlProvider } from '@edx/frontend-platform/i18n'; -import SocialAuthProviders from '../SocialAuthProviders'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; +import renderer from 'react-test-renderer'; + import registerIcons from '../RegisterFaIcons'; +import SocialAuthProviders from '../SocialAuthProviders'; registerIcons(); diff --git a/src/common-components/tests/ThirdPartyAuthAlert.test.jsx b/src/common-components/tests/ThirdPartyAuthAlert.test.jsx index 23b35229..435f1227 100644 --- a/src/common-components/tests/ThirdPartyAuthAlert.test.jsx +++ b/src/common-components/tests/ThirdPartyAuthAlert.test.jsx @@ -1,9 +1,10 @@ import React from 'react'; -import renderer from 'react-test-renderer'; -import { IntlProvider } from '@edx/frontend-platform/i18n'; -import ThirdPartyAuthAlert from '../ThirdPartyAuthAlert'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; +import renderer from 'react-test-renderer'; + import { REGISTER_PAGE } from '../../data/constants'; +import ThirdPartyAuthAlert from '../ThirdPartyAuthAlert'; describe('ThirdPartyAuthAlert', () => { let props = {}; diff --git a/src/common-components/tests/UnAuthOnlyRoute.test.jsx b/src/common-components/tests/UnAuthOnlyRoute.test.jsx index 38562acf..d5a51244 100644 --- a/src/common-components/tests/UnAuthOnlyRoute.test.jsx +++ b/src/common-components/tests/UnAuthOnlyRoute.test.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import { mount } from 'enzyme'; -import { BrowserRouter as Router, MemoryRouter, Switch } from 'react-router-dom'; import * as auth from '@edx/frontend-platform/auth'; +import { mount } from 'enzyme'; +import { MemoryRouter, BrowserRouter as Router, Switch } from 'react-router-dom'; import { UnAuthOnlyRoute } from '..'; import { LOGIN_PAGE } from '../../data/constants'; diff --git a/src/data/configureStore.js b/src/data/configureStore.js index 00de9d4f..5c186ee8 100644 --- a/src/data/configureStore.js +++ b/src/data/configureStore.js @@ -1,9 +1,9 @@ import { getConfig } from '@edx/frontend-platform'; -import { applyMiddleware, createStore, compose } from 'redux'; -import thunkMiddleware from 'redux-thunk'; import { composeWithDevTools } from '@redux-devtools/extension'; +import { applyMiddleware, compose, createStore } from 'redux'; import { createLogger } from 'redux-logger'; import createSagaMiddleware from 'redux-saga'; +import thunkMiddleware from 'redux-thunk'; import createRootReducer from './reducers'; import rootSaga from './sagas'; diff --git a/src/data/reducers.js b/src/data/reducers.js index 335552b7..14086dad 100755 --- a/src/data/reducers.js +++ b/src/data/reducers.js @@ -1,13 +1,5 @@ import { combineReducers } from 'redux'; -import { - reducer as loginReducer, - storeName as loginStoreName, -} from '../login'; -import { - reducer as registerReducer, - storeName as registerStoreName, -} from '../register'; import { reducer as commonComponentsReducer, storeName as commonComponentsStoreName, @@ -16,11 +8,18 @@ import { reducer as forgotPasswordReducer, storeName as forgotPasswordStoreName, } from '../forgot-password'; +import { + reducer as loginReducer, + storeName as loginStoreName, +} from '../login'; +import { + reducer as registerReducer, + storeName as registerStoreName, +} from '../register'; import { reducer as resetPasswordReducer, storeName as resetPasswordStoreName, } from '../reset-password'; - import { reducer as welcomePageReducers, storeName as welcomePageStoreName, diff --git a/src/data/sagas.js b/src/data/sagas.js index b6b9926d..f437865d 100644 --- a/src/data/sagas.js +++ b/src/data/sagas.js @@ -1,9 +1,9 @@ import { all } from 'redux-saga/effects'; -import { saga as registrationSaga } from '../register'; -import { saga as loginSaga } from '../login'; import { saga as commonComponentsSaga } from '../common-components'; import { saga as forgotPasswordSaga } from '../forgot-password'; +import { saga as loginSaga } from '../login'; +import { saga as registrationSaga } from '../register'; import { saga as resetPasswordSaga } from '../reset-password'; import { saga as welcomePageSaga } from '../welcome'; diff --git a/src/data/utils/cookies.js b/src/data/utils/cookies.js index 369913c6..8830d13b 100644 --- a/src/data/utils/cookies.js +++ b/src/data/utils/cookies.js @@ -1,5 +1,5 @@ -import Cookies from 'universal-cookie'; import { getConfig } from '@edx/frontend-platform'; +import Cookies from 'universal-cookie'; export function setCookie(cookieName, cookieValue, cookieExpiry) { const cookies = new Cookies(); diff --git a/src/data/utils/dataUtils.js b/src/data/utils/dataUtils.js index 0fb6e52b..7aa43ae4 100644 --- a/src/data/utils/dataUtils.js +++ b/src/data/utils/dataUtils.js @@ -1,6 +1,7 @@ // Utility functions import * as QueryString from 'query-string'; + import { AUTH_PARAMS } from '../constants'; export default function processLink(link) { diff --git a/src/data/utils/useMobileResponsive.js b/src/data/utils/useMobileResponsive.js index 135a4bad..799c4ca5 100644 --- a/src/data/utils/useMobileResponsive.js +++ b/src/data/utils/useMobileResponsive.js @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { breakpoints } from '@edx/paragon'; diff --git a/src/field-renderer/FieldRenderer.jsx b/src/field-renderer/FieldRenderer.jsx index 6756a97a..2afa69d4 100644 --- a/src/field-renderer/FieldRenderer.jsx +++ b/src/field-renderer/FieldRenderer.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Form, Icon } from '@edx/paragon'; import { ExpandMore } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; const FormFieldRenderer = (props) => { let formField = null; diff --git a/src/field-renderer/tests/FieldRenderer.test.jsx b/src/field-renderer/tests/FieldRenderer.test.jsx index d0fc20f6..7c6b4c40 100644 --- a/src/field-renderer/tests/FieldRenderer.test.jsx +++ b/src/field-renderer/tests/FieldRenderer.test.jsx @@ -1,4 +1,5 @@ import React from 'react'; + import { mount } from 'enzyme'; import FieldRenderer from '../FieldRenderer'; diff --git a/src/forgot-password/ForgotPasswordAlert.jsx b/src/forgot-password/ForgotPasswordAlert.jsx index 8e0dee7e..130f7d60 100644 --- a/src/forgot-password/ForgotPasswordAlert.jsx +++ b/src/forgot-password/ForgotPasswordAlert.jsx @@ -1,14 +1,14 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Alert } from '@edx/paragon'; import { CheckCircle, Error } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; -import messages from './messages'; import { INTERNAL_SERVER_ERROR } from '../data/constants'; import { PASSWORD_RESET } from '../reset-password/data/constants'; +import messages from './messages'; const ForgotPasswordAlert = (props) => { const { email, emailError, intl } = props; diff --git a/src/forgot-password/ForgotPasswordPage.jsx b/src/forgot-password/ForgotPasswordPage.jsx index 591c75fb..c4be3caa 100644 --- a/src/forgot-password/ForgotPasswordPage.jsx +++ b/src/forgot-password/ForgotPasswordPage.jsx @@ -1,33 +1,31 @@ -import React, { useState, useEffect } from 'react'; - -import { Formik } from 'formik'; -import PropTypes from 'prop-types'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Helmet } from 'react-helmet'; -import { Redirect } from 'react-router-dom'; import { getConfig } from '@edx/frontend-platform'; import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Form, - StatefulButton, Hyperlink, - Tabs, - Tab, Icon, + StatefulButton, + Tab, + Tabs, } from '@edx/paragon'; import { ChevronLeft } from '@edx/paragon/icons'; +import { Formik } from 'formik'; +import PropTypes from 'prop-types'; +import { Helmet } from 'react-helmet'; +import { Redirect } from 'react-router-dom'; -import { forgotPassword } from './data/actions'; -import { forgotPasswordResultSelector } from './data/selectors'; - -import messages from './messages'; +import BaseComponent from '../base-component'; import { FormGroup } from '../common-components'; import { DEFAULT_STATE, LOGIN_PAGE, VALID_EMAIL_REGEX } from '../data/constants'; import { updatePathWithQueryParams, windowScrollTo } from '../data/utils'; +import { forgotPassword } from './data/actions'; +import { forgotPasswordResultSelector } from './data/selectors'; import ForgotPasswordAlert from './ForgotPasswordAlert'; -import BaseComponent from '../base-component'; +import messages from './messages'; const ForgotPasswordPage = (props) => { const { intl, status, submitState } = props; diff --git a/src/forgot-password/data/reducers.js b/src/forgot-password/data/reducers.js index 62d000fb..139a4d59 100644 --- a/src/forgot-password/data/reducers.js +++ b/src/forgot-password/data/reducers.js @@ -1,6 +1,6 @@ -import { FORGOT_PASSWORD } from './actions'; import { INTERNAL_SERVER_ERROR, PENDING_STATE } from '../../data/constants'; import { PASSWORD_RESET_FAILURE } from '../../reset-password/data/actions'; +import { FORGOT_PASSWORD } from './actions'; export const defaultState = { status: '', diff --git a/src/forgot-password/data/sagas.js b/src/forgot-password/data/sagas.js index 439f6bf0..fa48d50b 100644 --- a/src/forgot-password/data/sagas.js +++ b/src/forgot-password/data/sagas.js @@ -5,11 +5,10 @@ import { call, put, takeEvery } from 'redux-saga/effects'; import { FORGOT_PASSWORD, forgotPasswordBegin, - forgotPasswordSuccess, forgotPasswordForbidden, forgotPasswordServerError, + forgotPasswordSuccess, } from './actions'; - import { forgotPassword } from './service'; // Services diff --git a/src/forgot-password/data/tests/sagas.test.js b/src/forgot-password/data/tests/sagas.test.js index d3e85654..f4c92162 100644 --- a/src/forgot-password/data/tests/sagas.test.js +++ b/src/forgot-password/data/tests/sagas.test.js @@ -1,9 +1,9 @@ import { runSaga } from 'redux-saga'; +import initializeMockLogging from '../../../setupTest'; import * as actions from '../actions'; import { handleForgotPassword } from '../sagas'; import * as api from '../service'; -import initializeMockLogging from '../../../setupTest'; const { loggingService } = initializeMockLogging(); diff --git a/src/forgot-password/tests/ForgotPasswordPage.test.jsx b/src/forgot-password/tests/ForgotPasswordPage.test.jsx index 06a66618..473e02c9 100644 --- a/src/forgot-password/tests/ForgotPasswordPage.test.jsx +++ b/src/forgot-password/tests/ForgotPasswordPage.test.jsx @@ -1,21 +1,20 @@ import React from 'react'; - -import { mount } from 'enzyme'; -import { act } from 'react-dom/test-utils'; import { Provider } from 'react-redux'; -import { MemoryRouter, Router } from 'react-router-dom'; -import configureStore from 'redux-mock-store'; -import { createMemoryHistory } from 'history'; -import * as analytics from '@edx/frontend-platform/analytics'; import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner'; import { mergeConfig } from '@edx/frontend-platform'; -import { IntlProvider, injectIntl, configure } from '@edx/frontend-platform/i18n'; - +import * as analytics from '@edx/frontend-platform/analytics'; import * as auth from '@edx/frontend-platform/auth'; -import ForgotPasswordPage from '../ForgotPasswordPage'; +import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { createMemoryHistory } from 'history'; +import { act } from 'react-dom/test-utils'; +import { MemoryRouter, Router } from 'react-router-dom'; +import configureStore from 'redux-mock-store'; + import { INTERNAL_SERVER_ERROR, LOGIN_PAGE } from '../../data/constants'; import { PASSWORD_RESET } from '../../reset-password/data/constants'; +import ForgotPasswordPage from '../ForgotPasswordPage'; jest.mock('@edx/frontend-platform/analytics'); jest.mock('@edx/frontend-platform/auth'); diff --git a/src/i18n/index.jsx b/src/i18n/index.jsx index 8c090720..986f8d65 100644 --- a/src/i18n/index.jsx +++ b/src/i18n/index.jsx @@ -1,21 +1,21 @@ import arMessages from './messages/ar.json'; import caMessages from './messages/ca.json'; // no need to import en messages-- they are in the defaultMessage field +import dedeMessages from './messages/de_DE.json'; import es419Messages from './messages/es_419.json'; import frMessages from './messages/fr.json'; -import zhcnMessages from './messages/zh_CN.json'; -import ititMessages from './messages/it_IT.json'; -import ptptMessages from './messages/pt_PT.json'; -import dedeMessages from './messages/de_DE.json'; -import hiMessages from './messages/hi.json'; import heMessages from './messages/he.json'; +import hiMessages from './messages/hi.json'; import idMessages from './messages/id.json'; +import ititMessages from './messages/it_IT.json'; import kokrMessages from './messages/ko_kr.json'; import plMessages from './messages/pl.json'; import ptbrMessages from './messages/pt_br.json'; +import ptptMessages from './messages/pt_PT.json'; import ruMessages from './messages/ru.json'; import thMessages from './messages/th.json'; import ukMessages from './messages/uk.json'; +import zhcnMessages from './messages/zh_CN.json'; const messages = { ar: arMessages, diff --git a/src/index.jsx b/src/index.jsx index 4a810beb..ba246795 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,15 +1,16 @@ import 'core-js/stable'; import 'regenerator-runtime/runtime'; -import { - APP_INIT_ERROR, APP_READY, subscribe, initialize, mergeConfig, -} from '@edx/frontend-platform'; -import { ErrorPage } from '@edx/frontend-platform/react'; import React from 'react'; import ReactDOM from 'react-dom'; -import MainApp from './MainApp'; +import { + APP_INIT_ERROR, APP_READY, initialize, mergeConfig, subscribe, +} from '@edx/frontend-platform'; +import { ErrorPage } from '@edx/frontend-platform/react'; + import messages from './i18n'; +import MainApp from './MainApp'; subscribe(APP_READY, () => { ReactDOM.render( diff --git a/src/login/ChangePasswordPrompt.jsx b/src/login/ChangePasswordPrompt.jsx index 162728c7..765e1bc8 100644 --- a/src/login/ChangePasswordPrompt.jsx +++ b/src/login/ChangePasswordPrompt.jsx @@ -1,19 +1,18 @@ import React, { useState } from 'react'; -import classNames from 'classnames'; -import { Link, Redirect } from 'react-router-dom'; -import PropTypes from 'prop-types'; - import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { ActionRow, ModalDialog, useToggle, } from '@edx/paragon'; +import classNames from 'classnames'; +import PropTypes from 'prop-types'; +import { Link, Redirect } from 'react-router-dom'; -import messages from './messages'; import { DEFAULT_REDIRECT_URL, RESET_PAGE } from '../data/constants'; import { updatePathWithQueryParams } from '../data/utils'; import useMobileResponsive from '../data/utils/useMobileResponsive'; +import messages from './messages'; const ChangePasswordPrompt = ({ intl, variant, redirectUrl }) => { const isMobileView = useMobileResponsive(); diff --git a/src/login/LoginFailure.jsx b/src/login/LoginFailure.jsx index 820b3bbd..c1b224f3 100644 --- a/src/login/LoginFailure.jsx +++ b/src/login/LoginFailure.jsx @@ -1,12 +1,13 @@ import React from 'react'; -import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getAuthService } from '@edx/frontend-platform/auth'; +import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Alert, Hyperlink } from '@edx/paragon'; import { Error } from '@edx/paragon/icons'; import PropTypes from 'prop-types'; import processLink from '../data/utils'; +import ChangePasswordPrompt from './ChangePasswordPrompt'; import { ACCOUNT_LOCKED_OUT, FAILED_LOGIN_ATTEMPT, @@ -20,7 +21,6 @@ import { REQUIRE_PASSWORD_CHANGE, } from './data/constants'; import messages from './messages'; -import ChangePasswordPrompt from './ChangePasswordPrompt'; const LoginFailureMessage = (props) => { const { intl } = props; diff --git a/src/login/LoginPage.jsx b/src/login/LoginPage.jsx index 90c88e67..b729067d 100644 --- a/src/login/LoginPage.jsx +++ b/src/login/LoginPage.jsx @@ -1,10 +1,5 @@ import React from 'react'; - -import PropTypes from 'prop-types'; -import { Helmet } from 'react-helmet'; -import Skeleton from 'react-loading-skeleton'; import { connect } from 'react-redux'; -import { Link } from 'react-router-dom'; import { getConfig } from '@edx/frontend-platform'; import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; @@ -13,17 +8,14 @@ import { Form, Hyperlink, Icon, StatefulButton, } from '@edx/paragon'; import { Institution } from '@edx/paragon/icons'; - -import AccountActivationMessage from './AccountActivationMessage'; -import { loginRequest, loginRequestFailure, loginRequestReset } from './data/actions'; -import { INVALID_FORM } from './data/constants'; -import { loginErrorSelector, loginRequestSelector } from './data/selectors'; -import LoginFailureMessage from './LoginFailure'; -import messages from './messages'; +import PropTypes from 'prop-types'; +import { Helmet } from 'react-helmet'; +import Skeleton from 'react-loading-skeleton'; +import { Link } from 'react-router-dom'; import { - RedirectLogistration, SocialAuthProviders, ThirdPartyAuthAlert, RenderInstitutionButton, - InstitutionLogistration, FormGroup, PasswordField, + FormGroup, InstitutionLogistration, PasswordField, RedirectLogistration, + RenderInstitutionButton, SocialAuthProviders, ThirdPartyAuthAlert, } from '../common-components'; import { getThirdPartyAuthContext } from '../common-components/data/actions'; import { thirdPartyAuthContextSelector } from '../common-components/data/selectors'; @@ -32,16 +24,22 @@ import { DEFAULT_STATE, ENTERPRISE_LOGIN_URL, PENDING_STATE, RESET_PAGE, } from '../data/constants'; import { - getTpaHint, - getTpaProvider, - windowScrollTo, - setSurveyCookie, getActivationStatus, getAllPossibleQueryParam, + getTpaHint, + getTpaProvider, + setSurveyCookie, updatePathWithQueryParams, + windowScrollTo, } from '../data/utils'; import { forgotPasswordResultSelector } from '../forgot-password'; import ResetPasswordSuccess from '../reset-password/ResetPasswordSuccess'; +import AccountActivationMessage from './AccountActivationMessage'; +import { loginRequest, loginRequestFailure, loginRequestReset } from './data/actions'; +import { INVALID_FORM } from './data/constants'; +import { loginErrorSelector, loginRequestSelector } from './data/selectors'; +import LoginFailureMessage from './LoginFailure'; +import messages from './messages'; class LoginPage extends React.Component { constructor(props, context) { diff --git a/src/login/data/reducers.js b/src/login/data/reducers.js index 3937f95a..e18a97ef 100644 --- a/src/login/data/reducers.js +++ b/src/login/data/reducers.js @@ -1,7 +1,6 @@ -import { LOGIN_REQUEST } from './actions'; - import { DEFAULT_STATE, PENDING_STATE } from '../../data/constants'; import { RESET_PASSWORD } from '../../reset-password'; +import { LOGIN_REQUEST } from './actions'; export const defaultState = { loginError: null, diff --git a/src/login/data/sagas.js b/src/login/data/sagas.js index 825ed738..58f1f361 100644 --- a/src/login/data/sagas.js +++ b/src/login/data/sagas.js @@ -1,18 +1,14 @@ -import { call, put, takeEvery } from 'redux-saga/effects'; - import { camelCaseObject } from '@edx/frontend-platform'; import { logError, logInfo } from '@edx/frontend-platform/logging'; -import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from './constants'; +import { call, put, takeEvery } from 'redux-saga/effects'; -// Actions import { LOGIN_REQUEST, loginRequestBegin, loginRequestFailure, loginRequestSuccess, } from './actions'; - -// Services +import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from './constants'; import { loginRequest, } from './service'; diff --git a/src/login/data/service.js b/src/login/data/service.js index cf43a832..c9870b10 100644 --- a/src/login/data/service.js +++ b/src/login/data/service.js @@ -1,5 +1,5 @@ -import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; import { getConfig } from '@edx/frontend-platform'; +import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; import * as QueryString from 'query-string'; // eslint-disable-next-line import/prefer-default-export diff --git a/src/login/data/tests/sagas.test.js b/src/login/data/tests/sagas.test.js index 377caf27..3883d741 100644 --- a/src/login/data/tests/sagas.test.js +++ b/src/login/data/tests/sagas.test.js @@ -1,12 +1,11 @@ +import { camelCaseObject } from '@edx/frontend-platform'; import { runSaga } from 'redux-saga'; -import { camelCaseObject } from '@edx/frontend-platform'; - -import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from '../constants'; +import initializeMockLogging from '../../../setupTest'; import * as actions from '../actions'; +import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from '../constants'; import { handleLoginRequest } from '../sagas'; import * as api from '../service'; -import initializeMockLogging from '../../../setupTest'; const { loggingService } = initializeMockLogging(); diff --git a/src/login/tests/AccountActivationMessage.test.jsx b/src/login/tests/AccountActivationMessage.test.jsx index 6caf0afb..740f270b 100644 --- a/src/login/tests/AccountActivationMessage.test.jsx +++ b/src/login/tests/AccountActivationMessage.test.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import { mount } from 'enzyme'; import { mergeConfig } from '@edx/frontend-platform'; import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; import AccountActivationMessage from '../AccountActivationMessage'; import { ACCOUNT_ACTIVATION_MESSAGE } from '../data/constants'; diff --git a/src/login/tests/ChangePasswordPrompt.test.jsx b/src/login/tests/ChangePasswordPrompt.test.jsx index 3803e0ed..4ec28b45 100644 --- a/src/login/tests/ChangePasswordPrompt.test.jsx +++ b/src/login/tests/ChangePasswordPrompt.test.jsx @@ -1,15 +1,14 @@ import React from 'react'; -import { createMemoryHistory } from 'history'; -import { act } from 'react-dom/test-utils'; -import { mount } from 'enzyme'; -import { MemoryRouter, Router } from 'react-router-dom'; - import { getConfig } from '@edx/frontend-platform'; import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { createMemoryHistory } from 'history'; +import { act } from 'react-dom/test-utils'; +import { MemoryRouter, Router } from 'react-router-dom'; -import ChangePasswordPrompt from '../ChangePasswordPrompt'; import { RESET_PAGE } from '../../data/constants'; +import ChangePasswordPrompt from '../ChangePasswordPrompt'; const IntlChangePasswordPrompt = injectIntl(ChangePasswordPrompt); const history = createMemoryHistory(); diff --git a/src/login/tests/LoginFailure.test.jsx b/src/login/tests/LoginFailure.test.jsx index 0965639f..1e0279ee 100644 --- a/src/login/tests/LoginFailure.test.jsx +++ b/src/login/tests/LoginFailure.test.jsx @@ -1,22 +1,22 @@ import React from 'react'; + +import * as auth from '@edx/frontend-platform/auth'; +import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; import { mount } from 'enzyme'; import { MemoryRouter } from 'react-router-dom'; -import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; -import * as auth from '@edx/frontend-platform/auth'; - -import LoginFailureMessage from '../LoginFailure'; import { + FAILED_LOGIN_ATTEMPT, FORBIDDEN_REQUEST, INACTIVE_USER, + INCORRECT_EMAIL_PASSWORD, INTERNAL_SERVER_ERROR, INVALID_FORM, NON_COMPLIANT_PASSWORD_EXCEPTION, - FAILED_LOGIN_ATTEMPT, - INCORRECT_EMAIL_PASSWORD, NUDGE_PASSWORD_CHANGE, REQUIRE_PASSWORD_CHANGE, } from '../data/constants'; +import LoginFailureMessage from '../LoginFailure'; jest.mock('@edx/frontend-platform/auth'); auth.getAuthService = jest.fn(); diff --git a/src/login/tests/LoginPage.test.jsx b/src/login/tests/LoginPage.test.jsx index e7cea8c0..b3b2407f 100644 --- a/src/login/tests/LoginPage.test.jsx +++ b/src/login/tests/LoginPage.test.jsx @@ -1,23 +1,21 @@ import React from 'react'; - -import { mount } from 'enzyme'; -import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; -import { MemoryRouter } from 'react-router-dom'; -import renderer from 'react-test-renderer'; import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner'; import { getConfig, mergeConfig } from '@edx/frontend-platform'; import * as analytics from '@edx/frontend-platform/analytics'; import * as auth from '@edx/frontend-platform/auth'; -import { IntlProvider, injectIntl } from '@edx/frontend-platform/i18n'; +import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { MemoryRouter } from 'react-router-dom'; +import renderer from 'react-test-renderer'; +import configureStore from 'redux-mock-store'; +import { COMPLETE_STATE, PENDING_STATE } from '../../data/constants'; import { loginRequest, loginRequestFailure, loginRequestReset } from '../data/actions'; import LoginFailureMessage from '../LoginFailure'; import LoginPage from '../LoginPage'; -import { COMPLETE_STATE, PENDING_STATE } from '../../data/constants'; - jest.mock('@edx/frontend-platform/analytics'); jest.mock('@edx/frontend-platform/auth'); diff --git a/src/register/CountryDropdown.jsx b/src/register/CountryDropdown.jsx index 751e9ef2..ed64e4ac 100644 --- a/src/register/CountryDropdown.jsx +++ b/src/register/CountryDropdown.jsx @@ -1,8 +1,10 @@ import React from 'react'; + import { Icon, IconButton } from '@edx/paragon'; -import { ExpandMore, ExpandLess } from '@edx/paragon/icons'; -import onClickOutside from 'react-onclickoutside'; +import { ExpandLess, ExpandMore } from '@edx/paragon/icons'; import PropTypes from 'prop-types'; +import onClickOutside from 'react-onclickoutside'; + import { FormGroup } from '../common-components'; import { FORM_SUBMISSION_ERROR } from './data/constants'; diff --git a/src/register/HonorCode.jsx b/src/register/HonorCode.jsx index ec09e822..263d7eb3 100644 --- a/src/register/HonorCode.jsx +++ b/src/register/HonorCode.jsx @@ -1,9 +1,10 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; -import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; -import { Hyperlink, Form } from '@edx/paragon'; +import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Form, Hyperlink } from '@edx/paragon'; +import PropTypes from 'prop-types'; + import messages from './messages'; const HonorCode = (props) => { diff --git a/src/register/RegistrationFailure.jsx b/src/register/RegistrationFailure.jsx index f5ce36b5..910d09d3 100644 --- a/src/register/RegistrationFailure.jsx +++ b/src/register/RegistrationFailure.jsx @@ -1,13 +1,13 @@ import React, { useEffect } from 'react'; -import PropTypes from 'prop-types'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Alert } from '@edx/paragon'; import { Error } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; +import { windowScrollTo } from '../data/utils'; import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR, TPA_SESSION_EXPIRED } from './data/constants'; import messages from './messages'; -import { windowScrollTo } from '../data/utils'; const RegistrationFailureMessage = (props) => { const { diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 53f37146..5d926ced 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -1,40 +1,22 @@ import React from 'react'; - import { connect } from 'react-redux'; -import Skeleton from 'react-loading-skeleton'; -import { Helmet } from 'react-helmet'; -import PropTypes, { string } from 'prop-types'; import { getConfig, snakeCaseObject } from '@edx/frontend-platform'; import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; import { - injectIntl, intlShape, getCountryList, getLocale, + getCountryList, getLocale, injectIntl, intlShape, } from '@edx/frontend-platform/i18n'; import { - Alert, Form, StatefulButton, Icon, + Alert, Form, Icon, StatefulButton, } from '@edx/paragon'; -import { Error, Close } from '@edx/paragon/icons'; -import FormFieldRenderer from '../field-renderer'; -import { - clearUsernameSuggestions, registerNewUser, resetRegistrationForm, fetchRealtimeValidations, -} from './data/actions'; -import { - FIELDS, FORM_SUBMISSION_ERROR, DEFAULT_SERVICE_PROVIDER_DOMAINS, DEFAULT_TOP_LEVEL_DOMAINS, COMMON_EMAIL_PROVIDERS, -} from './data/constants'; -import { - registrationErrorSelector, - registrationRequestSelector, - validationsSelector, - usernameSuggestionsSelector, -} from './data/selectors'; -import messages from './messages'; -import RegistrationFailure from './RegistrationFailure'; -import UsernameField from './UsernameField'; -import HonorCode from './HonorCode'; +import { Close, Error } from '@edx/paragon/icons'; +import PropTypes, { string } from 'prop-types'; +import { Helmet } from 'react-helmet'; +import Skeleton from 'react-loading-skeleton'; import { - RedirectLogistration, SocialAuthProviders, ThirdPartyAuthAlert, RenderInstitutionButton, - InstitutionLogistration, FormGroup, PasswordField, + FormGroup, InstitutionLogistration, PasswordField, RedirectLogistration, + RenderInstitutionButton, SocialAuthProviders, ThirdPartyAuthAlert, } from '../common-components'; import { getThirdPartyAuthContext } from '../common-components/data/actions'; import { @@ -45,14 +27,31 @@ import { } from '../common-components/data/selectors'; import EnterpriseSSO from '../common-components/EnterpriseSSO'; import { - DEFAULT_STATE, PENDING_STATE, REGISTER_PAGE, VALID_EMAIL_REGEX, LETTER_REGEX, NUMBER_REGEX, VALID_NAME_REGEX, + DEFAULT_STATE, LETTER_REGEX, NUMBER_REGEX, PENDING_STATE, REGISTER_PAGE, VALID_EMAIL_REGEX, VALID_NAME_REGEX, } from '../data/constants'; import { - getTpaProvider, getTpaHint, getAllPossibleQueryParam, setSurveyCookie, setCookie, + getAllPossibleQueryParam, getTpaHint, getTpaProvider, setCookie, setSurveyCookie, } from '../data/utils'; +import FormFieldRenderer from '../field-renderer'; import CountryDropdown from './CountryDropdown'; -import { getLevenshteinSuggestion, getSuggestionForInvalidEmail } from './utils'; +import { + clearUsernameSuggestions, fetchRealtimeValidations, registerNewUser, resetRegistrationForm, +} from './data/actions'; +import { + COMMON_EMAIL_PROVIDERS, DEFAULT_SERVICE_PROVIDER_DOMAINS, DEFAULT_TOP_LEVEL_DOMAINS, FIELDS, FORM_SUBMISSION_ERROR, +} from './data/constants'; +import { + registrationErrorSelector, + registrationRequestSelector, + usernameSuggestionsSelector, + validationsSelector, +} from './data/selectors'; +import HonorCode from './HonorCode'; +import messages from './messages'; +import RegistrationFailure from './RegistrationFailure'; import TermsOfService from './TermsOfService'; +import UsernameField from './UsernameField'; +import { getLevenshteinSuggestion, getSuggestionForInvalidEmail } from './utils'; class RegistrationPage extends React.Component { constructor(props, context) { diff --git a/src/register/TermsOfService.jsx b/src/register/TermsOfService.jsx index a4a20dff..7696d9ec 100644 --- a/src/register/TermsOfService.jsx +++ b/src/register/TermsOfService.jsx @@ -1,9 +1,10 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; -import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; -import { Hyperlink, Form } from '@edx/paragon'; +import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Form, Hyperlink } from '@edx/paragon'; +import PropTypes from 'prop-types'; + import messages from './messages'; const TermsOfService = (props) => { diff --git a/src/register/UsernameField.jsx b/src/register/UsernameField.jsx index a135ccad..670df0a3 100644 --- a/src/register/UsernameField.jsx +++ b/src/register/UsernameField.jsx @@ -1,9 +1,9 @@ import React from 'react'; -import PropTypes, { string } from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { Button, IconButton, Icon } from '@edx/paragon'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Button, Icon, IconButton } from '@edx/paragon'; import { Close } from '@edx/paragon/icons'; +import PropTypes, { string } from 'prop-types'; import { FormGroup } from '../common-components'; import messages from './messages'; diff --git a/src/register/data/reducers.js b/src/register/data/reducers.js index b53a63d7..873d0dc6 100644 --- a/src/register/data/reducers.js +++ b/src/register/data/reducers.js @@ -1,14 +1,13 @@ -import { - REGISTRATION_FORM, - REGISTER_NEW_USER, - REGISTER_FORM_VALIDATIONS, - REGISTER_CLEAR_USERNAME_SUGGESTIONS, -} from './actions'; - import { DEFAULT_STATE, PENDING_STATE, } from '../../data/constants'; +import { + REGISTER_CLEAR_USERNAME_SUGGESTIONS, + REGISTER_FORM_VALIDATIONS, + REGISTER_NEW_USER, + REGISTRATION_FORM, +} from './actions'; export const defaultState = { registrationError: {}, diff --git a/src/register/data/sagas.js b/src/register/data/sagas.js index 0966317a..74e9e591 100644 --- a/src/register/data/sagas.js +++ b/src/register/data/sagas.js @@ -1,22 +1,18 @@ -import { call, put, takeEvery } from 'redux-saga/effects'; - import { camelCaseObject } from '@edx/frontend-platform'; import { logError, logInfo } from '@edx/frontend-platform/logging'; +import { call, put, takeEvery } from 'redux-saga/effects'; -// Actions import { + fetchRealtimeValidationsBegin, + fetchRealtimeValidationsFailure, + fetchRealtimeValidationsSuccess, + REGISTER_FORM_VALIDATIONS, REGISTER_NEW_USER, registerNewUserBegin, registerNewUserFailure, registerNewUserSuccess, - REGISTER_FORM_VALIDATIONS, - fetchRealtimeValidationsBegin, - fetchRealtimeValidationsSuccess, - fetchRealtimeValidationsFailure, } from './actions'; import { INTERNAL_SERVER_ERROR } from './constants'; - -// Services import { getFieldsValidations, registerRequest } from './service'; export function* handleNewUserRegistration(action) { diff --git a/src/register/data/selectors.js b/src/register/data/selectors.js index 52969d72..34da0a6a 100644 --- a/src/register/data/selectors.js +++ b/src/register/data/selectors.js @@ -1,4 +1,5 @@ import { createSelector } from 'reselect'; + import { FORM_FIELDS } from './constants'; export const storeName = 'register'; diff --git a/src/register/data/service.js b/src/register/data/service.js index 77849c66..36229016 100644 --- a/src/register/data/service.js +++ b/src/register/data/service.js @@ -1,5 +1,5 @@ import { getConfig } from '@edx/frontend-platform'; -import { getHttpClient, getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; +import { getAuthenticatedHttpClient, getHttpClient } from '@edx/frontend-platform/auth'; import * as QueryString from 'query-string'; export async function registerRequest(registrationInformation) { diff --git a/src/register/data/tests/reducers.test.js b/src/register/data/tests/reducers.test.js index a92acc07..33995003 100644 --- a/src/register/data/tests/reducers.test.js +++ b/src/register/data/tests/reducers.test.js @@ -1,8 +1,8 @@ -import reducer from '../reducers'; +import { DEFAULT_STATE } from '../../../data/constants'; import { REGISTER_CLEAR_USERNAME_SUGGESTIONS, REGISTER_FORM_VALIDATIONS, REGISTER_NEW_USER, } from '../actions'; -import { DEFAULT_STATE } from '../../../data/constants'; +import reducer from '../reducers'; describe('register reducer', () => { it('should return the initial state', () => { diff --git a/src/register/data/tests/sagas.test.js b/src/register/data/tests/sagas.test.js index 9fb7e448..bf6e1e47 100644 --- a/src/register/data/tests/sagas.test.js +++ b/src/register/data/tests/sagas.test.js @@ -1,14 +1,14 @@ +import { camelCaseObject } from '@edx/frontend-platform'; import { runSaga } from 'redux-saga'; -import { camelCaseObject } from '@edx/frontend-platform'; +import initializeMockLogging from '../../../setupTest'; import * as actions from '../actions'; +import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from '../constants'; import { fetchRealtimeValidations, handleNewUserRegistration, } from '../sagas'; import * as api from '../service'; -import initializeMockLogging from '../../../setupTest'; -import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from '../constants'; const { loggingService } = initializeMockLogging(); diff --git a/src/register/tests/HonorCode.test.jsx b/src/register/tests/HonorCode.test.jsx index 8e590e12..71d7e108 100644 --- a/src/register/tests/HonorCode.test.jsx +++ b/src/register/tests/HonorCode.test.jsx @@ -1,8 +1,9 @@ import React from 'react'; + +import { mergeConfig } from '@edx/frontend-platform'; +import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; import { mount } from 'enzyme'; -import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; -import { mergeConfig } from '@edx/frontend-platform'; import HonorCode from '../HonorCode'; const IntlHonorCode = injectIntl(HonorCode); diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx index 0424ece4..1603b714 100644 --- a/src/register/tests/RegistrationPage.test.jsx +++ b/src/register/tests/RegistrationPage.test.jsx @@ -1,16 +1,16 @@ import React from 'react'; - -import { mount } from 'enzyme'; -import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; -import renderer from 'react-test-renderer'; import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner'; import { getConfig, mergeConfig } from '@edx/frontend-platform'; import * as analytics from '@edx/frontend-platform/analytics'; -import { IntlProvider, injectIntl, configure } from '@edx/frontend-platform/i18n'; +import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; import { MemoryRouter } from 'react-router-dom'; +import renderer from 'react-test-renderer'; +import configureStore from 'redux-mock-store'; +import { COMPLETE_STATE, PENDING_STATE, WELCOME_PAGE } from '../../data/constants'; import { clearUsernameSuggestions, fetchRealtimeValidations, @@ -23,8 +23,6 @@ import { import RegistrationFailureMessage from '../RegistrationFailure'; import RegistrationPage from '../RegistrationPage'; -import { COMPLETE_STATE, PENDING_STATE, WELCOME_PAGE } from '../../data/constants'; - jest.mock('@edx/frontend-platform/analytics'); analytics.sendTrackEvent = jest.fn(); diff --git a/src/register/tests/TermsOfService.test.jsx b/src/register/tests/TermsOfService.test.jsx index 3a71b01e..ed70e189 100644 --- a/src/register/tests/TermsOfService.test.jsx +++ b/src/register/tests/TermsOfService.test.jsx @@ -1,8 +1,9 @@ import React from 'react'; + +import { mergeConfig } from '@edx/frontend-platform'; +import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; import { mount } from 'enzyme'; -import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; -import { mergeConfig } from '@edx/frontend-platform'; import TermsOfService from '../TermsOfService'; const IntlTermsOfService = injectIntl(TermsOfService); diff --git a/src/register/utils.js b/src/register/utils.js index 9eca1039..98562bb5 100644 --- a/src/register/utils.js +++ b/src/register/utils.js @@ -1,4 +1,5 @@ import { distance } from 'fastest-levenshtein'; + import { COMMON_EMAIL_PROVIDERS } from './data/constants'; export function getLevenshteinSuggestion(word, knownWords, similarityThreshold = 4) { diff --git a/src/reset-password/ResetPasswordFailure.jsx b/src/reset-password/ResetPasswordFailure.jsx index 06a96270..e196a1b2 100644 --- a/src/reset-password/ResetPasswordFailure.jsx +++ b/src/reset-password/ResetPasswordFailure.jsx @@ -1,12 +1,11 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Alert } from '@edx/paragon'; import { Error } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; import { FORM_SUBMISSION_ERROR, PASSWORD_RESET, PASSWORD_VALIDATION_ERROR } from './data/constants'; - import messages from './messages'; const ResetPasswordFailure = (props) => { diff --git a/src/reset-password/ResetPasswordPage.jsx b/src/reset-password/ResetPasswordPage.jsx index d629de55..2d33a230 100644 --- a/src/reset-password/ResetPasswordPage.jsx +++ b/src/reset-password/ResetPasswordPage.jsx @@ -1,35 +1,35 @@ import React, { useEffect, useState } from 'react'; -import PropTypes from 'prop-types'; -import { Helmet } from 'react-helmet'; import { connect } from 'react-redux'; -import { Redirect } from 'react-router-dom'; +import { getConfig, getQueryParameters } from '@edx/frontend-platform'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Form, + Icon, Spinner, StatefulButton, - Tabs, Tab, - Icon, + Tabs, } from '@edx/paragon'; import { ChevronLeft } from '@edx/paragon/icons'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { getQueryParameters, getConfig } from '@edx/frontend-platform'; +import PropTypes from 'prop-types'; +import { Helmet } from 'react-helmet'; +import { Redirect } from 'react-router-dom'; -import messages from './messages'; -import { resetPassword, validateToken } from './data/actions'; -import { resetPasswordResultSelector } from './data/selectors'; -import { validatePassword } from './data/service'; -import ResetPasswordFailure from './ResetPasswordFailure'; +import BaseComponent from '../base-component'; import { PasswordField } from '../common-components'; import { LETTER_REGEX, LOGIN_PAGE, NUMBER_REGEX, RESET_PAGE, } from '../data/constants'; +import { updatePathWithQueryParams, windowScrollTo } from '../data/utils'; +import { resetPassword, validateToken } from './data/actions'; import { FORM_SUBMISSION_ERROR, PASSWORD_RESET_ERROR, PASSWORD_VALIDATION_ERROR, TOKEN_STATE, } from './data/constants'; -import { updatePathWithQueryParams, windowScrollTo } from '../data/utils'; -import BaseComponent from '../base-component'; +import { resetPasswordResultSelector } from './data/selectors'; +import { validatePassword } from './data/service'; +import messages from './messages'; +import ResetPasswordFailure from './ResetPasswordFailure'; const ResetPasswordPage = (props) => { const { intl } = props; diff --git a/src/reset-password/data/reducers.js b/src/reset-password/data/reducers.js index 554bcb2d..e1ea75fa 100644 --- a/src/reset-password/data/reducers.js +++ b/src/reset-password/data/reducers.js @@ -1,4 +1,4 @@ -import { RESET_PASSWORD, VALIDATE_TOKEN, PASSWORD_RESET_FAILURE } from './actions'; +import { PASSWORD_RESET_FAILURE, RESET_PASSWORD, VALIDATE_TOKEN } from './actions'; import { PASSWORD_RESET_ERROR, TOKEN_STATE } from './constants'; export const defaultState = { diff --git a/src/reset-password/data/sagas.js b/src/reset-password/data/sagas.js index ea10b174..185670e2 100644 --- a/src/reset-password/data/sagas.js +++ b/src/reset-password/data/sagas.js @@ -1,20 +1,18 @@ -import { call, put, takeEvery } from 'redux-saga/effects'; import { logError, logInfo } from '@edx/frontend-platform/logging'; +import { call, put, takeEvery } from 'redux-saga/effects'; -// Actions import { + passwordResetFailure, + RESET_PASSWORD, + resetPasswordBegin, + resetPasswordFailure, + resetPasswordSuccess, VALIDATE_TOKEN, validateTokenBegin, validateTokenSuccess, - RESET_PASSWORD, - resetPasswordBegin, - resetPasswordSuccess, - resetPasswordFailure, - passwordResetFailure, } from './actions'; - -import { validateToken, resetPassword } from './service'; import { PASSWORD_RESET, PASSWORD_VALIDATION_ERROR } from './constants'; +import { resetPassword, validateToken } from './service'; // Services export function* handleValidateToken(action) { diff --git a/src/reset-password/data/tests/sagas.test.js b/src/reset-password/data/tests/sagas.test.js index f156d334..48618572 100644 --- a/src/reset-password/data/tests/sagas.test.js +++ b/src/reset-password/data/tests/sagas.test.js @@ -1,17 +1,16 @@ import { runSaga } from 'redux-saga'; +import initializeMockLogging from '../../../setupTest'; import { + passwordResetFailure, resetPasswordBegin, - resetPasswordSuccess, - validateTokenBegin, - passwordResetFailure, resetPasswordFailure, + resetPasswordFailure, + resetPasswordSuccess, validateTokenBegin, } from '../actions'; import { PASSWORD_RESET } from '../constants'; import { handleResetPassword, handleValidateToken } from '../sagas'; import * as api from '../service'; -import initializeMockLogging from '../../../setupTest'; - const { loggingService } = initializeMockLogging(); describe('handleResetPassword', () => { diff --git a/src/reset-password/tests/ResetPasswordPage.test.jsx b/src/reset-password/tests/ResetPasswordPage.test.jsx index ce8ab709..2179b41f 100644 --- a/src/reset-password/tests/ResetPasswordPage.test.jsx +++ b/src/reset-password/tests/ResetPasswordPage.test.jsx @@ -1,19 +1,18 @@ import React from 'react'; - -import { act } from 'react-dom/test-utils'; -import { mount } from 'enzyme'; -import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; -import { MemoryRouter, Router } from 'react-router-dom'; -import { createMemoryHistory } from 'history'; -import * as auth from '@edx/frontend-platform/auth'; import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner'; -import { IntlProvider, injectIntl, configure } from '@edx/frontend-platform/i18n'; +import * as auth from '@edx/frontend-platform/auth'; +import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { createMemoryHistory } from 'history'; +import { act } from 'react-dom/test-utils'; +import { MemoryRouter, Router } from 'react-router-dom'; +import configureStore from 'redux-mock-store'; +import { LOGIN_PAGE } from '../../data/constants'; import { resetPassword } from '../data/actions'; import { PASSWORD_RESET, TOKEN_STATE } from '../data/constants'; -import { LOGIN_PAGE } from '../../data/constants'; import ResetPasswordPage from '../ResetPasswordPage'; jest.mock('@edx/frontend-platform/auth'); diff --git a/src/setupTest.js b/src/setupTest.js index dd28bfd5..7174cddf 100755 --- a/src/setupTest.js +++ b/src/setupTest.js @@ -1,10 +1,9 @@ /* eslint-disable import/no-extraneous-dependencies */ -import Enzyme from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - import { getConfig } from '@edx/frontend-platform'; import { configure as configureLogging } from '@edx/frontend-platform/logging'; +import Enzyme from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; Enzyme.configure({ adapter: new Adapter() }); class MockLoggingService { diff --git a/src/welcome/ProgressiveProfiling.jsx b/src/welcome/ProgressiveProfiling.jsx index ea5bcc7f..3e0d2e2c 100644 --- a/src/welcome/ProgressiveProfiling.jsx +++ b/src/welcome/ProgressiveProfiling.jsx @@ -1,39 +1,37 @@ -import React, { useState, useEffect } from 'react'; - -import PropTypes from 'prop-types'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Helmet } from 'react-helmet'; import { getConfig, snakeCaseObject } from '@edx/frontend-platform'; import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; import { - configure as configureAuth, AxiosJwtAuthService, + configure as configureAuth, ensureAuthenticatedUser, - hydrateAuthenticatedUser, getAuthenticatedUser, + hydrateAuthenticatedUser, } from '@edx/frontend-platform/auth'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getLoggingService } from '@edx/frontend-platform/logging'; import { Alert, Form, - StatefulButton, Hyperlink, + StatefulButton, } from '@edx/paragon'; import { Error } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; +import { Helmet } from 'react-helmet'; -import { saveUserProfile } from './data/actions'; -import { welcomePageSelector } from './data/selectors'; -import messages from './messages'; - +import BaseComponent from '../base-component'; import { RedirectLogistration } from '../common-components'; import { DEFAULT_REDIRECT_URL, DEFAULT_STATE, FAILURE_STATE, } from '../data/constants'; import FormFieldRenderer from '../field-renderer'; +import { saveUserProfile } from './data/actions'; +import { welcomePageSelector } from './data/selectors'; +import messages from './messages'; import WelcomePageModal from './WelcomePageModal'; -import BaseComponent from '../base-component'; const ProgressiveProfiling = (props) => { const { diff --git a/src/welcome/WelcomePage.jsx b/src/welcome/WelcomePage.jsx index 9790654d..f351ff53 100644 --- a/src/welcome/WelcomePage.jsx +++ b/src/welcome/WelcomePage.jsx @@ -1,38 +1,36 @@ -import React, { useState, useEffect } from 'react'; - -import PropTypes from 'prop-types'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Helmet } from 'react-helmet'; import { getConfig, snakeCaseObject } from '@edx/frontend-platform'; import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; import { - configure as configureAuth, AxiosJwtAuthService, + configure as configureAuth, ensureAuthenticatedUser, - hydrateAuthenticatedUser, getAuthenticatedUser, + hydrateAuthenticatedUser, } from '@edx/frontend-platform/auth'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { getLoggingService } from '@edx/frontend-platform/logging'; import { Alert, Form, - StatefulButton, Hyperlink, Icon, + StatefulButton, } from '@edx/paragon'; -import { ExpandMore, Error } from '@edx/paragon/icons'; - -import { saveUserProfile } from './data/actions'; -import { welcomePageSelector } from './data/selectors'; -import messages from './messages'; +import { Error, ExpandMore } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; +import { Helmet } from 'react-helmet'; +import BaseComponent from '../base-component'; import { RedirectLogistration } from '../common-components'; import { DEFAULT_REDIRECT_URL, DEFAULT_STATE } from '../data/constants'; import { EDUCATION_LEVELS, GENDER_OPTIONS, YEAR_OF_BIRTH_OPTIONS } from '../register/data/constants'; +import { saveUserProfile } from './data/actions'; +import { welcomePageSelector } from './data/selectors'; +import messages from './messages'; import WelcomePageModal from './WelcomePageModal'; -import BaseComponent from '../base-component'; const WelcomePage = (props) => { const { intl, submitState, showError } = props; diff --git a/src/welcome/WelcomePageModal.jsx b/src/welcome/WelcomePageModal.jsx index e138fae3..08e1f302 100644 --- a/src/welcome/WelcomePageModal.jsx +++ b/src/welcome/WelcomePageModal.jsx @@ -1,10 +1,10 @@ import React from 'react'; -import PropTypes from 'prop-types'; - import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { ActionRow, Button, ModalDialog } from '@edx/paragon'; +import PropTypes from 'prop-types'; + import messages from './messages'; const WelcomePageModal = (props) => { diff --git a/src/welcome/data/reducers.js b/src/welcome/data/reducers.js index 493a9672..4a5251c1 100644 --- a/src/welcome/data/reducers.js +++ b/src/welcome/data/reducers.js @@ -1,7 +1,7 @@ -import { SAVE_USER_PROFILE } from './actions'; import { DEFAULT_STATE, PENDING_STATE, } from '../../data/constants'; +import { SAVE_USER_PROFILE } from './actions'; export const defaultState = { extendedProfile: [], diff --git a/src/welcome/data/sagas.js b/src/welcome/data/sagas.js index 224c50ed..fc7a3c07 100644 --- a/src/welcome/data/sagas.js +++ b/src/welcome/data/sagas.js @@ -6,7 +6,6 @@ import { saveUserProfileFailure, saveUserProfileSuccess, } from './actions'; - import { patchAccount } from './service'; export function* saveUserProfileInformation(action) { diff --git a/src/welcome/tests/ProgressiveProfiling.test.jsx b/src/welcome/tests/ProgressiveProfiling.test.jsx index 08875b01..8fefe404 100644 --- a/src/welcome/tests/ProgressiveProfiling.test.jsx +++ b/src/welcome/tests/ProgressiveProfiling.test.jsx @@ -1,21 +1,20 @@ import React from 'react'; - -import { mount } from 'enzyme'; -import { act } from 'react-dom/test-utils'; import { Provider } from 'react-redux'; -import configureStore from 'redux-mock-store'; import { getConfig, mergeConfig } from '@edx/frontend-platform'; import * as analytics from '@edx/frontend-platform/analytics'; import * as auth from '@edx/frontend-platform/auth'; +import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; import * as logging from '@edx/frontend-platform/logging'; -import { injectIntl, IntlProvider, configure } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; +import configureStore from 'redux-mock-store'; -import { saveUserProfile } from '../data/actions'; -import ProgressiveProfiling from '../ProgressiveProfiling'; import { COMPLETE_STATE, DEFAULT_REDIRECT_URL, FAILURE_STATE, } from '../../data/constants'; +import { saveUserProfile } from '../data/actions'; +import ProgressiveProfiling from '../ProgressiveProfiling'; const IntlProgressiveProfilingPage = injectIntl(ProgressiveProfiling); const mockStore = configureStore(); diff --git a/src/welcome/tests/WelcomePage.test.jsx b/src/welcome/tests/WelcomePage.test.jsx index c649b2c8..1c2846e4 100644 --- a/src/welcome/tests/WelcomePage.test.jsx +++ b/src/welcome/tests/WelcomePage.test.jsx @@ -1,14 +1,13 @@ import React from 'react'; - -import { mount } from 'enzyme'; -import { act } from 'react-dom/test-utils'; import { Provider } from 'react-redux'; -import configureStore from 'redux-mock-store'; import { mergeConfig } from '@edx/frontend-platform'; import * as analytics from '@edx/frontend-platform/analytics'; import * as auth from '@edx/frontend-platform/auth'; -import { injectIntl, IntlProvider, configure } from '@edx/frontend-platform/i18n'; +import { configure, injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; +import { mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; +import configureStore from 'redux-mock-store'; import { saveUserProfile } from '../data/actions'; import WelcomePage from '../WelcomePage'; @@ -23,8 +22,8 @@ analytics.sendTrackEvent = jest.fn(); analytics.sendPageEvent = jest.fn(); auth.configure = jest.fn(); -auth.ensureAuthenticatedUser = jest.fn().mockImplementation(() => Promise.resolve((true))); -auth.hydrateAuthenticatedUser = jest.fn().mockImplementation(() => Promise.resolve((true))); +auth.ensureAuthenticatedUser = jest.fn().mockImplementation(() => Promise.resolve(true)); +auth.hydrateAuthenticatedUser = jest.fn().mockImplementation(() => Promise.resolve(true)); describe('WelcomePageTests', () => { mergeConfig({