diff --git a/CHANGELOG.md b/CHANGELOG.md index e2e325ee..a6bd9990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * *Nothing* ### Changed -* Updated to Vite 4.1 +* Update to Vite 4.1 +* Update to coding standard v2.1.0 * [#798](https://github.com/shlinkio/shlink-web-client/issues/798) Remove stryker and mutation testing. ### Deprecated diff --git a/package-lock.json b/package-lock.json index 70510eb3..36ff89b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "workbox-strategies": "^6.5.4" }, "devDependencies": { - "@shlinkio/eslint-config-js-coding-standard": "~2.0.2", + "@shlinkio/eslint-config-js-coding-standard": "~2.1.0", "@shlinkio/stylelint-config-css-coding-standard": "~1.0.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", @@ -2281,9 +2281,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.0.tgz", - "integrity": "sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -2327,9 +2327,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.19.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", - "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3433,18 +3433,19 @@ } }, "node_modules/@shlinkio/eslint-config-js-coding-standard": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@shlinkio/eslint-config-js-coding-standard/-/eslint-config-js-coding-standard-2.0.2.tgz", - "integrity": "sha512-9uWuCZ32FD64EJ3JCXVlc4YR9JVeSn7q0iHjMYqYqThPrTPGFrvnYLkc/HFmPcVGA/hzbavFrGjTLF1e7i4oAA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@shlinkio/eslint-config-js-coding-standard/-/eslint-config-js-coding-standard-2.1.0.tgz", + "integrity": "sha512-nWrmNUSe8qrNJPdR+zVWVJCCQgGVKckZe9n79qDiO7zAHh9/dw9ZlZWO+Zn9aJqadMtGN1RWey3PkBIStizcMA==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.16.0", - "@typescript-eslint/parser": "^5.16.0", + "@typescript-eslint/eslint-plugin": "^5.52.0", + "@typescript-eslint/parser": "^5.52.0", "eslint-config-airbnb": "^19.0.4", - "eslint-config-airbnb-typescript": "^16.1.4" + "eslint-config-airbnb-typescript": "^16.2.0", + "eslint-plugin-simple-import-sort": "^10.0.0" }, "peerDependencies": { - "eslint": "^8.12.0" + "eslint": "^8.34.0" } }, "node_modules/@shlinkio/stylelint-config-css-coding-standard": { @@ -3891,9 +3892,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.10", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", - "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, "node_modules/@types/json2csv": { @@ -4081,6 +4082,12 @@ "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -4135,19 +4142,20 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.16.0.tgz", - "integrity": "sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz", + "integrity": "sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.16.0", - "@typescript-eslint/type-utils": "5.16.0", - "@typescript-eslint/utils": "5.16.0", - "debug": "^4.3.2", - "functional-red-black-tree": "^1.0.1", - "ignore": "^5.1.8", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/type-utils": "5.52.0", + "@typescript-eslint/utils": "5.52.0", + "debug": "^4.3.4", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", - "semver": "^7.3.5", + "semver": "^7.3.7", "tsutils": "^3.21.0" }, "engines": { @@ -4191,9 +4199,9 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -4206,15 +4214,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.16.0.tgz", - "integrity": "sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.52.0.tgz", + "integrity": "sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.16.0", - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/typescript-estree": "5.16.0", - "debug": "^4.3.2" + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", + "debug": "^4.3.4" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4256,13 +4264,13 @@ "dev": true }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.16.0.tgz", - "integrity": "sha512-P+Yab2Hovg8NekLIR/mOElCDPyGgFZKhGoZA901Yax6WR6HVeGLbsqJkZ+Cvk5nts/dAlFKm8PfL43UZnWdpIQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz", + "integrity": "sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/visitor-keys": "5.16.0" + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4273,13 +4281,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.16.0.tgz", - "integrity": "sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz", + "integrity": "sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.16.0", - "debug": "^4.3.2", + "@typescript-eslint/typescript-estree": "5.52.0", + "@typescript-eslint/utils": "5.52.0", + "debug": "^4.3.4", "tsutils": "^3.21.0" }, "engines": { @@ -4322,9 +4331,9 @@ "dev": true }, "node_modules/@typescript-eslint/types": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.16.0.tgz", - "integrity": "sha512-oUorOwLj/3/3p/HFwrp6m/J2VfbLC8gjW5X3awpQJ/bSG+YRGFS4dpsvtQ8T2VNveV+LflQHjlLvB6v0R87z4g==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.52.0.tgz", + "integrity": "sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4335,17 +4344,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.16.0.tgz", - "integrity": "sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz", + "integrity": "sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/visitor-keys": "5.16.0", - "debug": "^4.3.2", - "globby": "^11.0.4", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0", + "debug": "^4.3.4", + "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.5", + "semver": "^7.3.7", "tsutils": "^3.21.0" }, "engines": { @@ -4385,9 +4394,9 @@ "dev": true }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -4400,17 +4409,19 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.16.0.tgz", - "integrity": "sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.52.0.tgz", + "integrity": "sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.16.0", - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/typescript-estree": "5.16.0", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4423,14 +4434,29 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.16.0.tgz", - "integrity": "sha512-jqxO8msp5vZDhikTwq9ubyMHqZ67UIvawohr4qF3KhlpL7gzSjOd+8471H3nh5LyABkaI85laEKKU8SnGUK5/g==", + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.16.0", - "eslint-visitor-keys": "^3.0.0" + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz", + "integrity": "sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.52.0", + "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -6298,12 +6324,12 @@ } }, "node_modules/eslint": { - "version": "8.30.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.30.0.tgz", - "integrity": "sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ==", + "version": "8.34.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", + "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.4.0", + "@eslint/eslintrc": "^1.4.1", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -6403,9 +6429,9 @@ } }, "node_modules/eslint-config-airbnb-typescript": { - "version": "16.1.4", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-16.1.4.tgz", - "integrity": "sha512-dfm2cEaYXh4mCYd+RyJO8+PQfd5/zp8WwrCeRznly5qD9W5tal3KTjgdInYWuEAdwWnNJxWcmQ/HFiA4bfkM1g==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-16.2.0.tgz", + "integrity": "sha512-OUaMPZpTOZGKd5tXOjJ9PRU4iYNW/Z5DoHIynjsVK/FpkWdiY5+nxQW6TiJAlLwVI1l53xUOrnlZWtVBVQzuWA==", "dev": true, "dependencies": { "eslint-config-airbnb-base": "^15.0.0" @@ -6677,6 +6703,15 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -7048,12 +7083,12 @@ } }, "node_modules/estraverse": { - "version": "4.2.0", - "resolved": "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=4.0" } }, "node_modules/estree-walker": { @@ -7467,12 +7502,6 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -10943,6 +10972,12 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -13370,9 +13405,9 @@ } }, "node_modules/tslib": { - "version": "1.9.3", - "resolved": "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "node_modules/tsutils": { @@ -15951,9 +15986,9 @@ "optional": true }, "@eslint/eslintrc": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.0.tgz", - "integrity": "sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -15983,9 +16018,9 @@ } }, "globals": { - "version": "13.19.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", - "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -16788,15 +16823,16 @@ } }, "@shlinkio/eslint-config-js-coding-standard": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@shlinkio/eslint-config-js-coding-standard/-/eslint-config-js-coding-standard-2.0.2.tgz", - "integrity": "sha512-9uWuCZ32FD64EJ3JCXVlc4YR9JVeSn7q0iHjMYqYqThPrTPGFrvnYLkc/HFmPcVGA/hzbavFrGjTLF1e7i4oAA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@shlinkio/eslint-config-js-coding-standard/-/eslint-config-js-coding-standard-2.1.0.tgz", + "integrity": "sha512-nWrmNUSe8qrNJPdR+zVWVJCCQgGVKckZe9n79qDiO7zAHh9/dw9ZlZWO+Zn9aJqadMtGN1RWey3PkBIStizcMA==", "dev": true, "requires": { - "@typescript-eslint/eslint-plugin": "^5.16.0", - "@typescript-eslint/parser": "^5.16.0", + "@typescript-eslint/eslint-plugin": "^5.52.0", + "@typescript-eslint/parser": "^5.52.0", "eslint-config-airbnb": "^19.0.4", - "eslint-config-airbnb-typescript": "^16.1.4" + "eslint-config-airbnb-typescript": "^16.2.0", + "eslint-plugin-simple-import-sort": "^10.0.0" } }, "@shlinkio/stylelint-config-css-coding-standard": { @@ -17170,9 +17206,9 @@ } }, "@types/json-schema": { - "version": "7.0.10", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", - "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, "@types/json2csv": { @@ -17355,6 +17391,12 @@ "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -17409,19 +17451,20 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.16.0.tgz", - "integrity": "sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz", + "integrity": "sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.16.0", - "@typescript-eslint/type-utils": "5.16.0", - "@typescript-eslint/utils": "5.16.0", - "debug": "^4.3.2", - "functional-red-black-tree": "^1.0.1", - "ignore": "^5.1.8", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/type-utils": "5.52.0", + "@typescript-eslint/utils": "5.52.0", + "debug": "^4.3.4", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", - "semver": "^7.3.5", + "semver": "^7.3.7", "tsutils": "^3.21.0" }, "dependencies": { @@ -17441,9 +17484,9 @@ "dev": true }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -17452,15 +17495,15 @@ } }, "@typescript-eslint/parser": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.16.0.tgz", - "integrity": "sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.52.0.tgz", + "integrity": "sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.16.0", - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/typescript-estree": "5.16.0", - "debug": "^4.3.2" + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", + "debug": "^4.3.4" }, "dependencies": { "debug": { @@ -17481,23 +17524,24 @@ } }, "@typescript-eslint/scope-manager": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.16.0.tgz", - "integrity": "sha512-P+Yab2Hovg8NekLIR/mOElCDPyGgFZKhGoZA901Yax6WR6HVeGLbsqJkZ+Cvk5nts/dAlFKm8PfL43UZnWdpIQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz", + "integrity": "sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/visitor-keys": "5.16.0" + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0" } }, "@typescript-eslint/type-utils": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.16.0.tgz", - "integrity": "sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz", + "integrity": "sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.16.0", - "debug": "^4.3.2", + "@typescript-eslint/typescript-estree": "5.52.0", + "@typescript-eslint/utils": "5.52.0", + "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { @@ -17519,23 +17563,23 @@ } }, "@typescript-eslint/types": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.16.0.tgz", - "integrity": "sha512-oUorOwLj/3/3p/HFwrp6m/J2VfbLC8gjW5X3awpQJ/bSG+YRGFS4dpsvtQ8T2VNveV+LflQHjlLvB6v0R87z4g==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.52.0.tgz", + "integrity": "sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.16.0.tgz", - "integrity": "sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz", + "integrity": "sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/visitor-keys": "5.16.0", - "debug": "^4.3.2", - "globby": "^11.0.4", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0", + "debug": "^4.3.4", + "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.5", + "semver": "^7.3.7", "tsutils": "^3.21.0" }, "dependencies": { @@ -17555,9 +17599,9 @@ "dev": true }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -17566,27 +17610,40 @@ } }, "@typescript-eslint/utils": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.16.0.tgz", - "integrity": "sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.52.0.tgz", + "integrity": "sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.16.0", - "@typescript-eslint/types": "5.16.0", - "@typescript-eslint/typescript-estree": "5.16.0", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "dependencies": { + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@typescript-eslint/visitor-keys": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.16.0.tgz", - "integrity": "sha512-jqxO8msp5vZDhikTwq9ubyMHqZ67UIvawohr4qF3KhlpL7gzSjOd+8471H3nh5LyABkaI85laEKKU8SnGUK5/g==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz", + "integrity": "sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.16.0", - "eslint-visitor-keys": "^3.0.0" + "@typescript-eslint/types": "5.52.0", + "eslint-visitor-keys": "^3.3.0" } }, "@vitejs/plugin-react": { @@ -18956,12 +19013,12 @@ } }, "eslint": { - "version": "8.30.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.30.0.tgz", - "integrity": "sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ==", + "version": "8.34.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", + "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.4.0", + "@eslint/eslintrc": "^1.4.1", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -19205,9 +19262,9 @@ } }, "eslint-config-airbnb-typescript": { - "version": "16.1.4", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-16.1.4.tgz", - "integrity": "sha512-dfm2cEaYXh4mCYd+RyJO8+PQfd5/zp8WwrCeRznly5qD9W5tal3KTjgdInYWuEAdwWnNJxWcmQ/HFiA4bfkM1g==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-16.2.0.tgz", + "integrity": "sha512-OUaMPZpTOZGKd5tXOjJ9PRU4iYNW/Z5DoHIynjsVK/FpkWdiY5+nxQW6TiJAlLwVI1l53xUOrnlZWtVBVQzuWA==", "dev": true, "requires": { "eslint-config-airbnb-base": "^15.0.0" @@ -19431,6 +19488,13 @@ "peer": true, "requires": {} }, + "eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", + "dev": true, + "requires": {} + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -19516,9 +19580,9 @@ } }, "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, "estree-walker": { @@ -19852,12 +19916,6 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -22413,6 +22471,12 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -24240,9 +24304,9 @@ } }, "tslib": { - "version": "1.9.3", - "resolved": "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "tsutils": { diff --git a/package.json b/package.json index bd227d51..938b4893 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "workbox-strategies": "^6.5.4" }, "devDependencies": { - "@shlinkio/eslint-config-js-coding-standard": "~2.0.2", + "@shlinkio/eslint-config-js-coding-standard": "~2.1.0", "@shlinkio/stylelint-config-css-coding-standard": "~1.0.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", diff --git a/src/api/ShlinkApiError.tsx b/src/api/ShlinkApiError.tsx index 6b78da38..057641da 100644 --- a/src/api/ShlinkApiError.tsx +++ b/src/api/ShlinkApiError.tsx @@ -1,5 +1,5 @@ +import type { ProblemDetailsError } from './types/errors'; import { isInvalidArgumentError } from './utils'; -import { ProblemDetailsError } from './types/errors'; export interface ShlinkApiErrorProps { errorData?: ProblemDetailsError; diff --git a/src/api/services/ShlinkApiClient.ts b/src/api/services/ShlinkApiClient.ts index d3f1626b..56f1f34b 100644 --- a/src/api/services/ShlinkApiClient.ts +++ b/src/api/services/ShlinkApiClient.ts @@ -1,26 +1,26 @@ import { isEmpty, isNil, reject } from 'ramda'; -import { ShortUrl, ShortUrlData } from '../../short-urls/data'; -import { OptionalString } from '../../utils/utils'; -import { +import type { HttpClient } from '../../common/services/HttpClient'; +import type { ShortUrl, ShortUrlData } from '../../short-urls/data'; +import { orderToString } from '../../utils/helpers/ordering'; +import { stringifyQuery } from '../../utils/helpers/query'; +import type { OptionalString } from '../../utils/utils'; +import type { + ShlinkDomainRedirects, + ShlinkDomainsResponse, + ShlinkEditDomainRedirects, ShlinkHealth, ShlinkMercureInfo, + ShlinkShortUrlData, + ShlinkShortUrlsListNormalizedParams, + ShlinkShortUrlsListParams, ShlinkShortUrlsResponse, ShlinkTags, ShlinkTagsResponse, ShlinkVisits, - ShlinkVisitsParams, - ShlinkShortUrlData, - ShlinkDomainsResponse, ShlinkVisitsOverview, - ShlinkEditDomainRedirects, - ShlinkDomainRedirects, - ShlinkShortUrlsListParams, - ShlinkShortUrlsListNormalizedParams, + ShlinkVisitsParams, } from '../types'; -import { orderToString } from '../../utils/helpers/ordering'; import { isRegularNotFound, parseApiError } from '../utils'; -import { stringifyQuery } from '../../utils/helpers/query'; -import { HttpClient } from '../../common/services/HttpClient'; const buildShlinkBaseUrl = (url: string, version: 2 | 3) => `${url}/rest/v${version}`; const rejectNilProps = reject(isNil); diff --git a/src/api/services/ShlinkApiClientBuilder.ts b/src/api/services/ShlinkApiClientBuilder.ts index ef74356a..d5cae053 100644 --- a/src/api/services/ShlinkApiClientBuilder.ts +++ b/src/api/services/ShlinkApiClientBuilder.ts @@ -1,7 +1,8 @@ -import { hasServerData, ServerWithId } from '../../servers/data'; -import { GetState } from '../../container/types'; +import type { HttpClient } from '../../common/services/HttpClient'; +import type { GetState } from '../../container/types'; +import type { ServerWithId } from '../../servers/data'; +import { hasServerData } from '../../servers/data'; import { ShlinkApiClient } from './ShlinkApiClient'; -import { HttpClient } from '../../common/services/HttpClient'; const apiClients: Record = {}; diff --git a/src/api/services/provideServices.ts b/src/api/services/provideServices.ts index c8bcd854..a89e111b 100644 --- a/src/api/services/provideServices.ts +++ b/src/api/services/provideServices.ts @@ -1,8 +1,6 @@ -import Bottle from 'bottlejs'; +import type Bottle from 'bottlejs'; import { buildShlinkApiClient } from './ShlinkApiClientBuilder'; -const provideServices = (bottle: Bottle) => { +export const provideServices = (bottle: Bottle) => { bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'HttpClient'); }; - -export default provideServices; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index ef51e9b2..ddd3cd97 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,7 +1,7 @@ -import { Visit } from '../../visits/types'; -import { OptionalString } from '../../utils/utils'; -import { ShortUrl, ShortUrlMeta } from '../../short-urls/data'; -import { Order } from '../../utils/helpers/ordering'; +import type { ShortUrl, ShortUrlMeta } from '../../short-urls/data'; +import type { Order } from '../../utils/helpers/ordering'; +import type { OptionalString } from '../../utils/utils'; +import type { Visit } from '../../visits/types'; export interface ShlinkShortUrlsResponse { data: ShortUrl[]; diff --git a/src/api/utils/index.ts b/src/api/utils/index.ts index 4d60a21e..f9af97fe 100644 --- a/src/api/utils/index.ts +++ b/src/api/utils/index.ts @@ -1,10 +1,11 @@ -import { - ErrorTypeV2, - ErrorTypeV3, +import type { InvalidArgumentError, InvalidShortUrlDeletion, ProblemDetailsError, - RegularNotFound, + RegularNotFound } from '../types/errors'; +import { + ErrorTypeV2, + ErrorTypeV3, } from '../types/errors'; const isProblemDetails = (e: unknown): e is ProblemDetailsError => diff --git a/src/app/App.tsx b/src/app/App.tsx index 457a50d7..40a14f41 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,12 +1,13 @@ -import { useEffect, FC } from 'react'; -import { Route, Routes, useLocation } from 'react-router-dom'; import classNames from 'classnames'; -import { NotFound } from '../common/NotFound'; -import { ServersMap } from '../servers/data'; -import { Settings } from '../settings/reducers/settings'; -import { changeThemeInMarkup } from '../utils/theme'; +import type { FC } from 'react'; +import { useEffect } from 'react'; +import { Route, Routes, useLocation } from 'react-router-dom'; import { AppUpdateBanner } from '../common/AppUpdateBanner'; +import { NotFound } from '../common/NotFound'; +import type { ServersMap } from '../servers/data'; +import type { Settings } from '../settings/reducers/settings'; import { forceUpdate } from '../utils/helpers/sw'; +import { changeThemeInMarkup } from '../utils/theme'; import './App.scss'; interface AppProps { diff --git a/src/app/services/provideServices.ts b/src/app/services/provideServices.ts index a69d6cbc..a73d7c83 100644 --- a/src/app/services/provideServices.ts +++ b/src/app/services/provideServices.ts @@ -1,9 +1,9 @@ -import Bottle from 'bottlejs'; -import { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates'; +import type Bottle from 'bottlejs'; +import type { ConnectDecorator } from '../../container/types'; import { App } from '../App'; -import { ConnectDecorator } from '../../container/types'; +import { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory( 'App', @@ -23,5 +23,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('appUpdateAvailable', () => appUpdateAvailable); bottle.serviceFactory('resetAppUpdate', () => resetAppUpdate); }; - -export default provideServices; diff --git a/src/common/AppUpdateBanner.tsx b/src/common/AppUpdateBanner.tsx index 300679c7..cb97179c 100644 --- a/src/common/AppUpdateBanner.tsx +++ b/src/common/AppUpdateBanner.tsx @@ -1,9 +1,9 @@ -import { FC, MouseEventHandler } from 'react'; -import { Alert, Button } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSyncAlt as reloadIcon } from '@fortawesome/free-solid-svg-icons'; -import { SimpleCard } from '../utils/SimpleCard'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC, MouseEventHandler } from 'react'; +import { Alert, Button } from 'reactstrap'; import { useToggle } from '../utils/helpers/hooks'; +import { SimpleCard } from '../utils/SimpleCard'; import './AppUpdateBanner.scss'; interface AppUpdateBannerProps { diff --git a/src/common/AsideMenu.tsx b/src/common/AsideMenu.tsx index b8ae44f8..9d6d1886 100644 --- a/src/common/AsideMenu.tsx +++ b/src/common/AsideMenu.tsx @@ -1,17 +1,19 @@ import { - faList as listIcon, - faLink as createIcon, - faTags as tagsIcon, - faPen as editIcon, - faHome as overviewIcon, faGlobe as domainsIcon, + faHome as overviewIcon, + faLink as createIcon, + faList as listIcon, + faPen as editIcon, + faTags as tagsIcon, } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { FC } from 'react'; -import { NavLink, NavLinkProps, useLocation } from 'react-router-dom'; import classNames from 'classnames'; -import { DeleteServerButtonProps } from '../servers/DeleteServerButton'; -import { isServerWithId, SelectedServer } from '../servers/data'; +import type { FC } from 'react'; +import type { NavLinkProps } from 'react-router-dom'; +import { NavLink, useLocation } from 'react-router-dom'; +import type { SelectedServer } from '../servers/data'; +import { isServerWithId } from '../servers/data'; +import type { DeleteServerButtonProps } from '../servers/DeleteServerButton'; import './AsideMenu.scss'; export interface AsideMenuProps { diff --git a/src/common/ErrorHandler.tsx b/src/common/ErrorHandler.tsx index 0a23968b..f01178cc 100644 --- a/src/common/ErrorHandler.tsx +++ b/src/common/ErrorHandler.tsx @@ -1,4 +1,5 @@ -import { Component, ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import { Component } from 'react'; import { Button } from 'reactstrap'; import { SimpleCard } from '../utils/SimpleCard'; diff --git a/src/common/Home.tsx b/src/common/Home.tsx index 018f9ce3..4029e39b 100644 --- a/src/common/Home.tsx +++ b/src/common/Home.tsx @@ -1,12 +1,12 @@ -import { useEffect } from 'react'; +import { faExternalLinkAlt, faPlus } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { isEmpty, values } from 'ramda'; +import { useEffect } from 'react'; +import { ExternalLink } from 'react-external-link'; import { Link, useNavigate } from 'react-router-dom'; import { Card, Row } from 'reactstrap'; -import { ExternalLink } from 'react-external-link'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faExternalLinkAlt, faPlus } from '@fortawesome/free-solid-svg-icons'; +import type { ServersMap } from '../servers/data'; import { ServersListGroup } from '../servers/ServersListGroup'; -import { ServersMap } from '../servers/data'; import { ShlinkLogo } from './img/ShlinkLogo'; import './Home.scss'; diff --git a/src/common/MainHeader.tsx b/src/common/MainHeader.tsx index 29c6f41c..3098d4ca 100644 --- a/src/common/MainHeader.tsx +++ b/src/common/MainHeader.tsx @@ -1,9 +1,10 @@ import { faChevronDown as arrowIcon, faCogs as cogsIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { FC, useEffect } from 'react'; +import classNames from 'classnames'; +import type { FC } from 'react'; +import { useEffect } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { Collapse, Nav, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap'; -import classNames from 'classnames'; import { useToggle } from '../utils/helpers/hooks'; import { ShlinkLogo } from './img/ShlinkLogo'; import './MainHeader.scss'; diff --git a/src/common/MenuLayout.tsx b/src/common/MenuLayout.tsx index 58f7da2d..f7c3b137 100644 --- a/src/common/MenuLayout.tsx +++ b/src/common/MenuLayout.tsx @@ -1,14 +1,15 @@ -import { FC, useEffect } from 'react'; -import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import { faBars as burgerIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classNames from 'classnames'; -import { withSelectedServer } from '../servers/helpers/withSelectedServer'; -import { useSwipeable, useToggle } from '../utils/helpers/hooks'; -import { supportsDomainVisits, supportsNonOrphanVisits } from '../utils/helpers/features'; +import type { FC } from 'react'; +import { useEffect } from 'react'; +import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import { isReachableServer } from '../servers/data'; +import { withSelectedServer } from '../servers/helpers/withSelectedServer'; +import { supportsDomainVisits, supportsNonOrphanVisits } from '../utils/helpers/features'; +import { useSwipeable, useToggle } from '../utils/helpers/hooks'; +import type { AsideMenuProps } from './AsideMenu'; import { NotFound } from './NotFound'; -import { AsideMenuProps } from './AsideMenu'; import './MenuLayout.scss'; interface MenuLayoutProps { diff --git a/src/common/NoMenuLayout.tsx b/src/common/NoMenuLayout.tsx index 9e44c15b..e853774d 100644 --- a/src/common/NoMenuLayout.tsx +++ b/src/common/NoMenuLayout.tsx @@ -1,4 +1,4 @@ -import { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; import './NoMenuLayout.scss'; export const NoMenuLayout: FC> = ({ children }) => ( diff --git a/src/common/NotFound.tsx b/src/common/NotFound.tsx index 76926d5d..2e5660cc 100644 --- a/src/common/NotFound.tsx +++ b/src/common/NotFound.tsx @@ -1,4 +1,4 @@ -import { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; import { Link } from 'react-router-dom'; import { SimpleCard } from '../utils/SimpleCard'; diff --git a/src/common/ScrollToTop.tsx b/src/common/ScrollToTop.tsx index 0fbdda39..33f4bb3a 100644 --- a/src/common/ScrollToTop.tsx +++ b/src/common/ScrollToTop.tsx @@ -1,4 +1,5 @@ -import { FC, PropsWithChildren, useEffect } from 'react'; +import type { FC, PropsWithChildren } from 'react'; +import { useEffect } from 'react'; import { useLocation } from 'react-router-dom'; export const ScrollToTop: FC> = ({ children }) => { diff --git a/src/common/ShlinkVersions.tsx b/src/common/ShlinkVersions.tsx index e750b25f..dad141d5 100644 --- a/src/common/ShlinkVersions.tsx +++ b/src/common/ShlinkVersions.tsx @@ -1,7 +1,8 @@ import { pipe } from 'ramda'; import { ExternalLink } from 'react-external-link'; +import type { SelectedServer } from '../servers/data'; +import { isReachableServer } from '../servers/data'; import { versionToPrintable, versionToSemVer } from '../utils/helpers/version'; -import { isReachableServer, SelectedServer } from '../servers/data'; const SHLINK_WEB_CLIENT_VERSION = '%_VERSION_%'; const normalizeVersion = pipe(versionToSemVer(), versionToPrintable); diff --git a/src/common/ShlinkVersionsContainer.tsx b/src/common/ShlinkVersionsContainer.tsx index 0cdf8405..cdce6c3a 100644 --- a/src/common/ShlinkVersionsContainer.tsx +++ b/src/common/ShlinkVersionsContainer.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; -import { SelectedServer } from '../servers/data'; +import type { SelectedServer } from '../servers/data'; +import type { Sidebar } from './reducers/sidebar'; import { ShlinkVersions } from './ShlinkVersions'; -import { Sidebar } from './reducers/sidebar'; import './ShlinkVersionsContainer.scss'; export interface ShlinkVersionsContainerProps { diff --git a/src/common/SimplePaginator.tsx b/src/common/SimplePaginator.tsx index 9ebc2ef4..9271bdaa 100644 --- a/src/common/SimplePaginator.tsx +++ b/src/common/SimplePaginator.tsx @@ -1,12 +1,13 @@ -import { FC } from 'react'; import classNames from 'classnames'; +import type { FC } from 'react'; import { Pagination, PaginationItem, PaginationLink } from 'reactstrap'; +import type { + NumberOrEllipsis } from '../utils/helpers/pagination'; import { - pageIsEllipsis, keyForPage, - NumberOrEllipsis, - progressivePagination, + pageIsEllipsis, prettifyPageNumber, + progressivePagination, } from '../utils/helpers/pagination'; import './SimplePaginator.scss'; diff --git a/src/common/services/HttpClient.ts b/src/common/services/HttpClient.ts index 9a07cfea..d43cb031 100644 --- a/src/common/services/HttpClient.ts +++ b/src/common/services/HttpClient.ts @@ -1,4 +1,4 @@ -import { Fetch } from '../../utils/types'; +import type { Fetch } from '../../utils/types'; const applicationJsonHeader = { 'Content-Type': 'application/json' }; const withJsonContentType = (options?: RequestInit): RequestInit | undefined => { diff --git a/src/common/services/ImageDownloader.ts b/src/common/services/ImageDownloader.ts index 39314d7e..780de082 100644 --- a/src/common/services/ImageDownloader.ts +++ b/src/common/services/ImageDownloader.ts @@ -1,5 +1,5 @@ import { saveUrl } from '../../utils/helpers/files'; -import { HttpClient } from './HttpClient'; +import type { HttpClient } from './HttpClient'; export class ImageDownloader { public constructor(private readonly httpClient: HttpClient, private readonly window: Window) {} diff --git a/src/common/services/ReportExporter.ts b/src/common/services/ReportExporter.ts index 8976e9d9..2ea0cd11 100644 --- a/src/common/services/ReportExporter.ts +++ b/src/common/services/ReportExporter.ts @@ -1,7 +1,7 @@ -import { NormalizedVisit } from '../../visits/types'; -import { ExportableShortUrl } from '../../short-urls/data'; +import type { ExportableShortUrl } from '../../short-urls/data'; +import type { JsonToCsv } from '../../utils/helpers/csvjson'; import { saveCsv } from '../../utils/helpers/files'; -import { JsonToCsv } from '../../utils/helpers/csvjson'; +import type { NormalizedVisit } from '../../visits/types'; export class ReportExporter { public constructor(private readonly window: Window, private readonly jsonToCsv: JsonToCsv) {} diff --git a/src/common/services/provideServices.ts b/src/common/services/provideServices.ts index 88a68575..23439654 100644 --- a/src/common/services/provideServices.ts +++ b/src/common/services/provideServices.ts @@ -1,19 +1,19 @@ -import Bottle from 'bottlejs'; -import { ScrollToTop } from '../ScrollToTop'; -import { MainHeader } from '../MainHeader'; -import { Home } from '../Home'; -import { MenuLayout } from '../MenuLayout'; +import type Bottle from 'bottlejs'; +import type { ConnectDecorator } from '../../container/types'; +import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer'; import { AsideMenu } from '../AsideMenu'; import { ErrorHandler } from '../ErrorHandler'; -import { ShlinkVersionsContainer } from '../ShlinkVersionsContainer'; -import { ConnectDecorator } from '../../container/types'; -import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer'; +import { Home } from '../Home'; +import { MainHeader } from '../MainHeader'; +import { MenuLayout } from '../MenuLayout'; import { sidebarNotPresent, sidebarPresent } from '../reducers/sidebar'; +import { ScrollToTop } from '../ScrollToTop'; +import { ShlinkVersionsContainer } from '../ShlinkVersionsContainer'; +import { HttpClient } from './HttpClient'; import { ImageDownloader } from './ImageDownloader'; import { ReportExporter } from './ReportExporter'; -import { HttpClient } from './HttpClient'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Services bottle.constant('window', window); bottle.constant('console', console); @@ -62,5 +62,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('sidebarPresent', () => sidebarPresent); bottle.serviceFactory('sidebarNotPresent', () => sidebarNotPresent); }; - -export default provideServices; diff --git a/src/container/index.ts b/src/container/index.ts index 4618d561..207b5565 100644 --- a/src/container/index.ts +++ b/src/container/index.ts @@ -1,18 +1,19 @@ -import Bottle, { IContainer } from 'bottlejs'; -import { connect as reduxConnect } from 'react-redux'; +import type { IContainer } from 'bottlejs'; +import Bottle from 'bottlejs'; import { pick } from 'ramda'; -import provideApiServices from '../api/services/provideServices'; -import provideCommonServices from '../common/services/provideServices'; -import provideShortUrlsServices from '../short-urls/services/provideServices'; -import provideServersServices from '../servers/services/provideServices'; -import provideVisitsServices from '../visits/services/provideServices'; -import provideTagsServices from '../tags/services/provideServices'; -import provideUtilsServices from '../utils/services/provideServices'; -import provideMercureServices from '../mercure/services/provideServices'; -import provideSettingsServices from '../settings/services/provideServices'; -import provideDomainsServices from '../domains/services/provideServices'; -import provideAppServices from '../app/services/provideServices'; -import { ConnectDecorator } from './types'; +import { connect as reduxConnect } from 'react-redux'; +import { provideServices as provideApiServices } from '../api/services/provideServices'; +import { provideServices as provideAppServices } from '../app/services/provideServices'; +import { provideServices as provideCommonServices } from '../common/services/provideServices'; +import { provideServices as provideDomainsServices } from '../domains/services/provideServices'; +import { provideServices as provideMercureServices } from '../mercure/services/provideServices'; +import { provideServices as provideServersServices } from '../servers/services/provideServices'; +import { provideServices as provideSettingsServices } from '../settings/services/provideServices'; +import { provideServices as provideShortUrlsServices } from '../short-urls/services/provideServices'; +import { provideServices as provideTagsServices } from '../tags/services/provideServices'; +import { provideServices as provideUtilsServices } from '../utils/services/provideServices'; +import { provideServices as provideVisitsServices } from '../visits/services/provideServices'; +import type { ConnectDecorator } from './types'; type LazyActionMap = Record; diff --git a/src/container/store.ts b/src/container/store.ts index 590c8382..4b799ff0 100644 --- a/src/container/store.ts +++ b/src/container/store.ts @@ -1,9 +1,10 @@ -import { IContainer } from 'bottlejs'; -import { save, load, RLSOptions } from 'redux-localstorage-simple'; import { configureStore } from '@reduxjs/toolkit'; -import reducer from '../reducers'; +import type { IContainer } from 'bottlejs'; +import type { RLSOptions } from 'redux-localstorage-simple'; +import { load, save } from 'redux-localstorage-simple'; +import { initReducers } from '../reducers'; import { migrateDeprecatedSettings } from '../settings/helpers'; -import { ShlinkState } from './types'; +import type { ShlinkState } from './types'; const isProduction = process.env.NODE_ENV === 'production'; const localStorageConfig: RLSOptions = { @@ -16,7 +17,7 @@ const preloadedState = migrateDeprecatedSettings(load(localStorageConfig) as Shl export const setUpStore = (container: IContainer) => configureStore({ devTools: !isProduction, - reducer: reducer(container), + reducer: initReducers(container), preloadedState, middleware: (defaultMiddlewaresIncludingReduxThunk) => defaultMiddlewaresIncludingReduxThunk({ immutableCheck: false, serializableCheck: false }) // State is too big for these diff --git a/src/container/types.ts b/src/container/types.ts index 3be8ee4c..eca6e21d 100644 --- a/src/container/types.ts +++ b/src/container/types.ts @@ -1,21 +1,21 @@ -import { MercureInfo } from '../mercure/reducers/mercureInfo'; -import { SelectedServer, ServersMap } from '../servers/data'; -import { Settings } from '../settings/reducers/settings'; -import { ShortUrlCreation } from '../short-urls/reducers/shortUrlCreation'; -import { ShortUrlDeletion } from '../short-urls/reducers/shortUrlDeletion'; -import { ShortUrlEdition } from '../short-urls/reducers/shortUrlEdition'; -import { ShortUrlsList } from '../short-urls/reducers/shortUrlsList'; -import { TagDeletion } from '../tags/reducers/tagDelete'; -import { TagEdition } from '../tags/reducers/tagEdit'; -import { TagsList } from '../tags/reducers/tagsList'; -import { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; -import { ShortUrlVisits } from '../visits/reducers/shortUrlVisits'; -import { TagVisits } from '../visits/reducers/tagVisits'; -import { DomainsList } from '../domains/reducers/domainsList'; -import { VisitsOverview } from '../visits/reducers/visitsOverview'; -import { Sidebar } from '../common/reducers/sidebar'; -import { DomainVisits } from '../visits/reducers/domainVisits'; -import { VisitsInfo } from '../visits/reducers/types'; +import type { Sidebar } from '../common/reducers/sidebar'; +import type { DomainsList } from '../domains/reducers/domainsList'; +import type { MercureInfo } from '../mercure/reducers/mercureInfo'; +import type { SelectedServer, ServersMap } from '../servers/data'; +import type { Settings } from '../settings/reducers/settings'; +import type { ShortUrlCreation } from '../short-urls/reducers/shortUrlCreation'; +import type { ShortUrlDeletion } from '../short-urls/reducers/shortUrlDeletion'; +import type { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; +import type { ShortUrlEdition } from '../short-urls/reducers/shortUrlEdition'; +import type { ShortUrlsList } from '../short-urls/reducers/shortUrlsList'; +import type { TagDeletion } from '../tags/reducers/tagDelete'; +import type { TagEdition } from '../tags/reducers/tagEdit'; +import type { TagsList } from '../tags/reducers/tagsList'; +import type { DomainVisits } from '../visits/reducers/domainVisits'; +import type { ShortUrlVisits } from '../visits/reducers/shortUrlVisits'; +import type { TagVisits } from '../visits/reducers/tagVisits'; +import type { VisitsInfo } from '../visits/reducers/types'; +import type { VisitsOverview } from '../visits/reducers/visitsOverview'; export interface ShlinkState { servers: ServersMap; diff --git a/src/domains/DomainRow.tsx b/src/domains/DomainRow.tsx index e57b0f36..464676cc 100644 --- a/src/domains/DomainRow.tsx +++ b/src/domains/DomainRow.tsx @@ -1,14 +1,15 @@ -import { FC, useEffect } from 'react'; -import { UncontrolledTooltip } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faDotCircle as defaultDomainIcon } from '@fortawesome/free-solid-svg-icons'; -import { ShlinkDomainRedirects } from '../api/types'; -import { OptionalString } from '../utils/utils'; -import { SelectedServer } from '../servers/data'; -import { Domain } from './data'; -import { DomainStatusIcon } from './helpers/DomainStatusIcon'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import { useEffect } from 'react'; +import { UncontrolledTooltip } from 'reactstrap'; +import type { ShlinkDomainRedirects } from '../api/types'; +import type { SelectedServer } from '../servers/data'; +import type { OptionalString } from '../utils/utils'; +import type { Domain } from './data'; import { DomainDropdown } from './helpers/DomainDropdown'; -import { EditDomainRedirects } from './reducers/domainRedirects'; +import { DomainStatusIcon } from './helpers/DomainStatusIcon'; +import type { EditDomainRedirects } from './reducers/domainRedirects'; interface DomainRowProps { domain: Domain; diff --git a/src/domains/DomainSelector.tsx b/src/domains/DomainSelector.tsx index 0c8671b4..e25442c7 100644 --- a/src/domains/DomainSelector.tsx +++ b/src/domains/DomainSelector.tsx @@ -1,11 +1,12 @@ -import { useEffect } from 'react'; -import { Button, DropdownItem, Input, InputGroup, UncontrolledTooltip, InputProps } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faUndo } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { isEmpty, pipe } from 'ramda'; +import { useEffect } from 'react'; +import type { InputProps } from 'reactstrap'; +import { Button, DropdownItem, Input, InputGroup, UncontrolledTooltip } from 'reactstrap'; import { DropdownBtn } from '../utils/DropdownBtn'; import { useToggle } from '../utils/helpers/hooks'; -import { DomainsList } from './reducers/domainsList'; +import type { DomainsList } from './reducers/domainsList'; import './DomainSelector.scss'; export interface DomainSelectorProps extends Omit { diff --git a/src/domains/ManageDomains.tsx b/src/domains/ManageDomains.tsx index f7c52992..3b54e22e 100644 --- a/src/domains/ManageDomains.tsx +++ b/src/domains/ManageDomains.tsx @@ -1,13 +1,14 @@ -import { FC, useEffect } from 'react'; +import type { FC } from 'react'; +import { useEffect } from 'react'; +import { ShlinkApiError } from '../api/ShlinkApiError'; +import type { SelectedServer } from '../servers/data'; import { Message } from '../utils/Message'; import { Result } from '../utils/Result'; -import { ShlinkApiError } from '../api/ShlinkApiError'; -import { SimpleCard } from '../utils/SimpleCard'; import { SearchField } from '../utils/SearchField'; -import { EditDomainRedirects } from './reducers/domainRedirects'; -import { SelectedServer } from '../servers/data'; -import { DomainsList } from './reducers/domainsList'; +import { SimpleCard } from '../utils/SimpleCard'; import { DomainRow } from './DomainRow'; +import type { EditDomainRedirects } from './reducers/domainRedirects'; +import type { DomainsList } from './reducers/domainsList'; interface ManageDomainsProps { listDomains: Function; diff --git a/src/domains/data/index.ts b/src/domains/data/index.ts index e427d87d..a6600f15 100644 --- a/src/domains/data/index.ts +++ b/src/domains/data/index.ts @@ -1,4 +1,4 @@ -import { ShlinkDomain } from '../../api/types'; +import type { ShlinkDomain } from '../../api/types'; export type DomainStatus = 'validating' | 'valid' | 'invalid'; diff --git a/src/domains/helpers/DomainDropdown.tsx b/src/domains/helpers/DomainDropdown.tsx index a91b40a8..15fda949 100644 --- a/src/domains/helpers/DomainDropdown.tsx +++ b/src/domains/helpers/DomainDropdown.tsx @@ -1,16 +1,17 @@ -import { FC } from 'react'; -import { DropdownItem } from 'reactstrap'; -import { Link } from 'react-router-dom'; import { faChartPie as pieChartIcon, faEdit as editIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { useToggle } from '../../utils/helpers/hooks'; +import type { FC } from 'react'; +import { Link } from 'react-router-dom'; +import { DropdownItem } from 'reactstrap'; +import type { SelectedServer } from '../../servers/data'; +import { getServerId } from '../../servers/data'; import { DropdownBtnMenu } from '../../utils/DropdownBtnMenu'; -import { EditDomainRedirectsModal } from './EditDomainRedirectsModal'; -import { Domain } from '../data'; -import { EditDomainRedirects } from '../reducers/domainRedirects'; import { supportsDefaultDomainRedirectsEdition, supportsDomainVisits } from '../../utils/helpers/features'; -import { getServerId, SelectedServer } from '../../servers/data'; +import { useToggle } from '../../utils/helpers/hooks'; import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits'; +import type { Domain } from '../data'; +import type { EditDomainRedirects } from '../reducers/domainRedirects'; +import { EditDomainRedirectsModal } from './EditDomainRedirectsModal'; interface DomainDropdownProps { domain: Domain; diff --git a/src/domains/helpers/DomainStatusIcon.tsx b/src/domains/helpers/DomainStatusIcon.tsx index 7a1e6ded..9d7c071c 100644 --- a/src/domains/helpers/DomainStatusIcon.tsx +++ b/src/domains/helpers/DomainStatusIcon.tsx @@ -1,15 +1,16 @@ -import { FC, useEffect, useState } from 'react'; -import { UncontrolledTooltip } from 'reactstrap'; -import { ExternalLink } from 'react-external-link'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { - faTimes as invalidIcon, faCheck as checkIcon, faCircleNotch as loadingStatusIcon, + faTimes as invalidIcon, } from '@fortawesome/free-solid-svg-icons'; -import { MediaMatcher } from '../../utils/types'; -import { DomainStatus } from '../data'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import { useEffect, useState } from 'react'; +import { ExternalLink } from 'react-external-link'; +import { UncontrolledTooltip } from 'reactstrap'; import { useElementRef } from '../../utils/helpers/hooks'; +import type { MediaMatcher } from '../../utils/types'; +import type { DomainStatus } from '../data'; interface DomainStatusIconProps { status: DomainStatus; diff --git a/src/domains/helpers/EditDomainRedirectsModal.tsx b/src/domains/helpers/EditDomainRedirectsModal.tsx index 26d11be5..726407f3 100644 --- a/src/domains/helpers/EditDomainRedirectsModal.tsx +++ b/src/domains/helpers/EditDomainRedirectsModal.tsx @@ -1,10 +1,12 @@ -import { FC, useState } from 'react'; +import type { FC } from 'react'; +import { useState } from 'react'; import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; -import { ShlinkDomain } from '../../api/types'; -import { InputFormGroup, InputFormGroupProps } from '../../utils/forms/InputFormGroup'; -import { handleEventPreventingDefault, nonEmptyValueOrNull } from '../../utils/utils'; +import type { ShlinkDomain } from '../../api/types'; +import type { InputFormGroupProps } from '../../utils/forms/InputFormGroup'; +import { InputFormGroup } from '../../utils/forms/InputFormGroup'; import { InfoTooltip } from '../../utils/InfoTooltip'; -import { EditDomainRedirects } from '../reducers/domainRedirects'; +import { handleEventPreventingDefault, nonEmptyValueOrNull } from '../../utils/utils'; +import type { EditDomainRedirects } from '../reducers/domainRedirects'; interface EditDomainRedirectsModalProps { domain: ShlinkDomain; diff --git a/src/domains/reducers/domainRedirects.ts b/src/domains/reducers/domainRedirects.ts index 7aea1b15..c0d41459 100644 --- a/src/domains/reducers/domainRedirects.ts +++ b/src/domains/reducers/domainRedirects.ts @@ -1,6 +1,6 @@ +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkDomainRedirects } from '../../api/types'; import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { ShlinkDomainRedirects } from '../../api/types'; const EDIT_DOMAIN_REDIRECTS = 'shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS'; diff --git a/src/domains/reducers/domainsList.ts b/src/domains/reducers/domainsList.ts index f1e622e0..1a9cdb6b 100644 --- a/src/domains/reducers/domainsList.ts +++ b/src/domains/reducers/domainsList.ts @@ -1,13 +1,14 @@ -import { createSlice, createAction, SliceCaseReducers, AsyncThunk } from '@reduxjs/toolkit'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkDomainRedirects } from '../../api/types'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { Domain, DomainStatus } from '../data'; -import { hasServerData } from '../../servers/data'; -import { replaceAuthorityFromUri } from '../../utils/helpers/uri'; -import { ProblemDetailsError } from '../../api/types/errors'; +import type { AsyncThunk, SliceCaseReducers } from '@reduxjs/toolkit'; +import { createAction, createSlice } from '@reduxjs/toolkit'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkDomainRedirects } from '../../api/types'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { EditDomainRedirects } from './domainRedirects'; +import { hasServerData } from '../../servers/data'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import { replaceAuthorityFromUri } from '../../utils/helpers/uri'; +import type { Domain, DomainStatus } from '../data'; +import type { EditDomainRedirects } from './domainRedirects'; const REDUCER_PREFIX = 'shlink/domainsList'; diff --git a/src/domains/services/provideServices.ts b/src/domains/services/provideServices.ts index 827302a3..f8a2988c 100644 --- a/src/domains/services/provideServices.ts +++ b/src/domains/services/provideServices.ts @@ -1,12 +1,12 @@ +import type Bottle from 'bottlejs'; import { prop } from 'ramda'; -import Bottle from 'bottlejs'; -import { ConnectDecorator } from '../../container/types'; -import { domainsListReducerCreator } from '../reducers/domainsList'; +import type { ConnectDecorator } from '../../container/types'; import { DomainSelector } from '../DomainSelector'; import { ManageDomains } from '../ManageDomains'; import { editDomainRedirects } from '../reducers/domainRedirects'; +import { domainsListReducerCreator } from '../reducers/domainsList'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory('DomainSelector', () => DomainSelector); bottle.decorator('DomainSelector', connect(['domainsList'], ['listDomains'])); @@ -32,5 +32,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'buildShlinkApiClient'); bottle.serviceFactory('checkDomainHealth', prop('checkDomainHealth'), 'domainsListReducerCreator'); }; - -export default provideServices; diff --git a/src/index.tsx b/src/index.tsx index e8d471c2..b22c7ac7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,15 +1,15 @@ +import 'chart.js/auto'; // TODO Import specific ones to reduce bundle size https://react-chartjs-2.js.org/docs/migration-to-v4/#tree-shaking import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; import { BrowserRouter } from 'react-router-dom'; import pack from '../package.json'; import { container } from './container'; import { setUpStore } from './container/store'; -import { fixLeafletIcons } from './utils/helpers/leaflet'; import { register as registerServiceWorker } from './serviceWorkerRegistration'; -import 'chart.js/auto'; // TODO Import specific ones to reduce bundle size https://react-chartjs-2.js.org/docs/migration-to-v4/#tree-shaking -import 'react-datepicker/dist/react-datepicker.css'; -import 'leaflet/dist/leaflet.css'; +import { fixLeafletIcons } from './utils/helpers/leaflet'; import './index.scss'; +import 'leaflet/dist/leaflet.css'; +import 'react-datepicker/dist/react-datepicker.css'; // This overwrites icons used for leaflet maps, fixing some issues caused by webpack while processing the CSS fixLeafletIcons(); diff --git a/src/mercure/helpers/boundToMercureHub.tsx b/src/mercure/helpers/boundToMercureHub.tsx index a9436237..854c9a4c 100644 --- a/src/mercure/helpers/boundToMercureHub.tsx +++ b/src/mercure/helpers/boundToMercureHub.tsx @@ -1,8 +1,9 @@ -import { FC, useEffect } from 'react'; import { pipe } from 'ramda'; +import type { FC } from 'react'; +import { useEffect } from 'react'; import { useParams } from 'react-router-dom'; -import { CreateVisit } from '../../visits/types'; -import { MercureInfo } from '../reducers/mercureInfo'; +import type { CreateVisit } from '../../visits/types'; +import type { MercureInfo } from '../reducers/mercureInfo'; import { bindToMercureTopic } from './index'; export interface MercureBoundProps { diff --git a/src/mercure/helpers/index.ts b/src/mercure/helpers/index.ts index 0368c8ee..26d2f09a 100644 --- a/src/mercure/helpers/index.ts +++ b/src/mercure/helpers/index.ts @@ -1,5 +1,5 @@ import { EventSourcePolyfill as EventSource } from 'event-source-polyfill'; -import { MercureInfo } from '../reducers/mercureInfo'; +import type { MercureInfo } from '../reducers/mercureInfo'; export const bindToMercureTopic = (mercureInfo: MercureInfo, topics: string[], onMessage: (message: T) => void, onTokenExpired: () => void) => { // eslint-disable-line max-len const { mercureHubUrl, token, loading, error } = mercureInfo; diff --git a/src/mercure/reducers/mercureInfo.ts b/src/mercure/reducers/mercureInfo.ts index d9ec7974..6b3898fe 100644 --- a/src/mercure/reducers/mercureInfo.ts +++ b/src/mercure/reducers/mercureInfo.ts @@ -1,7 +1,7 @@ import { createSlice } from '@reduxjs/toolkit'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkMercureInfo } from '../../api/types'; import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkMercureInfo } from '../../api/types'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; const REDUCER_PREFIX = 'shlink/mercure'; diff --git a/src/mercure/services/provideServices.ts b/src/mercure/services/provideServices.ts index 06c341c7..0b6b4121 100644 --- a/src/mercure/services/provideServices.ts +++ b/src/mercure/services/provideServices.ts @@ -1,8 +1,8 @@ +import type Bottle from 'bottlejs'; import { prop } from 'ramda'; -import Bottle from 'bottlejs'; import { mercureInfoReducerCreator } from '../reducers/mercureInfo'; -const provideServices = (bottle: Bottle) => { +export const provideServices = (bottle: Bottle) => { // Reducer bottle.serviceFactory('mercureInfoReducerCreator', mercureInfoReducerCreator, 'buildShlinkApiClient'); bottle.serviceFactory('mercureInfoReducer', prop('reducer'), 'mercureInfoReducerCreator'); @@ -10,5 +10,3 @@ const provideServices = (bottle: Bottle) => { // Actions bottle.serviceFactory('loadMercureInfo', prop('loadMercureInfo'), 'mercureInfoReducerCreator'); }; - -export default provideServices; diff --git a/src/reducers/index.ts b/src/reducers/index.ts index 56734ac7..d2d9ba82 100644 --- a/src/reducers/index.ts +++ b/src/reducers/index.ts @@ -1,12 +1,12 @@ -import { IContainer } from 'bottlejs'; import { combineReducers } from '@reduxjs/toolkit'; -import { serversReducer } from '../servers/reducers/servers'; -import { settingsReducer } from '../settings/reducers/settings'; +import type { IContainer } from 'bottlejs'; import { appUpdatesReducer } from '../app/reducers/appUpdates'; import { sidebarReducer } from '../common/reducers/sidebar'; -import { ShlinkState } from '../container/types'; +import type { ShlinkState } from '../container/types'; +import { serversReducer } from '../servers/reducers/servers'; +import { settingsReducer } from '../settings/reducers/settings'; -export default (container: IContainer) => combineReducers({ +export const initReducers = (container: IContainer) => combineReducers({ servers: serversReducer, selectedServer: container.selectedServerReducer, shortUrlsList: container.shortUrlsListReducer, diff --git a/src/servers/CreateServer.tsx b/src/servers/CreateServer.tsx index 4ffd93ea..9de1ab6f 100644 --- a/src/servers/CreateServer.tsx +++ b/src/servers/CreateServer.tsx @@ -1,14 +1,16 @@ -import { FC, useEffect, useState } from 'react'; -import { v4 as uuid } from 'uuid'; -import { Button } from 'reactstrap'; +import type { FC } from 'react'; +import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Result } from '../utils/Result'; +import { Button } from 'reactstrap'; +import { v4 as uuid } from 'uuid'; import { NoMenuLayout } from '../common/NoMenuLayout'; -import { TimeoutToggle, useGoBack, useToggle } from '../utils/helpers/hooks'; -import { ServerForm } from './helpers/ServerForm'; -import { ImportServersBtnProps } from './helpers/ImportServersBtn'; -import { ServerData, ServersMap, ServerWithId } from './data'; +import type { TimeoutToggle } from '../utils/helpers/hooks'; +import { useGoBack, useToggle } from '../utils/helpers/hooks'; +import { Result } from '../utils/Result'; +import type { ServerData, ServersMap, ServerWithId } from './data'; import { DuplicatedServersModal } from './helpers/DuplicatedServersModal'; +import type { ImportServersBtnProps } from './helpers/ImportServersBtn'; +import { ServerForm } from './helpers/ServerForm'; const SHOW_IMPORT_MSG_TIME = 4000; diff --git a/src/servers/DeleteServerButton.tsx b/src/servers/DeleteServerButton.tsx index 4759938c..6b931bad 100644 --- a/src/servers/DeleteServerButton.tsx +++ b/src/servers/DeleteServerButton.tsx @@ -1,9 +1,9 @@ -import { FC, PropsWithChildren } from 'react'; import { faMinusCircle as deleteIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC, PropsWithChildren } from 'react'; import { useToggle } from '../utils/helpers/hooks'; -import { DeleteServerModalProps } from './DeleteServerModal'; -import { ServerWithId } from './data'; +import type { ServerWithId } from './data'; +import type { DeleteServerModalProps } from './DeleteServerModal'; export type DeleteServerButtonProps = PropsWithChildren<{ server: ServerWithId; diff --git a/src/servers/DeleteServerModal.tsx b/src/servers/DeleteServerModal.tsx index d22c93c4..e7bff9b3 100644 --- a/src/servers/DeleteServerModal.tsx +++ b/src/servers/DeleteServerModal.tsx @@ -1,7 +1,8 @@ -import { FC, useRef } from 'react'; -import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; +import type { FC } from 'react'; +import { useRef } from 'react'; import { useNavigate } from 'react-router-dom'; -import { ServerWithId } from './data'; +import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; +import type { ServerWithId } from './data'; export interface DeleteServerModalProps { server: ServerWithId; diff --git a/src/servers/EditServer.tsx b/src/servers/EditServer.tsx index e95b4daa..b24a961e 100644 --- a/src/servers/EditServer.tsx +++ b/src/servers/EditServer.tsx @@ -1,10 +1,11 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { Button } from 'reactstrap'; import { NoMenuLayout } from '../common/NoMenuLayout'; import { useGoBack, useParsedQuery } from '../utils/helpers/hooks'; +import type { ServerData } from './data'; +import { isServerWithId } from './data'; import { ServerForm } from './helpers/ServerForm'; import { withSelectedServer } from './helpers/withSelectedServer'; -import { isServerWithId, ServerData } from './data'; interface EditServerProps { editServer: (serverId: string, serverData: ServerData) => void; diff --git a/src/servers/ManageServers.tsx b/src/servers/ManageServers.tsx index 80f91d61..378f157a 100644 --- a/src/servers/ManageServers.tsx +++ b/src/servers/ManageServers.tsx @@ -1,17 +1,18 @@ -import { FC, useEffect, useState } from 'react'; -import { Button, Row } from 'reactstrap'; import { faFileDownload as exportIcon, faPlus as plusIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; +import { Button, Row } from 'reactstrap'; import { NoMenuLayout } from '../common/NoMenuLayout'; -import { SimpleCard } from '../utils/SimpleCard'; -import { SearchField } from '../utils/SearchField'; +import type { TimeoutToggle } from '../utils/helpers/hooks'; import { Result } from '../utils/Result'; -import { TimeoutToggle } from '../utils/helpers/hooks'; -import { ImportServersBtnProps } from './helpers/ImportServersBtn'; -import { ServersMap } from './data'; -import { ManageServersRowProps } from './ManageServersRow'; -import ServersExporter from './services/ServersExporter'; +import { SearchField } from '../utils/SearchField'; +import { SimpleCard } from '../utils/SimpleCard'; +import type { ServersMap } from './data'; +import type { ImportServersBtnProps } from './helpers/ImportServersBtn'; +import type { ManageServersRowProps } from './ManageServersRow'; +import type { ServersExporter } from './services/ServersExporter'; interface ManageServersProps { servers: ServersMap; diff --git a/src/servers/ManageServersRow.tsx b/src/servers/ManageServersRow.tsx index b072bf2b..89291a48 100644 --- a/src/servers/ManageServersRow.tsx +++ b/src/servers/ManageServersRow.tsx @@ -1,10 +1,10 @@ -import { FC } from 'react'; -import { UncontrolledTooltip } from 'reactstrap'; -import { Link } from 'react-router-dom'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCheck as checkIcon } from '@fortawesome/free-solid-svg-icons'; -import { ServerWithId } from './data'; -import { ManageServersRowDropdownProps } from './ManageServersRowDropdown'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import { Link } from 'react-router-dom'; +import { UncontrolledTooltip } from 'reactstrap'; +import type { ServerWithId } from './data'; +import type { ManageServersRowDropdownProps } from './ManageServersRowDropdown'; export interface ManageServersRowProps { server: ServerWithId; diff --git a/src/servers/ManageServersRowDropdown.tsx b/src/servers/ManageServersRowDropdown.tsx index f0da17a5..357c0126 100644 --- a/src/servers/ManageServersRowDropdown.tsx +++ b/src/servers/ManageServersRowDropdown.tsx @@ -1,18 +1,18 @@ -import { FC } from 'react'; -import { DropdownItem } from 'reactstrap'; -import { Link } from 'react-router-dom'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faCircle as toggleOnIcon } from '@fortawesome/free-regular-svg-icons'; import { faBan as toggleOffIcon, faEdit as editIcon, faMinusCircle as deleteIcon, faPlug as connectIcon, } from '@fortawesome/free-solid-svg-icons'; -import { faCircle as toggleOnIcon } from '@fortawesome/free-regular-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import { Link } from 'react-router-dom'; +import { DropdownItem } from 'reactstrap'; import { DropdownBtnMenu } from '../utils/DropdownBtnMenu'; import { useToggle } from '../utils/helpers/hooks'; -import { DeleteServerModalProps } from './DeleteServerModal'; -import { ServerWithId } from './data'; +import type { ServerWithId } from './data'; +import type { DeleteServerModalProps } from './DeleteServerModal'; export interface ManageServersRowDropdownProps { server: ServerWithId; diff --git a/src/servers/Overview.tsx b/src/servers/Overview.tsx index d751a534..dfd39808 100644 --- a/src/servers/Overview.tsx +++ b/src/servers/Overview.tsx @@ -1,17 +1,20 @@ -import { FC, useEffect } from 'react'; -import { Card, CardBody, CardHeader, Row } from 'reactstrap'; +import type { FC } from 'react'; +import { useEffect } from 'react'; import { Link, useNavigate } from 'react-router-dom'; -import { ITEMS_IN_OVERVIEW_PAGE, ShortUrlsList as ShortUrlsListState } from '../short-urls/reducers/shortUrlsList'; -import { prettify } from '../utils/helpers/numbers'; -import { TagsList } from '../tags/reducers/tagsList'; -import { ShortUrlsTableType } from '../short-urls/ShortUrlsTable'; +import { Card, CardBody, CardHeader, Row } from 'reactstrap'; +import type { ShlinkShortUrlsListParams } from '../api/types'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; -import { CreateShortUrlProps } from '../short-urls/CreateShortUrl'; -import { VisitsOverview } from '../visits/reducers/visitsOverview'; import { Topics } from '../mercure/helpers/Topics'; -import { ShlinkShortUrlsListParams } from '../api/types'; +import type { CreateShortUrlProps } from '../short-urls/CreateShortUrl'; +import type { ShortUrlsList as ShortUrlsListState } from '../short-urls/reducers/shortUrlsList'; +import { ITEMS_IN_OVERVIEW_PAGE } from '../short-urls/reducers/shortUrlsList'; +import type { ShortUrlsTableType } from '../short-urls/ShortUrlsTable'; +import type { TagsList } from '../tags/reducers/tagsList'; import { supportsNonOrphanVisits } from '../utils/helpers/features'; -import { getServerId, SelectedServer } from './data'; +import { prettify } from '../utils/helpers/numbers'; +import type { VisitsOverview } from '../visits/reducers/visitsOverview'; +import type { SelectedServer } from './data'; +import { getServerId } from './data'; import { HighlightCard } from './helpers/HighlightCard'; interface OverviewConnectProps { diff --git a/src/servers/ServersDropdown.tsx b/src/servers/ServersDropdown.tsx index e549471a..934e8206 100644 --- a/src/servers/ServersDropdown.tsx +++ b/src/servers/ServersDropdown.tsx @@ -1,9 +1,10 @@ -import { isEmpty, values } from 'ramda'; -import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap'; -import { Link } from 'react-router-dom'; import { faPlus as plusIcon, faServer as serverIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { getServerId, SelectedServer, ServersMap } from './data'; +import { isEmpty, values } from 'ramda'; +import { Link } from 'react-router-dom'; +import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap'; +import type { SelectedServer, ServersMap } from './data'; +import { getServerId } from './data'; export interface ServersDropdownProps { servers: ServersMap; diff --git a/src/servers/ServersListGroup.tsx b/src/servers/ServersListGroup.tsx index 36bac3bf..b9fd3f41 100644 --- a/src/servers/ServersListGroup.tsx +++ b/src/servers/ServersListGroup.tsx @@ -1,10 +1,10 @@ -import { FC, PropsWithChildren } from 'react'; -import { ListGroup, ListGroupItem } from 'reactstrap'; -import { Link } from 'react-router-dom'; -import classNames from 'classnames'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons'; -import { ServerWithId } from './data'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import classNames from 'classnames'; +import type { FC, PropsWithChildren } from 'react'; +import { Link } from 'react-router-dom'; +import { ListGroup, ListGroupItem } from 'reactstrap'; +import type { ServerWithId } from './data'; import './ServersListGroup.scss'; type ServersListGroupProps = PropsWithChildren<{ diff --git a/src/servers/data/index.ts b/src/servers/data/index.ts index 7ee3351e..52a98a6f 100644 --- a/src/servers/data/index.ts +++ b/src/servers/data/index.ts @@ -1,5 +1,5 @@ import { omit } from 'ramda'; -import { SemVer } from '../../utils/helpers/version'; +import type { SemVer } from '../../utils/helpers/version'; export interface ServerData { name: string; diff --git a/src/servers/helpers/DuplicatedServersModal.tsx b/src/servers/helpers/DuplicatedServersModal.tsx index 2f8a43c1..858e7993 100644 --- a/src/servers/helpers/DuplicatedServersModal.tsx +++ b/src/servers/helpers/DuplicatedServersModal.tsx @@ -1,6 +1,7 @@ -import { FC, Fragment } from 'react'; +import type { FC } from 'react'; +import { Fragment } from 'react'; import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; -import { ServerData } from '../data'; +import type { ServerData } from '../data'; interface DuplicatedServersModalProps { duplicatedServers: ServerData[]; diff --git a/src/servers/helpers/HighlightCard.tsx b/src/servers/helpers/HighlightCard.tsx index d5a6f1ef..a272be9a 100644 --- a/src/servers/helpers/HighlightCard.tsx +++ b/src/servers/helpers/HighlightCard.tsx @@ -1,8 +1,8 @@ -import { FC, PropsWithChildren } from 'react'; -import { Card, CardText, CardTitle } from 'reactstrap'; -import { Link } from 'react-router-dom'; import { faArrowAltCircleRight as linkIcon } from '@fortawesome/free-regular-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC, PropsWithChildren } from 'react'; +import { Link } from 'react-router-dom'; +import { Card, CardText, CardTitle } from 'reactstrap'; import './HighlightCard.scss'; export type HighlightCardProps = PropsWithChildren<{ diff --git a/src/servers/helpers/ImportServersBtn.tsx b/src/servers/helpers/ImportServersBtn.tsx index 4ce8502a..b6b0cf41 100644 --- a/src/servers/helpers/ImportServersBtn.tsx +++ b/src/servers/helpers/ImportServersBtn.tsx @@ -1,11 +1,12 @@ -import { ChangeEvent, useState, useEffect, FC, PropsWithChildren } from 'react'; -import { Button, UncontrolledTooltip } from 'reactstrap'; -import { complement, pipe } from 'ramda'; import { faFileUpload as importIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { complement, pipe } from 'ramda'; +import type { ChangeEvent, FC, PropsWithChildren } from 'react'; +import { useEffect, useState } from 'react'; +import { Button, UncontrolledTooltip } from 'reactstrap'; import { useElementRef, useToggle } from '../../utils/helpers/hooks'; -import { ServersImporter } from '../services/ServersImporter'; -import { ServerData, ServersMap } from '../data'; +import type { ServerData, ServersMap } from '../data'; +import type { ServersImporter } from '../services/ServersImporter'; import { DuplicatedServersModal } from './DuplicatedServersModal'; import './ImportServersBtn.scss'; diff --git a/src/servers/helpers/ServerError.tsx b/src/servers/helpers/ServerError.tsx index f133d494..15fc2493 100644 --- a/src/servers/helpers/ServerError.tsx +++ b/src/servers/helpers/ServerError.tsx @@ -1,10 +1,11 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { Link } from 'react-router-dom'; -import { Message } from '../../utils/Message'; -import { ServersListGroup } from '../ServersListGroup'; -import { DeleteServerButtonProps } from '../DeleteServerButton'; -import { isServerWithId, SelectedServer, ServersMap } from '../data'; import { NoMenuLayout } from '../../common/NoMenuLayout'; +import { Message } from '../../utils/Message'; +import type { SelectedServer, ServersMap } from '../data'; +import { isServerWithId } from '../data'; +import type { DeleteServerButtonProps } from '../DeleteServerButton'; +import { ServersListGroup } from '../ServersListGroup'; import './ServerError.scss'; interface ServerErrorProps { diff --git a/src/servers/helpers/ServerForm.tsx b/src/servers/helpers/ServerForm.tsx index 5c781069..f06dec56 100644 --- a/src/servers/helpers/ServerForm.tsx +++ b/src/servers/helpers/ServerForm.tsx @@ -1,8 +1,9 @@ -import { FC, PropsWithChildren, ReactNode, useEffect, useState } from 'react'; +import type { FC, PropsWithChildren, ReactNode } from 'react'; +import { useEffect, useState } from 'react'; import { InputFormGroup } from '../../utils/forms/InputFormGroup'; -import { handleEventPreventingDefault } from '../../utils/utils'; -import { ServerData } from '../data'; import { SimpleCard } from '../../utils/SimpleCard'; +import { handleEventPreventingDefault } from '../../utils/utils'; +import type { ServerData } from '../data'; type ServerFormProps = PropsWithChildren<{ onSubmit: (server: ServerData) => void; diff --git a/src/servers/helpers/withSelectedServer.tsx b/src/servers/helpers/withSelectedServer.tsx index dcd7e228..8f28b9bd 100644 --- a/src/servers/helpers/withSelectedServer.tsx +++ b/src/servers/helpers/withSelectedServer.tsx @@ -1,8 +1,10 @@ -import { FC, useEffect } from 'react'; +import type { FC } from 'react'; +import { useEffect } from 'react'; import { useParams } from 'react-router-dom'; -import { Message } from '../../utils/Message'; -import { isNotFoundServer, SelectedServer } from '../data'; import { NoMenuLayout } from '../../common/NoMenuLayout'; +import { Message } from '../../utils/Message'; +import type { SelectedServer } from '../data'; +import { isNotFoundServer } from '../data'; interface WithSelectedServerProps { selectServer: (serverId: string) => void; diff --git a/src/servers/helpers/withoutSelectedServer.tsx b/src/servers/helpers/withoutSelectedServer.tsx index c2ee7329..53f5b4c7 100644 --- a/src/servers/helpers/withoutSelectedServer.tsx +++ b/src/servers/helpers/withoutSelectedServer.tsx @@ -1,4 +1,5 @@ -import { FC, useEffect } from 'react'; +import type { FC } from 'react'; +import { useEffect } from 'react'; interface WithoutSelectedServerProps { resetSelectedServer: Function; diff --git a/src/servers/reducers/remoteServers.ts b/src/servers/reducers/remoteServers.ts index 8776441d..a1995d71 100644 --- a/src/servers/reducers/remoteServers.ts +++ b/src/servers/reducers/remoteServers.ts @@ -1,8 +1,9 @@ import pack from '../../../package.json'; -import { hasServerData, ServerData } from '../data'; -import { createServers } from './servers'; +import type { HttpClient } from '../../common/services/HttpClient'; import { createAsyncThunk } from '../../utils/helpers/redux'; -import { HttpClient } from '../../common/services/HttpClient'; +import type { ServerData } from '../data'; +import { hasServerData } from '../data'; +import { createServers } from './servers'; const responseToServersList = (data: any): ServerData[] => (Array.isArray(data) ? data.filter(hasServerData) : []); diff --git a/src/servers/reducers/selectedServer.ts b/src/servers/reducers/selectedServer.ts index b69647f0..6469296b 100644 --- a/src/servers/reducers/selectedServer.ts +++ b/src/servers/reducers/selectedServer.ts @@ -1,10 +1,12 @@ -import { createAction, createListenerMiddleware, createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createAction, createListenerMiddleware, createSlice } from '@reduxjs/toolkit'; import { memoizeWith, pipe } from 'ramda'; -import { versionToPrintable, versionToSemVer as toSemVer } from '../../utils/helpers/version'; -import { isReachableServer, SelectedServer, ServerWithId } from '../data'; -import { ShlinkHealth } from '../../api/types'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkHealth } from '../../api/types'; import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import { versionToPrintable, versionToSemVer as toSemVer } from '../../utils/helpers/version'; +import type { SelectedServer, ServerWithId } from '../data'; +import { isReachableServer } from '../data'; const REDUCER_PREFIX = 'shlink/selectedServer'; diff --git a/src/servers/reducers/servers.ts b/src/servers/reducers/servers.ts index faa2c9c6..2402dc46 100644 --- a/src/servers/reducers/servers.ts +++ b/src/servers/reducers/servers.ts @@ -1,7 +1,8 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; import { assoc, dissoc, fromPairs, map, pipe, reduce, toPairs } from 'ramda'; import { v4 as uuid } from 'uuid'; -import { ServerData, ServersMap, ServerWithId } from '../data'; +import type { ServerData, ServersMap, ServerWithId } from '../data'; interface EditServer { serverId: string; diff --git a/src/servers/services/ServersExporter.ts b/src/servers/services/ServersExporter.ts index df4fa680..c003869b 100644 --- a/src/servers/services/ServersExporter.ts +++ b/src/servers/services/ServersExporter.ts @@ -1,12 +1,13 @@ import { values } from 'ramda'; -import { LocalStorage } from '../../utils/services/LocalStorage'; -import { ServersMap, serverWithIdToServerData } from '../data'; +import type { JsonToCsv } from '../../utils/helpers/csvjson'; import { saveCsv } from '../../utils/helpers/files'; -import { JsonToCsv } from '../../utils/helpers/csvjson'; +import type { LocalStorage } from '../../utils/services/LocalStorage'; +import type { ServersMap } from '../data'; +import { serverWithIdToServerData } from '../data'; const SERVERS_FILENAME = 'shlink-servers.csv'; -export default class ServersExporter { +export class ServersExporter { public constructor( private readonly storage: LocalStorage, private readonly window: Window, diff --git a/src/servers/services/ServersImporter.ts b/src/servers/services/ServersImporter.ts index 8fb560b7..2d47b7b5 100644 --- a/src/servers/services/ServersImporter.ts +++ b/src/servers/services/ServersImporter.ts @@ -1,5 +1,5 @@ -import { ServerData } from '../data'; -import { CsvToJson } from '../../utils/helpers/csvjson'; +import type { CsvToJson } from '../../utils/helpers/csvjson'; +import type { ServerData } from '../data'; const validateServer = (server: any): server is ServerData => typeof server.url === 'string' && typeof server.apiKey === 'string' && typeof server.name === 'string'; diff --git a/src/servers/services/provideServices.ts b/src/servers/services/provideServices.ts index 92aaca58..a7831580 100644 --- a/src/servers/services/provideServices.ts +++ b/src/servers/services/provideServices.ts @@ -1,11 +1,18 @@ +import type Bottle from 'bottlejs'; import { prop } from 'ramda'; -import Bottle from 'bottlejs'; +import type { ConnectDecorator } from '../../container/types'; import { CreateServer } from '../CreateServer'; -import { ServersDropdown } from '../ServersDropdown'; -import { DeleteServerModal } from '../DeleteServerModal'; import { DeleteServerButton } from '../DeleteServerButton'; +import { DeleteServerModal } from '../DeleteServerModal'; import { EditServer } from '../EditServer'; import { ImportServersBtn } from '../helpers/ImportServersBtn'; +import { ServerError } from '../helpers/ServerError'; +import { withoutSelectedServer } from '../helpers/withoutSelectedServer'; +import { ManageServers } from '../ManageServers'; +import { ManageServersRow } from '../ManageServersRow'; +import { ManageServersRowDropdown } from '../ManageServersRowDropdown'; +import { Overview } from '../Overview'; +import { fetchServers } from '../reducers/remoteServers'; import { resetSelectedServer, selectedServerReducerCreator, @@ -13,18 +20,11 @@ import { selectServerListener, } from '../reducers/selectedServer'; import { createServers, deleteServer, editServer, setAutoConnect } from '../reducers/servers'; -import { fetchServers } from '../reducers/remoteServers'; -import { ServerError } from '../helpers/ServerError'; -import { ConnectDecorator } from '../../container/types'; -import { withoutSelectedServer } from '../helpers/withoutSelectedServer'; -import { Overview } from '../Overview'; -import { ManageServers } from '../ManageServers'; -import { ManageServersRow } from '../ManageServersRow'; -import { ManageServersRowDropdown } from '../ManageServersRowDropdown'; +import { ServersDropdown } from '../ServersDropdown'; +import { ServersExporter } from './ServersExporter'; import { ServersImporter } from './ServersImporter'; -import ServersExporter from './ServersExporter'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory( 'ManageServers', @@ -89,5 +89,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('selectedServerReducerCreator', selectedServerReducerCreator, 'selectServer'); bottle.serviceFactory('selectedServerReducer', prop('reducer'), 'selectedServerReducerCreator'); }; - -export default provideServices; diff --git a/src/settings/RealTimeUpdatesSettings.tsx b/src/settings/RealTimeUpdatesSettings.tsx index f587baa8..99be265f 100644 --- a/src/settings/RealTimeUpdatesSettings.tsx +++ b/src/settings/RealTimeUpdatesSettings.tsx @@ -1,11 +1,11 @@ -import { FormGroup, Input } from 'reactstrap'; import classNames from 'classnames'; -import { ToggleSwitch } from '../utils/ToggleSwitch'; -import { SimpleCard } from '../utils/SimpleCard'; +import { FormGroup, Input } from 'reactstrap'; import { FormText } from '../utils/forms/FormText'; import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup'; -import { Settings } from './reducers/settings'; import { useDomId } from '../utils/helpers/hooks'; +import { SimpleCard } from '../utils/SimpleCard'; +import { ToggleSwitch } from '../utils/ToggleSwitch'; +import type { Settings } from './reducers/settings'; interface RealTimeUpdatesProps { settings: Settings; diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index d1c8fd72..cf39be3c 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -1,5 +1,5 @@ -import { FC, ReactNode } from 'react'; -import { Navigate, Routes, Route } from 'react-router-dom'; +import type { FC, ReactNode } from 'react'; +import { Navigate, Route, Routes } from 'react-router-dom'; import { NoMenuLayout } from '../common/NoMenuLayout'; import { NavPillItem, NavPills } from '../utils/NavPills'; diff --git a/src/settings/ShortUrlCreationSettings.tsx b/src/settings/ShortUrlCreationSettings.tsx index d5523550..736c032a 100644 --- a/src/settings/ShortUrlCreationSettings.tsx +++ b/src/settings/ShortUrlCreationSettings.tsx @@ -1,11 +1,11 @@ -import { FC, ReactNode } from 'react'; +import type { FC, ReactNode } from 'react'; import { DropdownItem, FormGroup } from 'reactstrap'; -import { SimpleCard } from '../utils/SimpleCard'; -import { ToggleSwitch } from '../utils/ToggleSwitch'; import { DropdownBtn } from '../utils/DropdownBtn'; import { FormText } from '../utils/forms/FormText'; import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup'; -import { Settings, ShortUrlCreationSettings as ShortUrlsSettings, TagFilteringMode } from './reducers/settings'; +import { SimpleCard } from '../utils/SimpleCard'; +import { ToggleSwitch } from '../utils/ToggleSwitch'; +import type { Settings, ShortUrlCreationSettings as ShortUrlsSettings, TagFilteringMode } from './reducers/settings'; interface ShortUrlCreationProps { settings: Settings; diff --git a/src/settings/ShortUrlsListSettings.tsx b/src/settings/ShortUrlsListSettings.tsx index bb5f6f8c..802d26cd 100644 --- a/src/settings/ShortUrlsListSettings.tsx +++ b/src/settings/ShortUrlsListSettings.tsx @@ -1,9 +1,10 @@ -import { FC } from 'react'; -import { OrderingDropdown } from '../utils/OrderingDropdown'; +import type { FC } from 'react'; import { SHORT_URLS_ORDERABLE_FIELDS } from '../short-urls/data'; -import { SimpleCard } from '../utils/SimpleCard'; import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup'; -import { DEFAULT_SHORT_URLS_ORDERING, Settings, ShortUrlsListSettings as ShortUrlsSettings } from './reducers/settings'; +import { OrderingDropdown } from '../utils/OrderingDropdown'; +import { SimpleCard } from '../utils/SimpleCard'; +import type { Settings, ShortUrlsListSettings as ShortUrlsSettings } from './reducers/settings'; +import { DEFAULT_SHORT_URLS_ORDERING } from './reducers/settings'; interface ShortUrlsListSettingsProps { settings: Settings; diff --git a/src/settings/TagsSettings.tsx b/src/settings/TagsSettings.tsx index 8cb5631d..ae3f395b 100644 --- a/src/settings/TagsSettings.tsx +++ b/src/settings/TagsSettings.tsx @@ -1,9 +1,9 @@ -import { FC } from 'react'; -import { SimpleCard } from '../utils/SimpleCard'; -import { OrderingDropdown } from '../utils/OrderingDropdown'; +import type { FC } from 'react'; import { TAGS_ORDERABLE_FIELDS } from '../tags/data/TagsListChildrenProps'; import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup'; -import { Settings, TagsSettings as TagsSettingsOptions } from './reducers/settings'; +import { OrderingDropdown } from '../utils/OrderingDropdown'; +import { SimpleCard } from '../utils/SimpleCard'; +import type { Settings, TagsSettings as TagsSettingsOptions } from './reducers/settings'; interface TagsProps { settings: Settings; diff --git a/src/settings/UserInterfaceSettings.tsx b/src/settings/UserInterfaceSettings.tsx index e21b3460..a2be2fdc 100644 --- a/src/settings/UserInterfaceSettings.tsx +++ b/src/settings/UserInterfaceSettings.tsx @@ -1,10 +1,11 @@ -import { FC } from 'react'; +import { faMoon, faSun } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faSun, faMoon } from '@fortawesome/free-solid-svg-icons'; +import type { FC } from 'react'; import { SimpleCard } from '../utils/SimpleCard'; +import type { Theme } from '../utils/theme'; +import { changeThemeInMarkup } from '../utils/theme'; import { ToggleSwitch } from '../utils/ToggleSwitch'; -import { changeThemeInMarkup, Theme } from '../utils/theme'; -import { Settings, UiSettings } from './reducers/settings'; +import type { Settings, UiSettings } from './reducers/settings'; import './UserInterfaceSettings.scss'; interface UserInterfaceProps { diff --git a/src/settings/VisitsSettings.tsx b/src/settings/VisitsSettings.tsx index a799bd2a..10dcba71 100644 --- a/src/settings/VisitsSettings.tsx +++ b/src/settings/VisitsSettings.tsx @@ -1,12 +1,12 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { FormGroup } from 'reactstrap'; -import { SimpleCard } from '../utils/SimpleCard'; import { DateIntervalSelector } from '../utils/dates/DateIntervalSelector'; -import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup'; -import { Settings, VisitsSettings as VisitsSettingsConfig } from './reducers/settings'; -import { ToggleSwitch } from '../utils/ToggleSwitch'; import { FormText } from '../utils/forms/FormText'; -import { DateInterval } from '../utils/helpers/dateIntervals'; +import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup'; +import type { DateInterval } from '../utils/helpers/dateIntervals'; +import { SimpleCard } from '../utils/SimpleCard'; +import { ToggleSwitch } from '../utils/ToggleSwitch'; +import type { Settings, VisitsSettings as VisitsSettingsConfig } from './reducers/settings'; interface VisitsProps { settings: Settings; diff --git a/src/settings/helpers/index.ts b/src/settings/helpers/index.ts index 10af7ccd..de01ff55 100644 --- a/src/settings/helpers/index.ts +++ b/src/settings/helpers/index.ts @@ -1,4 +1,4 @@ -import { ShlinkState } from '../../container/types'; +import type { ShlinkState } from '../../container/types'; /* eslint-disable no-param-reassign */ export const migrateDeprecatedSettings = (state: Partial): Partial => { diff --git a/src/settings/reducers/settings.ts b/src/settings/reducers/settings.ts index c8df4c48..fac7e151 100644 --- a/src/settings/reducers/settings.ts +++ b/src/settings/reducers/settings.ts @@ -1,9 +1,10 @@ -import { createSlice, PayloadAction, PrepareAction } from '@reduxjs/toolkit'; +import type { PayloadAction, PrepareAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; import { mergeDeepRight } from 'ramda'; -import { Theme } from '../../utils/theme'; -import { DateInterval } from '../../utils/helpers/dateIntervals'; -import { TagsOrder } from '../../tags/data/TagsListChildrenProps'; -import { ShortUrlsOrder } from '../../short-urls/data'; +import type { ShortUrlsOrder } from '../../short-urls/data'; +import type { TagsOrder } from '../../tags/data/TagsListChildrenProps'; +import type { DateInterval } from '../../utils/helpers/dateIntervals'; +import type { Theme } from '../../utils/theme'; export const DEFAULT_SHORT_URLS_ORDERING: ShortUrlsOrder = { field: 'dateCreated', diff --git a/src/settings/services/provideServices.ts b/src/settings/services/provideServices.ts index d64b8592..8f9dc9e4 100644 --- a/src/settings/services/provideServices.ts +++ b/src/settings/services/provideServices.ts @@ -1,6 +1,7 @@ -import Bottle from 'bottlejs'; +import type Bottle from 'bottlejs'; +import type { ConnectDecorator } from '../../container/types'; +import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer'; import { RealTimeUpdatesSettings } from '../RealTimeUpdatesSettings'; -import { Settings } from '../Settings'; import { setRealTimeUpdatesInterval, setShortUrlCreationSettings, @@ -10,15 +11,14 @@ import { setVisitsSettings, toggleRealTimeUpdates, } from '../reducers/settings'; -import { ConnectDecorator } from '../../container/types'; -import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer'; +import { Settings } from '../Settings'; import { ShortUrlCreationSettings } from '../ShortUrlCreationSettings'; +import { ShortUrlsListSettings } from '../ShortUrlsListSettings'; +import { TagsSettings } from '../TagsSettings'; import { UserInterfaceSettings } from '../UserInterfaceSettings'; import { VisitsSettings } from '../VisitsSettings'; -import { TagsSettings } from '../TagsSettings'; -import { ShortUrlsListSettings } from '../ShortUrlsListSettings'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory( 'Settings', @@ -63,5 +63,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('setVisitsSettings', () => setVisitsSettings); bottle.serviceFactory('setTagsSettings', () => setTagsSettings); }; - -export default provideServices; diff --git a/src/short-urls/CreateShortUrl.tsx b/src/short-urls/CreateShortUrl.tsx index 2f045023..66ed0754 100644 --- a/src/short-urls/CreateShortUrl.tsx +++ b/src/short-urls/CreateShortUrl.tsx @@ -1,10 +1,11 @@ -import { FC, useMemo } from 'react'; -import { SelectedServer } from '../servers/data'; -import { Settings, ShortUrlCreationSettings } from '../settings/reducers/settings'; -import { ShortUrlData } from './data'; -import { ShortUrlCreation } from './reducers/shortUrlCreation'; -import { CreateShortUrlResultProps } from './helpers/CreateShortUrlResult'; -import { ShortUrlFormProps } from './ShortUrlForm'; +import type { FC } from 'react'; +import { useMemo } from 'react'; +import type { SelectedServer } from '../servers/data'; +import type { Settings, ShortUrlCreationSettings } from '../settings/reducers/settings'; +import type { ShortUrlData } from './data'; +import type { CreateShortUrlResultProps } from './helpers/CreateShortUrlResult'; +import type { ShortUrlCreation } from './reducers/shortUrlCreation'; +import type { ShortUrlFormProps } from './ShortUrlForm'; export interface CreateShortUrlProps { basicMode?: boolean; diff --git a/src/short-urls/EditShortUrl.tsx b/src/short-urls/EditShortUrl.tsx index db8c4d43..0af479cc 100644 --- a/src/short-urls/EditShortUrl.tsx +++ b/src/short-urls/EditShortUrl.tsx @@ -1,21 +1,22 @@ -import { FC, useEffect, useMemo } from 'react'; -import { Button, Card } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faArrowLeft } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import { useEffect, useMemo } from 'react'; import { ExternalLink } from 'react-external-link'; import { useLocation, useParams } from 'react-router-dom'; -import { SelectedServer } from '../servers/data'; -import { Settings } from '../settings/reducers/settings'; -import { ShortUrlIdentifier } from './data'; +import { Button, Card } from 'reactstrap'; +import { ShlinkApiError } from '../api/ShlinkApiError'; +import type { SelectedServer } from '../servers/data'; +import type { Settings } from '../settings/reducers/settings'; +import { useGoBack } from '../utils/helpers/hooks'; import { parseQuery } from '../utils/helpers/query'; import { Message } from '../utils/Message'; import { Result } from '../utils/Result'; -import { ShlinkApiError } from '../api/ShlinkApiError'; -import { useGoBack } from '../utils/helpers/hooks'; -import { ShortUrlFormProps } from './ShortUrlForm'; -import { ShortUrlDetail } from './reducers/shortUrlDetail'; -import { EditShortUrl as EditShortUrlInfo, ShortUrlEdition } from './reducers/shortUrlEdition'; +import type { ShortUrlIdentifier } from './data'; import { shortUrlDataFromShortUrl, urlDecodeShortCode } from './helpers'; +import type { ShortUrlDetail } from './reducers/shortUrlDetail'; +import type { EditShortUrl as EditShortUrlInfo, ShortUrlEdition } from './reducers/shortUrlEdition'; +import type { ShortUrlFormProps } from './ShortUrlForm'; interface EditShortUrlConnectProps { settings: Settings; diff --git a/src/short-urls/Paginator.tsx b/src/short-urls/Paginator.tsx index 5e7d488e..6fb098b9 100644 --- a/src/short-urls/Paginator.tsx +++ b/src/short-urls/Paginator.tsx @@ -1,13 +1,14 @@ import { Link } from 'react-router-dom'; import { Pagination, PaginationItem, PaginationLink } from 'reactstrap'; +import type { ShlinkPaginator } from '../api/types'; +import type { + NumberOrEllipsis } from '../utils/helpers/pagination'; import { - pageIsEllipsis, keyForPage, - progressivePagination, + pageIsEllipsis, prettifyPageNumber, - NumberOrEllipsis, + progressivePagination, } from '../utils/helpers/pagination'; -import { ShlinkPaginator } from '../api/types'; interface PaginatorProps { paginator?: ShlinkPaginator; diff --git a/src/short-urls/ShortUrlForm.tsx b/src/short-urls/ShortUrlForm.tsx index f949de66..1824ec99 100644 --- a/src/short-urls/ShortUrlForm.tsx +++ b/src/short-urls/ShortUrlForm.tsx @@ -1,20 +1,23 @@ -import { FC, useEffect, useState } from 'react'; -import { InputType } from 'reactstrap/types/lib/Input'; -import { Button, FormGroup, Input, Row } from 'reactstrap'; -import { cond, isEmpty, pipe, replace, trim, T } from 'ramda'; import { parseISO } from 'date-fns'; -import { DateTimeInput, DateTimeInputProps } from '../utils/dates/DateTimeInput'; +import { cond, isEmpty, pipe, replace, T, trim } from 'ramda'; +import type { FC } from 'react'; +import { useEffect, useState } from 'react'; +import { Button, FormGroup, Input, Row } from 'reactstrap'; +import type { InputType } from 'reactstrap/types/lib/Input'; +import type { DomainSelectorProps } from '../domains/DomainSelector'; +import type { SelectedServer } from '../servers/data'; +import type { TagsSelectorProps } from '../tags/helpers/TagsSelector'; +import { Checkbox } from '../utils/Checkbox'; +import type { DateTimeInputProps } from '../utils/dates/DateTimeInput'; +import { DateTimeInput } from '../utils/dates/DateTimeInput'; +import { formatIsoDate } from '../utils/helpers/date'; import { supportsForwardQuery } from '../utils/helpers/features'; import { SimpleCard } from '../utils/SimpleCard'; -import { handleEventPreventingDefault, hasValue, OptionalString } from '../utils/utils'; -import { Checkbox } from '../utils/Checkbox'; -import { SelectedServer } from '../servers/data'; -import { TagsSelectorProps } from '../tags/helpers/TagsSelector'; -import { DomainSelectorProps } from '../domains/DomainSelector'; -import { formatIsoDate } from '../utils/helpers/date'; -import { UseExistingIfFoundInfoIcon } from './UseExistingIfFoundInfoIcon'; -import { ShortUrlData } from './data'; +import type { OptionalString } from '../utils/utils'; +import { handleEventPreventingDefault, hasValue } from '../utils/utils'; +import type { ShortUrlData } from './data'; import { ShortUrlFormCheckboxGroup } from './helpers/ShortUrlFormCheckboxGroup'; +import { UseExistingIfFoundInfoIcon } from './UseExistingIfFoundInfoIcon'; import './ShortUrlForm.scss'; export type Mode = 'create' | 'create-basic' | 'edit'; diff --git a/src/short-urls/ShortUrlsFilteringBar.tsx b/src/short-urls/ShortUrlsFilteringBar.tsx index b1cdb5a8..9d01f500 100644 --- a/src/short-urls/ShortUrlsFilteringBar.tsx +++ b/src/short-urls/ShortUrlsFilteringBar.tsx @@ -1,23 +1,25 @@ -import { FC } from 'react'; -import { isEmpty, pipe } from 'ramda'; -import { Button, InputGroup, Row, UncontrolledTooltip } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faTag, faTags } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classNames from 'classnames'; -import { SearchField } from '../utils/SearchField'; +import { isEmpty, pipe } from 'ramda'; +import type { FC } from 'react'; +import { Button, InputGroup, Row, UncontrolledTooltip } from 'reactstrap'; +import type { SelectedServer } from '../servers/data'; +import type { Settings } from '../settings/reducers/settings'; +import type { TagsSelectorProps } from '../tags/helpers/TagsSelector'; import { DateRangeSelector } from '../utils/dates/DateRangeSelector'; import { formatIsoDate } from '../utils/helpers/date'; -import { DateRange, datesToDateRange } from '../utils/helpers/dateIntervals'; +import type { DateRange } from '../utils/helpers/dateIntervals'; +import { datesToDateRange } from '../utils/helpers/dateIntervals'; import { supportsAllTagsFiltering, supportsFilterDisabledUrls } from '../utils/helpers/features'; -import { SelectedServer } from '../servers/data'; -import { OrderDir } from '../utils/helpers/ordering'; +import type { OrderDir } from '../utils/helpers/ordering'; import { OrderingDropdown } from '../utils/OrderingDropdown'; +import { SearchField } from '../utils/SearchField'; +import type { ShortUrlsOrder, ShortUrlsOrderableFields } from './data'; +import { SHORT_URLS_ORDERABLE_FIELDS } from './data'; +import type { ExportShortUrlsBtnProps } from './helpers/ExportShortUrlsBtn'; import { useShortUrlsQuery } from './helpers/hooks'; -import { SHORT_URLS_ORDERABLE_FIELDS, ShortUrlsOrder, ShortUrlsOrderableFields } from './data'; -import { ExportShortUrlsBtnProps } from './helpers/ExportShortUrlsBtn'; -import { TagsSelectorProps } from '../tags/helpers/TagsSelector'; import { ShortUrlsFilterDropdown } from './helpers/ShortUrlsFilterDropdown'; -import { Settings } from '../settings/reducers/settings'; import './ShortUrlsFilteringBar.scss'; interface ShortUrlsFilteringProps { diff --git a/src/short-urls/ShortUrlsList.tsx b/src/short-urls/ShortUrlsList.tsx index b29dc925..a5afaf7e 100644 --- a/src/short-urls/ShortUrlsList.tsx +++ b/src/short-urls/ShortUrlsList.tsx @@ -1,21 +1,24 @@ import { pipe } from 'ramda'; import { useEffect, useState } from 'react'; -import { Card } from 'reactstrap'; import { useLocation, useParams } from 'react-router-dom'; -import { determineOrderDir, OrderDir } from '../utils/helpers/ordering'; -import { getServerId, SelectedServer } from '../servers/data'; +import { Card } from 'reactstrap'; +import type { ShlinkShortUrlsListParams, ShlinkShortUrlsOrder } from '../api/types'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; -import { TableOrderIcon } from '../utils/table/TableOrderIcon'; -import { ShlinkShortUrlsListParams, ShlinkShortUrlsOrder } from '../api/types'; -import { DEFAULT_SHORT_URLS_ORDERING, Settings } from '../settings/reducers/settings'; -import { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList'; -import { ShortUrlsTableType } from './ShortUrlsTable'; -import { Paginator } from './Paginator'; -import { useShortUrlsQuery } from './helpers/hooks'; -import { ShortUrlsOrder, ShortUrlsOrderableFields } from './data'; -import { ShortUrlsFilteringBarType } from './ShortUrlsFilteringBar'; +import type { SelectedServer } from '../servers/data'; +import { getServerId } from '../servers/data'; +import type { Settings } from '../settings/reducers/settings'; +import { DEFAULT_SHORT_URLS_ORDERING } from '../settings/reducers/settings'; import { supportsExcludeBotsOnShortUrls } from '../utils/helpers/features'; +import type { OrderDir } from '../utils/helpers/ordering'; +import { determineOrderDir } from '../utils/helpers/ordering'; +import { TableOrderIcon } from '../utils/table/TableOrderIcon'; +import type { ShortUrlsOrder, ShortUrlsOrderableFields } from './data'; +import { useShortUrlsQuery } from './helpers/hooks'; +import { Paginator } from './Paginator'; +import type { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList'; +import type { ShortUrlsFilteringBarType } from './ShortUrlsFilteringBar'; +import type { ShortUrlsTableType } from './ShortUrlsTable'; interface ShortUrlsListProps { selectedServer: SelectedServer; diff --git a/src/short-urls/ShortUrlsTable.tsx b/src/short-urls/ShortUrlsTable.tsx index 4448af12..5851a58a 100644 --- a/src/short-urls/ShortUrlsTable.tsx +++ b/src/short-urls/ShortUrlsTable.tsx @@ -1,10 +1,10 @@ -import { ReactNode } from 'react'; -import { isEmpty } from 'ramda'; import classNames from 'classnames'; -import { SelectedServer } from '../servers/data'; -import { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList'; -import { ShortUrlsRowType } from './helpers/ShortUrlsRow'; -import { ShortUrlsOrderableFields } from './data'; +import { isEmpty } from 'ramda'; +import type { ReactNode } from 'react'; +import type { SelectedServer } from '../servers/data'; +import type { ShortUrlsOrderableFields } from './data'; +import type { ShortUrlsRowType } from './helpers/ShortUrlsRow'; +import type { ShortUrlsList as ShortUrlsListState } from './reducers/shortUrlsList'; import './ShortUrlsTable.scss'; interface ShortUrlsTableProps { diff --git a/src/short-urls/UseExistingIfFoundInfoIcon.tsx b/src/short-urls/UseExistingIfFoundInfoIcon.tsx index 2732247e..32c8d130 100644 --- a/src/short-urls/UseExistingIfFoundInfoIcon.tsx +++ b/src/short-urls/UseExistingIfFoundInfoIcon.tsx @@ -1,5 +1,5 @@ -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Modal, ModalBody, ModalHeader } from 'reactstrap'; import { useToggle } from '../utils/helpers/hooks'; import './UseExistingIfFoundInfoIcon.scss'; diff --git a/src/short-urls/data/index.ts b/src/short-urls/data/index.ts index c0ed41e2..78a59318 100644 --- a/src/short-urls/data/index.ts +++ b/src/short-urls/data/index.ts @@ -1,5 +1,5 @@ -import { Nullable, OptionalString } from '../../utils/utils'; -import { Order } from '../../utils/helpers/ordering'; +import type { Order } from '../../utils/helpers/ordering'; +import type { Nullable, OptionalString } from '../../utils/utils'; export interface EditShortUrlData { longUrl?: string; diff --git a/src/short-urls/helpers/CreateShortUrlResult.tsx b/src/short-urls/helpers/CreateShortUrlResult.tsx index 220eb42f..d5abd35d 100644 --- a/src/short-urls/helpers/CreateShortUrlResult.tsx +++ b/src/short-urls/helpers/CreateShortUrlResult.tsx @@ -4,11 +4,11 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { useEffect } from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; import { Tooltip } from 'reactstrap'; -import { ShortUrlCreation } from '../reducers/shortUrlCreation'; -import { TimeoutToggle } from '../../utils/helpers/hooks'; -import { Result } from '../../utils/Result'; -import './CreateShortUrlResult.scss'; import { ShlinkApiError } from '../../api/ShlinkApiError'; +import type { TimeoutToggle } from '../../utils/helpers/hooks'; +import { Result } from '../../utils/Result'; +import type { ShortUrlCreation } from '../reducers/shortUrlCreation'; +import './CreateShortUrlResult.scss'; export interface CreateShortUrlResultProps { creation: ShortUrlCreation; diff --git a/src/short-urls/helpers/DeleteShortUrlModal.tsx b/src/short-urls/helpers/DeleteShortUrlModal.tsx index e62a946e..205680ce 100644 --- a/src/short-urls/helpers/DeleteShortUrlModal.tsx +++ b/src/short-urls/helpers/DeleteShortUrlModal.tsx @@ -1,12 +1,12 @@ +import { pipe } from 'ramda'; import { useEffect, useState } from 'react'; import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; -import { pipe } from 'ramda'; -import { ShortUrlDeletion } from '../reducers/shortUrlDeletion'; -import { ShortUrlIdentifier, ShortUrlModalProps } from '../data'; -import { handleEventPreventingDefault } from '../../utils/utils'; -import { Result } from '../../utils/Result'; -import { isInvalidDeletionError } from '../../api/utils'; import { ShlinkApiError } from '../../api/ShlinkApiError'; +import { isInvalidDeletionError } from '../../api/utils'; +import { Result } from '../../utils/Result'; +import { handleEventPreventingDefault } from '../../utils/utils'; +import type { ShortUrlIdentifier, ShortUrlModalProps } from '../data'; +import type { ShortUrlDeletion } from '../reducers/shortUrlDeletion'; interface DeleteShortUrlModalConnectProps extends ShortUrlModalProps { shortUrlDeletion: ShortUrlDeletion; diff --git a/src/short-urls/helpers/ExportShortUrlsBtn.tsx b/src/short-urls/helpers/ExportShortUrlsBtn.tsx index 35403d1d..88f502e7 100644 --- a/src/short-urls/helpers/ExportShortUrlsBtn.tsx +++ b/src/short-urls/helpers/ExportShortUrlsBtn.tsx @@ -1,10 +1,11 @@ -import { FC } from 'react'; +import type { FC } from 'react'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ReportExporter } from '../../common/services/ReportExporter'; +import type { SelectedServer } from '../../servers/data'; +import { isServerWithId } from '../../servers/data'; import { ExportBtn } from '../../utils/ExportBtn'; import { useToggle } from '../../utils/helpers/hooks'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { isServerWithId, SelectedServer } from '../../servers/data'; -import { ShortUrl } from '../data'; -import { ReportExporter } from '../../common/services/ReportExporter'; +import type { ShortUrl } from '../data'; import { useShortUrlsQuery } from './hooks'; export interface ExportShortUrlsBtnProps { diff --git a/src/short-urls/helpers/QrCodeModal.tsx b/src/short-urls/helpers/QrCodeModal.tsx index f4bda9eb..e0bdb25b 100644 --- a/src/short-urls/helpers/QrCodeModal.tsx +++ b/src/short-urls/helpers/QrCodeModal.tsx @@ -1,16 +1,17 @@ -import { useMemo, useState } from 'react'; -import { Modal, FormGroup, ModalBody, ModalHeader, Row, Button } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faFileDownload as downloadIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { useMemo, useState } from 'react'; import { ExternalLink } from 'react-external-link'; -import { ShortUrlModalProps } from '../data'; -import { SelectedServer } from '../../servers/data'; +import { Button, FormGroup, Modal, ModalBody, ModalHeader, Row } from 'reactstrap'; +import type { ImageDownloader } from '../../common/services/ImageDownloader'; +import type { SelectedServer } from '../../servers/data'; import { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon'; -import { buildQrCodeUrl, QrCodeFormat, QrErrorCorrection } from '../../utils/helpers/qrCodes'; import { supportsNonRestCors } from '../../utils/helpers/features'; -import { ImageDownloader } from '../../common/services/ImageDownloader'; -import { QrFormatDropdown } from './qr-codes/QrFormatDropdown'; +import type { QrCodeFormat, QrErrorCorrection } from '../../utils/helpers/qrCodes'; +import { buildQrCodeUrl } from '../../utils/helpers/qrCodes'; +import type { ShortUrlModalProps } from '../data'; import { QrErrorCorrectionDropdown } from './qr-codes/QrErrorCorrectionDropdown'; +import { QrFormatDropdown } from './qr-codes/QrFormatDropdown'; import './QrCodeModal.scss'; interface QrCodeModalConnectProps extends ShortUrlModalProps { diff --git a/src/short-urls/helpers/ShortUrlDetailLink.tsx b/src/short-urls/helpers/ShortUrlDetailLink.tsx index 82adc6ba..89a91726 100644 --- a/src/short-urls/helpers/ShortUrlDetailLink.tsx +++ b/src/short-urls/helpers/ShortUrlDetailLink.tsx @@ -1,7 +1,8 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { Link } from 'react-router-dom'; -import { isServerWithId, SelectedServer, ServerWithId } from '../../servers/data'; -import { ShortUrl } from '../data'; +import type { SelectedServer, ServerWithId } from '../../servers/data'; +import { isServerWithId } from '../../servers/data'; +import type { ShortUrl } from '../data'; import { urlEncodeShortCode } from './index'; export type LinkSuffix = 'visits' | 'edit'; diff --git a/src/short-urls/helpers/ShortUrlFormCheckboxGroup.tsx b/src/short-urls/helpers/ShortUrlFormCheckboxGroup.tsx index 8d933df5..67e17d79 100644 --- a/src/short-urls/helpers/ShortUrlFormCheckboxGroup.tsx +++ b/src/short-urls/helpers/ShortUrlFormCheckboxGroup.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, FC, PropsWithChildren } from 'react'; +import type { ChangeEvent, FC, PropsWithChildren } from 'react'; import { Checkbox } from '../../utils/Checkbox'; import { InfoTooltip } from '../../utils/InfoTooltip'; diff --git a/src/short-urls/helpers/ShortUrlStatus.tsx b/src/short-urls/helpers/ShortUrlStatus.tsx index 0803e658..ec490b01 100644 --- a/src/short-urls/helpers/ShortUrlStatus.tsx +++ b/src/short-urls/helpers/ShortUrlStatus.tsx @@ -1,12 +1,12 @@ -import { FC, ReactNode } from 'react'; +import type { IconDefinition } from '@fortawesome/fontawesome-common-types'; +import { faCalendarXmark, faCheck, faLinkSlash } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { IconDefinition } from '@fortawesome/fontawesome-common-types'; -import { faLinkSlash, faCalendarXmark, faCheck } from '@fortawesome/free-solid-svg-icons'; -import { UncontrolledTooltip } from 'reactstrap'; import { isBefore } from 'date-fns'; -import { ShortUrl } from '../data'; +import type { FC, ReactNode } from 'react'; +import { UncontrolledTooltip } from 'reactstrap'; import { formatHumanFriendly, now, parseISO } from '../../utils/helpers/date'; import { useElementRef } from '../../utils/helpers/hooks'; +import type { ShortUrl } from '../data'; interface ShortUrlStatusProps { shortUrl: ShortUrl; diff --git a/src/short-urls/helpers/ShortUrlVisitsCount.tsx b/src/short-urls/helpers/ShortUrlVisitsCount.tsx index b73cc595..0dd53396 100644 --- a/src/short-urls/helpers/ShortUrlVisitsCount.tsx +++ b/src/short-urls/helpers/ShortUrlVisitsCount.tsx @@ -1,13 +1,13 @@ -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons'; -import { UncontrolledTooltip } from 'reactstrap'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classNames from 'classnames'; -import { prettify } from '../../utils/helpers/numbers'; -import { ShortUrl } from '../data'; -import { SelectedServer } from '../../servers/data'; -import { ShortUrlDetailLink } from './ShortUrlDetailLink'; +import { UncontrolledTooltip } from 'reactstrap'; +import type { SelectedServer } from '../../servers/data'; import { formatHumanFriendly, parseISO } from '../../utils/helpers/date'; import { useElementRef } from '../../utils/helpers/hooks'; +import { prettify } from '../../utils/helpers/numbers'; +import type { ShortUrl } from '../data'; +import { ShortUrlDetailLink } from './ShortUrlDetailLink'; import './ShortUrlVisitsCount.scss'; interface ShortUrlVisitsCountProps { diff --git a/src/short-urls/helpers/ShortUrlsFilterDropdown.tsx b/src/short-urls/helpers/ShortUrlsFilterDropdown.tsx index 5d774e1a..3e1366a6 100644 --- a/src/short-urls/helpers/ShortUrlsFilterDropdown.tsx +++ b/src/short-urls/helpers/ShortUrlsFilterDropdown.tsx @@ -1,7 +1,7 @@ import { DropdownItem } from 'reactstrap'; import { DropdownBtn } from '../../utils/DropdownBtn'; import { hasValue } from '../../utils/utils'; -import { ShortUrlsFilter } from '../data'; +import type { ShortUrlsFilter } from '../data'; interface ShortUrlsFilterDropdownProps { onChange: (filters: ShortUrlsFilter) => void; diff --git a/src/short-urls/helpers/ShortUrlsRow.tsx b/src/short-urls/helpers/ShortUrlsRow.tsx index 1104ba83..5e3d4748 100644 --- a/src/short-urls/helpers/ShortUrlsRow.tsx +++ b/src/short-urls/helpers/ShortUrlsRow.tsx @@ -1,17 +1,18 @@ -import { FC, useEffect, useRef } from 'react'; +import type { FC } from 'react'; +import { useEffect, useRef } from 'react'; import { ExternalLink } from 'react-external-link'; -import { ColorGenerator } from '../../utils/services/ColorGenerator'; -import { TimeoutToggle } from '../../utils/helpers/hooks'; -import { SelectedServer } from '../../servers/data'; +import type { SelectedServer } from '../../servers/data'; +import type { Settings } from '../../settings/reducers/settings'; import { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon'; -import { ShortUrl } from '../data'; import { Time } from '../../utils/dates/Time'; -import { Settings } from '../../settings/reducers/settings'; -import { ShortUrlVisitsCount } from './ShortUrlVisitsCount'; -import { ShortUrlsRowMenuType } from './ShortUrlsRowMenu'; -import { Tags } from './Tags'; -import { ShortUrlStatus } from './ShortUrlStatus'; +import type { TimeoutToggle } from '../../utils/helpers/hooks'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; +import type { ShortUrl } from '../data'; import { useShortUrlsQuery } from './hooks'; +import type { ShortUrlsRowMenuType } from './ShortUrlsRowMenu'; +import { ShortUrlStatus } from './ShortUrlStatus'; +import { ShortUrlVisitsCount } from './ShortUrlVisitsCount'; +import { Tags } from './Tags'; import './ShortUrlsRow.scss'; interface ShortUrlsRowProps { diff --git a/src/short-urls/helpers/ShortUrlsRowMenu.tsx b/src/short-urls/helpers/ShortUrlsRowMenu.tsx index 39d32075..7b08fe89 100644 --- a/src/short-urls/helpers/ShortUrlsRowMenu.tsx +++ b/src/short-urls/helpers/ShortUrlsRowMenu.tsx @@ -1,16 +1,16 @@ import { faChartPie as pieChartIcon, - faQrcode as qrIcon, - faMinusCircle as deleteIcon, faEdit as editIcon, + faMinusCircle as deleteIcon, + faQrcode as qrIcon, } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { FC } from 'react'; +import type { FC } from 'react'; import { DropdownItem } from 'reactstrap'; -import { useToggle } from '../../utils/helpers/hooks'; -import { ShortUrl, ShortUrlModalProps } from '../data'; -import { SelectedServer } from '../../servers/data'; +import type { SelectedServer } from '../../servers/data'; import { DropdownBtnMenu } from '../../utils/DropdownBtnMenu'; +import { useToggle } from '../../utils/helpers/hooks'; +import type { ShortUrl, ShortUrlModalProps } from '../data'; import { ShortUrlDetailLink } from './ShortUrlDetailLink'; interface ShortUrlsRowMenuProps { diff --git a/src/short-urls/helpers/Tags.tsx b/src/short-urls/helpers/Tags.tsx index f95a4511..b6bd6067 100644 --- a/src/short-urls/helpers/Tags.tsx +++ b/src/short-urls/helpers/Tags.tsx @@ -1,7 +1,7 @@ -import { FC } from 'react'; import { isEmpty } from 'ramda'; +import type { FC } from 'react'; import { Tag } from '../../tags/helpers/Tag'; -import { ColorGenerator } from '../../utils/services/ColorGenerator'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; interface TagsProps { tags: string[]; diff --git a/src/short-urls/helpers/hooks.ts b/src/short-urls/helpers/hooks.ts index 95cc5a43..054d5d49 100644 --- a/src/short-urls/helpers/hooks.ts +++ b/src/short-urls/helpers/hooks.ts @@ -1,11 +1,12 @@ -import { useParams, useLocation, useNavigate } from 'react-router-dom'; -import { useMemo } from 'react'; import { isEmpty, pipe } from 'ramda'; -import { parseQuery, stringifyQuery } from '../../utils/helpers/query'; -import { ShortUrlsOrder, ShortUrlsOrderableFields } from '../data'; +import { useMemo } from 'react'; +import { useLocation, useNavigate, useParams } from 'react-router-dom'; +import type { TagsFilteringMode } from '../../api/types'; import { orderToString, stringToOrder } from '../../utils/helpers/ordering'; -import { TagsFilteringMode } from '../../api/types'; -import { BooleanString, parseOptionalBooleanToString } from '../../utils/utils'; +import { parseQuery, stringifyQuery } from '../../utils/helpers/query'; +import type { BooleanString } from '../../utils/utils'; +import { parseOptionalBooleanToString } from '../../utils/utils'; +import type { ShortUrlsOrder, ShortUrlsOrderableFields } from '../data'; interface ShortUrlsQueryCommon { search?: string; diff --git a/src/short-urls/helpers/index.ts b/src/short-urls/helpers/index.ts index e4dd1f09..a5042608 100644 --- a/src/short-urls/helpers/index.ts +++ b/src/short-urls/helpers/index.ts @@ -1,8 +1,8 @@ import { isNil } from 'ramda'; -import { ShortUrl, ShortUrlData } from '../data'; -import { OptionalString } from '../../utils/utils'; +import type { ShortUrlCreationSettings } from '../../settings/reducers/settings'; +import type { OptionalString } from '../../utils/utils'; import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits'; -import { ShortUrlCreationSettings } from '../../settings/reducers/settings'; +import type { ShortUrl, ShortUrlData } from '../data'; export const shortUrlMatches = (shortUrl: ShortUrl, shortCode: string, domain: OptionalString): boolean => { if (isNil(domain)) { diff --git a/src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.tsx b/src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.tsx index b6fd68b7..81673261 100644 --- a/src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.tsx +++ b/src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.tsx @@ -1,7 +1,7 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { DropdownItem } from 'reactstrap'; import { DropdownBtn } from '../../../utils/DropdownBtn'; -import { QrErrorCorrection } from '../../../utils/helpers/qrCodes'; +import type { QrErrorCorrection } from '../../../utils/helpers/qrCodes'; interface QrErrorCorrectionDropdownProps { errorCorrection: QrErrorCorrection; diff --git a/src/short-urls/helpers/qr-codes/QrFormatDropdown.tsx b/src/short-urls/helpers/qr-codes/QrFormatDropdown.tsx index 3c9ca705..c7170b9c 100644 --- a/src/short-urls/helpers/qr-codes/QrFormatDropdown.tsx +++ b/src/short-urls/helpers/qr-codes/QrFormatDropdown.tsx @@ -1,7 +1,7 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { DropdownItem } from 'reactstrap'; import { DropdownBtn } from '../../../utils/DropdownBtn'; -import { QrCodeFormat } from '../../../utils/helpers/qrCodes'; +import type { QrCodeFormat } from '../../../utils/helpers/qrCodes'; interface QrFormatDropdownProps { format: QrCodeFormat; diff --git a/src/short-urls/reducers/shortUrlCreation.ts b/src/short-urls/reducers/shortUrlCreation.ts index 1a48b63e..c68c3a28 100644 --- a/src/short-urls/reducers/shortUrlCreation.ts +++ b/src/short-urls/reducers/shortUrlCreation.ts @@ -1,9 +1,10 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { ShortUrl, ShortUrlData } from '../data'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { ProblemDetailsError } from '../../api/types/errors'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import type { ShortUrl, ShortUrlData } from '../data'; const REDUCER_PREFIX = 'shlink/shortUrlCreation'; diff --git a/src/short-urls/reducers/shortUrlDeletion.ts b/src/short-urls/reducers/shortUrlDeletion.ts index 294e1986..7d4837f1 100644 --- a/src/short-urls/reducers/shortUrlDeletion.ts +++ b/src/short-urls/reducers/shortUrlDeletion.ts @@ -1,9 +1,9 @@ import { createAction, createSlice } from '@reduxjs/toolkit'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { ProblemDetailsError } from '../../api/types/errors'; -import { ShortUrl, ShortUrlIdentifier } from '../data'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import type { ShortUrl, ShortUrlIdentifier } from '../data'; const REDUCER_PREFIX = 'shlink/shortUrlDeletion'; diff --git a/src/short-urls/reducers/shortUrlDetail.ts b/src/short-urls/reducers/shortUrlDetail.ts index 4ad467f3..932d3dfc 100644 --- a/src/short-urls/reducers/shortUrlDetail.ts +++ b/src/short-urls/reducers/shortUrlDetail.ts @@ -1,10 +1,11 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { ShortUrl, ShortUrlIdentifier } from '../data'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { shortUrlMatches } from '../helpers'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { ProblemDetailsError } from '../../api/types/errors'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import type { ShortUrl, ShortUrlIdentifier } from '../data'; +import { shortUrlMatches } from '../helpers'; const REDUCER_PREFIX = 'shlink/shortUrlDetail'; diff --git a/src/short-urls/reducers/shortUrlEdition.ts b/src/short-urls/reducers/shortUrlEdition.ts index 79ea145d..103e6449 100644 --- a/src/short-urls/reducers/shortUrlEdition.ts +++ b/src/short-urls/reducers/shortUrlEdition.ts @@ -1,9 +1,10 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { EditShortUrlData, ShortUrl, ShortUrlIdentifier } from '../data'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { ProblemDetailsError } from '../../api/types/errors'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import type { EditShortUrlData, ShortUrl, ShortUrlIdentifier } from '../data'; const REDUCER_PREFIX = 'shlink/shortUrlEdition'; diff --git a/src/short-urls/reducers/shortUrlsList.ts b/src/short-urls/reducers/shortUrlsList.ts index 5b8d52b1..b2920ba4 100644 --- a/src/short-urls/reducers/shortUrlsList.ts +++ b/src/short-urls/reducers/shortUrlsList.ts @@ -1,14 +1,14 @@ import { createSlice } from '@reduxjs/toolkit'; import { assocPath, last, pipe, reject } from 'ramda'; -import { shortUrlMatches } from '../helpers'; -import { createNewVisits } from '../../visits/reducers/visitCreation'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkShortUrlsListParams, ShlinkShortUrlsResponse } from '../../api/types'; import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { ShlinkShortUrlsListParams, ShlinkShortUrlsResponse } from '../../api/types'; +import { createNewVisits } from '../../visits/reducers/visitCreation'; +import type { ShortUrl } from '../data'; +import { shortUrlMatches } from '../helpers'; +import type { createShortUrl } from './shortUrlCreation'; import { shortUrlDeleted } from './shortUrlDeletion'; -import { createShortUrl } from './shortUrlCreation'; -import { editShortUrl } from './shortUrlEdition'; -import { ShortUrl } from '../data'; +import type { editShortUrl } from './shortUrlEdition'; const REDUCER_PREFIX = 'shlink/shortUrlsList'; export const ITEMS_IN_OVERVIEW_PAGE = 5; diff --git a/src/short-urls/services/provideServices.ts b/src/short-urls/services/provideServices.ts index 185ab81e..1e5f79c8 100644 --- a/src/short-urls/services/provideServices.ts +++ b/src/short-urls/services/provideServices.ts @@ -1,25 +1,25 @@ -import Bottle from 'bottlejs'; +import type Bottle from 'bottlejs'; import { prop } from 'ramda'; -import { ShortUrlsFilteringBar } from '../ShortUrlsFilteringBar'; -import { ShortUrlsList } from '../ShortUrlsList'; +import type { ConnectDecorator } from '../../container/types'; +import { CreateShortUrl } from '../CreateShortUrl'; +import { EditShortUrl } from '../EditShortUrl'; +import { CreateShortUrlResult } from '../helpers/CreateShortUrlResult'; +import { DeleteShortUrlModal } from '../helpers/DeleteShortUrlModal'; +import { ExportShortUrlsBtn } from '../helpers/ExportShortUrlsBtn'; +import { QrCodeModal } from '../helpers/QrCodeModal'; import { ShortUrlsRow } from '../helpers/ShortUrlsRow'; import { ShortUrlsRowMenu } from '../helpers/ShortUrlsRowMenu'; -import { CreateShortUrl } from '../CreateShortUrl'; -import { DeleteShortUrlModal } from '../helpers/DeleteShortUrlModal'; -import { CreateShortUrlResult } from '../helpers/CreateShortUrlResult'; -import { listShortUrls, shortUrlsListReducerCreator } from '../reducers/shortUrlsList'; -import { shortUrlCreationReducerCreator, createShortUrl } from '../reducers/shortUrlCreation'; -import { shortUrlDeletionReducerCreator, deleteShortUrl, shortUrlDeleted } from '../reducers/shortUrlDeletion'; -import { editShortUrl, shortUrlEditionReducerCreator } from '../reducers/shortUrlEdition'; +import { createShortUrl, shortUrlCreationReducerCreator } from '../reducers/shortUrlCreation'; +import { deleteShortUrl, shortUrlDeleted, shortUrlDeletionReducerCreator } from '../reducers/shortUrlDeletion'; import { shortUrlDetailReducerCreator } from '../reducers/shortUrlDetail'; -import { ConnectDecorator } from '../../container/types'; -import { ShortUrlsTable } from '../ShortUrlsTable'; +import { editShortUrl, shortUrlEditionReducerCreator } from '../reducers/shortUrlEdition'; +import { listShortUrls, shortUrlsListReducerCreator } from '../reducers/shortUrlsList'; import { ShortUrlForm } from '../ShortUrlForm'; -import { EditShortUrl } from '../EditShortUrl'; -import { QrCodeModal } from '../helpers/QrCodeModal'; -import { ExportShortUrlsBtn } from '../helpers/ExportShortUrlsBtn'; +import { ShortUrlsFilteringBar } from '../ShortUrlsFilteringBar'; +import { ShortUrlsList } from '../ShortUrlsList'; +import { ShortUrlsTable } from '../ShortUrlsTable'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable', 'ShortUrlsFilteringBar'); bottle.decorator('ShortUrlsList', connect( @@ -98,5 +98,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('editShortUrl', editShortUrl, 'buildShlinkApiClient'); }; - -export default provideServices; diff --git a/src/tags/TagsList.tsx b/src/tags/TagsList.tsx index be35f153..a2e35501 100644 --- a/src/tags/TagsList.tsx +++ b/src/tags/TagsList.tsx @@ -1,20 +1,22 @@ -import { FC, useEffect, useState } from 'react'; -import { Row } from 'reactstrap'; import { pipe } from 'ramda'; -import { Message } from '../utils/Message'; -import { SearchField } from '../utils/SearchField'; -import { SelectedServer } from '../servers/data'; -import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; -import { Result } from '../utils/Result'; +import type { FC } from 'react'; +import { useEffect, useState } from 'react'; +import { Row } from 'reactstrap'; import { ShlinkApiError } from '../api/ShlinkApiError'; +import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; -import { Settings } from '../settings/reducers/settings'; +import type { SelectedServer } from '../servers/data'; +import type { Settings } from '../settings/reducers/settings'; import { determineOrderDir, sortList } from '../utils/helpers/ordering'; +import { Message } from '../utils/Message'; import { OrderingDropdown } from '../utils/OrderingDropdown'; -import { TagsList as TagsListState } from './reducers/tagsList'; -import { TagsOrderableFields, TAGS_ORDERABLE_FIELDS, TagsOrder } from './data/TagsListChildrenProps'; -import { NormalizedTag } from './data'; -import { TagsTableProps } from './TagsTable'; +import { Result } from '../utils/Result'; +import { SearchField } from '../utils/SearchField'; +import type { NormalizedTag } from './data'; +import type { TagsOrder, TagsOrderableFields } from './data/TagsListChildrenProps'; +import { TAGS_ORDERABLE_FIELDS } from './data/TagsListChildrenProps'; +import type { TagsList as TagsListState } from './reducers/tagsList'; +import type { TagsTableProps } from './TagsTable'; export interface TagsListProps { filterTags: (searchTerm: string) => void; diff --git a/src/tags/TagsTable.tsx b/src/tags/TagsTable.tsx index 205196e8..3898c623 100644 --- a/src/tags/TagsTable.tsx +++ b/src/tags/TagsTable.tsx @@ -1,13 +1,14 @@ -import { FC, useEffect, useRef } from 'react'; import { splitEvery } from 'ramda'; +import type { FC } from 'react'; +import { useEffect, useRef } from 'react'; import { useLocation } from 'react-router-dom'; -import { SimpleCard } from '../utils/SimpleCard'; import { SimplePaginator } from '../common/SimplePaginator'; import { useQueryState } from '../utils/helpers/hooks'; import { parseQuery } from '../utils/helpers/query'; +import { SimpleCard } from '../utils/SimpleCard'; import { TableOrderIcon } from '../utils/table/TableOrderIcon'; -import { TagsOrderableFields, TagsListChildrenProps, TagsOrder } from './data/TagsListChildrenProps'; -import { TagsTableRowProps } from './TagsTableRow'; +import type { TagsListChildrenProps, TagsOrder, TagsOrderableFields } from './data/TagsListChildrenProps'; +import type { TagsTableRowProps } from './TagsTableRow'; import './TagsTable.scss'; export interface TagsTableProps extends TagsListChildrenProps { diff --git a/src/tags/TagsTableRow.tsx b/src/tags/TagsTableRow.tsx index 1bad323e..aa8ea5a5 100644 --- a/src/tags/TagsTableRow.tsx +++ b/src/tags/TagsTableRow.tsx @@ -1,15 +1,16 @@ -import { FC } from 'react'; +import { faPencilAlt as editIcon, faTrash as deleteIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; import { Link } from 'react-router-dom'; import { DropdownItem } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faTrash as deleteIcon, faPencilAlt as editIcon } from '@fortawesome/free-solid-svg-icons'; -import { getServerId, SelectedServer } from '../servers/data'; -import { ColorGenerator } from '../utils/services/ColorGenerator'; -import { prettify } from '../utils/helpers/numbers'; -import { useToggle } from '../utils/helpers/hooks'; +import type { SelectedServer } from '../servers/data'; +import { getServerId } from '../servers/data'; import { DropdownBtnMenu } from '../utils/DropdownBtnMenu'; +import { useToggle } from '../utils/helpers/hooks'; +import { prettify } from '../utils/helpers/numbers'; +import type { ColorGenerator } from '../utils/services/ColorGenerator'; +import type { NormalizedTag, TagModalProps } from './data'; import { TagBullet } from './helpers/TagBullet'; -import { NormalizedTag, TagModalProps } from './data'; export interface TagsTableRowProps { tag: NormalizedTag; diff --git a/src/tags/data/TagsListChildrenProps.ts b/src/tags/data/TagsListChildrenProps.ts index 54837ac7..a20720bc 100644 --- a/src/tags/data/TagsListChildrenProps.ts +++ b/src/tags/data/TagsListChildrenProps.ts @@ -1,6 +1,6 @@ -import { SelectedServer } from '../../servers/data'; -import { Order } from '../../utils/helpers/ordering'; -import { NormalizedTag } from './index'; +import type { SelectedServer } from '../../servers/data'; +import type { Order } from '../../utils/helpers/ordering'; +import type { NormalizedTag } from './index'; export const TAGS_ORDERABLE_FIELDS = { tag: 'Tag', diff --git a/src/tags/helpers/DeleteTagConfirmModal.tsx b/src/tags/helpers/DeleteTagConfirmModal.tsx index fd2cbfdb..2d0742b8 100644 --- a/src/tags/helpers/DeleteTagConfirmModal.tsx +++ b/src/tags/helpers/DeleteTagConfirmModal.tsx @@ -1,8 +1,8 @@ import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; -import { TagDeletion } from '../reducers/tagDelete'; -import { TagModalProps } from '../data'; -import { Result } from '../../utils/Result'; import { ShlinkApiError } from '../../api/ShlinkApiError'; +import { Result } from '../../utils/Result'; +import type { TagModalProps } from '../data'; +import type { TagDeletion } from '../reducers/tagDelete'; interface DeleteTagConfirmModalProps extends TagModalProps { deleteTag: (tag: string) => Promise; diff --git a/src/tags/helpers/EditTagModal.tsx b/src/tags/helpers/EditTagModal.tsx index 06dbefe5..8c5da75a 100644 --- a/src/tags/helpers/EditTagModal.tsx +++ b/src/tags/helpers/EditTagModal.tsx @@ -1,16 +1,16 @@ -import { pipe } from 'ramda'; -import { useState } from 'react'; -import { Button, Input, Modal, ModalBody, ModalFooter, ModalHeader, Popover, InputGroup } from 'reactstrap'; -import { HexColorPicker } from 'react-colorful'; import { faPalette as colorIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { useToggle } from '../../utils/helpers/hooks'; -import { handleEventPreventingDefault } from '../../utils/utils'; -import { ColorGenerator } from '../../utils/services/ColorGenerator'; -import { TagModalProps } from '../data'; -import { EditTag, TagEdition } from '../reducers/tagEdit'; -import { Result } from '../../utils/Result'; +import { pipe } from 'ramda'; +import { useState } from 'react'; +import { HexColorPicker } from 'react-colorful'; +import { Button, Input, InputGroup, Modal, ModalBody, ModalFooter, ModalHeader, Popover } from 'reactstrap'; import { ShlinkApiError } from '../../api/ShlinkApiError'; +import { useToggle } from '../../utils/helpers/hooks'; +import { Result } from '../../utils/Result'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; +import { handleEventPreventingDefault } from '../../utils/utils'; +import type { TagModalProps } from '../data'; +import type { EditTag, TagEdition } from '../reducers/tagEdit'; import './EditTagModal.scss'; interface EditTagModalProps extends TagModalProps { diff --git a/src/tags/helpers/Tag.tsx b/src/tags/helpers/Tag.tsx index 61ab3057..4e9f33f8 100644 --- a/src/tags/helpers/Tag.tsx +++ b/src/tags/helpers/Tag.tsx @@ -1,6 +1,6 @@ -import { FC, MouseEventHandler, PropsWithChildren } from 'react'; import classNames from 'classnames'; -import { ColorGenerator } from '../../utils/services/ColorGenerator'; +import type { FC, MouseEventHandler, PropsWithChildren } from 'react'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; import './Tag.scss'; type TagProps = PropsWithChildren<{ diff --git a/src/tags/helpers/TagBullet.tsx b/src/tags/helpers/TagBullet.tsx index dc84f729..0c303571 100644 --- a/src/tags/helpers/TagBullet.tsx +++ b/src/tags/helpers/TagBullet.tsx @@ -1,4 +1,4 @@ -import { ColorGenerator } from '../../utils/services/ColorGenerator'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; import './TagBullet.scss'; interface TagBulletProps { diff --git a/src/tags/helpers/TagsSelector.tsx b/src/tags/helpers/TagsSelector.tsx index 3d785af3..15eb7926 100644 --- a/src/tags/helpers/TagsSelector.tsx +++ b/src/tags/helpers/TagsSelector.tsx @@ -1,10 +1,11 @@ import { useEffect } from 'react'; -import ReactTags, { SuggestionComponentProps, TagComponentProps } from 'react-tag-autocomplete'; -import { ColorGenerator } from '../../utils/services/ColorGenerator'; -import { Settings } from '../../settings/reducers/settings'; -import { TagsList } from '../reducers/tagsList'; -import { TagBullet } from './TagBullet'; +import type { SuggestionComponentProps, TagComponentProps } from 'react-tag-autocomplete'; +import ReactTags from 'react-tag-autocomplete'; +import type { Settings } from '../../settings/reducers/settings'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; +import type { TagsList } from '../reducers/tagsList'; import { Tag } from './Tag'; +import { TagBullet } from './TagBullet'; export interface TagsSelectorProps { selectedTags: string[]; diff --git a/src/tags/reducers/tagDelete.ts b/src/tags/reducers/tagDelete.ts index 5bac50a8..68be3b53 100644 --- a/src/tags/reducers/tagDelete.ts +++ b/src/tags/reducers/tagDelete.ts @@ -1,8 +1,8 @@ import { createAction, createSlice } from '@reduxjs/toolkit'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { ProblemDetailsError } from '../../api/types/errors'; +import { createAsyncThunk } from '../../utils/helpers/redux'; const REDUCER_PREFIX = 'shlink/tagDelete'; diff --git a/src/tags/reducers/tagEdit.ts b/src/tags/reducers/tagEdit.ts index 675f8898..20d8e74b 100644 --- a/src/tags/reducers/tagEdit.ts +++ b/src/tags/reducers/tagEdit.ts @@ -1,10 +1,11 @@ +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createAction, createSlice } from '@reduxjs/toolkit'; import { pick } from 'ramda'; -import { createAction, createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ColorGenerator } from '../../utils/services/ColorGenerator'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { ProblemDetailsError } from '../../api/types/errors'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import type { ColorGenerator } from '../../utils/services/ColorGenerator'; const REDUCER_PREFIX = 'shlink/tagEdit'; diff --git a/src/tags/reducers/tagsList.ts b/src/tags/reducers/tagsList.ts index d348674c..d6726817 100644 --- a/src/tags/reducers/tagsList.ts +++ b/src/tags/reducers/tagsList.ts @@ -1,16 +1,16 @@ import { createAction, createSlice } from '@reduxjs/toolkit'; import { isEmpty, reject } from 'ramda'; -import { createNewVisits } from '../../visits/reducers/visitCreation'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkTags } from '../../api/types'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { CreateVisit, Stats } from '../../visits/types'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkTags } from '../../api/types'; +import type { ProblemDetailsError } from '../../api/types/errors'; import { parseApiError } from '../../api/utils'; -import { TagStats } from '../data'; -import { createShortUrl } from '../../short-urls/reducers/shortUrlCreation'; +import type { createShortUrl } from '../../short-urls/reducers/shortUrlCreation'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import { createNewVisits } from '../../visits/reducers/visitCreation'; +import type { CreateVisit, Stats } from '../../visits/types'; +import type { TagStats } from '../data'; import { tagDeleted } from './tagDelete'; import { tagEdited } from './tagEdit'; -import { ProblemDetailsError } from '../../api/types/errors'; const REDUCER_PREFIX = 'shlink/tagsList'; diff --git a/src/tags/services/provideServices.ts b/src/tags/services/provideServices.ts index 0fbda139..8fbbe9cb 100644 --- a/src/tags/services/provideServices.ts +++ b/src/tags/services/provideServices.ts @@ -1,17 +1,18 @@ +import type { IContainer } from 'bottlejs'; +import type Bottle from 'bottlejs'; import { prop } from 'ramda'; -import Bottle, { IContainer } from 'bottlejs'; -import { TagsSelector } from '../helpers/TagsSelector'; +import type { ConnectDecorator } from '../../container/types'; import { DeleteTagConfirmModal } from '../helpers/DeleteTagConfirmModal'; import { EditTagModal } from '../helpers/EditTagModal'; -import { TagsList } from '../TagsList'; -import { filterTags, listTags, tagsListReducerCreator } from '../reducers/tagsList'; +import { TagsSelector } from '../helpers/TagsSelector'; import { tagDeleted, tagDeleteReducerCreator } from '../reducers/tagDelete'; import { editTag, tagEdited, tagEditReducerCreator } from '../reducers/tagEdit'; -import { ConnectDecorator } from '../../container/types'; +import { filterTags, listTags, tagsListReducerCreator } from '../reducers/tagsList'; +import { TagsList } from '../TagsList'; import { TagsTable } from '../TagsTable'; import { TagsTableRow } from '../TagsTableRow'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory('TagsSelector', TagsSelector, 'ColorGenerator'); bottle.decorator('TagsSelector', connect(['tagsList', 'settings'], ['listTags'])); @@ -56,5 +57,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('editTag', editTag, 'buildShlinkApiClient', 'ColorGenerator'); bottle.serviceFactory('tagEdited', () => tagEdited); }; - -export default provideServices; diff --git a/src/utils/BooleanControl.tsx b/src/utils/BooleanControl.tsx index fd93a8d0..e99dfbe1 100644 --- a/src/utils/BooleanControl.tsx +++ b/src/utils/BooleanControl.tsx @@ -1,6 +1,6 @@ -import { ChangeEvent, FC, PropsWithChildren } from 'react'; import classNames from 'classnames'; import { identity } from 'ramda'; +import type { ChangeEvent, FC, PropsWithChildren } from 'react'; import { useDomId } from './helpers/hooks'; export type BooleanControlProps = PropsWithChildren<{ diff --git a/src/utils/Checkbox.tsx b/src/utils/Checkbox.tsx index 4e4ef083..fc61a7e1 100644 --- a/src/utils/Checkbox.tsx +++ b/src/utils/Checkbox.tsx @@ -1,4 +1,5 @@ -import { FC } from 'react'; -import { BooleanControl, BooleanControlProps } from './BooleanControl'; +import type { FC } from 'react'; +import type { BooleanControlProps } from './BooleanControl'; +import { BooleanControl } from './BooleanControl'; export const Checkbox: FC = (props) => ; diff --git a/src/utils/CopyToClipboardIcon.tsx b/src/utils/CopyToClipboardIcon.tsx index 79359a12..c2f159d2 100644 --- a/src/utils/CopyToClipboardIcon.tsx +++ b/src/utils/CopyToClipboardIcon.tsx @@ -1,6 +1,6 @@ -import { FC } from 'react'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCopy as copyIcon } from '@fortawesome/free-regular-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; import './CopyToClipboardIcon.scss'; diff --git a/src/utils/DropdownBtn.tsx b/src/utils/DropdownBtn.tsx index 6bfe82cd..08e0ef4d 100644 --- a/src/utils/DropdownBtn.tsx +++ b/src/utils/DropdownBtn.tsx @@ -1,4 +1,4 @@ -import { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; import { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap'; import { useToggle } from './helpers/hooks'; import './DropdownBtn.scss'; diff --git a/src/utils/DropdownBtnMenu.tsx b/src/utils/DropdownBtnMenu.tsx index 694ccb89..330c5434 100644 --- a/src/utils/DropdownBtnMenu.tsx +++ b/src/utils/DropdownBtnMenu.tsx @@ -1,7 +1,7 @@ -import { FC, PropsWithChildren } from 'react'; -import { ButtonDropdown, DropdownMenu, DropdownToggle } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faEllipsisV as menuIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC, PropsWithChildren } from 'react'; +import { ButtonDropdown, DropdownMenu, DropdownToggle } from 'reactstrap'; import './DropdownBtnMenu.scss'; export type DropdownBtnMenuProps = PropsWithChildren<{ diff --git a/src/utils/ExportBtn.tsx b/src/utils/ExportBtn.tsx index c6f141bb..351083c1 100644 --- a/src/utils/ExportBtn.tsx +++ b/src/utils/ExportBtn.tsx @@ -1,7 +1,8 @@ -import { FC } from 'react'; -import { Button, ButtonProps } from 'reactstrap'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faFileCsv } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC } from 'react'; +import type { ButtonProps } from 'reactstrap'; +import { Button } from 'reactstrap'; import { prettify } from './helpers/numbers'; interface ExportBtnProps extends Omit { diff --git a/src/utils/InfoTooltip.tsx b/src/utils/InfoTooltip.tsx index 9d2eaa28..4fb281d5 100644 --- a/src/utils/InfoTooltip.tsx +++ b/src/utils/InfoTooltip.tsx @@ -1,8 +1,8 @@ -import { FC, PropsWithChildren } from 'react'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { Placement } from '@popperjs/core'; +import type { FC, PropsWithChildren } from 'react'; import { UncontrolledTooltip } from 'reactstrap'; -import { Placement } from '@popperjs/core'; import { useElementRef } from './helpers/hooks'; export type InfoTooltipProps = PropsWithChildren<{ diff --git a/src/utils/Message.tsx b/src/utils/Message.tsx index e171e93c..2d9d9928 100644 --- a/src/utils/Message.tsx +++ b/src/utils/Message.tsx @@ -1,8 +1,8 @@ -import { FC, PropsWithChildren } from 'react'; -import { Card, Row } from 'reactstrap'; -import classNames from 'classnames'; import { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import classNames from 'classnames'; +import type { FC, PropsWithChildren } from 'react'; +import { Card, Row } from 'reactstrap'; type MessageType = 'default' | 'error'; diff --git a/src/utils/NavPills.tsx b/src/utils/NavPills.tsx index 4eaf3f17..52e197bf 100644 --- a/src/utils/NavPills.tsx +++ b/src/utils/NavPills.tsx @@ -1,6 +1,7 @@ -import { FC, Children, isValidElement, PropsWithChildren } from 'react'; -import { Card, Nav, NavLink } from 'reactstrap'; +import type { FC, PropsWithChildren } from 'react'; +import { Children, isValidElement } from 'react'; import { NavLink as RouterNavLink } from 'react-router-dom'; +import { Card, Nav, NavLink } from 'reactstrap'; import './NavPills.scss'; type NavPillsProps = PropsWithChildren<{ diff --git a/src/utils/OrderingDropdown.tsx b/src/utils/OrderingDropdown.tsx index 71afb672..f2d73d2e 100644 --- a/src/utils/OrderingDropdown.tsx +++ b/src/utils/OrderingDropdown.tsx @@ -1,9 +1,10 @@ -import { UncontrolledDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; -import { toPairs } from 'ramda'; +import { faSortAmountDown as sortDescIcon, faSortAmountUp as sortAscIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faSortAmountUp as sortAscIcon, faSortAmountDown as sortDescIcon } from '@fortawesome/free-solid-svg-icons'; import classNames from 'classnames'; -import { determineOrderDir, Order, OrderDir } from './helpers/ordering'; +import { toPairs } from 'ramda'; +import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap'; +import type { Order, OrderDir } from './helpers/ordering'; +import { determineOrderDir } from './helpers/ordering'; import './OrderingDropdown.scss'; export interface OrderingDropdownProps { diff --git a/src/utils/Result.tsx b/src/utils/Result.tsx index e32872a8..12c380a1 100644 --- a/src/utils/Result.tsx +++ b/src/utils/Result.tsx @@ -1,6 +1,6 @@ -import { FC, PropsWithChildren } from 'react'; -import { Row } from 'reactstrap'; import classNames from 'classnames'; +import type { FC, PropsWithChildren } from 'react'; +import { Row } from 'reactstrap'; import { SimpleCard } from './SimpleCard'; export type ResultType = 'success' | 'error' | 'warning'; diff --git a/src/utils/SearchField.tsx b/src/utils/SearchField.tsx index a05576ba..4c8a742b 100644 --- a/src/utils/SearchField.tsx +++ b/src/utils/SearchField.tsx @@ -1,7 +1,7 @@ -import { useState } from 'react'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSearch as searchIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classNames from 'classnames'; +import { useState } from 'react'; import './SearchField.scss'; const DEFAULT_SEARCH_INTERVAL = 500; diff --git a/src/utils/SimpleCard.tsx b/src/utils/SimpleCard.tsx index 2243037b..20d85d89 100644 --- a/src/utils/SimpleCard.tsx +++ b/src/utils/SimpleCard.tsx @@ -1,5 +1,6 @@ -import { Card, CardBody, CardHeader, CardProps } from 'reactstrap'; -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import type { CardProps } from 'reactstrap'; +import { Card, CardBody, CardHeader } from 'reactstrap'; interface SimpleCardProps extends Omit { title?: ReactNode; diff --git a/src/utils/ToggleSwitch.tsx b/src/utils/ToggleSwitch.tsx index 797e9b5d..b9cc6b96 100644 --- a/src/utils/ToggleSwitch.tsx +++ b/src/utils/ToggleSwitch.tsx @@ -1,4 +1,5 @@ -import { FC } from 'react'; -import { BooleanControl, BooleanControlProps } from './BooleanControl'; +import type { FC } from 'react'; +import type { BooleanControlProps } from './BooleanControl'; +import { BooleanControl } from './BooleanControl'; export const ToggleSwitch: FC = (props) => ; diff --git a/src/utils/dates/DateInput.tsx b/src/utils/dates/DateInput.tsx index 15a95851..07fd96cc 100644 --- a/src/utils/dates/DateInput.tsx +++ b/src/utils/dates/DateInput.tsx @@ -1,9 +1,10 @@ -import { useRef } from 'react'; -import { isNil } from 'ramda'; -import DatePicker, { ReactDatePickerProps } from 'react-datepicker'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCalendarAlt as calendarIcon } from '@fortawesome/free-regular-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classNames from 'classnames'; +import { isNil } from 'ramda'; +import { useRef } from 'react'; +import type { ReactDatePickerProps } from 'react-datepicker'; +import DatePicker from 'react-datepicker'; import { STANDARD_DATE_FORMAT } from '../helpers/date'; import './DateInput.scss'; diff --git a/src/utils/dates/DateIntervalDropdownItems.tsx b/src/utils/dates/DateIntervalDropdownItems.tsx index bd2b8de4..3b8e585b 100644 --- a/src/utils/dates/DateIntervalDropdownItems.tsx +++ b/src/utils/dates/DateIntervalDropdownItems.tsx @@ -1,6 +1,7 @@ +import type { FC } from 'react'; import { DropdownItem } from 'reactstrap'; -import { FC } from 'react'; -import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from '../helpers/dateIntervals'; +import type { DateInterval } from '../helpers/dateIntervals'; +import { DATE_INTERVALS, rangeOrIntervalToString } from '../helpers/dateIntervals'; export interface DateIntervalDropdownProps { active?: DateInterval; diff --git a/src/utils/dates/DateIntervalSelector.tsx b/src/utils/dates/DateIntervalSelector.tsx index 3f4bccb3..094eb298 100644 --- a/src/utils/dates/DateIntervalSelector.tsx +++ b/src/utils/dates/DateIntervalSelector.tsx @@ -1,7 +1,8 @@ -import { FC } from 'react'; +import type { FC } from 'react'; import { DropdownBtn } from '../DropdownBtn'; import { rangeOrIntervalToString } from '../helpers/dateIntervals'; -import { DateIntervalDropdownItems, DateIntervalDropdownProps } from './DateIntervalDropdownItems'; +import type { DateIntervalDropdownProps } from './DateIntervalDropdownItems'; +import { DateIntervalDropdownItems } from './DateIntervalDropdownItems'; export const DateIntervalSelector: FC = ({ onChange, active, allText }) => ( diff --git a/src/utils/dates/DateRangeRow.tsx b/src/utils/dates/DateRangeRow.tsx index f5e33ff4..f5fe1d7f 100644 --- a/src/utils/dates/DateRangeRow.tsx +++ b/src/utils/dates/DateRangeRow.tsx @@ -1,6 +1,6 @@ import { endOfDay } from 'date-fns'; +import type { DateRange } from '../helpers/dateIntervals'; import { DateInput } from './DateInput'; -import { DateRange } from '../helpers/dateIntervals'; interface DateRangeRowProps extends DateRange { onStartDateChange: (date: Date | null) => void; diff --git a/src/utils/dates/DateRangeSelector.tsx b/src/utils/dates/DateRangeSelector.tsx index 3aaeaf9e..dd254a6a 100644 --- a/src/utils/dates/DateRangeSelector.tsx +++ b/src/utils/dates/DateRangeSelector.tsx @@ -1,18 +1,19 @@ import { useState } from 'react'; import { DropdownItem } from 'reactstrap'; import { DropdownBtn } from '../DropdownBtn'; -import { useEffectExceptFirstTime } from '../helpers/hooks'; -import { +import type { DateInterval, - DateRange, - rangeOrIntervalToString, + DateRange } from '../helpers/dateIntervals'; +import { + ALL, + dateRangeIsEmpty, intervalToDateRange, rangeIsInterval, - dateRangeIsEmpty, - ALL, + rangeOrIntervalToString, } from '../helpers/dateIntervals'; -import { DateRangeRow } from './DateRangeRow'; +import { useEffectExceptFirstTime } from '../helpers/hooks'; import { DateIntervalDropdownItems } from './DateIntervalDropdownItems'; +import { DateRangeRow } from './DateRangeRow'; export interface DateRangeSelectorProps { initialDateRange?: DateInterval | DateRange; diff --git a/src/utils/dates/DateTimeInput.tsx b/src/utils/dates/DateTimeInput.tsx index ddc45acb..236f1f0a 100644 --- a/src/utils/dates/DateTimeInput.tsx +++ b/src/utils/dates/DateTimeInput.tsx @@ -1,7 +1,7 @@ -import { ReactDatePickerProps } from 'react-datepicker'; -import { FC } from 'react'; -import { DateInput } from './DateInput'; +import type { FC } from 'react'; +import type { ReactDatePickerProps } from 'react-datepicker'; import { STANDARD_DATE_AND_TIME_FORMAT } from '../helpers/date'; +import { DateInput } from './DateInput'; export type DateTimeInputProps = Omit; diff --git a/src/utils/dates/Time.tsx b/src/utils/dates/Time.tsx index e2418659..8245d031 100644 --- a/src/utils/dates/Time.tsx +++ b/src/utils/dates/Time.tsx @@ -1,4 +1,4 @@ -import { parseISO, format as formatDate, getUnixTime, formatDistance } from 'date-fns'; +import { format as formatDate, formatDistance, getUnixTime, parseISO } from 'date-fns'; import { isDateObject, now, STANDARD_DATE_AND_TIME_FORMAT } from '../helpers/date'; export interface TimeProps { diff --git a/src/utils/forms/FormText.tsx b/src/utils/forms/FormText.tsx index c3e1a685..f80b5094 100644 --- a/src/utils/forms/FormText.tsx +++ b/src/utils/forms/FormText.tsx @@ -1,4 +1,4 @@ -import { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; export const FormText: FC> = ({ children }) => ( {children} diff --git a/src/utils/forms/InputFormGroup.tsx b/src/utils/forms/InputFormGroup.tsx index 9dabb6b1..97e6ccdf 100644 --- a/src/utils/forms/InputFormGroup.tsx +++ b/src/utils/forms/InputFormGroup.tsx @@ -1,7 +1,7 @@ -import { FC, PropsWithChildren } from 'react'; -import { InputType } from 'reactstrap/types/lib/Input'; -import { LabeledFormGroup } from './LabeledFormGroup'; +import type { FC, PropsWithChildren } from 'react'; +import type { InputType } from 'reactstrap/types/lib/Input'; import { useDomId } from '../helpers/hooks'; +import { LabeledFormGroup } from './LabeledFormGroup'; export type InputFormGroupProps = PropsWithChildren<{ value: string; diff --git a/src/utils/forms/LabeledFormGroup.tsx b/src/utils/forms/LabeledFormGroup.tsx index dfc68729..24ed4044 100644 --- a/src/utils/forms/LabeledFormGroup.tsx +++ b/src/utils/forms/LabeledFormGroup.tsx @@ -1,4 +1,4 @@ -import { FC, PropsWithChildren, ReactNode } from 'react'; +import type { FC, PropsWithChildren, ReactNode } from 'react'; type LabeledFormGroupProps = PropsWithChildren<{ label: ReactNode; diff --git a/src/utils/helpers/charts.ts b/src/utils/helpers/charts.ts index 7914eee8..87331d24 100644 --- a/src/utils/helpers/charts.ts +++ b/src/utils/helpers/charts.ts @@ -1,4 +1,4 @@ -import { ActiveElement, ChartEvent, ChartType, TooltipItem } from 'chart.js'; +import type { ActiveElement, ChartEvent, ChartType, TooltipItem } from 'chart.js'; import { prettify } from './numbers'; export const pointerOnHover = ({ native }: ChartEvent, [firstElement]: ActiveElement[]) => { diff --git a/src/utils/helpers/csvjson.ts b/src/utils/helpers/csvjson.ts index 8fe34feb..83411c51 100644 --- a/src/utils/helpers/csvjson.ts +++ b/src/utils/helpers/csvjson.ts @@ -1,5 +1,5 @@ -import csv from 'csvtojson'; import { Parser } from '@json2csv/plainjs'; +import csv from 'csvtojson'; export const csvToJson = (csvContent: string) => new Promise((resolve) => { csv().fromString(csvContent).then(resolve); diff --git a/src/utils/helpers/date.ts b/src/utils/helpers/date.ts index b766974c..ebb33605 100644 --- a/src/utils/helpers/date.ts +++ b/src/utils/helpers/date.ts @@ -1,5 +1,5 @@ import { format, formatISO, isBefore, isEqual, isWithinInterval, parse, parseISO as stdParseISO } from 'date-fns'; -import { OptionalString } from '../utils'; +import type { OptionalString } from '../utils'; export const STANDARD_DATE_FORMAT = 'yyyy-MM-dd'; diff --git a/src/utils/helpers/dateIntervals.ts b/src/utils/helpers/dateIntervals.ts index 248fcb5a..be5d7dd5 100644 --- a/src/utils/helpers/dateIntervals.ts +++ b/src/utils/helpers/dateIntervals.ts @@ -1,7 +1,8 @@ -import { subDays, startOfDay, endOfDay } from 'date-fns'; +import { endOfDay, startOfDay, subDays } from 'date-fns'; import { cond, filter, isEmpty, T } from 'ramda'; -import { dateOrNull, DateOrString, formatInternational, isBeforeOrEqual, now, parseISO } from './date'; import { equals } from '../utils'; +import type { DateOrString } from './date'; +import { dateOrNull, formatInternational, isBeforeOrEqual, now, parseISO } from './date'; export interface DateRange { startDate?: Date | null; diff --git a/src/utils/helpers/features.ts b/src/utils/helpers/features.ts index b85551cc..d4700802 100644 --- a/src/utils/helpers/features.ts +++ b/src/utils/helpers/features.ts @@ -1,5 +1,7 @@ -import { isReachableServer, SelectedServer } from '../../servers/data'; -import { SemVerPattern, versionMatch } from './version'; +import type { SelectedServer } from '../../servers/data'; +import { isReachableServer } from '../../servers/data'; +import type { SemVerPattern } from './version'; +import { versionMatch } from './version'; const serverMatchesMinVersion = (minVersion: SemVerPattern) => (selectedServer: SelectedServer): boolean => isReachableServer(selectedServer) && versionMatch(selectedServer.version, { minVersion }); diff --git a/src/utils/helpers/hooks.ts b/src/utils/helpers/hooks.ts index fc596ddb..d51cb13a 100644 --- a/src/utils/helpers/hooks.ts +++ b/src/utils/helpers/hooks.ts @@ -1,6 +1,7 @@ -import { DependencyList, EffectCallback, useEffect, useRef, useState } from 'react'; -import { useSwipeable as useReactSwipeable } from 'react-swipeable'; +import type { DependencyList, EffectCallback } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; +import { useSwipeable as useReactSwipeable } from 'react-swipeable'; import { v4 as uuid } from 'uuid'; import { parseQuery, stringifyQuery } from './query'; diff --git a/src/utils/helpers/leaflet.ts b/src/utils/helpers/leaflet.ts index 809e1575..df56e3fe 100644 --- a/src/utils/helpers/leaflet.ts +++ b/src/utils/helpers/leaflet.ts @@ -1,6 +1,6 @@ import L from 'leaflet'; -import marker2x from 'leaflet/dist/images/marker-icon-2x.png'; import marker from 'leaflet/dist/images/marker-icon.png'; +import marker2x from 'leaflet/dist/images/marker-icon-2x.png'; import markerShadow from 'leaflet/dist/images/marker-shadow.png'; export const fixLeafletIcons = () => { diff --git a/src/utils/helpers/redux.ts b/src/utils/helpers/redux.ts index 69309bf9..e113c937 100644 --- a/src/utils/helpers/redux.ts +++ b/src/utils/helpers/redux.ts @@ -1,6 +1,7 @@ -import { createAsyncThunk as baseCreateAsyncThunk, AsyncThunkPayloadCreator } from '@reduxjs/toolkit'; +import type { AsyncThunkPayloadCreator } from '@reduxjs/toolkit'; +import { createAsyncThunk as baseCreateAsyncThunk } from '@reduxjs/toolkit'; import { identity } from 'ramda'; -import { ShlinkState } from '../../container/types'; +import type { ShlinkState } from '../../container/types'; export const createAsyncThunk = ( typePrefix: string, diff --git a/src/utils/helpers/version.ts b/src/utils/helpers/version.ts index 6116a6da..91ef66d5 100644 --- a/src/utils/helpers/version.ts +++ b/src/utils/helpers/version.ts @@ -1,6 +1,7 @@ import { compare } from 'compare-versions'; import { identity, memoizeWith } from 'ramda'; -import { Empty, hasValue } from '../utils'; +import type { Empty } from '../utils'; +import { hasValue } from '../utils'; type SemVerPatternFragment = `${bigint | '*'}`; diff --git a/src/utils/helpers/visits.ts b/src/utils/helpers/visits.ts index 3b081814..468d310a 100644 --- a/src/utils/helpers/visits.ts +++ b/src/utils/helpers/visits.ts @@ -1,7 +1,8 @@ import bowser from 'bowser'; import { zipObj } from 'ramda'; -import { Empty, hasValue } from '../utils'; -import { Stats, UserAgent } from '../../visits/types'; +import type { Stats, UserAgent } from '../../visits/types'; +import type { Empty } from '../utils'; +import { hasValue } from '../utils'; const DEFAULT = 'Others'; const BROWSERS_WHITELIST = [ diff --git a/src/utils/services/ColorGenerator.ts b/src/utils/services/ColorGenerator.ts index b440ab52..789fe122 100644 --- a/src/utils/services/ColorGenerator.ts +++ b/src/utils/services/ColorGenerator.ts @@ -1,6 +1,6 @@ import { isNil } from 'ramda'; import { rangeOf } from '../utils'; -import { LocalStorage } from './LocalStorage'; +import type { LocalStorage } from './LocalStorage'; const HEX_COLOR_LENGTH = 6; const HEX_DIGITS = '0123456789ABCDEF'; diff --git a/src/utils/services/provideServices.ts b/src/utils/services/provideServices.ts index 66ca8d0e..7a16b11a 100644 --- a/src/utils/services/provideServices.ts +++ b/src/utils/services/provideServices.ts @@ -1,10 +1,10 @@ -import Bottle from 'bottlejs'; -import { useTimeoutToggle } from '../helpers/hooks'; -import { LocalStorage } from './LocalStorage'; -import { ColorGenerator } from './ColorGenerator'; +import type Bottle from 'bottlejs'; import { csvToJson, jsonToCsv } from '../helpers/csvjson'; +import { useTimeoutToggle } from '../helpers/hooks'; +import { ColorGenerator } from './ColorGenerator'; +import { LocalStorage } from './LocalStorage'; -const provideServices = (bottle: Bottle) => { +export const provideServices = (bottle: Bottle) => { bottle.constant('localStorage', window.localStorage); bottle.service('Storage', LocalStorage, 'localStorage'); bottle.service('ColorGenerator', ColorGenerator, 'Storage'); @@ -16,5 +16,3 @@ const provideServices = (bottle: Bottle) => { bottle.constant('clearTimeout', window.clearTimeout); bottle.serviceFactory('useTimeoutToggle', useTimeoutToggle, 'setTimeout', 'clearTimeout'); }; - -export default provideServices; diff --git a/src/utils/table/TableOrderIcon.tsx b/src/utils/table/TableOrderIcon.tsx index 20622340..4c8d8fae 100644 --- a/src/utils/table/TableOrderIcon.tsx +++ b/src/utils/table/TableOrderIcon.tsx @@ -1,6 +1,6 @@ -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCaretDown as caretDownIcon, faCaretUp as caretUpIcon } from '@fortawesome/free-solid-svg-icons'; -import { Order } from '../helpers/ordering'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { Order } from '../helpers/ordering'; interface TableOrderIconProps { currentOrder: Order; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 4ddef89d..243b4b99 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,5 +1,5 @@ import { isEmpty, isNil, pipe, range } from 'ramda'; -import { SyntheticEvent } from 'react'; +import type { SyntheticEvent } from 'react'; export const rangeOf = (size: number, mappingFn: (value: number) => T, startAt = 1): T[] => range(startAt, size + 1).map(mappingFn); diff --git a/src/visits/DomainVisits.tsx b/src/visits/DomainVisits.tsx index e2f5d3ba..474da438 100644 --- a/src/visits/DomainVisits.tsx +++ b/src/visits/DomainVisits.tsx @@ -1,15 +1,15 @@ import { useParams } from 'react-router-dom'; -import { CommonVisitsProps } from './types/CommonVisitsProps'; -import { ShlinkVisitsParams } from '../api/types'; -import { DomainVisits as DomainVisitsState, LoadDomainVisits } from './reducers/domainVisits'; -import { ReportExporter } from '../common/services/ReportExporter'; +import type { ShlinkVisitsParams } from '../api/types'; +import type { ReportExporter } from '../common/services/ReportExporter'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; import { useGoBack } from '../utils/helpers/hooks'; +import type { DomainVisits as DomainVisitsState, LoadDomainVisits } from './reducers/domainVisits'; +import type { NormalizedVisit } from './types'; +import type { CommonVisitsProps } from './types/CommonVisitsProps'; import { toApiParams } from './types/helpers'; -import { NormalizedVisit } from './types'; -import { VisitsStats } from './VisitsStats'; import { VisitsHeader } from './VisitsHeader'; +import { VisitsStats } from './VisitsStats'; export interface DomainVisitsProps extends CommonVisitsProps { getDomainVisits: (params: LoadDomainVisits) => void; diff --git a/src/visits/NonOrphanVisits.tsx b/src/visits/NonOrphanVisits.tsx index 3515afb8..79fd5fca 100644 --- a/src/visits/NonOrphanVisits.tsx +++ b/src/visits/NonOrphanVisits.tsx @@ -1,13 +1,13 @@ +import type { ReportExporter } from '../common/services/ReportExporter'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; import { useGoBack } from '../utils/helpers/hooks'; -import { ReportExporter } from '../common/services/ReportExporter'; -import { VisitsStats } from './VisitsStats'; -import { NormalizedVisit, VisitsParams } from './types'; -import { CommonVisitsProps } from './types/CommonVisitsProps'; +import type { LoadVisits, VisitsInfo } from './reducers/types'; +import type { NormalizedVisit, VisitsParams } from './types'; +import type { CommonVisitsProps } from './types/CommonVisitsProps'; import { toApiParams } from './types/helpers'; import { VisitsHeader } from './VisitsHeader'; -import { LoadVisits, VisitsInfo } from './reducers/types'; +import { VisitsStats } from './VisitsStats'; export interface NonOrphanVisitsProps extends CommonVisitsProps { getNonOrphanVisits: (params: LoadVisits) => void; diff --git a/src/visits/OrphanVisits.tsx b/src/visits/OrphanVisits.tsx index 3a7d711b..379b0ef8 100644 --- a/src/visits/OrphanVisits.tsx +++ b/src/visits/OrphanVisits.tsx @@ -1,14 +1,14 @@ +import type { ReportExporter } from '../common/services/ReportExporter'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; import { useGoBack } from '../utils/helpers/hooks'; -import { ReportExporter } from '../common/services/ReportExporter'; -import { VisitsStats } from './VisitsStats'; -import { NormalizedVisit, VisitsParams } from './types'; -import { CommonVisitsProps } from './types/CommonVisitsProps'; +import type { LoadOrphanVisits } from './reducers/orphanVisits'; +import type { VisitsInfo } from './reducers/types'; +import type { NormalizedVisit, VisitsParams } from './types'; +import type { CommonVisitsProps } from './types/CommonVisitsProps'; import { toApiParams } from './types/helpers'; import { VisitsHeader } from './VisitsHeader'; -import { VisitsInfo } from './reducers/types'; -import { LoadOrphanVisits } from './reducers/orphanVisits'; +import { VisitsStats } from './VisitsStats'; export interface OrphanVisitsProps extends CommonVisitsProps { getOrphanVisits: (params: LoadOrphanVisits) => void; diff --git a/src/visits/ShortUrlVisits.tsx b/src/visits/ShortUrlVisits.tsx index 47b23d27..d3a28e55 100644 --- a/src/visits/ShortUrlVisits.tsx +++ b/src/visits/ShortUrlVisits.tsx @@ -1,19 +1,19 @@ import { useEffect } from 'react'; import { useLocation, useParams } from 'react-router-dom'; +import type { ReportExporter } from '../common/services/ReportExporter'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; -import { parseQuery } from '../utils/helpers/query'; import { Topics } from '../mercure/helpers/Topics'; -import { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; -import { useGoBack } from '../utils/helpers/hooks'; -import { ReportExporter } from '../common/services/ReportExporter'; -import { LoadShortUrlVisits, ShortUrlVisits as ShortUrlVisitsState } from './reducers/shortUrlVisits'; -import { ShortUrlVisitsHeader } from './ShortUrlVisitsHeader'; -import { VisitsStats } from './VisitsStats'; -import { NormalizedVisit, VisitsParams } from './types'; -import { CommonVisitsProps } from './types/CommonVisitsProps'; -import { toApiParams } from './types/helpers'; +import type { ShortUrlIdentifier } from '../short-urls/data'; import { urlDecodeShortCode } from '../short-urls/helpers'; -import { ShortUrlIdentifier } from '../short-urls/data'; +import type { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; +import { useGoBack } from '../utils/helpers/hooks'; +import { parseQuery } from '../utils/helpers/query'; +import type { LoadShortUrlVisits, ShortUrlVisits as ShortUrlVisitsState } from './reducers/shortUrlVisits'; +import { ShortUrlVisitsHeader } from './ShortUrlVisitsHeader'; +import type { NormalizedVisit, VisitsParams } from './types'; +import type { CommonVisitsProps } from './types/CommonVisitsProps'; +import { toApiParams } from './types/helpers'; +import { VisitsStats } from './VisitsStats'; export interface ShortUrlVisitsProps extends CommonVisitsProps { getShortUrlVisits: (params: LoadShortUrlVisits) => void; diff --git a/src/visits/ShortUrlVisitsHeader.tsx b/src/visits/ShortUrlVisitsHeader.tsx index bac9587f..b40b4293 100644 --- a/src/visits/ShortUrlVisitsHeader.tsx +++ b/src/visits/ShortUrlVisitsHeader.tsx @@ -1,8 +1,8 @@ -import { UncontrolledTooltip } from 'reactstrap'; import { ExternalLink } from 'react-external-link'; -import { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; +import { UncontrolledTooltip } from 'reactstrap'; +import type { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; import { Time } from '../utils/dates/Time'; -import { ShortUrlVisits } from './reducers/shortUrlVisits'; +import type { ShortUrlVisits } from './reducers/shortUrlVisits'; import { VisitsHeader } from './VisitsHeader'; import './ShortUrlVisitsHeader.scss'; diff --git a/src/visits/TagVisits.tsx b/src/visits/TagVisits.tsx index 3d2510c1..dcbcdbb1 100644 --- a/src/visits/TagVisits.tsx +++ b/src/visits/TagVisits.tsx @@ -1,16 +1,16 @@ import { useParams } from 'react-router-dom'; +import type { ShlinkVisitsParams } from '../api/types'; +import type { ReportExporter } from '../common/services/ReportExporter'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; -import { ColorGenerator } from '../utils/services/ColorGenerator'; -import { ShlinkVisitsParams } from '../api/types'; import { Topics } from '../mercure/helpers/Topics'; import { useGoBack } from '../utils/helpers/hooks'; -import { ReportExporter } from '../common/services/ReportExporter'; -import { LoadTagVisits, TagVisits as TagVisitsState } from './reducers/tagVisits'; +import type { ColorGenerator } from '../utils/services/ColorGenerator'; +import type { LoadTagVisits, TagVisits as TagVisitsState } from './reducers/tagVisits'; import { TagVisitsHeader } from './TagVisitsHeader'; -import { VisitsStats } from './VisitsStats'; -import { NormalizedVisit } from './types'; -import { CommonVisitsProps } from './types/CommonVisitsProps'; +import type { NormalizedVisit } from './types'; +import type { CommonVisitsProps } from './types/CommonVisitsProps'; import { toApiParams } from './types/helpers'; +import { VisitsStats } from './VisitsStats'; export interface TagVisitsProps extends CommonVisitsProps { getTagVisits: (params: LoadTagVisits) => void; diff --git a/src/visits/TagVisitsHeader.tsx b/src/visits/TagVisitsHeader.tsx index 0de9df7c..341b0bad 100644 --- a/src/visits/TagVisitsHeader.tsx +++ b/src/visits/TagVisitsHeader.tsx @@ -1,7 +1,7 @@ import { Tag } from '../tags/helpers/Tag'; -import { ColorGenerator } from '../utils/services/ColorGenerator'; +import type { ColorGenerator } from '../utils/services/ColorGenerator'; +import type { TagVisits } from './reducers/tagVisits'; import { VisitsHeader } from './VisitsHeader'; -import { TagVisits } from './reducers/tagVisits'; import './ShortUrlVisitsHeader.scss'; interface TagVisitsHeaderProps { diff --git a/src/visits/VisitsHeader.tsx b/src/visits/VisitsHeader.tsx index 7dca6459..56584e83 100644 --- a/src/visits/VisitsHeader.tsx +++ b/src/visits/VisitsHeader.tsx @@ -1,10 +1,10 @@ -import { Button, Card } from 'reactstrap'; -import { FC, PropsWithChildren, ReactNode } from 'react'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faArrowLeft } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import type { FC, PropsWithChildren, ReactNode } from 'react'; +import { Button, Card } from 'reactstrap'; +import type { ShortUrl } from '../short-urls/data'; import { ShortUrlVisitsCount } from '../short-urls/helpers/ShortUrlVisitsCount'; -import { ShortUrl } from '../short-urls/data'; -import { Visit } from './types'; +import type { Visit } from './types'; type VisitsHeaderProps = PropsWithChildren<{ visits: Visit[]; diff --git a/src/visits/VisitsStats.tsx b/src/visits/VisitsStats.tsx index d2c2a767..638d0cff 100644 --- a/src/visits/VisitsStats.tsx +++ b/src/visits/VisitsStats.tsx @@ -1,31 +1,34 @@ -import { isEmpty, pipe, propEq, values } from 'ramda'; -import { useState, useEffect, useMemo, FC, useRef, PropsWithChildren } from 'react'; -import { Button, Progress, Row } from 'reactstrap'; +import type { IconDefinition } from '@fortawesome/fontawesome-common-types'; +import { faCalendarAlt, faChartPie, faList, faMapMarkedAlt } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faCalendarAlt, faMapMarkedAlt, faList, faChartPie } from '@fortawesome/free-solid-svg-icons'; -import { IconDefinition } from '@fortawesome/fontawesome-common-types'; -import { Route, Routes, Navigate, useLocation } from 'react-router-dom'; import classNames from 'classnames'; -import { DateRangeSelector } from '../utils/dates/DateRangeSelector'; -import { Message } from '../utils/Message'; -import { Result } from '../utils/Result'; +import { isEmpty, pipe, propEq, values } from 'ramda'; +import type { FC, PropsWithChildren } from 'react'; +import { useEffect, useMemo, useRef, useState } from 'react'; +import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; +import { Button, Progress, Row } from 'reactstrap'; import { ShlinkApiError } from '../api/ShlinkApiError'; -import { Settings } from '../settings/reducers/settings'; -import { prettify } from '../utils/helpers/numbers'; -import { NavPillItem, NavPills } from '../utils/NavPills'; +import type { Settings } from '../settings/reducers/settings'; +import { DateRangeSelector } from '../utils/dates/DateRangeSelector'; import { ExportBtn } from '../utils/ExportBtn'; -import { LineChartCard } from './charts/LineChartCard'; -import { VisitsTable } from './VisitsTable'; -import { NormalizedOrphanVisit, NormalizedVisit, VisitsParams } from './types'; -import { OpenMapModalBtn } from './helpers/OpenMapModalBtn'; -import { normalizeVisits, processStatsFromVisits } from './services/VisitsParser'; -import { VisitsFilterDropdown } from './helpers/VisitsFilterDropdown'; -import { HighlightableProps, highlightedVisitsToStats } from './types/helpers'; +import type { DateInterval, DateRange } from '../utils/helpers/dateIntervals'; +import { toDateRange } from '../utils/helpers/dateIntervals'; +import { prettify } from '../utils/helpers/numbers'; +import { Message } from '../utils/Message'; +import { NavPillItem, NavPills } from '../utils/NavPills'; +import { Result } from '../utils/Result'; import { DoughnutChartCard } from './charts/DoughnutChartCard'; +import { LineChartCard } from './charts/LineChartCard'; import { SortableBarChartCard } from './charts/SortableBarChartCard'; -import { VisitsInfo } from './reducers/types'; import { useVisitsQuery } from './helpers/hooks'; -import { DateInterval, DateRange, toDateRange } from '../utils/helpers/dateIntervals'; +import { OpenMapModalBtn } from './helpers/OpenMapModalBtn'; +import { VisitsFilterDropdown } from './helpers/VisitsFilterDropdown'; +import type { VisitsInfo } from './reducers/types'; +import { normalizeVisits, processStatsFromVisits } from './services/VisitsParser'; +import type { NormalizedOrphanVisit, NormalizedVisit, VisitsParams } from './types'; +import type { HighlightableProps } from './types/helpers'; +import { highlightedVisitsToStats } from './types/helpers'; +import { VisitsTable } from './VisitsTable'; export type VisitsStatsProps = PropsWithChildren<{ getVisits: (params: VisitsParams, doIntervalFallback?: boolean) => void; diff --git a/src/visits/VisitsTable.tsx b/src/visits/VisitsTable.tsx index 311ce160..44c395f4 100644 --- a/src/visits/VisitsTable.tsx +++ b/src/visits/VisitsTable.tsx @@ -1,17 +1,18 @@ -import { useEffect, useMemo, useState, useRef } from 'react'; -import classNames from 'classnames'; -import { min, splitEvery } from 'ramda'; import { faCheck as checkIcon, faRobot as botIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import classNames from 'classnames'; +import { min, splitEvery } from 'ramda'; +import { useEffect, useMemo, useRef, useState } from 'react'; import { UncontrolledTooltip } from 'reactstrap'; import { SimplePaginator } from '../common/SimplePaginator'; -import { SearchField } from '../utils/SearchField'; -import { determineOrderDir, Order, sortList } from '../utils/helpers/ordering'; -import { prettify } from '../utils/helpers/numbers'; import { Time } from '../utils/dates/Time'; +import { prettify } from '../utils/helpers/numbers'; +import type { Order } from '../utils/helpers/ordering'; +import { determineOrderDir, sortList } from '../utils/helpers/ordering'; +import { SearchField } from '../utils/SearchField'; import { TableOrderIcon } from '../utils/table/TableOrderIcon'; -import { MediaMatcher } from '../utils/types'; -import { NormalizedOrphanVisit, NormalizedVisit } from './types'; +import type { MediaMatcher } from '../utils/types'; +import type { NormalizedOrphanVisit, NormalizedVisit } from './types'; import './VisitsTable.scss'; export interface VisitsTableProps { diff --git a/src/visits/charts/ChartCard.tsx b/src/visits/charts/ChartCard.tsx index bb1e8253..ed2f0be6 100644 --- a/src/visits/charts/ChartCard.tsx +++ b/src/visits/charts/ChartCard.tsx @@ -1,5 +1,5 @@ -import { Card, CardHeader, CardBody, CardFooter } from 'reactstrap'; -import { FC, PropsWithChildren, ReactNode } from 'react'; +import type { FC, PropsWithChildren, ReactNode } from 'react'; +import { Card, CardBody, CardFooter, CardHeader } from 'reactstrap'; import './ChartCard.scss'; type ChartCardProps = PropsWithChildren<{ diff --git a/src/visits/charts/DoughnutChart.tsx b/src/visits/charts/DoughnutChart.tsx index bc403488..ff721c14 100644 --- a/src/visits/charts/DoughnutChart.tsx +++ b/src/visits/charts/DoughnutChart.tsx @@ -1,10 +1,11 @@ -import { FC, useState, memo } from 'react'; -import { Chart, ChartData, ChartDataset, ChartOptions } from 'chart.js'; +import type { Chart, ChartData, ChartDataset, ChartOptions } from 'chart.js'; import { keys, values } from 'ramda'; +import type { FC } from 'react'; +import { memo, useState } from 'react'; import { Doughnut } from 'react-chartjs-2'; import { renderPieChartLabel } from '../../utils/helpers/charts'; import { isDarkThemeEnabled, PRIMARY_DARK_COLOR, PRIMARY_LIGHT_COLOR } from '../../utils/theme'; -import { Stats } from '../types'; +import type { Stats } from '../types'; import { DoughnutChartLegend } from './DoughnutChartLegend'; interface DoughnutChartProps { diff --git a/src/visits/charts/DoughnutChartCard.tsx b/src/visits/charts/DoughnutChartCard.tsx index 3febaacc..176f84e4 100644 --- a/src/visits/charts/DoughnutChartCard.tsx +++ b/src/visits/charts/DoughnutChartCard.tsx @@ -1,7 +1,7 @@ -import { FC } from 'react'; -import { Stats } from '../types'; -import { DoughnutChart } from './DoughnutChart'; +import type { FC } from 'react'; +import type { Stats } from '../types'; import { ChartCard } from './ChartCard'; +import { DoughnutChart } from './DoughnutChart'; interface DoughnutChartCardProps { title: string; diff --git a/src/visits/charts/DoughnutChartLegend.tsx b/src/visits/charts/DoughnutChartLegend.tsx index cd843031..aa70f47a 100644 --- a/src/visits/charts/DoughnutChartLegend.tsx +++ b/src/visits/charts/DoughnutChartLegend.tsx @@ -1,5 +1,5 @@ -import { FC } from 'react'; -import { Chart } from 'chart.js'; +import type { Chart } from 'chart.js'; +import type { FC } from 'react'; import './DoughnutChartLegend.scss'; interface DoughnutChartLegendProps { diff --git a/src/visits/charts/HorizontalBarChart.tsx b/src/visits/charts/HorizontalBarChart.tsx index 2c9bcb22..1aac6903 100644 --- a/src/visits/charts/HorizontalBarChart.tsx +++ b/src/visits/charts/HorizontalBarChart.tsx @@ -1,12 +1,13 @@ -import { FC, MutableRefObject, useRef } from 'react'; -import { ChartData, ChartDataset, ChartOptions, InteractionItem } from 'chart.js'; +import type { ChartData, ChartDataset, ChartOptions, InteractionItem } from 'chart.js'; import { keys, values } from 'ramda'; +import type { FC, MutableRefObject } from 'react'; +import { useRef } from 'react'; import { Bar, getElementAtEvent } from 'react-chartjs-2'; -import { fillTheGaps } from '../../utils/helpers/visits'; import { pointerOnHover, renderChartLabel } from '../../utils/helpers/charts'; import { prettify } from '../../utils/helpers/numbers'; -import { Stats } from '../types'; +import { fillTheGaps } from '../../utils/helpers/visits'; import { HIGHLIGHTED_COLOR, HIGHLIGHTED_COLOR_ALPHA, MAIN_COLOR, MAIN_COLOR_ALPHA } from '../../utils/theme'; +import type { Stats } from '../types'; export interface HorizontalBarChartProps { stats: Stats; diff --git a/src/visits/charts/LineChartCard.tsx b/src/visits/charts/LineChartCard.tsx index c83fd5b8..59cb9bba 100644 --- a/src/visits/charts/LineChartCard.tsx +++ b/src/visits/charts/LineChartCard.tsx @@ -1,36 +1,37 @@ -import { useState, useMemo, MutableRefObject, useRef } from 'react'; -import { - Card, - CardHeader, - CardBody, - UncontrolledDropdown, - DropdownToggle, - DropdownMenu, - DropdownItem, -} from 'reactstrap'; -import { getElementAtEvent, Line } from 'react-chartjs-2'; -import { always, cond, countBy, reverse } from 'ramda'; +import type { ChartData, ChartDataset, ChartOptions, InteractionItem } from 'chart.js'; import { add, differenceInDays, differenceInHours, differenceInMonths, differenceInWeeks, - parseISO, - format, - startOfISOWeek, endOfISOWeek, + format, + parseISO, + startOfISOWeek, } from 'date-fns'; -import { ChartData, ChartDataset, ChartOptions, InteractionItem } from 'chart.js'; -import { NormalizedVisit, Stats } from '../types'; -import { fillTheGaps } from '../../utils/helpers/visits'; -import { useToggle } from '../../utils/helpers/hooks'; -import { rangeOf } from '../../utils/utils'; -import { ToggleSwitch } from '../../utils/ToggleSwitch'; -import { prettify } from '../../utils/helpers/numbers'; +import { always, cond, countBy, reverse } from 'ramda'; +import type { MutableRefObject } from 'react'; +import { useMemo, useRef, useState } from 'react'; +import { getElementAtEvent, Line } from 'react-chartjs-2'; +import { + Card, + CardBody, + CardHeader, + DropdownItem, + DropdownMenu, + DropdownToggle, + UncontrolledDropdown, +} from 'reactstrap'; import { pointerOnHover, renderChartLabel } from '../../utils/helpers/charts'; -import { HIGHLIGHTED_COLOR, MAIN_COLOR } from '../../utils/theme'; import { STANDARD_DATE_FORMAT } from '../../utils/helpers/date'; +import { useToggle } from '../../utils/helpers/hooks'; +import { prettify } from '../../utils/helpers/numbers'; +import { fillTheGaps } from '../../utils/helpers/visits'; +import { HIGHLIGHTED_COLOR, MAIN_COLOR } from '../../utils/theme'; +import { ToggleSwitch } from '../../utils/ToggleSwitch'; +import { rangeOf } from '../../utils/utils'; +import type { NormalizedVisit, Stats } from '../types'; import './LineChartCard.scss'; interface LineChartCardProps { diff --git a/src/visits/charts/SortableBarChartCard.tsx b/src/visits/charts/SortableBarChartCard.tsx index 04ac4f33..7ee08900 100644 --- a/src/visits/charts/SortableBarChartCard.tsx +++ b/src/visits/charts/SortableBarChartCard.tsx @@ -1,14 +1,16 @@ -import { FC, ReactNode, useState } from 'react'; import { fromPairs, pipe, reverse, sortBy, splitEvery, toLower, toPairs, type, zipObj } from 'ramda'; -import { rangeOf } from '../../utils/utils'; -import { Order } from '../../utils/helpers/ordering'; +import type { FC, ReactNode } from 'react'; +import { useState } from 'react'; import { SimplePaginator } from '../../common/SimplePaginator'; import { roundTen } from '../../utils/helpers/numbers'; +import type { Order } from '../../utils/helpers/ordering'; import { OrderingDropdown } from '../../utils/OrderingDropdown'; import { PaginationDropdown } from '../../utils/PaginationDropdown'; -import { Stats, StatsRow } from '../types'; -import { HorizontalBarChart, HorizontalBarChartProps } from './HorizontalBarChart'; +import { rangeOf } from '../../utils/utils'; +import type { Stats, StatsRow } from '../types'; import { ChartCard } from './ChartCard'; +import type { HorizontalBarChartProps } from './HorizontalBarChart'; +import { HorizontalBarChart } from './HorizontalBarChart'; interface SortableBarChartCardProps extends Omit { title: Function | string; diff --git a/src/visits/helpers/MapModal.tsx b/src/visits/helpers/MapModal.tsx index c2118031..bc0a1bd9 100644 --- a/src/visits/helpers/MapModal.tsx +++ b/src/visits/helpers/MapModal.tsx @@ -1,8 +1,9 @@ -import { FC } from 'react'; -import { Modal, ModalBody } from 'reactstrap'; -import { MapContainer, TileLayer, Marker, Popup, MapContainerProps } from 'react-leaflet'; import { prop } from 'ramda'; -import { CityStats } from '../types'; +import type { FC } from 'react'; +import type { MapContainerProps } from 'react-leaflet'; +import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet'; +import { Modal, ModalBody } from 'reactstrap'; +import type { CityStats } from '../types'; import './MapModal.scss'; interface MapModalProps { diff --git a/src/visits/helpers/OpenMapModalBtn.tsx b/src/visits/helpers/OpenMapModalBtn.tsx index 9d3032e7..b36a2ce9 100644 --- a/src/visits/helpers/OpenMapModalBtn.tsx +++ b/src/visits/helpers/OpenMapModalBtn.tsx @@ -1,9 +1,9 @@ -import { useState } from 'react'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faMapMarkedAlt as mapIcon } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { useState } from 'react'; import { Button, Dropdown, DropdownItem, DropdownMenu, UncontrolledTooltip } from 'reactstrap'; import { useDomId, useToggle } from '../../utils/helpers/hooks'; -import { CityStats } from '../types'; +import type { CityStats } from '../types'; import { MapModal } from './MapModal'; import './OpenMapModalBtn.scss'; diff --git a/src/visits/helpers/VisitsFilterDropdown.tsx b/src/visits/helpers/VisitsFilterDropdown.tsx index ebc5bc31..195acba6 100644 --- a/src/visits/helpers/VisitsFilterDropdown.tsx +++ b/src/visits/helpers/VisitsFilterDropdown.tsx @@ -1,7 +1,8 @@ -import { DropdownItem, DropdownItemProps } from 'reactstrap'; -import { OrphanVisitType, VisitsFilter } from '../types'; +import type { DropdownItemProps } from 'reactstrap'; +import { DropdownItem } from 'reactstrap'; import { DropdownBtn } from '../../utils/DropdownBtn'; import { hasValue } from '../../utils/utils'; +import type { OrphanVisitType, VisitsFilter } from '../types'; interface VisitsFilterDropdownProps { onChange: (filters: VisitsFilter) => void; diff --git a/src/visits/helpers/hooks.ts b/src/visits/helpers/hooks.ts index 1c57d8d7..42798bc7 100644 --- a/src/visits/helpers/hooks.ts +++ b/src/visits/helpers/hooks.ts @@ -1,12 +1,14 @@ -import { DeepPartial } from '@reduxjs/toolkit'; -import { useLocation, useNavigate } from 'react-router-dom'; -import { useMemo } from 'react'; +import type { DeepPartial } from '@reduxjs/toolkit'; import { isEmpty, isNil, mergeDeepRight, pipe } from 'ramda'; -import { DateRange, datesToDateRange } from '../../utils/helpers/dateIntervals'; -import { OrphanVisitType, VisitsFilter } from '../types'; -import { parseQuery, stringifyQuery } from '../../utils/helpers/query'; +import { useMemo } from 'react'; +import { useLocation, useNavigate } from 'react-router-dom'; import { formatIsoDate } from '../../utils/helpers/date'; -import { BooleanString, parseBooleanToString } from '../../utils/utils'; +import type { DateRange } from '../../utils/helpers/dateIntervals'; +import { datesToDateRange } from '../../utils/helpers/dateIntervals'; +import { parseQuery, stringifyQuery } from '../../utils/helpers/query'; +import type { BooleanString } from '../../utils/utils'; +import { parseBooleanToString } from '../../utils/utils'; +import type { OrphanVisitType, VisitsFilter } from '../types'; interface VisitsQuery { startDate?: string; diff --git a/src/visits/reducers/common.ts b/src/visits/reducers/common.ts index b3abfddd..fe7183ac 100644 --- a/src/visits/reducers/common.ts +++ b/src/visits/reducers/common.ts @@ -1,12 +1,13 @@ -import { flatten, prop, range, splitEvery } from 'ramda'; import { createAction, createSlice } from '@reduxjs/toolkit'; -import { ShlinkPaginator, ShlinkVisits, ShlinkVisitsParams } from '../../api/types'; -import { CreateVisit, Visit } from '../types'; -import { DateInterval, dateToMatchingInterval } from '../../utils/helpers/dateIntervals'; -import { LoadVisits, VisitsInfo, VisitsLoaded } from './types'; -import { createAsyncThunk } from '../../utils/helpers/redux'; -import { ShlinkState } from '../../container/types'; +import { flatten, prop, range, splitEvery } from 'ramda'; +import type { ShlinkPaginator, ShlinkVisits, ShlinkVisitsParams } from '../../api/types'; import { parseApiError } from '../../api/utils'; +import type { ShlinkState } from '../../container/types'; +import type { DateInterval } from '../../utils/helpers/dateIntervals'; +import { dateToMatchingInterval } from '../../utils/helpers/dateIntervals'; +import { createAsyncThunk } from '../../utils/helpers/redux'; +import type { CreateVisit, Visit } from '../types'; +import type { LoadVisits, VisitsInfo, VisitsLoaded } from './types'; import { createNewVisits } from './visitCreation'; const ITEMS_PER_PAGE = 5000; diff --git a/src/visits/reducers/domainVisits.ts b/src/visits/reducers/domainVisits.ts index a44d1cfc..cfb08322 100644 --- a/src/visits/reducers/domainVisits.ts +++ b/src/visits/reducers/domainVisits.ts @@ -1,8 +1,8 @@ -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import { domainMatches } from '../../short-urls/helpers'; import { isBetween } from '../../utils/helpers/date'; import { createVisitsAsyncThunk, createVisitsReducer, lastVisitLoaderForLoader } from './common'; -import { domainMatches } from '../../short-urls/helpers'; -import { LoadVisits, VisitsInfo } from './types'; +import type { LoadVisits, VisitsInfo } from './types'; const REDUCER_PREFIX = 'shlink/domainVisits'; diff --git a/src/visits/reducers/nonOrphanVisits.ts b/src/visits/reducers/nonOrphanVisits.ts index 83db3f43..6156cb74 100644 --- a/src/visits/reducers/nonOrphanVisits.ts +++ b/src/visits/reducers/nonOrphanVisits.ts @@ -1,7 +1,7 @@ -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; import { isBetween } from '../../utils/helpers/date'; import { createVisitsAsyncThunk, createVisitsReducer, lastVisitLoaderForLoader } from './common'; -import { VisitsInfo } from './types'; +import type { VisitsInfo } from './types'; const REDUCER_PREFIX = 'shlink/orphanVisits'; diff --git a/src/visits/reducers/orphanVisits.ts b/src/visits/reducers/orphanVisits.ts index 269aa764..1bb5c55d 100644 --- a/src/visits/reducers/orphanVisits.ts +++ b/src/visits/reducers/orphanVisits.ts @@ -1,9 +1,9 @@ -import { OrphanVisit, OrphanVisitType } from '../types'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; -import { isOrphanVisit } from '../types/helpers'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; import { isBetween } from '../../utils/helpers/date'; +import type { OrphanVisit, OrphanVisitType } from '../types'; +import { isOrphanVisit } from '../types/helpers'; import { createVisitsAsyncThunk, createVisitsReducer, lastVisitLoaderForLoader } from './common'; -import { LoadVisits, VisitsInfo } from './types'; +import type { LoadVisits, VisitsInfo } from './types'; const REDUCER_PREFIX = 'shlink/orphanVisits'; diff --git a/src/visits/reducers/shortUrlVisits.ts b/src/visits/reducers/shortUrlVisits.ts index 1c434787..5b7d432e 100644 --- a/src/visits/reducers/shortUrlVisits.ts +++ b/src/visits/reducers/shortUrlVisits.ts @@ -1,9 +1,9 @@ +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShortUrlIdentifier } from '../../short-urls/data'; import { shortUrlMatches } from '../../short-urls/helpers'; -import { ShortUrlIdentifier } from '../../short-urls/data'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; import { isBetween } from '../../utils/helpers/date'; import { createVisitsAsyncThunk, createVisitsReducer, lastVisitLoaderForLoader } from './common'; -import { LoadVisits, VisitsInfo } from './types'; +import type { LoadVisits, VisitsInfo } from './types'; const REDUCER_PREFIX = 'shlink/shortUrlVisits'; diff --git a/src/visits/reducers/tagVisits.ts b/src/visits/reducers/tagVisits.ts index 66b86ca0..ff2b2374 100644 --- a/src/visits/reducers/tagVisits.ts +++ b/src/visits/reducers/tagVisits.ts @@ -1,7 +1,7 @@ -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; import { isBetween } from '../../utils/helpers/date'; import { createVisitsAsyncThunk, createVisitsReducer, lastVisitLoaderForLoader } from './common'; -import { LoadVisits, VisitsInfo } from './types'; +import type { LoadVisits, VisitsInfo } from './types'; const REDUCER_PREFIX = 'shlink/tagVisits'; diff --git a/src/visits/reducers/types/index.ts b/src/visits/reducers/types/index.ts index f3e0e353..1ab70627 100644 --- a/src/visits/reducers/types/index.ts +++ b/src/visits/reducers/types/index.ts @@ -1,7 +1,7 @@ -import { ShlinkVisitsParams } from '../../../api/types'; -import { DateInterval } from '../../../utils/helpers/dateIntervals'; -import { ProblemDetailsError } from '../../../api/types/errors'; -import { Visit } from '../../types'; +import type { ShlinkVisitsParams } from '../../../api/types'; +import type { ProblemDetailsError } from '../../../api/types/errors'; +import type { DateInterval } from '../../../utils/helpers/dateIntervals'; +import type { Visit } from '../../types'; export interface VisitsInfo { visits: Visit[]; diff --git a/src/visits/reducers/visitCreation.ts b/src/visits/reducers/visitCreation.ts index eb037bd7..3504251e 100644 --- a/src/visits/reducers/visitCreation.ts +++ b/src/visits/reducers/visitCreation.ts @@ -1,5 +1,6 @@ -import { createAction, PayloadAction } from '@reduxjs/toolkit'; -import { CreateVisit } from '../types'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createAction } from '@reduxjs/toolkit'; +import type { CreateVisit } from '../types'; export type CreateVisitsAction = PayloadAction<{ createdVisits: CreateVisit[]; diff --git a/src/visits/reducers/visitsOverview.ts b/src/visits/reducers/visitsOverview.ts index 105bfd2b..bab2b58b 100644 --- a/src/visits/reducers/visitsOverview.ts +++ b/src/visits/reducers/visitsOverview.ts @@ -1,6 +1,7 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { ShlinkVisitsOverview } from '../../api/types'; -import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { PayloadAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; +import type { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder'; +import type { ShlinkVisitsOverview } from '../../api/types'; import { createAsyncThunk } from '../../utils/helpers/redux'; import { groupNewVisitsByType } from '../types/helpers'; import { createNewVisits } from './visitCreation'; diff --git a/src/visits/services/VisitsParser.ts b/src/visits/services/VisitsParser.ts index d9826152..9d10e706 100644 --- a/src/visits/services/VisitsParser.ts +++ b/src/visits/services/VisitsParser.ts @@ -1,7 +1,7 @@ import { isNil, map } from 'ramda'; import { extractDomain, parseUserAgent } from '../../utils/helpers/visits'; import { hasValue } from '../../utils/utils'; -import { CityStats, NormalizedVisit, Stats, Visit, VisitsStats } from '../types'; +import type { CityStats, NormalizedVisit, Stats, Visit, VisitsStats } from '../types'; import { isNormalizedOrphanVisit, isOrphanVisit } from '../types/helpers'; /* eslint-disable no-param-reassign */ diff --git a/src/visits/services/provideServices.ts b/src/visits/services/provideServices.ts index bff16548..0319bfc4 100644 --- a/src/visits/services/provideServices.ts +++ b/src/visits/services/provideServices.ts @@ -1,22 +1,22 @@ -import Bottle from 'bottlejs'; +import type Bottle from 'bottlejs'; import { prop } from 'ramda'; +import type { ConnectDecorator } from '../../container/types'; +import { DomainVisits } from '../DomainVisits'; import { MapModal } from '../helpers/MapModal'; -import { createNewVisits } from '../reducers/visitCreation'; -import { ShortUrlVisits } from '../ShortUrlVisits'; -import { TagVisits } from '../TagVisits'; -import { OrphanVisits } from '../OrphanVisits'; import { NonOrphanVisits } from '../NonOrphanVisits'; +import { OrphanVisits } from '../OrphanVisits'; +import { domainVisitsReducerCreator, getDomainVisits } from '../reducers/domainVisits'; +import { getNonOrphanVisits, nonOrphanVisitsReducerCreator } from '../reducers/nonOrphanVisits'; +import { getOrphanVisits, orphanVisitsReducerCreator } from '../reducers/orphanVisits'; import { getShortUrlVisits, shortUrlVisitsReducerCreator } from '../reducers/shortUrlVisits'; import { getTagVisits, tagVisitsReducerCreator } from '../reducers/tagVisits'; -import { getDomainVisits, domainVisitsReducerCreator } from '../reducers/domainVisits'; -import { getOrphanVisits, orphanVisitsReducerCreator } from '../reducers/orphanVisits'; -import { getNonOrphanVisits, nonOrphanVisitsReducerCreator } from '../reducers/nonOrphanVisits'; -import { ConnectDecorator } from '../../container/types'; +import { createNewVisits } from '../reducers/visitCreation'; import { loadVisitsOverview, visitsOverviewReducerCreator } from '../reducers/visitsOverview'; +import { ShortUrlVisits } from '../ShortUrlVisits'; +import { TagVisits } from '../TagVisits'; import * as visitsParser from './VisitsParser'; -import { DomainVisits } from '../DomainVisits'; -const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { +export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { // Components bottle.serviceFactory('MapModal', () => MapModal); @@ -91,5 +91,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('tagVisitsReducerCreator', tagVisitsReducerCreator, 'getTagVisits'); bottle.serviceFactory('tagVisitsReducer', prop('reducer'), 'tagVisitsReducerCreator'); }; - -export default provideServices; diff --git a/src/visits/types/CommonVisitsProps.ts b/src/visits/types/CommonVisitsProps.ts index d376f027..55ff817c 100644 --- a/src/visits/types/CommonVisitsProps.ts +++ b/src/visits/types/CommonVisitsProps.ts @@ -1,4 +1,4 @@ -import { Settings } from '../../settings/reducers/settings'; +import type { Settings } from '../../settings/reducers/settings'; export interface CommonVisitsProps { settings: Settings; diff --git a/src/visits/types/helpers.ts b/src/visits/types/helpers.ts index 04509d03..77714262 100644 --- a/src/visits/types/helpers.ts +++ b/src/visits/types/helpers.ts @@ -1,7 +1,7 @@ import { countBy, groupBy, pipe, prop } from 'ramda'; +import type { ShlinkVisitsParams } from '../../api/types'; import { formatIsoDate } from '../../utils/helpers/date'; -import { ShlinkVisitsParams } from '../../api/types'; -import { CreateVisit, NormalizedOrphanVisit, NormalizedVisit, OrphanVisit, Stats, Visit, VisitsParams } from './index'; +import type { CreateVisit, NormalizedOrphanVisit, NormalizedVisit, OrphanVisit, Stats, Visit, VisitsParams } from './index'; export const isOrphanVisit = (visit: Visit): visit is OrphanVisit => (visit as OrphanVisit).visitedUrl !== undefined; diff --git a/src/visits/types/index.ts b/src/visits/types/index.ts index 0ff67d6b..503f8170 100644 --- a/src/visits/types/index.ts +++ b/src/visits/types/index.ts @@ -1,5 +1,5 @@ -import { ShortUrl } from '../../short-urls/data'; -import { DateRange } from '../../utils/helpers/dateIntervals'; +import type { ShortUrl } from '../../short-urls/data'; +import type { DateRange } from '../../utils/helpers/dateIntervals'; export type OrphanVisitType = 'base_url' | 'invalid_short_url' | 'regular_404'; diff --git a/test/__helpers__/TestModalWrapper.tsx b/test/__helpers__/TestModalWrapper.tsx index e2364192..a673827b 100644 --- a/test/__helpers__/TestModalWrapper.tsx +++ b/test/__helpers__/TestModalWrapper.tsx @@ -1,4 +1,4 @@ -import { FC, ReactElement } from 'react'; +import type { FC, ReactElement } from 'react'; import { useToggle } from '../../src/utils/helpers/hooks'; interface RenderModalArgs { diff --git a/test/__helpers__/setUpTest.ts b/test/__helpers__/setUpTest.ts index 210a88ff..ffaf7376 100644 --- a/test/__helpers__/setUpTest.ts +++ b/test/__helpers__/setUpTest.ts @@ -1,6 +1,6 @@ -import { ReactElement } from 'react'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import type { ReactElement } from 'react'; export const setUpCanvas = (element: ReactElement) => { const result = render(element); diff --git a/test/api/ShlinkApiError.test.tsx b/test/api/ShlinkApiError.test.tsx index a7aaebc1..daa42f69 100644 --- a/test/api/ShlinkApiError.test.tsx +++ b/test/api/ShlinkApiError.test.tsx @@ -1,7 +1,9 @@ import { render, screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { ShlinkApiError, ShlinkApiErrorProps } from '../../src/api/ShlinkApiError'; -import { ErrorTypeV2, ErrorTypeV3, InvalidArgumentError, ProblemDetailsError } from '../../src/api/types/errors'; +import type { ShlinkApiErrorProps } from '../../src/api/ShlinkApiError'; +import { ShlinkApiError } from '../../src/api/ShlinkApiError'; +import type { InvalidArgumentError, ProblemDetailsError } from '../../src/api/types/errors'; +import { ErrorTypeV2, ErrorTypeV3 } from '../../src/api/types/errors'; describe('', () => { const setUp = (props: ShlinkApiErrorProps) => render(); diff --git a/test/api/services/ShlinkApiClient.test.ts b/test/api/services/ShlinkApiClient.test.ts index 802e0678..4215e088 100644 --- a/test/api/services/ShlinkApiClient.test.ts +++ b/test/api/services/ShlinkApiClient.test.ts @@ -1,10 +1,10 @@ import { Mock } from 'ts-mockery'; import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { OptionalString } from '../../../src/utils/utils'; -import { ShlinkDomain, ShlinkVisits, ShlinkVisitsOverview } from '../../../src/api/types'; -import { ShortUrl, ShortUrlsOrder } from '../../../src/short-urls/data'; +import type { ShlinkDomain, ShlinkVisits, ShlinkVisitsOverview } from '../../../src/api/types'; import { ErrorTypeV2, ErrorTypeV3 } from '../../../src/api/types/errors'; -import { HttpClient } from '../../../src/common/services/HttpClient'; +import type { HttpClient } from '../../../src/common/services/HttpClient'; +import type { ShortUrl, ShortUrlsOrder } from '../../../src/short-urls/data'; +import type { OptionalString } from '../../../src/utils/utils'; describe('ShlinkApiClient', () => { const fetchJson = jest.fn().mockResolvedValue({}); diff --git a/test/api/services/ShlinkApiClientBuilder.test.ts b/test/api/services/ShlinkApiClientBuilder.test.ts index 18c29ebf..3729bf07 100644 --- a/test/api/services/ShlinkApiClientBuilder.test.ts +++ b/test/api/services/ShlinkApiClientBuilder.test.ts @@ -1,8 +1,8 @@ import { Mock } from 'ts-mockery'; import { buildShlinkApiClient } from '../../../src/api/services/ShlinkApiClientBuilder'; -import { ReachableServer, SelectedServer } from '../../../src/servers/data'; -import { ShlinkState } from '../../../src/container/types'; -import { HttpClient } from '../../../src/common/services/HttpClient'; +import type { HttpClient } from '../../../src/common/services/HttpClient'; +import type { ShlinkState } from '../../../src/container/types'; +import type { ReachableServer, SelectedServer } from '../../../src/servers/data'; describe('ShlinkApiClientBuilder', () => { const server = (data: Partial) => Mock.of(data); diff --git a/test/app/App.test.tsx b/test/app/App.test.tsx index a286c61f..345ce5d6 100644 --- a/test/app/App.test.tsx +++ b/test/app/App.test.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; -import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; +import { Router } from 'react-router-dom'; import { Mock } from 'ts-mockery'; -import { Settings } from '../../src/settings/reducers/settings'; import { App as createApp } from '../../src/app/App'; +import type { Settings } from '../../src/settings/reducers/settings'; describe('', () => { const App = createApp( diff --git a/test/app/reducers/appUpdates.test.ts b/test/app/reducers/appUpdates.test.ts index 32070612..1289132f 100644 --- a/test/app/reducers/appUpdates.test.ts +++ b/test/app/reducers/appUpdates.test.ts @@ -1,4 +1,4 @@ -import { appUpdatesReducer, appUpdateAvailable, resetAppUpdate } from '../../../src/app/reducers/appUpdates'; +import { appUpdateAvailable, appUpdatesReducer, resetAppUpdate } from '../../../src/app/reducers/appUpdates'; describe('appUpdatesReducer', () => { describe('reducer', () => { diff --git a/test/common/AsideMenu.test.tsx b/test/common/AsideMenu.test.tsx index 6874053d..7e149e15 100644 --- a/test/common/AsideMenu.test.tsx +++ b/test/common/AsideMenu.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; import { AsideMenu as createAsideMenu } from '../../src/common/AsideMenu'; -import { ReachableServer } from '../../src/servers/data'; +import type { ReachableServer } from '../../src/servers/data'; describe('', () => { const AsideMenu = createAsideMenu(() => <>DeleteServerButton); diff --git a/test/common/Home.test.tsx b/test/common/Home.test.tsx index 75c14047..9f389c83 100644 --- a/test/common/Home.test.tsx +++ b/test/common/Home.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; import { Home } from '../../src/common/Home'; -import { ServersMap, ServerWithId } from '../../src/servers/data'; +import type { ServersMap, ServerWithId } from '../../src/servers/data'; describe('', () => { const setUp = (servers: ServersMap = {}) => render( diff --git a/test/common/MainHeader.test.tsx b/test/common/MainHeader.test.tsx index e3187c7e..678df1f8 100644 --- a/test/common/MainHeader.test.tsx +++ b/test/common/MainHeader.test.tsx @@ -1,6 +1,6 @@ import { screen, waitFor } from '@testing-library/react'; -import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; +import { Router } from 'react-router-dom'; import { MainHeader as createMainHeader } from '../../src/common/MainHeader'; import { renderWithEvents } from '../__helpers__/setUpTest'; diff --git a/test/common/MenuLayout.test.tsx b/test/common/MenuLayout.test.tsx index e2ebc468..644235f6 100644 --- a/test/common/MenuLayout.test.tsx +++ b/test/common/MenuLayout.test.tsx @@ -1,10 +1,10 @@ import { render, screen } from '@testing-library/react'; -import { Router, useParams } from 'react-router-dom'; import { createMemoryHistory } from 'history'; +import { Router, useParams } from 'react-router-dom'; import { Mock } from 'ts-mockery'; import { MenuLayout as createMenuLayout } from '../../src/common/MenuLayout'; -import { NonReachableServer, NotFoundServer, ReachableServer, SelectedServer } from '../../src/servers/data'; -import { SemVer } from '../../src/utils/helpers/version'; +import type { NonReachableServer, NotFoundServer, ReachableServer, SelectedServer } from '../../src/servers/data'; +import type { SemVer } from '../../src/utils/helpers/version'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useParams: jest.fn() })); diff --git a/test/common/ShlinkVersions.test.tsx b/test/common/ShlinkVersions.test.tsx index 7c6127f1..cd35d9d7 100644 --- a/test/common/ShlinkVersions.test.tsx +++ b/test/common/ShlinkVersions.test.tsx @@ -1,7 +1,8 @@ import { render, screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { ShlinkVersions, ShlinkVersionsProps } from '../../src/common/ShlinkVersions'; -import { NonReachableServer, NotFoundServer, ReachableServer } from '../../src/servers/data'; +import type { ShlinkVersionsProps } from '../../src/common/ShlinkVersions'; +import { ShlinkVersions } from '../../src/common/ShlinkVersions'; +import type { NonReachableServer, NotFoundServer, ReachableServer } from '../../src/servers/data'; describe('', () => { const setUp = (props: ShlinkVersionsProps) => render(); diff --git a/test/common/ShlinkVersionsContainer.test.tsx b/test/common/ShlinkVersionsContainer.test.tsx index 1920fdc2..75f3143a 100644 --- a/test/common/ShlinkVersionsContainer.test.tsx +++ b/test/common/ShlinkVersionsContainer.test.tsx @@ -1,8 +1,8 @@ import { render } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { Sidebar } from '../../src/common/reducers/sidebar'; import { ShlinkVersionsContainer } from '../../src/common/ShlinkVersionsContainer'; -import { SelectedServer } from '../../src/servers/data'; -import { Sidebar } from '../../src/common/reducers/sidebar'; +import type { SelectedServer } from '../../src/servers/data'; describe('', () => { const setUp = (sidebar: Sidebar) => render( diff --git a/test/common/img/ShlinkLogo.test.tsx b/test/common/img/ShlinkLogo.test.tsx index d1c6cc61..6fcc6459 100644 --- a/test/common/img/ShlinkLogo.test.tsx +++ b/test/common/img/ShlinkLogo.test.tsx @@ -1,5 +1,6 @@ import { render } from '@testing-library/react'; -import { ShlinkLogo, ShlinkLogoProps } from '../../../src/common/img/ShlinkLogo'; +import type { ShlinkLogoProps } from '../../../src/common/img/ShlinkLogo'; +import { ShlinkLogo } from '../../../src/common/img/ShlinkLogo'; import { MAIN_COLOR } from '../../../src/utils/theme'; describe('', () => { diff --git a/test/common/reducer/sidebar.test.ts b/test/common/reducer/sidebar.test.ts index db59f510..146529c5 100644 --- a/test/common/reducer/sidebar.test.ts +++ b/test/common/reducer/sidebar.test.ts @@ -1,4 +1,4 @@ -import { sidebarReducer, sidebarNotPresent, sidebarPresent } from '../../../src/common/reducers/sidebar'; +import { sidebarNotPresent, sidebarPresent, sidebarReducer } from '../../../src/common/reducers/sidebar'; describe('sidebarReducer', () => { describe('reducer', () => { diff --git a/test/common/services/ImageDownloader.test.ts b/test/common/services/ImageDownloader.test.ts index e33c4ecf..498b9e60 100644 --- a/test/common/services/ImageDownloader.test.ts +++ b/test/common/services/ImageDownloader.test.ts @@ -1,6 +1,6 @@ import { Mock } from 'ts-mockery'; +import type { HttpClient } from '../../../src/common/services/HttpClient'; import { ImageDownloader } from '../../../src/common/services/ImageDownloader'; -import { HttpClient } from '../../../src/common/services/HttpClient'; import { windowMock } from '../../__mocks__/Window.mock'; describe('ImageDownloader', () => { diff --git a/test/common/services/ReportExporter.test.ts b/test/common/services/ReportExporter.test.ts index 02097005..3d786787 100644 --- a/test/common/services/ReportExporter.test.ts +++ b/test/common/services/ReportExporter.test.ts @@ -1,7 +1,7 @@ import { ReportExporter } from '../../../src/common/services/ReportExporter'; -import { NormalizedVisit } from '../../../src/visits/types'; +import type { ExportableShortUrl } from '../../../src/short-urls/data'; +import type { NormalizedVisit } from '../../../src/visits/types'; import { windowMock } from '../../__mocks__/Window.mock'; -import { ExportableShortUrl } from '../../../src/short-urls/data'; describe('ReportExporter', () => { const jsonToCsv = jest.fn(); diff --git a/test/domains/DomainRow.test.tsx b/test/domains/DomainRow.test.tsx index 0c506a88..2fd4f26d 100644 --- a/test/domains/DomainRow.test.tsx +++ b/test/domains/DomainRow.test.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { ShlinkDomainRedirects } from '../../src/api/types'; +import type { ShlinkDomainRedirects } from '../../src/api/types'; +import type { Domain } from '../../src/domains/data'; import { DomainRow } from '../../src/domains/DomainRow'; -import { SelectedServer } from '../../src/servers/data'; -import { Domain } from '../../src/domains/data'; +import type { SelectedServer } from '../../src/servers/data'; describe('', () => { const redirectsCombinations = [ diff --git a/test/domains/DomainSelector.test.tsx b/test/domains/DomainSelector.test.tsx index e2effdf4..065201bc 100644 --- a/test/domains/DomainSelector.test.tsx +++ b/test/domains/DomainSelector.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { ShlinkDomain } from '../../src/api/types'; import { DomainSelector } from '../../src/domains/DomainSelector'; -import { DomainsList } from '../../src/domains/reducers/domainsList'; -import { ShlinkDomain } from '../../src/api/types'; +import type { DomainsList } from '../../src/domains/reducers/domainsList'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/domains/ManageDomains.test.tsx b/test/domains/ManageDomains.test.tsx index 4726ed4e..fc3c295d 100644 --- a/test/domains/ManageDomains.test.tsx +++ b/test/domains/ManageDomains.test.tsx @@ -1,11 +1,11 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { DomainsList } from '../../src/domains/reducers/domainsList'; +import type { ShlinkDomain } from '../../src/api/types'; +import type { ProblemDetailsError } from '../../src/api/types/errors'; import { ManageDomains } from '../../src/domains/ManageDomains'; -import { ShlinkDomain } from '../../src/api/types'; -import { SelectedServer } from '../../src/servers/data'; +import type { DomainsList } from '../../src/domains/reducers/domainsList'; +import type { SelectedServer } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; -import { ProblemDetailsError } from '../../src/api/types/errors'; describe('', () => { const listDomains = jest.fn(); diff --git a/test/domains/helpers/DomainDropdown.test.tsx b/test/domains/helpers/DomainDropdown.test.tsx index 1efd1a5e..6acd0b9b 100644 --- a/test/domains/helpers/DomainDropdown.test.tsx +++ b/test/domains/helpers/DomainDropdown.test.tsx @@ -1,10 +1,10 @@ import { screen, waitForElementToBeRemoved } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { Domain } from '../../../src/domains/data'; import { DomainDropdown } from '../../../src/domains/helpers/DomainDropdown'; -import { Domain } from '../../../src/domains/data'; -import { ReachableServer, SelectedServer } from '../../../src/servers/data'; -import { SemVer } from '../../../src/utils/helpers/version'; +import type { ReachableServer, SelectedServer } from '../../../src/servers/data'; +import type { SemVer } from '../../../src/utils/helpers/version'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/domains/helpers/DomainStatusIcon.test.tsx b/test/domains/helpers/DomainStatusIcon.test.tsx index a95ab027..ee5d3410 100644 --- a/test/domains/helpers/DomainStatusIcon.test.tsx +++ b/test/domains/helpers/DomainStatusIcon.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { DomainStatus } from '../../../src/domains/data'; +import type { DomainStatus } from '../../../src/domains/data'; import { DomainStatusIcon } from '../../../src/domains/helpers/DomainStatusIcon'; import { renderWithEvents } from '../../__helpers__/setUpTest'; diff --git a/test/domains/helpers/EditDomainRedirectsModal.test.tsx b/test/domains/helpers/EditDomainRedirectsModal.test.tsx index a83ddcbb..fb9a98fc 100644 --- a/test/domains/helpers/EditDomainRedirectsModal.test.tsx +++ b/test/domains/helpers/EditDomainRedirectsModal.test.tsx @@ -1,6 +1,6 @@ import { fireEvent, screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { ShlinkDomain } from '../../../src/api/types'; +import type { ShlinkDomain } from '../../../src/api/types'; import { EditDomainRedirectsModal } from '../../../src/domains/helpers/EditDomainRedirectsModal'; import { renderWithEvents } from '../../__helpers__/setUpTest'; diff --git a/test/domains/reducers/domainRedirects.test.ts b/test/domains/reducers/domainRedirects.test.ts index 567e0c1f..c33af060 100644 --- a/test/domains/reducers/domainRedirects.test.ts +++ b/test/domains/reducers/domainRedirects.test.ts @@ -1,7 +1,8 @@ import { Mock } from 'ts-mockery'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { EditDomainRedirects, editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; -import { ShlinkDomainRedirects } from '../../../src/api/types'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkDomainRedirects } from '../../../src/api/types'; +import type { EditDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; +import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; describe('domainRedirectsReducer', () => { beforeEach(jest.clearAllMocks); diff --git a/test/domains/reducers/domainsList.test.ts b/test/domains/reducers/domainsList.test.ts index b96a37d0..ba880183 100644 --- a/test/domains/reducers/domainsList.test.ts +++ b/test/domains/reducers/domainsList.test.ts @@ -1,17 +1,18 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkDomainRedirects } from '../../../src/api/types'; +import { parseApiError } from '../../../src/api/utils'; +import type { ShlinkState } from '../../../src/container/types'; +import type { Domain } from '../../../src/domains/data'; +import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; +import type { + DomainsList } from '../../../src/domains/reducers/domainsList'; import { - DomainsList, + domainsListReducerCreator, replaceRedirectsOnDomain, replaceStatusOnDomain, - domainsListReducerCreator, } from '../../../src/domains/reducers/domainsList'; -import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; -import { ShlinkDomainRedirects } from '../../../src/api/types'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { Domain } from '../../../src/domains/data'; -import { ShlinkState } from '../../../src/container/types'; -import { SelectedServer, ServerData } from '../../../src/servers/data'; -import { parseApiError } from '../../../src/api/utils'; +import type { SelectedServer, ServerData } from '../../../src/servers/data'; describe('domainsListReducer', () => { const dispatch = jest.fn(); diff --git a/test/mercure/helpers/index.test.tsx b/test/mercure/helpers/index.test.tsx index 109e2b57..335cd79c 100644 --- a/test/mercure/helpers/index.test.tsx +++ b/test/mercure/helpers/index.test.tsx @@ -1,8 +1,8 @@ import { EventSourcePolyfill } from 'event-source-polyfill'; -import { Mock } from 'ts-mockery'; import { identity } from 'ramda'; +import { Mock } from 'ts-mockery'; import { bindToMercureTopic } from '../../../src/mercure/helpers'; -import { MercureInfo } from '../../../src/mercure/reducers/mercureInfo'; +import type { MercureInfo } from '../../../src/mercure/reducers/mercureInfo'; jest.mock('event-source-polyfill'); diff --git a/test/mercure/reducers/mercureInfo.test.ts b/test/mercure/reducers/mercureInfo.test.ts index 2dcc71b0..f76c5f99 100644 --- a/test/mercure/reducers/mercureInfo.test.ts +++ b/test/mercure/reducers/mercureInfo.test.ts @@ -1,7 +1,7 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { GetState } from '../../../src/container/types'; import { mercureInfoReducerCreator } from '../../../src/mercure/reducers/mercureInfo'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { GetState } from '../../../src/container/types'; describe('mercureInfoReducer', () => { const mercureInfo = { diff --git a/test/servers/CreateServer.test.tsx b/test/servers/CreateServer.test.tsx index a5cbc674..4930d9f7 100644 --- a/test/servers/CreateServer.test.tsx +++ b/test/servers/CreateServer.test.tsx @@ -1,8 +1,8 @@ import { fireEvent, screen, waitFor } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { useNavigate } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; import { CreateServer as createCreateServer } from '../../src/servers/CreateServer'; -import { ServerWithId } from '../../src/servers/data'; +import type { ServerWithId } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useNavigate: jest.fn() })); diff --git a/test/servers/DeleteServerButton.test.tsx b/test/servers/DeleteServerButton.test.tsx index c26431e5..4b17fcb0 100644 --- a/test/servers/DeleteServerButton.test.tsx +++ b/test/servers/DeleteServerButton.test.tsx @@ -1,8 +1,8 @@ -import { ReactNode } from 'react'; import { screen, waitFor } from '@testing-library/react'; +import type { ReactNode } from 'react'; import { Mock } from 'ts-mockery'; +import type { ServerWithId } from '../../src/servers/data'; import { DeleteServerButton as createDeleteServerButton } from '../../src/servers/DeleteServerButton'; -import { ServerWithId } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/DeleteServerModal.test.tsx b/test/servers/DeleteServerModal.test.tsx index 0a5affe5..3df5a2e5 100644 --- a/test/servers/DeleteServerModal.test.tsx +++ b/test/servers/DeleteServerModal.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { useNavigate } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ServerWithId } from '../../src/servers/data'; import { DeleteServerModal } from '../../src/servers/DeleteServerModal'; -import { ServerWithId } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; import { TestModalWrapper } from '../__helpers__/TestModalWrapper'; diff --git a/test/servers/EditServer.test.tsx b/test/servers/EditServer.test.tsx index c5181bc0..f38b2e64 100644 --- a/test/servers/EditServer.test.tsx +++ b/test/servers/EditServer.test.tsx @@ -1,8 +1,8 @@ import { fireEvent, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter, useNavigate } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ReachableServer, SelectedServer } from '../../src/servers/data'; import { EditServer as editServerConstruct } from '../../src/servers/EditServer'; -import { ReachableServer, SelectedServer } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useNavigate: jest.fn() })); diff --git a/test/servers/ManageServers.test.tsx b/test/servers/ManageServers.test.tsx index f34ad465..b3c97e8f 100644 --- a/test/servers/ManageServers.test.tsx +++ b/test/servers/ManageServers.test.tsx @@ -1,9 +1,9 @@ -import { Mock } from 'ts-mockery'; import { screen, waitFor } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; -import ServersExporter from '../../src/servers/services/ServersExporter'; +import { Mock } from 'ts-mockery'; +import type { ServersMap, ServerWithId } from '../../src/servers/data'; import { ManageServers as createManageServers } from '../../src/servers/ManageServers'; -import { ServersMap, ServerWithId } from '../../src/servers/data'; +import type { ServersExporter } from '../../src/servers/services/ServersExporter'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/ManageServersRow.test.tsx b/test/servers/ManageServersRow.test.tsx index 7c3e24ff..25a27d65 100644 --- a/test/servers/ManageServersRow.test.tsx +++ b/test/servers/ManageServersRow.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; +import type { ServerWithId } from '../../src/servers/data'; import { ManageServersRow as createManageServersRow } from '../../src/servers/ManageServersRow'; -import { ServerWithId } from '../../src/servers/data'; describe('', () => { const ManageServersRow = createManageServersRow(() => ManageServersRowDropdown); diff --git a/test/servers/ManageServersRowDropdown.test.tsx b/test/servers/ManageServersRowDropdown.test.tsx index 043950f0..df8c0946 100644 --- a/test/servers/ManageServersRowDropdown.test.tsx +++ b/test/servers/ManageServersRowDropdown.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; -import { ServerWithId } from '../../src/servers/data'; +import { Mock } from 'ts-mockery'; +import type { ServerWithId } from '../../src/servers/data'; import { ManageServersRowDropdown as createManageServersRowDropdown } from '../../src/servers/ManageServersRowDropdown'; import { renderWithEvents } from '../__helpers__/setUpTest'; diff --git a/test/servers/Overview.test.tsx b/test/servers/Overview.test.tsx index 2cf05347..4b20e3a1 100644 --- a/test/servers/Overview.test.tsx +++ b/test/servers/Overview.test.tsx @@ -1,13 +1,13 @@ import { render, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; -import { ShortUrlsList as ShortUrlsListState } from '../../src/short-urls/reducers/shortUrlsList'; +import { Mock } from 'ts-mockery'; +import type { MercureInfo } from '../../src/mercure/reducers/mercureInfo'; +import type { ReachableServer } from '../../src/servers/data'; import { Overview as overviewCreator } from '../../src/servers/Overview'; -import { TagsList } from '../../src/tags/reducers/tagsList'; -import { VisitsOverview } from '../../src/visits/reducers/visitsOverview'; -import { MercureInfo } from '../../src/mercure/reducers/mercureInfo'; -import { ReachableServer } from '../../src/servers/data'; +import type { ShortUrlsList as ShortUrlsListState } from '../../src/short-urls/reducers/shortUrlsList'; +import type { TagsList } from '../../src/tags/reducers/tagsList'; import { prettify } from '../../src/utils/helpers/numbers'; +import type { VisitsOverview } from '../../src/visits/reducers/visitsOverview'; describe('', () => { const ShortUrlsTable = () => <>ShortUrlsTable; diff --git a/test/servers/ServersDropdown.test.tsx b/test/servers/ServersDropdown.test.tsx index 102cec91..b22ceb24 100644 --- a/test/servers/ServersDropdown.test.tsx +++ b/test/servers/ServersDropdown.test.tsx @@ -1,9 +1,9 @@ import { screen } from '@testing-library/react'; import { values } from 'ramda'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ServersMap, ServerWithId } from '../../src/servers/data'; import { ServersDropdown } from '../../src/servers/ServersDropdown'; -import { ServersMap, ServerWithId } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/ServersListGroup.test.tsx b/test/servers/ServersListGroup.test.tsx index 401777e7..5c0e45a5 100644 --- a/test/servers/ServersListGroup.test.tsx +++ b/test/servers/ServersListGroup.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ServerWithId } from '../../src/servers/data'; import { ServersListGroup } from '../../src/servers/ServersListGroup'; -import { ServerWithId } from '../../src/servers/data'; describe('', () => { const servers = [ diff --git a/test/servers/helpers/DuplicatedServersModal.test.tsx b/test/servers/helpers/DuplicatedServersModal.test.tsx index 0441b4e5..81ef52d3 100644 --- a/test/servers/helpers/DuplicatedServersModal.test.tsx +++ b/test/servers/helpers/DuplicatedServersModal.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { ServerData } from '../../../src/servers/data'; import { DuplicatedServersModal } from '../../../src/servers/helpers/DuplicatedServersModal'; -import { ServerData } from '../../../src/servers/data'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/helpers/HighlightCard.test.tsx b/test/servers/helpers/HighlightCard.test.tsx index 199fe4c9..afc8f070 100644 --- a/test/servers/helpers/HighlightCard.test.tsx +++ b/test/servers/helpers/HighlightCard.test.tsx @@ -1,7 +1,8 @@ import { render, screen } from '@testing-library/react'; -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { MemoryRouter } from 'react-router-dom'; -import { HighlightCard, HighlightCardProps } from '../../../src/servers/helpers/HighlightCard'; +import type { HighlightCardProps } from '../../../src/servers/helpers/HighlightCard'; +import { HighlightCard } from '../../../src/servers/helpers/HighlightCard'; describe('', () => { const setUp = (props: HighlightCardProps & { children?: ReactNode }) => render( diff --git a/test/servers/helpers/ImportServersBtn.test.tsx b/test/servers/helpers/ImportServersBtn.test.tsx index f60d21ad..2abc105f 100644 --- a/test/servers/helpers/ImportServersBtn.test.tsx +++ b/test/servers/helpers/ImportServersBtn.test.tsx @@ -1,11 +1,12 @@ import { fireEvent, screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { ServersMap, ServerWithId } from '../../../src/servers/data'; +import type { + ImportServersBtnProps } from '../../../src/servers/helpers/ImportServersBtn'; import { ImportServersBtn as createImportServersBtn, - ImportServersBtnProps, } from '../../../src/servers/helpers/ImportServersBtn'; -import { ServersImporter } from '../../../src/servers/services/ServersImporter'; -import { ServersMap, ServerWithId } from '../../../src/servers/data'; +import type { ServersImporter } from '../../../src/servers/services/ServersImporter'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/helpers/ServerError.test.tsx b/test/servers/helpers/ServerError.test.tsx index 88847c39..be428ccf 100644 --- a/test/servers/helpers/ServerError.test.tsx +++ b/test/servers/helpers/ServerError.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import { Mock } from 'ts-mockery'; +import type { NonReachableServer, NotFoundServer } from '../../../src/servers/data'; import { ServerError as createServerError } from '../../../src/servers/helpers/ServerError'; -import { NonReachableServer, NotFoundServer } from '../../../src/servers/data'; describe('', () => { const ServerError = createServerError(() => null); diff --git a/test/servers/reducers/remoteServers.test.ts b/test/servers/reducers/remoteServers.test.ts index 2c717696..54dd80a4 100644 --- a/test/servers/reducers/remoteServers.test.ts +++ b/test/servers/reducers/remoteServers.test.ts @@ -1,7 +1,7 @@ import { Mock } from 'ts-mockery'; +import type { HttpClient } from '../../../src/common/services/HttpClient'; import { fetchServers } from '../../../src/servers/reducers/remoteServers'; import { createServers } from '../../../src/servers/reducers/servers'; -import { HttpClient } from '../../../src/common/services/HttpClient'; describe('remoteServersReducer', () => { afterEach(jest.clearAllMocks); diff --git a/test/servers/reducers/selectedServer.test.ts b/test/servers/reducers/selectedServer.test.ts index bbb93798..0a4796d2 100644 --- a/test/servers/reducers/selectedServer.test.ts +++ b/test/servers/reducers/selectedServer.test.ts @@ -1,16 +1,16 @@ -import { v4 as uuid } from 'uuid'; import { Mock } from 'ts-mockery'; +import { v4 as uuid } from 'uuid'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../src/container/types'; +import type { NonReachableServer, NotFoundServer, ReachableServer, RegularServer } from '../../../src/servers/data'; import { - selectServer as selectServerCreator, - resetSelectedServer, - selectedServerReducerCreator, - selectServerListener, MAX_FALLBACK_VERSION, MIN_FALLBACK_VERSION, + resetSelectedServer, + selectedServerReducerCreator, + selectServer as selectServerCreator, + selectServerListener, } from '../../../src/servers/reducers/selectedServer'; -import { ShlinkState } from '../../../src/container/types'; -import { NonReachableServer, NotFoundServer, ReachableServer, RegularServer } from '../../../src/servers/data'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; describe('selectedServerReducer', () => { const dispatch = jest.fn(); diff --git a/test/servers/reducers/servers.test.ts b/test/servers/reducers/servers.test.ts index 81695779..188f0678 100644 --- a/test/servers/reducers/servers.test.ts +++ b/test/servers/reducers/servers.test.ts @@ -1,13 +1,13 @@ import { dissoc, values } from 'ramda'; import { Mock } from 'ts-mockery'; +import type { RegularServer } from '../../../src/servers/data'; import { - deleteServer, createServers, + deleteServer, editServer, - setAutoConnect, serversReducer, + setAutoConnect, } from '../../../src/servers/reducers/servers'; -import { RegularServer } from '../../../src/servers/data'; describe('serversReducer', () => { const list = { diff --git a/test/servers/services/ServersExporter.test.ts b/test/servers/services/ServersExporter.test.ts index 0aa73ec1..796ca5d9 100644 --- a/test/servers/services/ServersExporter.test.ts +++ b/test/servers/services/ServersExporter.test.ts @@ -1,6 +1,6 @@ import { Mock } from 'ts-mockery'; -import ServersExporter from '../../../src/servers/services/ServersExporter'; -import { LocalStorage } from '../../../src/utils/services/LocalStorage'; +import { ServersExporter } from '../../../src/servers/services/ServersExporter'; +import type { LocalStorage } from '../../../src/utils/services/LocalStorage'; import { appendChild, removeChild, windowMock } from '../../__mocks__/Window.mock'; describe('ServersExporter', () => { diff --git a/test/servers/services/ServersImporter.test.ts b/test/servers/services/ServersImporter.test.ts index dee01be0..be0a12dc 100644 --- a/test/servers/services/ServersImporter.test.ts +++ b/test/servers/services/ServersImporter.test.ts @@ -1,6 +1,6 @@ import { Mock } from 'ts-mockery'; +import type { RegularServer } from '../../../src/servers/data'; import { ServersImporter } from '../../../src/servers/services/ServersImporter'; -import { RegularServer } from '../../../src/servers/data'; describe('ServersImporter', () => { const servers: RegularServer[] = [Mock.all(), Mock.all()]; diff --git a/test/settings/RealTimeUpdatesSettings.test.tsx b/test/settings/RealTimeUpdatesSettings.test.tsx index 943f8157..98586dda 100644 --- a/test/settings/RealTimeUpdatesSettings.test.tsx +++ b/test/settings/RealTimeUpdatesSettings.test.tsx @@ -1,10 +1,10 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { +import { RealTimeUpdatesSettings } from '../../src/settings/RealTimeUpdatesSettings'; +import type { RealTimeUpdatesSettings as RealTimeUpdatesSettingsOptions, Settings, } from '../../src/settings/reducers/settings'; -import { RealTimeUpdatesSettings } from '../../src/settings/RealTimeUpdatesSettings'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/settings/Settings.test.tsx b/test/settings/Settings.test.tsx index 593dd943..bef4d26b 100644 --- a/test/settings/Settings.test.tsx +++ b/test/settings/Settings.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react'; -import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; +import { Router } from 'react-router-dom'; import { Settings as createSettings } from '../../src/settings/Settings'; describe('', () => { diff --git a/test/settings/ShortUrlCreationSettings.test.tsx b/test/settings/ShortUrlCreationSettings.test.tsx index 57ea949a..220ff554 100644 --- a/test/settings/ShortUrlCreationSettings.test.tsx +++ b/test/settings/ShortUrlCreationSettings.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { ShortUrlCreationSettings as ShortUrlsSettings, Settings } from '../../src/settings/reducers/settings'; +import type { Settings, ShortUrlCreationSettings as ShortUrlsSettings } from '../../src/settings/reducers/settings'; import { ShortUrlCreationSettings } from '../../src/settings/ShortUrlCreationSettings'; import { renderWithEvents } from '../__helpers__/setUpTest'; diff --git a/test/settings/ShortUrlsListSettings.test.tsx b/test/settings/ShortUrlsListSettings.test.tsx index 53350a0e..c0cd1a4b 100644 --- a/test/settings/ShortUrlsListSettings.test.tsx +++ b/test/settings/ShortUrlsListSettings.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { Settings, ShortUrlsListSettings as ShortUrlsSettings } from '../../src/settings/reducers/settings'; +import type { Settings, ShortUrlsListSettings as ShortUrlsSettings } from '../../src/settings/reducers/settings'; import { ShortUrlsListSettings } from '../../src/settings/ShortUrlsListSettings'; -import { ShortUrlsOrder } from '../../src/short-urls/data'; +import type { ShortUrlsOrder } from '../../src/short-urls/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/settings/TagsSettings.test.tsx b/test/settings/TagsSettings.test.tsx index d1b56f05..050e4b1c 100644 --- a/test/settings/TagsSettings.test.tsx +++ b/test/settings/TagsSettings.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { Settings, TagsSettings as TagsSettingsOptions } from '../../src/settings/reducers/settings'; +import type { Settings, TagsSettings as TagsSettingsOptions } from '../../src/settings/reducers/settings'; import { TagsSettings } from '../../src/settings/TagsSettings'; -import { TagsOrder } from '../../src/tags/data/TagsListChildrenProps'; +import type { TagsOrder } from '../../src/tags/data/TagsListChildrenProps'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/settings/UserInterfaceSettings.test.tsx b/test/settings/UserInterfaceSettings.test.tsx index 12270b37..0ca68e86 100644 --- a/test/settings/UserInterfaceSettings.test.tsx +++ b/test/settings/UserInterfaceSettings.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { Settings, UiSettings } from '../../src/settings/reducers/settings'; +import type { Settings, UiSettings } from '../../src/settings/reducers/settings'; import { UserInterfaceSettings } from '../../src/settings/UserInterfaceSettings'; -import { Theme } from '../../src/utils/theme'; +import type { Theme } from '../../src/utils/theme'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/settings/VisitsSettings.test.tsx b/test/settings/VisitsSettings.test.tsx index 051bdcf4..3326b75e 100644 --- a/test/settings/VisitsSettings.test.tsx +++ b/test/settings/VisitsSettings.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { Settings } from '../../src/settings/reducers/settings'; +import type { Settings } from '../../src/settings/reducers/settings'; import { VisitsSettings } from '../../src/settings/VisitsSettings'; import { renderWithEvents } from '../__helpers__/setUpTest'; diff --git a/test/settings/helpers/index.test.ts b/test/settings/helpers/index.test.ts index 0808ad35..6b7c188f 100644 --- a/test/settings/helpers/index.test.ts +++ b/test/settings/helpers/index.test.ts @@ -1,6 +1,6 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkState } from '../../../src/container/types'; import { migrateDeprecatedSettings } from '../../../src/settings/helpers'; -import { ShlinkState } from '../../../src/container/types'; describe('settings-helpers', () => { describe('migrateDeprecatedSettings', () => { diff --git a/test/settings/reducers/settings.test.ts b/test/settings/reducers/settings.test.ts index 50d31ac1..6199b7ce 100644 --- a/test/settings/reducers/settings.test.ts +++ b/test/settings/reducers/settings.test.ts @@ -1,13 +1,13 @@ import { DEFAULT_SHORT_URLS_ORDERING, - settingsReducer, - toggleRealTimeUpdates, setRealTimeUpdatesInterval, setShortUrlCreationSettings, + setShortUrlsListSettings, + setTagsSettings, + settingsReducer, setUiSettings, setVisitsSettings, - setTagsSettings, - setShortUrlsListSettings, + toggleRealTimeUpdates, } from '../../../src/settings/reducers/settings'; describe('settingsReducer', () => { diff --git a/test/short-urls/CreateShortUrl.test.tsx b/test/short-urls/CreateShortUrl.test.tsx index 2e53e8dc..68a3dbbc 100644 --- a/test/short-urls/CreateShortUrl.test.tsx +++ b/test/short-urls/CreateShortUrl.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { Settings } from '../../src/settings/reducers/settings'; import { CreateShortUrl as createShortUrlsCreator } from '../../src/short-urls/CreateShortUrl'; -import { ShortUrlCreation } from '../../src/short-urls/reducers/shortUrlCreation'; -import { Settings } from '../../src/settings/reducers/settings'; +import type { ShortUrlCreation } from '../../src/short-urls/reducers/shortUrlCreation'; describe('', () => { const ShortUrlForm = () => ShortUrlForm; diff --git a/test/short-urls/EditShortUrl.test.tsx b/test/short-urls/EditShortUrl.test.tsx index 8af59969..77767c47 100644 --- a/test/short-urls/EditShortUrl.test.tsx +++ b/test/short-urls/EditShortUrl.test.tsx @@ -1,11 +1,11 @@ import { render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import { Mock } from 'ts-mockery'; +import type { Settings } from '../../src/settings/reducers/settings'; +import type { ShortUrl } from '../../src/short-urls/data'; import { EditShortUrl as createEditShortUrl } from '../../src/short-urls/EditShortUrl'; -import { Settings } from '../../src/settings/reducers/settings'; -import { ShortUrlDetail } from '../../src/short-urls/reducers/shortUrlDetail'; -import { ShortUrlEdition } from '../../src/short-urls/reducers/shortUrlEdition'; -import { ShortUrl } from '../../src/short-urls/data'; +import type { ShortUrlDetail } from '../../src/short-urls/reducers/shortUrlDetail'; +import type { ShortUrlEdition } from '../../src/short-urls/reducers/shortUrlEdition'; describe('', () => { const shortUrlCreation = { validateUrls: true }; diff --git a/test/short-urls/Paginator.test.tsx b/test/short-urls/Paginator.test.tsx index a40a62d8..36f215f8 100644 --- a/test/short-urls/Paginator.test.tsx +++ b/test/short-urls/Paginator.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ShlinkPaginator } from '../../src/api/types'; import { Paginator } from '../../src/short-urls/Paginator'; -import { ShlinkPaginator } from '../../src/api/types'; import { ELLIPSIS } from '../../src/utils/helpers/pagination'; describe('', () => { diff --git a/test/short-urls/ShortUrlForm.test.tsx b/test/short-urls/ShortUrlForm.test.tsx index 2709a7f8..03be97e2 100644 --- a/test/short-urls/ShortUrlForm.test.tsx +++ b/test/short-urls/ShortUrlForm.test.tsx @@ -1,11 +1,12 @@ import { screen } from '@testing-library/react'; -import { UserEvent } from '@testing-library/user-event/setup/setup'; +import type { UserEvent } from '@testing-library/user-event/setup/setup'; import { formatISO } from 'date-fns'; import { Mock } from 'ts-mockery'; -import { ShortUrlForm as createShortUrlForm, Mode } from '../../src/short-urls/ShortUrlForm'; -import { ReachableServer, SelectedServer } from '../../src/servers/data'; +import type { ReachableServer, SelectedServer } from '../../src/servers/data'; +import type { Mode } from '../../src/short-urls/ShortUrlForm'; +import { ShortUrlForm as createShortUrlForm } from '../../src/short-urls/ShortUrlForm'; import { parseDate } from '../../src/utils/helpers/date'; -import { OptionalString } from '../../src/utils/utils'; +import type { OptionalString } from '../../src/utils/utils'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/ShortUrlsFilteringBar.test.tsx b/test/short-urls/ShortUrlsFilteringBar.test.tsx index 5c89c865..3c89587f 100644 --- a/test/short-urls/ShortUrlsFilteringBar.test.tsx +++ b/test/short-urls/ShortUrlsFilteringBar.test.tsx @@ -1,12 +1,12 @@ import { screen, waitFor } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { endOfDay, formatISO, startOfDay } from 'date-fns'; import { MemoryRouter, useLocation, useNavigate } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ReachableServer, SelectedServer } from '../../src/servers/data'; +import type { Settings } from '../../src/settings/reducers/settings'; import { ShortUrlsFilteringBar as filteringBarCreator } from '../../src/short-urls/ShortUrlsFilteringBar'; -import { ReachableServer, SelectedServer } from '../../src/servers/data'; -import { Settings } from '../../src/settings/reducers/settings'; -import { DateRange } from '../../src/utils/helpers/dateIntervals'; import { formatDate } from '../../src/utils/helpers/date'; +import type { DateRange } from '../../src/utils/helpers/dateIntervals'; import { renderWithEvents } from '../__helpers__/setUpTest'; jest.mock('react-router-dom', () => ({ diff --git a/test/short-urls/ShortUrlsList.test.tsx b/test/short-urls/ShortUrlsList.test.tsx index 12a81188..38ddef0e 100644 --- a/test/short-urls/ShortUrlsList.test.tsx +++ b/test/short-urls/ShortUrlsList.test.tsx @@ -1,15 +1,15 @@ import { screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter, useNavigate } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub'; +import type { ReachableServer } from '../../src/servers/data'; +import type { Settings } from '../../src/settings/reducers/settings'; +import type { ShortUrl, ShortUrlsOrder } from '../../src/short-urls/data'; +import type { ShortUrlsList as ShortUrlsListModel } from '../../src/short-urls/reducers/shortUrlsList'; import { ShortUrlsList as createShortUrlsList } from '../../src/short-urls/ShortUrlsList'; -import { ShortUrl, ShortUrlsOrder } from '../../src/short-urls/data'; -import { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub'; -import { ShortUrlsList as ShortUrlsListModel } from '../../src/short-urls/reducers/shortUrlsList'; -import { ReachableServer } from '../../src/servers/data'; -import { Settings } from '../../src/settings/reducers/settings'; -import { ShortUrlsTableType } from '../../src/short-urls/ShortUrlsTable'; +import type { ShortUrlsTableType } from '../../src/short-urls/ShortUrlsTable'; +import type { SemVer } from '../../src/utils/helpers/version'; import { renderWithEvents } from '../__helpers__/setUpTest'; -import { SemVer } from '../../src/utils/helpers/version'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/test/short-urls/ShortUrlsTable.test.tsx b/test/short-urls/ShortUrlsTable.test.tsx index c3fded0a..e083d71a 100644 --- a/test/short-urls/ShortUrlsTable.test.tsx +++ b/test/short-urls/ShortUrlsTable.test.tsx @@ -1,9 +1,10 @@ import { fireEvent, screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { ReachableServer, SelectedServer } from '../../src/servers/data'; +import type { ShortUrlsOrderableFields } from '../../src/short-urls/data'; +import { SHORT_URLS_ORDERABLE_FIELDS } from '../../src/short-urls/data'; +import type { ShortUrlsList } from '../../src/short-urls/reducers/shortUrlsList'; import { ShortUrlsTable as shortUrlsTableCreator } from '../../src/short-urls/ShortUrlsTable'; -import { ShortUrlsList } from '../../src/short-urls/reducers/shortUrlsList'; -import { ReachableServer, SelectedServer } from '../../src/servers/data'; -import { ShortUrlsOrderableFields, SHORT_URLS_ORDERABLE_FIELDS } from '../../src/short-urls/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/CreateShortUrlResult.test.tsx b/test/short-urls/helpers/CreateShortUrlResult.test.tsx index 404ab833..0c07b109 100644 --- a/test/short-urls/helpers/CreateShortUrlResult.test.tsx +++ b/test/short-urls/helpers/CreateShortUrlResult.test.tsx @@ -1,10 +1,10 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { TimeoutToggle } from '../../../src/utils/helpers/hooks'; +import type { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation'; +import type { TimeoutToggle } from '../../../src/utils/helpers/hooks'; import { renderWithEvents } from '../../__helpers__/setUpTest'; -import { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation'; describe('', () => { const copyToClipboard = jest.fn(); diff --git a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx b/test/short-urls/helpers/DeleteShortUrlModal.test.tsx index a71cd977..fbff806c 100644 --- a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx +++ b/test/short-urls/helpers/DeleteShortUrlModal.test.tsx @@ -1,10 +1,11 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { InvalidShortUrlDeletion, ProblemDetailsError } from '../../../src/api/types/errors'; +import { ErrorTypeV2, ErrorTypeV3 } from '../../../src/api/types/errors'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { DeleteShortUrlModal } from '../../../src/short-urls/helpers/DeleteShortUrlModal'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { ShortUrlDeletion } from '../../../src/short-urls/reducers/shortUrlDeletion'; +import type { ShortUrlDeletion } from '../../../src/short-urls/reducers/shortUrlDeletion'; import { renderWithEvents } from '../../__helpers__/setUpTest'; -import { ErrorTypeV2, ErrorTypeV3, InvalidShortUrlDeletion, ProblemDetailsError } from '../../../src/api/types/errors'; import { TestModalWrapper } from '../../__helpers__/TestModalWrapper'; describe('', () => { diff --git a/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx b/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx index e2af62af..6f335c62 100644 --- a/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx +++ b/test/short-urls/helpers/ExportShortUrlsBtn.test.tsx @@ -1,9 +1,9 @@ -import { Mock } from 'ts-mockery'; import { screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; -import { ReportExporter } from '../../../src/common/services/ReportExporter'; +import { Mock } from 'ts-mockery'; +import type { ReportExporter } from '../../../src/common/services/ReportExporter'; +import type { NotFoundServer, ReachableServer, SelectedServer } from '../../../src/servers/data'; import { ExportShortUrlsBtn as createExportShortUrlsBtn } from '../../../src/short-urls/helpers/ExportShortUrlsBtn'; -import { NotFoundServer, ReachableServer, SelectedServer } from '../../../src/servers/data'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/QrCodeModal.test.tsx b/test/short-urls/helpers/QrCodeModal.test.tsx index 12bcad54..9dc25726 100644 --- a/test/short-urls/helpers/QrCodeModal.test.tsx +++ b/test/short-urls/helpers/QrCodeModal.test.tsx @@ -1,10 +1,10 @@ import { fireEvent, screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { ImageDownloader } from '../../../src/common/services/ImageDownloader'; +import type { ReachableServer } from '../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { QrCodeModal as createQrCodeModal } from '../../../src/short-urls/helpers/QrCodeModal'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { ReachableServer } from '../../../src/servers/data'; -import { SemVer } from '../../../src/utils/helpers/version'; -import { ImageDownloader } from '../../../src/common/services/ImageDownloader'; +import type { SemVer } from '../../../src/utils/helpers/version'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/ShortUrlDetailLink.test.tsx b/test/short-urls/helpers/ShortUrlDetailLink.test.tsx index 3c38216e..04187148 100644 --- a/test/short-urls/helpers/ShortUrlDetailLink.test.tsx +++ b/test/short-urls/helpers/ShortUrlDetailLink.test.tsx @@ -1,9 +1,10 @@ import { render, screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; -import { ShortUrlDetailLink, LinkSuffix } from '../../../src/short-urls/helpers/ShortUrlDetailLink'; -import { NotFoundServer, ReachableServer } from '../../../src/servers/data'; -import { ShortUrl } from '../../../src/short-urls/data'; +import { Mock } from 'ts-mockery'; +import type { NotFoundServer, ReachableServer } from '../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import type { LinkSuffix } from '../../../src/short-urls/helpers/ShortUrlDetailLink'; +import { ShortUrlDetailLink } from '../../../src/short-urls/helpers/ShortUrlDetailLink'; describe('', () => { it.each([ diff --git a/test/short-urls/helpers/ShortUrlStatus.test.tsx b/test/short-urls/helpers/ShortUrlStatus.test.tsx index 8c689086..4f373503 100644 --- a/test/short-urls/helpers/ShortUrlStatus.test.tsx +++ b/test/short-urls/helpers/ShortUrlStatus.test.tsx @@ -1,8 +1,8 @@ -import userEvent from '@testing-library/user-event'; import { render, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import { Mock } from 'ts-mockery'; +import type { ShortUrl, ShortUrlMeta, ShortUrlVisitsSummary } from '../../../src/short-urls/data'; import { ShortUrlStatus } from '../../../src/short-urls/helpers/ShortUrlStatus'; -import { ShortUrl, ShortUrlMeta, ShortUrlVisitsSummary } from '../../../src/short-urls/data'; describe('', () => { const setUp = (shortUrl: ShortUrl) => ({ diff --git a/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx b/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx index 2bf13db7..8fa8141c 100644 --- a/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx +++ b/test/short-urls/helpers/ShortUrlVisitsCount.test.tsx @@ -1,8 +1,8 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { Mock } from 'ts-mockery'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { ShortUrlVisitsCount } from '../../../src/short-urls/helpers/ShortUrlVisitsCount'; -import { ShortUrl } from '../../../src/short-urls/data'; describe('', () => { const setUp = (visitsCount: number, shortUrl: ShortUrl) => ({ diff --git a/test/short-urls/helpers/ShortUrlsRow.test.tsx b/test/short-urls/helpers/ShortUrlsRow.test.tsx index e81ce8e6..f4482422 100644 --- a/test/short-urls/helpers/ShortUrlsRow.test.tsx +++ b/test/short-urls/helpers/ShortUrlsRow.test.tsx @@ -1,16 +1,16 @@ import { screen } from '@testing-library/react'; -import { last } from 'ramda'; -import { Mock } from 'ts-mockery'; import { addDays, formatISO, subDays } from 'date-fns'; +import { last } from 'ramda'; import { MemoryRouter, useLocation } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ReachableServer } from '../../../src/servers/data'; +import type { Settings } from '../../../src/settings/reducers/settings'; +import type { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data'; import { ShortUrlsRow as createShortUrlsRow } from '../../../src/short-urls/helpers/ShortUrlsRow'; -import { TimeoutToggle } from '../../../src/utils/helpers/hooks'; -import { ShortUrl, ShortUrlMeta } from '../../../src/short-urls/data'; -import { Settings } from '../../../src/settings/reducers/settings'; -import { ReachableServer } from '../../../src/servers/data'; -import { parseDate, now } from '../../../src/utils/helpers/date'; +import { now, parseDate } from '../../../src/utils/helpers/date'; +import type { TimeoutToggle } from '../../../src/utils/helpers/hooks'; +import type { OptionalString } from '../../../src/utils/utils'; import { renderWithEvents } from '../../__helpers__/setUpTest'; -import { OptionalString } from '../../../src/utils/utils'; import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock'; interface SetUpOptions { diff --git a/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx b/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx index c0324e50..ba64ff51 100644 --- a/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx +++ b/test/short-urls/helpers/ShortUrlsRowMenu.test.tsx @@ -1,9 +1,9 @@ import { screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ReachableServer } from '../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { ShortUrlsRowMenu as createShortUrlsRowMenu } from '../../../src/short-urls/helpers/ShortUrlsRowMenu'; -import { ReachableServer } from '../../../src/servers/data'; -import { ShortUrl } from '../../../src/short-urls/data'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/index.test.ts b/test/short-urls/helpers/index.test.ts index 06415123..bc33c1d5 100644 --- a/test/short-urls/helpers/index.test.ts +++ b/test/short-urls/helpers/index.test.ts @@ -1,5 +1,5 @@ import { Mock } from 'ts-mockery'; -import { ShortUrl } from '../../../src/short-urls/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; import { shortUrlDataFromShortUrl, urlDecodeShortCode, urlEncodeShortCode } from '../../../src/short-urls/helpers'; describe('helpers', () => { diff --git a/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx b/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx index ae20d61f..a5a1d06d 100644 --- a/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx +++ b/test/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; -import { QrErrorCorrection } from '../../../../src/utils/helpers/qrCodes'; import { QrErrorCorrectionDropdown } from '../../../../src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown'; +import type { QrErrorCorrection } from '../../../../src/utils/helpers/qrCodes'; import { renderWithEvents } from '../../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx b/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx index 499a5e89..41cb3975 100644 --- a/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx +++ b/test/short-urls/helpers/qr-codes/QrFormatDropdown.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; -import { QrCodeFormat } from '../../../../src/utils/helpers/qrCodes'; import { QrFormatDropdown } from '../../../../src/short-urls/helpers/qr-codes/QrFormatDropdown'; +import type { QrCodeFormat } from '../../../../src/utils/helpers/qrCodes'; import { renderWithEvents } from '../../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/short-urls/reducers/shortUrlCreation.test.ts b/test/short-urls/reducers/shortUrlCreation.test.ts index f7815b4a..1f8cf99b 100644 --- a/test/short-urls/reducers/shortUrlCreation.test.ts +++ b/test/short-urls/reducers/shortUrlCreation.test.ts @@ -1,12 +1,13 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../src/container/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import type { + CreateShortUrlAction } from '../../../src/short-urls/reducers/shortUrlCreation'; import { - CreateShortUrlAction, - shortUrlCreationReducerCreator, createShortUrl as createShortUrlCreator, + shortUrlCreationReducerCreator, } from '../../../src/short-urls/reducers/shortUrlCreation'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { ShlinkState } from '../../../src/container/types'; describe('shortUrlCreationReducer', () => { const shortUrl = Mock.of(); diff --git a/test/short-urls/reducers/shortUrlDeletion.test.ts b/test/short-urls/reducers/shortUrlDeletion.test.ts index e6bd8162..d91476f3 100644 --- a/test/short-urls/reducers/shortUrlDeletion.test.ts +++ b/test/short-urls/reducers/shortUrlDeletion.test.ts @@ -1,10 +1,10 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ProblemDetailsError } from '../../../src/api/types/errors'; import { - shortUrlDeletionReducerCreator, deleteShortUrl as deleteShortUrlCretor, + shortUrlDeletionReducerCreator, } from '../../../src/short-urls/reducers/shortUrlDeletion'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { ProblemDetailsError } from '../../../src/api/types/errors'; describe('shortUrlDeletionReducer', () => { const deleteShortUrlCall = jest.fn(); diff --git a/test/short-urls/reducers/shortUrlDetail.test.ts b/test/short-urls/reducers/shortUrlDetail.test.ts index cb745724..2080c437 100644 --- a/test/short-urls/reducers/shortUrlDetail.test.ts +++ b/test/short-urls/reducers/shortUrlDetail.test.ts @@ -1,9 +1,10 @@ import { Mock } from 'ts-mockery'; -import { ShortUrlDetailAction, shortUrlDetailReducerCreator } from '../../../src/short-urls/reducers/shortUrlDetail'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { ShlinkState } from '../../../src/container/types'; -import { ShortUrlsList } from '../../../src/short-urls/reducers/shortUrlsList'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../src/container/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import type { ShortUrlDetailAction } from '../../../src/short-urls/reducers/shortUrlDetail'; +import { shortUrlDetailReducerCreator } from '../../../src/short-urls/reducers/shortUrlDetail'; +import type { ShortUrlsList } from '../../../src/short-urls/reducers/shortUrlsList'; describe('shortUrlDetailReducer', () => { const getShortUrlCall = jest.fn(); diff --git a/test/short-urls/reducers/shortUrlEdition.test.ts b/test/short-urls/reducers/shortUrlEdition.test.ts index 941328c8..fad29937 100644 --- a/test/short-urls/reducers/shortUrlEdition.test.ts +++ b/test/short-urls/reducers/shortUrlEdition.test.ts @@ -1,12 +1,13 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkState } from '../../../src/container/types'; +import type { SelectedServer } from '../../../src/servers/data'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import type { + ShortUrlEditedAction } from '../../../src/short-urls/reducers/shortUrlEdition'; import { - ShortUrlEditedAction, - shortUrlEditionReducerCreator, editShortUrl as editShortUrlCreator, + shortUrlEditionReducerCreator, } from '../../../src/short-urls/reducers/shortUrlEdition'; -import { ShlinkState } from '../../../src/container/types'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { SelectedServer } from '../../../src/servers/data'; describe('shortUrlEditionReducer', () => { const longUrl = 'https://shlink.io'; diff --git a/test/short-urls/reducers/shortUrlsList.test.ts b/test/short-urls/reducers/shortUrlsList.test.ts index 8e639603..095cd137 100644 --- a/test/short-urls/reducers/shortUrlsList.test.ts +++ b/test/short-urls/reducers/shortUrlsList.test.ts @@ -1,15 +1,15 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkPaginator, ShlinkShortUrlsResponse } from '../../../src/api/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { createShortUrl as createShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlCreation'; +import { shortUrlDeleted } from '../../../src/short-urls/reducers/shortUrlDeletion'; +import { editShortUrl as editShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlEdition'; import { listShortUrls as listShortUrlsCreator, shortUrlsListReducerCreator, } from '../../../src/short-urls/reducers/shortUrlsList'; -import { shortUrlDeleted } from '../../../src/short-urls/reducers/shortUrlDeletion'; -import { ShlinkPaginator, ShlinkShortUrlsResponse } from '../../../src/api/types'; -import { createShortUrl as createShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlCreation'; -import { editShortUrl as editShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlEdition'; import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; describe('shortUrlsListReducer', () => { const shortCode = 'abc123'; diff --git a/test/tags/TagsList.test.tsx b/test/tags/TagsList.test.tsx index 9e47ffcb..b20a8115 100644 --- a/test/tags/TagsList.test.tsx +++ b/test/tags/TagsList.test.tsx @@ -1,10 +1,11 @@ import { screen, waitFor } from '@testing-library/react'; import { identity } from 'ramda'; import { Mock } from 'ts-mockery'; -import { TagsList as createTagsList, TagsListProps } from '../../src/tags/TagsList'; -import { TagsList } from '../../src/tags/reducers/tagsList'; -import { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub'; -import { Settings } from '../../src/settings/reducers/settings'; +import type { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub'; +import type { Settings } from '../../src/settings/reducers/settings'; +import type { TagsList } from '../../src/tags/reducers/tagsList'; +import type { TagsListProps } from '../../src/tags/TagsList'; +import { TagsList as createTagsList } from '../../src/tags/TagsList'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/tags/TagsTable.test.tsx b/test/tags/TagsTable.test.tsx index aae618ec..4c212cf0 100644 --- a/test/tags/TagsTable.test.tsx +++ b/test/tags/TagsTable.test.tsx @@ -1,10 +1,10 @@ import { screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { useLocation } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { SelectedServer } from '../../src/servers/data'; +import type { NormalizedTag } from '../../src/tags/data'; import { TagsTable as createTagsTable } from '../../src/tags/TagsTable'; -import { SelectedServer } from '../../src/servers/data'; import { rangeOf } from '../../src/utils/utils'; -import { NormalizedTag } from '../../src/tags/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useLocation: jest.fn() })); diff --git a/test/tags/TagsTableRow.test.tsx b/test/tags/TagsTableRow.test.tsx index 4974f621..4f3a133a 100644 --- a/test/tags/TagsTableRow.test.tsx +++ b/test/tags/TagsTableRow.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { MemoryRouter } from 'react-router-dom'; +import { Mock } from 'ts-mockery'; +import type { ReachableServer } from '../../src/servers/data'; import { TagsTableRow as createTagsTableRow } from '../../src/tags/TagsTableRow'; -import { ReachableServer } from '../../src/servers/data'; import { renderWithEvents } from '../__helpers__/setUpTest'; import { colorGeneratorMock } from '../utils/services/__mocks__/ColorGenerator.mock'; diff --git a/test/tags/helpers/DeleteTagConfirmModal.test.tsx b/test/tags/helpers/DeleteTagConfirmModal.test.tsx index 00a7cdf1..55493087 100644 --- a/test/tags/helpers/DeleteTagConfirmModal.test.tsx +++ b/test/tags/helpers/DeleteTagConfirmModal.test.tsx @@ -1,6 +1,6 @@ import { screen } from '@testing-library/react'; import { DeleteTagConfirmModal } from '../../../src/tags/helpers/DeleteTagConfirmModal'; -import { TagDeletion } from '../../../src/tags/reducers/tagDelete'; +import type { TagDeletion } from '../../../src/tags/reducers/tagDelete'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/tags/helpers/EditTagModal.test.tsx b/test/tags/helpers/EditTagModal.test.tsx index b4bc1dbf..0b6a96b7 100644 --- a/test/tags/helpers/EditTagModal.test.tsx +++ b/test/tags/helpers/EditTagModal.test.tsx @@ -1,10 +1,10 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { TagEdition } from '../../../src/tags/reducers/tagEdit'; +import type { ProblemDetailsError } from '../../../src/api/types/errors'; import { EditTagModal as createEditTagModal } from '../../../src/tags/helpers/EditTagModal'; -import { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; +import type { TagEdition } from '../../../src/tags/reducers/tagEdit'; +import type { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; import { renderWithEvents } from '../../__helpers__/setUpTest'; -import { ProblemDetailsError } from '../../../src/api/types/errors'; describe('', () => { const EditTagModal = createEditTagModal(Mock.of({ getColorForKey: jest.fn(() => 'green') })); diff --git a/test/tags/helpers/Tag.test.tsx b/test/tags/helpers/Tag.test.tsx index edd4d20c..46f224e7 100644 --- a/test/tags/helpers/Tag.test.tsx +++ b/test/tags/helpers/Tag.test.tsx @@ -1,9 +1,9 @@ import { screen } from '@testing-library/react'; +import type { ReactNode } from 'react'; import { Mock } from 'ts-mockery'; -import { ReactNode } from 'react'; -import { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; -import { MAIN_COLOR } from '../../../src/utils/theme'; import { Tag } from '../../../src/tags/helpers/Tag'; +import type { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; +import { MAIN_COLOR } from '../../../src/utils/theme'; import { renderWithEvents } from '../../__helpers__/setUpTest'; const hexToRgb = (hex: string) => { diff --git a/test/tags/helpers/TagsSelector.test.tsx b/test/tags/helpers/TagsSelector.test.tsx index e6bed7ec..398a0e93 100644 --- a/test/tags/helpers/TagsSelector.test.tsx +++ b/test/tags/helpers/TagsSelector.test.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; +import type { Settings } from '../../../src/settings/reducers/settings'; import { TagsSelector as createTagsSelector } from '../../../src/tags/helpers/TagsSelector'; -import { TagsList } from '../../../src/tags/reducers/tagsList'; -import { Settings } from '../../../src/settings/reducers/settings'; +import type { TagsList } from '../../../src/tags/reducers/tagsList'; import { renderWithEvents } from '../../__helpers__/setUpTest'; import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock'; diff --git a/test/tags/reducers/tagDelete.test.ts b/test/tags/reducers/tagDelete.test.ts index 3b4bf655..9b0b161b 100644 --- a/test/tags/reducers/tagDelete.test.ts +++ b/test/tags/reducers/tagDelete.test.ts @@ -1,7 +1,7 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../src/container/types'; import { tagDeleted, tagDeleteReducerCreator } from '../../../src/tags/reducers/tagDelete'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { ShlinkState } from '../../../src/container/types'; describe('tagDeleteReducer', () => { const deleteTagsCall = jest.fn(); diff --git a/test/tags/reducers/tagEdit.test.ts b/test/tags/reducers/tagEdit.test.ts index b421c579..deab5355 100644 --- a/test/tags/reducers/tagEdit.test.ts +++ b/test/tags/reducers/tagEdit.test.ts @@ -1,8 +1,9 @@ import { Mock } from 'ts-mockery'; -import { tagEdited, editTag as editTagCreator, EditTagAction, tagEditReducerCreator } from '../../../src/tags/reducers/tagEdit'; -import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; -import { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; -import { ShlinkState } from '../../../src/container/types'; +import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; +import type { ShlinkState } from '../../../src/container/types'; +import type { EditTagAction } from '../../../src/tags/reducers/tagEdit'; +import { editTag as editTagCreator, tagEdited, tagEditReducerCreator } from '../../../src/tags/reducers/tagEdit'; +import type { ColorGenerator } from '../../../src/utils/services/ColorGenerator'; describe('tagEditReducer', () => { const oldName = 'foo'; diff --git a/test/tags/reducers/tagsList.test.ts b/test/tags/reducers/tagsList.test.ts index 2bea89bf..d69b8645 100644 --- a/test/tags/reducers/tagsList.test.ts +++ b/test/tags/reducers/tagsList.test.ts @@ -1,15 +1,16 @@ import { Mock } from 'ts-mockery'; +import type { ShlinkState } from '../../../src/container/types'; +import type { ShortUrl } from '../../../src/short-urls/data'; +import { createShortUrl as createShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlCreation'; +import { tagDeleted } from '../../../src/tags/reducers/tagDelete'; +import { tagEdited } from '../../../src/tags/reducers/tagEdit'; +import type { + TagsList } from '../../../src/tags/reducers/tagsList'; import { - TagsList, filterTags, listTags as listTagsCreator, tagsListReducerCreator, } from '../../../src/tags/reducers/tagsList'; -import { ShlinkState } from '../../../src/container/types'; -import { ShortUrl } from '../../../src/short-urls/data'; -import { createShortUrl as createShortUrlCreator } from '../../../src/short-urls/reducers/shortUrlCreation'; -import { tagEdited } from '../../../src/tags/reducers/tagEdit'; -import { tagDeleted } from '../../../src/tags/reducers/tagDelete'; describe('tagsListReducer', () => { const state = (props: Partial) => Mock.of(props); diff --git a/test/utils/DropdownBtn.test.tsx b/test/utils/DropdownBtn.test.tsx index 36d820a8..a3c6309e 100644 --- a/test/utils/DropdownBtn.test.tsx +++ b/test/utils/DropdownBtn.test.tsx @@ -1,6 +1,7 @@ import { screen } from '@testing-library/react'; -import { PropsWithChildren } from 'react'; -import { DropdownBtn, DropdownBtnProps } from '../../src/utils/DropdownBtn'; +import type { PropsWithChildren } from 'react'; +import type { DropdownBtnProps } from '../../src/utils/DropdownBtn'; +import { DropdownBtn } from '../../src/utils/DropdownBtn'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/DropdownBtnMenu.test.tsx b/test/utils/DropdownBtnMenu.test.tsx index d7ef86b8..c38d0c7d 100644 --- a/test/utils/DropdownBtnMenu.test.tsx +++ b/test/utils/DropdownBtnMenu.test.tsx @@ -1,6 +1,7 @@ import { screen } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { DropdownBtnMenu, DropdownBtnMenuProps } from '../../src/utils/DropdownBtnMenu'; +import type { DropdownBtnMenuProps } from '../../src/utils/DropdownBtnMenu'; +import { DropdownBtnMenu } from '../../src/utils/DropdownBtnMenu'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/InfoTooltip.test.tsx b/test/utils/InfoTooltip.test.tsx index 1bda4e60..388c279c 100644 --- a/test/utils/InfoTooltip.test.tsx +++ b/test/utils/InfoTooltip.test.tsx @@ -1,6 +1,7 @@ +import type { Placement } from '@popperjs/core'; import { screen, waitFor } from '@testing-library/react'; -import { Placement } from '@popperjs/core'; -import { InfoTooltip, InfoTooltipProps } from '../../src/utils/InfoTooltip'; +import type { InfoTooltipProps } from '../../src/utils/InfoTooltip'; +import { InfoTooltip } from '../../src/utils/InfoTooltip'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/Message.test.tsx b/test/utils/Message.test.tsx index d800a66d..7adbe691 100644 --- a/test/utils/Message.test.tsx +++ b/test/utils/Message.test.tsx @@ -1,6 +1,7 @@ import { render, screen } from '@testing-library/react'; -import { PropsWithChildren } from 'react'; -import { Message, MessageProps } from '../../src/utils/Message'; +import type { PropsWithChildren } from 'react'; +import type { MessageProps } from '../../src/utils/Message'; +import { Message } from '../../src/utils/Message'; describe('', () => { const setUp = (props: PropsWithChildren = {}) => render(); diff --git a/test/utils/OrderingDropdown.test.tsx b/test/utils/OrderingDropdown.test.tsx index f8e78944..71660353 100644 --- a/test/utils/OrderingDropdown.test.tsx +++ b/test/utils/OrderingDropdown.test.tsx @@ -1,7 +1,8 @@ import { screen } from '@testing-library/react'; import { values } from 'ramda'; -import { OrderingDropdown, OrderingDropdownProps } from '../../src/utils/OrderingDropdown'; -import { OrderDir } from '../../src/utils/helpers/ordering'; +import type { OrderDir } from '../../src/utils/helpers/ordering'; +import type { OrderingDropdownProps } from '../../src/utils/OrderingDropdown'; +import { OrderingDropdown } from '../../src/utils/OrderingDropdown'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/Result.test.tsx b/test/utils/Result.test.tsx index 0ba9b3f3..92a342a6 100644 --- a/test/utils/Result.test.tsx +++ b/test/utils/Result.test.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react'; -import { Result, ResultProps, ResultType } from '../../src/utils/Result'; +import type { ResultProps, ResultType } from '../../src/utils/Result'; +import { Result } from '../../src/utils/Result'; describe('', () => { const setUp = (props: ResultProps) => render(); diff --git a/test/utils/dates/DateInput.test.tsx b/test/utils/dates/DateInput.test.tsx index 525b0652..1e648089 100644 --- a/test/utils/dates/DateInput.test.tsx +++ b/test/utils/dates/DateInput.test.tsx @@ -1,7 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; -import { Mock } from 'ts-mockery'; import { parseISO } from 'date-fns'; -import { DateInput, DateInputProps } from '../../../src/utils/dates/DateInput'; +import { Mock } from 'ts-mockery'; +import type { DateInputProps } from '../../../src/utils/dates/DateInput'; +import { DateInput } from '../../../src/utils/dates/DateInput'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/DateIntervalDropdownItems.test.tsx b/test/utils/dates/DateIntervalDropdownItems.test.tsx index 66a909aa..7b56930d 100644 --- a/test/utils/dates/DateIntervalDropdownItems.test.tsx +++ b/test/utils/dates/DateIntervalDropdownItems.test.tsx @@ -1,7 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { DateIntervalDropdownItems } from '../../../src/utils/dates/DateIntervalDropdownItems'; -import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals'; import { DropdownBtn } from '../../../src/utils/DropdownBtn'; +import type { DateInterval } from '../../../src/utils/helpers/dateIntervals'; +import { DATE_INTERVALS, rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/DateIntervalSelector.test.tsx b/test/utils/dates/DateIntervalSelector.test.tsx index 975159c7..75b995bb 100644 --- a/test/utils/dates/DateIntervalSelector.test.tsx +++ b/test/utils/dates/DateIntervalSelector.test.tsx @@ -1,6 +1,7 @@ import { screen, waitFor } from '@testing-library/react'; -import { DateInterval, rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals'; import { DateIntervalSelector } from '../../../src/utils/dates/DateIntervalSelector'; +import type { DateInterval } from '../../../src/utils/helpers/dateIntervals'; +import { rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/DateRangeSelector.test.tsx b/test/utils/dates/DateRangeSelector.test.tsx index 858d06c0..ed4429fa 100644 --- a/test/utils/dates/DateRangeSelector.test.tsx +++ b/test/utils/dates/DateRangeSelector.test.tsx @@ -1,7 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; -import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector'; -import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; +import type { DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector'; +import { DateRangeSelector } from '../../../src/utils/dates/DateRangeSelector'; +import type { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/Time.test.tsx b/test/utils/dates/Time.test.tsx index 38b38a47..aa57cdd8 100644 --- a/test/utils/dates/Time.test.tsx +++ b/test/utils/dates/Time.test.tsx @@ -1,5 +1,6 @@ import { render } from '@testing-library/react'; -import { TimeProps, Time } from '../../../src/utils/dates/Time'; +import type { TimeProps } from '../../../src/utils/dates/Time'; +import { Time } from '../../../src/utils/dates/Time'; import { parseDate } from '../../../src/utils/helpers/date'; describe('