From 13310814da60e7f9113347f1ab5529dcc10fd80d Mon Sep 17 00:00:00 2001 From: Behrang Yarahmadi Date: Fri, 29 Oct 2021 17:33:05 +0200 Subject: [PATCH] #2606 add prettier plugin sort imports (#2607) * #2606 add prettier plugin sort imprts * #2606 update pnpm-lock.yaml * #2606 update eslint rules * #2606 fixes website directory formatting Co-authored-by: Ayush Sharma --- .prettierrc | 11 -- package.json | 1 + packages/api/src/dist-tags.ts | 13 ++- packages/api/src/index.ts | 21 ++-- packages/api/src/package.ts | 15 +-- packages/api/src/ping.ts | 3 +- packages/api/src/publish.ts | 22 ++-- packages/api/src/star.ts | 7 +- packages/api/src/stars.ts | 8 +- packages/api/src/user.ts | 16 +-- packages/api/src/utils.ts | 3 +- packages/api/src/v1/profile.ts | 7 +- packages/api/src/v1/search.ts | 5 +- packages/api/src/v1/token.ts | 15 +-- packages/api/src/whoami.ts | 5 +- packages/api/test/integration/_helper.ts | 15 +-- packages/api/test/integration/package.spec.ts | 5 +- packages/api/test/integration/ping.spec.ts | 3 +- packages/api/test/integration/publish.spec.ts | 8 +- packages/api/test/integration/user.spec.ts | 8 +- packages/api/test/unit/publish.spec.ts | 7 +- .../validate.api.params.middleware.spec.ts | 2 +- packages/api/types/custom.d.ts | 3 +- packages/auth/src/auth.ts | 47 ++++---- packages/auth/src/jwt-token.ts | 2 +- packages/auth/src/legacy-token.ts | 7 +- packages/auth/src/utils.ts | 27 ++--- packages/auth/test/auth-utils.spec.ts | 41 ++++--- packages/auth/test/auth.spec.ts | 10 +- packages/auth/test/helper/plugin.ts | 1 + packages/cli/src/cli.ts | 5 +- packages/cli/src/commands/FastifyServer.ts | 3 +- packages/cli/src/commands/info.ts | 2 +- packages/cli/src/commands/init.ts | 5 +- packages/config/src/config-path.ts | 9 +- packages/config/src/config.ts | 22 ++-- packages/config/src/package-access.ts | 4 +- packages/config/src/parse.ts | 1 + packages/config/src/uplinks.ts | 5 +- packages/config/test/config.path.spec.ts | 1 + packages/config/test/config.spec.ts | 6 +- packages/config/test/package-access.spec.ts | 2 +- packages/config/test/token.spec.ts | 2 +- packages/config/test/uplinks.spec.ts | 2 +- packages/config/test/utils.spec.ts | 2 +- packages/core/core/src/error-utils.ts | 1 + packages/core/core/src/index.ts | 10 +- packages/core/core/src/pkg-utils.ts | 4 +- packages/core/core/src/plugin-utils.ts | 1 + packages/core/core/src/stream-utils.ts | 2 +- packages/core/core/src/validation-utils.ts | 2 + packages/core/core/test/errors.spec.ts | 18 +-- .../core/core/test/merge.dist.tags.spec.ts | 2 +- packages/core/core/test/mystreams.spec.ts | 3 +- .../core/core/test/validation-utilts.spec.ts | 2 +- packages/core/file-locking/src/unclock.ts | 1 + packages/core/file-locking/src/utils.ts | 3 +- packages/core/file-locking/tests/lock.spec.ts | 4 +- packages/core/readme/src/index.ts | 2 +- packages/core/server/debug/index.ts | 6 +- packages/core/server/src/endpoints/ping.ts | 4 +- packages/core/server/src/endpoints/search.ts | 4 +- packages/core/server/src/endpoints/tarball.ts | 2 +- packages/core/server/src/endpoints/user.ts | 14 ++- packages/core/server/src/endpoints/whoami.ts | 2 +- packages/core/server/src/plugins/auth.ts | 7 +- packages/core/server/src/plugins/config.ts | 4 +- packages/core/server/src/plugins/coreUtils.ts | 2 +- packages/core/server/src/plugins/storage.ts | 7 +- packages/core/server/src/server.ts | 20 ++-- .../convertDistRemoteToLocalTarballUrls.ts | 3 +- .../tarball/src/getLocalRegistryTarballUri.ts | 4 +- ...onvertDistRemoteToLocalTarballUrls.spec.ts | 2 + packages/core/types/index.d.ts | 2 +- packages/core/url/src/index.ts | 3 +- packages/core/url/tests/getPublicUrl.spec.ts | 1 + packages/hooks/src/notify-request.ts | 2 +- packages/hooks/src/notify.ts | 8 +- packages/hooks/test/notify-request.spec.ts | 3 +- packages/loaders/src/plugin-loader.ts | 4 +- packages/loaders/test/plugin_loader.spec.ts | 1 + packages/logger-prettify/src/formatter.ts | 6 +- packages/logger-prettify/src/levels.ts | 2 +- packages/logger-prettify/src/utils.ts | 2 +- packages/logger/src/logger.ts | 5 +- packages/logger/test/logger.spec.ts | 1 + packages/middleware/src/middleware.ts | 27 +++-- packages/middleware/types/custom.d.ts | 2 +- packages/node-api/src/server.ts | 11 +- packages/node-api/test/node-api.utils.spec.ts | 1 + packages/node-api/test/parseAddress.spec.ts | 1 + packages/node-api/test/run-server.spec.ts | 2 + .../active-directory/src/active-directory.ts | 3 +- .../tests/active-directory.test.ts | 2 +- packages/plugins/audit/src/audit.ts | 14 +-- packages/plugins/auth-memory/src/Memory.ts | 21 ++-- .../plugins/auth-memory/test/index.spec.ts | 2 +- packages/plugins/aws-storage/src/index.ts | 15 +-- packages/plugins/aws-storage/src/s3Errors.ts | 3 +- .../aws-storage/src/s3PackageManager.ts | 15 +-- .../plugins/aws-storage/tests/index.test.ts | 10 +- .../tests/s3PackageManager.test.ts | 13 +-- .../tests/s3PackageManagerMockedS3.test.ts | 5 +- .../google-cloud-storage/src/data-storage.ts | 20 ++-- .../src/storage-helper.ts | 2 +- .../google-cloud-storage/src/storage.ts | 18 +-- .../google-cloud-storage/src/types/index.ts | 1 + .../tests/datastore.spec.ts | 6 +- .../tests/storage.spec.ts | 7 +- packages/plugins/htpasswd/src/crypt3.ts | 2 - packages/plugins/htpasswd/src/htpasswd.ts | 14 +-- packages/plugins/htpasswd/src/utils.ts | 6 +- .../plugins/htpasswd/tests/crypt3.test.ts | 2 +- .../plugins/htpasswd/tests/htpasswd.test.ts | 4 +- packages/plugins/htpasswd/tests/utils.test.ts | 11 +- .../plugins/local-storage/src/dir-utils.ts | 5 +- packages/plugins/local-storage/src/fs.ts | 2 +- .../local-storage/src/local-database.ts | 9 +- .../plugins/local-storage/src/local-fs.ts | 16 +-- .../plugins/local-storage/src/pkg-utils.ts | 4 +- packages/plugins/local-storage/src/token.ts | 5 +- packages/plugins/local-storage/src/utils.ts | 3 +- .../local-storage/tests/dir-utils.test.ts | 1 + .../local-storage/tests/local-fs.test.ts | 5 +- .../plugins/local-storage/tests/token.test.ts | 1 + .../plugins/local-storage/tests/utils.test.ts | 9 +- packages/plugins/memory/src/local-memory.ts | 5 +- packages/plugins/memory/src/memory-handler.ts | 19 ++-- .../plugins/memory/test/local-memory.spec.ts | 5 +- packages/plugins/memory/test/memory.spec.ts | 5 +- packages/plugins/ui-theme/.eslintrc | 15 --- packages/plugins/ui-theme/jest/setup-env.ts | 2 +- .../jest/unit/components/__mocks__/token.ts | 1 - .../jest/unit/components/store/login.ts | 1 + .../plugins/ui-theme/src/App/App.test.tsx | 6 +- packages/plugins/ui-theme/src/App/App.tsx | 8 +- .../plugins/ui-theme/src/App/AppRoute.tsx | 2 +- .../ui-theme/src/App/Footer/Footer.test.tsx | 1 - .../ui-theme/src/App/Footer/Footer.tsx | 6 +- .../plugins/ui-theme/src/App/Footer/styles.ts | 1 - .../ui-theme/src/App/Header/Header.test.tsx | 8 +- .../ui-theme/src/App/Header/Header.tsx | 4 +- .../src/App/Header/HeaderGreetings.tsx | 1 - .../ui-theme/src/App/Header/HeaderLeft.tsx | 1 - .../ui-theme/src/App/Header/HeaderMenu.tsx | 1 - .../ui-theme/src/App/Header/HeaderRight.tsx | 3 +- .../ui-theme/src/App/Header/HeaderToolTip.tsx | 1 - .../src/App/Header/HeaderToolTipIcon.tsx | 1 - .../src/App/Header/LanguageSwitch.tsx | 5 +- .../Header/LoginDialog/LoginDialog.test.tsx | 12 +- .../App/Header/LoginDialog/LoginDialog.tsx | 4 +- .../LoginDialog/LoginDialogCloseButton.tsx | 1 - .../Header/LoginDialog/LoginDialogForm.tsx | 1 - .../LoginDialog/LoginDialogFormError.tsx | 1 - .../Header/LoginDialog/LoginDialogHeader.tsx | 2 +- .../RegistryInfoContent.test.tsx | 3 +- .../RegistryInfoContent.tsx | 5 +- .../RegistryInfoDialog/RegistryInfoDialog.tsx | 3 +- .../App/Header/RegistryInfoDialog/styles.ts | 1 - .../src/App/Header/Search/Search.test.tsx | 6 +- .../ui-theme/src/App/Header/Search/Search.tsx | 4 +- .../src/App/Header/Search/SearchAdornment.tsx | 1 - .../plugins/ui-theme/src/App/Header/styles.ts | 1 - .../ui-theme/src/App/utils/loadable.tsx | 3 +- .../components/ActionBar/ActionBar.test.tsx | 4 +- .../src/components/ActionBar/ActionBar.tsx | 2 - .../components/ActionBar/ActionBarAction.tsx | 1 - .../ui-theme/src/components/AppBar.tsx | 2 +- .../src/components/Author/Author.test.tsx | 4 +- .../ui-theme/src/components/Author/Author.tsx | 4 +- .../ui-theme/src/components/Author/styles.ts | 1 - .../components/AutoComplete/AutoComplete.tsx | 12 +- .../AutoComplete/AutoCompleteV2.tsx | 8 +- .../src/components/AutoComplete/styles.tsx | 1 - .../plugins/ui-theme/src/components/Box.tsx | 2 +- .../ui-theme/src/components/Button.tsx | 2 +- .../plugins/ui-theme/src/components/Card.tsx | 2 +- .../ui-theme/src/components/CardActions.tsx | 2 +- .../ui-theme/src/components/CardContent.tsx | 2 +- .../plugins/ui-theme/src/components/Chip.tsx | 2 +- .../src/components/CircularProgress.tsx | 2 +- .../src/components/CopyToClipBoard.tsx | 1 - .../ui-theme/src/components/Dialog.tsx | 2 +- .../ui-theme/src/components/DialogActions.tsx | 2 +- .../ui-theme/src/components/DialogContent.tsx | 2 +- .../ui-theme/src/components/DialogTitle.tsx | 2 +- .../ui-theme/src/components/Divider.tsx | 2 +- .../src/components/FloatingActionButton.tsx | 2 +- .../ui-theme/src/components/FormControl.tsx | 2 +- .../src/components/FormHelperText.tsx | 2 +- .../plugins/ui-theme/src/components/Grid.tsx | 2 +- .../ui-theme/src/components/IconButton.tsx | 2 +- .../plugins/ui-theme/src/components/Input.tsx | 2 +- .../InputAdornment/InputAdornment.tsx | 2 +- .../ui-theme/src/components/InputLabel.tsx | 2 +- .../src/components/Label/Label.test.tsx | 1 - .../ui-theme/src/components/Label/Label.tsx | 3 +- .../plugins/ui-theme/src/components/List.tsx | 2 +- .../ui-theme/src/components/ListItem.tsx | 2 +- .../ui-theme/src/components/ListItemText.tsx | 2 +- .../src/components/Loading/Loading.test.tsx | 1 - .../src/components/Loading/Loading.tsx | 3 +- .../Loading/Spinner/Spinner.test.tsx | 3 +- .../components/Loading/Spinner/Spinner.tsx | 1 - .../ui-theme/src/components/Loading/styles.ts | 1 - .../src/components/Logo/Logo.test.tsx | 1 - .../ui-theme/src/components/Logo/Logo.tsx | 1 - .../src/components/NotFound/NotFound.tsx | 2 - .../src/components/NotFound/Notfound.test.tsx | 3 +- .../src/components/NotFound/styles.ts | 1 - .../components/TextField/TextField.test.tsx | 1 - .../src/design-tokens/StyleBaseline.tsx | 2 +- .../src/design-tokens/ThemeProvider.tsx | 7 +- .../ui-theme/src/design-tokens/theme.ts | 1 - packages/plugins/ui-theme/src/index.tsx | 1 - .../Dependencies/Dependencies.test.tsx | 2 - .../Dependencies/Dependencies.tsx | 4 +- .../DetailContainer/Dependencies/styles.ts | 1 - .../Deprecated/Deprecated.test.tsx | 4 +- .../DetailContainer/Deprecated/Deprecated.tsx | 1 - .../DetailContainer/DetailContainer.test.tsx | 1 - .../DetailContainer/DetailContainer.tsx | 4 +- .../DetailContainerContent.tsx | 1 - .../DetailContainerContentReadme.tsx | 1 - .../DetailContainer/DetailContainerTabs.tsx | 1 - .../DetailContainer/NoItems/NoItems.tsx | 1 - .../DetailContainer/NoItems/Noitems.test.tsx | 1 - .../DetailContainer/Readme/Readme.spec.tsx | 3 +- .../Version/DetailContainer/Readme/Readme.tsx | 3 +- .../DetailContainer/UpLinks/UpLinks.test.tsx | 4 +- .../DetailContainer/UpLinks/UpLinks.tsx | 4 +- .../Version/DetailContainer/UpLinks/styles.ts | 1 - .../Versions/Versions.test.tsx | 6 +- .../DetailContainer/Versions/Versions.tsx | 3 +- .../Versions/VersionsHistoryList.tsx | 6 +- .../Versions/VersionsTagList.tsx | 4 +- .../DetailContainer/Versions/styles.ts | 1 - .../Version/DetailSidebar/DetailSidebar.tsx | 2 - .../DetailSidebarFundButton.test.tsx | 2 - .../DetailSidebar/DetailSidebarFundButton.tsx | 1 - .../DetailSidebar/DetailSidebarTitle.tsx | 1 - .../Developers/Developers.test.tsx | 4 +- .../DetailSidebar/Developers/Developers.tsx | 4 +- .../Developers/DevelopersTitle.tsx | 1 - .../DetailSidebar/Developers/styles.ts | 1 - .../Version/DetailSidebar/Dist/Dist.test.tsx | 4 +- .../pages/Version/DetailSidebar/Dist/Dist.tsx | 4 +- .../Version/DetailSidebar/Dist/styles.ts | 1 - .../DetailSidebar/Engines/Engines.test.tsx | 4 +- .../Version/DetailSidebar/Engines/Engines.tsx | 4 +- .../Version/DetailSidebar/Engines/styles.ts | 1 - .../DetailSidebar/Install/Install.test.tsx | 4 +- .../Version/DetailSidebar/Install/Install.tsx | 2 - .../DetailSidebar/Install/InstallListItem.tsx | 1 - .../Repository/Repository.test.tsx | 4 +- .../DetailSidebar/Repository/Repository.tsx | 2 - .../src/pages/Version/Version.test.tsx | 4 +- .../ui-theme/src/pages/Version/Version.tsx | 4 +- .../pages/Version/VersionContextProvider.tsx | 1 - .../ui-theme/src/pages/Version/context.ts | 2 +- .../plugins/ui-theme/src/pages/home/Home.tsx | 2 - .../pages/home/PackageList/Help/Help.test.tsx | 1 - .../src/pages/home/PackageList/Help/Help.tsx | 1 - .../src/pages/home/PackageList/Help/styles.ts | 1 - .../home/PackageList/Package/Package.test.tsx | 4 +- .../home/PackageList/Package/Package.tsx | 10 +- .../home/PackageList/Package/Tag/Tag.test.tsx | 1 - .../pages/home/PackageList/Package/styles.ts | 1 - .../pages/home/PackageList/PackageList.tsx | 1 - .../home/PackageList/Packagelist.test.tsx | 4 +- .../plugins/ui-theme/src/providers/API/api.ts | 2 +- .../config/AppConfigurationProvider.tsx | 6 +- .../src/store/models/configuration.ts | 5 +- .../ui-theme/src/store/models/download.ts | 3 +- .../ui-theme/src/store/models/index.ts | 1 + .../ui-theme/src/store/models/login.ts | 3 +- .../ui-theme/src/store/models/manifest.ts | 4 +- .../ui-theme/src/store/models/packages.ts | 4 +- .../ui-theme/src/store/models/search.ts | 4 +- packages/plugins/ui-theme/src/store/store.ts | 4 +- .../plugins/ui-theme/src/utils/login.test.ts | 5 +- .../ui-theme/src/utils/package.test.ts | 5 +- .../plugins/ui-theme/src/utils/package.ts | 3 +- .../plugins/ui-theme/src/utils/sec-utils.ts | 2 +- .../src/utils/test-react-testing-library.tsx | 1 - .../plugins/ui-theme/src/utils/url.test.ts | 2 +- packages/plugins/ui-theme/src/utils/url.ts | 1 + packages/plugins/ui-theme/tools/dev.server.js | 1 - .../tools/webpack.dev.config.babel.js | 4 +- packages/plugins/ui-theme/types/index.ts | 1 + packages/proxy/src/up-storage.ts | 34 +++--- packages/proxy/test/headers.auth.spec.ts | 7 +- packages/proxy/test/proxy-utils.spec.ts | 1 + packages/proxy/test/proxy.error.spec.ts | 4 +- packages/proxy/test/proxy.metadata.ts | 4 +- packages/proxy/test/proxy.search.spec.ts | 6 +- packages/proxy/test/proxy.tarball.spec.ts | 6 +- packages/server/src/debug/index.ts | 3 +- packages/server/src/server.ts | 33 +++--- packages/server/test/api/index.spec.ts | 18 ++- packages/server/test/basic/index.spec.ts | 4 +- packages/server/test/jwt/index.spec.ts | 19 ++-- .../server/test/package-access/index.spec.ts | 10 +- packages/server/test/profile/index.spec.ts | 9 +- packages/server/test/storage/index.spec.ts | 13 +-- packages/server/test/token/index.spec.ts | 22 ++-- packages/server/test/web/index.spec.ts | 7 +- packages/server/types/custom.d.ts | 3 +- packages/store/src/local-storage.ts | 48 ++++---- packages/store/src/search.ts | 17 +-- packages/store/src/storage-utils.ts | 10 +- packages/store/src/storage.ts | 46 ++++---- packages/store/src/type.ts | 2 +- packages/store/src/uplink-util.ts | 5 +- packages/store/test/local-storage.spec.ts | 9 +- packages/store/test/search.spec.ts | 6 +- packages/store/test/storage-utils.spec.ts | 7 +- packages/tools/benchmark/src/api/index.ts | 1 + packages/tools/benchmark/src/index.ts | 1 + packages/tools/eslint/src/rules/base.js | 1 - packages/tools/mock/src/config.ts | 2 +- packages/tools/mock/src/mock-api.ts | 8 +- packages/tools/mock/src/mock.ts | 7 +- packages/tools/mock/src/request.ts | 3 +- packages/tools/mock/src/server.ts | 4 +- packages/tools/mock/src/server_process.ts | 3 +- packages/tools/mock/src/utils-test.ts | 7 +- packages/tools/mock/test/request.spec.ts | 3 +- packages/types/index.ts | 3 +- packages/types/src/index.ts | 45 ++++---- packages/utils/src/crypto-utils.ts | 2 +- packages/utils/src/matcher.ts | 3 +- packages/utils/src/utils.ts | 5 +- packages/utils/test/auth-utils.spec.ts | 2 +- packages/utils/test/utils.spec.ts | 5 +- packages/verdaccio/test/.eslintrc | 1 - .../verdaccio/test/functional/basic/basic.ts | 7 +- .../verdaccio/test/functional/index.spec.ts | 27 ++--- .../test/functional/lib/environment.ts | 6 +- .../test/functional/package/access.ts | 2 +- .../verdaccio/test/functional/package/gzip.ts | 4 +- .../test/functional/package/scoped.ts | 6 +- .../test/functional/performance/race.ts | 4 +- .../verdaccio/test/functional/plugins/auth.ts | 2 +- .../test/functional/readme/readme.ts | 2 +- .../test/functional/sanity/mirror.ts | 2 +- .../test/functional/sanity/nullstorage.ts | 2 +- .../test/functional/sanity/racycrash.ts | 3 +- .../test/functional/sanity/security.ts | 1 + .../test/functional/scenarios/gh29.ts | 1 + .../test/functional/search/simple.search.ts | 1 + .../verdaccio/test/functional/tags/addtag.ts | 2 +- .../test/functional/tags/dist-tags-merge.ts | 2 +- .../verdaccio/test/functional/tags/tags.ts | 2 + .../test/functional/uplinks/cache.ts | 5 +- .../plugins/auth/example.auth.plugin.ts | 19 ++-- .../plugins/storage/example.storage.plugin.ts | 14 +-- .../unit/__helper/__template/api.__test.ts | 11 +- packages/verdaccio/test/unit/__helper/api.ts | 4 +- packages/web/src/api/package.ts | 16 +-- packages/web/src/api/readme.ts | 10 +- packages/web/src/api/search.ts | 10 +- packages/web/src/api/sidebar.ts | 18 +-- packages/web/src/api/user.ts | 10 +- packages/web/src/middleware/render-web.ts | 7 +- packages/web/src/middleware/web-api.ts | 13 ++- packages/web/src/renderHTML.ts | 7 +- packages/web/src/template.ts | 4 +- packages/web/src/utils/web-utils.ts | 11 +- packages/web/src/web-middleware.ts | 1 + packages/web/test/api.packages.test.ts | 4 +- packages/web/test/api.readme.test.ts | 3 +- packages/web/test/api.search.test.ts | 5 +- packages/web/test/api.sidebar.test.ts | 3 +- packages/web/test/api.user.test.ts | 4 +- packages/web/test/helper.ts | 11 +- packages/web/test/render.test.ts | 4 +- packages/web/test/template.test.ts | 1 + packages/web/test/utils.spec.ts | 2 +- pnpm-lock.yaml | 103 ++++++++++++++++++ prettier.config.js | 16 +++ test/e2e-cli/setup/setup.ts | 10 +- test/e2e-cli/setup/test_environment.ts | 5 +- test/e2e-cli/test_bk/info.spec.ts | 2 +- test/e2e-cli/test_bk/install.spec.ts | 3 +- test/e2e-cli/test_bk/search.spec.ts | 2 +- test/e2e-cli/utils/global.js | 3 +- test/e2e-cli/utils/process.ts | 2 +- test/e2e-cli/utils/registry.ts | 6 +- test/e2e-cli/utils/utils.ts | 4 +- test/e2e-ui/request.ts | 1 - test/e2e-ui/server.ts | 4 +- website/package.json | 2 +- website/src/components/Command.tsx | 4 +- website/src/components/Divider.tsx | 3 +- website/src/components/FeatureCard.tsx | 1 + website/src/components/Features.tsx | 6 +- website/src/components/Header.tsx | 10 +- website/src/components/PackageManagers.tsx | 8 +- website/src/components/Spinner.tsx | 1 + website/src/components/Testimonials.tsx | 1 + website/src/components/TwitterCarrousel.tsx | 14 +-- website/src/components/UsedBy.tsx | 7 +- website/src/components/WhatIsVerdaccio.tsx | 4 +- website/src/pages/contributors.tsx | 6 +- website/src/pages/help.tsx | 10 +- website/src/pages/index.tsx | 11 +- 407 files changed, 1196 insertions(+), 1141 deletions(-) delete mode 100644 .prettierrc create mode 100644 prettier.config.js diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 34f4adcfb..000000000 --- a/.prettierrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "endOfLine": "lf", - "useTabs": false, - "printWidth": 100, - "tabWidth": 2, - "singleQuote": true, - "bracketSpacing": true, - "jsxBracketSameLine": true, - "trailingComma": "es5", - "semi": true -} diff --git a/package.json b/package.json index 0edc2f8ac..0279fdf13 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@changesets/cli": "2.15.0", "@changesets/get-dependents-graph": "1.2.2", "@crowdin/cli": "3.7.1", + "@trivago/prettier-plugin-sort-imports": "3.0.0", "@types/async": "3.2.7", "@types/autocannon": "4.1.1", "@types/autosuggest-highlight": "3.1.1", diff --git a/packages/api/src/dist-tags.ts b/packages/api/src/dist-tags.ts index d7fa76440..12ec0817f 100644 --- a/packages/api/src/dist-tags.ts +++ b/packages/api/src/dist-tags.ts @@ -1,12 +1,13 @@ -import mime from 'mime'; -import _ from 'lodash'; import { Router } from 'express'; +import _ from 'lodash'; +import mime from 'mime'; -import { media, allow } from '@verdaccio/middleware'; -import { constants, VerdaccioError } from '@verdaccio/core'; -import { Package } from '@verdaccio/types'; -import { Storage } from '@verdaccio/store'; import { IAuth } from '@verdaccio/auth'; +import { VerdaccioError, constants } from '@verdaccio/core'; +import { allow, media } from '@verdaccio/middleware'; +import { Storage } from '@verdaccio/store'; +import { Package } from '@verdaccio/types'; + import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom'; export default function (route: Router, auth: IAuth, storage: Storage): void { diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index d2d41e44c..470548ace 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -1,28 +1,29 @@ +import bodyParser from 'body-parser'; import express, { Router } from 'express'; +import semver from 'semver'; + +import { IAuth } from '@verdaccio/auth'; import { + antiLoop, + encodeScopePackage, match, validateName, validatePackage, - encodeScopePackage, - antiLoop, } from '@verdaccio/middleware'; -import { IAuth } from '@verdaccio/auth'; import { Storage } from '@verdaccio/store'; import { Config } from '@verdaccio/types'; -import bodyParser from 'body-parser'; -import semver from 'semver'; -import whoami from './whoami'; -import ping from './ping'; -import user from './user'; import distTags from './dist-tags'; +import pkg from './package'; +import ping from './ping'; import publish from './publish'; import search from './search'; -import pkg from './package'; import stars from './stars'; +import user from './user'; import profile from './v1/profile'; -import token from './v1/token'; import v1Search from './v1/search'; +import token from './v1/token'; +import whoami from './whoami'; if (semver.lte(process.version, 'v15.0.0')) { global.AbortController = require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController; diff --git a/packages/api/src/package.ts b/packages/api/src/package.ts index 32b0e9121..78ed29528 100644 --- a/packages/api/src/package.ts +++ b/packages/api/src/package.ts @@ -1,15 +1,16 @@ -import _ from 'lodash'; -import { Router } from 'express'; import buildDebug from 'debug'; +import { Router } from 'express'; +import _ from 'lodash'; -import { allow } from '@verdaccio/middleware'; -import { getVersion } from '@verdaccio/utils'; -import { HEADERS, DIST_TAGS, API_ERROR, errorUtils } from '@verdaccio/core'; -import { Config, Package } from '@verdaccio/types'; import { IAuth } from '@verdaccio/auth'; +import { API_ERROR, DIST_TAGS, HEADERS, errorUtils } from '@verdaccio/core'; +import { allow } from '@verdaccio/middleware'; import { Storage } from '@verdaccio/store'; import { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball'; -import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom'; +import { Config, Package } from '@verdaccio/types'; +import { getVersion } from '@verdaccio/utils'; + +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom'; const debug = buildDebug('verdaccio:api:package'); diff --git a/packages/api/src/ping.ts b/packages/api/src/ping.ts index 5d7545913..4d6ca62f5 100644 --- a/packages/api/src/ping.ts +++ b/packages/api/src/ping.ts @@ -1,5 +1,6 @@ import { Router } from 'express'; -import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom'; + +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom'; export default function (route: Router): void { route.get( diff --git a/packages/api/src/publish.ts b/packages/api/src/publish.ts index 302257db2..55e85b816 100644 --- a/packages/api/src/publish.ts +++ b/packages/api/src/publish.ts @@ -1,26 +1,26 @@ -import Path from 'path'; +import buildDebug from 'debug'; +import { Router } from 'express'; import _ from 'lodash'; import mime from 'mime'; -import { Router } from 'express'; -import buildDebug from 'debug'; +import Path from 'path'; +import { IAuth } from '@verdaccio/auth'; import { - API_MESSAGE, - HEADERS, - DIST_TAGS, API_ERROR, + API_MESSAGE, + DIST_TAGS, + HEADERS, HTTP_STATUS, errorUtils, } from '@verdaccio/core'; -import { validateMetadata, isObject, hasDiffOneKey } from '@verdaccio/utils'; -import { media, expectJson, allow } from '@verdaccio/middleware'; import { notify } from '@verdaccio/hooks'; -import { Config, Callback, MergeTags, Version, Package, CallbackAction } from '@verdaccio/types'; import { logger } from '@verdaccio/logger'; -import { IAuth } from '@verdaccio/auth'; +import { allow, expectJson, media } from '@verdaccio/middleware'; import { Storage } from '@verdaccio/store'; -import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom'; +import { Callback, CallbackAction, Config, MergeTags, Package, Version } from '@verdaccio/types'; +import { hasDiffOneKey, isObject, validateMetadata } from '@verdaccio/utils'; +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom'; import star from './star'; import { isPublishablePackage, isRelatedToDeprecation } from './utils'; diff --git a/packages/api/src/star.ts b/packages/api/src/star.ts index 336faa560..f037a34fb 100644 --- a/packages/api/src/star.ts +++ b/packages/api/src/star.ts @@ -1,10 +1,11 @@ -import { USERS, HTTP_STATUS } from '@verdaccio/core'; +import buildDebug from 'debug'; import { Response } from 'express'; import _ from 'lodash'; -import buildDebug from 'debug'; +import { HTTP_STATUS, USERS } from '@verdaccio/core'; import { Storage } from '@verdaccio/store'; -import { $RequestExtend, $NextFunctionVer } from '../types/custom'; + +import { $NextFunctionVer, $RequestExtend } from '../types/custom'; const debug = buildDebug('verdaccio:api:publish:star'); diff --git a/packages/api/src/stars.ts b/packages/api/src/stars.ts index 2a72cd4ce..1b143ba04 100644 --- a/packages/api/src/stars.ts +++ b/packages/api/src/stars.ts @@ -1,11 +1,11 @@ -import _ from 'lodash'; import { Response, Router } from 'express'; +import _ from 'lodash'; -import { USERS, HTTP_STATUS } from '@verdaccio/core'; +import { HTTP_STATUS, USERS } from '@verdaccio/core'; +import { Storage } from '@verdaccio/store'; import { Package } from '@verdaccio/types'; -import { Storage } from '@verdaccio/store'; -import { $RequestExtend, $NextFunctionVer } from '../types/custom'; +import { $NextFunctionVer, $RequestExtend } from '../types/custom'; type Packages = Package[]; diff --git a/packages/api/src/user.ts b/packages/api/src/user.ts index b8d9e8ece..a7e9f71aa 100644 --- a/packages/api/src/user.ts +++ b/packages/api/src/user.ts @@ -1,16 +1,16 @@ -import _ from 'lodash'; -import { Response, Router } from 'express'; import buildDebug from 'debug'; +import { Response, Router } from 'express'; +import _ from 'lodash'; -import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils'; import { getApiToken } from '@verdaccio/auth'; -import { logger } from '@verdaccio/logger'; -import { createRemoteUser } from '@verdaccio/config'; - -import { Config, RemoteUser } from '@verdaccio/types'; import { IAuth } from '@verdaccio/auth'; +import { createRemoteUser } from '@verdaccio/config'; import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils } from '@verdaccio/core'; -import { $RequestExtend, $NextFunctionVer } from '../types/custom'; +import { logger } from '@verdaccio/logger'; +import { Config, RemoteUser } from '@verdaccio/types'; +import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils'; + +import { $NextFunctionVer, $RequestExtend } from '../types/custom'; const debug = buildDebug('verdaccio:api:user'); diff --git a/packages/api/src/utils.ts b/packages/api/src/utils.ts index 546c213ad..da8131437 100644 --- a/packages/api/src/utils.ts +++ b/packages/api/src/utils.ts @@ -1,6 +1,7 @@ -import { Package } from '@verdaccio/types'; import _ from 'lodash'; +import { Package } from '@verdaccio/types'; + /** * Check whether the package metadta has enough data to be published * @param pkg metadata diff --git a/packages/api/src/v1/profile.ts b/packages/api/src/v1/profile.ts index dd8e8a7bc..bd75b924c 100644 --- a/packages/api/src/v1/profile.ts +++ b/packages/api/src/v1/profile.ts @@ -1,10 +1,11 @@ -import _ from 'lodash'; import { Response, Router } from 'express'; +import _ from 'lodash'; +import { IAuth } from '@verdaccio/auth'; import { API_ERROR, APP_ERROR, HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core'; import { validatePassword } from '@verdaccio/utils'; -import { IAuth } from '@verdaccio/auth'; -import { $RequestExtend, $NextFunctionVer } from '../../types/custom'; + +import { $NextFunctionVer, $RequestExtend } from '../../types/custom'; export interface Profile { tfa: boolean; diff --git a/packages/api/src/v1/search.ts b/packages/api/src/v1/search.ts index b5db3b765..8bc8d41bd 100644 --- a/packages/api/src/v1/search.ts +++ b/packages/api/src/v1/search.ts @@ -1,8 +1,9 @@ -import _ from 'lodash'; import buildDebug from 'debug'; -import { logger } from '@verdaccio/logger'; +import _ from 'lodash'; + import { IAuth } from '@verdaccio/auth'; import { HTTP_STATUS, searchUtils } from '@verdaccio/core'; +import { logger } from '@verdaccio/logger'; import { Storage } from '@verdaccio/store'; import { Package } from '@verdaccio/types'; diff --git a/packages/api/src/v1/token.ts b/packages/api/src/v1/token.ts index 3700eeab7..2faa67ad9 100644 --- a/packages/api/src/v1/token.ts +++ b/packages/api/src/v1/token.ts @@ -1,14 +1,15 @@ -import _ from 'lodash'; -import { errorUtils, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/core'; -import { stringToMD5, mask } from '@verdaccio/utils'; -import { getApiToken } from '@verdaccio/auth'; -import { logger } from '@verdaccio/logger'; import { Response, Router } from 'express'; +import _ from 'lodash'; -import { Config, RemoteUser, Token } from '@verdaccio/types'; +import { getApiToken } from '@verdaccio/auth'; import { IAuth } from '@verdaccio/auth'; +import { HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core'; +import { logger } from '@verdaccio/logger'; import { Storage } from '@verdaccio/store'; -import { $RequestExtend, $NextFunctionVer } from '../../types/custom'; +import { Config, RemoteUser, Token } from '@verdaccio/types'; +import { mask, stringToMD5 } from '@verdaccio/utils'; + +import { $NextFunctionVer, $RequestExtend } from '../../types/custom'; export type NormalizeToken = Token & { created: string; diff --git a/packages/api/src/whoami.ts b/packages/api/src/whoami.ts index 1731a80b9..fc2bf8140 100644 --- a/packages/api/src/whoami.ts +++ b/packages/api/src/whoami.ts @@ -1,6 +1,7 @@ -import { Response, Router } from 'express'; import buildDebug from 'debug'; -import { $RequestExtend, $NextFunctionVer } from '../types/custom'; +import { Response, Router } from 'express'; + +import { $NextFunctionVer, $RequestExtend } from '../types/custom'; const debug = buildDebug('verdaccio:api:user'); diff --git a/packages/api/test/integration/_helper.ts b/packages/api/test/integration/_helper.ts index 08907f06a..7e2f7b4ef 100644 --- a/packages/api/test/integration/_helper.ts +++ b/packages/api/test/integration/_helper.ts @@ -1,14 +1,15 @@ -import path from 'path'; -import express, { Application } from 'express'; -import supertest from 'supertest'; import bodyParser from 'body-parser'; +import express, { Application } from 'express'; +import path from 'path'; +import supertest from 'supertest'; -import { Config, parseConfigFile } from '@verdaccio/config'; -import { Storage } from '@verdaccio/store'; -import { generatePackageMetadata } from '@verdaccio/helper'; -import { final, handleError, errorReportingMiddleware } from '@verdaccio/middleware'; import { Auth, IAuth } from '@verdaccio/auth'; +import { Config, parseConfigFile } from '@verdaccio/config'; import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; +import { generatePackageMetadata } from '@verdaccio/helper'; +import { errorReportingMiddleware, final, handleError } from '@verdaccio/middleware'; +import { Storage } from '@verdaccio/store'; + import apiEndpoints from '../../src'; const getConf = (conf) => { diff --git a/packages/api/test/integration/package.spec.ts b/packages/api/test/integration/package.spec.ts index 2b9a96579..10269ecf0 100644 --- a/packages/api/test/integration/package.spec.ts +++ b/packages/api/test/integration/package.spec.ts @@ -1,7 +1,8 @@ import supertest from 'supertest'; -import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core'; -import { $ResponseExtend, $RequestExtend } from '../../types/custom'; +import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; + +import { $RequestExtend, $ResponseExtend } from '../../types/custom'; import { initializeServer, publishTaggedVersion, publishVersion } from './_helper'; const mockApiJWTmiddleware = jest.fn( diff --git a/packages/api/test/integration/ping.spec.ts b/packages/api/test/integration/ping.spec.ts index 9c843d19e..b116adcdb 100644 --- a/packages/api/test/integration/ping.spec.ts +++ b/packages/api/test/integration/ping.spec.ts @@ -1,6 +1,7 @@ import supertest from 'supertest'; -import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core'; +import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; + import { initializeServer } from './_helper'; describe('ping', () => { diff --git a/packages/api/test/integration/publish.spec.ts b/packages/api/test/integration/publish.spec.ts index 362a55b37..f1cbac1c1 100644 --- a/packages/api/test/integration/publish.spec.ts +++ b/packages/api/test/integration/publish.spec.ts @@ -1,8 +1,10 @@ -import { HTTP_STATUS } from '@verdaccio/core'; import supertest from 'supertest'; -import { API_ERROR, API_MESSAGE, HEADER_TYPE, HEADERS } from '@verdaccio/core'; + +import { HTTP_STATUS } from '@verdaccio/core'; +import { API_ERROR, API_MESSAGE, HEADERS, HEADER_TYPE } from '@verdaccio/core'; import { generatePackageMetadata } from '@verdaccio/helper'; -import { $ResponseExtend, $RequestExtend } from '../../types/custom'; + +import { $RequestExtend, $ResponseExtend } from '../../types/custom'; import { initializeServer, publishVersion } from './_helper'; const mockApiJWTmiddleware = jest.fn( diff --git a/packages/api/test/integration/user.spec.ts b/packages/api/test/integration/user.spec.ts index ab53c734a..afc49b580 100644 --- a/packages/api/test/integration/user.spec.ts +++ b/packages/api/test/integration/user.spec.ts @@ -1,13 +1,13 @@ -import supertest from 'supertest'; import _ from 'lodash'; +import supertest from 'supertest'; import { - errorUtils, + API_ERROR, + API_MESSAGE, HEADERS, HEADER_TYPE, - API_MESSAGE, HTTP_STATUS, - API_ERROR, + errorUtils, } from '@verdaccio/core'; import { $RequestExtend, $ResponseExtend } from '../../types/custom'; diff --git a/packages/api/test/unit/publish.spec.ts b/packages/api/test/unit/publish.spec.ts index 0c72ec9ba..33bfd19bf 100644 --- a/packages/api/test/unit/publish.spec.ts +++ b/packages/api/test/unit/publish.spec.ts @@ -1,10 +1,11 @@ -import { errorUtils, HTTP_STATUS, API_ERROR } from '@verdaccio/core'; +import { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core'; + import { addVersion, - uploadPackageTarball, + publishPackage, removeTarball, unPublishPackage, - publishPackage, + uploadPackageTarball, } from '../../src/publish'; const REVISION_MOCK = '15-e53a77096b0ee33e'; diff --git a/packages/api/test/unit/validate.api.params.middleware.spec.ts b/packages/api/test/unit/validate.api.params.middleware.spec.ts index e91da244a..3cfc32585 100644 --- a/packages/api/test/unit/validate.api.params.middleware.spec.ts +++ b/packages/api/test/unit/validate.api.params.middleware.spec.ts @@ -1,7 +1,7 @@ /* eslint-disable curly */ // ensure that all arguments are validated -import path from 'path'; import fs from 'fs'; +import path from 'path'; /** * Validate. diff --git a/packages/api/types/custom.d.ts b/packages/api/types/custom.d.ts index 72cee6d7d..7936ace2a 100644 --- a/packages/api/types/custom.d.ts +++ b/packages/api/types/custom.d.ts @@ -1,6 +1,7 @@ -import { Logger, RemoteUser } from '@verdaccio/types'; import { NextFunction, Request, Response } from 'express'; +import { Logger, RemoteUser } from '@verdaccio/types'; + export type $RequestExtend = Request & { remote_user?: any; log: Logger }; export type $ResponseExtend = Response & { cookies?: any }; export type $NextFunctionVer = NextFunction & any; diff --git a/packages/auth/src/auth.ts b/packages/auth/src/auth.ts index 83f61a06b..2133aa3b1 100644 --- a/packages/auth/src/auth.ts +++ b/packages/auth/src/auth.ts @@ -1,7 +1,9 @@ -import _ from 'lodash'; -import { NextFunction, Request, Response } from 'express'; import buildDebug from 'debug'; +import { NextFunction, Request, Response } from 'express'; +import _ from 'lodash'; +import { HTPasswd, HTPasswdConfig } from 'verdaccio-htpasswd'; +import { createAnonymousRemoteUser, createRemoteUser } from '@verdaccio/config'; import { API_ERROR, SUPPORT_ERRORS, @@ -11,38 +13,33 @@ import { errorUtils, } from '@verdaccio/core'; import { loadPlugin } from '@verdaccio/loaders'; -import { HTPasswd, HTPasswdConfig } from 'verdaccio-htpasswd'; - import { - Config, - Logger, - Callback, - IPluginAuth, - RemoteUser, - JWTSignOptions, - Security, - AuthPluginPackage, AllowAccess, + AuthPluginPackage, + Callback, + Config, + IPluginAuth, + JWTSignOptions, + Logger, PackageAccess, PluginOptions, + RemoteUser, + Security, } from '@verdaccio/types'; - -import { getMatchedPackagesSpec, isNil, isFunction } from '@verdaccio/utils'; -import { createAnonymousRemoteUser, createRemoteUser } from '@verdaccio/config'; - -import { - getMiddlewareCredentials, - getDefaultPlugins, - verifyJWTPayload, - parseAuthTokenHeader, - isAuthHeaderValid, - isAESLegacy, - convertPayloadToBase64, -} from './utils'; +import { getMatchedPackagesSpec, isFunction, isNil } from '@verdaccio/utils'; import { signPayload } from './jwt-token'; import { aesEncrypt } from './legacy-token'; import { parseBasicPayload } from './token'; +import { + convertPayloadToBase64, + getDefaultPlugins, + getMiddlewareCredentials, + isAESLegacy, + isAuthHeaderValid, + parseAuthTokenHeader, + verifyJWTPayload, +} from './utils'; /* eslint-disable @typescript-eslint/no-var-requires */ const LoggerApi = require('@verdaccio/logger'); diff --git a/packages/auth/src/jwt-token.ts b/packages/auth/src/jwt-token.ts index cb2ac5204..782d4de40 100644 --- a/packages/auth/src/jwt-token.ts +++ b/packages/auth/src/jwt-token.ts @@ -1,5 +1,5 @@ -import jwt from 'jsonwebtoken'; import buildDebug from 'debug'; +import jwt from 'jsonwebtoken'; import { JWTSignOptions, RemoteUser } from '@verdaccio/types'; diff --git a/packages/auth/src/legacy-token.ts b/packages/auth/src/legacy-token.ts index 5735a8951..085923b44 100644 --- a/packages/auth/src/legacy-token.ts +++ b/packages/auth/src/legacy-token.ts @@ -1,13 +1,14 @@ import { + HexBase64BinaryEncoding, + Utf8AsciiBinaryEncoding, createCipheriv, createDecipheriv, - HexBase64BinaryEncoding, randomBytes, - Utf8AsciiBinaryEncoding, } from 'crypto'; -import { TOKEN_VALID_LENGTH } from '@verdaccio/config'; import buildDebug from 'debug'; +import { TOKEN_VALID_LENGTH } from '@verdaccio/config'; + const debug = buildDebug('verdaccio:auth:token:legacy'); export const defaultAlgorithm = process.env.VERDACCIO_LEGACY_ALGORITHM || 'aes-256-ctr'; diff --git a/packages/auth/src/utils.ts b/packages/auth/src/utils.ts index 80c0c2d8a..b76697585 100644 --- a/packages/auth/src/utils.ts +++ b/packages/auth/src/utils.ts @@ -1,26 +1,27 @@ -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; + +import { createAnonymousRemoteUser } from '@verdaccio/config'; import { + API_ERROR, + HTTP_STATUS, + TOKEN_BASIC, + TOKEN_BEARER, + VerdaccioError, + errorUtils, +} from '@verdaccio/core'; +import { + AuthPackageAllow, Callback, Config, IPluginAuth, RemoteUser, Security, - AuthPackageAllow, } from '@verdaccio/types'; -import { - HTTP_STATUS, - TOKEN_BASIC, - TOKEN_BEARER, - API_ERROR, - VerdaccioError, - errorUtils, -} from '@verdaccio/core'; -import { createAnonymousRemoteUser } from '@verdaccio/config'; -import { TokenEncryption, AESPayload } from './auth'; -import { aesDecrypt } from './legacy-token'; +import { AESPayload, TokenEncryption } from './auth'; import { verifyPayload } from './jwt-token'; +import { aesDecrypt } from './legacy-token'; import { parseBasicPayload } from './token'; const debug = buildDebug('verdaccio:auth:utils'); diff --git a/packages/auth/test/auth-utils.spec.ts b/packages/auth/test/auth-utils.spec.ts index 7d48c7323..22dfe06c0 100644 --- a/packages/auth/test/auth-utils.spec.ts +++ b/packages/auth/test/auth-utils.spec.ts @@ -1,43 +1,42 @@ -import path from 'path'; import _ from 'lodash'; +import path from 'path'; -import { configExample } from '@verdaccio/mock'; import { Config as AppConfig, - parseConfigFile, ROLES, - createRemoteUser, createAnonymousRemoteUser, + createRemoteUser, + parseConfigFile, } from '@verdaccio/config'; - import { - getAuthenticatedMessage, - buildToken, - AllowActionCallbackResponse, - buildUserBuffer, -} from '@verdaccio/utils'; - -import { Config, Security, RemoteUser } from '@verdaccio/types'; -import { - VerdaccioError, + API_ERROR, CHARACTER_ENCODING, TOKEN_BEARER, - API_ERROR, + VerdaccioError, errorUtils, } from '@verdaccio/core'; import { setup } from '@verdaccio/logger'; +import { configExample } from '@verdaccio/mock'; +import { Config, RemoteUser, Security } from '@verdaccio/types'; +import { + AllowActionCallbackResponse, + buildToken, + buildUserBuffer, + getAuthenticatedMessage, +} from '@verdaccio/utils'; + import { - IAuth, - Auth, ActionsAllowed, + Auth, + IAuth, + aesDecrypt, allow_action, + getApiToken, getDefaultPlugins, getMiddlewareCredentials, - getApiToken, - verifyJWTPayload, - aesDecrypt, - verifyPayload, signPayload, + verifyJWTPayload, + verifyPayload, } from '../src'; setup([]); diff --git a/packages/auth/test/auth.spec.ts b/packages/auth/test/auth.spec.ts index 7d0574a72..fd0dd74ff 100644 --- a/packages/auth/test/auth.spec.ts +++ b/packages/auth/test/auth.spec.ts @@ -1,13 +1,13 @@ import _ from 'lodash'; -import { ROLES, Config as AppConfig } from '@verdaccio/config'; -import { setup } from '@verdaccio/logger'; + import { IAuth } from '@verdaccio/auth'; -import { Config } from '@verdaccio/types'; +import { Config as AppConfig, ROLES } from '@verdaccio/config'; import { errorUtils } from '@verdaccio/core'; +import { setup } from '@verdaccio/logger'; +import { Config } from '@verdaccio/types'; import { Auth } from '../src'; - -import { authProfileConf, authPluginFailureConf, authPluginPassThrougConf } from './helper/plugin'; +import { authPluginFailureConf, authPluginPassThrougConf, authProfileConf } from './helper/plugin'; setup([]); diff --git a/packages/auth/test/helper/plugin.ts b/packages/auth/test/helper/plugin.ts index 00d61e5d4..013349a70 100644 --- a/packages/auth/test/helper/plugin.ts +++ b/packages/auth/test/helper/plugin.ts @@ -1,4 +1,5 @@ import path from 'path'; + import { configExample as config } from '@verdaccio/mock'; export const authProfileConf = config({ diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index bad99b62c..db80ead94 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,11 +1,12 @@ import { Cli } from 'clipanion'; import { warningUtils } from '@verdaccio/core'; + +import { FastifyServer } from './commands/FastifyServer'; import { InfoCommand } from './commands/info'; import { InitCommand } from './commands/init'; import { VersionCommand } from './commands/version'; -import { FastifyServer } from './commands/FastifyServer'; -import { isVersionValid, MIN_NODE_VERSION } from './utils'; +import { MIN_NODE_VERSION, isVersionValid } from './utils'; if (process.getuid && process.getuid() === 0) { warningUtils.emit(warningUtils.Codes.VERWAR001); diff --git a/packages/cli/src/commands/FastifyServer.ts b/packages/cli/src/commands/FastifyServer.ts index f0b70629d..1aa52fb9e 100644 --- a/packages/cli/src/commands/FastifyServer.ts +++ b/packages/cli/src/commands/FastifyServer.ts @@ -1,7 +1,8 @@ import { Command, Option } from 'clipanion'; + import { findConfigFile, parseConfigFile } from '@verdaccio/config'; -import { setup, logger } from '@verdaccio/logger'; import server from '@verdaccio/fastify-migration'; +import { logger, setup } from '@verdaccio/logger'; import { ConfigRuntime } from '@verdaccio/types'; export const DEFAULT_PROCESS_NAME: string = 'verdaccio'; diff --git a/packages/cli/src/commands/info.ts b/packages/cli/src/commands/info.ts index c2b4a4b96..4a57defbd 100644 --- a/packages/cli/src/commands/info.ts +++ b/packages/cli/src/commands/info.ts @@ -1,5 +1,5 @@ -import envinfo from 'envinfo'; import { Command } from 'clipanion'; +import envinfo from 'envinfo'; export class InfoCommand extends Command { public static paths = [[`--info`], [`-i`]]; diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 9e65efbb9..fabce4610 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -1,9 +1,10 @@ import { Command, Option } from 'clipanion'; + import { findConfigFile, parseConfigFile } from '@verdaccio/config'; -import { setup, logger } from '@verdaccio/logger'; +import { warningUtils } from '@verdaccio/core'; +import { logger, setup } from '@verdaccio/logger'; import { initServer } from '@verdaccio/node-api'; import { ConfigRuntime } from '@verdaccio/types'; -import { warningUtils } from '@verdaccio/core'; export const DEFAULT_PROCESS_NAME: string = 'verdaccio'; diff --git a/packages/config/src/config-path.ts b/packages/config/src/config-path.ts index 1845f4a38..6967597d7 100644 --- a/packages/config/src/config-path.ts +++ b/packages/config/src/config-path.ts @@ -1,10 +1,11 @@ -import fs from 'fs'; -import path from 'path'; -import _ from 'lodash'; import buildDebug from 'debug'; +import fs from 'fs'; +import _ from 'lodash'; +import path from 'path'; import { CHARACTER_ENCODING } from '@verdaccio/core'; -import { folderExists, fileExists } from './config-utils'; + +import { fileExists, folderExists } from './config-utils'; const CONFIG_FILE = 'config.yaml'; const XDG = 'xdg'; diff --git a/packages/config/src/config.ts b/packages/config/src/config.ts index 55f855643..8104e7853 100644 --- a/packages/config/src/config.ts +++ b/packages/config/src/config.ts @@ -1,25 +1,25 @@ import assert from 'assert'; -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; -import { getMatchedPackagesSpec, generateRandomHexString, isObject } from '@verdaccio/utils'; import { APP_ERROR } from '@verdaccio/core'; import { - PackageList, Config as AppConfig, - ConfigRuntime, - Security, - PackageAccess, - ServerSettingsConf, AuthConf, + ConfigRuntime, + PackageAccess, + PackageList, + Security, + ServerSettingsConf, } from '@verdaccio/types'; +import { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils'; -import { generateRandomSecretKey } from './token'; -import { normalisePackageAccess } from './package-access'; -import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks'; -import { defaultSecurity } from './security'; import { getUserAgent } from './agent'; +import { normalisePackageAccess } from './package-access'; +import { defaultSecurity } from './security'; import serverSettings from './serverSettings'; +import { generateRandomSecretKey } from './token'; +import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks'; const strategicConfigProps = ['uplinks', 'packages']; const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy']; diff --git a/packages/config/src/package-access.ts b/packages/config/src/package-access.ts index 13cf52d98..505808295 100644 --- a/packages/config/src/package-access.ts +++ b/packages/config/src/package-access.ts @@ -1,7 +1,9 @@ import assert from 'assert'; import _ from 'lodash'; -import { PackageAccess } from '@verdaccio/types'; + import { errorUtils } from '@verdaccio/core'; +import { PackageAccess } from '@verdaccio/types'; + export interface LegacyPackageList { [key: string]: PackageAccess; } diff --git a/packages/config/src/parse.ts b/packages/config/src/parse.ts index b98569062..0904e6283 100644 --- a/packages/config/src/parse.ts +++ b/packages/config/src/parse.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import YAML from 'js-yaml'; + import { APP_ERROR } from '@verdaccio/core'; import { ConfigRuntime, ConfigYaml } from '@verdaccio/types'; diff --git a/packages/config/src/uplinks.ts b/packages/config/src/uplinks.ts index a5ee0bc92..d1d9fd0cc 100644 --- a/packages/config/src/uplinks.ts +++ b/packages/config/src/uplinks.ts @@ -1,8 +1,9 @@ import assert from 'assert'; -import { getMatchedPackagesSpec } from '@verdaccio/utils'; -import { PackageList, UpLinksConfList } from '@verdaccio/types'; import _ from 'lodash'; +import { PackageList, UpLinksConfList } from '@verdaccio/types'; +import { getMatchedPackagesSpec } from '@verdaccio/utils'; + export const DEFAULT_REGISTRY = 'https://registry.npmjs.org'; export const DEFAULT_UPLINK = 'npmjs'; diff --git a/packages/config/test/config.path.spec.ts b/packages/config/test/config.path.spec.ts index 9a7d6897a..0f0e5b2c0 100644 --- a/packages/config/test/config.path.spec.ts +++ b/packages/config/test/config.path.spec.ts @@ -1,4 +1,5 @@ import os from 'os'; + import { findConfigFile } from '../src/config-path'; const mockmkDir = jest.fn(); diff --git a/packages/config/test/config.spec.ts b/packages/config/test/config.spec.ts index 7698ab6fb..b6f4eaf37 100644 --- a/packages/config/test/config.spec.ts +++ b/packages/config/test/config.spec.ts @@ -1,14 +1,14 @@ -import path from 'path'; import _ from 'lodash'; +import path from 'path'; import { Config, DEFAULT_REGISTRY, DEFAULT_UPLINK, - defaultSecurity, - parseConfigFile, ROLES, WEB_TITLE, + defaultSecurity, + parseConfigFile, } from '../src'; import { parseConfigurationFile } from './utils'; diff --git a/packages/config/test/package-access.spec.ts b/packages/config/test/package-access.spec.ts index a5136c5cd..30c6e66b7 100644 --- a/packages/config/test/package-access.spec.ts +++ b/packages/config/test/package-access.spec.ts @@ -1,7 +1,7 @@ import _ from 'lodash'; -import { normalisePackageAccess, PACKAGE_ACCESS } from '../src/package-access'; import { parseConfigFile } from '../src'; +import { PACKAGE_ACCESS, normalisePackageAccess } from '../src/package-access'; import { parseConfigurationFile } from './utils'; describe('Package access utilities', () => { diff --git a/packages/config/test/token.spec.ts b/packages/config/test/token.spec.ts index b7771786b..4780e3713 100644 --- a/packages/config/test/token.spec.ts +++ b/packages/config/test/token.spec.ts @@ -1,4 +1,4 @@ -import { generateRandomSecretKey, TOKEN_VALID_LENGTH } from '../src/token'; +import { TOKEN_VALID_LENGTH, generateRandomSecretKey } from '../src/token'; test('token test valid length', () => { const token = generateRandomSecretKey(); diff --git a/packages/config/test/uplinks.spec.ts b/packages/config/test/uplinks.spec.ts index b1b43d278..416f7e359 100644 --- a/packages/config/test/uplinks.spec.ts +++ b/packages/config/test/uplinks.spec.ts @@ -1,5 +1,5 @@ -import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks'; import { normalisePackageAccess, parseConfigFile } from '../src'; +import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks'; import { parseConfigurationFile } from './utils'; describe('Uplinks Utilities', () => { diff --git a/packages/config/test/utils.spec.ts b/packages/config/test/utils.spec.ts index 45ae22859..ce9b35090 100644 --- a/packages/config/test/utils.spec.ts +++ b/packages/config/test/utils.spec.ts @@ -1,5 +1,5 @@ +import { ROLES, createAnonymousRemoteUser, createRemoteUser } from '../src'; import { spliceURL } from '../src/string'; -import { createAnonymousRemoteUser, createRemoteUser, ROLES } from '../src'; describe('spliceURL', () => { test('should splice two strings and generate a url', () => { diff --git a/packages/core/core/src/error-utils.ts b/packages/core/core/src/error-utils.ts index d5ba2cd0a..3fac13ea1 100644 --- a/packages/core/core/src/error-utils.ts +++ b/packages/core/core/src/error-utils.ts @@ -1,4 +1,5 @@ import createError, { HttpError } from 'http-errors'; + import { DEFAULT_MIN_LIMIT_PASSWORD, HTTP_STATUS } from './constants'; export const API_ERROR = { diff --git a/packages/core/core/src/index.ts b/packages/core/core/src/index.ts index 3d9df0ff5..356762685 100644 --- a/packages/core/core/src/index.ts +++ b/packages/core/core/src/index.ts @@ -1,11 +1,11 @@ -import * as searchUtils from './search-utils'; -import * as streamUtils from './stream-utils'; -import * as errorUtils from './error-utils'; -import * as validatioUtils from './validation-utils'; import * as constants from './constants'; -import * as pluginUtils from './plugin-utils'; +import * as errorUtils from './error-utils'; import * as fileUtils from './file-utils'; import * as pkgUtils from './pkg-utils'; +import * as pluginUtils from './plugin-utils'; +import * as searchUtils from './search-utils'; +import * as streamUtils from './stream-utils'; +import * as validatioUtils from './validation-utils'; import * as warningUtils from './warning-utils'; export { VerdaccioError, API_ERROR, SUPPORT_ERRORS, APP_ERROR } from './error-utils'; diff --git a/packages/core/core/src/pkg-utils.ts b/packages/core/core/src/pkg-utils.ts index c065ad748..fa6fc27cb 100644 --- a/packages/core/core/src/pkg-utils.ts +++ b/packages/core/core/src/pkg-utils.ts @@ -1,5 +1,7 @@ -import { Package } from '@verdaccio/types'; import semver from 'semver'; + +import { Package } from '@verdaccio/types'; + import { DIST_TAGS } from './constants'; /** diff --git a/packages/core/core/src/plugin-utils.ts b/packages/core/core/src/plugin-utils.ts index 72174d387..6ed693fbb 100644 --- a/packages/core/core/src/plugin-utils.ts +++ b/packages/core/core/src/plugin-utils.ts @@ -1,4 +1,5 @@ import { Config, IPackageStorage, Token, TokenFilter } from '@verdaccio/types'; + import { searchUtils } from '.'; interface IPlugin { diff --git a/packages/core/core/src/stream-utils.ts b/packages/core/core/src/stream-utils.ts index 7fa669f7e..f32e36cd2 100644 --- a/packages/core/core/src/stream-utils.ts +++ b/packages/core/core/src/stream-utils.ts @@ -1,4 +1,4 @@ -import { PassThrough, TransformOptions, Transform } from 'stream'; +import { PassThrough, Transform, TransformOptions } from 'stream'; export interface IReadTarball { abort?: () => void; diff --git a/packages/core/core/src/validation-utils.ts b/packages/core/core/src/validation-utils.ts index 55fb39381..356aa75af 100644 --- a/packages/core/core/src/validation-utils.ts +++ b/packages/core/core/src/validation-utils.ts @@ -1,5 +1,7 @@ import assert from 'assert'; + import { Package } from '@verdaccio/types'; + import { DIST_TAGS } from './constants'; export function isPackageNameScoped(name: string): boolean { diff --git a/packages/core/core/test/errors.spec.ts b/packages/core/core/test/errors.spec.ts index b3158ca49..8dfcc9419 100644 --- a/packages/core/core/test/errors.spec.ts +++ b/packages/core/core/test/errors.spec.ts @@ -1,17 +1,17 @@ import _ from 'lodash'; -import { HTTP_STATUS } from '../src/constants'; +import { HTTP_STATUS } from '../src/constants'; import { - getNotFound, - VerdaccioError, - getConflict, - getBadData, - getInternalError, API_ERROR, - getUnauthorized, - getForbidden, - getServiceUnavailable, + VerdaccioError, + getBadData, getCode, + getConflict, + getForbidden, + getInternalError, + getNotFound, + getServiceUnavailable, + getUnauthorized, } from '../src/error-utils'; describe('testing errors', () => { diff --git a/packages/core/core/test/merge.dist.tags.spec.ts b/packages/core/core/test/merge.dist.tags.spec.ts index 33a9fb786..eb0018528 100644 --- a/packages/core/core/test/merge.dist.tags.spec.ts +++ b/packages/core/core/test/merge.dist.tags.spec.ts @@ -1,4 +1,4 @@ -import { semverSort, mergeVersions } from '../src/pkg-utils'; +import { mergeVersions, semverSort } from '../src/pkg-utils'; describe('Storage._merge_versions versions', () => { test('simple', () => { diff --git a/packages/core/core/test/mystreams.spec.ts b/packages/core/core/test/mystreams.spec.ts index b7b604ace..e3eb221c2 100644 --- a/packages/core/core/test/mystreams.spec.ts +++ b/packages/core/core/test/mystreams.spec.ts @@ -1,5 +1,6 @@ import { Stream } from 'stream'; -import { readableToString, ReadTarball, UploadTarball } from '../src/stream-utils'; + +import { ReadTarball, UploadTarball, readableToString } from '../src/stream-utils'; describe('mystreams', () => { test('should delay events on ReadTarball abort', (cb) => { diff --git a/packages/core/core/test/validation-utilts.spec.ts b/packages/core/core/test/validation-utilts.spec.ts index 397f4f4bb..79d6c2200 100644 --- a/packages/core/core/test/validation-utilts.spec.ts +++ b/packages/core/core/test/validation-utilts.spec.ts @@ -1,4 +1,4 @@ -import { validateName, validatePackage, isObject } from '../src/validation-utils'; +import { isObject, validateName, validatePackage } from '../src/validation-utils'; describe('validatePackage', () => { test('should validate package names', () => { diff --git a/packages/core/file-locking/src/unclock.ts b/packages/core/file-locking/src/unclock.ts index ab1817611..a9a6a937f 100644 --- a/packages/core/file-locking/src/unclock.ts +++ b/packages/core/file-locking/src/unclock.ts @@ -1,4 +1,5 @@ import locker from 'lockfile'; + import { Callback } from '@verdaccio/types'; // unlocks file by removing existing lock file diff --git a/packages/core/file-locking/src/utils.ts b/packages/core/file-locking/src/utils.ts index fd7fd8cd6..a61ac5387 100644 --- a/packages/core/file-locking/src/utils.ts +++ b/packages/core/file-locking/src/utils.ts @@ -1,7 +1,6 @@ import fs from 'fs'; -import path from 'path'; - import locker from 'lockfile'; +import path from 'path'; export const statDir = (name: string): Promise => { return new Promise((resolve, reject): void => { diff --git a/packages/core/file-locking/tests/lock.spec.ts b/packages/core/file-locking/tests/lock.spec.ts index d2ec5dc8c..a6aec7e62 100644 --- a/packages/core/file-locking/tests/lock.spec.ts +++ b/packages/core/file-locking/tests/lock.spec.ts @@ -1,7 +1,7 @@ -import path from 'path'; import fs from 'fs'; +import path from 'path'; -import { lockFile, unlockFile, readFile } from '../src/index'; +import { lockFile, readFile, unlockFile } from '../src/index'; interface Error { message: string; diff --git a/packages/core/readme/src/index.ts b/packages/core/readme/src/index.ts index e88a690c5..b36942436 100644 --- a/packages/core/readme/src/index.ts +++ b/packages/core/readme/src/index.ts @@ -1,6 +1,6 @@ -import marked from 'marked'; import createDOMPurify from 'dompurify'; import { JSDOM } from 'jsdom'; +import marked from 'marked'; const DOMPurify = createDOMPurify(new JSDOM('').window); diff --git a/packages/core/server/debug/index.ts b/packages/core/server/debug/index.ts index 64d85dad0..09e1c55c9 100644 --- a/packages/core/server/debug/index.ts +++ b/packages/core/server/debug/index.ts @@ -1,7 +1,9 @@ -import path from 'path'; import buildDebug from 'debug'; +import path from 'path'; + import { parseConfigFile } from '@verdaccio/config'; -import { setup, logger } from '@verdaccio/logger'; +import { logger, setup } from '@verdaccio/logger'; + import server from '../src/index'; const debug = buildDebug('verdaccio:fastify:debug'); diff --git a/packages/core/server/src/endpoints/ping.ts b/packages/core/server/src/endpoints/ping.ts index 470e14509..0b2fb1491 100644 --- a/packages/core/server/src/endpoints/ping.ts +++ b/packages/core/server/src/endpoints/ping.ts @@ -1,8 +1,10 @@ /* eslint-disable no-console */ + /* eslint-disable no-invalid-this */ -import { logger } from '@verdaccio/logger'; import { FastifyInstance } from 'fastify'; +import { logger } from '@verdaccio/logger'; + async function pingRoute(fastify: FastifyInstance) { fastify.get('/-/ping', async () => { logger.http('ping endpoint'); diff --git a/packages/core/server/src/endpoints/search.ts b/packages/core/server/src/endpoints/search.ts index 0369ab56e..4831a76f1 100644 --- a/packages/core/server/src/endpoints/search.ts +++ b/packages/core/server/src/endpoints/search.ts @@ -1,8 +1,10 @@ /* eslint-disable no-console */ + /* eslint-disable no-invalid-this */ -import { logger } from '@verdaccio/logger'; import { FastifyInstance } from 'fastify'; +import { logger } from '@verdaccio/logger'; + async function searchRoute(fastify: FastifyInstance) { fastify.get('/-/v1/search', async (request, reply) => { // TODO: apply security layer here like in diff --git a/packages/core/server/src/endpoints/tarball.ts b/packages/core/server/src/endpoints/tarball.ts index 0e663543c..0e522f42c 100644 --- a/packages/core/server/src/endpoints/tarball.ts +++ b/packages/core/server/src/endpoints/tarball.ts @@ -1,5 +1,5 @@ -import { FastifyInstance } from 'fastify'; import buildDebug from 'debug'; +import { FastifyInstance } from 'fastify'; const debug = buildDebug('verdaccio:api:tarball'); diff --git a/packages/core/server/src/endpoints/user.ts b/packages/core/server/src/endpoints/user.ts index 6296bf2ea..30c689c71 100644 --- a/packages/core/server/src/endpoints/user.ts +++ b/packages/core/server/src/endpoints/user.ts @@ -1,13 +1,15 @@ /* eslint-disable no-console */ + /* eslint-disable no-invalid-this */ -import _ from 'lodash'; -import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils'; -import { RemoteUser } from '@verdaccio/types'; -import { logger } from '@verdaccio/logger'; -import { createRemoteUser } from '@verdaccio/config'; -import { getApiToken } from '@verdaccio/auth'; import buildDebug from 'debug'; import { FastifyInstance, FastifyRequest } from 'fastify'; +import _ from 'lodash'; + +import { getApiToken } from '@verdaccio/auth'; +import { createRemoteUser } from '@verdaccio/config'; +import { logger } from '@verdaccio/logger'; +import { RemoteUser } from '@verdaccio/types'; +import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils'; const debug = buildDebug('verdaccio:api:user'); diff --git a/packages/core/server/src/endpoints/whoami.ts b/packages/core/server/src/endpoints/whoami.ts index 9af7a0429..355de7b31 100644 --- a/packages/core/server/src/endpoints/whoami.ts +++ b/packages/core/server/src/endpoints/whoami.ts @@ -1,5 +1,5 @@ -import { FastifyInstance } from 'fastify'; import buildDebug from 'debug'; +import { FastifyInstance } from 'fastify'; const debug = buildDebug('verdaccio:api:whoami'); diff --git a/packages/core/server/src/plugins/auth.ts b/packages/core/server/src/plugins/auth.ts index 142ab011c..57de93fe6 100644 --- a/packages/core/server/src/plugins/auth.ts +++ b/packages/core/server/src/plugins/auth.ts @@ -1,7 +1,8 @@ -import fp from 'fastify-plugin'; -import { Config as IConfig } from '@verdaccio/types'; -import { Auth, IAuth } from '@verdaccio/auth'; import { FastifyInstance } from 'fastify'; +import fp from 'fastify-plugin'; + +import { Auth, IAuth } from '@verdaccio/auth'; +import { Config as IConfig } from '@verdaccio/types'; export default fp( async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) { diff --git a/packages/core/server/src/plugins/config.ts b/packages/core/server/src/plugins/config.ts index 40ab1deec..49269a5ca 100644 --- a/packages/core/server/src/plugins/config.ts +++ b/packages/core/server/src/plugins/config.ts @@ -1,8 +1,8 @@ +import { FastifyInstance } from 'fastify'; import fp from 'fastify-plugin'; -import { Config as IConfig, ConfigRuntime } from '@verdaccio/types'; import { Config as AppConfig } from '@verdaccio/config'; -import { FastifyInstance } from 'fastify'; +import { ConfigRuntime, Config as IConfig } from '@verdaccio/types'; export default fp( async function (fastify: FastifyInstance, opts: { config: ConfigRuntime }) { diff --git a/packages/core/server/src/plugins/coreUtils.ts b/packages/core/server/src/plugins/coreUtils.ts index 96c516d7d..b6fe81a1a 100644 --- a/packages/core/server/src/plugins/coreUtils.ts +++ b/packages/core/server/src/plugins/coreUtils.ts @@ -1,6 +1,6 @@ import fp from 'fastify-plugin'; -import { errorUtils, validatioUtils, API_ERROR, API_MESSAGE, HTTP_STATUS } from '@verdaccio/core'; +import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils, validatioUtils } from '@verdaccio/core'; export default fp( async function (fastify) { diff --git a/packages/core/server/src/plugins/storage.ts b/packages/core/server/src/plugins/storage.ts index 4d4d28bb2..92355c6c4 100644 --- a/packages/core/server/src/plugins/storage.ts +++ b/packages/core/server/src/plugins/storage.ts @@ -1,7 +1,8 @@ -import fp from 'fastify-plugin'; -import { Config as IConfig } from '@verdaccio/types'; -import { Storage } from '@verdaccio/store'; import { FastifyInstance } from 'fastify'; +import fp from 'fastify-plugin'; + +import { Storage } from '@verdaccio/store'; +import { Config as IConfig } from '@verdaccio/types'; export default fp( async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) { diff --git a/packages/core/server/src/server.ts b/packages/core/server/src/server.ts index 20eefd9a2..a6f70e2f5 100644 --- a/packages/core/server/src/server.ts +++ b/packages/core/server/src/server.ts @@ -1,18 +1,18 @@ -import { Config as IConfig, RemoteUser } from '@verdaccio/types'; -import { Config as AppConfig, createAnonymousRemoteUser } from '@verdaccio/config'; - -import fastify from 'fastify'; import buildDebug from 'debug'; +import fastify from 'fastify'; + +import { Config as AppConfig, createAnonymousRemoteUser } from '@verdaccio/config'; +import { Config as IConfig, RemoteUser } from '@verdaccio/types'; -import search from './endpoints/search'; -import storagePlugin from './plugins/storage'; -import authPlugin from './plugins/auth'; -import coreUtils from './plugins/coreUtils'; -import configPlugin from './plugins/config'; import ping from './endpoints/ping'; +import search from './endpoints/search'; +import tarball from './endpoints/tarball'; import user from './endpoints/user'; import whoami from './endpoints/whoami'; -import tarball from './endpoints/tarball'; +import authPlugin from './plugins/auth'; +import configPlugin from './plugins/config'; +import coreUtils from './plugins/coreUtils'; +import storagePlugin from './plugins/storage'; const debug = buildDebug('verdaccio:fastify'); diff --git a/packages/core/tarball/src/convertDistRemoteToLocalTarballUrls.ts b/packages/core/tarball/src/convertDistRemoteToLocalTarballUrls.ts index 6c543be22..7b6686d03 100644 --- a/packages/core/tarball/src/convertDistRemoteToLocalTarballUrls.ts +++ b/packages/core/tarball/src/convertDistRemoteToLocalTarballUrls.ts @@ -1,6 +1,7 @@ +import _ from 'lodash'; + import { Package } from '@verdaccio/types'; import { RequestOptions } from '@verdaccio/url'; -import _ from 'lodash'; import { getLocalRegistryTarballUri } from './getLocalRegistryTarballUri'; diff --git a/packages/core/tarball/src/getLocalRegistryTarballUri.ts b/packages/core/tarball/src/getLocalRegistryTarballUri.ts index 38814a608..f70fb0026 100644 --- a/packages/core/tarball/src/getLocalRegistryTarballUri.ts +++ b/packages/core/tarball/src/getLocalRegistryTarballUri.ts @@ -1,7 +1,7 @@ -import URL from 'url'; -import { RequestOptions } from '@verdaccio/url'; import buildDebug from 'debug'; +import URL from 'url'; +import { RequestOptions } from '@verdaccio/url'; import { getPublicUrl } from '@verdaccio/url'; const debug = buildDebug('verdaccio:core:url'); diff --git a/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts b/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts index 3a7144f7d..48fef9fb4 100644 --- a/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts +++ b/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts @@ -1,5 +1,7 @@ import * as httpMocks from 'node-mocks-http'; + import { HEADERS } from '@verdaccio/core'; + import { convertDistRemoteToLocalTarballUrls } from '../src'; describe('convertDistRemoteToLocalTarballUrls', () => { diff --git a/packages/core/types/index.d.ts b/packages/core/types/index.d.ts index 5674cb217..182cff38b 100644 --- a/packages/core/types/index.d.ts +++ b/packages/core/types/index.d.ts @@ -1,6 +1,6 @@ /// - import { PassThrough } from 'stream'; + declare module '@verdaccio/types' { type StringValue = string | void | null; diff --git a/packages/core/url/src/index.ts b/packages/core/url/src/index.ts index 8f475c826..b552e186e 100644 --- a/packages/core/url/src/index.ts +++ b/packages/core/url/src/index.ts @@ -1,6 +1,7 @@ -import { URL } from 'url'; import buildDebug from 'debug'; +import { URL } from 'url'; import isURLValidator from 'validator/lib/isURL'; + import { HEADERS } from '@verdaccio/core'; const debug = buildDebug('verdaccio:core:url'); diff --git a/packages/core/url/tests/getPublicUrl.spec.ts b/packages/core/url/tests/getPublicUrl.spec.ts index 05213bf86..26d36acd6 100644 --- a/packages/core/url/tests/getPublicUrl.spec.ts +++ b/packages/core/url/tests/getPublicUrl.spec.ts @@ -1,6 +1,7 @@ import * as httpMocks from 'node-mocks-http'; import { HEADERS } from '@verdaccio/core'; + import { getPublicUrl } from '../src'; describe('host', () => { diff --git a/packages/hooks/src/notify-request.ts b/packages/hooks/src/notify-request.ts index b97005896..544fcc176 100644 --- a/packages/hooks/src/notify-request.ts +++ b/packages/hooks/src/notify-request.ts @@ -1,7 +1,7 @@ import buildDebug from 'debug'; -import { logger } from '@verdaccio/logger'; import { HTTP_STATUS } from '@verdaccio/core'; +import { logger } from '@verdaccio/logger'; const debug = buildDebug('verdaccio:hooks:request'); const fetch = require('undici-fetch'); diff --git a/packages/hooks/src/notify.ts b/packages/hooks/src/notify.ts index 1da0bbed5..f0ee1a081 100644 --- a/packages/hooks/src/notify.ts +++ b/packages/hooks/src/notify.ts @@ -1,11 +1,11 @@ /* eslint-disable no-undef */ - +import buildDebug from 'debug'; import Handlebars from 'handlebars'; -import buildDebug from 'debug'; -import { Config, Package, RemoteUser, Notification } from '@verdaccio/types'; import { logger } from '@verdaccio/logger'; -import { notifyRequest, FetchOptions } from './notify-request'; +import { Config, Notification, Package, RemoteUser } from '@verdaccio/types'; + +import { FetchOptions, notifyRequest } from './notify-request'; const debug = buildDebug('verdaccio:hooks'); diff --git a/packages/hooks/test/notify-request.spec.ts b/packages/hooks/test/notify-request.spec.ts index 300b6255c..5eecb2492 100644 --- a/packages/hooks/test/notify-request.spec.ts +++ b/packages/hooks/test/notify-request.spec.ts @@ -1,6 +1,7 @@ +import { createRemoteUser, parseConfigFile } from '@verdaccio/config'; import { setup } from '@verdaccio/logger'; import { Config } from '@verdaccio/types'; -import { parseConfigFile, createRemoteUser } from '@verdaccio/config'; + import { notify } from '../src/notify'; import { parseConfigurationFile } from './__helper'; diff --git a/packages/loaders/src/plugin-loader.ts b/packages/loaders/src/plugin-loader.ts index e70522580..0ff0a0b91 100644 --- a/packages/loaders/src/plugin-loader.ts +++ b/packages/loaders/src/plugin-loader.ts @@ -1,6 +1,6 @@ -import Path from 'path'; -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; +import Path from 'path'; import { logger } from '@verdaccio/logger'; import { Config, IPlugin } from '@verdaccio/types'; diff --git a/packages/loaders/test/plugin_loader.spec.ts b/packages/loaders/test/plugin_loader.spec.ts index 8a6c610d6..abb5ec9cd 100644 --- a/packages/loaders/test/plugin_loader.spec.ts +++ b/packages/loaders/test/plugin_loader.spec.ts @@ -1,4 +1,5 @@ import path from 'path'; + import { setup } from '@verdaccio/logger'; import { loadPlugin } from '../src/plugin-loader'; diff --git a/packages/logger-prettify/src/formatter.ts b/packages/logger-prettify/src/formatter.ts index 9a96f6200..4069c7415 100644 --- a/packages/logger-prettify/src/formatter.ts +++ b/packages/logger-prettify/src/formatter.ts @@ -1,9 +1,9 @@ +import { green, red, white } from 'kleur'; import { inspect } from 'util'; -import { white, red, green } from 'kleur'; -import { calculateLevel, LevelCode, levelsColors, subSystemLevels } from './levels'; -import { formatLoggingDate, isObject, padLeft, padRight } from './utils'; +import { LevelCode, calculateLevel, levelsColors, subSystemLevels } from './levels'; import { PrettyOptionsExtended } from './types'; +import { formatLoggingDate, isObject, padLeft, padRight } from './utils'; let LEVEL_VALUE_MAX = 0; for (const l in levelsColors) { diff --git a/packages/logger-prettify/src/levels.ts b/packages/logger-prettify/src/levels.ts index cf564467a..a8f4a0db8 100644 --- a/packages/logger-prettify/src/levels.ts +++ b/packages/logger-prettify/src/levels.ts @@ -1,4 +1,4 @@ -import { yellow, green, red, magenta, black, blue, cyan, white } from 'kleur'; +import { black, blue, cyan, green, magenta, red, white, yellow } from 'kleur'; export type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal'; diff --git a/packages/logger-prettify/src/utils.ts b/packages/logger-prettify/src/utils.ts index dbd80f527..0fe1460da 100644 --- a/packages/logger-prettify/src/utils.ts +++ b/packages/logger-prettify/src/utils.ts @@ -1,5 +1,5 @@ -import _ from 'lodash'; import dayjs from 'dayjs'; +import _ from 'lodash'; export const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss'; export const CUSTOM_PAD_LENGTH = 1; diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index e8e4353f9..3d8b9b0e6 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -1,6 +1,7 @@ -import pino from 'pino'; -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; +import pino from 'pino'; + import { warningUtils } from '@verdaccio/core'; const debug = buildDebug('verdaccio:logger'); diff --git a/packages/logger/test/logger.spec.ts b/packages/logger/test/logger.spec.ts index fb6682779..b6ce6f99d 100644 --- a/packages/logger/test/logger.spec.ts +++ b/packages/logger/test/logger.spec.ts @@ -1,4 +1,5 @@ import { warningUtils } from '@verdaccio/core'; + import { logger, setup } from '../src'; const mockWarningUtils = jest.fn(); diff --git a/packages/middleware/src/middleware.ts b/packages/middleware/src/middleware.ts index 1ab55abb6..5d79f5080 100644 --- a/packages/middleware/src/middleware.ts +++ b/packages/middleware/src/middleware.ts @@ -1,29 +1,28 @@ -import _ from 'lodash'; import buildDebug from 'debug'; - -import { - validateName as utilValidateName, - validatePackage as utilValidatePackage, - isObject, - stringToMD5, -} from '@verdaccio/utils'; - import { NextFunction, Request, Response } from 'express'; +import { HttpError } from 'http-errors'; +import _ from 'lodash'; -import { Config, Package, RemoteUser, Logger } from '@verdaccio/types'; -import { logger } from '@verdaccio/logger'; import { IAuth } from '@verdaccio/auth'; import { - errorUtils, API_ERROR, - HEADER_TYPE, HEADERS, + HEADER_TYPE, HTTP_STATUS, TOKEN_BASIC, TOKEN_BEARER, VerdaccioError, + errorUtils, } from '@verdaccio/core'; -import { HttpError } from 'http-errors'; +import { logger } from '@verdaccio/logger'; +import { Config, Logger, Package, RemoteUser } from '@verdaccio/types'; +import { + isObject, + stringToMD5, + validateName as utilValidateName, + validatePackage as utilValidatePackage, +} from '@verdaccio/utils'; + import { getVersionFromTarball } from './middleware-utils'; export type $RequestExtend = Request & { remote_user?: RemoteUser; log: Logger }; diff --git a/packages/middleware/types/custom.d.ts b/packages/middleware/types/custom.d.ts index c9f461f5b..c4903c261 100644 --- a/packages/middleware/types/custom.d.ts +++ b/packages/middleware/types/custom.d.ts @@ -1,6 +1,6 @@ // - import * as http from 'http'; + import { Logger, RemoteUser } from '@verdaccio/types'; declare global { diff --git a/packages/node-api/src/server.ts b/packages/node-api/src/server.ts index 6e153a74d..eb122869e 100644 --- a/packages/node-api/src/server.ts +++ b/packages/node-api/src/server.ts @@ -1,17 +1,18 @@ /* eslint-disable */ -import _, { assign, isFunction } from 'lodash'; -import http from 'http'; -import https from 'https'; import constants from 'constants'; import buildDebug from 'debug'; import fs from 'fs'; +import http from 'http'; +import https from 'https'; +import _, { assign, isFunction } from 'lodash'; import url from 'url'; import { findConfigFile, parseConfigFile } from '@verdaccio/config'; import { API_ERROR } from '@verdaccio/core'; -import { ConfigRuntime, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types'; -import { setup, logger } from '@verdaccio/logger'; +import { logger, setup } from '@verdaccio/logger'; import server from '@verdaccio/server'; +import { ConfigRuntime, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types'; + import { getListListenAddresses } from './cli-utils'; import { displayExperimentsInfoBox } from './experiments'; diff --git a/packages/node-api/test/node-api.utils.spec.ts b/packages/node-api/test/node-api.utils.spec.ts index c0663e9ea..8ecc7810e 100644 --- a/packages/node-api/test/node-api.utils.spec.ts +++ b/packages/node-api/test/node-api.utils.spec.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import { DEFAULT_DOMAIN, DEFAULT_PORT, diff --git a/packages/node-api/test/parseAddress.spec.ts b/packages/node-api/test/parseAddress.spec.ts index 068bd95bb..1ffb241e0 100644 --- a/packages/node-api/test/parseAddress.spec.ts +++ b/packages/node-api/test/parseAddress.spec.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import { DEFAULT_DOMAIN, DEFAULT_PORT, parseAddress } from '../src/cli-utils'; describe('Parse listen address', () => { diff --git a/packages/node-api/test/run-server.spec.ts b/packages/node-api/test/run-server.spec.ts index 22562fe4b..99ba82fdf 100644 --- a/packages/node-api/test/run-server.spec.ts +++ b/packages/node-api/test/run-server.spec.ts @@ -1,5 +1,7 @@ import request from 'supertest'; + import { runServer } from '../src'; + describe('startServer via API', () => { test('should provide all HTTP server data', async () => { const webServer = await runServer(); diff --git a/packages/plugins/active-directory/src/active-directory.ts b/packages/plugins/active-directory/src/active-directory.ts index c2a8ec128..08095cd86 100644 --- a/packages/plugins/active-directory/src/active-directory.ts +++ b/packages/plugins/active-directory/src/active-directory.ts @@ -1,6 +1,7 @@ +import ActiveDirectory from 'activedirectory2'; + import { errorUtils } from '@verdaccio/core'; import { Callback, IPluginAuth, Logger } from '@verdaccio/types'; -import ActiveDirectory from 'activedirectory2'; export const NotAuthMessage = 'AD - Active Directory authentication failed'; diff --git a/packages/plugins/active-directory/tests/active-directory.test.ts b/packages/plugins/active-directory/tests/active-directory.test.ts index 2082bc824..d1e14787f 100644 --- a/packages/plugins/active-directory/tests/active-directory.test.ts +++ b/packages/plugins/active-directory/tests/active-directory.test.ts @@ -1,8 +1,8 @@ import ActiveDirectory from 'activedirectory2'; + import { HTTP_STATUS } from '@verdaccio/core'; import ActiveDirectoryPlugin, { NotAuthMessage } from '../src/active-directory'; - // eslint-disable-next-line jest/no-mocks-import import logger from './__mocks__/Logger'; diff --git a/packages/plugins/audit/src/audit.ts b/packages/plugins/audit/src/audit.ts index 042e050c0..3123c1d01 100644 --- a/packages/plugins/audit/src/audit.ts +++ b/packages/plugins/audit/src/audit.ts @@ -1,11 +1,11 @@ -import https from 'https'; - -import fetch from 'node-fetch'; -import createHttpsProxyAgent from 'https-proxy-agent'; -import express, { Request, Response } from 'express'; -import { Logger, IPluginMiddleware, IBasicAuth, PluginOptions } from '@verdaccio/types'; - import { json as jsonParser } from 'body-parser'; +import express, { Request, Response } from 'express'; +import https from 'https'; +import createHttpsProxyAgent from 'https-proxy-agent'; +import fetch from 'node-fetch'; + +import { IBasicAuth, IPluginMiddleware, Logger, PluginOptions } from '@verdaccio/types'; + import { ConfigAudit } from './types'; // FUTURE: we should be able to overwrite this diff --git a/packages/plugins/auth-memory/src/Memory.ts b/packages/plugins/auth-memory/src/Memory.ts index 59111ec70..318c5221c 100644 --- a/packages/plugins/auth-memory/src/Memory.ts +++ b/packages/plugins/auth-memory/src/Memory.ts @@ -1,15 +1,16 @@ import buildDebug from 'debug'; -import { - PluginOptions, - Callback, - PackageAccess, - IPluginAuth, - RemoteUser, - Logger, -} from '@verdaccio/types'; -import { errorUtils, API_ERROR } from '@verdaccio/core'; -import { VerdaccioMemoryConfig, Users, UserMemory } from './types'; +import { API_ERROR, errorUtils } from '@verdaccio/core'; +import { + Callback, + IPluginAuth, + Logger, + PackageAccess, + PluginOptions, + RemoteUser, +} from '@verdaccio/types'; + +import { UserMemory, Users, VerdaccioMemoryConfig } from './types'; const debug = buildDebug('verdaccio:plugin:auth:memory:user'); diff --git a/packages/plugins/auth-memory/test/index.spec.ts b/packages/plugins/auth-memory/test/index.spec.ts index 77494c601..677026095 100644 --- a/packages/plugins/auth-memory/test/index.spec.ts +++ b/packages/plugins/auth-memory/test/index.spec.ts @@ -1,7 +1,7 @@ import { Callback } from '@verdaccio/types'; -import { VerdaccioMemoryConfig } from '../src/types'; import Memory from '../src/index'; +import { VerdaccioMemoryConfig } from '../src/types'; describe('Memory', function () { let auth; diff --git a/packages/plugins/aws-storage/src/index.ts b/packages/plugins/aws-storage/src/index.ts index bdd0f9bd3..7b0db33b7 100644 --- a/packages/plugins/aws-storage/src/index.ts +++ b/packages/plugins/aws-storage/src/index.ts @@ -1,19 +1,20 @@ +import { S3 } from 'aws-sdk'; + +import { VerdaccioError, errorUtils } from '@verdaccio/core'; import { - LocalStorage, - Logger, Config, IPluginStorage, + LocalStorage, + Logger, PluginOptions, Token, TokenFilter, } from '@verdaccio/types'; -import { errorUtils, VerdaccioError } from '@verdaccio/core'; -import { S3 } from 'aws-sdk'; -import { S3Config } from './config'; -import S3PackageManager from './s3PackageManager'; -import { convertS3Error, is404Error } from './s3Errors'; import addTrailingSlash from './addTrailingSlash'; +import { S3Config } from './config'; +import { convertS3Error, is404Error } from './s3Errors'; +import S3PackageManager from './s3PackageManager'; import setConfigValue from './setConfigValue'; export default class S3Database implements IPluginStorage { diff --git a/packages/plugins/aws-storage/src/s3Errors.ts b/packages/plugins/aws-storage/src/s3Errors.ts index ad5de8926..f633dd53e 100644 --- a/packages/plugins/aws-storage/src/s3Errors.ts +++ b/packages/plugins/aws-storage/src/s3Errors.ts @@ -1,5 +1,6 @@ import { AWSError } from 'aws-sdk'; -import { errorUtils, API_ERROR, HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; + +import { API_ERROR, HTTP_STATUS, VerdaccioError, errorUtils } from '@verdaccio/core'; export function is404Error(err: VerdaccioError): boolean { return err.code === HTTP_STATUS.NOT_FOUND; diff --git a/packages/plugins/aws-storage/src/s3PackageManager.ts b/packages/plugins/aws-storage/src/s3PackageManager.ts index 70ce47dea..bdbc97365 100644 --- a/packages/plugins/aws-storage/src/s3PackageManager.ts +++ b/packages/plugins/aws-storage/src/s3PackageManager.ts @@ -1,13 +1,14 @@ -import { S3, AWSError } from 'aws-sdk'; -import { UploadTarball, ReadTarball } from '@verdaccio/streams'; -import { HEADERS, HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; -import { Callback, Logger, Package, ILocalPackageManager, CallbackAction } from '@verdaccio/types'; +import { AWSError, S3 } from 'aws-sdk'; import { HttpError } from 'http-errors'; -import { is404Error, convertS3Error, create409Error } from './s3Errors'; -import { deleteKeyPrefix } from './deleteKeyPrefix'; -import { S3Config } from './config'; +import { HEADERS, HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; +import { ReadTarball, UploadTarball } from '@verdaccio/streams'; +import { Callback, CallbackAction, ILocalPackageManager, Logger, Package } from '@verdaccio/types'; + import addTrailingSlash from './addTrailingSlash'; +import { S3Config } from './config'; +import { deleteKeyPrefix } from './deleteKeyPrefix'; +import { convertS3Error, create409Error, is404Error } from './s3Errors'; const pkgFileName = 'package.json'; diff --git a/packages/plugins/aws-storage/tests/index.test.ts b/packages/plugins/aws-storage/tests/index.test.ts index 0d442ef21..56fd5a457 100644 --- a/packages/plugins/aws-storage/tests/index.test.ts +++ b/packages/plugins/aws-storage/tests/index.test.ts @@ -1,13 +1,13 @@ import { S3 } from 'aws-sdk'; + import { IPluginStorage } from '@verdaccio/types'; -import S3Database from '../src/index'; -import { deleteKeyPrefix } from '../src/deleteKeyPrefix'; -import { is404Error } from '../src/s3Errors'; import { S3Config } from '../src/config'; - -import logger from './__mocks__/Logger'; +import { deleteKeyPrefix } from '../src/deleteKeyPrefix'; +import S3Database from '../src/index'; +import { is404Error } from '../src/s3Errors'; import Config from './__mocks__/Config'; +import logger from './__mocks__/Logger'; describe.skip('Local Database', () => { let db: IPluginStorage; diff --git a/packages/plugins/aws-storage/tests/s3PackageManager.test.ts b/packages/plugins/aws-storage/tests/s3PackageManager.test.ts index fbe95306e..328f45fb7 100644 --- a/packages/plugins/aws-storage/tests/s3PackageManager.test.ts +++ b/packages/plugins/aws-storage/tests/s3PackageManager.test.ts @@ -1,17 +1,16 @@ -import path from 'path'; -import fs from 'fs'; - import { S3 } from 'aws-sdk'; +import fs from 'fs'; +import path from 'path'; import rReadDir from 'recursive-readdir'; + import { Package } from '@verdaccio/types'; -import S3PackageManager from '../src/s3PackageManager'; +import { S3Config } from '../src/config'; import { deleteKeyPrefix } from '../src/deleteKeyPrefix'; import { create404Error, create409Error, is404Error } from '../src/s3Errors'; -import { S3Config } from '../src/config'; - -import logger from './__mocks__/Logger'; +import S3PackageManager from '../src/s3PackageManager'; import pkg from './__fixtures__/pkg'; +import logger from './__mocks__/Logger'; const pkgFileName = 'package.json'; diff --git a/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts b/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts index f116dd5ec..31b8401b2 100644 --- a/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts +++ b/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts @@ -1,10 +1,9 @@ import { PackageAccess } from '@verdaccio/types'; -import S3PackageManager from '../src/s3PackageManager'; import { S3Config } from '../src/config'; - -import logger from './__mocks__/Logger'; +import S3PackageManager from '../src/s3PackageManager'; import pkg from './__fixtures__/pkg'; +import logger from './__mocks__/Logger'; const mockHeadObject = jest.fn(); const mockPutObject = jest.fn(); diff --git a/packages/plugins/google-cloud-storage/src/data-storage.ts b/packages/plugins/google-cloud-storage/src/data-storage.ts index db96e89a6..8e44bf918 100644 --- a/packages/plugins/google-cloud-storage/src/data-storage.ts +++ b/packages/plugins/google-cloud-storage/src/data-storage.ts @@ -1,21 +1,23 @@ -import { Storage } from '@google-cloud/storage'; import { Datastore, DatastoreOptions } from '@google-cloud/datastore'; -import { errorUtils, VerdaccioError } from '@verdaccio/core'; +import { entity } from '@google-cloud/datastore/build/src/entity'; +import { RunQueryResponse } from '@google-cloud/datastore/build/src/query'; +import { CommitResponse } from '@google-cloud/datastore/build/src/request'; +import { Storage } from '@google-cloud/storage'; + +import { VerdaccioError, errorUtils } from '@verdaccio/core'; import { - Logger, Callback, + IPackageStorageManager, IPluginStorage, + Logger, Token, TokenFilter, - IPackageStorageManager, } from '@verdaccio/types'; -import { CommitResponse } from '@google-cloud/datastore/build/src/request'; -import { RunQueryResponse } from '@google-cloud/datastore/build/src/query'; -import { entity } from '@google-cloud/datastore/build/src/entity'; -import { VerdaccioConfigGoogleStorage, GoogleDataStorage } from './types'; -import StorageHelper, { IStorageHelper } from './storage-helper'; import GoogleCloudStorageHandler from './storage'; +import StorageHelper, { IStorageHelper } from './storage-helper'; +import { GoogleDataStorage, VerdaccioConfigGoogleStorage } from './types'; + type Key = entity.Key; export const ERROR_MISSING_CONFIG = diff --git a/packages/plugins/google-cloud-storage/src/storage-helper.ts b/packages/plugins/google-cloud-storage/src/storage-helper.ts index 0e0a310ec..ae4f9627b 100644 --- a/packages/plugins/google-cloud-storage/src/storage-helper.ts +++ b/packages/plugins/google-cloud-storage/src/storage-helper.ts @@ -1,6 +1,6 @@ import { Datastore, Query } from '@google-cloud/datastore'; -import { Bucket, File, Storage } from '@google-cloud/storage'; import { RunQueryResponse } from '@google-cloud/datastore/build/src/query'; +import { Bucket, File, Storage } from '@google-cloud/storage'; import { VerdaccioConfigGoogleStorage } from './types'; diff --git a/packages/plugins/google-cloud-storage/src/storage.ts b/packages/plugins/google-cloud-storage/src/storage.ts index 330c15468..4312525ae 100644 --- a/packages/plugins/google-cloud-storage/src/storage.ts +++ b/packages/plugins/google-cloud-storage/src/storage.ts @@ -1,20 +1,20 @@ +import { DownloadResponse, File } from '@google-cloud/storage'; +import { Response } from 'request'; import { Readable } from 'stream'; -import { UploadTarball, ReadTarball } from '@verdaccio/streams'; +import { HTTP_STATUS, VerdaccioError, errorUtils } from '@verdaccio/core'; +import { ReadTarball, UploadTarball } from '@verdaccio/streams'; import { - Package, Callback, - Logger, + CallbackAction, IPackageStorageManager, + Logger, + Package, + PackageTransformer, + ReadPackageCallback, StorageUpdateCallback, StorageWriteCallback, - PackageTransformer, - CallbackAction, - ReadPackageCallback, } from '@verdaccio/types'; -import { File, DownloadResponse } from '@google-cloud/storage'; -import { errorUtils, VerdaccioError, HTTP_STATUS } from '@verdaccio/core'; -import { Response } from 'request'; import { IStorageHelper } from './storage-helper'; import { VerdaccioConfigGoogleStorage } from './types'; diff --git a/packages/plugins/google-cloud-storage/src/types/index.ts b/packages/plugins/google-cloud-storage/src/types/index.ts index 5c6ffa101..24d832339 100644 --- a/packages/plugins/google-cloud-storage/src/types/index.ts +++ b/packages/plugins/google-cloud-storage/src/types/index.ts @@ -1,4 +1,5 @@ import { Datastore } from '@google-cloud/datastore'; + import { Config } from '@verdaccio/types'; export interface VerdaccioConfigGoogleStorage extends Config { diff --git a/packages/plugins/google-cloud-storage/tests/datastore.spec.ts b/packages/plugins/google-cloud-storage/tests/datastore.spec.ts index 37195dd61..aced594a3 100644 --- a/packages/plugins/google-cloud-storage/tests/datastore.spec.ts +++ b/packages/plugins/google-cloud-storage/tests/datastore.spec.ts @@ -1,10 +1,10 @@ import _ from 'lodash'; -import { Logger, ILocalPackageManager } from '@verdaccio/types'; -import { VerdaccioError, HTTP_STATUS } from '@verdaccio/core'; + +import { HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; +import { ILocalPackageManager, Logger } from '@verdaccio/types'; import { ERROR_MISSING_CONFIG } from '../src/data-storage'; import { VerdaccioConfigGoogleStorage } from '../src/types'; - import storageConfig from './partials/config'; const loggerDefault: Logger = { diff --git a/packages/plugins/google-cloud-storage/tests/storage.spec.ts b/packages/plugins/google-cloud-storage/tests/storage.spec.ts index b2582a35b..1b5b7cf22 100644 --- a/packages/plugins/google-cloud-storage/tests/storage.spec.ts +++ b/packages/plugins/google-cloud-storage/tests/storage.spec.ts @@ -1,15 +1,14 @@ +import { DownloadResponse } from '@google-cloud/storage'; import fs from 'fs'; import path from 'path'; import { Writable } from 'stream'; -import { DownloadResponse } from '@google-cloud/storage'; +import { API_ERROR, HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; import { IPackageStorageManager } from '@verdaccio/types'; -import { Logger, ILocalData, Callback, Package, IPackageStorage } from '@verdaccio/types'; -import { HTTP_STATUS, API_ERROR, VerdaccioError } from '@verdaccio/core'; +import { Callback, ILocalData, IPackageStorage, Logger, Package } from '@verdaccio/types'; import { pkgFileName } from '../src/storage'; import { VerdaccioConfigGoogleStorage } from '../src/types'; - import storageConfig from './partials/config'; import pkgExample from './partials/pkg'; import { generatePackage } from './partials/utils.helpers'; diff --git a/packages/plugins/htpasswd/src/crypt3.ts b/packages/plugins/htpasswd/src/crypt3.ts index 41fcdcf04..56395d045 100644 --- a/packages/plugins/htpasswd/src/crypt3.ts +++ b/packages/plugins/htpasswd/src/crypt3.ts @@ -5,9 +5,7 @@ which is not platform independent, and requires compilation. Instead, a pure javascript version is used. */ - import crypto from 'crypto'; - import crypt from 'unix-crypt-td-js'; export enum EncryptionMethod { diff --git a/packages/plugins/htpasswd/src/htpasswd.ts b/packages/plugins/htpasswd/src/htpasswd.ts index d74045b46..ee7469453 100644 --- a/packages/plugins/htpasswd/src/htpasswd.ts +++ b/packages/plugins/htpasswd/src/htpasswd.ts @@ -1,18 +1,18 @@ import fs from 'fs'; import Path from 'path'; -import { Callback, Config, IPluginAuth, Logger, PluginOptions } from '@verdaccio/types'; import { unlockFile } from '@verdaccio/file-locking'; +import { Callback, Config, IPluginAuth, Logger, PluginOptions } from '@verdaccio/types'; import { - verifyPassword, - lockAndRead, - parseHTPasswd, - addUserToHTPasswd, - changePasswordToHTPasswd, - sanityCheck, HtpasswdHashAlgorithm, HtpasswdHashConfig, + addUserToHTPasswd, + changePasswordToHTPasswd, + lockAndRead, + parseHTPasswd, + sanityCheck, + verifyPassword, } from './utils'; export type HTPasswdConfig = { diff --git a/packages/plugins/htpasswd/src/utils.ts b/packages/plugins/htpasswd/src/utils.ts index 22bb54a67..958b0c6e2 100644 --- a/packages/plugins/htpasswd/src/utils.ts +++ b/packages/plugins/htpasswd/src/utils.ts @@ -1,11 +1,11 @@ -import crypto from 'crypto'; - import md5 from 'apache-md5'; import bcrypt from 'bcryptjs'; +import crypto from 'crypto'; import createError, { HttpError } from 'http-errors'; + +import { API_ERROR, HTTP_STATUS } from '@verdaccio/core'; import { readFile } from '@verdaccio/file-locking'; import { Callback } from '@verdaccio/types'; -import { API_ERROR, HTTP_STATUS } from '@verdaccio/core'; import crypt3 from './crypt3'; diff --git a/packages/plugins/htpasswd/tests/crypt3.test.ts b/packages/plugins/htpasswd/tests/crypt3.test.ts index 50ec4feb4..7df7c7f12 100644 --- a/packages/plugins/htpasswd/tests/crypt3.test.ts +++ b/packages/plugins/htpasswd/tests/crypt3.test.ts @@ -1,4 +1,4 @@ -import { createSalt, EncryptionMethod } from '../src/crypt3'; +import { EncryptionMethod, createSalt } from '../src/crypt3'; jest.mock('crypto', () => { return { diff --git a/packages/plugins/htpasswd/tests/htpasswd.test.ts b/packages/plugins/htpasswd/tests/htpasswd.test.ts index 226e2d8e9..1f6fce945 100644 --- a/packages/plugins/htpasswd/tests/htpasswd.test.ts +++ b/packages/plugins/htpasswd/tests/htpasswd.test.ts @@ -2,15 +2,13 @@ import crypto from 'crypto'; // @ts-ignore import fs from 'fs'; - import MockDate from 'mockdate'; import HTPasswd, { VerdaccioConfigApp } from '../src/htpasswd'; import { HtpasswdHashAlgorithm } from '../src/utils'; - +import Config from './__mocks__/Config'; // FIXME: remove this mocks imports import Logger from './__mocks__/Logger'; -import Config from './__mocks__/Config'; const stuff = { logger: new Logger(), diff --git a/packages/plugins/htpasswd/tests/utils.test.ts b/packages/plugins/htpasswd/tests/utils.test.ts index 549e1e430..11752261f 100644 --- a/packages/plugins/htpasswd/tests/utils.test.ts +++ b/packages/plugins/htpasswd/tests/utils.test.ts @@ -1,17 +1,16 @@ import crypto from 'crypto'; - import MockDate from 'mockdate'; import { DEFAULT_BCRYPT_ROUNDS } from '../src/htpasswd'; import { - verifyPassword, - lockAndRead, - parseHTPasswd, + HtpasswdHashAlgorithm, addUserToHTPasswd, - sanityCheck, changePasswordToHTPasswd, generateHtpasswdLine, - HtpasswdHashAlgorithm, + lockAndRead, + parseHTPasswd, + sanityCheck, + verifyPassword, } from '../src/utils'; const mockReadFile = jest.fn(); diff --git a/packages/plugins/local-storage/src/dir-utils.ts b/packages/plugins/local-storage/src/dir-utils.ts index e659e07bb..4b845c307 100644 --- a/packages/plugins/local-storage/src/dir-utils.ts +++ b/packages/plugins/local-storage/src/dir-utils.ts @@ -1,6 +1,7 @@ -import { join } from 'path'; -import globby from 'globby'; import buildDebug from 'debug'; +import globby from 'globby'; +import { join } from 'path'; + import { searchUtils, validatioUtils } from '@verdaccio/core'; const debug = buildDebug('verdaccio:plugin:local-storage:utils'); diff --git a/packages/plugins/local-storage/src/fs.ts b/packages/plugins/local-storage/src/fs.ts index b3e20818b..01d018445 100644 --- a/packages/plugins/local-storage/src/fs.ts +++ b/packages/plugins/local-storage/src/fs.ts @@ -1,5 +1,5 @@ -import { promisify } from 'util'; import fs from 'fs'; +import { promisify } from 'util'; // FUTURE: when v15 is min replace by fs/promises const readFile = promisify(fs.readFile); diff --git a/packages/plugins/local-storage/src/local-database.ts b/packages/plugins/local-storage/src/local-database.ts index 58433ffd1..8e55e55f7 100644 --- a/packages/plugins/local-storage/src/local-database.ts +++ b/packages/plugins/local-storage/src/local-database.ts @@ -1,16 +1,17 @@ -import path from 'path'; // import LRU from 'lru-cache'; import buildDebug from 'debug'; import _ from 'lodash'; +import path from 'path'; + +import { errorUtils, fileUtils, pluginUtils, searchUtils } from '@verdaccio/core'; import { Config, IPackageStorage, LocalStorage, Logger } from '@verdaccio/types'; -import { errorUtils, searchUtils, pluginUtils, fileUtils } from '@verdaccio/core'; import { getMatchedPackagesSpec } from '@verdaccio/utils'; +import { searchOnStorage } from './dir-utils'; +import { mkdirPromise, writeFilePromise } from './fs'; import LocalDriver, { noSuchFile } from './local-fs'; import { loadPrivatePackages } from './pkg-utils'; import TokenActions from './token'; -import { mkdirPromise, writeFilePromise } from './fs'; -import { searchOnStorage } from './dir-utils'; import { _dbGenPath } from './utils'; const DB_NAME = process.env.VERDACCIO_STORAGE_NAME ?? fileUtils.Files.DatabaseName; diff --git a/packages/plugins/local-storage/src/local-fs.ts b/packages/plugins/local-storage/src/local-fs.ts index cf2319880..4710b7396 100644 --- a/packages/plugins/local-storage/src/local-fs.ts +++ b/packages/plugins/local-storage/src/local-fs.ts @@ -1,15 +1,15 @@ /* eslint-disable no-undef */ - -import fs from 'fs'; -import path from 'path'; import buildDebug from 'debug'; - +import fs from 'fs'; import _ from 'lodash'; -import { UploadTarball, ReadTarball } from '@verdaccio/streams'; -import { unlockFile, readFile } from '@verdaccio/file-locking'; -import { Callback, Logger, Package, ILocalPackageManager, IUploadTarball } from '@verdaccio/types'; +import path from 'path'; + import { VerdaccioError, errorUtils } from '@verdaccio/core'; -import { unlinkPromise, rmdirPromise, readFilePromise } from './fs'; +import { readFile, unlockFile } from '@verdaccio/file-locking'; +import { ReadTarball, UploadTarball } from '@verdaccio/streams'; +import { Callback, ILocalPackageManager, IUploadTarball, Logger, Package } from '@verdaccio/types'; + +import { readFilePromise, rmdirPromise, unlinkPromise } from './fs'; export const fileExist = 'EEXISTS'; export const noSuchFile = 'ENOENT'; diff --git a/packages/plugins/local-storage/src/pkg-utils.ts b/packages/plugins/local-storage/src/pkg-utils.ts index b0ddccb93..84cd7fde8 100644 --- a/packages/plugins/local-storage/src/pkg-utils.ts +++ b/packages/plugins/local-storage/src/pkg-utils.ts @@ -1,5 +1,7 @@ import _ from 'lodash'; -import { LocalStorage, StorageList, Logger } from '@verdaccio/types'; + +import { LocalStorage, Logger, StorageList } from '@verdaccio/types'; + import { readFilePromise } from './fs'; export async function loadPrivatePackages(path: string, logger: Logger): Promise { diff --git a/packages/plugins/local-storage/src/token.ts b/packages/plugins/local-storage/src/token.ts index 56bd6df92..990e71116 100644 --- a/packages/plugins/local-storage/src/token.ts +++ b/packages/plugins/local-storage/src/token.ts @@ -1,10 +1,11 @@ +import buildDebug from 'debug'; import _ from 'lodash'; import low from 'lowdb'; import FileAsync from 'lowdb/adapters/FileAsync'; import FileMemory from 'lowdb/adapters/Memory'; -import buildDebug from 'debug'; -import { ITokenActions, Config, Token, TokenFilter } from '@verdaccio/types'; +import { Config, ITokenActions, Token, TokenFilter } from '@verdaccio/types'; + import { _dbGenPath } from './utils'; const debug = buildDebug('verdaccio:plugin:local-storage:token'); diff --git a/packages/plugins/local-storage/src/utils.ts b/packages/plugins/local-storage/src/utils.ts index 019d43b55..59cf217dc 100644 --- a/packages/plugins/local-storage/src/utils.ts +++ b/packages/plugins/local-storage/src/utils.ts @@ -1,6 +1,7 @@ import fs from 'fs'; -import path from 'path'; import _ from 'lodash'; +import path from 'path'; + import { Config } from '@verdaccio/types'; export function getFileStats(packagePath: string): Promise { diff --git a/packages/plugins/local-storage/tests/dir-utils.test.ts b/packages/plugins/local-storage/tests/dir-utils.test.ts index 3c257a299..90b84d5b1 100644 --- a/packages/plugins/local-storage/tests/dir-utils.test.ts +++ b/packages/plugins/local-storage/tests/dir-utils.test.ts @@ -1,4 +1,5 @@ import { join } from 'path'; + import { getFolders, searchOnStorage } from '../src/dir-utils'; const mockFolder = join(__dirname, 'mockStorage'); diff --git a/packages/plugins/local-storage/tests/local-fs.test.ts b/packages/plugins/local-storage/tests/local-fs.test.ts index 5d8413b91..4209c005e 100644 --- a/packages/plugins/local-storage/tests/local-fs.test.ts +++ b/packages/plugins/local-storage/tests/local-fs.test.ts @@ -1,11 +1,10 @@ -import path from 'path'; import fs from 'fs'; +import path from 'path'; import { dirSync } from 'tmp-promise'; import { ILocalPackageManager, Logger, Package } from '@verdaccio/types'; -import LocalDriver, { fileExist, fSError, noSuchFile, resourceNotAvailable } from '../src/local-fs'; - +import LocalDriver, { fSError, fileExist, noSuchFile, resourceNotAvailable } from '../src/local-fs'; import pkg from './__fixtures__/pkg'; let localTempStorage: string; diff --git a/packages/plugins/local-storage/tests/token.test.ts b/packages/plugins/local-storage/tests/token.test.ts index 0f1025cbe..503713e78 100644 --- a/packages/plugins/local-storage/tests/token.test.ts +++ b/packages/plugins/local-storage/tests/token.test.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; import { dirSync } from 'tmp-promise'; + import { Logger, Token } from '@verdaccio/types'; import LocalDatabase from '../src/local-database'; diff --git a/packages/plugins/local-storage/tests/utils.test.ts b/packages/plugins/local-storage/tests/utils.test.ts index 04da75bc8..81a581f44 100644 --- a/packages/plugins/local-storage/tests/utils.test.ts +++ b/packages/plugins/local-storage/tests/utils.test.ts @@ -1,10 +1,11 @@ import path from 'path'; -import { Logger } from '@verdaccio/types'; -import * as readFile from '../src/fs'; -import { findPackages, _dbGenPath } from '../src/utils'; -import { loadPrivatePackages } from '../src/pkg-utils'; +import { Logger } from '@verdaccio/types'; + +import * as readFile from '../src/fs'; import { noSuchFile } from '../src/local-fs'; +import { loadPrivatePackages } from '../src/pkg-utils'; +import { _dbGenPath, findPackages } from '../src/utils'; const logger: Logger = { error: jest.fn(), diff --git a/packages/plugins/memory/src/local-memory.ts b/packages/plugins/memory/src/local-memory.ts index b3bc06975..06e3c14cf 100644 --- a/packages/plugins/memory/src/local-memory.ts +++ b/packages/plugins/memory/src/local-memory.ts @@ -1,7 +1,8 @@ -import { errorUtils } from '@verdaccio/core'; -import { Logger, Callback, Config, IPluginStorage, Token, PluginOptions } from '@verdaccio/types'; import buildDebug from 'debug'; +import { errorUtils } from '@verdaccio/core'; +import { Callback, Config, IPluginStorage, Logger, PluginOptions, Token } from '@verdaccio/types'; + import MemoryHandler, { DataHandler } from './memory-handler'; export type ConfigMemory = Config & { limit?: number }; diff --git a/packages/plugins/memory/src/memory-handler.ts b/packages/plugins/memory/src/memory-handler.ts index 706a2201a..dbcc9ebb8 100644 --- a/packages/plugins/memory/src/memory-handler.ts +++ b/packages/plugins/memory/src/memory-handler.ts @@ -1,18 +1,19 @@ import buildDebug from 'debug'; -import { VerdaccioError, errorUtils } from '@verdaccio/core'; import { fs } from 'memfs'; -import { UploadTarball, ReadTarball } from '@verdaccio/streams'; + +import { VerdaccioError, errorUtils } from '@verdaccio/core'; +import { ReadTarball, UploadTarball } from '@verdaccio/streams'; import { - Logger, - IPackageStorageManager, - IUploadTarball, - IReadTarball, CallbackAction, + IPackageStorageManager, + IReadTarball, + IUploadTarball, + Logger, + Package, + PackageTransformer, + ReadPackageCallback, StorageUpdateCallback, StorageWriteCallback, - PackageTransformer, - Package, - ReadPackageCallback, } from '@verdaccio/types'; import { parsePackage, stringifyPackage } from './utils'; diff --git a/packages/plugins/memory/test/local-memory.spec.ts b/packages/plugins/memory/test/local-memory.spec.ts index cbde1fecf..4d9b93652 100644 --- a/packages/plugins/memory/test/local-memory.spec.ts +++ b/packages/plugins/memory/test/local-memory.spec.ts @@ -1,9 +1,8 @@ -import { Logger, IPluginStorage } from '@verdaccio/types'; +import { IPluginStorage, Logger } from '@verdaccio/types'; +import LocalMemory from '../src/index'; import { ConfigMemory } from '../src/local-memory'; import { DataHandler } from '../src/memory-handler'; -import LocalMemory from '../src/index'; - import config from './partials/config'; const logger: Logger = { diff --git a/packages/plugins/memory/test/memory.spec.ts b/packages/plugins/memory/test/memory.spec.ts index 23449927d..5fb9a5a2c 100644 --- a/packages/plugins/memory/test/memory.spec.ts +++ b/packages/plugins/memory/test/memory.spec.ts @@ -1,10 +1,9 @@ -import { Logger, IPluginStorage, IPackageStorage, ILocalPackageManager } from '@verdaccio/types'; import { errorUtils } from '@verdaccio/core'; +import { ILocalPackageManager, IPackageStorage, IPluginStorage, Logger } from '@verdaccio/types'; +import LocalMemory from '../src/index'; import { ConfigMemory } from '../src/local-memory'; import MemoryHandler from '../src/memory-handler'; -import LocalMemory from '../src/index'; - import config from './partials/config'; import pkgExample from './partials/pkg'; diff --git a/packages/plugins/ui-theme/.eslintrc b/packages/plugins/ui-theme/.eslintrc index 232e18af1..bbc91ce2d 100644 --- a/packages/plugins/ui-theme/.eslintrc +++ b/packages/plugins/ui-theme/.eslintrc @@ -11,21 +11,6 @@ "verdaccio" ], "rules": { - "import/order": ["error", { - "pathGroups": [ - { - "pattern": "verdaccio-ui/**", - "group": "external", - "position": "after" - } - ], - "pathGroupsExcludedImportTypes": ["verdaccio-ui"], - "alphabetize": { - "order": "asc", - "caseInsensitive": true - }, - "newlines-between": "always" - }], "react/display-name": 0, "react/no-deprecated": 1, "react/jsx-no-target-blank": 1, diff --git a/packages/plugins/ui-theme/jest/setup-env.ts b/packages/plugins/ui-theme/jest/setup-env.ts index b19a3a0d9..b429c355b 100644 --- a/packages/plugins/ui-theme/jest/setup-env.ts +++ b/packages/plugins/ui-theme/jest/setup-env.ts @@ -1,6 +1,6 @@ +import '@testing-library/jest-dom'; import '@testing-library/jest-dom/extend-expect'; import 'whatwg-fetch'; -import '@testing-library/jest-dom'; import { server } from './server'; diff --git a/packages/plugins/ui-theme/jest/unit/components/__mocks__/token.ts b/packages/plugins/ui-theme/jest/unit/components/__mocks__/token.ts index fabffd475..6a387b290 100644 --- a/packages/plugins/ui-theme/jest/unit/components/__mocks__/token.ts +++ b/packages/plugins/ui-theme/jest/unit/components/__mocks__/token.ts @@ -1,7 +1,6 @@ /** * Token Utility */ - import dayjs from 'dayjs'; import { Base64 } from 'js-base64'; diff --git a/packages/plugins/ui-theme/jest/unit/components/store/login.ts b/packages/plugins/ui-theme/jest/unit/components/store/login.ts index cc048e253..354d5b833 100644 --- a/packages/plugins/ui-theme/jest/unit/components/store/login.ts +++ b/packages/plugins/ui-theme/jest/unit/components/store/login.ts @@ -1,4 +1,5 @@ import { API_ERROR } from '../../../../lib/constants'; + /** * API mock for login endpoint * @param {object} config configuration of api call diff --git a/packages/plugins/ui-theme/src/App/App.test.tsx b/packages/plugins/ui-theme/src/App/App.test.tsx index 1b0ad2df5..2de1a667a 100644 --- a/packages/plugins/ui-theme/src/App/App.test.tsx +++ b/packages/plugins/ui-theme/src/App/App.test.tsx @@ -1,17 +1,15 @@ import React from 'react'; - import { - renderWithStore, act, - waitFor, fireEvent, + renderWithStore, screen, + waitFor, } from 'verdaccio-ui/utils/test-react-testing-library'; // eslint-disable-next-line jest/no-mocks-import import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token'; import { store } from '../store'; - import App from './App'; jest.mock('verdaccio-ui/utils/storage', () => { diff --git a/packages/plugins/ui-theme/src/App/App.tsx b/packages/plugins/ui-theme/src/App/App.tsx index 7e2e25bcd..d46da5d4e 100644 --- a/packages/plugins/ui-theme/src/App/App.tsx +++ b/packages/plugins/ui-theme/src/App/App.tsx @@ -1,20 +1,18 @@ /* eslint-disable react/jsx-max-depth */ import styled from '@emotion/styled'; -import React, { useEffect, Suspense } from 'react'; +import React, { Suspense, useEffect } from 'react'; import { Router } from 'react-router-dom'; - import Box from 'verdaccio-ui/components/Box'; import Loading from 'verdaccio-ui/components/Loading'; -import loadDayJSLocale from 'verdaccio-ui/design-tokens/load-dayjs-locale'; import StyleBaseline from 'verdaccio-ui/design-tokens/StyleBaseline'; +import loadDayJSLocale from 'verdaccio-ui/design-tokens/load-dayjs-locale'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; +import '../i18n/config'; import AppRoute, { history } from './AppRoute'; import Footer from './Footer'; import Header from './Header'; -import '../i18n/config'; - const StyledBox = styled(Box)<{ theme?: Theme }>(({ theme }) => ({ backgroundColor: theme?.palette.background.default, })); diff --git a/packages/plugins/ui-theme/src/App/AppRoute.tsx b/packages/plugins/ui-theme/src/App/AppRoute.tsx index 82c268263..e59b9673b 100644 --- a/packages/plugins/ui-theme/src/App/AppRoute.tsx +++ b/packages/plugins/ui-theme/src/App/AppRoute.tsx @@ -1,6 +1,6 @@ import { createBrowserHistory } from 'history'; import React from 'react'; -import { Route as ReactRouterDomRoute, Switch, Router } from 'react-router-dom'; +import { Route as ReactRouterDomRoute, Router, Switch } from 'react-router-dom'; import loadable from './utils/loadable'; diff --git a/packages/plugins/ui-theme/src/App/Footer/Footer.test.tsx b/packages/plugins/ui-theme/src/App/Footer/Footer.test.tsx index 3e2970eeb..9f60b86e1 100644 --- a/packages/plugins/ui-theme/src/App/Footer/Footer.test.tsx +++ b/packages/plugins/ui-theme/src/App/Footer/Footer.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import Footer from './Footer'; diff --git a/packages/plugins/ui-theme/src/App/Footer/Footer.tsx b/packages/plugins/ui-theme/src/App/Footer/Footer.tsx index 3312ed2ed..0b88ea89d 100644 --- a/packages/plugins/ui-theme/src/App/Footer/Footer.tsx +++ b/packages/plugins/ui-theme/src/App/Footer/Footer.tsx @@ -1,17 +1,17 @@ /* eslint-disable react/jsx-max-depth */ + /* eslint-disable react/jsx-pascal-case */ import styled from '@emotion/styled'; import FlagsIcon from 'country-flag-icons/react/3x2'; import React from 'react'; -import { useTranslation, Trans } from 'react-i18next'; - +import { Trans, useTranslation } from 'react-i18next'; import { Earth } from 'verdaccio-ui/components/Icons'; import Logo from 'verdaccio-ui/components/Logo'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { useConfig } from 'verdaccio-ui/providers/config'; import { goToVerdaccioWebsite } from 'verdaccio-ui/utils/windows'; -import { Wrapper, Left, Right, Love, Inner } from './styles'; +import { Inner, Left, Love, Right, Wrapper } from './styles'; /* eslint-disable react/jsx-key */ const Footer = () => { diff --git a/packages/plugins/ui-theme/src/App/Footer/styles.ts b/packages/plugins/ui-theme/src/App/Footer/styles.ts index 1877eac4f..b83238364 100644 --- a/packages/plugins/ui-theme/src/App/Footer/styles.ts +++ b/packages/plugins/ui-theme/src/App/Footer/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; export const Wrapper = styled('div')<{ theme?: Theme }>(({ theme }) => ({ diff --git a/packages/plugins/ui-theme/src/App/Header/Header.test.tsx b/packages/plugins/ui-theme/src/App/Header/Header.test.tsx index 1d7bd4fcd..d06d3432b 100644 --- a/packages/plugins/ui-theme/src/App/Header/Header.test.tsx +++ b/packages/plugins/ui-theme/src/App/Header/Header.test.tsx @@ -1,18 +1,16 @@ import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom'; - import { - renderWithStore, - fireEvent, - waitFor, cleanup, + fireEvent, + renderWithStore, screen, + waitFor, waitForElementToBeRemoved, } from 'verdaccio-ui/utils/test-react-testing-library'; import translationEN from '../../i18n/crowdin/ui.json'; import { store } from '../../store'; - import Header from './Header'; /* eslint-disable react/jsx-no-bind*/ diff --git a/packages/plugins/ui-theme/src/App/Header/Header.tsx b/packages/plugins/ui-theme/src/App/Header/Header.tsx index 6d2cb6534..d2fba5dcf 100644 --- a/packages/plugins/ui-theme/src/App/Header/Header.tsx +++ b/packages/plugins/ui-theme/src/App/Header/Header.tsx @@ -1,18 +1,16 @@ import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; - import Button from 'verdaccio-ui/components/Button'; import { useConfig } from 'verdaccio-ui/providers/config'; import { Dispatch, RootState } from '../../store/store'; - import HeaderInfoDialog from './HeaderInfoDialog'; import HeaderLeft from './HeaderLeft'; import HeaderRight from './HeaderRight'; import LoginDialog from './LoginDialog'; import Search from './Search'; -import { NavBar, InnerNavBar, MobileNavBar, InnerMobileNavBar } from './styles'; +import { InnerMobileNavBar, InnerNavBar, MobileNavBar, NavBar } from './styles'; interface Props { withoutSearch?: boolean; diff --git a/packages/plugins/ui-theme/src/App/Header/HeaderGreetings.tsx b/packages/plugins/ui-theme/src/App/Header/HeaderGreetings.tsx index 5345666ef..6ad50f772 100644 --- a/packages/plugins/ui-theme/src/App/Header/HeaderGreetings.tsx +++ b/packages/plugins/ui-theme/src/App/Header/HeaderGreetings.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; - import Label from 'verdaccio-ui/components/Label'; import { Greetings } from './styles'; diff --git a/packages/plugins/ui-theme/src/App/Header/HeaderLeft.tsx b/packages/plugins/ui-theme/src/App/Header/HeaderLeft.tsx index 8b57894d0..6cb83a9cd 100644 --- a/packages/plugins/ui-theme/src/App/Header/HeaderLeft.tsx +++ b/packages/plugins/ui-theme/src/App/Header/HeaderLeft.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; import { Link } from 'react-router-dom'; - import Logo from 'verdaccio-ui/components/Logo'; import Search from './Search'; diff --git a/packages/plugins/ui-theme/src/App/Header/HeaderMenu.tsx b/packages/plugins/ui-theme/src/App/Header/HeaderMenu.tsx index a464e8b35..4a7f4392b 100644 --- a/packages/plugins/ui-theme/src/App/Header/HeaderMenu.tsx +++ b/packages/plugins/ui-theme/src/App/Header/HeaderMenu.tsx @@ -1,7 +1,6 @@ import AccountCircle from '@material-ui/icons/AccountCircle'; import React, { MouseEvent } from 'react'; import { useTranslation } from 'react-i18next'; - import IconButton from 'verdaccio-ui/components/IconButton'; import Menu from 'verdaccio-ui/components/Menu'; import MenuItem from 'verdaccio-ui/components/MenuItem'; diff --git a/packages/plugins/ui-theme/src/App/Header/HeaderRight.tsx b/packages/plugins/ui-theme/src/App/Header/HeaderRight.tsx index b67def2db..d08ebf46f 100644 --- a/packages/plugins/ui-theme/src/App/Header/HeaderRight.tsx +++ b/packages/plugins/ui-theme/src/App/Header/HeaderRight.tsx @@ -1,6 +1,5 @@ -import React, { useState, useEffect, useContext, MouseEvent } from 'react'; +import React, { MouseEvent, useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; - import Button from 'verdaccio-ui/components/Button'; import ThemeContext from 'verdaccio-ui/design-tokens/ThemeContext'; diff --git a/packages/plugins/ui-theme/src/App/Header/HeaderToolTip.tsx b/packages/plugins/ui-theme/src/App/Header/HeaderToolTip.tsx index af6af33be..1c4ef4162 100644 --- a/packages/plugins/ui-theme/src/App/Header/HeaderToolTip.tsx +++ b/packages/plugins/ui-theme/src/App/Header/HeaderToolTip.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import Tooltip from 'verdaccio-ui/components/Tooltip'; import HeaderToolTipIcon, { TooltipIconType } from './HeaderToolTipIcon'; diff --git a/packages/plugins/ui-theme/src/App/Header/HeaderToolTipIcon.tsx b/packages/plugins/ui-theme/src/App/Header/HeaderToolTipIcon.tsx index 15bd9e60b..f1aa32022 100644 --- a/packages/plugins/ui-theme/src/App/Header/HeaderToolTipIcon.tsx +++ b/packages/plugins/ui-theme/src/App/Header/HeaderToolTipIcon.tsx @@ -4,7 +4,6 @@ import NightsStay from '@material-ui/icons/NightsStay'; import Search from '@material-ui/icons/Search'; import WbSunny from '@material-ui/icons/WbSunny'; import React, { forwardRef } from 'react'; - import IconButton from 'verdaccio-ui/components/IconButton'; import { IconSearchButton, StyledLink } from './styles'; diff --git a/packages/plugins/ui-theme/src/App/Header/LanguageSwitch.tsx b/packages/plugins/ui-theme/src/App/Header/LanguageSwitch.tsx index 805520cbb..66779e20b 100644 --- a/packages/plugins/ui-theme/src/App/Header/LanguageSwitch.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LanguageSwitch.tsx @@ -3,13 +3,12 @@ import styled from '@emotion/styled'; import { withStyles } from '@material-ui/core/styles'; import LanguageIcon from '@material-ui/icons/Language'; import i18next from 'i18next'; -import React, { useCallback, useContext, useState, useMemo } from 'react'; +import React, { useCallback, useContext, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; - import { AutoComplete } from 'verdaccio-ui/components/AutoComplete/AutoCompleteV2'; import MenuItem from 'verdaccio-ui/components/MenuItem'; -import { Theme } from 'verdaccio-ui/design-tokens/theme'; import ThemeContext from 'verdaccio-ui/design-tokens/ThemeContext'; +import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { Language, listLanguages } from '../../i18n/enabledLanguages'; diff --git a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.test.tsx b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.test.tsx index b39232bf2..621de8481 100644 --- a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.test.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.test.tsx @@ -1,17 +1,15 @@ import React from 'react'; - import api from 'verdaccio-ui/providers/API/api'; import { - renderWithStore, - waitFor, - fireEvent, - cleanup, - screen, act, + cleanup, + fireEvent, + renderWithStore, + screen, + waitFor, } from 'verdaccio-ui/utils/test-react-testing-library'; import { store } from '../../../store'; - import LoginDialog from './LoginDialog'; describe(' component', () => { diff --git a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.tsx b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.tsx index bed21d538..ce8535f9e 100644 --- a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialog.tsx @@ -1,14 +1,12 @@ import i18next from 'i18next'; import isEmpty from 'lodash/isEmpty'; -import React, { useEffect, useCallback } from 'react'; +import React, { useCallback, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; - import Dialog from 'verdaccio-ui/components/Dialog'; import DialogContent from 'verdaccio-ui/components/DialogContent'; import { LoginBody } from '../../../store/models/login'; import { Dispatch, RootState } from '../../../store/store'; - import LoginDialogCloseButton from './LoginDialogCloseButton'; import LoginDialogForm, { FormValues } from './LoginDialogForm'; import LoginDialogHeader from './LoginDialogHeader'; diff --git a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx index 229ddac91..9f48a1459 100644 --- a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx @@ -2,7 +2,6 @@ import styled from '@emotion/styled'; import CloseIcon from '@material-ui/icons/Close'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import DialogTitle from 'verdaccio-ui/components/DialogTitle'; import IconButton from 'verdaccio-ui/components/IconButton'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogForm.tsx b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogForm.tsx index d80f45556..7e9abe38d 100644 --- a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogForm.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogForm.tsx @@ -3,7 +3,6 @@ import styled from '@emotion/styled'; import React, { memo } from 'react'; import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; - import Button from 'verdaccio-ui/components/Button'; import TextField from 'verdaccio-ui/components/TextField'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogFormError.tsx b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogFormError.tsx index 073d2a22e..aae6e26cd 100644 --- a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogFormError.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogFormError.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import Error from '@material-ui/icons/Error'; import React, { memo } from 'react'; - import Box from 'verdaccio-ui/components/Box'; import SnackbarContent from 'verdaccio-ui/components/SnackbarContent'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogHeader.tsx b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogHeader.tsx index 422366069..745af0d3e 100644 --- a/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogHeader.tsx +++ b/packages/plugins/ui-theme/src/App/Header/LoginDialog/LoginDialogHeader.tsx @@ -3,12 +3,12 @@ import CloseIcon from '@material-ui/icons/Close'; import LockOutlined from '@material-ui/icons/LockOutlined'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import Avatar from 'verdaccio-ui/components/Avatar'; import Box from 'verdaccio-ui/components/Box'; import Heading from 'verdaccio-ui/components/Heading'; import IconButton from 'verdaccio-ui/components/IconButton'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; + interface Props { onClose?: () => void; } diff --git a/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx b/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx index b9fc80a8b..7f0497c3b 100644 --- a/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +++ b/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx @@ -1,6 +1,5 @@ import React from 'react'; - -import { screen, render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render, screen } from 'verdaccio-ui/utils/test-react-testing-library'; import RegistryInfoContent from './RegistryInfoContent'; diff --git a/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx b/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx index ba76269f3..cc02ca259 100644 --- a/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +++ b/packages/plugins/ui-theme/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx @@ -4,18 +4,17 @@ import AccordionDetails from '@material-ui/core/AccordionDetails'; import AccordionSummary from '@material-ui/core/AccordionSummary'; import Box from '@material-ui/core/Box'; import Link from '@material-ui/core/Link'; -import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; +import { makeStyles } from '@material-ui/core/styles'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import React, { FC } from 'react'; import { useTranslation } from 'react-i18next'; - import CopyToClipBoard from 'verdaccio-ui/components/CopyToClipBoard'; import { useConfig } from 'verdaccio-ui/providers/config'; import { - getCLISetRegistry, getCLIChangePassword, getCLISetConfigRegistry, + getCLISetRegistry, } from 'verdaccio-ui/utils/cli-utils'; import { NODE_MANAGER } from 'verdaccio-ui/utils/constants'; diff --git a/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx b/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx index f4a7c7925..49da92b14 100644 --- a/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +++ b/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx @@ -1,11 +1,10 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; - import Button from 'verdaccio-ui/components/Button'; import Dialog from 'verdaccio-ui/components/Dialog'; import DialogActions from 'verdaccio-ui/components/DialogActions'; -import { Title, Content } from './styles'; +import { Content, Title } from './styles'; import { Props } from './types'; const RegistryInfoDialog: React.FC = ({ open = false, children, onClose }) => { diff --git a/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/styles.ts b/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/styles.ts index 917a9991e..2b175b6d5 100644 --- a/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/styles.ts +++ b/packages/plugins/ui-theme/src/App/Header/RegistryInfoDialog/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import DialogContent from 'verdaccio-ui/components/DialogContent'; import DialogTitle from 'verdaccio-ui/components/DialogTitle'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/App/Header/Search/Search.test.tsx b/packages/plugins/ui-theme/src/App/Header/Search/Search.test.tsx index 909d76912..80cd4c3a4 100644 --- a/packages/plugins/ui-theme/src/App/Header/Search/Search.test.tsx +++ b/packages/plugins/ui-theme/src/App/Header/Search/Search.test.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom'; - import api from 'verdaccio-ui/providers/API/api'; -import { renderWithStore, fireEvent, waitFor } from 'verdaccio-ui/utils/test-react-testing-library'; +import { fireEvent, renderWithStore, waitFor } from 'verdaccio-ui/utils/test-react-testing-library'; import { store } from '../../../store/store'; +import Search from './Search'; jest.mock('lodash/debounce', () => jest.fn((fn) => { @@ -13,8 +13,6 @@ jest.mock('lodash/debounce', () => }) ); -import Search from './Search'; - /* eslint-disable verdaccio/jsx-spread */ const ComponentToBeRendered: React.FC = () => ( diff --git a/packages/plugins/ui-theme/src/App/Header/Search/Search.tsx b/packages/plugins/ui-theme/src/App/Header/Search/Search.tsx index 053b9c39c..10717220f 100644 --- a/packages/plugins/ui-theme/src/App/Header/Search/Search.tsx +++ b/packages/plugins/ui-theme/src/App/Header/Search/Search.tsx @@ -1,14 +1,12 @@ import debounce from 'lodash/debounce'; -import React, { useState, FormEvent, useCallback } from 'react'; +import React, { FormEvent, useCallback, useState } from 'react'; import { SuggestionSelectedEventData } from 'react-autosuggest'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { RouteComponentProps, withRouter } from 'react-router'; - import AutoComplete from 'verdaccio-ui/components/AutoComplete'; import { Dispatch, RootState } from '../../../store/store'; - import SearchAdornment from './SearchAdornment'; const CONSTANTS = { diff --git a/packages/plugins/ui-theme/src/App/Header/Search/SearchAdornment.tsx b/packages/plugins/ui-theme/src/App/Header/Search/SearchAdornment.tsx index 9547f22ee..ece3dbf36 100644 --- a/packages/plugins/ui-theme/src/App/Header/Search/SearchAdornment.tsx +++ b/packages/plugins/ui-theme/src/App/Header/Search/SearchAdornment.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import Search from '@material-ui/icons/Search'; import React from 'react'; - import InputAdornment from 'verdaccio-ui/components/InputAdornment'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/App/Header/styles.ts b/packages/plugins/ui-theme/src/App/Header/styles.ts index 517942faf..f578535c1 100644 --- a/packages/plugins/ui-theme/src/App/Header/styles.ts +++ b/packages/plugins/ui-theme/src/App/Header/styles.ts @@ -1,6 +1,5 @@ import { css } from '@emotion/core'; import styled from '@emotion/styled'; - import AppBar from 'verdaccio-ui/components/AppBar'; import IconButton from 'verdaccio-ui/components/IconButton'; import Link from 'verdaccio-ui/components/Link'; diff --git a/packages/plugins/ui-theme/src/App/utils/loadable.tsx b/packages/plugins/ui-theme/src/App/utils/loadable.tsx index d33ec9db3..deef44a4e 100644 --- a/packages/plugins/ui-theme/src/App/utils/loadable.tsx +++ b/packages/plugins/ui-theme/src/App/utils/loadable.tsx @@ -1,5 +1,6 @@ /* eslint-disable verdaccio/jsx-spread */ -import React, { lazy, Suspense } from 'react'; +import React, { Suspense, lazy } from 'react'; + export default (importCallback: any) => { const TargetComponent = lazy(importCallback); return (props: any) => ( diff --git a/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.test.tsx b/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.test.tsx index 0330b35cc..cdb0920a4 100644 --- a/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.test.tsx +++ b/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.test.tsx @@ -1,10 +1,8 @@ import React from 'react'; - -import { renderWithStore, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, renderWithStore } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext, DetailContextProps } from '../../pages/Version'; import { store } from '../../store/store'; - import ActionBar from './ActionBar'; const detailContextValue: DetailContextProps = { diff --git a/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.tsx b/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.tsx index 2f96d6e80..cdb328f52 100644 --- a/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.tsx +++ b/packages/plugins/ui-theme/src/components/ActionBar/ActionBar.tsx @@ -1,10 +1,8 @@ import React from 'react'; - import { isURL } from 'verdaccio-ui/utils/url'; import { DetailContext } from '../../pages/Version'; import Box from '../Box'; - import ActionBarAction, { ActionBarActionProps } from './ActionBarAction'; /* eslint-disable verdaccio/jsx-spread */ diff --git a/packages/plugins/ui-theme/src/components/ActionBar/ActionBarAction.tsx b/packages/plugins/ui-theme/src/components/ActionBar/ActionBarAction.tsx index bebc76454..3dd8df1b4 100644 --- a/packages/plugins/ui-theme/src/components/ActionBar/ActionBarAction.tsx +++ b/packages/plugins/ui-theme/src/components/ActionBar/ActionBarAction.tsx @@ -5,7 +5,6 @@ import HomeIcon from '@material-ui/icons/Home'; import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { Dispatch } from '../../store/store'; diff --git a/packages/plugins/ui-theme/src/components/AppBar.tsx b/packages/plugins/ui-theme/src/components/AppBar.tsx index 3641d6531..c4f8f60d1 100644 --- a/packages/plugins/ui-theme/src/components/AppBar.tsx +++ b/packages/plugins/ui-theme/src/components/AppBar.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIAppBar, AppBarProps } from '@material-ui/core/AppBar'; +import { AppBarProps, default as MaterialUIAppBar } from '@material-ui/core/AppBar'; import React, { forwardRef } from 'react'; type AppBarRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap]; diff --git a/packages/plugins/ui-theme/src/components/Author/Author.test.tsx b/packages/plugins/ui-theme/src/components/Author/Author.test.tsx index 3d12b8984..aad81f83b 100644 --- a/packages/plugins/ui-theme/src/components/Author/Author.test.tsx +++ b/packages/plugins/ui-theme/src/components/Author/Author.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext } from '../../pages/Version'; - import Authors from './Author'; const withAuthorComponent = ( diff --git a/packages/plugins/ui-theme/src/components/Author/Author.tsx b/packages/plugins/ui-theme/src/components/Author/Author.tsx index a0660d2f4..69f50afe7 100644 --- a/packages/plugins/ui-theme/src/components/Author/Author.tsx +++ b/packages/plugins/ui-theme/src/components/Author/Author.tsx @@ -1,14 +1,12 @@ import Avatar from '@material-ui/core/Avatar'; import React, { FC, useContext } from 'react'; import { useTranslation } from 'react-i18next'; - import { getAuthorName } from 'verdaccio-ui/utils/package'; import { isEmail } from 'verdaccio-ui/utils/url'; import { DetailContext } from '../../pages/Version'; import List from '../List'; - -import { StyledText, AuthorListItem, AuthorListItemText } from './styles'; +import { AuthorListItem, AuthorListItemText, StyledText } from './styles'; const Author: FC = () => { const { packageMeta } = useContext(DetailContext); diff --git a/packages/plugins/ui-theme/src/components/Author/styles.ts b/packages/plugins/ui-theme/src/components/Author/styles.ts index 0c8f0a332..aba430440 100644 --- a/packages/plugins/ui-theme/src/components/Author/styles.ts +++ b/packages/plugins/ui-theme/src/components/Author/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import ListItem from '../ListItem'; diff --git a/packages/plugins/ui-theme/src/components/AutoComplete/AutoComplete.tsx b/packages/plugins/ui-theme/src/components/AutoComplete/AutoComplete.tsx index bd4e61835..89d41b4f5 100644 --- a/packages/plugins/ui-theme/src/components/AutoComplete/AutoComplete.tsx +++ b/packages/plugins/ui-theme/src/components/AutoComplete/AutoComplete.tsx @@ -4,22 +4,20 @@ import match from 'autosuggest-highlight/match'; import parse from 'autosuggest-highlight/parse'; import React, { KeyboardEvent, memo } from 'react'; import Autosuggest, { - SuggestionSelectedEventData, - InputProps, ChangeEvent, - SuggestionsFetchRequested, GetSuggestionValue, + InputProps, + RenderInputComponent, RenderSuggestion, RenderSuggestionsContainer, - RenderInputComponent, + SuggestionSelectedEventData, + SuggestionsFetchRequested, } from 'react-autosuggest'; import { useTranslation } from 'react-i18next'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import MenuItem from '../MenuItem'; - -import { Wrapper, InputField, SuggestionContainer } from './styles'; +import { InputField, SuggestionContainer, Wrapper } from './styles'; const StyledAnchor = styled('a')<{ highlight: boolean; theme?: Theme }>((props) => ({ fontWeight: diff --git a/packages/plugins/ui-theme/src/components/AutoComplete/AutoCompleteV2.tsx b/packages/plugins/ui-theme/src/components/AutoComplete/AutoCompleteV2.tsx index 3a21832e8..7e646ff94 100644 --- a/packages/plugins/ui-theme/src/components/AutoComplete/AutoCompleteV2.tsx +++ b/packages/plugins/ui-theme/src/components/AutoComplete/AutoCompleteV2.tsx @@ -3,16 +3,15 @@ import { withStyles } from '@material-ui/core/styles'; import CloseIcon from '@material-ui/icons/Close'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import React, { - memo, - useState, ChangeEvent, KeyboardEvent, + memo, + useCallback, useEffect, useRef, - useCallback, + useState, } from 'react'; import { useTranslation } from 'react-i18next'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { useOnClickOutside } from 'verdaccio-ui/design-tokens/useOnClickOutside'; @@ -20,7 +19,6 @@ import IconButton from '../IconButton'; import MenuItem from '../MenuItem'; import Paper from '../Paper'; import TextField from '../TextField'; - import { createFilterOptions } from './useAutoComplete'; const defaultFilterOptions = createFilterOptions(); diff --git a/packages/plugins/ui-theme/src/components/AutoComplete/styles.tsx b/packages/plugins/ui-theme/src/components/AutoComplete/styles.tsx index 9f742aa63..3b150793e 100644 --- a/packages/plugins/ui-theme/src/components/AutoComplete/styles.tsx +++ b/packages/plugins/ui-theme/src/components/AutoComplete/styles.tsx @@ -1,6 +1,5 @@ import styled from '@emotion/styled'; import React from 'react'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import Paper from '../Paper'; diff --git a/packages/plugins/ui-theme/src/components/Box.tsx b/packages/plugins/ui-theme/src/components/Box.tsx index a6aaebade..467831852 100644 --- a/packages/plugins/ui-theme/src/components/Box.tsx +++ b/packages/plugins/ui-theme/src/components/Box.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIBox, BoxProps } from '@material-ui/core/Box'; +import { BoxProps, default as MaterialUIBox } from '@material-ui/core/Box'; import React from 'react'; function Box(props: BoxProps) { diff --git a/packages/plugins/ui-theme/src/components/Button.tsx b/packages/plugins/ui-theme/src/components/Button.tsx index e2a9129e5..c0a22c625 100644 --- a/packages/plugins/ui-theme/src/components/Button.tsx +++ b/packages/plugins/ui-theme/src/components/Button.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIButton, ButtonProps } from '@material-ui/core/Button'; +import { ButtonProps, default as MaterialUIButton } from '@material-ui/core/Button'; import React, { forwardRef } from 'react'; type ButtonRef = HTMLButtonElement; diff --git a/packages/plugins/ui-theme/src/components/Card.tsx b/packages/plugins/ui-theme/src/components/Card.tsx index 883d08eb5..805a6797a 100644 --- a/packages/plugins/ui-theme/src/components/Card.tsx +++ b/packages/plugins/ui-theme/src/components/Card.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUICard, CardProps } from '@material-ui/core/Card'; +import { CardProps, default as MaterialUICard } from '@material-ui/core/Card'; import React, { forwardRef } from 'react'; type CardRef = HTMLDivElement; diff --git a/packages/plugins/ui-theme/src/components/CardActions.tsx b/packages/plugins/ui-theme/src/components/CardActions.tsx index 98673bd11..6987a884c 100644 --- a/packages/plugins/ui-theme/src/components/CardActions.tsx +++ b/packages/plugins/ui-theme/src/components/CardActions.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUICardActions, CardActionsProps } from '@material-ui/core/CardActions'; +import { CardActionsProps, default as MaterialUICardActions } from '@material-ui/core/CardActions'; import React, { forwardRef } from 'react'; type CardActionsRef = HTMLDivElement; diff --git a/packages/plugins/ui-theme/src/components/CardContent.tsx b/packages/plugins/ui-theme/src/components/CardContent.tsx index 5f4fc1c33..fd6c4a094 100644 --- a/packages/plugins/ui-theme/src/components/CardContent.tsx +++ b/packages/plugins/ui-theme/src/components/CardContent.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUICardContent, CardContentProps } from '@material-ui/core/CardContent'; +import { CardContentProps, default as MaterialUICardContent } from '@material-ui/core/CardContent'; import React, { forwardRef } from 'react'; type CardContentRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap]; diff --git a/packages/plugins/ui-theme/src/components/Chip.tsx b/packages/plugins/ui-theme/src/components/Chip.tsx index 349f393d4..00765d6ae 100644 --- a/packages/plugins/ui-theme/src/components/Chip.tsx +++ b/packages/plugins/ui-theme/src/components/Chip.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIChip, ChipProps } from '@material-ui/core/Chip'; +import { ChipProps, default as MaterialUIChip } from '@material-ui/core/Chip'; import React, { forwardRef } from 'react'; type ChipRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap]; diff --git a/packages/plugins/ui-theme/src/components/CircularProgress.tsx b/packages/plugins/ui-theme/src/components/CircularProgress.tsx index 36d6f53d2..c48f4425b 100644 --- a/packages/plugins/ui-theme/src/components/CircularProgress.tsx +++ b/packages/plugins/ui-theme/src/components/CircularProgress.tsx @@ -1,6 +1,6 @@ import { - default as MaterialUICircularProgress, CircularProgressProps, + default as MaterialUICircularProgress, } from '@material-ui/core/CircularProgress'; import React, { forwardRef } from 'react'; diff --git a/packages/plugins/ui-theme/src/components/CopyToClipBoard.tsx b/packages/plugins/ui-theme/src/components/CopyToClipBoard.tsx index 4051176a1..6cc25cc7d 100644 --- a/packages/plugins/ui-theme/src/components/CopyToClipBoard.tsx +++ b/packages/plugins/ui-theme/src/components/CopyToClipBoard.tsx @@ -2,7 +2,6 @@ import styled from '@emotion/styled'; import FileCopy from '@material-ui/icons/FileCopy'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import { copyToClipBoardUtility } from 'verdaccio-ui/utils/cli-utils'; import IconButton from './IconButton'; diff --git a/packages/plugins/ui-theme/src/components/Dialog.tsx b/packages/plugins/ui-theme/src/components/Dialog.tsx index 7c81823fe..7c937be5d 100644 --- a/packages/plugins/ui-theme/src/components/Dialog.tsx +++ b/packages/plugins/ui-theme/src/components/Dialog.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIDialog, DialogProps } from '@material-ui/core/Dialog'; +import { DialogProps, default as MaterialUIDialog } from '@material-ui/core/Dialog'; import React, { forwardRef } from 'react'; type DialogRef = HTMLDivElement; diff --git a/packages/plugins/ui-theme/src/components/DialogActions.tsx b/packages/plugins/ui-theme/src/components/DialogActions.tsx index 84cfd53f4..d84f3bcce 100644 --- a/packages/plugins/ui-theme/src/components/DialogActions.tsx +++ b/packages/plugins/ui-theme/src/components/DialogActions.tsx @@ -1,6 +1,6 @@ import { - default as MaterialUIDialogActions, DialogActionsProps, + default as MaterialUIDialogActions, } from '@material-ui/core/DialogActions'; import React, { forwardRef } from 'react'; diff --git a/packages/plugins/ui-theme/src/components/DialogContent.tsx b/packages/plugins/ui-theme/src/components/DialogContent.tsx index 0fd58ecbc..9382f48f5 100644 --- a/packages/plugins/ui-theme/src/components/DialogContent.tsx +++ b/packages/plugins/ui-theme/src/components/DialogContent.tsx @@ -1,6 +1,6 @@ import { - default as MaterialUIDialogContent, DialogContentProps, + default as MaterialUIDialogContent, } from '@material-ui/core/DialogContent'; import React, { forwardRef } from 'react'; diff --git a/packages/plugins/ui-theme/src/components/DialogTitle.tsx b/packages/plugins/ui-theme/src/components/DialogTitle.tsx index 0f9a993e6..e086253c8 100644 --- a/packages/plugins/ui-theme/src/components/DialogTitle.tsx +++ b/packages/plugins/ui-theme/src/components/DialogTitle.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIDialogTitle, DialogTitleProps } from '@material-ui/core/DialogTitle'; +import { DialogTitleProps, default as MaterialUIDialogTitle } from '@material-ui/core/DialogTitle'; import React, { forwardRef } from 'react'; type DialogTitleRef = HTMLDivElement; diff --git a/packages/plugins/ui-theme/src/components/Divider.tsx b/packages/plugins/ui-theme/src/components/Divider.tsx index 354c44910..5fbda1d61 100644 --- a/packages/plugins/ui-theme/src/components/Divider.tsx +++ b/packages/plugins/ui-theme/src/components/Divider.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIDivider, DividerProps } from '@material-ui/core/Divider'; +import { DividerProps, default as MaterialUIDivider } from '@material-ui/core/Divider'; import React, { forwardRef } from 'react'; type DividerRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap]; diff --git a/packages/plugins/ui-theme/src/components/FloatingActionButton.tsx b/packages/plugins/ui-theme/src/components/FloatingActionButton.tsx index 3c57ec4b2..4ceceb39b 100644 --- a/packages/plugins/ui-theme/src/components/FloatingActionButton.tsx +++ b/packages/plugins/ui-theme/src/components/FloatingActionButton.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIFab, FabProps } from '@material-ui/core/Fab'; +import { FabProps, default as MaterialUIFab } from '@material-ui/core/Fab'; import React, { forwardRef } from 'react'; type FloatingActionButtonRef = HTMLButtonElement; diff --git a/packages/plugins/ui-theme/src/components/FormControl.tsx b/packages/plugins/ui-theme/src/components/FormControl.tsx index 70bf517cb..181e5dffb 100644 --- a/packages/plugins/ui-theme/src/components/FormControl.tsx +++ b/packages/plugins/ui-theme/src/components/FormControl.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIFormControl, FormControlProps } from '@material-ui/core/FormControl'; +import { FormControlProps, default as MaterialUIFormControl } from '@material-ui/core/FormControl'; import React, { forwardRef } from 'react'; type FormControlRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap]; diff --git a/packages/plugins/ui-theme/src/components/FormHelperText.tsx b/packages/plugins/ui-theme/src/components/FormHelperText.tsx index 605223470..a46038385 100644 --- a/packages/plugins/ui-theme/src/components/FormHelperText.tsx +++ b/packages/plugins/ui-theme/src/components/FormHelperText.tsx @@ -1,6 +1,6 @@ import { - default as MaterialUIFormHelperText, FormHelperTextProps, + default as MaterialUIFormHelperText, } from '@material-ui/core/FormHelperText'; import React, { forwardRef } from 'react'; diff --git a/packages/plugins/ui-theme/src/components/Grid.tsx b/packages/plugins/ui-theme/src/components/Grid.tsx index b761da4f5..1189401a1 100644 --- a/packages/plugins/ui-theme/src/components/Grid.tsx +++ b/packages/plugins/ui-theme/src/components/Grid.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIGrid, GridProps } from '@material-ui/core/Grid'; +import { GridProps, default as MaterialUIGrid } from '@material-ui/core/Grid'; import React, { forwardRef } from 'react'; type GridRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap]; diff --git a/packages/plugins/ui-theme/src/components/IconButton.tsx b/packages/plugins/ui-theme/src/components/IconButton.tsx index d20fa983c..733df6371 100644 --- a/packages/plugins/ui-theme/src/components/IconButton.tsx +++ b/packages/plugins/ui-theme/src/components/IconButton.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIIconButton, IconButtonProps } from '@material-ui/core/IconButton'; +import { IconButtonProps, default as MaterialUIIconButton } from '@material-ui/core/IconButton'; import React, { forwardRef } from 'react'; type IconButtonRef = HTMLButtonElement; diff --git a/packages/plugins/ui-theme/src/components/Input.tsx b/packages/plugins/ui-theme/src/components/Input.tsx index f95415b76..456077586 100644 --- a/packages/plugins/ui-theme/src/components/Input.tsx +++ b/packages/plugins/ui-theme/src/components/Input.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIInput, InputProps } from '@material-ui/core/Input'; +import { InputProps, default as MaterialUIInput } from '@material-ui/core/Input'; import React, { forwardRef } from 'react'; type InputRef = HTMLDivElement; diff --git a/packages/plugins/ui-theme/src/components/InputAdornment/InputAdornment.tsx b/packages/plugins/ui-theme/src/components/InputAdornment/InputAdornment.tsx index 8669b4f2b..f43341bd5 100644 --- a/packages/plugins/ui-theme/src/components/InputAdornment/InputAdornment.tsx +++ b/packages/plugins/ui-theme/src/components/InputAdornment/InputAdornment.tsx @@ -1,6 +1,6 @@ import { - default as MaterialUIInputAdornment, InputAdornmentProps, + default as MaterialUIInputAdornment, } from '@material-ui/core/InputAdornment'; import React, { forwardRef } from 'react'; diff --git a/packages/plugins/ui-theme/src/components/InputLabel.tsx b/packages/plugins/ui-theme/src/components/InputLabel.tsx index 206909df9..e71517799 100644 --- a/packages/plugins/ui-theme/src/components/InputLabel.tsx +++ b/packages/plugins/ui-theme/src/components/InputLabel.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIInputLabel, InputLabelProps } from '@material-ui/core/InputLabel'; +import { InputLabelProps, default as MaterialUIInputLabel } from '@material-ui/core/InputLabel'; import React, { forwardRef } from 'react'; type InputLabelRef = HTMLLabelElement; diff --git a/packages/plugins/ui-theme/src/components/Label/Label.test.tsx b/packages/plugins/ui-theme/src/components/Label/Label.test.tsx index e75359bec..b3a337305 100644 --- a/packages/plugins/ui-theme/src/components/Label/Label.test.tsx +++ b/packages/plugins/ui-theme/src/components/Label/Label.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import Label from './Label'; diff --git a/packages/plugins/ui-theme/src/components/Label/Label.tsx b/packages/plugins/ui-theme/src/components/Label/Label.tsx index dc65ca07a..75f19ee27 100644 --- a/packages/plugins/ui-theme/src/components/Label/Label.tsx +++ b/packages/plugins/ui-theme/src/components/Label/Label.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; - -import { Theme, FontWeight } from 'verdaccio-ui/design-tokens/theme'; +import { FontWeight, Theme } from 'verdaccio-ui/design-tokens/theme'; interface Props { text: string; diff --git a/packages/plugins/ui-theme/src/components/List.tsx b/packages/plugins/ui-theme/src/components/List.tsx index 07d4d9247..e5f4e0dc8 100644 --- a/packages/plugins/ui-theme/src/components/List.tsx +++ b/packages/plugins/ui-theme/src/components/List.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIList, ListProps } from '@material-ui/core/List'; +import { ListProps, default as MaterialUIList } from '@material-ui/core/List'; import React, { forwardRef } from 'react'; type ListRef = HTMLUListElement; diff --git a/packages/plugins/ui-theme/src/components/ListItem.tsx b/packages/plugins/ui-theme/src/components/ListItem.tsx index 83d49be40..e0707735f 100644 --- a/packages/plugins/ui-theme/src/components/ListItem.tsx +++ b/packages/plugins/ui-theme/src/components/ListItem.tsx @@ -1,4 +1,4 @@ -import { default as MaterialUIListItem, ListItemProps } from '@material-ui/core/ListItem'; +import { ListItemProps, default as MaterialUIListItem } from '@material-ui/core/ListItem'; import React, { forwardRef } from 'react'; type ListItemRef = T extends true ? HTMLDivElement : HTMLLIElement; diff --git a/packages/plugins/ui-theme/src/components/ListItemText.tsx b/packages/plugins/ui-theme/src/components/ListItemText.tsx index 1994211b5..9da12cc61 100644 --- a/packages/plugins/ui-theme/src/components/ListItemText.tsx +++ b/packages/plugins/ui-theme/src/components/ListItemText.tsx @@ -1,6 +1,6 @@ import { - default as MaterialUIListItemText, ListItemTextProps, + default as MaterialUIListItemText, } from '@material-ui/core/ListItemText'; import React, { forwardRef } from 'react'; diff --git a/packages/plugins/ui-theme/src/components/Loading/Loading.test.tsx b/packages/plugins/ui-theme/src/components/Loading/Loading.test.tsx index 69031bd15..91c2573e1 100644 --- a/packages/plugins/ui-theme/src/components/Loading/Loading.test.tsx +++ b/packages/plugins/ui-theme/src/components/Loading/Loading.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import Loading from './Loading'; diff --git a/packages/plugins/ui-theme/src/components/Loading/Loading.tsx b/packages/plugins/ui-theme/src/components/Loading/Loading.tsx index b4e793b1e..d640d5baa 100644 --- a/packages/plugins/ui-theme/src/components/Loading/Loading.tsx +++ b/packages/plugins/ui-theme/src/components/Loading/Loading.tsx @@ -1,9 +1,8 @@ import React from 'react'; import Logo from '../Logo'; - import Spinner from './Spinner'; -import { Wrapper, Badge } from './styles'; +import { Badge, Wrapper } from './styles'; const Loading: React.FC = () => ( diff --git a/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.test.tsx b/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.test.tsx index e768a6f8e..9ce2abe79 100644 --- a/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.test.tsx +++ b/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.test.tsx @@ -1,6 +1,5 @@ import React from 'react'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import Spinner from './Spinner'; diff --git a/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.tsx b/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.tsx index 4f62d9c97..11d0b7462 100644 --- a/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.tsx +++ b/packages/plugins/ui-theme/src/components/Loading/Spinner/Spinner.tsx @@ -1,6 +1,5 @@ import styled from '@emotion/styled'; import React from 'react'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import CircularProgress from '../../CircularProgress'; diff --git a/packages/plugins/ui-theme/src/components/Loading/styles.ts b/packages/plugins/ui-theme/src/components/Loading/styles.ts index 96ec4dc5e..e156dab70 100644 --- a/packages/plugins/ui-theme/src/components/Loading/styles.ts +++ b/packages/plugins/ui-theme/src/components/Loading/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; export const Wrapper = styled('div')({ diff --git a/packages/plugins/ui-theme/src/components/Logo/Logo.test.tsx b/packages/plugins/ui-theme/src/components/Logo/Logo.test.tsx index 38e2de308..8b4ce88c6 100644 --- a/packages/plugins/ui-theme/src/components/Logo/Logo.test.tsx +++ b/packages/plugins/ui-theme/src/components/Logo/Logo.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import Logo from './Logo'; diff --git a/packages/plugins/ui-theme/src/components/Logo/Logo.tsx b/packages/plugins/ui-theme/src/components/Logo/Logo.tsx index 74ecf2ab1..6bb53fe30 100644 --- a/packages/plugins/ui-theme/src/components/Logo/Logo.tsx +++ b/packages/plugins/ui-theme/src/components/Logo/Logo.tsx @@ -1,6 +1,5 @@ import styled from '@emotion/styled'; import React from 'react'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { useConfig } from 'verdaccio-ui/providers/config'; diff --git a/packages/plugins/ui-theme/src/components/NotFound/NotFound.tsx b/packages/plugins/ui-theme/src/components/NotFound/NotFound.tsx index 1bf850a35..2565015ef 100644 --- a/packages/plugins/ui-theme/src/components/NotFound/NotFound.tsx +++ b/packages/plugins/ui-theme/src/components/NotFound/NotFound.tsx @@ -2,13 +2,11 @@ import styled from '@emotion/styled'; import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; import Box from '../Box'; import Button from '../Button'; import Heading from '../Heading'; - import PackageImg from './img/package.svg'; const NotFound: React.FC = () => { diff --git a/packages/plugins/ui-theme/src/components/NotFound/Notfound.test.tsx b/packages/plugins/ui-theme/src/components/NotFound/Notfound.test.tsx index 7eb02f534..9c041cc38 100644 --- a/packages/plugins/ui-theme/src/components/NotFound/Notfound.test.tsx +++ b/packages/plugins/ui-theme/src/components/NotFound/Notfound.test.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { MemoryRouter } from 'react-router'; - -import { render, fireEvent } from 'verdaccio-ui/utils/test-react-testing-library'; +import { fireEvent, render } from 'verdaccio-ui/utils/test-react-testing-library'; import NotFound from './NotFound'; diff --git a/packages/plugins/ui-theme/src/components/NotFound/styles.ts b/packages/plugins/ui-theme/src/components/NotFound/styles.ts index e2fff0e3e..3042c746d 100644 --- a/packages/plugins/ui-theme/src/components/NotFound/styles.ts +++ b/packages/plugins/ui-theme/src/components/NotFound/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import { PRIMARY_COLOR } from 'verdaccio-ui/utils/colors'; import { default as MuiCard } from '../Card'; diff --git a/packages/plugins/ui-theme/src/components/TextField/TextField.test.tsx b/packages/plugins/ui-theme/src/components/TextField/TextField.test.tsx index 2c04c5419..35dfe061e 100644 --- a/packages/plugins/ui-theme/src/components/TextField/TextField.test.tsx +++ b/packages/plugins/ui-theme/src/components/TextField/TextField.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import TextField from './TextField'; diff --git a/packages/plugins/ui-theme/src/design-tokens/StyleBaseline.tsx b/packages/plugins/ui-theme/src/design-tokens/StyleBaseline.tsx index 676ab45e2..0321ea89e 100644 --- a/packages/plugins/ui-theme/src/design-tokens/StyleBaseline.tsx +++ b/packages/plugins/ui-theme/src/design-tokens/StyleBaseline.tsx @@ -1,6 +1,6 @@ import CssBaseline from '@material-ui/core/CssBaseline'; -import React from 'react'; import 'normalize.css'; +import React from 'react'; import ResetCSS from './ResetStyles'; diff --git a/packages/plugins/ui-theme/src/design-tokens/ThemeProvider.tsx b/packages/plugins/ui-theme/src/design-tokens/ThemeProvider.tsx index 96a5acf65..2e40103b6 100644 --- a/packages/plugins/ui-theme/src/design-tokens/ThemeProvider.tsx +++ b/packages/plugins/ui-theme/src/design-tokens/ThemeProvider.tsx @@ -1,13 +1,12 @@ import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles'; import { ThemeProvider as EmotionThemeProvider } from 'emotion-theming'; import i18next from 'i18next'; -import React, { useEffect, useCallback } from 'react'; - +import React, { useCallback, useEffect } from 'react'; import { useConfig } from 'verdaccio-ui/providers/config'; -import loadDayJSLocale from './load-dayjs-locale'; -import { getTheme, ThemeMode } from './theme'; import ThemeContext from './ThemeContext'; +import loadDayJSLocale from './load-dayjs-locale'; +import { ThemeMode, getTheme } from './theme'; import useLocalStorage from './useLocalStorage'; const ThemeProvider: React.FC = ({ children }) => { diff --git a/packages/plugins/ui-theme/src/design-tokens/theme.ts b/packages/plugins/ui-theme/src/design-tokens/theme.ts index d7b6d7f74..dd1c70b76 100644 --- a/packages/plugins/ui-theme/src/design-tokens/theme.ts +++ b/packages/plugins/ui-theme/src/design-tokens/theme.ts @@ -1,5 +1,4 @@ import createMuiTheme from '@material-ui/core/styles/createMuiTheme'; - import { PRIMARY_COLOR } from 'verdaccio-ui/utils/colors'; const colors = { diff --git a/packages/plugins/ui-theme/src/index.tsx b/packages/plugins/ui-theme/src/index.tsx index 12de9d2a7..a2cd42835 100644 --- a/packages/plugins/ui-theme/src/index.tsx +++ b/packages/plugins/ui-theme/src/index.tsx @@ -2,7 +2,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { AppContainer } from 'react-hot-loader'; import { Provider } from 'react-redux'; - import AppConfigurationContext from 'verdaccio-ui/providers/config'; import App from './App'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx index 3850e02db..31573c8ac 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx @@ -1,10 +1,8 @@ import React from 'react'; import { HashRouter } from 'react-router-dom'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContextProvider } from '../../context'; - import Dependencies from './Dependencies'; describe(' component', () => { diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx index a9e4a77d7..5fba611b6 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx @@ -1,14 +1,12 @@ import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; - import CardContent from 'verdaccio-ui/components/CardContent'; import { PackageDependencies } from '../../../../../types/packageMeta'; import { DetailContext } from '../../context'; import NoItems from '../NoItems'; - -import { CardWrap, StyledText, Tags, Tag } from './styles'; +import { CardWrap, StyledText, Tag, Tags } from './styles'; interface DependencyBlockProps { title: string; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/styles.ts b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/styles.ts index c45e58fd4..a1e313b4b 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/styles.ts +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Dependencies/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import Card from 'verdaccio-ui/components/Card'; import Chip from 'verdaccio-ui/components/Chip'; import Text from 'verdaccio-ui/components/Text'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx index 067f9f399..9c0cdcc25 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; - -import { render, cleanup, screen } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render, screen } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContextProvider } from '../../context'; - import Deprecated from './Deprecated'; describe('test Deprecated', () => { diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx index 164ee2452..374183825 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx @@ -2,7 +2,6 @@ import styled from '@emotion/styled'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; import React from 'react'; - import { Theme } from 'verdaccio-ui/design-tokens/theme'; export const CardStyled = styled(Card)<{ theme?: Theme }>(({ theme }) => { diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.test.tsx index 5f57a26f2..3152a11a1 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import DetailContainer from './DetailContainer'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.tsx index 516e62a72..f0c4280a9 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainer.tsx @@ -1,9 +1,7 @@ -import React, { useState, useContext } from 'react'; - +import React, { useContext, useState } from 'react'; import Box from 'verdaccio-ui/components/Box'; import { DetailContext } from '../context'; - import Deprecated from './Deprecated'; import DetailContainerContent from './DetailContainerContent'; import DetailContainerTabs from './DetailContainerTabs'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContent.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContent.tsx index 72a3019a5..8044d2928 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContent.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContent.tsx @@ -1,7 +1,6 @@ import React from 'react'; import loadable from '../../../App/utils/loadable'; - import DetailContainerContentReadme from './DetailContainerContentReadme'; export enum TabPosition { diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx index 14c4c4de0..d4b9c7972 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { preventXSS } from 'verdaccio-ui/utils/sec-utils'; import Readme from './Readme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerTabs.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerTabs.tsx index 762a97804..ad84eadb8 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/DetailContainerTabs.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import Tab from 'verdaccio-ui/components/Tab'; import { default as MuiTabs } from 'verdaccio-ui/components/Tabs'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/NoItems.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/NoItems.tsx index b4a567ed2..28ce50746 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/NoItems.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import Text from 'verdaccio-ui/components/Text'; interface Props { diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx index 4c9a12df0..fd6563a2a 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import NoItems from './NoItems'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx index 40ff4f666..7f9b796b4 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx @@ -1,6 +1,5 @@ import React from 'react'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import Readme from './Readme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.tsx index 86e5beaa4..29271b695 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Readme/Readme.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; -import React from 'react'; import 'github-markdown-css'; - +import React from 'react'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { Props } from './types'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx index d4dba0676..a3a9e1d21 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext } from '../../context'; - import UpLinks from './UpLinks'; describe(' component', () => { diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx index 7066549c5..433bd6ec8 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx @@ -1,14 +1,12 @@ import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; - import List from 'verdaccio-ui/components/List'; import ListItem from 'verdaccio-ui/components/ListItem'; import { formatDateDistance } from 'verdaccio-ui/utils/package'; import { DetailContext } from '../..'; import NoItems from '../NoItems'; - -import { StyledText, Spacer, ListItemText } from './styles'; +import { ListItemText, Spacer, StyledText } from './styles'; const UpLinks: React.FC = () => { const { packageMeta } = useContext(DetailContext); diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/styles.ts b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/styles.ts index 265cc8b21..081cfe284 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/styles.ts +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/UpLinks/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import { default as MuiListItemText } from 'verdaccio-ui/components/ListItemText'; import Text from 'verdaccio-ui/components/Text'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx index 8c3bb9ef7..b31c6c145 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx @@ -1,14 +1,12 @@ import React from 'react'; import { MemoryRouter } from 'react-router-dom'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import translationEN from '../../../../i18n/crowdin/ui.json'; import { DetailContext } from '../../context'; import { DetailContextProps } from '../../version-config'; - -import data from './__partials__/data.json'; import Versions from './Versions'; +import data from './__partials__/data.json'; const detailContextValue: Partial = { packageName: 'foo', diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.tsx index 4f2f5eecc..839c136ab 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.tsx @@ -3,10 +3,9 @@ import { useTranslation } from 'react-i18next'; import { DIST_TAGS } from '../../../../../lib/constants'; import { DetailContext } from '../../context'; - -import { StyledText } from './styles'; import VersionsHistoryList from './VersionsHistoryList'; import VersionsTagList from './VersionsTagList'; +import { StyledText } from './styles'; const Versions: React.FC = () => { const detailContext = useContext(DetailContext); diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx index 037286b49..dfb9679b9 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx @@ -1,13 +1,11 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; - import List from 'verdaccio-ui/components/List'; import ListItem from 'verdaccio-ui/components/ListItem'; import { formatDateDistance } from 'verdaccio-ui/utils/package'; -import { Versions, Time } from '../../../../../types/packageMeta'; - -import { Spacer, ListItemText, StyledLink } from './styles'; +import { Time, Versions } from '../../../../../types/packageMeta'; +import { ListItemText, Spacer, StyledLink } from './styles'; interface Props { versions: Versions; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx index 9e280fad3..db7789beb 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx @@ -1,11 +1,9 @@ import React from 'react'; - import List from 'verdaccio-ui/components/List'; import ListItem from 'verdaccio-ui/components/ListItem'; import { DistTags } from '../../../../../types/packageMeta'; - -import { Spacer, ListItemText } from './styles'; +import { ListItemText, Spacer } from './styles'; interface Props { tags: DistTags; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/styles.ts b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/styles.ts index a5cef0fdd..3d6afb892 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/styles.ts +++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import Link from 'verdaccio-ui/components/Link'; import { default as MuiListItemText } from 'verdaccio-ui/components/ListItemText'; import Text from 'verdaccio-ui/components/Text'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebar.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebar.tsx index 4c49d0fd8..985fef05c 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebar.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebar.tsx @@ -1,6 +1,5 @@ import styled from '@emotion/styled'; import React, { useContext } from 'react'; - import ActionBar from 'verdaccio-ui/components/ActionBar'; import Author from 'verdaccio-ui/components/Author'; import Paper from 'verdaccio-ui/components/Paper'; @@ -8,7 +7,6 @@ import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { DetailContext } from '..'; import loadable from '../../../App/utils/loadable'; - import DetailSidebarFundButton from './DetailSidebarFundButton'; import DetailSidebarTitle from './DetailSidebarTitle'; import Developers from './Developers'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx index 5f42c46c8..79bf81613 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx @@ -1,11 +1,9 @@ import _ from 'lodash'; import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext } from '../context'; import { DetailContextProps } from '../version-config'; - import DetailSidebarFundButton from './DetailSidebarFundButton'; const ComponentToBeRendered: React.FC<{ contextValue: DetailContextProps }> = ({ diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx index 8f5c624ec..67e1a77fc 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx @@ -2,7 +2,6 @@ import styled from '@emotion/styled'; import Favorite from '@material-ui/icons/Favorite'; import React, { useContext } from 'react'; import { Trans } from 'react-i18next'; - import Button from 'verdaccio-ui/components/Button'; import Link from 'verdaccio-ui/components/Link'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx index a2321121d..5743836f4 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import Box from 'verdaccio-ui/components/Box'; import Heading from 'verdaccio-ui/components/Heading'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx index f745c2b61..f74364781 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; - -import { render, cleanup, fireEvent } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, fireEvent, render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContextProvider } from '../../context'; - import Developers from './Developers'; import { DeveloperType } from './DevelopersTitle'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.tsx index 9bcfc2e7f..a165b0ba6 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/Developers.tsx @@ -1,16 +1,14 @@ import styled from '@emotion/styled'; import Avatar from '@material-ui/core/Avatar'; import Add from '@material-ui/icons/Add'; -import React, { useState, useCallback, useContext, useEffect, useMemo } from 'react'; +import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; - import Box from 'verdaccio-ui/components/Box'; import FloatingActionButton from 'verdaccio-ui/components/FloatingActionButton'; import Tooltip from 'verdaccio-ui/components/Tooltip'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { DetailContext } from '../..'; - import DevelopersTitle from './DevelopersTitle'; import getUniqueDeveloperValues from './get-unique-developer-values'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx index 8b0d34f09..67009f0df 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import Text from 'verdaccio-ui/components/Text'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/styles.ts b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/styles.ts index b05662c1e..2e4f8f7a6 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/styles.ts +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Developers/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import FloatingActionButton from 'verdaccio-ui/components/FloatingActionButton'; import Text from 'verdaccio-ui/components/Text'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx index 400e63508..ddd9692a3 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx @@ -1,9 +1,7 @@ import React from 'react'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext } from '../../context'; - import Dist from './Dist'; const withDistComponent = ( diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.tsx index 9378ae799..417296120 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/Dist.tsx @@ -1,13 +1,11 @@ import React, { FC, useContext } from 'react'; import { useTranslation } from 'react-i18next'; - import List from 'verdaccio-ui/components/List'; import fileSizeSI from 'verdaccio-ui/utils/file-size'; import { formatLicense } from 'verdaccio-ui/utils/package'; import { DetailContext } from '../../context'; - -import { StyledText, DistListItem, DistChips } from './styles'; +import { DistChips, DistListItem, StyledText } from './styles'; const DistChip: FC<{ name: string }> = ({ name, children }) => children ? ( diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/styles.ts b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/styles.ts index bedbecf35..d32e43d40 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/styles.ts +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Dist/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import Chip from 'verdaccio-ui/components/Chip'; import FloatingActionButton from 'verdaccio-ui/components/FloatingActionButton'; import ListItem from 'verdaccio-ui/components/ListItem'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx index 2871f88d3..76c4efead 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx @@ -1,10 +1,8 @@ import React from 'react'; - -import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, render } from 'verdaccio-ui/utils/test-react-testing-library'; import { PackageMetaInterface } from '../../../../../types/packageMeta'; import { DetailContext } from '../../context'; - import Engine from './Engines'; jest.mock('./img/node.png', () => ''); diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.tsx index a93753700..748ef7494 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/Engines.tsx @@ -1,6 +1,5 @@ import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; - import Avatar from 'verdaccio-ui/components/Avatar'; import Grid from 'verdaccio-ui/components/Grid'; import List from 'verdaccio-ui/components/List'; @@ -8,9 +7,8 @@ import ListItemText from 'verdaccio-ui/components/ListItemText'; import { DetailContext } from '../../context'; import npm from '../Install/img/npm.svg'; - import node from './img/node.png'; -import { StyledText, EngineListItem } from './styles'; +import { EngineListItem, StyledText } from './styles'; const Engine: React.FC = () => { const { packageMeta } = useContext(DetailContext); diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/styles.ts b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/styles.ts index a4bf21cfa..fae45da54 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/styles.ts +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Engines/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import ListItem from 'verdaccio-ui/components/ListItem'; import Text from 'verdaccio-ui/components/Text'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.test.tsx index 9a8c04e50..d3e16c868 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.test.tsx @@ -1,12 +1,10 @@ import React from 'react'; - import { render, screen } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext } from '../../context'; import { DetailContextProps } from '../../version-config'; - -import data from './__partials__/data.json'; import Install from './Install'; +import data from './__partials__/data.json'; const detailContextValue: Partial = { packageName: 'foo', diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.tsx index f61a64bde..b41382613 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/Install.tsx @@ -1,14 +1,12 @@ import styled from '@emotion/styled'; import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; - import List from 'verdaccio-ui/components/List'; import Text from 'verdaccio-ui/components/Text'; import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { useConfig } from 'verdaccio-ui/providers/config'; import { DetailContext } from '../..'; - import InstallListItem, { DependencyManager } from './InstallListItem'; const StyledText = styled(Text)<{ theme?: Theme }>((props) => ({ diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx index 1bfdd9035..2719b98f4 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import Avatar from 'verdaccio-ui/components/Avatar'; import CopyToClipBoard from 'verdaccio-ui/components/CopyToClipBoard'; import ListItem from 'verdaccio-ui/components/ListItem'; diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx index aea100fa7..99108aee3 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx @@ -1,12 +1,10 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import { DetailContext } from '../../context'; import { DetailContextProps } from '../../version-config'; - -import data from './__partials__/data.json'; import Repository from './Repository'; +import data from './__partials__/data.json'; const detailContextValue: DetailContextProps = { packageName: 'foo', diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.tsx index 0e723cede..abdace0b3 100644 --- a/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/DetailSidebar/Repository/Repository.tsx @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; import React from 'react'; import { useTranslation } from 'react-i18next'; - import Avatar from 'verdaccio-ui/components/Avatar'; import CopyToClipBoard from 'verdaccio-ui/components/CopyToClipBoard'; import Link from 'verdaccio-ui/components/Link'; @@ -13,7 +12,6 @@ import { Theme } from 'verdaccio-ui/design-tokens/theme'; import { isURL } from 'verdaccio-ui/utils/url'; import { DetailContext } from '../../context'; - import git from './img/git.png'; const StyledText = styled(Text)<{ theme?: Theme }>((props) => ({ diff --git a/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx b/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx index b49defb26..93a1374db 100644 --- a/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx @@ -1,14 +1,12 @@ import { waitFor } from '@testing-library/dom'; import React from 'react'; import { MemoryRouter } from 'react-router'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import translationEN from '../../i18n/crowdin/ui.json'; - +import Version from './Version'; import data from './__partials__/data.json'; import { DetailContext } from './context'; -import Version from './Version'; // :-) we mock this otherways fails on render, some weird issue on material-ui jest.mock('verdaccio-ui/components/Avatar'); diff --git a/packages/plugins/ui-theme/src/pages/Version/Version.tsx b/packages/plugins/ui-theme/src/pages/Version/Version.tsx index c76ad581d..00166a152 100644 --- a/packages/plugins/ui-theme/src/pages/Version/Version.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/Version.tsx @@ -1,14 +1,12 @@ import React, { useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; - import Loading from 'verdaccio-ui/components/Loading'; import NotFound from 'verdaccio-ui/components/NotFound'; import { Dispatch, RootState } from '../../store/store'; - -import getRouterPackageName from './get-route-package-name'; import VersionLayout from './VersionLayout'; +import getRouterPackageName from './get-route-package-name'; interface Params { scope?: string; diff --git a/packages/plugins/ui-theme/src/pages/Version/VersionContextProvider.tsx b/packages/plugins/ui-theme/src/pages/Version/VersionContextProvider.tsx index 0bd1f0008..7e0cdf773 100644 --- a/packages/plugins/ui-theme/src/pages/Version/VersionContextProvider.tsx +++ b/packages/plugins/ui-theme/src/pages/Version/VersionContextProvider.tsx @@ -3,7 +3,6 @@ import { useDispatch, useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; import { Dispatch, RootState } from '../../store/store'; - import { DetailContext } from './context'; import getRouterPackageName from './get-route-package-name'; diff --git a/packages/plugins/ui-theme/src/pages/Version/context.ts b/packages/plugins/ui-theme/src/pages/Version/context.ts index 4c7cb682e..284a1e4fe 100644 --- a/packages/plugins/ui-theme/src/pages/Version/context.ts +++ b/packages/plugins/ui-theme/src/pages/Version/context.ts @@ -1,4 +1,4 @@ -import { createContext, Consumer, Provider } from 'react'; +import { Consumer, Provider, createContext } from 'react'; import { DetailContextProps, VersionPageConsumerProps } from './version-config'; diff --git a/packages/plugins/ui-theme/src/pages/home/Home.tsx b/packages/plugins/ui-theme/src/pages/home/Home.tsx index 40eff5ea5..219d29dd4 100644 --- a/packages/plugins/ui-theme/src/pages/home/Home.tsx +++ b/packages/plugins/ui-theme/src/pages/home/Home.tsx @@ -1,10 +1,8 @@ import React, { useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; - import Loading from 'verdaccio-ui/components/Loading'; import { Dispatch, RootState } from '../../store/store'; - import { PackageList } from './PackageList'; const Home: React.FC = () => { diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.test.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.test.tsx index 3391175ae..9e8a228a9 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.test.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import Help from './Help'; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.tsx index 1ccc40625..6c877b614 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/Help.tsx @@ -1,6 +1,5 @@ import React, { Fragment } from 'react'; import { useTranslation } from 'react-i18next'; - import Button from 'verdaccio-ui/components/Button'; import CardActions from 'verdaccio-ui/components/CardActions'; import CardContent from 'verdaccio-ui/components/CardContent'; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/styles.ts b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/styles.ts index cc1d33a5e..ac9f9a824 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/styles.ts +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/styles.ts @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - import Card from 'verdaccio-ui/components/Card'; import { default as Typography } from 'verdaccio-ui/components/Heading'; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.test.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.test.tsx index 8a38b7050..9a64493df 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.test.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.test.tsx @@ -1,10 +1,8 @@ import React from 'react'; import { MemoryRouter } from 'react-router'; - -import { renderWithStore, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, renderWithStore } from 'verdaccio-ui/utils/test-react-testing-library'; import { store } from '../../../../store'; - import Package from './Package'; /** diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.tsx index 4b6a583f5..7fe665887 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Package.tsx @@ -6,9 +6,8 @@ import HomeIcon from '@material-ui/icons/Home'; import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; - import Grid from 'verdaccio-ui/components/Grid'; -import { Version, FileBinary, Time, Law } from 'verdaccio-ui/components/Icons'; +import { FileBinary, Law, Time, Version } from 'verdaccio-ui/components/Icons'; import Link from 'verdaccio-ui/components/Link'; import ListItem from 'verdaccio-ui/components/ListItem'; import Tooltip from 'verdaccio-ui/components/Tooltip'; @@ -17,9 +16,9 @@ import fileSizeSI from 'verdaccio-ui/utils/file-size'; import { formatDate, formatDateDistance, getAuthorName } from 'verdaccio-ui/utils/package'; import { isURL } from 'verdaccio-ui/utils/url'; -import { PackageMetaInterface, Author as PackageAuthor } from '../../../../../types/packageMeta'; +import { Author as PackageAuthor, PackageMetaInterface } from '../../../../../types/packageMeta'; import { Dispatch, RootState } from '../../../../store/store'; - +import Tag from './Tag'; import { Author, Avatar, @@ -28,15 +27,14 @@ import { GridRightAligned, IconButton, OverviewItem, - Wrapper, PackageListItemText, PackageTitle, Published, TagContainer, Text, + Wrapper, WrapperLink, } from './styles'; -import Tag from './Tag'; interface Bugs { url: string; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Tag/Tag.test.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Tag/Tag.test.tsx index 308f31b7b..46c4df917 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/Tag/Tag.test.tsx @@ -1,5 +1,4 @@ import React from 'react'; - import { render } from 'verdaccio-ui/utils/test-react-testing-library'; import Tag from './Tag'; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/styles.ts b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/styles.ts index 1f08cacca..48e9eb14c 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Package/styles.ts +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Package/styles.ts @@ -1,6 +1,5 @@ import styled from '@emotion/styled'; import { Link } from 'react-router-dom'; - import { default as Photo } from 'verdaccio-ui/components/Avatar'; import Grid from 'verdaccio-ui/components/Grid'; import { default as MuiIconButton } from 'verdaccio-ui/components/IconButton'; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/PackageList.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/PackageList.tsx index 728c8d494..c701ec8b8 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/PackageList.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/PackageList.tsx @@ -3,7 +3,6 @@ import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer'; import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer'; import { List, ListRowProps } from 'react-virtualized/dist/commonjs/List'; import { WindowScroller } from 'react-virtualized/dist/commonjs/WindowScroller'; - import Divider from 'verdaccio-ui/components/Divider'; import { formatLicense } from 'verdaccio-ui/utils/package'; diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Packagelist.test.tsx b/packages/plugins/ui-theme/src/pages/home/PackageList/Packagelist.test.tsx index 16d7c40b5..92224f873 100644 --- a/packages/plugins/ui-theme/src/pages/home/PackageList/Packagelist.test.tsx +++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Packagelist.test.tsx @@ -1,10 +1,8 @@ import React from 'react'; import { BrowserRouter } from 'react-router-dom'; - -import { renderWithStore, cleanup } from 'verdaccio-ui/utils/test-react-testing-library'; +import { cleanup, renderWithStore } from 'verdaccio-ui/utils/test-react-testing-library'; import { store } from '../../../store'; - import { PackageList } from './PackageList'; describe(' component', () => { diff --git a/packages/plugins/ui-theme/src/providers/API/api.ts b/packages/plugins/ui-theme/src/providers/API/api.ts index 17c1d1af5..b231ae4f7 100644 --- a/packages/plugins/ui-theme/src/providers/API/api.ts +++ b/packages/plugins/ui-theme/src/providers/API/api.ts @@ -1,5 +1,5 @@ -import storage from './storage'; import '../../../types'; +import storage from './storage'; /** * Handles response according to content type diff --git a/packages/plugins/ui-theme/src/providers/config/AppConfigurationProvider.tsx b/packages/plugins/ui-theme/src/providers/config/AppConfigurationProvider.tsx index 99f6fd13c..4b5198925 100644 --- a/packages/plugins/ui-theme/src/providers/config/AppConfigurationProvider.tsx +++ b/packages/plugins/ui-theme/src/providers/config/AppConfigurationProvider.tsx @@ -1,10 +1,10 @@ -import { TemplateUIOptions } from '@verdaccio/types'; import isEmpty from 'lodash/isEmpty'; import isNil from 'lodash/isNil'; -import React, { createContext, FunctionComponent, useContext, useMemo, useState } from 'react'; - +import React, { FunctionComponent, createContext, useContext, useMemo, useState } from 'react'; import { PRIMARY_COLOR } from 'verdaccio-ui/utils/colors'; +import { TemplateUIOptions } from '@verdaccio/types'; + type ConfigProviderProps = { configOptions: TemplateUIOptions; setConfigOptions: Function; diff --git a/packages/plugins/ui-theme/src/store/models/configuration.ts b/packages/plugins/ui-theme/src/store/models/configuration.ts index 1a10f1bfb..1dea2b825 100644 --- a/packages/plugins/ui-theme/src/store/models/configuration.ts +++ b/packages/plugins/ui-theme/src/store/models/configuration.ts @@ -1,13 +1,12 @@ import { createModel } from '@rematch/core'; -import { Package, TemplateUIOptions } from '@verdaccio/types'; import isEmpty from 'lodash/isEmpty'; import isNil from 'lodash/isNil'; - import { PRIMARY_COLOR } from 'verdaccio-ui/utils/colors'; -import API from '../../providers/API/api'; +import { Package, TemplateUIOptions } from '@verdaccio/types'; import type { RootModel } from '.'; +import API from '../../providers/API/api'; const defaultValues: TemplateUIOptions = { primaryColor: PRIMARY_COLOR, diff --git a/packages/plugins/ui-theme/src/store/models/download.ts b/packages/plugins/ui-theme/src/store/models/download.ts index 832d5ecf5..4acb9f801 100644 --- a/packages/plugins/ui-theme/src/store/models/download.ts +++ b/packages/plugins/ui-theme/src/store/models/download.ts @@ -1,10 +1,9 @@ import { createModel } from '@rematch/core'; +import type { RootModel } from '.'; import API from '../../providers/API/api'; import { downloadFile, extractFileName } from '../../utils/url'; -import type { RootModel } from '.'; - export const download = createModel()({ state: {}, reducers: {}, diff --git a/packages/plugins/ui-theme/src/store/models/index.ts b/packages/plugins/ui-theme/src/store/models/index.ts index 3c771910c..3ddbc9e5a 100644 --- a/packages/plugins/ui-theme/src/store/models/index.ts +++ b/packages/plugins/ui-theme/src/store/models/index.ts @@ -6,6 +6,7 @@ import { login } from './login'; import { manifest } from './manifest'; import { packages } from './packages'; import { search } from './search'; + export interface RootModel extends Models { packages: typeof packages; manifest: typeof manifest; diff --git a/packages/plugins/ui-theme/src/store/models/login.ts b/packages/plugins/ui-theme/src/store/models/login.ts index 249ebe504..e6fe76344 100644 --- a/packages/plugins/ui-theme/src/store/models/login.ts +++ b/packages/plugins/ui-theme/src/store/models/login.ts @@ -1,12 +1,11 @@ import { createModel } from '@rematch/core'; import i18next from 'i18next'; +import type { RootModel } from '.'; import { HEADERS } from '../../lib/constants'; import API from '../../providers/API/api'; import storage from '../../utils/storage'; -import type { RootModel } from '.'; - export type LoginError = { type: string; description: string; diff --git a/packages/plugins/ui-theme/src/store/models/manifest.ts b/packages/plugins/ui-theme/src/store/models/manifest.ts index 9dc16c3b0..a24036023 100644 --- a/packages/plugins/ui-theme/src/store/models/manifest.ts +++ b/packages/plugins/ui-theme/src/store/models/manifest.ts @@ -1,10 +1,10 @@ import { createModel } from '@rematch/core'; -import { Package } from '@verdaccio/types'; import { PackageMetaInterface } from 'types/packageMeta'; -import API from '../../providers/API/api'; +import { Package } from '@verdaccio/types'; import type { RootModel } from '.'; +import API from '../../providers/API/api'; function isPackageVersionValid( packageMeta: Partial, diff --git a/packages/plugins/ui-theme/src/store/models/packages.ts b/packages/plugins/ui-theme/src/store/models/packages.ts index 6fd142824..529a8b07c 100644 --- a/packages/plugins/ui-theme/src/store/models/packages.ts +++ b/packages/plugins/ui-theme/src/store/models/packages.ts @@ -1,9 +1,9 @@ import { createModel } from '@rematch/core'; + import { Package } from '@verdaccio/types'; -import API from '../../providers/API/api'; - import type { RootModel } from '.'; +import API from '../../providers/API/api'; export const packages = createModel()({ state: { diff --git a/packages/plugins/ui-theme/src/store/models/search.ts b/packages/plugins/ui-theme/src/store/models/search.ts index 0e4cec041..0a7c60764 100644 --- a/packages/plugins/ui-theme/src/store/models/search.ts +++ b/packages/plugins/ui-theme/src/store/models/search.ts @@ -1,9 +1,9 @@ import { createModel } from '@rematch/core'; + import { Package } from '@verdaccio/types'; -import API from '../../providers/API/api'; - import type { RootModel } from '.'; +import API from '../../providers/API/api'; const CONSTANTS = { API_DELAY: 300, diff --git a/packages/plugins/ui-theme/src/store/store.ts b/packages/plugins/ui-theme/src/store/store.ts index e58ceb2ce..5b336439a 100644 --- a/packages/plugins/ui-theme/src/store/store.ts +++ b/packages/plugins/ui-theme/src/store/store.ts @@ -1,7 +1,7 @@ -import { init, RematchDispatch, RematchRootState } from '@rematch/core'; +import { RematchDispatch, RematchRootState, init } from '@rematch/core'; import loadingPlugin, { ExtraModelsFromLoading } from '@rematch/loading'; -import { models, RootModel } from './models'; +import { RootModel, models } from './models'; type FullModel = ExtraModelsFromLoading; diff --git a/packages/plugins/ui-theme/src/utils/login.test.ts b/packages/plugins/ui-theme/src/utils/login.test.ts index 6906dc03a..da5023227 100644 --- a/packages/plugins/ui-theme/src/utils/login.test.ts +++ b/packages/plugins/ui-theme/src/utils/login.test.ts @@ -1,11 +1,10 @@ // eslint-disable-next-line jest/no-mocks-import import { - generateTokenWithTimeRange, + generateInvalidToken, generateTokenWithExpirationAsString, generateTokenWithOutExpiration, - generateInvalidToken, + generateTokenWithTimeRange, } from '../../jest/unit/components/__mocks__/token'; - import { isTokenExpire } from './login'; /* eslint-disable no-console */ diff --git a/packages/plugins/ui-theme/src/utils/package.test.ts b/packages/plugins/ui-theme/src/utils/package.test.ts index 1770d1bcf..ba9a6cb0d 100644 --- a/packages/plugins/ui-theme/src/utils/package.test.ts +++ b/packages/plugins/ui-theme/src/utils/package.test.ts @@ -1,10 +1,9 @@ import { packageMeta } from '../../jest/unit/components/store/packageMeta'; - import { - formatLicense, - formatRepository, formatDate, formatDateDistance, + formatLicense, + formatRepository, getLastUpdatedPackageTime, getRecentReleases, } from './package'; diff --git a/packages/plugins/ui-theme/src/utils/package.ts b/packages/plugins/ui-theme/src/utils/package.ts index edb2f8116..0fc18b6b0 100644 --- a/packages/plugins/ui-theme/src/utils/package.ts +++ b/packages/plugins/ui-theme/src/utils/package.ts @@ -1,10 +1,11 @@ -import { UpLinks } from '@verdaccio/types'; import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat'; import relativeTime from 'dayjs/plugin/relativeTime'; import i18next from 'i18next'; import isString from 'lodash/isString'; +import { UpLinks } from '@verdaccio/types'; + import { Time } from '../../types/packageMeta'; export const TIMEFORMAT = 'L LTS'; diff --git a/packages/plugins/ui-theme/src/utils/sec-utils.ts b/packages/plugins/ui-theme/src/utils/sec-utils.ts index 42b8de342..a615a6303 100644 --- a/packages/plugins/ui-theme/src/utils/sec-utils.ts +++ b/packages/plugins/ui-theme/src/utils/sec-utils.ts @@ -1,4 +1,4 @@ -import { filterXSS, escapeAttrValue } from 'xss'; +import { escapeAttrValue, filterXSS } from 'xss'; const xssOpts = { onIgnoreTagAttr: function (tag: string, name: string, value: string) { diff --git a/packages/plugins/ui-theme/src/utils/test-react-testing-library.tsx b/packages/plugins/ui-theme/src/utils/test-react-testing-library.tsx index 049e01f4e..e3dc8f676 100644 --- a/packages/plugins/ui-theme/src/utils/test-react-testing-library.tsx +++ b/packages/plugins/ui-theme/src/utils/test-react-testing-library.tsx @@ -2,7 +2,6 @@ import { render } from '@testing-library/react'; import React from 'react'; import { I18nextProvider } from 'react-i18next'; import { Provider } from 'react-redux'; - import ThemeProvider from 'verdaccio-ui/design-tokens/ThemeProvider'; import AppConfigurationProvider from 'verdaccio-ui/providers/config'; diff --git a/packages/plugins/ui-theme/src/utils/url.test.ts b/packages/plugins/ui-theme/src/utils/url.test.ts index e19bfe71f..f6fe8fa75 100644 --- a/packages/plugins/ui-theme/src/utils/url.test.ts +++ b/packages/plugins/ui-theme/src/utils/url.test.ts @@ -1,4 +1,4 @@ -import { isURL, isEmail, extractFileName } from './url'; +import { extractFileName, isEmail, isURL } from './url'; describe('utils', () => { describe('url', () => { diff --git a/packages/plugins/ui-theme/src/utils/url.ts b/packages/plugins/ui-theme/src/utils/url.ts index 73649482c..81f24dfc7 100644 --- a/packages/plugins/ui-theme/src/utils/url.ts +++ b/packages/plugins/ui-theme/src/utils/url.ts @@ -1,5 +1,6 @@ import isEmailValidator from 'validator/lib/isEmail'; import isURLValidator from 'validator/lib/isURL'; + import '../../types'; export function isURL(url: string): boolean { diff --git a/packages/plugins/ui-theme/tools/dev.server.js b/packages/plugins/ui-theme/tools/dev.server.js index caeaf58c7..a7eefb6fa 100644 --- a/packages/plugins/ui-theme/tools/dev.server.js +++ b/packages/plugins/ui-theme/tools/dev.server.js @@ -3,7 +3,6 @@ import webpack from 'webpack'; import WebpackDevServer from 'webpack-dev-server'; import env from '../config/env'; - import config from './webpack.dev.config.babel'; const compiler = webpack(config); diff --git a/packages/plugins/ui-theme/tools/webpack.dev.config.babel.js b/packages/plugins/ui-theme/tools/webpack.dev.config.babel.js index c67e3f7ac..0dbb5aad5 100644 --- a/packages/plugins/ui-theme/tools/webpack.dev.config.babel.js +++ b/packages/plugins/ui-theme/tools/webpack.dev.config.babel.js @@ -1,13 +1,11 @@ -import fs from 'fs'; - import FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin'; +import fs from 'fs'; import HTMLWebpackPlugin from 'html-webpack-plugin'; import yalm from 'js-yaml'; import StyleLintPlugin from 'stylelint-webpack-plugin'; import webpack from 'webpack'; import env from '../config/env'; - import getPackageJson from './getPackageJson'; import baseConfig from './webpack.config'; diff --git a/packages/plugins/ui-theme/types/index.ts b/packages/plugins/ui-theme/types/index.ts index e3081532a..67f9d943c 100644 --- a/packages/plugins/ui-theme/types/index.ts +++ b/packages/plugins/ui-theme/types/index.ts @@ -1,4 +1,5 @@ import { TemplateUIOptions } from '@verdaccio/types'; + declare global { interface Window { __VERDACCIO_BASENAME_UI_OPTIONS: TemplateUIOptions; diff --git a/packages/proxy/src/up-storage.ts b/packages/proxy/src/up-storage.ts index b0e4baf0f..2c7d3cd3b 100644 --- a/packages/proxy/src/up-storage.ts +++ b/packages/proxy/src/up-storage.ts @@ -1,28 +1,30 @@ /* global AbortController */ - -import Stream, { PassThrough, Readable } from 'stream'; -import { URL } from 'url'; +import JSONStream from 'JSONStream'; import buildDebug from 'debug'; import _ from 'lodash'; -import { Request, Headers } from 'undici-fetch'; -import JSONStream from 'JSONStream'; import request from 'request'; -import { buildToken } from '@verdaccio/utils'; -import { ReadTarball } from '@verdaccio/streams'; +import Stream, { PassThrough, Readable } from 'stream'; +import { Headers, Request } from 'undici-fetch'; +import { URL } from 'url'; + import { - constants, - errorUtils, - validatioUtils, - searchUtils, + CHARACTER_ENCODING, + HEADERS, + HEADER_TYPE, + HTTP_STATUS, TOKEN_BASIC, TOKEN_BEARER, - HEADERS, - HTTP_STATUS, - HEADER_TYPE, - CHARACTER_ENCODING, + constants, + errorUtils, + searchUtils, + validatioUtils, } from '@verdaccio/core'; -import { Config, Callback, Logger, UpLinkConf, IReadTarball } from '@verdaccio/types'; +import { ReadTarball } from '@verdaccio/streams'; +import { Callback, Config, IReadTarball, Logger, UpLinkConf } from '@verdaccio/types'; +import { buildToken } from '@verdaccio/utils'; + import { parseInterval } from './proxy-utils'; + const LoggerApi = require('@verdaccio/logger'); const fetch = require('undici-fetch'); diff --git a/packages/proxy/test/headers.auth.spec.ts b/packages/proxy/test/headers.auth.spec.ts index 0635e894c..6885714b4 100644 --- a/packages/proxy/test/headers.auth.spec.ts +++ b/packages/proxy/test/headers.auth.spec.ts @@ -1,8 +1,7 @@ -import { buildToken } from '@verdaccio/utils'; - -import { constants, TOKEN_BASIC, TOKEN_BEARER, HEADERS } from '@verdaccio/core'; -import { setup } from '@verdaccio/logger'; import { DEFAULT_REGISTRY } from '@verdaccio/config'; +import { HEADERS, TOKEN_BASIC, TOKEN_BEARER, constants } from '@verdaccio/core'; +import { setup } from '@verdaccio/logger'; +import { buildToken } from '@verdaccio/utils'; import { ProxyStorage } from '../src/up-storage'; diff --git a/packages/proxy/test/proxy-utils.spec.ts b/packages/proxy/test/proxy-utils.spec.ts index 820ef190a..e91038434 100644 --- a/packages/proxy/test/proxy-utils.spec.ts +++ b/packages/proxy/test/proxy-utils.spec.ts @@ -1,4 +1,5 @@ import assert from 'assert'; + import { parseInterval } from '../src/proxy-utils'; describe('Parse interval', () => { diff --git a/packages/proxy/test/proxy.error.spec.ts b/packages/proxy/test/proxy.error.spec.ts index 40d60d1b7..017e83101 100644 --- a/packages/proxy/test/proxy.error.spec.ts +++ b/packages/proxy/test/proxy.error.spec.ts @@ -1,7 +1,9 @@ -import path from 'path'; import nock from 'nock'; +import path from 'path'; + import { Config, parseConfigFile } from '@verdaccio/config'; import { API_ERROR, HEADER_TYPE, HTTP_STATUS, VerdaccioError, errorUtils } from '@verdaccio/core'; + import { ProxyStorage } from '../src/up-storage'; const getConf = (name) => path.join(__dirname, '/conf', name); diff --git a/packages/proxy/test/proxy.metadata.ts b/packages/proxy/test/proxy.metadata.ts index f31fb9947..4cd2df4b1 100644 --- a/packages/proxy/test/proxy.metadata.ts +++ b/packages/proxy/test/proxy.metadata.ts @@ -1,7 +1,9 @@ -import path from 'path'; import nock from 'nock'; +import path from 'path'; + import { Config, parseConfigFile } from '@verdaccio/config'; import { API_ERROR, errorUtils } from '@verdaccio/core'; + import { ProxyStorage } from '../src/up-storage'; const getConf = (name) => path.join(__dirname, '/conf', name); diff --git a/packages/proxy/test/proxy.search.spec.ts b/packages/proxy/test/proxy.search.spec.ts index 633b8162f..7384c8eb3 100644 --- a/packages/proxy/test/proxy.search.spec.ts +++ b/packages/proxy/test/proxy.search.spec.ts @@ -1,11 +1,13 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars -/* global AbortController */ +/* global AbortController */ +import getStream from 'get-stream'; import path from 'path'; import semver from 'semver'; -import getStream from 'get-stream'; + import { Config, parseConfigFile } from '@verdaccio/config'; import { streamUtils } from '@verdaccio/core'; + import { ProxyStorage } from '../src/up-storage'; // FUTURE: remove me when v15 is the min required version diff --git a/packages/proxy/test/proxy.tarball.spec.ts b/packages/proxy/test/proxy.tarball.spec.ts index 95558fa14..733f6579c 100644 --- a/packages/proxy/test/proxy.tarball.spec.ts +++ b/packages/proxy/test/proxy.tarball.spec.ts @@ -1,7 +1,9 @@ -import path from 'path'; import nock from 'nock'; +import path from 'path'; + import { Config, parseConfigFile } from '@verdaccio/config'; -import { errorUtils, API_ERROR, HEADER_TYPE, HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; +import { API_ERROR, HEADER_TYPE, HTTP_STATUS, VerdaccioError, errorUtils } from '@verdaccio/core'; + import { ProxyStorage } from '../src/up-storage'; const getConf = (name) => path.join(__dirname, '/conf', name); diff --git a/packages/server/src/debug/index.ts b/packages/server/src/debug/index.ts index 3360d07b0..0f4a0a879 100644 --- a/packages/server/src/debug/index.ts +++ b/packages/server/src/debug/index.ts @@ -1,5 +1,6 @@ import { Application } from 'express'; -import { $ResponseExtend, $RequestExtend, $NextFunctionVer } from '../../types/custom'; + +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../types/custom'; export default (app: Application, configPath: string): void => { // Hook for tests only diff --git a/packages/server/src/server.ts b/packages/server/src/server.ts index 1329951c5..8fe5ff325 100644 --- a/packages/server/src/server.ts +++ b/packages/server/src/server.ts @@ -1,28 +1,25 @@ -import _ from 'lodash'; -import express, { Application } from 'express'; -import buildDebug from 'debug'; import compression from 'compression'; import cors from 'cors'; +import buildDebug from 'debug'; +import express, { Application } from 'express'; import RateLimit from 'express-rate-limit'; import { HttpError } from 'http-errors'; - -import { loadPlugin } from '@verdaccio/loaders'; -import { Auth, IBasicAuth } from '@verdaccio/auth'; -import apiEndpoint from '@verdaccio/api'; -import { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core'; -import { Config as AppConfig } from '@verdaccio/config'; - -import webMiddleware from '@verdaccio/web'; -import { ConfigRuntime } from '@verdaccio/types'; - -import { Storage } from '@verdaccio/store'; -import { logger } from '@verdaccio/logger'; -import { log, final, errorReportingMiddleware } from '@verdaccio/middleware'; +import _ from 'lodash'; import AuditMiddleware from 'verdaccio-audit'; -import { Config as IConfig, IPluginStorageFilter, IPlugin } from '@verdaccio/types'; -import { $ResponseExtend, $RequestExtend, $NextFunctionVer } from '../types/custom'; +import apiEndpoint from '@verdaccio/api'; +import { Auth, IBasicAuth } from '@verdaccio/auth'; +import { Config as AppConfig } from '@verdaccio/config'; +import { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core'; +import { loadPlugin } from '@verdaccio/loaders'; +import { logger } from '@verdaccio/logger'; +import { errorReportingMiddleware, final, log } from '@verdaccio/middleware'; +import { Storage } from '@verdaccio/store'; +import { ConfigRuntime } from '@verdaccio/types'; +import { Config as IConfig, IPlugin, IPluginStorageFilter } from '@verdaccio/types'; +import webMiddleware from '@verdaccio/web'; +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom'; import hookDebug from './debug'; export interface IPluginMiddleware extends IPlugin { diff --git a/packages/server/test/api/index.spec.ts b/packages/server/test/api/index.spec.ts index 4553b1cd0..7f2b573cc 100644 --- a/packages/server/test/api/index.spec.ts +++ b/packages/server/test/api/index.spec.ts @@ -1,24 +1,22 @@ +import _ from 'lodash'; import path from 'path'; import request from 'supertest'; -import _ from 'lodash'; - -import { HEADERS, HTTP_STATUS, HEADER_TYPE, API_MESSAGE, TOKEN_BEARER } from '@verdaccio/core'; -// import { generatePackageMetadata } from '@verdaccio/helper'; -import { buildToken } from '@verdaccio/utils'; -import { setup, logger } from '@verdaccio/logger'; +import { API_MESSAGE, HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; +import { logger, setup } from '@verdaccio/logger'; import { mockServer } from '@verdaccio/mock'; - import { - configExample, DOMAIN_SERVERS, + configExample, + generateRamdonStorage, + generateUnPublishURI, getNewToken, getPackage, putPackage, - generateRamdonStorage, verifyPackageVersionDoesExist, - generateUnPublishURI, } from '@verdaccio/mock'; +// import { generatePackageMetadata } from '@verdaccio/helper'; +import { buildToken } from '@verdaccio/utils'; import endPointAPI from '../../src'; import publishMetadata from './helpers/publish-api'; diff --git a/packages/server/test/basic/index.spec.ts b/packages/server/test/basic/index.spec.ts index 78caa547a..bb8de2d54 100644 --- a/packages/server/test/basic/index.spec.ts +++ b/packages/server/test/basic/index.spec.ts @@ -1,9 +1,9 @@ -import path from 'path'; import express from 'express'; +import path from 'path'; import request from 'request'; -import { API_ERROR } from '@verdaccio/core'; import { parseConfigFile } from '@verdaccio/config'; +import { API_ERROR } from '@verdaccio/core'; import { setup } from '@verdaccio/logger'; import endPointAPI from '../../src'; diff --git a/packages/server/test/jwt/index.spec.ts b/packages/server/test/jwt/index.spec.ts index ec8b05509..c7c3fb2cb 100644 --- a/packages/server/test/jwt/index.spec.ts +++ b/packages/server/test/jwt/index.spec.ts @@ -2,24 +2,23 @@ import path from 'path'; import request from 'supertest'; import { - HEADERS, - HTTP_STATUS, - HEADER_TYPE, - TOKEN_BEARER, - TOKEN_BASIC, API_ERROR, + HEADERS, + HEADER_TYPE, + HTTP_STATUS, + TOKEN_BASIC, + TOKEN_BEARER, } from '@verdaccio/core'; -import { mockServer, generateRamdonStorage } from '@verdaccio/mock'; -import { buildUserBuffer, buildToken } from '@verdaccio/utils'; +import { logger, setup } from '@verdaccio/logger'; +import { generateRamdonStorage, mockServer } from '@verdaccio/mock'; import { - configExample, DOMAIN_SERVERS, addUser, + configExample, getPackage, loginUserToken, } from '@verdaccio/mock'; - -import { setup, logger } from '@verdaccio/logger'; +import { buildToken, buildUserBuffer } from '@verdaccio/utils'; import endPointAPI from '../../src'; diff --git a/packages/server/test/package-access/index.spec.ts b/packages/server/test/package-access/index.spec.ts index 01bd1d355..7ab873e35 100644 --- a/packages/server/test/package-access/index.spec.ts +++ b/packages/server/test/package-access/index.spec.ts @@ -1,14 +1,14 @@ import path from 'path'; import request from 'supertest'; -import { setup, logger } from '@verdaccio/logger'; +import { HEADERS, HTTP_STATUS } from '@verdaccio/core'; +import { logger, setup } from '@verdaccio/logger'; +import { DOMAIN_SERVERS, configExample, generateRamdonStorage, mockServer } from '@verdaccio/mock'; + +import endPointAPI from '../../src'; setup([]); -import { HEADERS, HTTP_STATUS } from '@verdaccio/core'; -import { generateRamdonStorage, mockServer, configExample, DOMAIN_SERVERS } from '@verdaccio/mock'; -import endPointAPI from '../../src'; - describe('api with no limited access configuration', () => { let app; let mockRegistry; diff --git a/packages/server/test/profile/index.spec.ts b/packages/server/test/profile/index.spec.ts index 5c5b99a9b..08d6fa5e9 100644 --- a/packages/server/test/profile/index.spec.ts +++ b/packages/server/test/profile/index.spec.ts @@ -1,17 +1,16 @@ import path from 'path'; import request from 'supertest'; -import { mockServer } from '@verdaccio/mock'; import { API_ERROR, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/core'; -import { setup, logger } from '@verdaccio/logger'; - +import { logger, setup } from '@verdaccio/logger'; +import { mockServer } from '@verdaccio/mock'; import { + DOMAIN_SERVERS, + configExample, generateRamdonStorage, getNewToken, getProfile, postProfile, - configExample, - DOMAIN_SERVERS, } from '@verdaccio/mock'; import endPointAPI from '../../src'; diff --git a/packages/server/test/storage/index.spec.ts b/packages/server/test/storage/index.spec.ts index 5779e91d6..75fe41d8d 100644 --- a/packages/server/test/storage/index.spec.ts +++ b/packages/server/test/storage/index.spec.ts @@ -1,14 +1,13 @@ -import path from 'path'; import fs from 'fs'; +import path from 'path'; import { Writable } from 'stream'; + import { Config as AppConfig } from '@verdaccio/config'; -import { Storage } from '@verdaccio/store'; - -import { Config } from '@verdaccio/types'; import { API_ERROR, HTTP_STATUS } from '@verdaccio/core'; -import { mockServer, configExample, DOMAIN_SERVERS, generateRamdonStorage } from '@verdaccio/mock'; - -import { setup, logger } from '@verdaccio/logger'; +import { logger, setup } from '@verdaccio/logger'; +import { DOMAIN_SERVERS, configExample, generateRamdonStorage, mockServer } from '@verdaccio/mock'; +import { Storage } from '@verdaccio/store'; +import { Config } from '@verdaccio/types'; setup([]); diff --git a/packages/server/test/token/index.spec.ts b/packages/server/test/token/index.spec.ts index 5ba992c23..c373f2129 100644 --- a/packages/server/test/token/index.spec.ts +++ b/packages/server/test/token/index.spec.ts @@ -1,26 +1,24 @@ +import _ from 'lodash'; import path from 'path'; import request from 'supertest'; -import _ from 'lodash'; import { - HEADERS, - HTTP_STATUS, - HEADER_TYPE, - TOKEN_BEARER, API_ERROR, + HEADERS, + HEADER_TYPE, + HTTP_STATUS, SUPPORT_ERRORS, + TOKEN_BEARER, } from '@verdaccio/core'; - -import { buildToken } from '@verdaccio/utils'; +import { logger, setup } from '@verdaccio/logger'; import { - generateRamdonStorage, DOMAIN_SERVERS, - mockServer, - getNewToken, configExample, + generateRamdonStorage, + getNewToken, + mockServer, } from '@verdaccio/mock'; - -import { setup, logger } from '@verdaccio/logger'; +import { buildToken } from '@verdaccio/utils'; import endPointAPI from '../../src'; diff --git a/packages/server/test/web/index.spec.ts b/packages/server/test/web/index.spec.ts index 8dedcfe21..582c5faa6 100644 --- a/packages/server/test/web/index.spec.ts +++ b/packages/server/test/web/index.spec.ts @@ -1,11 +1,10 @@ import path from 'path'; import request from 'supertest'; -import { HEADERS, HTTP_STATUS, HEADER_TYPE, DIST_TAGS } from '@verdaccio/core'; +import { DIST_TAGS, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; +import { logger, setup } from '@verdaccio/logger'; +import { DOMAIN_SERVERS, configExample, generateRamdonStorage, mockServer } from '@verdaccio/mock'; -import { mockServer, DOMAIN_SERVERS, configExample, generateRamdonStorage } from '@verdaccio/mock'; - -import { setup, logger } from '@verdaccio/logger'; import endPointAPI from '../../src'; import forbiddenPlace from './partials/forbidden-place'; import publishMetadata from './partials/publish-api'; diff --git a/packages/server/types/custom.d.ts b/packages/server/types/custom.d.ts index 72cee6d7d..7936ace2a 100644 --- a/packages/server/types/custom.d.ts +++ b/packages/server/types/custom.d.ts @@ -1,6 +1,7 @@ -import { Logger, RemoteUser } from '@verdaccio/types'; import { NextFunction, Request, Response } from 'express'; +import { Logger, RemoteUser } from '@verdaccio/types'; + export type $RequestExtend = Request & { remote_user?: any; log: Logger }; export type $ResponseExtend = Response & { cookies?: any }; export type $NextFunctionVer = NextFunction & any; diff --git a/packages/store/src/local-storage.ts b/packages/store/src/local-storage.ts index 203b4410a..0cbde924d 100644 --- a/packages/store/src/local-storage.ts +++ b/packages/store/src/local-storage.ts @@ -1,44 +1,44 @@ import assert from 'assert'; -import UrlNode from 'url'; -import { PassThrough } from 'stream'; -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; +import { PassThrough } from 'stream'; +import UrlNode from 'url'; -import { isObject, getLatestVersion } from '@verdaccio/utils'; -import { errorUtils, searchUtils, pluginUtils, pkgUtils, validatioUtils } from '@verdaccio/core'; +import { errorUtils, pkgUtils, pluginUtils, searchUtils, validatioUtils } from '@verdaccio/core'; import { API_ERROR, DIST_TAGS, HTTP_STATUS, SUPPORT_ERRORS, USERS } from '@verdaccio/core'; -import { createTarballHash } from '@verdaccio/utils'; +import { VerdaccioError } from '@verdaccio/core'; import { loadPlugin } from '@verdaccio/loaders'; import LocalDatabase from '@verdaccio/local-storage'; -import { UploadTarball, ReadTarball } from '@verdaccio/streams'; +import { ReadTarball, UploadTarball } from '@verdaccio/streams'; import { + Author, + Callback, + CallbackAction, + Config, + DistFile, + IPackageStorage, + IReadTarball, + IUploadTarball, + Logger, + MergeTags, + Package, + StorageUpdateCallback, + StringValue, Token, TokenFilter, - Package, - Config, - IUploadTarball, - IReadTarball, - MergeTags, Version, - DistFile, - Callback, - Logger, - IPackageStorage, - Author, - CallbackAction, - StringValue, - StorageUpdateCallback, } from '@verdaccio/types'; -import { VerdaccioError } from '@verdaccio/core'; +import { getLatestVersion, isObject } from '@verdaccio/utils'; +import { createTarballHash } from '@verdaccio/utils'; import { + STORAGE, + cleanUpReadme, generatePackageTemplate, - normalizePackage, generateRevision, getLatestReadme, - cleanUpReadme, normalizeContributors, - STORAGE, + normalizePackage, tagVersion, } from './storage-utils'; diff --git a/packages/store/src/search.ts b/packages/store/src/search.ts index b300d9717..b8b66fa04 100644 --- a/packages/store/src/search.ts +++ b/packages/store/src/search.ts @@ -1,16 +1,17 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ // eslint-disable no-invalid-this - -import { PassThrough, Transform, pipeline } from 'stream'; +import buildDebug from 'debug'; +import _ from 'lodash'; import lunr from 'lunr'; import lunrMutable from 'lunr-mutable-indexes'; -import _ from 'lodash'; -import buildDebug from 'debug'; -import { logger } from '@verdaccio/logger'; -import { Version } from '@verdaccio/types'; -import { IProxy, ProxyList, ProxySearchParams } from '@verdaccio/proxy'; +import { PassThrough, Transform, pipeline } from 'stream'; + import { VerdaccioError } from '@verdaccio/core'; -import { searchUtils, errorUtils } from '@verdaccio/core'; +import { errorUtils, searchUtils } from '@verdaccio/core'; +import { logger } from '@verdaccio/logger'; +import { IProxy, ProxyList, ProxySearchParams } from '@verdaccio/proxy'; +import { Version } from '@verdaccio/types'; + import { LocalStorage } from './local-storage'; import { Storage } from './storage'; diff --git a/packages/store/src/storage-utils.ts b/packages/store/src/storage-utils.ts index e67d2dc68..d5c54ba38 100644 --- a/packages/store/src/storage-utils.ts +++ b/packages/store/src/storage-utils.ts @@ -1,13 +1,13 @@ import _ from 'lodash'; import semver from 'semver'; -import { normalizeDistTags, generateRandomHexString, isNil } from '@verdaccio/utils'; -import { Package, Version, Author, StringValue } from '@verdaccio/types'; +import { errorUtils, pkgUtils, validatioUtils } from '@verdaccio/core'; +import { API_ERROR, DIST_TAGS, HTTP_STATUS, USERS } from '@verdaccio/core'; +import { Author, Package, StringValue, Version } from '@verdaccio/types'; +import { generateRandomHexString, isNil, normalizeDistTags } from '@verdaccio/utils'; -import { pkgUtils, validatioUtils, errorUtils } from '@verdaccio/core'; -import { API_ERROR, HTTP_STATUS, DIST_TAGS, USERS } from '@verdaccio/core'; -import { SearchInstance } from './search'; import { LocalStorage } from './local-storage'; +import { SearchInstance } from './search'; export const STORAGE = { PACKAGE_FILE_NAME: 'package.json', diff --git a/packages/store/src/storage.ts b/packages/store/src/storage.ts index 31e285985..3487d1eab 100644 --- a/packages/store/src/storage.ts +++ b/packages/store/src/storage.ts @@ -1,47 +1,47 @@ import assert from 'assert'; import async, { AsyncResultArrayCallback } from 'async'; -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; import semver from 'semver'; +import { hasProxyTo } from '@verdaccio/config'; +import { API_ERROR, DIST_TAGS, HTTP_STATUS, errorUtils } from '@verdaccio/core'; +import { pkgUtils, validatioUtils } from '@verdaccio/core'; +import { logger } from '@verdaccio/logger'; import { ProxyStorage } from '@verdaccio/proxy'; -import { errorUtils, API_ERROR, HTTP_STATUS, DIST_TAGS } from '@verdaccio/core'; +import { IProxy, ProxyList } from '@verdaccio/proxy'; import { ReadTarball } from '@verdaccio/streams'; -import { normalizeDistTags } from '@verdaccio/utils'; -import { ProxyList, IProxy } from '@verdaccio/proxy'; import { + Callback, + CallbackAction, + Config, + DistFile, + GenericBody, IReadTarball, IUploadTarball, - Versions, - Package, - Config, - MergeTags, - Version, - DistFile, - StringValue, - Callback, Logger, - GenericBody, - TokenFilter, + MergeTags, + Package, + StringValue, Token, - CallbackAction, + TokenFilter, + Version, + Versions, } from '@verdaccio/types'; -import { hasProxyTo } from '@verdaccio/config'; -import { logger } from '@verdaccio/logger'; -import { pkgUtils, validatioUtils } from '@verdaccio/core'; -import { SearchInstance, SearchManager } from './search'; +import { normalizeDistTags } from '@verdaccio/utils'; import { LocalStorage } from './local-storage'; -import { setupUpLinks, updateVersionsHiddenUpLink } from './uplink-util'; +import { SearchInstance, SearchManager } from './search'; import { checkPackageLocal, - publishPackage, checkPackageRemote, cleanUpLinksRef, - mergeUplinkTimeIntoLocal, generatePackageTemplate, + mergeUplinkTimeIntoLocal, + publishPackage, } from './storage-utils'; -import { ISyncUplinks, IPluginFilters, IGetPackageOptions } from './type'; +import { IGetPackageOptions, IPluginFilters, ISyncUplinks } from './type'; +import { setupUpLinks, updateVersionsHiddenUpLink } from './uplink-util'; if (semver.lte(process.version, 'v15.0.0')) { global.AbortController = require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController; diff --git a/packages/store/src/type.ts b/packages/store/src/type.ts index 66efd2840..c00cb97d7 100644 --- a/packages/store/src/type.ts +++ b/packages/store/src/type.ts @@ -1,4 +1,4 @@ -import { Config, IPluginStorageFilter, Callback } from '@verdaccio/types'; +import { Callback, Config, IPluginStorageFilter } from '@verdaccio/types'; export interface IGetPackageOptions { callback: Callback; diff --git a/packages/store/src/uplink-util.ts b/packages/store/src/uplink-util.ts index 600f71174..95272e107 100644 --- a/packages/store/src/uplink-util.ts +++ b/packages/store/src/uplink-util.ts @@ -1,6 +1,5 @@ -import { Versions, Config } from '@verdaccio/types'; - -import { ProxyStorage, IProxy, ProxyList } from '@verdaccio/proxy'; +import { IProxy, ProxyList, ProxyStorage } from '@verdaccio/proxy'; +import { Config, Versions } from '@verdaccio/types'; /** * Set up the Up Storage for each link. diff --git a/packages/store/test/local-storage.spec.ts b/packages/store/test/local-storage.spec.ts index 773a03f23..e89f62da4 100644 --- a/packages/store/test/local-storage.spec.ts +++ b/packages/store/test/local-storage.spec.ts @@ -3,17 +3,18 @@ import rimRaf from 'rimraf'; import { dirSync } from 'tmp-promise'; import { Config as AppConfig } from '@verdaccio/config'; +import { API_ERROR, DIST_TAGS, HTTP_STATUS } from '@verdaccio/core'; +import { VerdaccioError } from '@verdaccio/core'; import { logger, setup } from '@verdaccio/logger'; import { configExample, generateNewVersion } from '@verdaccio/mock'; - -const readMetadata = (fileName = 'metadata') => readFile(`../fixtures/${fileName}`).toString(); import { Config, MergeTags, Package } from '@verdaccio/types'; -import { API_ERROR, HTTP_STATUS, DIST_TAGS } from '@verdaccio/core'; -import { VerdaccioError } from '@verdaccio/core'; + import { LocalStorage, PROTO_NAME } from '../src/local-storage'; import { generatePackageTemplate } from '../src/storage-utils'; import { readFile } from './fixtures/test.utils'; +const readMetadata = (fileName = 'metadata') => readFile(`../fixtures/${fileName}`).toString(); + setup([]); describe('LocalStorage', () => { diff --git a/packages/store/test/search.spec.ts b/packages/store/test/search.spec.ts index c0730c211..191d629da 100644 --- a/packages/store/test/search.spec.ts +++ b/packages/store/test/search.spec.ts @@ -1,8 +1,8 @@ import { Config } from '@verdaccio/config'; -import { configExample } from '@verdaccio/mock'; -import { setup } from '@verdaccio/logger'; - import { searchUtils } from '@verdaccio/core'; +import { setup } from '@verdaccio/logger'; +import { configExample } from '@verdaccio/mock'; + import { Storage, removeDuplicates } from '../src'; import { SearchInstance } from '../src/search'; diff --git a/packages/store/test/storage-utils.spec.ts b/packages/store/test/storage-utils.spec.ts index 1e9a84342..4f9e569ea 100644 --- a/packages/store/test/storage-utils.spec.ts +++ b/packages/store/test/storage-utils.spec.ts @@ -1,8 +1,9 @@ import assert from 'assert'; -import { Package } from '@verdaccio/types'; -import { DIST_TAGS } from '@verdaccio/core'; -import { normalizePackage, mergeUplinkTimeIntoLocal, STORAGE } from '../src/storage-utils'; +import { DIST_TAGS } from '@verdaccio/core'; +import { Package } from '@verdaccio/types'; + +import { STORAGE, mergeUplinkTimeIntoLocal, normalizePackage } from '../src/storage-utils'; import { tagVersion } from '../src/storage-utils'; import { readFile } from './fixtures/test.utils'; diff --git a/packages/tools/benchmark/src/api/index.ts b/packages/tools/benchmark/src/api/index.ts index 5a2375f79..780b95816 100644 --- a/packages/tools/benchmark/src/api/index.ts +++ b/packages/tools/benchmark/src/api/index.ts @@ -1,5 +1,6 @@ /* eslint-disable no-console */ import { Command, Option } from 'clipanion'; + import runApi from './run'; export class ApiCommand extends Command { diff --git a/packages/tools/benchmark/src/index.ts b/packages/tools/benchmark/src/index.ts index 546280d3a..0c85a9494 100644 --- a/packages/tools/benchmark/src/index.ts +++ b/packages/tools/benchmark/src/index.ts @@ -1,4 +1,5 @@ import { Cli } from 'clipanion'; + import { ApiCommand } from './api'; const [node, app, ...args] = process.argv; diff --git a/packages/tools/eslint/src/rules/base.js b/packages/tools/eslint/src/rules/base.js index 2692221a1..296d2bb3e 100644 --- a/packages/tools/eslint/src/rules/base.js +++ b/packages/tools/eslint/src/rules/base.js @@ -15,7 +15,6 @@ module.exports = { 'padded-blocks': 'off', 'require-jsdoc': 'off', 'valid-jsdoc': 'off', - 'import/order': ['error'], 'eol-last': 'error', 'no-irregular-whitespace': 'error', 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'], diff --git a/packages/tools/mock/src/config.ts b/packages/tools/mock/src/config.ts index d09be508a..9eef19ab2 100644 --- a/packages/tools/mock/src/config.ts +++ b/packages/tools/mock/src/config.ts @@ -1,5 +1,5 @@ -import path from 'path'; import _ from 'lodash'; +import path from 'path'; import { parseConfigFile } from '@verdaccio/config'; diff --git a/packages/tools/mock/src/mock-api.ts b/packages/tools/mock/src/mock-api.ts index e5104278a..f7a5d7a93 100644 --- a/packages/tools/mock/src/mock-api.ts +++ b/packages/tools/mock/src/mock-api.ts @@ -1,18 +1,18 @@ +import buildDebug from 'debug'; import _ from 'lodash'; import request from 'supertest'; -import buildDebug from 'debug'; import { DIST_TAGS, - LATEST, - HEADER_TYPE, HEADERS, + HEADER_TYPE, HTTP_STATUS, + LATEST, TOKEN_BEARER, } from '@verdaccio/core'; +import { Package } from '@verdaccio/types'; import { buildToken } from '@verdaccio/utils'; import { generateRandomHexString } from '@verdaccio/utils'; -import { Package } from '@verdaccio/types'; const debug = buildDebug('verdaccio:mock:api'); diff --git a/packages/tools/mock/src/mock.ts b/packages/tools/mock/src/mock.ts index e0660d55a..cdc5aace8 100644 --- a/packages/tools/mock/src/mock.ts +++ b/packages/tools/mock/src/mock.ts @@ -1,11 +1,12 @@ -import path from 'path'; import fs from 'fs'; -import os from 'os'; import * as fsExtra from 'fs-extra'; +import os from 'os'; +import path from 'path'; + import { DOMAIN_SERVERS } from './constants'; +import Server, { IServerBridge } from './server'; import VerdaccioProcess from './server_process'; import { VerdaccioConfig } from './verdaccio-server'; -import Server, { IServerBridge } from './server'; /** * Fork a Verdaccio process with a custom configuration. diff --git a/packages/tools/mock/src/request.ts b/packages/tools/mock/src/request.ts index b0c0ce298..c79ee0509 100644 --- a/packages/tools/mock/src/request.ts +++ b/packages/tools/mock/src/request.ts @@ -1,7 +1,8 @@ import assert from 'assert'; +import buildDebug from 'debug'; import _ from 'lodash'; import request from 'request'; -import buildDebug from 'debug'; + import { IRequestPromise } from './server'; const requestData = Symbol('smart_request_data'); diff --git a/packages/tools/mock/src/server.ts b/packages/tools/mock/src/server.ts index fd393a378..c0af5702f 100644 --- a/packages/tools/mock/src/server.ts +++ b/packages/tools/mock/src/server.ts @@ -1,13 +1,13 @@ import assert from 'assert'; -import _ from 'lodash'; import buildDebug from 'debug'; +import _ from 'lodash'; import { API_MESSAGE, HEADERS, HTTP_STATUS, TOKEN_BASIC } from '@verdaccio/core'; import { buildToken } from '@verdaccio/utils'; -import smartRequest, { PromiseAssert } from './request'; import { CREDENTIALS } from './constants'; import getPackage from './fixtures/package'; +import smartRequest, { PromiseAssert } from './request'; const buildAuthHeader = (user, pass): string => { return buildToken(TOKEN_BASIC, Buffer.from(`${user}:${pass}`).toString('base64')); diff --git a/packages/tools/mock/src/server_process.ts b/packages/tools/mock/src/server_process.ts index 87b99ebcc..8b0682caa 100644 --- a/packages/tools/mock/src/server_process.ts +++ b/packages/tools/mock/src/server_process.ts @@ -4,8 +4,9 @@ import { fork } from 'child_process'; import { HTTP_STATUS } from '@verdaccio/core'; import { CREDENTIALS } from './constants'; -import { IVerdaccioConfig, IServerProcess } from './types'; import { IServerBridge } from './server'; +import { IServerProcess, IVerdaccioConfig } from './types'; + const defaultBinPath = require.resolve('verdaccio/bin/verdaccio'); export default class VerdaccioProcess implements IServerProcess { diff --git a/packages/tools/mock/src/utils-test.ts b/packages/tools/mock/src/utils-test.ts index b2521b27a..df32a0375 100644 --- a/packages/tools/mock/src/utils-test.ts +++ b/packages/tools/mock/src/utils-test.ts @@ -1,7 +1,8 @@ -import fs from 'fs'; -import path from 'path'; -import os from 'os'; import { pseudoRandomBytes } from 'crypto'; +import fs from 'fs'; +import os from 'os'; +import path from 'path'; + import { Version } from '@verdaccio/types'; export function generateRamdonStorage() { diff --git a/packages/tools/mock/test/request.spec.ts b/packages/tools/mock/test/request.spec.ts index c6948a97c..4856e313a 100644 --- a/packages/tools/mock/test/request.spec.ts +++ b/packages/tools/mock/test/request.spec.ts @@ -1,8 +1,9 @@ import _ from 'lodash'; + import { HTTP_STATUS, VerdaccioError } from '@verdaccio/core'; -import smartRequest, { PromiseAssert } from '../src/request'; import { mockServer } from '../src/mock'; +import smartRequest, { PromiseAssert } from '../src/request'; import { IRequestPromise } from '../src/types'; describe('Request Functional', () => { diff --git a/packages/types/index.ts b/packages/types/index.ts index 2ecfad0e6..1315eca18 100644 --- a/packages/types/index.ts +++ b/packages/types/index.ts @@ -1,6 +1,5 @@ // REMOVE and VERIFY where these types are used and remove the package - -import { Callback, RemoteUser, Package } from '@verdaccio/types'; +import { Callback, Package, RemoteUser } from '@verdaccio/types'; export type JWTPayload = RemoteUser & { password?: string; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index e5f47e7e0..d67e57a61 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,26 +1,27 @@ -import { - IBasicStorage, - IStorageManager, - UpLinkConf, - Callback, - Versions, - Version, - RemoteUser, - Config, - Logger, - PackageAccess, - IPluginStorage, - StringValue as verdaccio$StringValue, - IReadTarball, - Package, - IPluginStorageFilter, - Author, - Token, - ITokenActions, - TokenFilter, -} from '@verdaccio/types'; -import lunrMutable from 'lunr-mutable-indexes'; import { NextFunction, Request, Response } from 'express'; +import lunrMutable from 'lunr-mutable-indexes'; + +import { + Author, + Callback, + Config, + IBasicStorage, + IPluginStorage, + IPluginStorageFilter, + IReadTarball, + IStorageManager, + ITokenActions, + Logger, + Package, + PackageAccess, + RemoteUser, + Token, + TokenFilter, + UpLinkConf, + Version, + Versions, + StringValue as verdaccio$StringValue, +} from '@verdaccio/types'; export type StringValue = verdaccio$StringValue; diff --git a/packages/utils/src/crypto-utils.ts b/packages/utils/src/crypto-utils.ts index 2caca41b7..238f5541c 100644 --- a/packages/utils/src/crypto-utils.ts +++ b/packages/utils/src/crypto-utils.ts @@ -1,4 +1,4 @@ -import { createHash, pseudoRandomBytes, Hash } from 'crypto'; +import { Hash, createHash, pseudoRandomBytes } from 'crypto'; export const defaultTarballHashAlgorithm = 'sha1'; diff --git a/packages/utils/src/matcher.ts b/packages/utils/src/matcher.ts index 6f4a255b7..3e5ac6dbb 100644 --- a/packages/utils/src/matcher.ts +++ b/packages/utils/src/matcher.ts @@ -1,6 +1,7 @@ -import { PackageList, PackageAccess } from '@verdaccio/types'; import minimatch from 'minimatch'; +import { PackageAccess, PackageList } from '@verdaccio/types'; + export function getMatchedPackagesSpec( pkgName: string, packages: PackageList diff --git a/packages/utils/src/utils.ts b/packages/utils/src/utils.ts index 3cb470da5..5a157ba49 100644 --- a/packages/utils/src/utils.ts +++ b/packages/utils/src/utils.ts @@ -1,8 +1,9 @@ import assert from 'assert'; import _ from 'lodash'; import semver from 'semver'; -import { Package, Version, Author } from '@verdaccio/types'; -import { DIST_TAGS, DEFAULT_USER } from '@verdaccio/core'; + +import { DEFAULT_USER, DIST_TAGS } from '@verdaccio/core'; +import { Author, Package, Version } from '@verdaccio/types'; /** * From normalize-package-data/lib/fixer.js diff --git a/packages/utils/test/auth-utils.spec.ts b/packages/utils/test/auth-utils.spec.ts index 80bf6d94e..ca7ffd211 100644 --- a/packages/utils/test/auth-utils.spec.ts +++ b/packages/utils/test/auth-utils.spec.ts @@ -1,4 +1,4 @@ -import { validatePassword, createSessionToken, getAuthenticatedMessage } from '../src'; +import { createSessionToken, getAuthenticatedMessage, validatePassword } from '../src'; describe('Auth Utilities', () => { describe('validatePassword', () => { diff --git a/packages/utils/test/utils.spec.ts b/packages/utils/test/utils.spec.ts index b0bb03016..395ac14a4 100644 --- a/packages/utils/test/utils.spec.ts +++ b/packages/utils/test/utils.spec.ts @@ -1,5 +1,6 @@ -import { DIST_TAGS, DEFAULT_USER } from '@verdaccio/core'; -import { validateMetadata, getVersion, normalizeDistTags, formatAuthor } from '../src/index'; +import { DEFAULT_USER, DIST_TAGS } from '@verdaccio/core'; + +import { formatAuthor, getVersion, normalizeDistTags, validateMetadata } from '../src/index'; describe('Utilities', () => { const metadata: any = { diff --git a/packages/verdaccio/test/.eslintrc b/packages/verdaccio/test/.eslintrc index cad945d0c..84a1abf4f 100644 --- a/packages/verdaccio/test/.eslintrc +++ b/packages/verdaccio/test/.eslintrc @@ -27,7 +27,6 @@ "@typescript-eslint/explicit-function-return-type": 0, "@typescript-eslint/no-empty-function": 0, "handle-callback-err": 0, - "import/order": 0, "jest/no-standalone-expect": 0, "prefer-const": 0, "prefer-promise-reject-errors": 1 diff --git a/packages/verdaccio/test/functional/basic/basic.ts b/packages/verdaccio/test/functional/basic/basic.ts index 24e470c64..5bf29cb33 100644 --- a/packages/verdaccio/test/functional/basic/basic.ts +++ b/packages/verdaccio/test/functional/basic/basic.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; + +import { DIST_TAGS, HTTP_STATUS } from '@verdaccio/core'; import { createTarballHash } from '@verdaccio/utils'; -import { HTTP_STATUS, DIST_TAGS } from '@verdaccio/core'; import { CREDENTIALS, @@ -10,9 +11,9 @@ import { PORT_SERVER_2, TARBALL, } from '../config.functional'; -import whoIam from './whoIam'; -import ping from './ping'; import fixturePkg from '../fixtures/package'; +import ping from './ping'; +import whoIam from './whoIam'; function readfile(folderPath) { return fs.readFileSync(path.join(__dirname, '/', folderPath)); diff --git a/packages/verdaccio/test/functional/index.spec.ts b/packages/verdaccio/test/functional/index.spec.ts index 14741edb2..52cbfe382 100644 --- a/packages/verdaccio/test/functional/index.spec.ts +++ b/packages/verdaccio/test/functional/index.spec.ts @@ -1,33 +1,34 @@ /* eslint-disable no-unused-vars */ + /* eslint-disable @typescript-eslint/no-unused-vars */ // we need this for notifications import { setup } from '@verdaccio/logger'; +import { IServerBridge } from '@verdaccio/mock'; -setup({}); - +import adduser from './adduser/adduser'; +import logout from './adduser/logout'; import basic from './basic/basic'; import packageAccess from './package/access'; import packageGzip from './package/gzip'; import packageScoped from './package/scoped'; -import tags from './tags/tags'; -import distTagsMerge from './tags/dist-tags-merge'; -import addtag from './tags/addtag'; -import adduser from './adduser/adduser'; -import logout from './adduser/logout'; +import race from './performance/race'; +import pluginsAuth from './plugins/auth'; +import middleware from './plugins/middleware'; +import readme from './readme/readme'; import incomplete from './sanity/incomplete'; import mirror from './sanity/mirror'; -import readme from './readme/readme'; -import gh29 from './scenarios/gh29'; import nullstorage from './sanity/nullstorage'; // import simpleSearch from './search/simple.search'; import racycrash from './sanity/racycrash'; import security from './sanity/security'; -import race from './performance/race'; -import pluginsAuth from './plugins/auth'; -import middleware from './plugins/middleware'; +import gh29 from './scenarios/gh29'; +import addtag from './tags/addtag'; +import distTagsMerge from './tags/dist-tags-merge'; +import tags from './tags/tags'; import upLinkCache from './uplinks/cache'; import uplinkTimeout from './uplinks/timeout'; -import { IServerBridge } from '@verdaccio/mock'; + +setup({}); describe('functional test verdaccio', function () { jest.setTimeout(20000); diff --git a/packages/verdaccio/test/functional/lib/environment.ts b/packages/verdaccio/test/functional/lib/environment.ts index 20187e4bb..587ab2bdf 100644 --- a/packages/verdaccio/test/functional/lib/environment.ts +++ b/packages/verdaccio/test/functional/lib/environment.ts @@ -1,7 +1,9 @@ -import { yellow, green, blue, magenta } from 'kleur'; -import path from 'path'; import NodeEnvironment from 'jest-environment-node'; +import { blue, green, magenta, yellow } from 'kleur'; +import path from 'path'; + import { mockServer } from '@verdaccio/mock'; + import { PORT_SERVER_1, PORT_SERVER_2, PORT_SERVER_3 } from '../config.functional'; class FunctionalEnvironment extends NodeEnvironment { diff --git a/packages/verdaccio/test/functional/package/access.ts b/packages/verdaccio/test/functional/package/access.ts index 99f66a30d..39de4e4b3 100644 --- a/packages/verdaccio/test/functional/package/access.ts +++ b/packages/verdaccio/test/functional/package/access.ts @@ -1,5 +1,5 @@ -import { buildToken } from '@verdaccio/utils'; import { API_ERROR, HTTP_STATUS, TOKEN_BASIC } from '@verdaccio/core'; +import { buildToken } from '@verdaccio/utils'; import { CREDENTIALS } from '../config.functional'; import fixturePkg from '../fixtures/package'; diff --git a/packages/verdaccio/test/functional/package/gzip.ts b/packages/verdaccio/test/functional/package/gzip.ts index 44b054b9c..c25d38a33 100644 --- a/packages/verdaccio/test/functional/package/gzip.ts +++ b/packages/verdaccio/test/functional/package/gzip.ts @@ -1,6 +1,8 @@ import zlib from 'zlib'; + +import { CHARACTER_ENCODING, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; + import { readFile } from '../lib/test.utils'; -import { HEADER_TYPE, HEADERS, HTTP_STATUS, CHARACTER_ENCODING } from '@verdaccio/core'; export default function (server, express) { const PKG_NAME = 'testexp_gzip'; diff --git a/packages/verdaccio/test/functional/package/scoped.ts b/packages/verdaccio/test/functional/package/scoped.ts index dc0dddfc4..6a4227421 100644 --- a/packages/verdaccio/test/functional/package/scoped.ts +++ b/packages/verdaccio/test/functional/package/scoped.ts @@ -1,9 +1,9 @@ -import { DOMAIN_SERVERS, PORT_SERVER_1, PORT_SERVER_2 } from '../config.functional'; -import { generateSha } from '../lib/test.utils'; - import { HEADERS, HTTP_STATUS } from '@verdaccio/core'; import { DIST_TAGS } from '@verdaccio/core'; +import { DOMAIN_SERVERS, PORT_SERVER_1, PORT_SERVER_2 } from '../config.functional'; +import { generateSha } from '../lib/test.utils'; + export default function (server, server2) { const SCOPE = '@test/scoped'; const PKG_VERSION = '1.0.0'; diff --git a/packages/verdaccio/test/functional/performance/race.ts b/packages/verdaccio/test/functional/performance/race.ts index 8af7eb6f3..d9756b071 100644 --- a/packages/verdaccio/test/functional/performance/race.ts +++ b/packages/verdaccio/test/functional/performance/race.ts @@ -1,9 +1,11 @@ import async from 'async'; + import { HTTP_STATUS } from '@verdaccio/core'; -let okTotalSum = 0; import racePkg from '../fixtures/package'; +let okTotalSum = 0; + export default function (server) { describe('should test race condition on publish packages', () => { const MAX_COUNT = 20; diff --git a/packages/verdaccio/test/functional/plugins/auth.ts b/packages/verdaccio/test/functional/plugins/auth.ts index bb3e48514..7f56cdbd2 100644 --- a/packages/verdaccio/test/functional/plugins/auth.ts +++ b/packages/verdaccio/test/functional/plugins/auth.ts @@ -1,4 +1,4 @@ -import { HTTP_STATUS, API_ERROR } from '@verdaccio/core'; +import { API_ERROR, HTTP_STATUS } from '@verdaccio/core'; export default function (server2) { // credentials diff --git a/packages/verdaccio/test/functional/readme/readme.ts b/packages/verdaccio/test/functional/readme/readme.ts index eece64113..6ed8807b2 100644 --- a/packages/verdaccio/test/functional/readme/readme.ts +++ b/packages/verdaccio/test/functional/readme/readme.ts @@ -1,7 +1,7 @@ import { HTTP_STATUS } from '@verdaccio/core'; -import pkgReadmeJSON from './pkg-readme.json'; import pkgNoReadmeJSON from './pkg-no-readme.json'; +import pkgReadmeJSON from './pkg-readme.json'; export default function (server, server2) { const DEFAULT_NO_README = 'ERROR: No README data found!'; diff --git a/packages/verdaccio/test/functional/sanity/mirror.ts b/packages/verdaccio/test/functional/sanity/mirror.ts index 54cb370dc..97af538eb 100644 --- a/packages/verdaccio/test/functional/sanity/mirror.ts +++ b/packages/verdaccio/test/functional/sanity/mirror.ts @@ -1,8 +1,8 @@ import { API_MESSAGE, HTTP_STATUS } from '@verdaccio/core'; +import { TARBALL } from '../config.functional'; import generatePkg from '../fixtures/package'; import { readFile } from '../lib/test.utils'; -import { TARBALL } from '../config.functional'; const getBinary = () => readFile('../fixtures/binary'); diff --git a/packages/verdaccio/test/functional/sanity/nullstorage.ts b/packages/verdaccio/test/functional/sanity/nullstorage.ts index 85b67e778..6cc3f799c 100644 --- a/packages/verdaccio/test/functional/sanity/nullstorage.ts +++ b/packages/verdaccio/test/functional/sanity/nullstorage.ts @@ -1,5 +1,5 @@ +import { API_ERROR, DIST_TAGS, HTTP_STATUS } from '@verdaccio/core'; import { createTarballHash } from '@verdaccio/utils'; -import { DIST_TAGS, API_ERROR, HTTP_STATUS } from '@verdaccio/core'; import { DOMAIN_SERVERS, PORT_SERVER_1, TARBALL } from '../config.functional'; import generatePkg from '../fixtures/package'; diff --git a/packages/verdaccio/test/functional/sanity/racycrash.ts b/packages/verdaccio/test/functional/sanity/racycrash.ts index 00ec9166e..67fa30c2d 100644 --- a/packages/verdaccio/test/functional/sanity/racycrash.ts +++ b/packages/verdaccio/test/functional/sanity/racycrash.ts @@ -1,6 +1,7 @@ -import { DOMAIN_SERVERS, PORT_SERVER_APP } from '../config.functional'; import { API_ERROR, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; +import { DOMAIN_SERVERS, PORT_SERVER_APP } from '../config.functional'; + export default function (server, express) { describe('shoul test for unexpected client hangs', () => { let handleResponseTarball; diff --git a/packages/verdaccio/test/functional/sanity/security.ts b/packages/verdaccio/test/functional/sanity/security.ts index 800dc4333..a567bd957 100644 --- a/packages/verdaccio/test/functional/sanity/security.ts +++ b/packages/verdaccio/test/functional/sanity/security.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import { HTTP_STATUS } from '@verdaccio/core'; export default function (server) { diff --git a/packages/verdaccio/test/functional/scenarios/gh29.ts b/packages/verdaccio/test/functional/scenarios/gh29.ts index 85dee1fc8..fb3646c0b 100644 --- a/packages/verdaccio/test/functional/scenarios/gh29.ts +++ b/packages/verdaccio/test/functional/scenarios/gh29.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; + import { HTTP_STATUS } from '@verdaccio/core'; import { createTarballHash } from '@verdaccio/utils'; diff --git a/packages/verdaccio/test/functional/search/simple.search.ts b/packages/verdaccio/test/functional/search/simple.search.ts index 6fa856bde..79a8316e6 100644 --- a/packages/verdaccio/test/functional/search/simple.search.ts +++ b/packages/verdaccio/test/functional/search/simple.search.ts @@ -1,4 +1,5 @@ import { API_MESSAGE, HTTP_STATUS } from '@verdaccio/core'; + import pkgExample from './search.json'; export default function (server, server2, express) { diff --git a/packages/verdaccio/test/functional/tags/addtag.ts b/packages/verdaccio/test/functional/tags/addtag.ts index 581f512a4..ffb59f948 100644 --- a/packages/verdaccio/test/functional/tags/addtag.ts +++ b/packages/verdaccio/test/functional/tags/addtag.ts @@ -1,4 +1,4 @@ -import { API_ERROR, HTTP_STATUS, CHARACTER_ENCODING } from '@verdaccio/core'; +import { API_ERROR, CHARACTER_ENCODING, HTTP_STATUS } from '@verdaccio/core'; import { readFile } from '../lib/test.utils'; diff --git a/packages/verdaccio/test/functional/tags/dist-tags-merge.ts b/packages/verdaccio/test/functional/tags/dist-tags-merge.ts index 977ab7e2f..d0db6fb68 100644 --- a/packages/verdaccio/test/functional/tags/dist-tags-merge.ts +++ b/packages/verdaccio/test/functional/tags/dist-tags-merge.ts @@ -1,4 +1,4 @@ -import { DIST_TAGS, API_MESSAGE, HTTP_STATUS } from '@verdaccio/core'; +import { API_MESSAGE, DIST_TAGS, HTTP_STATUS } from '@verdaccio/core'; import { DOMAIN_SERVERS, PORT_SERVER_1, PORT_SERVER_2, PORT_SERVER_3 } from '../config.functional'; import { generateSha } from '../lib/test.utils'; diff --git a/packages/verdaccio/test/functional/tags/tags.ts b/packages/verdaccio/test/functional/tags/tags.ts index 4e945b7d6..c3196880a 100644 --- a/packages/verdaccio/test/functional/tags/tags.ts +++ b/packages/verdaccio/test/functional/tags/tags.ts @@ -1,5 +1,7 @@ import _ from 'lodash'; + import { HTTP_STATUS } from '@verdaccio/core'; + import SimpleServer from '../lib/simple_server'; const simpleServer = new SimpleServer(); diff --git a/packages/verdaccio/test/functional/uplinks/cache.ts b/packages/verdaccio/test/functional/uplinks/cache.ts index 62015fa21..663893d98 100644 --- a/packages/verdaccio/test/functional/uplinks/cache.ts +++ b/packages/verdaccio/test/functional/uplinks/cache.ts @@ -1,12 +1,13 @@ +import crypto from 'crypto'; import fs from 'fs'; import path from 'path'; -import crypto from 'crypto'; + import { HTTP_STATUS } from '@verdaccio/core'; import { createTarballHash } from '@verdaccio/utils'; import { TARBALL } from '../config.functional'; -import { readFile } from '../lib/test.utils'; import requirePackage from '../fixtures/package'; +import { readFile } from '../lib/test.utils'; function getBinary() { return readFile('../fixtures/binary'); diff --git a/packages/verdaccio/test/types-test/plugins/auth/example.auth.plugin.ts b/packages/verdaccio/test/types-test/plugins/auth/example.auth.plugin.ts index 09d34241b..00688fc90 100644 --- a/packages/verdaccio/test/types-test/plugins/auth/example.auth.plugin.ts +++ b/packages/verdaccio/test/types-test/plugins/auth/example.auth.plugin.ts @@ -1,17 +1,16 @@ // this file is not aim to be tested, just to check flow definitions +import { Callback } from '@verdaccio/types'; +import { + Config as AppConfig, + IPluginAuth, + Logger, + PackageAccess, + PluginOptions, + RemoteUser, +} from '@verdaccio/types'; import Config from '../../../../packages/config/src/config'; import { logger } from '../../../../packages/logger/src/logger'; -import { Callback } from '@verdaccio/types'; - -import { - Config as AppConfig, - PackageAccess, - IPluginAuth, - RemoteUser, - Logger, - PluginOptions, -} from '@verdaccio/types'; class ExampleAuthPlugin implements IPluginAuth<{}> { config: AppConfig; diff --git a/packages/verdaccio/test/types-test/plugins/storage/example.storage.plugin.ts b/packages/verdaccio/test/types-test/plugins/storage/example.storage.plugin.ts index a32c3e6cd..5588bdfa9 100644 --- a/packages/verdaccio/test/types-test/plugins/storage/example.storage.plugin.ts +++ b/packages/verdaccio/test/types-test/plugins/storage/example.storage.plugin.ts @@ -1,22 +1,20 @@ // this file is not aim to be tested, just to check typescript definitions - +import { generatePackageTemplate } from '@verdaccio/store'; +import { ReadTarball, UploadTarball } from '@verdaccio/streams'; import { - Callback, Config as AppConfig, + Callback, + IReadTarball, + IUploadTarball, Logger, Package, Token, TokenFilter, - IUploadTarball, - IReadTarball, } from '@verdaccio/types'; - -import { IPluginStorage, IPackageStorageManager, IPackageStorage } from '@verdaccio/types'; -import { UploadTarball, ReadTarball } from '@verdaccio/streams'; +import { IPackageStorage, IPackageStorageManager, IPluginStorage } from '@verdaccio/types'; import Config from '../../../../packages/config/src/config'; import { logger } from '../../../../packages/logger/src/logger'; -import { generatePackageTemplate } from '@verdaccio/store'; class PackageStorage implements IPackageStorageManager { path: string; diff --git a/packages/verdaccio/test/unit/__helper/__template/api.__test.ts b/packages/verdaccio/test/unit/__helper/__template/api.__test.ts index a92b7e733..cb717c6cf 100644 --- a/packages/verdaccio/test/unit/__helper/__template/api.__test.ts +++ b/packages/verdaccio/test/unit/__helper/__template/api.__test.ts @@ -7,18 +7,19 @@ * If you have any questions, ask at the http://chat.verdaccio.org #questions channel. * */ -import request from 'supertest'; import _ from 'lodash'; import path from 'path'; import rimraf from 'rimraf'; +import request from 'supertest'; -import endPointAPI from '@verdaccio/server'; -import { mockServer } from '../../__helper/mock'; -import { DOMAIN_SERVERS } from '../../../functional/config.functional'; import { parseConfigFile } from '@verdaccio/config'; +import { setup } from '@verdaccio/logger'; +import endPointAPI from '@verdaccio/server'; + +import { DOMAIN_SERVERS } from '../../../functional/config.functional'; import { parseConfigurationFile } from '../../__helper'; import { addUser } from '../../__helper/api'; -import { setup } from '@verdaccio/logger'; +import { mockServer } from '../../__helper/mock'; // we must start logging without output setup([]); diff --git a/packages/verdaccio/test/unit/__helper/api.ts b/packages/verdaccio/test/unit/__helper/api.ts index 3812d497d..7c3da3bc3 100644 --- a/packages/verdaccio/test/unit/__helper/api.ts +++ b/packages/verdaccio/test/unit/__helper/api.ts @@ -1,10 +1,10 @@ import _ from 'lodash'; import request from 'supertest'; -import { HEADER_TYPE, HEADERS, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; +import { HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; +import { Package } from '@verdaccio/types'; import { buildToken } from '@verdaccio/utils'; import { generateRandomHexString } from '@verdaccio/utils'; -import { Package } from '@verdaccio/types'; import { getTaggedVersionFromPackage } from './expects'; diff --git a/packages/web/src/api/package.ts b/packages/web/src/api/package.ts index b47e9fd0b..746bd7cf8 100644 --- a/packages/web/src/api/package.ts +++ b/packages/web/src/api/package.ts @@ -1,15 +1,15 @@ import buildDebug from 'debug'; +import { Router } from 'express'; import _ from 'lodash'; + +import { IAuth } from '@verdaccio/auth'; +import { logger } from '@verdaccio/logger'; +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '@verdaccio/middleware'; +import { Storage } from '@verdaccio/store'; +import { getLocalRegistryTarballUri } from '@verdaccio/tarball'; +import { Config, Package, RemoteUser } from '@verdaccio/types'; import { formatAuthor } from '@verdaccio/utils'; -import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '@verdaccio/middleware'; -import { logger } from '@verdaccio/logger'; -import { Router } from 'express'; -import { IAuth } from '@verdaccio/auth'; -import { Storage } from '@verdaccio/store'; -import { Config, Package, RemoteUser } from '@verdaccio/types'; - -import { getLocalRegistryTarballUri } from '@verdaccio/tarball'; import { generateGravatarUrl } from '../utils/user'; import { AuthorAvatar, sortByName } from '../utils/web-utils'; diff --git a/packages/web/src/api/readme.ts b/packages/web/src/api/readme.ts index 603af5f3b..0c73611ae 100644 --- a/packages/web/src/api/readme.ts +++ b/packages/web/src/api/readme.ts @@ -1,14 +1,14 @@ import buildDebug from 'debug'; -import sanitizyReadme from '@verdaccio/readme'; - -import { allow, $RequestExtend, $ResponseExtend, $NextFunctionVer } from '@verdaccio/middleware'; -import { HEADER_TYPE, HEADERS } from '@verdaccio/core'; import { Router } from 'express'; + import { IAuth } from '@verdaccio/auth'; +import { HEADERS, HEADER_TYPE } from '@verdaccio/core'; +import { $NextFunctionVer, $RequestExtend, $ResponseExtend, allow } from '@verdaccio/middleware'; +import sanitizyReadme from '@verdaccio/readme'; import { Storage } from '@verdaccio/store'; import { Package } from '@verdaccio/types'; -import { addScope, AuthorAvatar, parseReadme } from '../utils/web-utils'; +import { AuthorAvatar, addScope, parseReadme } from '../utils/web-utils'; export { $RequestExtend, $ResponseExtend, $NextFunctionVer }; // Was required by other packages diff --git a/packages/web/src/api/search.ts b/packages/web/src/api/search.ts index 158221f7f..9a1a57cc1 100644 --- a/packages/web/src/api/search.ts +++ b/packages/web/src/api/search.ts @@ -1,11 +1,13 @@ import buildDebug from 'debug'; -import { SearchInstance } from '@verdaccio/store'; -import { DIST_TAGS } from '@verdaccio/core'; import { Router } from 'express'; -import { Package } from '@verdaccio/types'; + import { IAuth } from '@verdaccio/auth'; +import { DIST_TAGS } from '@verdaccio/core'; +import { SearchInstance } from '@verdaccio/store'; import { Storage } from '@verdaccio/store'; -import { $ResponseExtend, $RequestExtend, $NextFunctionVer } from './package'; +import { Package } from '@verdaccio/types'; + +import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from './package'; const debug = buildDebug('verdaccio:web:api:search'); diff --git a/packages/web/src/api/sidebar.ts b/packages/web/src/api/sidebar.ts index 783df538a..da7fb2c74 100644 --- a/packages/web/src/api/sidebar.ts +++ b/packages/web/src/api/sidebar.ts @@ -1,16 +1,16 @@ import buildDebug from 'debug'; -import _ from 'lodash'; -import { isVersionValid, formatAuthor } from '@verdaccio/utils'; -import { HTTP_STATUS, DIST_TAGS } from '@verdaccio/core'; -import { allow, $RequestExtend, $ResponseExtend, $NextFunctionVer } from '@verdaccio/middleware'; - import { Router } from 'express'; -import { IAuth } from '@verdaccio/auth'; -import { Storage } from '@verdaccio/store'; -import { Config, Package, Version } from '@verdaccio/types'; +import _ from 'lodash'; +import { IAuth } from '@verdaccio/auth'; +import { DIST_TAGS, HTTP_STATUS } from '@verdaccio/core'; +import { $NextFunctionVer, $RequestExtend, $ResponseExtend, allow } from '@verdaccio/middleware'; +import { Storage } from '@verdaccio/store'; import { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball'; -import { addGravatarSupport, addScope, AuthorAvatar, deleteProperties } from '../utils/web-utils'; +import { Config, Package, Version } from '@verdaccio/types'; +import { formatAuthor, isVersionValid } from '@verdaccio/utils'; + +import { AuthorAvatar, addGravatarSupport, addScope, deleteProperties } from '../utils/web-utils'; export { $RequestExtend, $ResponseExtend, $NextFunctionVer }; // Was required by other packages diff --git a/packages/web/src/api/user.ts b/packages/web/src/api/user.ts index f9f925053..0f45f0e48 100644 --- a/packages/web/src/api/user.ts +++ b/packages/web/src/api/user.ts @@ -1,12 +1,12 @@ -import _ from 'lodash'; import buildDebug from 'debug'; -import { Router, Response, Request } from 'express'; +import { Request, Response, Router } from 'express'; +import _ from 'lodash'; -import { Config, RemoteUser, JWTSignOptions } from '@verdaccio/types'; - -import { API_ERROR, APP_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core'; import { IAuth } from '@verdaccio/auth'; +import { API_ERROR, APP_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core'; +import { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types'; import { validatePassword } from '@verdaccio/utils'; + import { $NextFunctionVer } from './package'; const debug = buildDebug('verdaccio:web:api:user'); diff --git a/packages/web/src/middleware/render-web.ts b/packages/web/src/middleware/render-web.ts index 0f07d8be3..3642b9b54 100644 --- a/packages/web/src/middleware/render-web.ts +++ b/packages/web/src/middleware/render-web.ts @@ -1,12 +1,13 @@ -import path from 'path'; -import _ from 'lodash'; import buildDebug from 'debug'; import express from 'express'; +import _ from 'lodash'; +import path from 'path'; -import { SearchInstance } from '@verdaccio/store'; import { HTTP_STATUS } from '@verdaccio/core'; import { loadPlugin } from '@verdaccio/loaders'; +import { SearchInstance } from '@verdaccio/store'; import { isURLhasValidProtocol } from '@verdaccio/url'; + import renderHTML from '../renderHTML'; import { setSecurityWebHeaders } from './security'; diff --git a/packages/web/src/middleware/web-api.ts b/packages/web/src/middleware/web-api.ts index 30491c267..45eb1a0cf 100644 --- a/packages/web/src/middleware/web-api.ts +++ b/packages/web/src/middleware/web-api.ts @@ -1,16 +1,17 @@ -import { Router } from 'express'; import bodyParser from 'body-parser'; +import { Router } from 'express'; -import { SearchInstance } from '@verdaccio/store'; -import { match, validateName, validatePackage } from '@verdaccio/middleware'; -import { Config } from '@verdaccio/types'; import { IAuth } from '@verdaccio/auth'; +import { match, validateName, validatePackage } from '@verdaccio/middleware'; +import { SearchInstance } from '@verdaccio/store'; import { Storage } from '@verdaccio/store'; -import addSearchWebApi from '../api/search'; +import { Config } from '@verdaccio/types'; + import addPackageWebApi from '../api/package'; -import addUserAuthApi from '../api/user'; import addReadmeWebApi from '../api/readme'; +import addSearchWebApi from '../api/search'; import addSidebarWebApi from '../api/sidebar'; +import addUserAuthApi from '../api/user'; import { hasLogin } from '../utils/web-utils'; import { setSecurityWebHeaders } from './security'; diff --git a/packages/web/src/renderHTML.ts b/packages/web/src/renderHTML.ts index 83afc27fe..6236cc1f8 100644 --- a/packages/web/src/renderHTML.ts +++ b/packages/web/src/renderHTML.ts @@ -1,12 +1,13 @@ -import { URL } from 'url'; import buildDebug from 'debug'; import LRU from 'lru-cache'; +import { URL } from 'url'; + +import { WEB_TITLE } from '@verdaccio/config'; import { HEADERS } from '@verdaccio/core'; import { getPublicUrl } from '@verdaccio/url'; -import { WEB_TITLE } from '@verdaccio/config'; -import { hasLogin, validatePrimaryColor } from './utils/web-utils'; import renderTemplate from './template'; +import { hasLogin, validatePrimaryColor } from './utils/web-utils'; const pkgJSON = require('../package.json'); const DEFAULT_LANGUAGE = 'es-US'; diff --git a/packages/web/src/template.ts b/packages/web/src/template.ts index 72b45c881..bc540796e 100644 --- a/packages/web/src/template.ts +++ b/packages/web/src/template.ts @@ -1,6 +1,8 @@ import buildDebug from 'debug'; + import { TemplateUIOptions } from '@verdaccio/types'; -import { getManifestValue, Manifest } from './utils/manifest'; + +import { Manifest, getManifestValue } from './utils/manifest'; const debug = buildDebug('verdaccio:web:render:template'); diff --git a/packages/web/src/utils/web-utils.ts b/packages/web/src/utils/web-utils.ts index 9e3c99ab4..cd563427b 100644 --- a/packages/web/src/utils/web-utils.ts +++ b/packages/web/src/utils/web-utils.ts @@ -1,13 +1,14 @@ -import _ from 'lodash'; import buildDebug from 'debug'; -import { isObject } from '@verdaccio/utils'; -import { Package, Author, ConfigYaml } from '@verdaccio/types'; -import { normalizeContributors } from '@verdaccio/store'; +import _ from 'lodash'; import sanitizyReadme from '@verdaccio/readme'; +import { normalizeContributors } from '@verdaccio/store'; +import { Author, ConfigYaml, Package } from '@verdaccio/types'; +import { isObject } from '@verdaccio/utils'; + +import { GENERIC_AVATAR, generateGravatarUrl } from './user'; export type AuthorAvatar = Author & { avatar?: string }; -import { generateGravatarUrl, GENERIC_AVATAR } from './user'; const debug = buildDebug('verdaccio:web:utils'); diff --git a/packages/web/src/web-middleware.ts b/packages/web/src/web-middleware.ts index 149aa53d9..00cab033a 100644 --- a/packages/web/src/web-middleware.ts +++ b/packages/web/src/web-middleware.ts @@ -1,4 +1,5 @@ import express from 'express'; + import { renderWebMiddleware } from './middleware/render-web'; import { webAPI } from './middleware/web-api'; diff --git a/packages/web/test/api.packages.test.ts b/packages/web/test/api.packages.test.ts index 6c0d75ae3..7576177ee 100644 --- a/packages/web/test/api.packages.test.ts +++ b/packages/web/test/api.packages.test.ts @@ -1,7 +1,9 @@ import path from 'path'; import supertest from 'supertest'; -import { setup } from '@verdaccio/logger'; + import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; +import { setup } from '@verdaccio/logger'; + import { initializeServer } from './helper'; setup([]); diff --git a/packages/web/test/api.readme.test.ts b/packages/web/test/api.readme.test.ts index d245335dd..6c7b1a58c 100644 --- a/packages/web/test/api.readme.test.ts +++ b/packages/web/test/api.readme.test.ts @@ -1,8 +1,9 @@ import path from 'path'; import supertest from 'supertest'; + +import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { setup } from '@verdaccio/logger'; import { IGetPackageOptions } from '@verdaccio/store'; -import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { NOT_README_FOUND } from '../src/api/readme'; import { initializeServer } from './helper'; diff --git a/packages/web/test/api.search.test.ts b/packages/web/test/api.search.test.ts index d50228419..8bc433ef7 100644 --- a/packages/web/test/api.search.test.ts +++ b/packages/web/test/api.search.test.ts @@ -1,9 +1,10 @@ import path from 'path'; import supertest from 'supertest'; -import { IGetPackageOptions } from '@verdaccio/store'; -import { setup } from '@verdaccio/logger'; import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; +import { setup } from '@verdaccio/logger'; +import { IGetPackageOptions } from '@verdaccio/store'; + import { initializeServer } from './helper'; setup([]); diff --git a/packages/web/test/api.sidebar.test.ts b/packages/web/test/api.sidebar.test.ts index 78fb5a740..fc62825f9 100644 --- a/packages/web/test/api.sidebar.test.ts +++ b/packages/web/test/api.sidebar.test.ts @@ -1,8 +1,9 @@ import path from 'path'; import supertest from 'supertest'; + +import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { setup } from '@verdaccio/logger'; import { IGetPackageOptions } from '@verdaccio/store'; -import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { NOT_README_FOUND } from '../src/api/readme'; import { initializeServer } from './helper'; diff --git a/packages/web/test/api.user.test.ts b/packages/web/test/api.user.test.ts index 9306be66b..ae209ae01 100644 --- a/packages/web/test/api.user.test.ts +++ b/packages/web/test/api.user.test.ts @@ -1,7 +1,9 @@ import path from 'path'; import supertest from 'supertest'; + +import { API_ERROR, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { setup } from '@verdaccio/logger'; -import { HEADERS, HEADER_TYPE, HTTP_STATUS, API_ERROR } from '@verdaccio/core'; + import { initializeServer } from './helper'; setup([]); diff --git a/packages/web/test/helper.ts b/packages/web/test/helper.ts index 76226d631..a7450bdce 100644 --- a/packages/web/test/helper.ts +++ b/packages/web/test/helper.ts @@ -1,13 +1,14 @@ -import path from 'path'; +import bodyParser from 'body-parser'; import express from 'express'; import { Application } from 'express'; -import bodyParser from 'body-parser'; -import { Config, parseConfigFile } from '@verdaccio/config'; -import { final, handleError, errorReportingMiddleware } from '@verdaccio/middleware'; +import path from 'path'; -import { Storage } from '@verdaccio/store'; import { Auth, IAuth } from '@verdaccio/auth'; +import { Config, parseConfigFile } from '@verdaccio/config'; import { setup } from '@verdaccio/logger'; +import { errorReportingMiddleware, final, handleError } from '@verdaccio/middleware'; +import { Storage } from '@verdaccio/store'; + import routes from '../src'; setup([]); diff --git a/packages/web/test/render.test.ts b/packages/web/test/render.test.ts index e52472d55..65ed6b33b 100644 --- a/packages/web/test/render.test.ts +++ b/packages/web/test/render.test.ts @@ -1,7 +1,9 @@ import path from 'path'; import supertest from 'supertest'; + +import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { setup } from '@verdaccio/logger'; -import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core'; + import { initializeServer } from './helper'; setup([]); diff --git a/packages/web/test/template.test.ts b/packages/web/test/template.test.ts index b563ffe46..51b42102c 100644 --- a/packages/web/test/template.test.ts +++ b/packages/web/test/template.test.ts @@ -1,4 +1,5 @@ import template from '../src/template'; + const manifest = require('./partials/manifest/manifest.json'); const exampleManifest = { diff --git a/packages/web/test/utils.spec.ts b/packages/web/test/utils.spec.ts index 694ce7b4f..44b979c6e 100644 --- a/packages/web/test/utils.spec.ts +++ b/packages/web/test/utils.spec.ts @@ -1,8 +1,8 @@ import fs from 'fs'; import path from 'path'; +import { GENERIC_AVATAR, generateGravatarUrl } from '../src/utils/user'; import { addGravatarSupport, parseReadme } from '../src/utils/web-utils'; -import { generateGravatarUrl, GENERIC_AVATAR } from '../src/utils/user'; const readmeFile = (fileName = 'markdown.md') => { return fs.readFileSync(path.join(__dirname, `./partials/readme/${fileName}`)); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 307c938ae..bbf0f80cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,6 +31,7 @@ importers: '@changesets/cli': 2.15.0 '@changesets/get-dependents-graph': 1.2.2 '@crowdin/cli': 3.7.1 + '@trivago/prettier-plugin-sort-imports': 3.0.0 '@types/async': 3.2.7 '@types/autocannon': 4.1.1 '@types/autosuggest-highlight': 3.1.1 @@ -121,6 +122,7 @@ importers: '@changesets/cli': 2.15.0 '@changesets/get-dependents-graph': 1.2.2 '@crowdin/cli': 3.7.1 + '@trivago/prettier-plugin-sort-imports': 3.0.0_prettier@2.3.2 '@types/async': 3.2.7 '@types/autocannon': 4.1.1 '@types/autosuggest-highlight': 3.1.1 @@ -1511,6 +1513,30 @@ packages: - supports-color dev: false + /@babel/core/7.13.10: + resolution: {integrity: sha512-bfIYcT0BdKeAZrovpMqX2Mx5NrgAckGbwT982AkdS5GNfn3KMGiprlBAtmBcFZRUmpaufS6WZFP8trvx8ptFDw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.15.8 + '@babel/generator': 7.15.8 + '@babel/helper-compilation-targets': 7.15.4_@babel+core@7.13.10 + '@babel/helper-module-transforms': 7.15.8 + '@babel/helpers': 7.15.4 + '@babel/parser': 7.15.8 + '@babel/template': 7.15.4 + '@babel/traverse': 7.15.4 + '@babel/types': 7.15.6 + convert-source-map: 1.7.0 + debug: 4.3.2 + gensync: 1.0.0-beta.2 + json5: 2.2.0 + lodash: 4.17.21 + semver: 6.3.0 + source-map: 0.5.7 + transitivePeerDependencies: + - supports-color + dev: true + /@babel/core/7.13.15: resolution: {integrity: sha512-6GXmNYeNjS2Uz+uls5jalOemgIhnTMeaXo+yBUA72kC2uX/8VW6XyhVIo2L8/q0goKQA3EVKx0KOQpVKSeWadQ==} engines: {node: '>=6.9.0'} @@ -1587,6 +1613,14 @@ packages: source-map: 0.5.7 dev: true + /@babel/generator/7.13.9: + resolution: {integrity: sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw==} + dependencies: + '@babel/types': 7.15.6 + jsesc: 2.5.2 + source-map: 0.5.7 + dev: true + /@babel/generator/7.14.5: resolution: {integrity: sha512-y3rlP+/G25OIX3mYKKIOlQRcqj7YgrvHxOLbVmyLJ9bPmi5ttvUmpydVjcFjZphOktWuA7ovbx91ECloWTfjIA==} engines: {node: '>=6.9.0'} @@ -1626,6 +1660,19 @@ packages: '@babel/helper-explode-assignable-expression': 7.15.4 '@babel/types': 7.15.6 + /@babel/helper-compilation-targets/7.15.4_@babel+core@7.13.10: + resolution: {integrity: sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/compat-data': 7.15.0 + '@babel/core': 7.13.10 + '@babel/helper-validator-option': 7.14.5 + browserslist: 4.17.4 + semver: 6.3.0 + dev: true + /@babel/helper-compilation-targets/7.15.4_@babel+core@7.13.15: resolution: {integrity: sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==} engines: {node: '>=6.9.0'} @@ -1977,6 +2024,12 @@ packages: hasBin: true dev: true + /@babel/parser/7.13.10: + resolution: {integrity: sha512-0s7Mlrw9uTWkYua7xWr99Wpk2bnGa0ANleKfksYAES8LpWH4gW1OUr42vqKNf0us5UQNfru2wPqMqRITzq/SIQ==} + engines: {node: '>=6.0.0'} + hasBin: true + dev: true + /@babel/parser/7.15.5: resolution: {integrity: sha512-2hQstc6I7T6tQsWzlboMh3SgMRPaS4H6H7cPQsJkdzTzEGqQrpLDsE2BGASU5sBPoEQyHzeqU6C8uKbFeEk6sg==} engines: {node: '>=6.0.0'} @@ -3907,6 +3960,22 @@ packages: - supports-color dev: true + /@babel/traverse/7.13.0: + resolution: {integrity: sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ==} + dependencies: + '@babel/code-frame': 7.15.8 + '@babel/generator': 7.15.8 + '@babel/helper-function-name': 7.15.4 + '@babel/helper-split-export-declaration': 7.15.4 + '@babel/parser': 7.15.8 + '@babel/types': 7.15.6 + debug: 4.3.2 + globals: 11.12.0 + lodash: 4.17.21 + transitivePeerDependencies: + - supports-color + dev: true + /@babel/traverse/7.14.5: resolution: {integrity: sha512-G3BiS15vevepdmFqmUc9X+64y0viZYygubAMO8SvBmKARuF6CPSZtH4Ng9vi/lrWlZFGe3FWdXNy835akH8Glg==} engines: {node: '>=6.9.0'} @@ -3956,6 +4025,14 @@ packages: to-fast-properties: 2.0.0 dev: true + /@babel/types/7.13.0: + resolution: {integrity: sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==} + dependencies: + '@babel/helper-validator-identifier': 7.15.7 + lodash: 4.17.21 + to-fast-properties: 2.0.0 + dev: true + /@babel/types/7.15.4: resolution: {integrity: sha512-0f1HJFuGmmbrKTCZtbm3cU+b/AqdEYk5toj5iQur58xkVMlS0JWaKxTBSmCXd47uiN7vbcozAupm6Mvs80GNhw==} engines: {node: '>=6.9.0'} @@ -6063,6 +6140,24 @@ packages: resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} engines: {node: '>= 6'} + /@trivago/prettier-plugin-sort-imports/3.0.0_prettier@2.3.2: + resolution: {integrity: sha512-6n+shLUWKPZpSdY25VyDO+AKc5lCAuugDLtatWNrCBB2H7dJHmO4HO9EMRALrry9P4jBNi1T1orGQ/Fxm7pkNg==} + peerDependencies: + prettier: 2.x + dependencies: + '@babel/core': 7.13.10 + '@babel/generator': 7.13.9 + '@babel/parser': 7.13.10 + '@babel/traverse': 7.13.0 + '@babel/types': 7.13.0 + '@types/lodash': 4.14.168 + javascript-natural-sort: 0.7.1 + lodash: 4.17.21 + prettier: 2.3.2 + transitivePeerDependencies: + - supports-color + dev: true + /@trysound/sax/0.1.1: resolution: {integrity: sha512-Z6DoceYb/1xSg5+e+ZlPZ9v0N16ZvZ+wYMraFue4HYrE4ttONKtsvruIRf6t9TBR0YvSOfi1hUU0fJfBLCDYow==} engines: {node: '>=10.13.0'} @@ -6319,6 +6414,10 @@ packages: '@types/node': 15.12.4 dev: true + /@types/lodash/4.14.168: + resolution: {integrity: sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==} + dev: true + /@types/lodash/4.14.175: resolution: {integrity: sha512-XmdEOrKQ8a1Y/yxQFOMbC47G/V2VDO1GvMRnl4O75M4GW/abC5tnfzadQYkqEveqRM1dEJGFFegfPNA2vvx2iw==} dev: false @@ -13631,6 +13730,10 @@ packages: istanbul-lib-report: 3.0.0 dev: true + /javascript-natural-sort/0.7.1: + resolution: {integrity: sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k=} + dev: true + /jest-changed-files/27.3.0: resolution: {integrity: sha512-9DJs9garMHv4RhylUMZgbdCJ3+jHSkpL9aaVKp13xtXAD80qLTLrqcDZL1PHA9dYA0bCI86Nv2BhkLpLhrBcPg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 000000000..28b82da39 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,16 @@ +module.exports = { + endOfLine: 'lf', + useTabs: false, + printWidth: 100, + tabWidth: 2, + singleQuote: true, + bracketSpacing: true, + jsxBracketSameLine: true, + trailingComma: 'es5', + semi: true, + plugins: [require('@trivago/prettier-plugin-sort-imports')], + importOrder: ['^@verdaccio/(.*)$', '^[./]'], + importOrderSeparation: true, + importOrderParserPlugins: ['typescript', 'classProperties', 'jsx'], + importOrderSortSpecifiers: true, +}; diff --git a/test/e2e-cli/setup/setup.ts b/test/e2e-cli/setup/setup.ts index b8e4fac02..561d8b850 100644 --- a/test/e2e-cli/setup/setup.ts +++ b/test/e2e-cli/setup/setup.ts @@ -1,12 +1,14 @@ -import fs from 'fs'; -import path from 'path'; -import os from 'os'; import { spawn } from 'child_process'; import buildDebug from 'debug'; +import fs from 'fs'; import { yellow } from 'kleur'; -import { pnpmGlobal } from '../utils/process'; +import os from 'os'; +import path from 'path'; + import * as __global from '../utils/global.js'; +import { pnpmGlobal } from '../utils/process'; import { SETUP_VERDACCIO_PORT } from '../utils/utils'; + // import { waitOnRegistry } from '../utils/registry'; const debug = buildDebug('verdaccio:e2e:setup'); diff --git a/test/e2e-cli/setup/test_environment.ts b/test/e2e-cli/setup/test_environment.ts index f18f9b8c6..dbc5f9e01 100644 --- a/test/e2e-cli/setup/test_environment.ts +++ b/test/e2e-cli/setup/test_environment.ts @@ -1,7 +1,8 @@ -import os from 'os'; -import path from 'path'; import buildDebug from 'debug'; import NodeEnvironment from 'jest-environment-node'; +import os from 'os'; +import path from 'path'; + const fs = require('fs'); const __global = require('../utils/global'); diff --git a/test/e2e-cli/test_bk/info.spec.ts b/test/e2e-cli/test_bk/info.spec.ts index 92f8754ee..e5ac3dea8 100644 --- a/test/e2e-cli/test_bk/info.spec.ts +++ b/test/e2e-cli/test_bk/info.spec.ts @@ -1,5 +1,5 @@ -import { initialSetup } from '../utils/registry'; import { npm, pnpm, yarn } from '../utils/process'; +import { initialSetup } from '../utils/registry'; describe('install a package', () => { jest.setTimeout(90000); diff --git a/test/e2e-cli/test_bk/install.spec.ts b/test/e2e-cli/test_bk/install.spec.ts index 8b18fb538..69cd35a50 100644 --- a/test/e2e-cli/test_bk/install.spec.ts +++ b/test/e2e-cli/test_bk/install.spec.ts @@ -1,6 +1,7 @@ import semver from 'semver'; -import { addNpmPrefix, addRegistry, addYarnPrefix, initialSetup, Setup } from '../utils/registry'; + import { npm, pnpm, yarn, yarnWithCwd } from '../utils/process'; +import { Setup, addNpmPrefix, addRegistry, addYarnPrefix, initialSetup } from '../utils/registry'; import { createProject } from '../utils/utils'; describe('install a package', () => { diff --git a/test/e2e-cli/test_bk/search.spec.ts b/test/e2e-cli/test_bk/search.spec.ts index d445744c7..07c2ff5db 100644 --- a/test/e2e-cli/test_bk/search.spec.ts +++ b/test/e2e-cli/test_bk/search.spec.ts @@ -1,5 +1,5 @@ -import { addRegistry, initialSetup } from '../utils/registry'; import { npm } from '../utils/process'; +import { addRegistry, initialSetup } from '../utils/registry'; describe('search a package', () => { jest.setTimeout(90000); diff --git a/test/e2e-cli/utils/global.js b/test/e2e-cli/utils/global.js index bd222b2ee..3e2e04d34 100644 --- a/test/e2e-cli/utils/global.js +++ b/test/e2e-cli/utils/global.js @@ -1,6 +1,7 @@ -const namespace = Object.create(null); import buildDebug from 'debug'; +const namespace = Object.create(null); + const debug = buildDebug('verdaccio:e2e:global'); exports.addItem = function (name, value) { diff --git a/test/e2e-cli/utils/process.ts b/test/e2e-cli/utils/process.ts index a7534aca0..9760c4d4c 100644 --- a/test/e2e-cli/utils/process.ts +++ b/test/e2e-cli/utils/process.ts @@ -1,7 +1,7 @@ import { spawn } from 'child_process'; import { SpawnOptions } from 'child_process'; -import readline from 'readline'; import buildDebug from 'debug'; +import readline from 'readline'; const debug = buildDebug('verdaccio:e2e:process'); diff --git a/test/e2e-cli/utils/registry.ts b/test/e2e-cli/utils/registry.ts index ebbf5da59..b4732db7b 100644 --- a/test/e2e-cli/utils/registry.ts +++ b/test/e2e-cli/utils/registry.ts @@ -1,9 +1,9 @@ /* eslint-disable prefer-promise-reject-errors */ import { ChildProcess, fork } from 'child_process'; -import path from 'path'; -import fs from 'fs'; -import waitOn from 'wait-on'; import buildDebug from 'debug'; +import fs from 'fs'; +import path from 'path'; +import waitOn from 'wait-on'; import { silentNpm } from './process'; diff --git a/test/e2e-cli/utils/utils.ts b/test/e2e-cli/utils/utils.ts index 61440e3a2..ee28ca23b 100644 --- a/test/e2e-cli/utils/utils.ts +++ b/test/e2e-cli/utils/utils.ts @@ -1,6 +1,6 @@ -import path from 'path'; -import os from 'os'; import fs from 'fs-extra'; +import os from 'os'; +import path from 'path'; export function createProject(projectName: string) { // @ts-ignore diff --git a/test/e2e-ui/request.ts b/test/e2e-ui/request.ts index 09247b84d..5964b3e8f 100644 --- a/test/e2e-ui/request.ts +++ b/test/e2e-ui/request.ts @@ -1,5 +1,4 @@ import assert from 'assert'; - import _ from 'lodash'; import request from 'request'; diff --git a/test/e2e-ui/server.ts b/test/e2e-ui/server.ts index 75c501c6e..8ceaca861 100644 --- a/test/e2e-ui/server.ts +++ b/test/e2e-ui/server.ts @@ -1,8 +1,8 @@ import assert from 'assert'; - -import { HTTP_STATUS, HEADERS, API_MESSAGE } from '@verdaccio/core'; import _ from 'lodash'; +import { API_MESSAGE, HEADERS, HTTP_STATUS } from '@verdaccio/core'; + import { CREDENTIALS } from './registry-launcher'; import smartRequest, { RequestPromise } from './request'; diff --git a/website/package.json b/website/package.json index 1449d79f1..e944a26a1 100644 --- a/website/package.json +++ b/website/package.json @@ -17,7 +17,7 @@ "eslint:check": "eslint src/**/*.tsx", "eslint:write": "eslint src/**/*.tsx --fix", "prettier:check": "prettier src/**/* --check", - "prettier:write": "prettier src/**/* --write" + "prettier:write": "prettier src/**/* --write --config ../prettier.config.js" }, "engines": { "node": ">=14" diff --git a/website/src/components/Command.tsx b/website/src/components/Command.tsx index bdbd45b14..8d8574bab 100644 --- a/website/src/components/Command.tsx +++ b/website/src/components/Command.tsx @@ -1,7 +1,7 @@ -import React, { useState } from 'react'; +import Translate, { translate } from '@docusaurus/Translate'; import clsx from 'clsx'; import copy from 'copy-text-to-clipboard'; -import Translate, { translate } from '@docusaurus/Translate'; +import React, { useState } from 'react'; import styles from './Command.module.scss'; diff --git a/website/src/components/Divider.tsx b/website/src/components/Divider.tsx index 5db21214b..b667f997b 100644 --- a/website/src/components/Divider.tsx +++ b/website/src/components/Divider.tsx @@ -1,5 +1,6 @@ -import React from 'react'; import clsx from 'clsx'; +import React from 'react'; + import styles from './Divider.module.scss'; type DividerProps = { diff --git a/website/src/components/FeatureCard.tsx b/website/src/components/FeatureCard.tsx index fbc0c3eb2..7bea479a8 100644 --- a/website/src/components/FeatureCard.tsx +++ b/website/src/components/FeatureCard.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import styles from './FeatureCard.module.scss'; type FeatureCardProps = { diff --git a/website/src/components/Features.tsx b/website/src/components/Features.tsx index d592c1f8d..3141e449a 100644 --- a/website/src/components/Features.tsx +++ b/website/src/components/Features.tsx @@ -1,9 +1,9 @@ -import React from 'react'; import Translate, { translate } from '@docusaurus/Translate'; -import { useBaseUrlUtils } from '@docusaurus/useBaseUrl'; import { Link } from '@docusaurus/router'; -import FeatureCard from './FeatureCard'; +import { useBaseUrlUtils } from '@docusaurus/useBaseUrl'; +import React from 'react'; +import FeatureCard from './FeatureCard'; import styles from './Features.module.scss'; const FEATURES = [ diff --git a/website/src/components/Header.tsx b/website/src/components/Header.tsx index a06376d33..5c04dbbfd 100644 --- a/website/src/components/Header.tsx +++ b/website/src/components/Header.tsx @@ -1,11 +1,11 @@ -import React from 'react'; -import useBaseUrl from '@docusaurus/useBaseUrl'; -import { Link } from '@docusaurus/router'; -import { Follow } from 'react-twitter-widgets'; import Translate, { translate } from '@docusaurus/Translate'; +import { Link } from '@docusaurus/router'; +import useBaseUrl from '@docusaurus/useBaseUrl'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import Command from './Command'; +import React from 'react'; +import { Follow } from 'react-twitter-widgets'; +import Command from './Command'; import styles from './Header.module.scss'; const Header = (): React.ReactElement => { diff --git a/website/src/components/PackageManagers.tsx b/website/src/components/PackageManagers.tsx index e5f858662..b1cebd08c 100644 --- a/website/src/components/PackageManagers.tsx +++ b/website/src/components/PackageManagers.tsx @@ -1,9 +1,9 @@ -import React from 'react'; -import useBaseUrl from '@docusaurus/useBaseUrl'; import Translate, { translate } from '@docusaurus/Translate'; -import Divider from './Divider'; -import Command from './Command'; +import useBaseUrl from '@docusaurus/useBaseUrl'; +import React from 'react'; +import Command from './Command'; +import Divider from './Divider'; import styles from './PackageManagers.module.scss'; const PackageManagers = (): React.ReactElement => ( diff --git a/website/src/components/Spinner.tsx b/website/src/components/Spinner.tsx index 195552fc2..fbdac0d7e 100644 --- a/website/src/components/Spinner.tsx +++ b/website/src/components/Spinner.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import styles from './Spinner.module.scss'; const Spinner = (): React.ReactElement =>
Loading...
; diff --git a/website/src/components/Testimonials.tsx b/website/src/components/Testimonials.tsx index bd1bda348..ebae7ce9b 100644 --- a/website/src/components/Testimonials.tsx +++ b/website/src/components/Testimonials.tsx @@ -1,5 +1,6 @@ import Translate from '@docusaurus/Translate'; import React from 'react'; + import styles from './Testimonials.module.scss'; import TwitterCarrousel from './TwitterCarrousel'; diff --git a/website/src/components/TwitterCarrousel.tsx b/website/src/components/TwitterCarrousel.tsx index ac933a265..9526e292b 100644 --- a/website/src/components/TwitterCarrousel.tsx +++ b/website/src/components/TwitterCarrousel.tsx @@ -1,13 +1,13 @@ -import React, { useState, useRef, useCallback } from 'react'; -import useThemeContext from '@theme/hooks/useThemeContext'; -import { Tweet } from 'react-twitter-widgets'; -import clsx from 'clsx'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import { translate } from '@docusaurus/Translate'; -import Spinner from './Spinner'; -import useClampedIsInViewport from './hooks/useClampedIsInViewport'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import useThemeContext from '@theme/hooks/useThemeContext'; +import clsx from 'clsx'; +import React, { useCallback, useRef, useState } from 'react'; +import { Tweet } from 'react-twitter-widgets'; +import Spinner from './Spinner'; import styles from './TwitterCarrousel.module.scss'; +import useClampedIsInViewport from './hooks/useClampedIsInViewport'; const Carrousel = ({ data }: { data: string[][] }): React.ReactElement => { const { isDarkTheme } = useThemeContext(); diff --git a/website/src/components/UsedBy.tsx b/website/src/components/UsedBy.tsx index ac82637e2..31a464851 100644 --- a/website/src/components/UsedBy.tsx +++ b/website/src/components/UsedBy.tsx @@ -1,11 +1,10 @@ -import React from 'react'; -import useBaseUrl from '@docusaurus/useBaseUrl'; import Translate from '@docusaurus/Translate'; - -import styles from './UsedBy.module.scss'; +import useBaseUrl from '@docusaurus/useBaseUrl'; +import React from 'react'; import Divider from './Divider'; import SponsorImage from './SponsorImage'; +import styles from './UsedBy.module.scss'; const UsedBy = (): React.ReactElement => (
diff --git a/website/src/components/WhatIsVerdaccio.tsx b/website/src/components/WhatIsVerdaccio.tsx index c3d9a5cd4..6bade70bc 100644 --- a/website/src/components/WhatIsVerdaccio.tsx +++ b/website/src/components/WhatIsVerdaccio.tsx @@ -1,9 +1,9 @@ -import React from 'react'; import Translate from '@docusaurus/Translate'; import { Link } from '@docusaurus/router'; import useBaseUrl from '@docusaurus/useBaseUrl'; -import Divider from './Divider'; +import React from 'react'; +import Divider from './Divider'; import styles from './WhatIsVerdaccio.module.scss'; const WhatIs = (): React.ReactElement => ( diff --git a/website/src/pages/contributors.tsx b/website/src/pages/contributors.tsx index 04acaa9fe..5128a5327 100644 --- a/website/src/pages/contributors.tsx +++ b/website/src/pages/contributors.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import Layout from '@theme/Layout'; - import Translate, { translate } from '@docusaurus/Translate'; +import Layout from '@theme/Layout'; +import React from 'react'; + import styles from './contributors.module.scss'; const Contributors = (): React.ReactElement => ( diff --git a/website/src/pages/help.tsx b/website/src/pages/help.tsx index 64cca4d4f..2388a26b6 100644 --- a/website/src/pages/help.tsx +++ b/website/src/pages/help.tsx @@ -1,11 +1,11 @@ -import React from 'react'; -import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; -import { Follow } from 'react-twitter-widgets'; import Translate from '@docusaurus/Translate'; -import clsx from 'clsx'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import Layout from '@theme/Layout'; +import clsx from 'clsx'; +import React from 'react'; +import { Follow } from 'react-twitter-widgets'; import styles from './help.module.scss'; diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index be8cd5eef..a582eb826 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -1,15 +1,14 @@ -import React from 'react'; -import Layout from '@theme/Layout'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import Layout from '@theme/Layout'; +import React from 'react'; -import Header from '../components/Header'; -import UsedBy from '../components/UsedBy'; import Feature from '../components/Features'; -import WhatIsVerdaccio from '../components/WhatIsVerdaccio'; +import Header from '../components/Header'; import PackageManagers from '../components/PackageManagers'; import Testimonial from '../components/Testimonials'; +import UsedBy from '../components/UsedBy'; import Wave from '../components/Wave'; - +import WhatIsVerdaccio from '../components/WhatIsVerdaccio'; import styles from './index.module.scss'; const Home = (): React.ReactElement => {