From f99b272e2c9e8476851faff24c858044927f9428 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 15:09:26 +0100 Subject: [PATCH 01/46] Switch shields.io package to module type --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index bc686b0ae6b66..44ba4e4f32cf7 100644 --- a/package.json +++ b/package.json @@ -244,6 +244,7 @@ "node": "^12.18.3", "npm": ">=7.0.0" }, + "type": "module", "babel": { "plugins": [ [ From 483cc96585b683eafc9eb407da47ad365c3333e2 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 15:44:15 +0100 Subject: [PATCH 02/46] Run Putout convert-commonjs-to-esm with require and exports rules --- core/badge-urls/make-badge-url.js | 14 +++--- core/badge-urls/make-badge-url.spec.js | 13 +----- core/badge-urls/path-helpers.js | 20 ++++----- core/badge-urls/path-helpers.spec.js | 6 +-- core/base-service/auth-helper.js | 8 ++-- core/base-service/auth-helper.spec.js | 10 ++--- core/base-service/base-graphql.js | 12 +++-- core/base-service/base-graphql.spec.js | 14 +++--- core/base-service/base-json.js | 8 ++-- core/base-service/base-json.spec.js | 10 ++--- core/base-service/base-static.js | 25 +++++------ core/base-service/base-svg-scraping.js | 12 +++-- core/base-service/base-svg-scraping.spec.js | 14 +++--- core/base-service/base-xml.js | 14 +++--- core/base-service/base-xml.spec.js | 10 ++--- core/base-service/base-yaml.js | 14 +++--- core/base-service/base-yaml.spec.js | 10 ++--- core/base-service/base.js | 44 +++++++------------ core/base-service/base.spec.js | 32 +++++--------- core/base-service/cache-headers.js | 12 +++-- core/base-service/categories.js | 10 ++--- core/base-service/check-error-response.js | 8 ++-- .../base-service/check-error-response.spec.js | 8 ++-- core/base-service/coalesce-badge.js | 17 +++---- core/base-service/coalesce-badge.spec.js | 8 ++-- core/base-service/coalesce.js | 6 +-- core/base-service/coalesce.spec.js | 6 +-- core/base-service/deprecated-service.js | 18 ++++---- core/base-service/deprecated-service.spec.js | 6 +-- core/base-service/errors.js | 6 +-- core/base-service/examples.js | 16 +++---- core/base-service/examples.spec.js | 8 ++-- core/base-service/graphql.js | 3 +- core/base-service/graphql.spec.js | 12 +++-- core/base-service/index.js | 32 +++++--------- core/base-service/json.js | 12 +++-- core/base-service/legacy-request-handler.js | 24 ++++------ .../legacy-request-handler.spec.js | 16 +++---- core/base-service/legacy-result-sender.js | 8 ++-- .../empty-array.fixture.js | 4 +- .../empty-object.fixture.js | 4 +- .../empty-undefined.fixture.js | 4 +- .../invalid-mixed.fixture.js | 6 +-- .../invalid-no-base.fixture.js | 4 +- .../invalid-wrong-base.fixture.js | 4 +- .../valid-array.fixture.js | 6 +-- .../valid-class.fixture.js | 6 +-- .../valid-object.fixture.js | 6 +-- core/base-service/loader.js | 18 ++++---- core/base-service/loader.spec.js | 6 +-- core/base-service/metric-helper.js | 6 +-- core/base-service/redirector.js | 31 ++++++------- core/base-service/redirector.spec.js | 12 +++-- core/base-service/route.js | 12 +++-- core/base-service/route.spec.js | 14 ++---- core/base-service/service-definitions.js | 8 ++-- core/base-service/to-array.js | 6 +-- core/base-service/trace.js | 8 ++-- core/base-service/validate.js | 10 ++--- core/base-service/validate.spec.js | 14 +++--- core/got-test-client.js | 6 +-- core/legacy/regular-update.js | 8 ++-- core/register-chai-plugins.spec.js | 4 +- core/server/in-process-server-test-helpers.js | 12 +++-- core/server/influx-metrics.js | 15 +++---- core/server/influx-metrics.spec.js | 15 +++---- core/server/instance-id-generator.js | 4 +- core/server/log.js | 19 ++++---- core/server/metrics/format-converters.js | 5 +-- core/server/metrics/format-converters.spec.js | 8 ++-- core/server/prometheus-metrics.js | 10 ++--- core/server/prometheus-metrics.spec.js | 12 +++-- core/server/secret-is-valid.js | 4 +- core/server/server.js | 39 ++++++++-------- core/server/server.spec.js | 20 ++++----- core/service-test-runner/cli.js | 14 +++--- .../create-service-tester.js | 9 ++-- .../service-test-runner/icedfrisby-shields.js | 11 +++-- .../service-test-runner/infer-pull-request.js | 7 ++- .../infer-pull-request.spec.js | 9 +--- .../pull-request-services-cli.js | 10 ++--- core/service-test-runner/runner.js | 5 +-- core/service-test-runner/service-tester.js | 7 ++- .../service-test-runner/services-for-title.js | 5 +-- .../services-for-title.spec.js | 6 +-- .../redis-token-persistence.integration.js | 10 ++--- core/token-pooling/redis-token-persistence.js | 12 +++-- core/token-pooling/token-pool.js | 9 ++-- core/token-pooling/token-pool.spec.js | 10 ++--- dangerfile.js | 6 +-- entrypoint.spec.js | 8 ++-- gatsby-config.js | 8 ++-- gatsby-node.js | 10 ++--- lib/load-logos.js | 10 ++--- lib/load-simple-icons.js | 8 ++-- lib/load-simple-icons.spec.js | 6 +-- lib/logos.js | 20 +++------ lib/logos.spec.js | 14 ++---- lib/svg-helpers.js | 4 +- lib/svg-helpers.spec.js | 6 +-- scripts/badge-cli.js | 14 +++--- scripts/benchmark-performance.js | 10 ++--- scripts/capture-timings.js | 8 ++-- scripts/export-service-definitions-cli.js | 6 +-- scripts/redis-connectivity-test.js | 6 +-- server.js | 13 +++--- services/amo/amo-base.js | 10 ++--- services/amo/amo-downloads.service.js | 14 +++--- services/amo/amo-downloads.tester.js | 14 +++--- services/amo/amo-rating.service.js | 12 +++-- services/amo/amo-rating.tester.js | 10 ++--- services/amo/amo-users.service.js | 10 ++--- services/amo/amo-users.tester.js | 8 ++-- services/amo/amo-version.service.js | 10 ++--- services/amo/amo-version.tester.js | 8 ++-- services/ansible/ansible-quality.service.js | 12 +++-- services/ansible/ansible-quality.tester.js | 8 ++-- services/ansible/ansible-role.service.js | 16 +++---- services/ansible/ansible-role.tester.js | 14 +++--- services/apm/apm.service.js | 18 ++++---- services/apm/apm.tester.js | 15 +++---- services/appveyor/appveyor-base.js | 14 +++--- .../appveyor-build-redirect.service.js | 8 ++-- .../appveyor-build-redirect.tester.js | 12 ++--- services/appveyor/appveyor-build.service.js | 10 ++--- services/appveyor/appveyor-build.tester.js | 8 ++-- .../appveyor/appveyor-job-build.service.js | 12 +++-- services/appveyor/appveyor-job-build.spec.js | 10 ++--- .../appveyor/appveyor-job-build.tester.js | 8 ++-- services/appveyor/appveyor-tests.service.js | 13 ++---- services/appveyor/appveyor-tests.tester.js | 10 ++--- services/archlinux/archlinux.service.js | 12 +++-- services/archlinux/archlinux.tester.js | 10 ++--- services/aur/aur.service.js | 19 +++----- services/aur/aur.spec.js | 6 +-- services/aur/aur.tester.js | 19 +++----- services/azure-devops/azure-devops-base.js | 10 ++--- .../azure-devops-build.service.js | 14 +++--- .../azure-devops/azure-devops-build.tester.js | 8 ++-- .../azure-devops-coverage.service.js | 16 +++---- .../azure-devops-coverage.tester.js | 8 ++-- services/azure-devops/azure-devops-helpers.js | 8 ++-- .../azure-devops-release.service.js | 12 +++-- .../azure-devops-release.tester.js | 8 ++-- .../azure-devops-tests.service.js | 15 +++---- .../azure-devops/azure-devops-tests.tester.js | 8 ++-- services/azure-devops/vso-redirect.service.js | 8 ++-- services/azure-devops/vso-redirect.tester.js | 11 ++--- services/beerpay/beerpay.service.js | 10 ++--- services/beerpay/beerpay.tester.js | 8 ++-- services/bintray/bintray.service.js | 8 ++-- services/bintray/bintray.tester.js | 11 ++--- services/bit/bit-components.service.js | 16 +++---- services/bit/bit-components.tester.js | 8 ++-- .../bitbucket/bitbucket-issues.service.js | 12 +++-- services/bitbucket/bitbucket-issues.tester.js | 14 +++--- .../bitbucket/bitbucket-pipelines.service.js | 12 +++-- .../bitbucket/bitbucket-pipelines.tester.js | 14 +++--- .../bitbucket-pull-request.service.js | 14 +++--- .../bitbucket/bitbucket-pull-request.spec.js | 10 ++--- .../bitbucket-pull-request.tester.js | 14 +++--- services/bithound/bithound.service.js | 8 ++-- services/bithound/bithound.tester.js | 11 ++--- services/bitrise/bitrise.service.js | 10 ++--- services/bitrise/bitrise.tester.js | 8 ++-- services/bountysource/bountysource.service.js | 14 +++--- services/bountysource/bountysource.tester.js | 13 +++--- services/bower/bower-base.js | 10 ++--- services/bower/bower-license.service.js | 10 ++--- services/bower/bower-license.tester.js | 6 +-- services/bower/bower-version.service.js | 12 +++-- services/bower/bower-version.tester.js | 16 +++---- services/bstats/bstats-players.service.js | 12 +++-- services/bstats/bstats-players.tester.js | 8 ++-- services/bstats/bstats-servers.service.js | 12 +++-- services/bstats/bstats-servers.tester.js | 8 ++-- services/bugzilla/bugzilla.service.js | 12 +++-- services/bugzilla/bugzilla.spec.js | 6 +-- services/bugzilla/bugzilla.tester.js | 8 ++-- services/build-status.js | 6 +-- services/build-status.spec.js | 8 ++-- services/buildkite/buildkite.service.js | 12 +++-- services/buildkite/buildkite.tester.js | 10 ++--- services/bundlephobia/bundlephobia.service.js | 14 +++--- services/bundlephobia/bundlephobia.tester.js | 8 ++-- services/categories.js | 6 +-- services/cauditor/cauditor.service.js | 8 ++-- services/cauditor/cauditor.tester.js | 11 ++--- services/cdnjs/cdnjs.service.js | 12 +++-- services/cdnjs/cdnjs.tester.js | 8 ++-- services/check-services.spec.js | 7 +-- services/chocolatey/chocolatey.service.js | 8 ++-- services/chocolatey/chocolatey.tester.js | 19 +++----- .../chrome-web-store/chrome-web-store-base.js | 12 +++-- .../chrome-web-store-price.service.js | 12 +++-- .../chrome-web-store-price.tester.js | 8 ++-- .../chrome-web-store-rating.service.js | 14 +++--- .../chrome-web-store-rating.tester.js | 16 +++---- .../chrome-web-store-users.service.js | 14 +++--- .../chrome-web-store-users.tester.js | 14 +++--- .../chrome-web-store-version.service.js | 12 +++-- .../chrome-web-store-version.tester.js | 8 ++-- .../cii-best-practices.service.js | 12 +++-- .../cii-best-practices.tester.js | 8 ++-- services/circleci/circleci.service.js | 10 ++--- services/circleci/circleci.tester.js | 13 +++--- services/cirrus/cirrus.service.js | 12 +++-- services/cirrus/cirrus.tester.js | 10 ++--- services/clojars/clojars-base.js | 10 ++--- services/clojars/clojars-downloads.service.js | 12 +++-- services/clojars/clojars-downloads.tester.js | 8 ++-- services/clojars/clojars-version.service.js | 12 +++-- services/clojars/clojars-version.tester.js | 12 ++--- services/cocoapods/cocoapods-apps.service.js | 8 ++-- services/cocoapods/cocoapods-apps.tester.js | 12 ++--- services/cocoapods/cocoapods-base.js | 10 ++--- services/cocoapods/cocoapods-docs.service.js | 14 +++--- services/cocoapods/cocoapods-docs.tester.js | 8 ++-- .../cocoapods/cocoapods-downloads.service.js | 8 ++-- .../cocoapods/cocoapods-downloads.tester.js | 12 ++--- .../cocoapods/cocoapods-license.service.js | 8 ++-- .../cocoapods/cocoapods-license.tester.js | 6 +-- .../cocoapods/cocoapods-platform.service.js | 8 ++-- .../cocoapods/cocoapods-platform.tester.js | 8 ++-- .../cocoapods/cocoapods-version.service.js | 10 ++--- .../cocoapods/cocoapods-version.tester.js | 8 ++-- services/codacy/codacy-coverage.service.js | 17 +++---- services/codacy/codacy-coverage.tester.js | 8 ++-- services/codacy/codacy-grade.service.js | 12 +++-- services/codacy/codacy-grade.tester.js | 8 ++-- services/codacy/codacy-helpers.js | 6 +-- ...codeclimate-analysis-redirector.service.js | 8 ++-- .../codeclimate-analysis-redirector.tester.js | 12 ++--- .../codeclimate-analysis.service.js | 16 +++---- .../codeclimate-analysis.tester.js | 10 ++--- services/codeclimate/codeclimate-common.js | 10 ++--- ...codeclimate-coverage-redirector.service.js | 8 ++-- .../codeclimate-coverage-redirector.tester.js | 12 ++--- .../codeclimate-coverage.service.js | 14 +++--- .../codeclimate-coverage.tester.js | 10 ++--- services/codecov/codecov-redirect.service.js | 8 ++-- services/codecov/codecov-redirect.tester.js | 12 ++--- services/codecov/codecov.service.js | 14 +++--- services/codecov/codecov.spec.js | 6 +-- services/codecov/codecov.tester.js | 8 ++-- .../codefactor/codefactor-grade.service.js | 12 +++-- services/codefactor/codefactor-grade.spec.js | 6 +-- .../codefactor/codefactor-grade.tester.js | 8 ++-- services/codefactor/codefactor-helpers.js | 6 +-- services/codeship/codeship.service.js | 14 +++--- services/codeship/codeship.spec.js | 6 +-- services/codeship/codeship.tester.js | 8 ++-- services/codetally/codetally.service.js | 8 ++-- services/codetally/codetally.tester.js | 12 ++--- services/color-formatters.js | 8 ++-- services/color-formatters.spec.js | 14 ++---- services/conda/conda-base.js | 12 +++-- services/conda/conda-downloads.service.js | 12 +++-- services/conda/conda-downloads.tester.js | 8 ++-- services/conda/conda-license.service.js | 14 +++--- services/conda/conda-license.tester.js | 6 +-- services/conda/conda-platform.service.js | 8 ++-- services/conda/conda-platform.tester.js | 8 ++-- services/conda/conda-version.service.js | 12 +++-- services/conda/conda-version.tester.js | 8 ++-- .../continuousphp/continuousphp.service.js | 8 ++-- .../continuousphp/continuousphp.tester.js | 11 ++--- services/contributor-count.js | 8 ++-- services/contributor-count.spec.js | 6 +-- services/cookbook/cookbook.service.js | 12 +++-- services/cookbook/cookbook.tester.js | 8 ++-- .../coveralls/coveralls-redirector.service.js | 8 ++-- .../coveralls/coveralls-redirector.tester.js | 12 ++--- services/coveralls/coveralls.service.js | 12 +++-- services/coveralls/coveralls.tester.js | 8 ++-- .../coverity/coverity-on-demand.service.js | 8 ++-- .../coverity/coverity-on-demand.tester.js | 12 ++--- services/coverity/coverity-scan.service.js | 10 ++--- services/coverity/coverity-scan.tester.js | 8 ++-- services/cpan/cpan-license.service.js | 8 ++-- services/cpan/cpan-license.tester.js | 6 +-- services/cpan/cpan-version.service.js | 10 ++--- services/cpan/cpan-version.tester.js | 8 ++-- services/cpan/cpan.js | 10 ++--- services/cran/cran.service.js | 10 ++--- services/cran/cran.tester.js | 13 +++--- services/crates/crates-base.js | 10 ++--- services/crates/crates-downloads.service.js | 14 +++--- services/crates/crates-downloads.tester.js | 14 +++--- services/crates/crates-license.service.js | 8 ++-- services/crates/crates-license.tester.js | 12 ++--- services/crates/crates-version.service.js | 12 +++-- services/crates/crates-version.spec.js | 10 ++--- services/crates/crates-version.tester.js | 8 ++-- services/criterion/constants.js | 6 +-- services/criterion/criterion.service.js | 17 +++---- services/criterion/criterion.tester.js | 15 +++---- services/ctan/ctan.service.js | 14 +++--- services/ctan/ctan.tester.js | 13 +++--- services/date/date.service.js | 10 ++--- services/date/date.tester.js | 13 +++--- services/david/david.service.js | 10 ++--- services/david/david.tester.js | 8 ++-- services/debian/debian.service.js | 12 +++-- services/debian/debian.tester.js | 10 ++--- services/debug/debug.service.js | 8 ++-- services/debug/debug.tester.js | 8 ++-- services/dependabot/dependabot.service.js | 10 ++--- services/dependabot/dependabot.tester.js | 8 ++-- services/depfu/depfu.service.js | 10 ++--- services/depfu/depfu.tester.js | 10 ++--- services/deprecation-helpers.js | 8 ++-- services/deprecation-helpers.spec.js | 8 ++-- services/discord/discord.service.js | 12 +++-- services/discord/discord.spec.js | 10 ++--- services/discord/discord.tester.js | 8 ++-- .../discourse/discourse-redirect.service.js | 8 ++-- .../discourse/discourse-redirect.tester.js | 12 ++--- services/discourse/discourse.service.js | 14 +++--- services/discourse/discourse.tester.js | 13 +++--- services/dockbit/dockbit.service.js | 8 ++-- services/dockbit/dockbit.tester.js | 11 ++--- services/docker/docker-automated.service.js | 16 +++---- services/docker/docker-automated.tester.js | 10 ++--- services/docker/docker-build.service.js | 6 +-- services/docker/docker-build.tester.js | 6 ++- .../docker/docker-cloud-automated.service.js | 12 +++-- .../docker/docker-cloud-automated.tester.js | 10 ++--- services/docker/docker-cloud-build.service.js | 12 +++-- services/docker/docker-cloud-build.tester.js | 10 ++--- services/docker/docker-cloud-common-fetch.js | 8 ++-- services/docker/docker-fixtures.js | 6 +-- services/docker/docker-helpers.js | 8 ++-- services/docker/docker-pulls.service.js | 20 +++------ services/docker/docker-pulls.tester.js | 10 ++--- services/docker/docker-size.service.js | 22 ++++------ services/docker/docker-size.spec.js | 8 ++-- services/docker/docker-size.tester.js | 8 ++-- services/docker/docker-stars.service.js | 18 +++----- services/docker/docker-stars.tester.js | 10 ++--- services/docker/docker-version.service.js | 21 +++------ services/docker/docker-version.spec.js | 18 +++----- services/docker/docker-version.tester.js | 8 ++-- services/docsrs/docsrs.service.js | 10 ++--- services/docsrs/docsrs.tester.js | 8 ++-- services/dotnetstatus/dotnetstatus.service.js | 8 ++-- services/dotnetstatus/dotnetstatus.tester.js | 11 ++--- services/drone/drone-build.service.js | 14 +++--- services/drone/drone-build.spec.js | 10 ++--- services/drone/drone-build.tester.js | 10 ++--- services/dub/dub-download.service.js | 16 +++---- services/dub/dub-download.tester.js | 10 ++--- services/dub/dub-license.service.js | 12 +++-- services/dub/dub-license.tester.js | 6 +-- services/dub/dub-version.service.js | 12 +++-- services/dub/dub-version.tester.js | 12 +++-- services/dynamic-common.js | 14 +++--- services/dynamic/dynamic-helpers.js | 10 ++--- services/dynamic/dynamic-json.service.js | 14 +++--- services/dynamic/dynamic-json.tester.js | 10 ++--- services/dynamic/dynamic-response-fixtures.js | 6 +-- services/dynamic/dynamic-xml.service.js | 18 ++++---- services/dynamic/dynamic-xml.spec.js | 14 +++--- services/dynamic/dynamic-xml.tester.js | 10 ++--- services/dynamic/dynamic-yaml.service.js | 14 +++--- services/dynamic/dynamic-yaml.tester.js | 6 +-- services/dynamic/json-path.js | 16 +++---- services/dynamic/json-path.spec.js | 6 +-- .../eclipse-marketplace-base.js | 8 ++-- .../eclipse-marketplace-downloads.service.js | 14 +++--- .../eclipse-marketplace-downloads.tester.js | 14 +++--- .../eclipse-marketplace-favorites.service.js | 12 +++-- .../eclipse-marketplace-favorites.tester.js | 8 ++-- .../eclipse-marketplace-license.service.js | 10 ++--- .../eclipse-marketplace-license.tester.js | 6 +-- .../eclipse-marketplace-update.service.js | 16 +++---- .../eclipse-marketplace-update.tester.js | 8 ++-- .../eclipse-marketplace-version.service.js | 12 +++-- .../eclipse-marketplace-version.tester.js | 8 ++-- services/ecologi/ecologi-carbon.service.js | 14 +++--- services/ecologi/ecologi-carbon.tester.js | 8 ++-- services/ecologi/ecologi-trees.service.js | 16 +++---- services/ecologi/ecologi-trees.tester.js | 8 ++-- services/elm-package/elm-package.service.js | 14 +++--- services/elm-package/elm-package.tester.js | 8 ++-- services/endpoint-common.js | 12 +++-- .../endpoint/endpoint-redirect.service.js | 8 ++-- services/endpoint/endpoint-redirect.tester.js | 12 ++--- services/endpoint/endpoint.service.js | 18 ++++---- services/endpoint/endpoint.tester.js | 12 ++--- services/f-droid/f-droid.service.js | 19 +++----- services/f-droid/f-droid.tester.js | 13 +++--- services/fedora/fedora.service.js | 12 +++-- services/fedora/fedora.tester.js | 10 ++--- services/feedz/feedz.service.js | 17 +++---- services/feedz/feedz.service.spec.js | 6 +-- services/feedz/feedz.tester.js | 12 ++--- services/flathub/flathub.service.js | 12 +++-- services/flathub/flathub.tester.js | 8 ++-- services/gem/gem-downloads.service.js | 20 ++++----- services/gem/gem-downloads.tester.js | 8 ++-- services/gem/gem-owner.service.js | 12 +++-- services/gem/gem-owner.tester.js | 8 ++-- services/gem/gem-rank.service.js | 14 +++--- services/gem/gem-rank.tester.js | 8 ++-- services/gem/gem-version.service.js | 12 +++-- services/gem/gem-version.tester.js | 11 ++--- services/gemnasium/gemnasium.service.js | 8 ++-- services/gemnasium/gemnasium.tester.js | 11 ++--- services/gerrit/gerrit.service.js | 12 +++-- services/gerrit/gerrit.tester.js | 6 +-- services/github/auth/acceptor.js | 14 +++--- services/github/auth/acceptor.spec.js | 22 +++++----- services/github/auth/admin.js | 6 +-- services/github/auth/admin.spec.js | 14 +++--- .../github/github-all-contributors.service.js | 16 +++---- .../github/github-all-contributors.tester.js | 8 ++-- .../github/github-api-provider.integration.js | 6 +-- services/github/github-api-provider.js | 14 +++--- services/github/github-api-provider.spec.js | 8 ++-- services/github/github-auth-service.js | 12 +++-- .../github/github-checks-status.service.js | 14 +++--- .../github/github-checks-status.tester.js | 8 ++-- services/github/github-code-size.service.js | 12 +++-- services/github/github-code-size.tester.js | 8 ++-- .../github/github-commit-activity.service.js | 16 +++---- .../github/github-commit-activity.tester.js | 13 +++--- .../github/github-commit-status.service.js | 14 +++--- .../github/github-commit-status.tester.js | 8 ++-- .../github/github-commits-since.service.js | 21 ++++----- .../github/github-commits-since.tester.js | 8 ++-- services/github/github-common-fetch.js | 12 +++-- services/github/github-common-release.js | 16 +++---- services/github/github-common-release.spec.js | 6 +-- services/github/github-constellation.js | 16 +++---- .../github/github-contributors.service.js | 16 +++---- services/github/github-contributors.tester.js | 8 ++-- services/github/github-deployments.service.js | 16 +++---- services/github/github-deployments.spec.js | 6 +-- services/github/github-deployments.tester.js | 8 ++-- .../github-directory-file-count.service.js | 21 ++++----- .../github-directory-file-count.spec.js | 10 ++--- .../github-directory-file-count.tester.js | 8 ++-- .../github-discussions-total.service.js | 16 +++---- .../github/github-discussions-total.tester.js | 8 ++-- services/github/github-downloads.service.js | 22 +++++----- services/github/github-downloads.tester.js | 10 ++--- services/github/github-followers.service.js | 16 +++---- services/github/github-followers.tester.js | 8 ++-- services/github/github-forks.service.js | 18 ++++---- services/github/github-forks.tester.js | 8 ++-- services/github/github-go-mod.service.js | 18 ++++---- services/github/github-go-mod.tester.js | 8 ++-- .../github/github-hacktoberfest.service.js | 23 ++++------ services/github/github-hacktoberfest.spec.js | 6 +-- .../github/github-hacktoberfest.tester.js | 8 ++-- services/github/github-helpers.js | 10 ++--- .../github-issue-detail-redirect.service.js | 8 ++-- .../github-issue-detail-redirect.tester.js | 12 ++--- .../github/github-issue-detail.service.js | 25 ++++------- services/github/github-issue-detail.spec.js | 16 +++---- services/github/github-issue-detail.tester.js | 10 ++--- .../github/github-issues-search.service.js | 18 ++++---- .../github/github-issues-search.tester.js | 14 +++--- services/github/github-issues.service.js | 18 ++++---- services/github/github-issues.tester.js | 10 ++--- services/github/github-labels.service.js | 12 +++-- services/github/github-labels.tester.js | 6 +-- .../github/github-language-count.service.js | 10 ++--- .../github/github-language-count.tester.js | 8 ++-- services/github/github-languages-base.js | 12 +++-- services/github/github-last-commit.service.js | 16 +++---- services/github/github-last-commit.tester.js | 8 ++-- services/github/github-lerna-json.service.js | 18 ++++---- services/github/github-lerna-json.tester.js | 8 ++-- services/github/github-license.service.js | 14 +++--- services/github/github-license.spec.js | 6 +-- services/github/github-license.tester.js | 8 ++-- services/github/github-manifest.service.js | 22 ++++------ services/github/github-manifest.tester.js | 16 +++---- .../github/github-milestone-detail.service.js | 16 +++---- .../github/github-milestone-detail.tester.js | 12 ++--- services/github/github-milestone.service.js | 14 +++--- services/github/github-milestone.tester.js | 8 ++-- .../github/github-package-json.service.js | 28 +++++------- services/github/github-package-json.tester.js | 18 +++----- services/github/github-pipenv.service.js | 20 ++++----- services/github/github-pipenv.tester.js | 19 +++----- ...github-pull-request-check-state.service.js | 16 +++---- .../github-pull-request-check-state.tester.js | 6 +-- services/github/github-r-package.service.js | 18 ++++---- services/github/github-r-package.spec.js | 10 ++--- services/github/github-r-package.tester.js | 8 ++-- .../github/github-release-date.service.js | 18 ++++---- services/github/github-release-date.tester.js | 8 ++-- services/github/github-release.service.js | 21 ++++----- services/github/github-release.tester.js | 16 +++---- services/github/github-repo-size.service.js | 16 +++---- services/github/github-repo-size.tester.js | 8 ++-- services/github/github-search.service.js | 16 +++---- services/github/github-search.tester.js | 8 ++-- services/github/github-size.service.js | 18 ++++---- services/github/github-size.tester.js | 8 ++-- services/github/github-sponsors.service.js | 20 ++++----- services/github/github-sponsors.tester.js | 14 +++--- services/github/github-stars.service.js | 16 +++---- services/github/github-stars.tester.js | 8 ++-- services/github/github-tag.service.js | 24 +++++----- services/github/github-tag.spec.js | 6 +-- services/github/github-tag.tester.js | 16 +++---- .../github/github-top-language.service.js | 10 ++--- services/github/github-top-language.tester.js | 8 ++-- services/github/github-total-star.service.js | 21 ++++----- services/github/github-total-star.tester.js | 8 ++-- services/github/github-watchers.service.js | 16 +++---- services/github/github-watchers.tester.js | 8 ++-- .../github/github-workflow-status.service.js | 14 +++--- .../github/github-workflow-status.tester.js | 10 ++--- services/gitlab/gitlab-coverage.service.js | 14 +++--- services/gitlab/gitlab-coverage.tester.js | 8 ++-- .../gitlab/gitlab-pipeline-status.service.js | 14 +++--- .../gitlab/gitlab-pipeline-status.tester.js | 14 +++--- services/gitter/gitter.service.js | 8 ++-- services/gitter/gitter.tester.js | 6 +-- services/gratipay/gratipay.service.js | 8 ++-- services/gratipay/gratipay.tester.js | 11 ++--- services/hackage/hackage-deps.service.js | 8 ++-- services/hackage/hackage-deps.tester.js | 8 ++-- services/hackage/hackage-version.service.js | 12 +++-- services/hackage/hackage-version.tester.js | 8 ++-- services/hexpm/hexpm.service.js | 12 +++-- services/hexpm/hexpm.tester.js | 12 ++--- services/homebrew/homebrew-cask.service.js | 12 +++-- services/homebrew/homebrew-cask.tester.js | 8 ++-- .../homebrew/homebrew-downloads.service.js | 16 +++---- .../homebrew/homebrew-downloads.tester.js | 8 ++-- services/homebrew/homebrew-version.service.js | 12 +++-- services/homebrew/homebrew-version.tester.js | 8 ++-- services/hsts/hsts.service.js | 10 ++--- services/hsts/hsts.tester.js | 6 +-- services/imagelayers/imagelayers.service.js | 8 ++-- services/imagelayers/imagelayers.tester.js | 11 ++--- services/index.js | 8 ++-- services/issuestats/issuestats.service.js | 8 ++-- services/issuestats/issuestats.tester.js | 6 +-- services/itunes/itunes.service.js | 14 +++--- services/itunes/itunes.tester.js | 8 ++-- services/jenkins/jenkins-base.js | 8 ++-- .../jenkins/jenkins-build-redirect.service.js | 10 ++--- .../jenkins/jenkins-build-redirect.tester.js | 12 ++--- services/jenkins/jenkins-build.service.js | 18 +++----- services/jenkins/jenkins-build.spec.js | 14 +++--- services/jenkins/jenkins-build.tester.js | 10 ++--- services/jenkins/jenkins-common.js | 10 ++--- services/jenkins/jenkins-common.spec.js | 5 +-- .../jenkins-coverage-redirector.service.js | 10 ++--- .../jenkins-coverage-redirector.tester.js | 12 ++--- services/jenkins/jenkins-coverage.service.js | 18 +++----- services/jenkins/jenkins-coverage.tester.js | 8 ++-- .../jenkins-plugin-installs.service.js | 16 +++---- .../jenkins/jenkins-plugin-installs.tester.js | 8 ++-- .../jenkins/jenkins-plugin-version.service.js | 14 +++--- .../jenkins/jenkins-plugin-version.tester.js | 8 ++-- .../jenkins-tests-redirector.service.js | 10 ++--- .../jenkins-tests-redirector.tester.js | 12 ++--- services/jenkins/jenkins-tests.service.js | 26 ++++------- services/jenkins/jenkins-tests.tester.js | 13 ++---- services/jetbrains/jetbrains-base.js | 12 +++-- .../jetbrains/jetbrains-downloads.service.js | 16 +++---- .../jetbrains/jetbrains-downloads.tester.js | 8 ++-- .../jetbrains/jetbrains-rating.service.js | 14 +++--- services/jetbrains/jetbrains-rating.tester.js | 8 ++-- .../jetbrains/jetbrains-version.service.js | 12 +++-- .../jetbrains/jetbrains-version.tester.js | 8 ++-- services/jira/jira-common.js | 4 +- services/jira/jira-issue-redirect.service.js | 8 ++-- services/jira/jira-issue-redirect.tester.js | 12 ++--- services/jira/jira-issue.service.js | 14 +++--- services/jira/jira-issue.spec.js | 12 +++-- services/jira/jira-issue.tester.js | 6 +-- services/jira/jira-sprint-redirect.service.js | 8 ++-- services/jira/jira-sprint-redirect.tester.js | 12 ++--- services/jira/jira-sprint.service.js | 14 +++--- services/jira/jira-sprint.spec.js | 19 +++----- services/jira/jira-sprint.tester.js | 10 ++--- services/jira/jira-test-helpers.js | 6 +-- services/jitpack/jitpack-downloads.service.js | 8 ++-- services/jitpack/jitpack-downloads.tester.js | 12 ++--- .../jitpack-version-redirector.service.js | 8 ++-- .../jitpack-version-redirector.tester.js | 12 ++--- services/jitpack/jitpack-version.service.js | 12 +++-- services/jitpack/jitpack-version.tester.js | 8 ++-- services/jsdelivr/jsdelivr-base.js | 12 +++-- .../jsdelivr/jsdelivr-hits-github.service.js | 8 ++-- .../jsdelivr/jsdelivr-hits-github.tester.js | 13 +++--- .../jsdelivr/jsdelivr-hits-npm.service.js | 8 ++-- services/jsdelivr/jsdelivr-hits-npm.tester.js | 13 +++--- services/keybase/keybase-btc.service.js | 12 +++-- services/keybase/keybase-btc.tester.js | 8 ++-- services/keybase/keybase-pgp.service.js | 12 +++-- services/keybase/keybase-pgp.tester.js | 8 ++-- services/keybase/keybase-profile.js | 9 ++-- services/keybase/keybase-xlm.service.js | 12 +++-- services/keybase/keybase-xlm.tester.js | 8 ++-- services/keybase/keybase-zec.service.js | 12 +++-- services/keybase/keybase-zec.tester.js | 8 ++-- .../leanpub/leanpub-book-summary.service.js | 8 ++-- .../leanpub/leanpub-book-summary.tester.js | 12 ++--- services/lgtm/lgtm-alerts.service.js | 10 ++--- services/lgtm/lgtm-alerts.tester.js | 10 ++--- services/lgtm/lgtm-base.js | 10 ++--- services/lgtm/lgtm-grade.service.js | 8 ++-- services/lgtm/lgtm-grade.tester.js | 10 ++--- services/lgtm/lgtm-redirector.service.js | 8 ++-- services/lgtm/lgtm-redirector.tester.js | 12 ++--- services/lgtm/lgtm-test-helpers.js | 6 +-- services/liberapay/liberapay-base.js | 16 +++---- services/liberapay/liberapay-gives.service.js | 10 ++--- services/liberapay/liberapay-gives.tester.js | 8 ++-- services/liberapay/liberapay-goal.service.js | 12 +++-- services/liberapay/liberapay-goal.spec.js | 10 ++--- services/liberapay/liberapay-goal.tester.js | 8 ++-- .../liberapay/liberapay-patrons.service.js | 12 +++-- .../liberapay/liberapay-patrons.tester.js | 8 ++-- .../liberapay/liberapay-receives.service.js | 10 ++--- .../liberapay/liberapay-receives.tester.js | 8 ++-- services/librariesio/librariesio-common.js | 10 ++--- .../librariesio-dependencies-helpers.js | 4 +- .../librariesio-dependencies-helpers.spec.js | 8 +--- .../librariesio-dependencies.service.js | 13 ++---- .../librariesio-dependencies.tester.js | 14 +++--- .../librariesio-dependent-repos.service.js | 12 +++-- .../librariesio-dependent-repos.tester.js | 8 ++-- .../librariesio-dependents.service.js | 12 +++-- .../librariesio-dependents.tester.js | 8 ++-- .../librariesio-sourcerank.service.js | 12 +++-- .../librariesio-sourcerank.tester.js | 8 ++-- services/libscore/libscore.service.js | 8 ++-- services/libscore/libscore.tester.js | 6 +-- services/licenses.js | 6 +-- services/licenses.spec.js | 6 +-- services/localizely/localizely.service.js | 12 +++-- services/localizely/localizely.tester.js | 8 ++-- services/luarocks/luarocks-version-helpers.js | 8 ++-- .../luarocks/luarocks-version-helpers.spec.js | 10 +---- services/luarocks/luarocks.service.js | 14 +++--- services/luarocks/luarocks.spec.js | 6 +-- services/luarocks/luarocks.tester.js | 8 ++-- services/magnumci/magnumci.service.js | 8 ++-- services/magnumci/magnumci.tester.js | 6 +-- services/maintenance/maintenance.service.js | 8 ++-- services/maintenance/maintenance.spec.js | 6 +-- services/maintenance/maintenance.tester.js | 6 +-- services/mastodon/mastodon-follow.service.js | 14 +++--- services/mastodon/mastodon-follow.tester.js | 8 ++-- services/matrix/matrix.service.js | 10 ++--- services/matrix/matrix.tester.js | 8 ++-- .../maven-central/maven-central.service.js | 12 +++-- .../maven-central/maven-central.tester.js | 10 ++--- .../maven-metadata-redirect.service.js | 8 ++-- .../maven-metadata-redirect.tester.js | 6 +-- .../maven-metadata/maven-metadata.service.js | 14 +++--- .../maven-metadata/maven-metadata.tester.js | 8 ++-- services/microbadger/microbadger-base.js | 12 +++-- .../microbadger/microbadger-layers.service.js | 8 ++-- .../microbadger/microbadger-layers.tester.js | 8 ++-- .../microbadger/microbadger-size.service.js | 12 +++-- .../microbadger/microbadger-size.tester.js | 8 ++-- .../mozilla-observatory.service.js | 10 ++--- .../mozilla-observatory.tester.js | 8 ++-- services/myget/myget.service.js | 8 ++-- services/myget/myget.tester.js | 28 ++++-------- services/netlify/netlify.service.js | 10 ++--- services/netlify/netlify.spec.js | 6 +-- services/netlify/netlify.tester.js | 8 ++-- services/nexus/nexus-redirect.service.js | 8 ++-- services/nexus/nexus-redirect.tester.js | 12 ++--- services/nexus/nexus-version.js | 6 +-- services/nexus/nexus.service.js | 21 ++++----- services/nexus/nexus.spec.js | 12 +++-- services/nexus/nexus.tester.js | 10 ++--- services/node/node-base.js | 8 ++-- services/node/node-current.service.js | 10 ++--- services/node/node-current.spec.js | 6 +-- services/node/node-current.tester.js | 12 ++--- services/node/node-lts.service.js | 10 ++--- services/node/node-lts.spec.js | 6 +-- services/node/node-lts.tester.js | 16 +++---- services/node/node-version-color.js | 14 +++--- services/node/testUtils/test-utils.js | 12 +++-- services/nodeping/nodeping-status.service.js | 16 +++---- services/nodeping/nodeping-status.tester.js | 8 ++-- services/nodeping/nodeping-uptime.service.js | 12 +++-- services/nodeping/nodeping-uptime.tester.js | 8 ++-- services/npm/npm-base.js | 20 ++++----- services/npm/npm-base.spec.js | 10 ++--- services/npm/npm-collaborators.service.js | 10 ++--- services/npm/npm-collaborators.tester.js | 8 ++-- .../npm/npm-dependency-version.service.js | 10 ++--- services/npm/npm-dependency-version.tester.js | 8 ++-- services/npm/npm-downloads.service.js | 14 +++--- services/npm/npm-downloads.spec.js | 6 +-- services/npm/npm-downloads.tester.js | 8 ++-- services/npm/npm-license.service.js | 12 +++-- services/npm/npm-license.tester.js | 6 +-- services/npm/npm-type-definitions.service.js | 8 ++-- services/npm/npm-type-definitions.spec.js | 6 +-- services/npm/npm-type-definitions.tester.js | 8 ++-- services/npm/npm-version.service.js | 14 +++--- services/npm/npm-version.tester.js | 8 ++-- services/nsp/nsp.service.js | 8 ++-- services/nsp/nsp.tester.js | 12 ++--- services/nuget-fixtures.js | 6 +-- services/nuget/nuget-helpers.js | 16 +++---- services/nuget/nuget-helpers.spec.js | 11 +---- services/nuget/nuget-v2-service-family.js | 18 +++----- services/nuget/nuget-v3-service-family.js | 20 +++------ .../nuget/nuget-v3-service-family.spec.js | 6 +-- services/nuget/nuget.service.js | 6 +-- services/nuget/nuget.tester.js | 26 ++++------- services/nycrc/nycrc.service.js | 18 +++----- services/nycrc/nycrc.tester.js | 8 ++-- .../offset-earth-carbon-redirect.service.js | 8 ++-- .../offset-earth-carbon-redirect.tester.js | 12 ++--- .../offset-earth-trees-redirect.service.js | 8 ++-- .../offset-earth-trees-redirect.tester.js | 12 ++--- services/open-vsx/open-vsx-base.js | 12 +++-- .../open-vsx/open-vsx-downloads.service.js | 12 +++-- .../open-vsx/open-vsx-downloads.tester.js | 8 ++-- services/open-vsx/open-vsx-rating.service.js | 12 +++-- services/open-vsx/open-vsx-rating.spec.js | 6 +-- services/open-vsx/open-vsx-rating.tester.js | 8 ++-- .../open-vsx/open-vsx-release-date.service.js | 12 +++-- .../open-vsx/open-vsx-release-date.tester.js | 8 ++-- services/open-vsx/open-vsx-version.service.js | 10 ++--- services/open-vsx/open-vsx-version.tester.js | 8 ++-- .../opencollective-all.service.js | 8 ++-- .../opencollective-all.tester.js | 8 ++-- .../opencollective-backers.service.js | 8 ++-- .../opencollective-backers.tester.js | 8 ++-- .../opencollective/opencollective-base.js | 12 +++-- .../opencollective-by-tier.service.js | 8 ++-- .../opencollective-by-tier.tester.js | 8 ++-- .../opencollective-sponsors.service.js | 8 ++-- .../opencollective-sponsors.tester.js | 8 ++-- services/opm/opm-version.service.js | 10 ++--- services/opm/opm-version.tester.js | 8 ++-- services/ore/ore-base.js | 8 ++-- services/ore/ore-category.service.js | 8 ++-- services/ore/ore-category.spec.js | 6 +-- services/ore/ore-category.tester.js | 8 ++-- services/ore/ore-downloads.service.js | 12 +++-- services/ore/ore-downloads.tester.js | 8 ++-- services/ore/ore-license.service.js | 10 ++--- services/ore/ore-license.spec.js | 6 +-- services/ore/ore-license.tester.js | 6 +-- services/ore/ore-sponge-versions.service.js | 8 ++-- services/ore/ore-sponge-versions.spec.js | 6 +-- services/ore/ore-sponge-versions.tester.js | 6 +-- services/ore/ore-stars.service.js | 10 ++--- services/ore/ore-stars.tester.js | 8 ++-- services/ore/ore-version.service.js | 10 ++--- services/ore/ore-version.spec.js | 6 +-- services/ore/ore-version.tester.js | 8 ++-- services/osslifecycle/osslifecycle.service.js | 8 ++-- services/osslifecycle/osslifecycle.tester.js | 11 ++--- services/package-json-helpers.js | 10 ++--- services/package-json-helpers.spec.js | 6 +-- .../packagecontrol/packagecontrol.service.js | 14 +++--- .../packagecontrol/packagecontrol.tester.js | 13 +++--- services/packagist/packagist-base.js | 10 ++--- .../packagist/packagist-downloads.service.js | 21 +++------ .../packagist/packagist-downloads.tester.js | 8 ++-- .../packagist/packagist-license.service.js | 20 +++------ services/packagist/packagist-license.spec.js | 8 ++-- .../packagist/packagist-license.tester.js | 6 +-- .../packagist-php-version.service.js | 18 +++----- .../packagist/packagist-php-version.spec.js | 8 ++-- .../packagist/packagist-php-version.tester.js | 8 ++-- services/packagist/packagist-stars.service.js | 20 +++------ services/packagist/packagist-stars.tester.js | 8 ++-- .../packagist/packagist-version.service.js | 21 +++------ .../packagist/packagist-version.tester.js | 18 +++----- services/php-eye/php-eye-hhvm.service.js | 8 ++-- services/php-eye/php-eye-hhvm.tester.js | 12 ++--- .../php-eye/php-eye-php-version.service.js | 8 ++-- .../php-eye/php-eye-php-version.tester.js | 12 ++--- services/php-version.js | 18 ++++---- services/php-version.spec.js | 6 +-- services/pingpong/pingpong-status.service.js | 10 ++--- services/pingpong/pingpong-status.tester.js | 8 ++-- services/pingpong/pingpong-uptime.service.js | 12 +++-- services/pingpong/pingpong-uptime.tester.js | 8 ++-- services/pipenv-helpers.js | 10 ++--- services/pkgreview/package-rating.service.js | 16 +++---- services/pkgreview/package-rating.tester.js | 8 ++-- services/poeditor/poeditor.service.js | 14 +++--- services/poeditor/poeditor.tester.js | 8 ++-- .../powershellgallery.service.js | 13 ++---- .../powershellgallery.tester.js | 14 ++---- services/pub/pub.service.js | 10 ++--- services/pub/pub.tester.js | 14 +++--- services/puppetforge/puppetforge-base.js | 12 +++-- .../puppetforge-module-downloads.service.js | 12 +++-- .../puppetforge-module-downloads.tester.js | 8 ++-- .../puppetforge-module-endorsement.service.js | 10 ++--- .../puppetforge-module-endorsement.tester.js | 8 ++-- .../puppetforge-module-feedback.service.js | 14 +++--- .../puppetforge-module-feedback.tester.js | 8 ++-- .../puppetforge-module-pdk-version.service.js | 12 +++-- .../puppetforge-module-pdk-version.tester.js | 8 ++-- .../puppetforge-module-version.service.js | 10 ++--- .../puppetforge-module-version.tester.js | 8 ++-- .../puppetforge-user-module-count.service.js | 12 +++-- .../puppetforge-user-module-count.tester.js | 8 ++-- .../puppetforge-user-release-count.service.js | 12 +++-- .../puppetforge-user-release-count.tester.js | 8 ++-- services/pypi/pypi-base.js | 10 ++--- services/pypi/pypi-django-versions.service.js | 10 ++--- services/pypi/pypi-django-versions.tester.js | 8 ++-- services/pypi/pypi-downloads.service.js | 16 +++---- services/pypi/pypi-downloads.tester.js | 8 ++-- services/pypi/pypi-format.service.js | 10 ++--- services/pypi/pypi-format.tester.js | 6 +-- services/pypi/pypi-helpers.js | 6 +-- services/pypi/pypi-implementation.service.js | 10 ++--- services/pypi/pypi-implementation.tester.js | 6 +-- services/pypi/pypi-license.service.js | 12 +++-- services/pypi/pypi-license.tester.js | 6 +-- services/pypi/pypi-python-versions.service.js | 12 +++-- services/pypi/pypi-python-versions.spec.js | 6 +-- services/pypi/pypi-python-versions.tester.js | 8 ++-- services/pypi/pypi-status.service.js | 10 ++--- services/pypi/pypi-status.tester.js | 6 +-- services/pypi/pypi-version.service.js | 10 ++--- services/pypi/pypi-version.tester.js | 10 ++--- services/pypi/pypi-wheel.service.js | 10 ++--- services/pypi/pypi-wheel.tester.js | 6 +-- services/readthedocs/readthedocs.service.js | 12 +++-- services/readthedocs/readthedocs.tester.js | 10 ++--- .../reddit/subreddit-subscribers.service.js | 14 +++--- .../reddit/subreddit-subscribers.tester.js | 8 ++-- services/reddit/user-karma.service.js | 14 +++--- services/reddit/user-karma.tester.js | 8 ++-- services/redmine/redmine.service.js | 12 +++-- services/redmine/redmine.tester.js | 15 +++---- .../repology/repology-repositories.service.js | 14 +++--- .../repology/repology-repositories.tester.js | 8 ++-- services/requires/requires.service.js | 10 ++--- services/requires/requires.tester.js | 8 ++-- services/resharper/resharper.service.js | 8 ++-- services/resharper/resharper.tester.js | 19 +++----- services/response-fixtures.js | 6 +-- services/reuse/reuse-compliance-helper.js | 8 ++-- services/reuse/reuse-compliance.service.js | 11 +++-- services/reuse/reuse-compliance.tester.js | 8 ++-- services/route-builder.js | 8 ++-- services/scoop/scoop-version.service.js | 18 +++----- services/scoop/scoop-version.tester.js | 13 +++--- services/scrutinizer/scrutinizer-base.js | 8 ++-- .../scrutinizer/scrutinizer-build.service.js | 12 +++-- .../scrutinizer/scrutinizer-build.tester.js | 16 +++---- .../scrutinizer-coverage.service.js | 14 +++--- .../scrutinizer/scrutinizer-coverage.spec.js | 10 ++--- .../scrutinizer-coverage.tester.js | 14 +++--- .../scrutinizer-quality.service.js | 12 +++-- .../scrutinizer/scrutinizer-quality.tester.js | 14 +++--- .../scrutinizer-redirect.service.js | 8 ++-- .../scrutinizer-redirect.tester.js | 12 ++--- .../security-headers.service.js | 12 +++-- .../security-headers.tester.js | 6 +-- services/shippable/shippable.service.js | 10 ++--- services/shippable/shippable.tester.js | 14 +++--- services/snap-ci/snap-ci.service.js | 8 ++-- services/snap-ci/snap-ci.tester.js | 6 +-- services/snyk/snyk-test-helpers.js | 6 +-- services/snyk/snyk-vulnerability-base.js | 10 ++--- .../snyk/snyk-vulnerability-github.service.js | 8 ++-- .../snyk/snyk-vulnerability-github.tester.js | 13 +++--- .../snyk/snyk-vulnerability-npm.service.js | 10 ++--- .../snyk/snyk-vulnerability-npm.tester.js | 13 +++--- services/sonar/sonar-base.js | 12 +++-- services/sonar/sonar-coverage.service.js | 12 +++-- services/sonar/sonar-coverage.tester.js | 8 ++-- .../sonar-documented-api-density.service.js | 16 ++----- .../sonar-documented-api-density.spec.js | 6 +-- .../sonar-documented-api-density.tester.js | 6 +-- .../sonar/sonar-fortify-rating.service.js | 10 ++--- services/sonar/sonar-fortify-rating.spec.js | 10 ++--- services/sonar/sonar-fortify-rating.tester.js | 6 +-- services/sonar/sonar-generic.service.js | 12 +++-- services/sonar/sonar-generic.tester.js | 8 ++-- services/sonar/sonar-helpers.js | 14 +++--- services/sonar/sonar-quality-gate.service.js | 10 ++--- services/sonar/sonar-quality-gate.spec.js | 6 +-- services/sonar/sonar-quality-gate.tester.js | 8 ++-- services/sonar/sonar-redirector.service.js | 8 ++-- services/sonar/sonar-redirector.tester.js | 14 +++--- services/sonar/sonar-tech-debt.service.js | 16 ++----- services/sonar/sonar-tech-debt.spec.js | 6 +-- services/sonar/sonar-tech-debt.tester.js | 8 ++-- services/sonar/sonar-tests.service.js | 21 +++------ services/sonar/sonar-tests.spec.js | 4 +- services/sonar/sonar-tests.tester.js | 22 +++------- services/sonar/sonar-violations.service.js | 19 +++----- services/sonar/sonar-violations.spec.js | 8 ++-- services/sonar/sonar-violations.tester.js | 10 ++--- .../sourceforge-open-tickets.service.js | 14 +++--- .../sourceforge-open-tickets.tester.js | 8 ++-- services/sourceforge/sourceforge.service.js | 18 ++++---- services/sourceforge/sourceforge.tester.js | 8 ++-- services/sourcegraph/sourcegraph.service.js | 10 ++--- services/sourcegraph/sourcegraph.tester.js | 8 ++-- services/spack/spack.service.js | 12 +++-- services/spack/spack.tester.js | 8 ++-- services/spiget/spiget-base.js | 8 ++-- .../spiget/spiget-download-size.service.js | 8 ++-- .../spiget/spiget-download-size.tester.js | 8 ++-- services/spiget/spiget-downloads.service.js | 12 +++-- services/spiget/spiget-downloads.tester.js | 8 ++-- .../spiget/spiget-latest-version.service.js | 12 +++-- .../spiget/spiget-latest-version.tester.js | 8 ++-- services/spiget/spiget-rating.service.js | 12 +++-- services/spiget/spiget-rating.tester.js | 8 ++-- .../spiget/spiget-tested-versions.service.js | 8 ++-- .../spiget/spiget-tested-versions.tester.js | 8 ++-- .../stackexchange/stackexchange-helpers.js | 10 ++--- .../stackexchange-monthlyquestions.service.js | 16 +++---- .../stackexchange-monthlyquestions.tester.js | 8 ++-- .../stackexchange-reputation.service.js | 14 +++--- .../stackexchange-reputation.tester.js | 8 ++-- .../stackexchange-taginfo.service.js | 12 +++-- .../stackexchange-taginfo.tester.js | 8 ++-- .../query-string-static.service.js | 10 ++--- .../query-string-static.tester.js | 6 +-- services/static-badge/static-badge.service.js | 10 ++--- services/static-badge/static-badge.tester.js | 8 ++-- services/steam/steam-base.js | 5 +-- services/steam/steam-workshop.service.js | 18 ++++---- services/steam/steam-workshop.tester.js | 8 ++-- services/suggest.integration.js | 14 +++--- services/suggest.js | 10 ++--- services/suggest.spec.js | 16 +++---- services/swagger/swagger-redirect.service.js | 8 ++-- services/swagger/swagger-redirect.tester.js | 12 ++--- services/swagger/swagger.service.js | 12 +++-- services/swagger/swagger.tester.js | 6 +-- .../symfony/sensiolabs-redirect.service.js | 8 ++-- .../symfony/sensiolabs-redirect.tester.js | 11 ++--- services/symfony/symfony-insight-base.js | 10 ++--- services/symfony/symfony-insight-base.spec.js | 8 ++-- .../symfony/symfony-insight-grade.service.js | 12 ++--- .../symfony/symfony-insight-grade.tester.js | 10 ++--- .../symfony/symfony-insight-stars.service.js | 14 ++---- .../symfony/symfony-insight-stars.tester.js | 10 ++--- .../symfony-insight-violations.service.js | 8 ++-- .../symfony-insight-violations.tester.js | 10 ++--- services/symfony/symfony-insight.spec.js | 33 +++----------- services/symfony/symfony-test-helpers.js | 10 ++--- services/teamcity/teamcity-base.js | 8 ++-- .../teamcity-build-redirect.service.js | 8 ++-- .../teamcity-build-redirect.tester.js | 12 ++--- services/teamcity/teamcity-build.service.js | 12 +++-- services/teamcity/teamcity-build.spec.js | 12 +++-- services/teamcity/teamcity-build.tester.js | 10 ++--- .../teamcity-coverage-redirect.service.js | 8 ++-- .../teamcity-coverage-redirect.tester.js | 12 ++--- .../teamcity/teamcity-coverage.service.js | 16 +++---- services/teamcity/teamcity-coverage.spec.js | 12 +++-- services/teamcity/teamcity-coverage.tester.js | 8 ++-- services/teamcity/teamcity-test-helpers.js | 6 +-- services/test-helpers.js | 12 +++-- services/test-results.js | 8 ++-- services/test-results.spec.js | 9 +--- services/test-validators.js | 10 ++--- services/tester.js | 10 ++--- services/testspace/testspace-base.js | 12 +++-- services/testspace/testspace-base.spec.js | 8 ++-- .../testspace/testspace-test-count.service.js | 10 ++--- .../testspace/testspace-test-count.spec.js | 6 +-- .../testspace/testspace-test-count.tester.js | 10 ++--- .../testspace-test-pass-ratio.service.js | 8 ++-- .../testspace-test-pass-ratio.spec.js | 6 +-- .../testspace-test-pass-ratio.tester.js | 8 ++-- .../testspace-test-summary.service.js | 14 ++---- .../testspace-test-summary.tester.js | 13 ++---- services/text-formatters.js | 8 ++-- services/text-formatters.spec.js | 18 ++------ services/tokei/tokei.service.js | 14 +++--- services/tokei/tokei.tester.js | 8 ++-- services/travis/travis-build.service.js | 12 +++-- services/travis/travis-build.tester.js | 10 ++--- .../travis-php-version-redirect.service.js | 6 +-- .../travis-php-version-redirect.tester.js | 12 ++--- services/travis/travis-php-version.service.js | 16 +++---- services/travis/travis-php-version.tester.js | 8 ++-- services/treeware/treeware-trees.service.js | 16 +++---- services/treeware/treeware-trees.tester.js | 8 ++-- services/twitch/twitch-base.js | 10 ++--- services/twitch/twitch.service.js | 10 ++--- services/twitch/twitch.spec.js | 10 ++--- services/twitch/twitch.tester.js | 18 ++++---- services/twitter/twitter-redirect.service.js | 8 ++-- services/twitter/twitter-redirect.tester.js | 12 ++--- services/twitter/twitter.service.js | 12 +++-- services/twitter/twitter.tester.js | 13 +++--- services/ubuntu/ubuntu.service.js | 12 +++-- services/ubuntu/ubuntu.tester.js | 8 ++-- services/uptimerobot/uptimerobot-base.js | 10 ++--- .../uptimerobot/uptimerobot-ratio.service.js | 10 ++--- .../uptimerobot/uptimerobot-ratio.tester.js | 10 ++--- .../uptimerobot/uptimerobot-status.service.js | 8 ++-- .../uptimerobot/uptimerobot-status.tester.js | 10 ++--- .../vaadin-directory/vaadin-directory-base.js | 10 ++--- .../vaadin-directory-rating-count.service.js | 12 +++-- .../vaadin-directory-rating-count.tester.js | 8 ++-- .../vaadin-directory-rating.service.js | 12 +++-- .../vaadin-directory-rating.tester.js | 10 ++--- .../vaadin-directory-release-date.service.js | 12 +++-- .../vaadin-directory-release-date.tester.js | 8 ++-- .../vaadin-directory-status.service.js | 8 ++-- .../vaadin-directory-status.tester.js | 8 ++-- .../vaadin-directory-version.service.js | 10 ++--- .../vaadin-directory-version.tester.js | 8 ++-- services/validators.js | 8 ++-- services/version.js | 12 +++-- services/version.spec.js | 6 +-- services/versioneye/versioneye.service.js | 8 ++-- services/versioneye/versioneye.tester.js | 6 +-- .../visual-studio-app-center-base.js | 6 +-- ...visual-studio-app-center-builds.service.js | 18 +++----- .../visual-studio-app-center-builds.tester.js | 6 +-- ...o-app-center-releases-osversion.service.js | 14 ++---- ...io-app-center-releases-osversion.tester.js | 6 +-- ...studio-app-center-releases-size.service.js | 18 +++----- ...-studio-app-center-releases-size.tester.js | 8 ++-- ...dio-app-center-releases-version.service.js | 16 +++---- ...udio-app-center-releases-version.tester.js | 6 +-- ...rketplace-azure-devops-installs.service.js | 12 +++-- ...arketplace-azure-devops-installs.tester.js | 8 ++-- .../visual-studio-marketplace-base.js | 12 +++-- ...al-studio-marketplace-downloads.service.js | 12 +++-- ...ual-studio-marketplace-downloads.tester.js | 8 ++-- ...studio-marketplace-last-updated.service.js | 12 +++-- ...-studio-marketplace-last-updated.tester.js | 8 ++-- ...isual-studio-marketplace-rating.service.js | 12 +++-- ...visual-studio-marketplace-rating.tester.js | 8 ++-- ...studio-marketplace-release-date.service.js | 12 +++-- ...-studio-marketplace-release-date.tester.js | 8 ++-- ...sual-studio-marketplace-version.service.js | 10 ++--- ...isual-studio-marketplace-version.tester.js | 8 ++-- services/w3c/w3c-validation-helper.js | 6 +-- services/w3c/w3c-validation-helper.spec.js | 12 ++--- services/w3c/w3c-validation.service.js | 19 +++----- services/w3c/w3c-validation.tester.js | 7 +-- .../waffle/waffle-label-redirect.service.js | 8 ++-- .../waffle/waffle-label-redirect.tester.js | 12 ++--- services/waffle/waffle-label.service.js | 8 ++-- services/waffle/waffle-label.tester.js | 12 ++--- services/website-status.js | 8 ++-- services/website-status.spec.js | 6 +-- services/website/website-redirect.service.js | 18 +++----- services/website/website-redirect.tester.js | 12 ++--- services/website/website.service.js | 22 ++++------ services/website/website.tester.js | 6 +-- services/wercker/wercker.service.js | 12 +++-- services/wercker/wercker.tester.js | 8 ++-- services/wheelmap/wheelmap.service.js | 10 ++--- services/wheelmap/wheelmap.spec.js | 10 ++--- services/wheelmap/wheelmap.tester.js | 11 ++--- services/wordpress/wordpress-base.js | 12 +++-- .../wordpress/wordpress-downloads.service.js | 14 +++--- .../wordpress/wordpress-downloads.tester.js | 8 ++-- .../wordpress-last-update.service.js | 14 +++--- .../wordpress/wordpress-last-update.tester.js | 8 ++-- .../wordpress-platform-redirect.service.js | 8 ++-- .../wordpress-platform-redirect.tester.js | 6 +-- .../wordpress/wordpress-platform.service.js | 16 +++---- .../wordpress/wordpress-platform.tester.js | 21 +++------ .../wordpress/wordpress-rating.service.js | 10 ++--- services/wordpress/wordpress-rating.tester.js | 8 ++-- services/wordpress/wordpress-version-color.js | 12 +++-- .../wordpress/wordpress-version-color.spec.js | 9 +--- .../wordpress/wordpress-version.service.js | 10 ++--- .../wordpress/wordpress-version.tester.js | 13 +++--- services/youtube/youtube-base.js | 12 +++-- .../youtube/youtube-channel-views.service.js | 8 ++-- .../youtube/youtube-channel-views.tester.js | 13 +++--- services/youtube/youtube-comments.service.js | 8 ++-- services/youtube/youtube-comments.tester.js | 13 +++--- services/youtube/youtube-likes.service.js | 12 +++-- services/youtube/youtube-likes.tester.js | 15 ++++--- .../youtube/youtube-subscribers.service.js | 8 ++-- .../youtube/youtube-subscribers.tester.js | 13 +++--- services/youtube/youtube-views.service.js | 8 ++-- services/youtube/youtube-views.tester.js | 13 +++--- 1096 files changed, 4810 insertions(+), 7015 deletions(-) diff --git a/core/badge-urls/make-badge-url.js b/core/badge-urls/make-badge-url.js index 42c09f91689f2..74d1f2b2530ef 100644 --- a/core/badge-urls/make-badge-url.js +++ b/core/badge-urls/make-badge-url.js @@ -1,8 +1,6 @@ -'use strict' - -const { URL } = require('url') -const queryString = require('query-string') -const { compile } = require('path-to-regexp') +import {URL} from 'url'; +import queryString from 'query-string'; +import {compile} from 'path-to-regexp'; function badgeUrlFromPath({ baseUrl = '', @@ -52,7 +50,7 @@ function badgeUrlFromPattern({ } function encodeField(s) { - return encodeURIComponent(s.replace(/-/g, '--').replace(/_/g, '__')) + return encodeURIComponent(s.replace(/-/g, '--').replace(/_/g, '__')); } function staticBadgeUrl({ @@ -153,7 +151,7 @@ function rasterRedirectUrl({ rasterUrl }, badgeUrl) { return result } -module.exports = { +export default { badgeUrlFromPath, badgeUrlFromPattern, encodeField, @@ -161,4 +159,4 @@ module.exports = { queryStringStaticBadgeUrl, dynamicBadgeUrl, rasterRedirectUrl, -} +}; diff --git a/core/badge-urls/make-badge-url.spec.js b/core/badge-urls/make-badge-url.spec.js index 94642db1f85c5..9b9711516be6e 100644 --- a/core/badge-urls/make-badge-url.spec.js +++ b/core/badge-urls/make-badge-url.spec.js @@ -1,14 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { - badgeUrlFromPath, - badgeUrlFromPattern, - encodeField, - staticBadgeUrl, - queryStringStaticBadgeUrl, - dynamicBadgeUrl, -} = require('./make-badge-url') +import {test, given} from 'sazerac'; +import {badgeUrlFromPath, badgeUrlFromPattern, encodeField, staticBadgeUrl, queryStringStaticBadgeUrl, dynamicBadgeUrl} from './make-badge-url.js'; describe('Badge URL generation functions', function () { test(badgeUrlFromPath, () => { diff --git a/core/badge-urls/path-helpers.js b/core/badge-urls/path-helpers.js index b7b3bded44880..8102dc747a76f 100644 --- a/core/badge-urls/path-helpers.js +++ b/core/badge-urls/path-helpers.js @@ -1,18 +1,14 @@ -'use strict' - // Escapes `t` using the format specified in // function escapeFormat(t) { - return ( - t - // Single underscore. - .replace(/(^|[^_])((?:__)*)_(?!_)/g, '$1$2 ') - // Double underscore and double dash. - .replace(/__/g, '_') - .replace(/--/g, '-') - ) + return t + // Single underscore. + .replace(/(^|[^_])((?:__)*)_(?!_)/g, '$1$2 ') + // Double underscore and double dash. + .replace(/__/g, '_') + .replace(/--/g, '-'); } -module.exports = { +export default { escapeFormat, -} +}; diff --git a/core/badge-urls/path-helpers.spec.js b/core/badge-urls/path-helpers.spec.js index ef7a0068e1cc2..c0adbfdbace2c 100644 --- a/core/badge-urls/path-helpers.spec.js +++ b/core/badge-urls/path-helpers.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { escapeFormat } = require('./path-helpers') +import {test, given} from 'sazerac'; +import {escapeFormat} from './path-helpers.js'; describe('Badge URL helper functions', function () { test(escapeFormat, () => { diff --git a/core/base-service/auth-helper.js b/core/base-service/auth-helper.js index f4ce18102614c..c39f41afdc042 100644 --- a/core/base-service/auth-helper.js +++ b/core/base-service/auth-helper.js @@ -1,7 +1,5 @@ -'use strict' - -const { URL } = require('url') -const { InvalidParameter } = require('./errors') +import {URL} from 'url'; +import {InvalidParameter} from './errors.js'; class AuthHelper { constructor( @@ -207,4 +205,4 @@ class AuthHelper { } } -module.exports = { AuthHelper } +export default { AuthHelper }; diff --git a/core/base-service/auth-helper.spec.js b/core/base-service/auth-helper.spec.js index 2666c818aa909..6a3903b7dc0d3 100644 --- a/core/base-service/auth-helper.spec.js +++ b/core/base-service/auth-helper.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const { test, given, forCases } = require('sazerac') -const { AuthHelper } = require('./auth-helper') -const { InvalidParameter } = require('./errors') +import {expect} from 'chai'; +import {test, given, forCases} from 'sazerac'; +import {AuthHelper} from './auth-helper.js'; +import {InvalidParameter} from './errors.js'; describe('AuthHelper', function () { describe('constructor checks', function () { diff --git a/core/base-service/base-graphql.js b/core/base-service/base-graphql.js index 9d70fcf52ce66..55de5e0c8f1e7 100644 --- a/core/base-service/base-graphql.js +++ b/core/base-service/base-graphql.js @@ -2,12 +2,10 @@ * @module */ -'use strict' - -const { print } = require('graphql/language/printer') -const BaseService = require('./base') -const { InvalidResponse, ShieldsRuntimeError } = require('./errors') -const { parseJson } = require('./json') +import {print} from 'graphql/language/printer'; +import BaseService from './base.js'; +import {InvalidResponse, ShieldsRuntimeError} from './errors.js'; +import {parseJson} from './json.js'; function defaultTransformErrors(errors) { return new InvalidResponse({ prettyMessage: errors[0].message }) @@ -93,4 +91,4 @@ class BaseGraphqlService extends BaseService { } } -module.exports = BaseGraphqlService +export default BaseGraphqlService; diff --git a/core/base-service/base-graphql.spec.js b/core/base-service/base-graphql.spec.js index 187063c88da69..2c3ecfd5d1851 100644 --- a/core/base-service/base-graphql.spec.js +++ b/core/base-service/base-graphql.spec.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { expect } = require('chai') -const gql = require('graphql-tag') -const sinon = require('sinon') -const BaseGraphqlService = require('./base-graphql') -const { InvalidResponse } = require('./errors') +import Joi from 'joi'; +import {expect} from 'chai'; +import gql from 'graphql-tag'; +import sinon from 'sinon'; +import BaseGraphqlService from './base-graphql.js'; +import {InvalidResponse} from './errors.js'; const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base-json.js b/core/base-service/base-json.js index 3d786df49aacc..d534620b224c6 100644 --- a/core/base-service/base-json.js +++ b/core/base-service/base-json.js @@ -2,10 +2,8 @@ * @module */ -'use strict' - -const BaseService = require('./base') -const { parseJson } = require('./json') +import BaseService from './base.js'; +import {parseJson} from './json.js'; /** * Services which query a JSON endpoint should extend BaseJsonService @@ -54,4 +52,4 @@ class BaseJsonService extends BaseService { } } -module.exports = BaseJsonService +export default BaseJsonService; diff --git a/core/base-service/base-json.spec.js b/core/base-service/base-json.spec.js index 464b3800e6f04..31f35dd6ef09e 100644 --- a/core/base-service/base-json.spec.js +++ b/core/base-service/base-json.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { expect } = require('chai') -const sinon = require('sinon') -const BaseJsonService = require('./base-json') +import Joi from 'joi'; +import {expect} from 'chai'; +import sinon from 'sinon'; +import BaseJsonService from './base-json.js'; const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base-static.js b/core/base-service/base-static.js index 3781d450e3578..a5454f425fd57 100644 --- a/core/base-service/base-static.js +++ b/core/base-service/base-static.js @@ -1,17 +1,12 @@ -'use strict' - -const makeBadge = require('../../badge-maker/lib/make-badge') -const BaseService = require('./base') -const { - serverHasBeenUpSinceResourceCached, - setCacheHeadersForStaticResource, -} = require('./cache-headers') -const { makeSend } = require('./legacy-result-sender') -const { MetricHelper } = require('./metric-helper') -const coalesceBadge = require('./coalesce-badge') -const { prepareRoute, namedParamsForMatch } = require('./route') - -module.exports = class BaseStaticService extends BaseService { +import makeBadge from '../../badge-maker/lib/make-badge.js'; +import BaseService from './base.js'; +import {serverHasBeenUpSinceResourceCached, setCacheHeadersForStaticResource} from './cache-headers.js'; +import {makeSend} from './legacy-result-sender.js'; +import {MetricHelper} from './metric-helper.js'; +import coalesceBadge from './coalesce-badge.js'; +import {prepareRoute, namedParamsForMatch} from './route.js'; + +export default class BaseStaticService extends BaseService { static register({ camp, metricInstance }, serviceConfig) { const { regex, captureNames } = prepareRoute(this.route) @@ -57,4 +52,4 @@ module.exports = class BaseStaticService extends BaseService { metricHandle.noteResponseSent() }) } -} +}; diff --git a/core/base-service/base-svg-scraping.js b/core/base-service/base-svg-scraping.js index a79caeca82801..26379c86647b8 100644 --- a/core/base-service/base-svg-scraping.js +++ b/core/base-service/base-svg-scraping.js @@ -2,13 +2,11 @@ * @module */ -'use strict' - // See available emoji at http://emoji.muan.co/ -const emojic = require('emojic') -const BaseService = require('./base') -const trace = require('./trace') -const { InvalidResponse } = require('./errors') +import emojic from 'emojic'; +import BaseService from './base.js'; +import trace from './trace.js'; +import {InvalidResponse} from './errors.js'; const defaultValueMatcher = />([^<>]+)<\/text><\/g>/ const leadingWhitespace = /(?:\r\n\s*|\r\s*|\n\s*)/g @@ -90,4 +88,4 @@ class BaseSvgScrapingService extends BaseService { } } -module.exports = BaseSvgScrapingService +export default BaseSvgScrapingService; diff --git a/core/base-service/base-svg-scraping.spec.js b/core/base-service/base-svg-scraping.spec.js index 25b0a33e82608..8cb3c812ca072 100644 --- a/core/base-service/base-svg-scraping.spec.js +++ b/core/base-service/base-svg-scraping.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const sinon = require('sinon') -const Joi = require('joi') -const makeBadge = require('../../badge-maker/lib/make-badge') -const BaseSvgScrapingService = require('./base-svg-scraping') +import {expect} from 'chai'; +import sinon from 'sinon'; +import Joi from 'joi'; +import makeBadge from '../../badge-maker/lib/make-badge.js'; +import BaseSvgScrapingService from './base-svg-scraping.js'; const schema = Joi.object({ message: Joi.string().required(), @@ -116,7 +114,7 @@ describe('BaseSvgScrapingService', function () { schema, valueMatcher: />([^<>]+)<\/desc>/, url: 'http://example.com/foo.svg', - }) + }); } } const sendAndCacheRequest = async () => ({ diff --git a/core/base-service/base-xml.js b/core/base-service/base-xml.js index d42a54e11d9a0..7dcd73aac634e 100644 --- a/core/base-service/base-xml.js +++ b/core/base-service/base-xml.js @@ -2,14 +2,12 @@ * @module */ -'use strict' - // See available emoji at http://emoji.muan.co/ -const emojic = require('emojic') -const fastXmlParser = require('fast-xml-parser') -const BaseService = require('./base') -const trace = require('./trace') -const { InvalidResponse } = require('./errors') +import emojic from 'emojic'; +import fastXmlParser from 'fast-xml-parser'; +import BaseService from './base.js'; +import trace from './trace.js'; +import {InvalidResponse} from './errors.js'; /** * Services which query a XML endpoint should extend BaseXmlService @@ -68,4 +66,4 @@ class BaseXmlService extends BaseService { } } -module.exports = BaseXmlService +export default BaseXmlService; diff --git a/core/base-service/base-xml.spec.js b/core/base-service/base-xml.spec.js index 42ca1505fb314..135360aaf7197 100644 --- a/core/base-service/base-xml.spec.js +++ b/core/base-service/base-xml.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { expect } = require('chai') -const sinon = require('sinon') -const BaseXmlService = require('./base-xml') +import Joi from 'joi'; +import {expect} from 'chai'; +import sinon from 'sinon'; +import BaseXmlService from './base-xml.js'; const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base-yaml.js b/core/base-service/base-yaml.js index 3f16ea0c8192c..7b3264675ccc8 100644 --- a/core/base-service/base-yaml.js +++ b/core/base-service/base-yaml.js @@ -2,13 +2,11 @@ * @module */ -'use strict' - -const emojic = require('emojic') -const yaml = require('js-yaml') -const BaseService = require('./base') -const { InvalidResponse } = require('./errors') -const trace = require('./trace') +import emojic from 'emojic'; +import yaml from 'js-yaml'; +import BaseService from './base.js'; +import {InvalidResponse} from './errors.js'; +import trace from './trace.js'; /** * Services which query a YAML endpoint should extend BaseYamlService @@ -72,4 +70,4 @@ class BaseYamlService extends BaseService { } } -module.exports = BaseYamlService +export default BaseYamlService; diff --git a/core/base-service/base-yaml.spec.js b/core/base-service/base-yaml.spec.js index 781c76f130304..f7b5efe320704 100644 --- a/core/base-service/base-yaml.spec.js +++ b/core/base-service/base-yaml.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { expect } = require('chai') -const sinon = require('sinon') -const BaseYamlService = require('./base-yaml') +import Joi from 'joi'; +import {expect} from 'chai'; +import sinon from 'sinon'; +import BaseYamlService from './base-yaml.js'; const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base.js b/core/base-service/base.js index 332c7ca8380d1..de1784f4360bb 100644 --- a/core/base-service/base.js +++ b/core/base-service/base.js @@ -1,36 +1,22 @@ -'use strict' /** * @module */ // See available emoji at http://emoji.muan.co/ -const emojic = require('emojic') -const Joi = require('joi') -const log = require('../server/log') -const { AuthHelper } = require('./auth-helper') -const { MetricHelper, MetricNames } = require('./metric-helper') -const { assertValidCategory } = require('./categories') -const checkErrorResponse = require('./check-error-response') -const coalesceBadge = require('./coalesce-badge') -const { - NotFound, - InvalidResponse, - Inaccessible, - ImproperlyConfigured, - InvalidParameter, - Deprecated, -} = require('./errors') -const { validateExample, transformExample } = require('./examples') -const { - makeFullUrl, - assertValidRoute, - prepareRoute, - namedParamsForMatch, - getQueryParamNames, -} = require('./route') -const { assertValidServiceDefinition } = require('./service-definitions') -const trace = require('./trace') -const validate = require('./validate') +import emojic from 'emojic'; +import Joi from 'joi'; +import log from '../server/log.js'; +import {AuthHelper} from './auth-helper.js'; +import {MetricHelper, MetricNames} from './metric-helper.js'; +import {assertValidCategory} from './categories.js'; +import checkErrorResponse from './check-error-response.js'; +import coalesceBadge from './coalesce-badge.js'; +import {NotFound, InvalidResponse, Inaccessible, ImproperlyConfigured, InvalidParameter, Deprecated} from './errors.js'; +import {validateExample, transformExample} from './examples.js'; +import {makeFullUrl, assertValidRoute, prepareRoute, namedParamsForMatch, getQueryParamNames} from './route.js'; +import {assertValidServiceDefinition} from './service-definitions.js'; +import trace from './trace.js'; +import validate from './validate.js'; const defaultBadgeDataSchema = Joi.object({ label: Joi.string(), @@ -565,4 +551,4 @@ class BaseService { * An HTML string that is included in the badge popup. */ -module.exports = BaseService +export default BaseService; diff --git a/core/base-service/base.spec.js b/core/base-service/base.spec.js index 9fa7e7e1a2906..426514840e5d7 100644 --- a/core/base-service/base.spec.js +++ b/core/base-service/base.spec.js @@ -1,22 +1,14 @@ -'use strict' - -const Joi = require('joi') -const chai = require('chai') +import Joi from 'joi'; +import chai from 'chai'; const { expect } = chai -const sinon = require('sinon') -const prometheus = require('prom-client') -const PrometheusMetrics = require('../server/prometheus-metrics') -const trace = require('./trace') -const { - NotFound, - Inaccessible, - InvalidResponse, - InvalidParameter, - Deprecated, -} = require('./errors') -const BaseService = require('./base') -const { MetricHelper, MetricNames } = require('./metric-helper') -require('../register-chai-plugins.spec') +import sinon from 'sinon'; +import prometheus from 'prom-client'; +import PrometheusMetrics from '../server/prometheus-metrics.js'; +import trace from './trace.js'; +import {NotFound, Inaccessible, InvalidResponse, InvalidParameter, Deprecated} from './errors.js'; +import BaseService from './base.js'; +import {MetricHelper, MetricNames} from './metric-helper.js'; +import('../register-chai-plugins.spec'); chai.use(require('chai-as-promised')) const queryParamSchema = Joi.object({ @@ -105,7 +97,7 @@ describe('BaseService', function () { it('Should throw if route is not overridden', function () { return expect(BaseService.invoke({}, {}, {})).to.be.rejectedWith( /^Route not defined for BaseService$/ - ) + ); }) class WithRoute extends BaseService { @@ -114,7 +106,7 @@ describe('BaseService', function () { it('Should throw if handle() is not overridden', function () { return expect(WithRoute.invoke({}, {}, {})).to.be.rejectedWith( /^Handler not implemented for WithRoute$/ - ) + ); }) it('Should throw if category is not overridden', function () { diff --git a/core/base-service/cache-headers.js b/core/base-service/cache-headers.js index 999867aa22b04..f17672fb1913e 100644 --- a/core/base-service/cache-headers.js +++ b/core/base-service/cache-headers.js @@ -1,8 +1,6 @@ -'use strict' - -const assert = require('assert') -const Joi = require('joi') -const coalesce = require('./coalesce') +import assert from 'assert'; +import Joi from 'joi'; +import coalesce from './coalesce.js'; const serverStartTimeGMTString = new Date().toGMTString() const serverStartTimestamp = Date.now() @@ -104,10 +102,10 @@ function serverHasBeenUpSinceResourceCached(req) { ) } -module.exports = { +export default { coalesceCacheLength, setCacheHeaders, setHeadersForCacheLength, setCacheHeadersForStaticResource, serverHasBeenUpSinceResourceCached, -} +}; diff --git a/core/base-service/categories.js b/core/base-service/categories.js index d1bb0028fa5c4..e3a1312765ec7 100644 --- a/core/base-service/categories.js +++ b/core/base-service/categories.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const categories = require('../../services/categories') +import Joi from 'joi'; +import categories from '../../services/categories.js'; const isRealCategory = Joi.equal(...categories.map(({ id }) => id)).required() @@ -13,7 +11,7 @@ function assertValidCategory(category, message = undefined) { Joi.assert(category, isValidCategory, message) } -module.exports = { +export default { isValidCategory, assertValidCategory, -} +}; diff --git a/core/base-service/check-error-response.js b/core/base-service/check-error-response.js index 1c4816b1117b7..31029b39e135d 100644 --- a/core/base-service/check-error-response.js +++ b/core/base-service/check-error-response.js @@ -1,12 +1,10 @@ -'use strict' - -const { NotFound, InvalidResponse, Inaccessible } = require('./errors') +import {NotFound, InvalidResponse, Inaccessible} from './errors.js'; const defaultErrorMessages = { 404: 'not found', } -module.exports = function checkErrorResponse(errorMessages = {}) { +export default function checkErrorResponse(errorMessages = {}) { return async function ({ buffer, res }) { let error errorMessages = { ...defaultErrorMessages, ...errorMessages } @@ -34,4 +32,4 @@ module.exports = function checkErrorResponse(errorMessages = {}) { return { buffer, res } } } -} +}; diff --git a/core/base-service/check-error-response.spec.js b/core/base-service/check-error-response.spec.js index 34404aa658d72..2bfc3c329430e 100644 --- a/core/base-service/check-error-response.spec.js +++ b/core/base-service/check-error-response.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { NotFound, InvalidResponse, Inaccessible } = require('./errors') -const checkErrorResponse = require('./check-error-response') +import {expect} from 'chai'; +import {NotFound, InvalidResponse, Inaccessible} from './errors.js'; +import checkErrorResponse from './check-error-response.js'; describe('async error handler', function () { const buffer = Buffer.from('some stuff') diff --git a/core/base-service/coalesce-badge.js b/core/base-service/coalesce-badge.js index 9a94cb2752e26..29478e3d7139c 100644 --- a/core/base-service/coalesce-badge.js +++ b/core/base-service/coalesce-badge.js @@ -1,12 +1,7 @@ -'use strict' - -const { - decodeDataUrlFromQueryParam, - prepareNamedLogo, -} = require('../../lib/logos') -const { svg2base64 } = require('../../lib/svg-helpers') -const coalesce = require('./coalesce') -const toArray = require('./to-array') +import {decodeDataUrlFromQueryParam, prepareNamedLogo} from '../../lib/logos.js'; +import {svg2base64} from '../../lib/svg-helpers.js'; +import coalesce from './coalesce.js'; +import toArray from './to-array.js'; // Translate modern badge data to the legacy schema understood by the badge // maker. Allow the user to override the label, color, logo, etc. through the @@ -34,7 +29,7 @@ const toArray = require('./to-array') // 3. In the case of the `social` style only, the last precedence is the // service's default logo. The `logoColor` can be overridden by the query // string. -module.exports = function coalesceBadge( +export default function coalesceBadge( overrides, serviceData, // These two parameters were kept separate to make tests clearer. @@ -185,4 +180,4 @@ module.exports = function coalesceBadge( links: toArray(overrideLink || serviceLink), cacheLengthSeconds: coalesce(serviceCacheSeconds, defaultCacheSeconds), } -} +}; diff --git a/core/base-service/coalesce-badge.spec.js b/core/base-service/coalesce-badge.spec.js index 195926d74adb4..f7c347ca1ce15 100644 --- a/core/base-service/coalesce-badge.spec.js +++ b/core/base-service/coalesce-badge.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { getShieldsIcon, getSimpleIcon } = require('../../lib/logos') -const coalesceBadge = require('./coalesce-badge') +import {expect} from 'chai'; +import {getShieldsIcon, getSimpleIcon} from '../../lib/logos.js'; +import coalesceBadge from './coalesce-badge.js'; describe('coalesceBadge', function () { describe('Label', function () { diff --git a/core/base-service/coalesce.js b/core/base-service/coalesce.js index 4875b409c7925..845c896d2ab2c 100644 --- a/core/base-service/coalesce.js +++ b/core/base-service/coalesce.js @@ -1,5 +1,3 @@ -'use strict' - -module.exports = function coalesce(...candidates) { +export default function coalesce(...candidates) { return candidates.find(c => c !== undefined && c !== null) -} +}; diff --git a/core/base-service/coalesce.spec.js b/core/base-service/coalesce.spec.js index b83b458caf3e3..901e67963479d 100644 --- a/core/base-service/coalesce.spec.js +++ b/core/base-service/coalesce.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const coalesce = require('./coalesce') +import {test, given} from 'sazerac'; +import coalesce from './coalesce.js'; // Sticking with our one-line spread implementation, and defaulting to // `undefined` instead of `null`, though h/t to diff --git a/core/base-service/deprecated-service.js b/core/base-service/deprecated-service.js index a2c4796a58319..9bc927c0ef573 100644 --- a/core/base-service/deprecated-service.js +++ b/core/base-service/deprecated-service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const camelcase = require('camelcase') -const BaseService = require('./base') -const { isValidCategory } = require('./categories') -const { Deprecated } = require('./errors') -const { isValidRoute } = require('./route') +import Joi from 'joi'; +import camelcase from 'camelcase'; +import BaseService from './base.js'; +import {isValidCategory} from './categories.js'; +import {Deprecated} from './errors.js'; +import {isValidRoute} from './route.js'; const attrSchema = Joi.object({ route: isValidRoute, @@ -41,7 +39,7 @@ function deprecatedService(attrs) { async handle() { throw new Deprecated({ prettyMessage: message }) } - } + }; } -module.exports = deprecatedService +export default deprecatedService; diff --git a/core/base-service/deprecated-service.spec.js b/core/base-service/deprecated-service.spec.js index 3cc321efe32a4..4167f0a6d4ed4 100644 --- a/core/base-service/deprecated-service.spec.js +++ b/core/base-service/deprecated-service.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { expect } = require('chai') -const deprecatedService = require('./deprecated-service') +import {expect} from 'chai'; +import deprecatedService from './deprecated-service.js'; describe('DeprecatedService', function () { const route = { diff --git a/core/base-service/errors.js b/core/base-service/errors.js index 5bbd709089df1..753f96ceb4c45 100644 --- a/core/base-service/errors.js +++ b/core/base-service/errors.js @@ -4,8 +4,6 @@ * @module */ -'use strict' - /** * Base error class * @@ -210,7 +208,7 @@ class Deprecated extends ShieldsRuntimeError { * badge when we catch and render the exception (Optional) */ -module.exports = { +export default { ShieldsRuntimeError, NotFound, ImproperlyConfigured, @@ -218,4 +216,4 @@ module.exports = { Inaccessible, InvalidParameter, Deprecated, -} +}; diff --git a/core/base-service/examples.js b/core/base-service/examples.js index 99200d6564eeb..812f8c4c87681 100644 --- a/core/base-service/examples.js +++ b/core/base-service/examples.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { pathToRegexp, compile } = require('path-to-regexp') -const categories = require('../../services/categories') -const coalesceBadge = require('./coalesce-badge') -const { makeFullUrl } = require('./route') +import Joi from 'joi'; +import {pathToRegexp, compile} from 'path-to-regexp'; +import categories from '../../services/categories.js'; +import coalesceBadge from './coalesce-badge.js'; +import {makeFullUrl} from './route.js'; const optionalObjectOfKeyValues = Joi.object().pattern( /./, @@ -155,7 +153,7 @@ function transformExample(inExample, index, ServiceClass) { } } -module.exports = { +export default { validateExample, transformExample, -} +}; diff --git a/core/base-service/examples.spec.js b/core/base-service/examples.spec.js index 3428771bfbc9c..8259922d75dd1 100644 --- a/core/base-service/examples.spec.js +++ b/core/base-service/examples.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { validateExample, transformExample } = require('./examples') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {validateExample, transformExample} from './examples.js'; describe('validateExample function', function () { it('passes valid examples', function () { diff --git a/core/base-service/graphql.js b/core/base-service/graphql.js index 3a78deb09a6d8..2ad7f2e4ba7ca 100644 --- a/core/base-service/graphql.js +++ b/core/base-service/graphql.js @@ -1,4 +1,3 @@ -'use strict' /** * @module */ @@ -49,4 +48,4 @@ function mergeQueries(...queries) { return merged } -module.exports = { mergeQueries } +export default { mergeQueries }; diff --git a/core/base-service/graphql.spec.js b/core/base-service/graphql.spec.js index 202dd052c6982..aa5adf322d3c4 100644 --- a/core/base-service/graphql.spec.js +++ b/core/base-service/graphql.spec.js @@ -1,11 +1,9 @@ -'use strict' +import {expect} from 'chai'; +import gql from 'graphql-tag'; +import {print} from 'graphql/language/printer'; +import {mergeQueries} from './graphql.js'; -const { expect } = require('chai') -const gql = require('graphql-tag') -const { print } = require('graphql/language/printer') -const { mergeQueries } = require('./graphql') - -require('../register-chai-plugins.spec') +import('../register-chai-plugins.spec'); describe('mergeQueries function', function () { it('merges valid gql queries', function () { diff --git a/core/base-service/index.js b/core/base-service/index.js index ef99fdb296494..a63eae9e6909b 100644 --- a/core/base-service/index.js +++ b/core/base-service/index.js @@ -1,23 +1,15 @@ -'use strict' +import BaseService from './base.js'; +import BaseJsonService from './base-json.js'; +import BaseGraphqlService from './base-graphql.js'; +import BaseStaticService from './base-static.js'; +import BaseSvgScrapingService from './base-svg-scraping.js'; +import BaseXmlService from './base-xml.js'; +import BaseYamlService from './base-yaml.js'; +import deprecatedService from './deprecated-service.js'; +import redirector from './redirector.js'; +import {NotFound, InvalidResponse, Inaccessible, InvalidParameter, Deprecated} from './errors.js'; -const BaseService = require('./base') -const BaseJsonService = require('./base-json') -const BaseGraphqlService = require('./base-graphql') -const BaseStaticService = require('./base-static') -const BaseSvgScrapingService = require('./base-svg-scraping') -const BaseXmlService = require('./base-xml') -const BaseYamlService = require('./base-yaml') -const deprecatedService = require('./deprecated-service') -const redirector = require('./redirector') -const { - NotFound, - InvalidResponse, - Inaccessible, - InvalidParameter, - Deprecated, -} = require('./errors') - -module.exports = { +export default { BaseService, BaseJsonService, BaseGraphqlService, @@ -32,4 +24,4 @@ module.exports = { Inaccessible, InvalidParameter, Deprecated, -} +}; diff --git a/core/base-service/json.js b/core/base-service/json.js index 6186b1e6b0b57..148685ffee91a 100644 --- a/core/base-service/json.js +++ b/core/base-service/json.js @@ -1,9 +1,7 @@ -'use strict' - // See available emoji at http://emoji.muan.co/ -const emojic = require('emojic') -const { InvalidResponse } = require('./errors') -const trace = require('./trace') +import emojic from 'emojic'; +import {InvalidResponse} from './errors.js'; +import trace from './trace.js'; function parseJson(buffer) { const logTrace = (...args) => trace.logTrace('fetch', ...args) @@ -23,6 +21,6 @@ function parseJson(buffer) { return json } -module.exports = { +export default { parseJson, -} +}; diff --git a/core/base-service/legacy-request-handler.js b/core/base-service/legacy-request-handler.js index f048ec55bdcc7..1caef662f17c0 100644 --- a/core/base-service/legacy-request-handler.js +++ b/core/base-service/legacy-request-handler.js @@ -1,15 +1,9 @@ -'use strict' - -const request = require('request') -const makeBadge = require('../../badge-maker/lib/make-badge') -const { setCacheHeaders } = require('./cache-headers') -const { - Inaccessible, - InvalidResponse, - ShieldsRuntimeError, -} = require('./errors') -const { makeSend } = require('./legacy-result-sender') -const coalesceBadge = require('./coalesce-badge') +import request from 'request'; +import makeBadge from '../../badge-maker/lib/make-badge.js'; +import {setCacheHeaders} from './cache-headers.js'; +import {Inaccessible, InvalidResponse, ShieldsRuntimeError} from './errors.js'; +import {makeSend} from './legacy-result-sender.js'; +import coalesceBadge from './coalesce-badge.js'; const userAgent = 'Shields.io/2003a' @@ -203,11 +197,11 @@ function handleRequest(cacheHeaderConfig, handlerOptions) { throw err }) } - } + }; } -module.exports = { +export default { handleRequest, promisify, userAgent, -} +}; diff --git a/core/base-service/legacy-request-handler.spec.js b/core/base-service/legacy-request-handler.spec.js index a4cd21bbd32f4..c40342dcbc09c 100644 --- a/core/base-service/legacy-request-handler.spec.js +++ b/core/base-service/legacy-request-handler.spec.js @@ -1,12 +1,10 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const portfinder = require('portfinder') -const Camp = require('@shields_io/camp') -const got = require('../got-test-client') -const coalesceBadge = require('./coalesce-badge') -const { handleRequest } = require('./legacy-request-handler') +import {expect} from 'chai'; +import nock from 'nock'; +import portfinder from 'portfinder'; +import Camp from '@shields_io/camp'; +import got from '../got-test-client.js'; +import coalesceBadge from './coalesce-badge.js'; +import {handleRequest} from './legacy-request-handler.js'; async function performTwoRequests(baseUrl, first, second) { expect((await got(`${baseUrl}${first}`)).statusCode).to.equal(200) diff --git a/core/base-service/legacy-result-sender.js b/core/base-service/legacy-result-sender.js index 01ffc800cc6d9..987feba90235a 100644 --- a/core/base-service/legacy-result-sender.js +++ b/core/base-service/legacy-result-sender.js @@ -1,6 +1,4 @@ -'use strict' - -const stream = require('stream') +import stream from 'stream'; function streamFromString(str) { const newStream = new stream.Readable() @@ -32,6 +30,6 @@ function makeSend(format, askres, end) { } } -module.exports = { +export default { makeSend, -} +}; diff --git a/core/base-service/loader-test-fixtures/empty-array.fixture.js b/core/base-service/loader-test-fixtures/empty-array.fixture.js index d0c6276a37eb4..d6d1738de67ec 100644 --- a/core/base-service/loader-test-fixtures/empty-array.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-array.fixture.js @@ -1,3 +1 @@ -'use strict' - -module.exports = [] +export default []; diff --git a/core/base-service/loader-test-fixtures/empty-object.fixture.js b/core/base-service/loader-test-fixtures/empty-object.fixture.js index 545992ebbbabe..ff8b4c56321a3 100644 --- a/core/base-service/loader-test-fixtures/empty-object.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-object.fixture.js @@ -1,3 +1 @@ -'use strict' - -module.exports = {} +export default {}; diff --git a/core/base-service/loader-test-fixtures/empty-undefined.fixture.js b/core/base-service/loader-test-fixtures/empty-undefined.fixture.js index 3ad27782bc55c..f237ddf58ed4f 100644 --- a/core/base-service/loader-test-fixtures/empty-undefined.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-undefined.fixture.js @@ -1,3 +1 @@ -'use strict' - -module.exports = undefined +export default undefined; diff --git a/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js b/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js index 7cacacc9033ed..8a35cd1d48488 100644 --- a/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js @@ -1,9 +1,7 @@ -'use strict' - -const BaseJsonService = require('../base-json') +import BaseJsonService from '../base-json.js'; class BadBaseService {} class GoodService extends BaseJsonService {} class BadService extends BadBaseService {} -module.exports = [GoodService, BadService] +export default [GoodService, BadService]; diff --git a/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js b/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js index 2a8a55c48effb..5654839e70853 100644 --- a/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js @@ -1,5 +1,3 @@ -'use strict' - class BadService {} -module.exports = BadService +export default BadService; diff --git a/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js b/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js index 89b1451d9616f..a607f8e49855d 100644 --- a/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js @@ -1,6 +1,4 @@ -'use strict' - class BadBaseService {} class BadService extends BadBaseService {} -module.exports = BadService +export default BadService; diff --git a/core/base-service/loader-test-fixtures/valid-array.fixture.js b/core/base-service/loader-test-fixtures/valid-array.fixture.js index ee8e213954d81..1e1bb2b34931f 100644 --- a/core/base-service/loader-test-fixtures/valid-array.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-array.fixture.js @@ -1,6 +1,4 @@ -'use strict' - -const BaseJsonService = require('../base-json') +import BaseJsonService from '../base-json.js'; class GoodServiceOne extends BaseJsonService { static category = 'build' @@ -11,4 +9,4 @@ class GoodServiceTwo extends BaseJsonService { static route = { base: 'good', pattern: 'two' } } -module.exports = [GoodServiceOne, GoodServiceTwo] +export default [GoodServiceOne, GoodServiceTwo]; diff --git a/core/base-service/loader-test-fixtures/valid-class.fixture.js b/core/base-service/loader-test-fixtures/valid-class.fixture.js index 41ae5ed9054c2..8541e4bc28b72 100644 --- a/core/base-service/loader-test-fixtures/valid-class.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-class.fixture.js @@ -1,10 +1,8 @@ -'use strict' - -const BaseJsonService = require('../base-json') +import BaseJsonService from '../base-json.js'; class GoodService extends BaseJsonService { static category = 'build' static route = { base: 'it/is', pattern: 'good' } } -module.exports = GoodService +export default GoodService; diff --git a/core/base-service/loader-test-fixtures/valid-object.fixture.js b/core/base-service/loader-test-fixtures/valid-object.fixture.js index 4bf828f9cc99b..62aed2bbdb23d 100644 --- a/core/base-service/loader-test-fixtures/valid-object.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-object.fixture.js @@ -1,6 +1,4 @@ -'use strict' - -const BaseJsonService = require('../base-json') +import BaseJsonService from '../base-json.js'; class GoodServiceOne extends BaseJsonService { static category = 'build' @@ -11,4 +9,4 @@ class GoodServiceTwo extends BaseJsonService { static route = { base: 'good', pattern: 'two' } } -module.exports = { GoodServiceOne, GoodServiceTwo } +export default { GoodServiceOne, GoodServiceTwo }; diff --git a/core/base-service/loader.js b/core/base-service/loader.js index c2404b8c38da8..3009d5ae80c84 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -1,11 +1,9 @@ -'use strict' - -const path = require('path') -const glob = require('glob') -const countBy = require('lodash.countby') -const categories = require('../../services/categories') -const BaseService = require('./base') -const { assertValidServiceDefinitionExport } = require('./service-definitions') +import path from 'path'; +import glob from 'glob'; +import countBy from 'lodash.countby'; +import categories from '../../services/categories.js'; +import BaseService from './base.js'; +import {assertValidServiceDefinitionExport} from './service-definitions.js'; const serviceDir = path.join(__dirname, '..', '..', 'services') @@ -109,10 +107,10 @@ function loadTesters() { .map(path => require(path)) } -module.exports = { +export default { InvalidService, loadServiceClasses, checkNames, collectDefinitions, loadTesters, -} +}; diff --git a/core/base-service/loader.spec.js b/core/base-service/loader.spec.js index 374c17cb004e0..3a10e31819ee6 100644 --- a/core/base-service/loader.spec.js +++ b/core/base-service/loader.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { expect } = require('chai') -const { loadServiceClasses, InvalidService } = require('./loader') +import {expect} from 'chai'; +import {loadServiceClasses, InvalidService} from './loader.js'; describe('loadServiceClasses function', function () { it('throws if module exports empty', function () { diff --git a/core/base-service/metric-helper.js b/core/base-service/metric-helper.js index 33f472b02d45e..9cae13650456c 100644 --- a/core/base-service/metric-helper.js +++ b/core/base-service/metric-helper.js @@ -1,6 +1,4 @@ -'use strict' - -const { performance } = require('perf_hooks') +import {performance} from 'perf_hooks'; class MetricHelper { constructor({ metricInstance }, { category, serviceFamily, name }) { @@ -59,4 +57,4 @@ const MetricNames = Object.freeze({ SERVICE_RESPONSE_SIZE: Symbol('service-response-size'), }) -module.exports = { MetricHelper, MetricNames } +export default { MetricHelper, MetricNames }; diff --git a/core/base-service/redirector.js b/core/base-service/redirector.js index 5d499e9dad59b..ea8dd2a6fdea0 100644 --- a/core/base-service/redirector.js +++ b/core/base-service/redirector.js @@ -1,18 +1,13 @@ -'use strict' - -const camelcase = require('camelcase') -const emojic = require('emojic') -const Joi = require('joi') -const queryString = require('query-string') -const BaseService = require('./base') -const { - serverHasBeenUpSinceResourceCached, - setCacheHeadersForStaticResource, -} = require('./cache-headers') -const { isValidCategory } = require('./categories') -const { MetricHelper } = require('./metric-helper') -const { isValidRoute, prepareRoute, namedParamsForMatch } = require('./route') -const trace = require('./trace') +import camelcase from 'camelcase'; +import emojic from 'emojic'; +import Joi from 'joi'; +import queryString from 'query-string'; +import BaseService from './base.js'; +import {serverHasBeenUpSinceResourceCached, setCacheHeadersForStaticResource} from './cache-headers.js'; +import {isValidCategory} from './categories.js'; +import {MetricHelper} from './metric-helper.js'; +import {isValidRoute, prepareRoute, namedParamsForMatch} from './route.js'; +import trace from './trace.js'; const attrSchema = Joi.object({ name: Joi.string().min(3), @@ -32,7 +27,7 @@ const attrSchema = Joi.object({ overrideTransformedQueryParams: Joi.bool().optional(), }).required() -module.exports = function redirector(attrs) { +export default function redirector(attrs) { const { name, category, @@ -121,5 +116,5 @@ module.exports = function redirector(attrs) { metricHandle.noteResponseSent() }) } - } -} + }; +}; diff --git a/core/base-service/redirector.spec.js b/core/base-service/redirector.spec.js index 1f81913c6fba1..422ce2001a664 100644 --- a/core/base-service/redirector.spec.js +++ b/core/base-service/redirector.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const Camp = require('@shields_io/camp') -const portfinder = require('portfinder') -const { expect } = require('chai') -const got = require('../got-test-client') -const redirector = require('./redirector') +import Camp from '@shields_io/camp'; +import portfinder from 'portfinder'; +import {expect} from 'chai'; +import got from '../got-test-client.js'; +import redirector from './redirector.js'; describe('Redirector', function () { const route = { diff --git a/core/base-service/route.js b/core/base-service/route.js index 9d60b495af047..1890f7094ba34 100644 --- a/core/base-service/route.js +++ b/core/base-service/route.js @@ -1,8 +1,6 @@ -'use strict' - -const escapeStringRegexp = require('escape-string-regexp') -const Joi = require('joi') -const { pathToRegexp } = require('path-to-regexp') +import escapeStringRegexp from 'escape-string-regexp'; +import Joi from 'joi'; +import {pathToRegexp} from 'path-to-regexp'; function makeFullUrl(base, partialUrl) { return `/${[base, partialUrl].filter(Boolean).join('/')}` @@ -74,11 +72,11 @@ function getQueryParamNames({ queryParamSchema }) { } } -module.exports = { +export default { makeFullUrl, isValidRoute, assertValidRoute, prepareRoute, namedParamsForMatch, getQueryParamNames, -} +}; diff --git a/core/base-service/route.spec.js b/core/base-service/route.spec.js index 612a0d5cc27f1..54e1db62da550 100644 --- a/core/base-service/route.spec.js +++ b/core/base-service/route.spec.js @@ -1,13 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const Joi = require('joi') -const { test, given, forCases } = require('sazerac') -const { - prepareRoute, - namedParamsForMatch, - getQueryParamNames, -} = require('./route') +import {expect} from 'chai'; +import Joi from 'joi'; +import {test, given, forCases} from 'sazerac'; +import {prepareRoute, namedParamsForMatch, getQueryParamNames} from './route.js'; describe('Route helpers', function () { context('A `pattern` with a named param is declared', function () { diff --git a/core/base-service/service-definitions.js b/core/base-service/service-definitions.js index 3f931458276cf..55705f0872cc6 100644 --- a/core/base-service/service-definitions.js +++ b/core/base-service/service-definitions.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; // This should be kept in sync with the schema in // `frontend/lib/service-definitions/index.ts`. @@ -72,9 +70,9 @@ function assertValidServiceDefinitionExport(examples, message = undefined) { Joi.assert(examples, serviceDefinitionExport, message) } -module.exports = { +export default { serviceDefinition, assertValidServiceDefinition, serviceDefinitionExport, assertValidServiceDefinitionExport, -} +}; diff --git a/core/base-service/to-array.js b/core/base-service/to-array.js index e22a7227b39dd..cfbaeb3d38079 100644 --- a/core/base-service/to-array.js +++ b/core/base-service/to-array.js @@ -1,6 +1,4 @@ -'use strict' - -module.exports = function toArray(val) { +export default function toArray(val) { if (val === undefined) { return [] } else if (Object(val) instanceof Array) { @@ -8,4 +6,4 @@ module.exports = function toArray(val) { } else { return [val] } -} +}; diff --git a/core/base-service/trace.js b/core/base-service/trace.js index 97ef96c66cbb8..99642037aea7f 100644 --- a/core/base-service/trace.js +++ b/core/base-service/trace.js @@ -1,6 +1,4 @@ -'use strict' - -const chalk = require('chalk') +import chalk from 'chalk'; const config = require('config').util.toObject() // Config is loaded globally but it would be better to inject it. To do that, @@ -37,6 +35,6 @@ function logTrace(stage, symbol, label, content, { deep = false } = {}) { } } -module.exports = { +export default { logTrace, -} +}; diff --git a/core/base-service/validate.js b/core/base-service/validate.js index a2da0e922da02..fc5afb021d654 100644 --- a/core/base-service/validate.js +++ b/core/base-service/validate.js @@ -1,8 +1,6 @@ -'use strict' - -const emojic = require('emojic') -const Joi = require('joi') -const trace = require('./trace') +import emojic from 'emojic'; +import Joi from 'joi'; +import trace from './trace.js'; function validate( { @@ -50,4 +48,4 @@ function validate( } } -module.exports = validate +export default validate; diff --git a/core/base-service/validate.spec.js b/core/base-service/validate.spec.js index c51f771070385..c340620beb5c2 100644 --- a/core/base-service/validate.spec.js +++ b/core/base-service/validate.spec.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { expect } = require('chai') -const sinon = require('sinon') -const trace = require('./trace') -const { InvalidParameter } = require('./errors') -const validate = require('./validate') +import Joi from 'joi'; +import {expect} from 'chai'; +import sinon from 'sinon'; +import trace from './trace.js'; +import {InvalidParameter} from './errors.js'; +import validate from './validate.js'; describe('validate', function () { const schema = Joi.object({ diff --git a/core/got-test-client.js b/core/got-test-client.js index 70af889af97bc..32b24cc4243aa 100644 --- a/core/got-test-client.js +++ b/core/got-test-client.js @@ -1,6 +1,4 @@ -'use strict' - -const got = require('got') +import got from 'got'; // https://github.com/nock/nock/issues/1523 -module.exports = got.extend({ retry: 0 }) +export default got.extend({ retry: 0 }); diff --git a/core/legacy/regular-update.js b/core/legacy/regular-update.js index e32e05c412d1f..1325e7176698a 100644 --- a/core/legacy/regular-update.js +++ b/core/legacy/regular-update.js @@ -1,6 +1,4 @@ -'use strict' - -const { Inaccessible, InvalidResponse } = require('../base-service/errors') +import {Inaccessible, InvalidResponse} from '../base-service/errors.js'; // Map from URL to { timestamp: last fetch time, data: data }. let regularUpdateCache = Object.create(null) @@ -95,7 +93,7 @@ function clearRegularUpdateCache() { regularUpdateCache = Object.create(null) } -module.exports = { +export default { regularUpdate, clearRegularUpdateCache, -} +}; diff --git a/core/register-chai-plugins.spec.js b/core/register-chai-plugins.spec.js index 0873f4c86344f..4126b28366494 100644 --- a/core/register-chai-plugins.spec.js +++ b/core/register-chai-plugins.spec.js @@ -1,6 +1,4 @@ -'use strict' - -const { use } = require('chai') +import {use} from 'chai'; use(require('chai-string')) use(require('sinon-chai')) diff --git a/core/server/in-process-server-test-helpers.js b/core/server/in-process-server-test-helpers.js index 85280a1a31629..9c6ffcb7fbd27 100644 --- a/core/server/in-process-server-test-helpers.js +++ b/core/server/in-process-server-test-helpers.js @@ -1,9 +1,7 @@ -'use strict' - -const merge = require('deepmerge') +import merge from 'deepmerge'; const config = require('config').util.toObject() -const portfinder = require('portfinder') -const Server = require('./server') +import portfinder from 'portfinder'; +import Server from './server.js'; async function createTestServer(customConfig = {}) { const mergedConfig = merge(config, customConfig) @@ -13,6 +11,6 @@ async function createTestServer(customConfig = {}) { return new Server(mergedConfig) } -module.exports = { +export default { createTestServer, -} +}; diff --git a/core/server/influx-metrics.js b/core/server/influx-metrics.js index 2d87cc56d5af9..237bdc9e5843b 100644 --- a/core/server/influx-metrics.js +++ b/core/server/influx-metrics.js @@ -1,11 +1,10 @@ -'use strict' -const os = require('os') -const got = require('got') -const generateInstanceId = require('./instance-id-generator') -const { promClientJsonToInfluxV2 } = require('./metrics/format-converters') -const log = require('./log') +import os from 'os'; +import got from 'got'; +import generateInstanceId from './instance-id-generator.js'; +import {promClientJsonToInfluxV2} from './metrics/format-converters.js'; +import log from './log.js'; -module.exports = class InfluxMetrics { +export default class InfluxMetrics { constructor(metricInstance, config) { this._metricInstance = metricInstance this._config = config @@ -79,4 +78,4 @@ module.exports = class InfluxMetrics { this._intervalId = undefined } } -} +}; diff --git a/core/server/influx-metrics.spec.js b/core/server/influx-metrics.spec.js index 4b91b055230bc..860a37c9e5b96 100644 --- a/core/server/influx-metrics.spec.js +++ b/core/server/influx-metrics.spec.js @@ -1,11 +1,10 @@ -'use strict' -const os = require('os') -const nock = require('nock') -const sinon = require('sinon') -const { expect } = require('chai') -const log = require('./log') -const InfluxMetrics = require('./influx-metrics') -require('../register-chai-plugins.spec') +import os from 'os'; +import nock from 'nock'; +import sinon from 'sinon'; +import {expect} from 'chai'; +import log from './log.js'; +import InfluxMetrics from './influx-metrics.js'; +import('../register-chai-plugins.spec'); describe('Influx metrics', function () { const metricInstance = { metrics() { diff --git a/core/server/instance-id-generator.js b/core/server/instance-id-generator.js index e156070161ec5..ba5ecdee1f322 100644 --- a/core/server/instance-id-generator.js +++ b/core/server/instance-id-generator.js @@ -1,8 +1,6 @@ -'use strict' - function generateInstanceId() { // from https://gist.github.com/gordonbrander/2230317 return Math.random().toString(36).substr(2, 9) } -module.exports = generateInstanceId +export default generateInstanceId; diff --git a/core/server/log.js b/core/server/log.js index 46cb98a24ac1e..513cfb0125b07 100644 --- a/core/server/log.js +++ b/core/server/log.js @@ -1,5 +1,4 @@ -'use strict' -const Sentry = require('@sentry/node') +import Sentry from '@sentry/node'; const listeners = [] @@ -23,27 +22,27 @@ function date() { ) } -module.exports = function log(...msg) { +export default function log(...msg) { const d = date() listeners.forEach(f => f(d, ...msg)) console.log(d, ...msg) -} +}; -module.exports.error = function error(err) { +export const error = function error(err) { const d = date() listeners.forEach(f => f(d, err)) Sentry.captureException(err) console.error(d, err) -} +}; -module.exports.addListener = function addListener(func) { +export const addListener = function addListener(func) { listeners.push(func) -} +}; -module.exports.removeListener = function removeListener(func) { +export const removeListener = function removeListener(func) { const index = listeners.indexOf(func) if (index < 0) { return } listeners.splice(index, 1) -} +}; diff --git a/core/server/metrics/format-converters.js b/core/server/metrics/format-converters.js index bb3903a68422b..538851da0731e 100644 --- a/core/server/metrics/format-converters.js +++ b/core/server/metrics/format-converters.js @@ -1,5 +1,4 @@ -'use strict' -const groupBy = require('lodash.groupby') +import groupBy from 'lodash.groupby'; function promClientJsonToInfluxV2(metrics, extraLabels = {}) { return metrics @@ -24,4 +23,4 @@ function promClientJsonToInfluxV2(metrics, extraLabels = {}) { .join('\n') } -module.exports = { promClientJsonToInfluxV2 } +export default { promClientJsonToInfluxV2 }; diff --git a/core/server/metrics/format-converters.spec.js b/core/server/metrics/format-converters.spec.js index f4f2381429780..f60a641cbbb64 100644 --- a/core/server/metrics/format-converters.spec.js +++ b/core/server/metrics/format-converters.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const prometheus = require('prom-client') -const { promClientJsonToInfluxV2 } = require('./format-converters') +import {expect} from 'chai'; +import prometheus from 'prom-client'; +import {promClientJsonToInfluxV2} from './format-converters.js'; describe('Metric format converters', function () { describe('prom-client JSON to InfluxDB line protocol (version 2)', function () { diff --git a/core/server/prometheus-metrics.js b/core/server/prometheus-metrics.js index a19c916d920d5..aa2af9d01d99f 100644 --- a/core/server/prometheus-metrics.js +++ b/core/server/prometheus-metrics.js @@ -1,9 +1,7 @@ -'use strict' +import decamelize from 'decamelize'; +import prometheus from 'prom-client'; -const decamelize = require('decamelize') -const prometheus = require('prom-client') - -module.exports = class PrometheusMetrics { +export default class PrometheusMetrics { constructor({ register } = {}) { this.register = register || new prometheus.Registry() this.counters = { @@ -84,4 +82,4 @@ module.exports = class PrometheusMetrics { service ) } -} +}; diff --git a/core/server/prometheus-metrics.spec.js b/core/server/prometheus-metrics.spec.js index 22cffbaef78f8..47c7e062d9795 100644 --- a/core/server/prometheus-metrics.spec.js +++ b/core/server/prometheus-metrics.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const Camp = require('@shields_io/camp') -const portfinder = require('portfinder') -const got = require('../got-test-client') -const Metrics = require('./prometheus-metrics') +import {expect} from 'chai'; +import Camp from '@shields_io/camp'; +import portfinder from 'portfinder'; +import got from '../got-test-client.js'; +import Metrics from './prometheus-metrics.js'; describe('Prometheus metrics route', function () { let port, baseUrl, camp, metrics diff --git a/core/server/secret-is-valid.js b/core/server/secret-is-valid.js index d00118969add8..422e570e35fe2 100644 --- a/core/server/secret-is-valid.js +++ b/core/server/secret-is-valid.js @@ -1,5 +1,3 @@ -'use strict' - function constEq(a, b) { if (a.length !== b.length) { return false @@ -17,4 +15,4 @@ function makeSecretIsValid(shieldsSecret) { } } -module.exports = { makeSecretIsValid } +export default { makeSecretIsValid }; diff --git a/core/server/server.js b/core/server/server.js index 36e9d57d73809..ea32ce96d35ed 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -1,27 +1,26 @@ -'use strict' /** * @module */ -const path = require('path') -const url = require('url') +import path from 'path'; +import url from 'url'; const { URL } = url -const cloudflareMiddleware = require('cloudflare-middleware') -const bytes = require('bytes') -const Camp = require('@shields_io/camp') -const originalJoi = require('joi') -const makeBadge = require('../../badge-maker/lib/make-badge') -const GithubConstellation = require('../../services/github/github-constellation') -const suggest = require('../../services/suggest') -const { loadServiceClasses } = require('../base-service/loader') -const { makeSend } = require('../base-service/legacy-result-sender') -const { handleRequest } = require('../base-service/legacy-request-handler') -const { clearRegularUpdateCache } = require('../legacy/regular-update') -const { rasterRedirectUrl } = require('../badge-urls/make-badge-url') -const { nonNegativeInteger } = require('../../services/validators') -const log = require('./log') -const PrometheusMetrics = require('./prometheus-metrics') -const InfluxMetrics = require('./influx-metrics') +import cloudflareMiddleware from 'cloudflare-middleware'; +import bytes from 'bytes'; +import Camp from '@shields_io/camp'; +import originalJoi from 'joi'; +import makeBadge from '../../badge-maker/lib/make-badge.js'; +import GithubConstellation from '../../services/github/github-constellation.js'; +import suggest from '../../services/suggest.js'; +import {loadServiceClasses} from '../base-service/loader.js'; +import {makeSend} from '../base-service/legacy-result-sender.js'; +import {handleRequest} from '../base-service/legacy-request-handler.js'; +import {clearRegularUpdateCache} from '../legacy/regular-update.js'; +import {rasterRedirectUrl} from '../badge-urls/make-badge-url.js'; +import {nonNegativeInteger} from '../../services/validators.js'; +import log from './log.js'; +import PrometheusMetrics from './prometheus-metrics.js'; +import InfluxMetrics from './influx-metrics.js'; const Joi = originalJoi .extend(base => ({ @@ -522,4 +521,4 @@ class Server { } } -module.exports = Server +export default Server; diff --git a/core/server/server.spec.js b/core/server/server.spec.js index 3955561034f46..326ea6a0a0bda 100644 --- a/core/server/server.spec.js +++ b/core/server/server.spec.js @@ -1,14 +1,12 @@ -'use strict' - -const path = require('path') -const { expect } = require('chai') -const isSvg = require('is-svg') -const config = require('config') -const nock = require('nock') -const sinon = require('sinon') -const got = require('../got-test-client') -const Server = require('./server') -const { createTestServer } = require('./in-process-server-test-helpers') +import path from 'path'; +import {expect} from 'chai'; +import isSvg from 'is-svg'; +import config from 'config'; +import nock from 'nock'; +import sinon from 'sinon'; +import got from '../got-test-client.js'; +import Server from './server.js'; +import {createTestServer} from './in-process-server-test-helpers.js'; describe('The server', function () { describe('running', function () { diff --git a/core/service-test-runner/cli.js b/core/service-test-runner/cli.js index d63be95a0d355..979a56fb52c2d 100644 --- a/core/service-test-runner/cli.js +++ b/core/service-test-runner/cli.js @@ -54,15 +54,13 @@ // Relying on npm scripts is safer. Using "pre" makes it impossible to run // the second step without the first. -'use strict' +import minimist from 'minimist'; +import envFlag from 'node-env-flag'; +import readAllStdinSync from 'read-all-stdin-sync'; +import {createTestServer} from '../server/in-process-server-test-helpers.js'; +import Runner from './runner.js'; -const minimist = require('minimist') -const envFlag = require('node-env-flag') -const readAllStdinSync = require('read-all-stdin-sync') -const { createTestServer } = require('../server/in-process-server-test-helpers') -const Runner = require('./runner') - -require('../unhandled-rejection.spec') +import('../unhandled-rejection.spec'); const retry = {} retry.count = parseInt(process.env.RETRY_COUNT) || 0 diff --git a/core/service-test-runner/create-service-tester.js b/core/service-test-runner/create-service-tester.js index 4f90a614c4300..0b59ffcfcad7c 100644 --- a/core/service-test-runner/create-service-tester.js +++ b/core/service-test-runner/create-service-tester.js @@ -1,11 +1,10 @@ -'use strict' /** * @module */ -const caller = require('caller') -const BaseService = require('../base-service/base') -const ServiceTester = require('./service-tester') +import caller from 'caller'; +import BaseService from '../base-service/base.js'; +import ServiceTester from './service-tester.js'; /** * Automatically create a ServiceTester. @@ -30,4 +29,4 @@ function createServiceTester() { return ServiceTester.forServiceClass(ServiceClass) } -module.exports = createServiceTester +export default createServiceTester; diff --git a/core/service-test-runner/icedfrisby-shields.js b/core/service-test-runner/icedfrisby-shields.js index f4a99b7b720b7..b7c3e9698915f 100644 --- a/core/service-test-runner/icedfrisby-shields.js +++ b/core/service-test-runner/icedfrisby-shields.js @@ -1,10 +1,9 @@ -'use strict' /** * @module */ -const Joi = require('joi') -const { expect } = require('chai') +import Joi from 'joi'; +import {expect} from 'chai'; /** * Factory which wraps an "icedfrisby-nock" with some additional functionality: @@ -16,7 +15,7 @@ const { expect } = require('chai') * @returns {Function} wrapped class */ const factory = superclass => - class IcedFrisbyNock extends superclass { + (class IcedFrisbyNock extends superclass { constructor(message) { super(message) this.intercepted = false @@ -83,6 +82,6 @@ const factory = superclass => ) } } - } + }) -module.exports = factory +export default factory; diff --git a/core/service-test-runner/infer-pull-request.js b/core/service-test-runner/infer-pull-request.js index c9c4695fbeeef..ae84f41e95996 100644 --- a/core/service-test-runner/infer-pull-request.js +++ b/core/service-test-runner/infer-pull-request.js @@ -1,9 +1,8 @@ -'use strict' /** * @module */ -const { URL, format: urlFormat } = require('url') +import {URL, format as urlFormat} from 'url'; function formatSlug(owner, repo, pullRequest) { return `${owner}/${repo}#${pullRequest}` @@ -98,8 +97,8 @@ function inferPullRequest(env = process.env) { * @property {string} slug owner/repo/#pullRequest */ -module.exports = { +export default { parseGithubPullRequestUrl, parseGithubRepoSlug, inferPullRequest, -} +}; diff --git a/core/service-test-runner/infer-pull-request.spec.js b/core/service-test-runner/infer-pull-request.spec.js index 610c258eebb6e..05b768ca0330a 100644 --- a/core/service-test-runner/infer-pull-request.spec.js +++ b/core/service-test-runner/infer-pull-request.spec.js @@ -1,10 +1,5 @@ -'use strict' - -const { test, given, forCases } = require('sazerac') -const { - parseGithubPullRequestUrl, - inferPullRequest, -} = require('./infer-pull-request') +import {test, given, forCases} from 'sazerac'; +import {parseGithubPullRequestUrl, inferPullRequest} from './infer-pull-request.js'; describe('Pull request inference', function () { test(parseGithubPullRequestUrl, () => { diff --git a/core/service-test-runner/pull-request-services-cli.js b/core/service-test-runner/pull-request-services-cli.js index 0a23f638edb12..a87e577aaf087 100644 --- a/core/service-test-runner/pull-request-services-cli.js +++ b/core/service-test-runner/pull-request-services-cli.js @@ -13,11 +13,9 @@ // // TRAVIS=1 TRAVIS_REPO_SLUG=badges/shields TRAVIS_PULL_REQUEST=1108 npm run test:services:pr:prepare -'use strict' - -const got = require('got') -const { inferPullRequest } = require('./infer-pull-request') -const servicesForTitle = require('./services-for-title') +import got from 'got'; +import {inferPullRequest} from './infer-pull-request.js'; +import servicesForTitle from './services-for-title.js'; async function getTitle(owner, repo, pullRequest) { const { @@ -53,7 +51,7 @@ async function main() { } } -;(async () => { +(async () => { try { await main() } catch (e) { diff --git a/core/service-test-runner/runner.js b/core/service-test-runner/runner.js index 44e4718267414..f1b2f0a618429 100644 --- a/core/service-test-runner/runner.js +++ b/core/service-test-runner/runner.js @@ -1,9 +1,8 @@ -'use strict' /** * @module */ -const { loadTesters } = require('../base-service/loader') +import {loadTesters} from '../base-service/loader.js'; /** * Load a collection of ServiceTester objects and register them with Mocha. @@ -72,4 +71,4 @@ class Runner { testers.forEach(tester => tester.toss({ baseUrl, skipIntercepted, retry })) } } -module.exports = Runner +export default Runner; diff --git a/core/service-test-runner/service-tester.js b/core/service-test-runner/service-tester.js index 4aa282f8535c4..fd8207546587a 100644 --- a/core/service-test-runner/service-tester.js +++ b/core/service-test-runner/service-tester.js @@ -1,10 +1,9 @@ -'use strict' /** * @module */ -const emojic = require('emojic') -const trace = require('../base-service/trace') +import emojic from 'emojic'; +import trace from '../base-service/trace.js'; const frisby = require('./icedfrisby-shields')( // eslint-disable-next-line import/order require('icedfrisby-nock')(require('icedfrisby')) @@ -140,4 +139,4 @@ class ServiceTester { } } -module.exports = ServiceTester +export default ServiceTester; diff --git a/core/service-test-runner/services-for-title.js b/core/service-test-runner/services-for-title.js index f5c6fcb46c23b..0c55c3fcbf1db 100644 --- a/core/service-test-runner/services-for-title.js +++ b/core/service-test-runner/services-for-title.js @@ -1,9 +1,8 @@ -'use strict' /** * @module */ -const difference = require('lodash.difference') +import difference from 'lodash.difference'; /** * Given a pull request title like @@ -31,4 +30,4 @@ function servicesForTitle(title) { return difference(services, ignored) } -module.exports = servicesForTitle +export default servicesForTitle; diff --git a/core/service-test-runner/services-for-title.spec.js b/core/service-test-runner/services-for-title.spec.js index 40d216d8968a4..876c7bf74e61a 100644 --- a/core/service-test-runner/services-for-title.spec.js +++ b/core/service-test-runner/services-for-title.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const servicesForTitle = require('./services-for-title') +import {test, given} from 'sazerac'; +import servicesForTitle from './services-for-title.js'; describe('Services from PR title', function () { test(servicesForTitle, () => { diff --git a/core/token-pooling/redis-token-persistence.integration.js b/core/token-pooling/redis-token-persistence.integration.js index a852e28515a14..174b6ce497794 100644 --- a/core/token-pooling/redis-token-persistence.integration.js +++ b/core/token-pooling/redis-token-persistence.integration.js @@ -1,9 +1,7 @@ -'use strict' - -const RedisServer = require('redis-server') -const Redis = require('ioredis') -const { expect } = require('chai') -const RedisTokenPersistence = require('./redis-token-persistence') +import RedisServer from 'redis-server'; +import Redis from 'ioredis'; +import {expect} from 'chai'; +import RedisTokenPersistence from './redis-token-persistence.js'; describe('Redis token persistence', function () { let server diff --git a/core/token-pooling/redis-token-persistence.js b/core/token-pooling/redis-token-persistence.js index 05a5ee3fbc724..755b093433c2c 100644 --- a/core/token-pooling/redis-token-persistence.js +++ b/core/token-pooling/redis-token-persistence.js @@ -1,10 +1,8 @@ -'use strict' +import {URL} from 'url'; +import Redis from 'ioredis'; +import log from '../server/log.js'; -const { URL } = require('url') -const Redis = require('ioredis') -const log = require('../server/log') - -module.exports = class RedisTokenPersistence { +export default class RedisTokenPersistence { constructor({ url, key }) { this.url = url this.key = key @@ -56,4 +54,4 @@ module.exports = class RedisTokenPersistence { log.error(e) } } -} +}; diff --git a/core/token-pooling/token-pool.js b/core/token-pooling/token-pool.js index 54e4cfb8a951b..98aacfcfee914 100644 --- a/core/token-pooling/token-pool.js +++ b/core/token-pooling/token-pool.js @@ -1,10 +1,9 @@ -'use strict' /** * @module */ -const crypto = require('crypto') -const PriorityQueue = require('priorityqueuejs') +import crypto from 'crypto'; +import PriorityQueue from 'priorityqueuejs'; /** * Compute a one-way hash of the input string. @@ -354,8 +353,8 @@ class TokenPool { } } -module.exports = { +export default { sanitizeToken, Token, TokenPool, -} +}; diff --git a/core/token-pooling/token-pool.spec.js b/core/token-pooling/token-pool.spec.js index 8780b17e6f74e..6709967ec320b 100644 --- a/core/token-pooling/token-pool.spec.js +++ b/core/token-pooling/token-pool.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const sinon = require('sinon') -const times = require('lodash.times') -const { Token, TokenPool } = require('./token-pool') +import {expect} from 'chai'; +import sinon from 'sinon'; +import times from 'lodash.times'; +import {Token, TokenPool} from './token-pool.js'; function expectPoolToBeExhausted(pool) { expect(() => { diff --git a/dangerfile.js b/dangerfile.js index 94b4185945dd4..6395c45e006df 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -1,5 +1,3 @@ -'use strict' - // Have you identified a contributing guideline that should be included here? // Please open a pull request! // @@ -10,8 +8,8 @@ // To test changes locally: // DANGER_GITHUB_API_TOKEN=your-github-api-token npm run danger -- pr https://github.com/badges/shields/pull/2665 -const { danger, fail, message, warn } = require('danger') -const { default: noTestShortcuts } = require('danger-plugin-no-test-shortcuts') +import {danger, fail, message, warn} from 'danger'; +import {default as noTestShortcuts} from 'danger-plugin-no-test-shortcuts'; const { fileMatch } = danger.git const documentation = fileMatch( diff --git a/entrypoint.spec.js b/entrypoint.spec.js index c52368d162184..0469394701571 100644 --- a/entrypoint.spec.js +++ b/entrypoint.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const isSvg = require('is-svg') -const got = require('./core/got-test-client') +import {expect} from 'chai'; +import isSvg from 'is-svg'; +import got from './core/got-test-client.js'; let server before(function () { diff --git a/gatsby-config.js b/gatsby-config.js index ebf6b46e08138..708f9cde7fea7 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,8 +1,6 @@ -'use strict' +import path from 'path'; -const path = require('path') - -module.exports = { +export default { siteMetadata: { title: 'Shields.io: Quality metadata badges for open source projects', description: @@ -30,4 +28,4 @@ module.exports = { // }, // }, ], -} +}; diff --git a/gatsby-node.js b/gatsby-node.js index 0b6e5fa44d83f..9a2081841b5d8 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,14 +1,12 @@ -'use strict' - /* * Implement Gatsby's Node APIs in this file. * * See: https://www.gatsbyjs.org/docs/node-apis/ */ -const fs = require('fs') -const yaml = require('js-yaml') -const envFlag = require('node-env-flag') +import fs from 'fs'; +import yaml from 'js-yaml'; +import envFlag from 'node-env-flag'; const includeDevPages = envFlag(process.env.INCLUDE_DEV_PAGES, true) @@ -46,4 +44,4 @@ async function createPages({ actions: { createPage } }) { }) } -module.exports = { createPages } +export default { createPages }; diff --git a/lib/load-logos.js b/lib/load-logos.js index 7a9efbfdbfa54..757cba5ec4e3e 100644 --- a/lib/load-logos.js +++ b/lib/load-logos.js @@ -1,8 +1,6 @@ -'use strict' - -const fs = require('fs') -const path = require('path') -const { svg2base64 } = require('./svg-helpers') +import fs from 'fs'; +import path from 'path'; +import {svg2base64} from './svg-helpers.js'; function loadLogos() { // Cache svg logos from disk in base64 string @@ -30,4 +28,4 @@ function loadLogos() { return logos } -module.exports = loadLogos +export default loadLogos; diff --git a/lib/load-simple-icons.js b/lib/load-simple-icons.js index 86f9b8e3563a7..20a31c65c1bad 100644 --- a/lib/load-simple-icons.js +++ b/lib/load-simple-icons.js @@ -1,7 +1,5 @@ -'use strict' - -const originalSimpleIcons = require('simple-icons') -const { svg2base64 } = require('./svg-helpers') +import originalSimpleIcons from 'simple-icons'; +import {svg2base64} from './svg-helpers.js'; function loadSimpleIcons() { const simpleIcons = {} @@ -40,4 +38,4 @@ function loadSimpleIcons() { return simpleIcons } -module.exports = loadSimpleIcons +export default loadSimpleIcons; diff --git a/lib/load-simple-icons.spec.js b/lib/load-simple-icons.spec.js index d32f95bb93c2c..8f98d5602e56b 100644 --- a/lib/load-simple-icons.spec.js +++ b/lib/load-simple-icons.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { expect } = require('chai') -const loadSimpleIcons = require('./load-simple-icons') +import {expect} from 'chai'; +import loadSimpleIcons from './load-simple-icons.js'; describe('loadSimpleIcons', function () { let simpleIcons diff --git a/lib/logos.js b/lib/logos.js index 26000732e50ef..e072ecf544dc6 100644 --- a/lib/logos.js +++ b/lib/logos.js @@ -1,13 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { - toSvgColor, - brightness, - normalizeColor, -} = require('../badge-maker/lib/color') -const coalesce = require('../core/base-service/coalesce') -const { svg2base64 } = require('./svg-helpers') +import Joi from 'joi'; +import {toSvgColor, brightness, normalizeColor} from '../badge-maker/lib/color.js'; +import coalesce from '../core/base-service/coalesce.js'; +import {svg2base64} from './svg-helpers.js'; const logos = require('./load-logos')() const simpleIcons = require('./load-simple-icons')() @@ -67,7 +61,7 @@ function getShieldsIcon({ name, color }) { const { svg, base64, isMonochrome } = logos[name] const svgColor = toSvgColor(color) if (svgColor && isMonochrome) { - return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`)) + return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`)); } else { return base64 } @@ -131,7 +125,7 @@ function makeLogo(defaultNamedLogo, overrides) { } } -module.exports = { +export default { prependPrefix, isDataUrl, decodeDataUrlFromQueryParam, @@ -139,4 +133,4 @@ module.exports = { getShieldsIcon, getSimpleIcon, makeLogo, -} +}; diff --git a/lib/logos.spec.js b/lib/logos.spec.js index 38964fa37b991..12283fbe4b6f2 100644 --- a/lib/logos.spec.js +++ b/lib/logos.spec.js @@ -1,14 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { test, given, forCases } = require('sazerac') -const { - prependPrefix, - isDataUrl, - prepareNamedLogo, - getSimpleIcon, - makeLogo, -} = require('./logos') +import {expect} from 'chai'; +import {test, given, forCases} from 'sazerac'; +import {prependPrefix, isDataUrl, prepareNamedLogo, getSimpleIcon, makeLogo} from './logos.js'; describe('Logo helpers', function () { test(prependPrefix, () => { diff --git a/lib/svg-helpers.js b/lib/svg-helpers.js index 7011c156aed72..1e7f8df373cc5 100644 --- a/lib/svg-helpers.js +++ b/lib/svg-helpers.js @@ -1,7 +1,5 @@ -'use strict' - function svg2base64(svg) { return `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}` } -module.exports = { svg2base64 } +export default { svg2base64 }; diff --git a/lib/svg-helpers.spec.js b/lib/svg-helpers.spec.js index c36fe39ffe7b4..e32c1f6436b8d 100644 --- a/lib/svg-helpers.spec.js +++ b/lib/svg-helpers.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { svg2base64 } = require('./svg-helpers') +import {test, given} from 'sazerac'; +import {svg2base64} from './svg-helpers.js'; describe('SVG helpers', function () { test(svg2base64, () => { diff --git a/scripts/badge-cli.js b/scripts/badge-cli.js index 9e29ad246cf73..4a5383e2663ad 100644 --- a/scripts/badge-cli.js +++ b/scripts/badge-cli.js @@ -1,11 +1,9 @@ -'use strict' - -const { URL } = require('url') +import {URL} from 'url'; const config = require('config').util.toObject() -const got = require('got') -const emojic = require('emojic') -const Server = require('../core/server/server') -const trace = require('../core/base-service/trace') +import got from 'got'; +import emojic from 'emojic'; +import Server from '../core/server/server.js'; +import trace from '../core/base-service/trace.js'; function normalizeBadgeUrl(url) { // Provide a base URL in order to accept fragments. @@ -37,7 +35,7 @@ async function main() { await traceBadge(normalized) } -;(async () => { +(async () => { try { await main() } catch (e) { diff --git a/scripts/benchmark-performance.js b/scripts/benchmark-performance.js index 7686138f7ceac..4e446ad3dfd88 100644 --- a/scripts/benchmark-performance.js +++ b/scripts/benchmark-performance.js @@ -1,9 +1,7 @@ -'use strict' - const config = require('config').util.toObject() -const got = require('got') -const minimist = require('minimist') -const Server = require('../core/server/server') +import got from 'got'; +import minimist from 'minimist'; +import Server from '../core/server/server.js'; async function main() { const server = new Server(config) @@ -16,7 +14,7 @@ async function main() { await server.stop() } -;(async () => { +(async () => { try { await main() } catch (e) { diff --git a/scripts/capture-timings.js b/scripts/capture-timings.js index fee8bf24a27a0..4cc46c2b988ce 100644 --- a/scripts/capture-timings.js +++ b/scripts/capture-timings.js @@ -1,7 +1,5 @@ -'use strict' - -const readline = require('readline') -const minimist = require('minimist') +import readline from 'readline'; +import minimist from 'minimist'; async function captureTimings(warmupIterations) { const rl = readline.createInterface({ @@ -51,7 +49,7 @@ async function main() { logResults({ times, iterations, warmupIterations }) } -;(async () => { +(async () => { try { await main() } catch (e) { diff --git a/scripts/export-service-definitions-cli.js b/scripts/export-service-definitions-cli.js index fc411431398e7..39ddc6b768b16 100644 --- a/scripts/export-service-definitions-cli.js +++ b/scripts/export-service-definitions-cli.js @@ -1,7 +1,5 @@ -'use strict' - -const yaml = require('js-yaml') -const { collectDefinitions } = require('../core/base-service/loader') +import yaml from 'js-yaml'; +import {collectDefinitions} from '../core/base-service/loader.js'; const definitions = collectDefinitions() diff --git a/scripts/redis-connectivity-test.js b/scripts/redis-connectivity-test.js index de161e029a891..31266cd6afc8f 100644 --- a/scripts/redis-connectivity-test.js +++ b/scripts/redis-connectivity-test.js @@ -1,8 +1,6 @@ -'use strict' - const config = require('config').util.toObject() console.log(config) -const GithubConstellation = require('../services/github/github-constellation') +import GithubConstellation from '../services/github/github-constellation.js'; const { persistence } = new GithubConstellation({ service: config.public.services.github, @@ -15,7 +13,7 @@ async function main() { await persistence.stop() } -;(async () => { +(async () => { try { await main() } catch (e) { diff --git a/server.js b/server.js index 7eb2bbc6f8f13..4489cfb2b17ab 100644 --- a/server.js +++ b/server.js @@ -1,12 +1,11 @@ -'use strict' /* eslint-disable import/order */ -const fs = require('fs') -const path = require('path') +import fs from 'fs'; +import path from 'path'; // Set up Sentry reporting as early in the process as possible. const config = require('config').util.toObject() -const Sentry = require('@sentry/node') +import Sentry from '@sentry/node'; const disabledIntegrations = ['Console', 'Http'] Sentry.init({ dsn: process.env.SENTRY_DSN || config.private.sentry_dsn, @@ -50,8 +49,10 @@ if (fs.existsSync(legacySecretsPath)) { process.exit(1) } -const Server = require('./core/server/server') -const server = (module.exports = new Server(config)) +import Server from './core/server/server.js'; +const server = (function() { + export default __a; +}()) ;(async () => { try { diff --git a/services/amo/amo-base.js b/services/amo/amo-base.js index 090221348fd67..cc005c370d4a7 100644 --- a/services/amo/amo-base.js +++ b/services/amo/amo-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const keywords = ['amo', 'firefox'] @@ -28,4 +26,4 @@ class BaseAmoService extends BaseJsonService { } } -module.exports = { BaseAmoService, keywords } +export default { BaseAmoService, keywords }; diff --git a/services/amo/amo-downloads.service.js b/services/amo/amo-downloads.service.js index ad3012d4fd61f..77b3c6801fa1a 100644 --- a/services/amo/amo-downloads.service.js +++ b/services/amo/amo-downloads.service.js @@ -1,9 +1,7 @@ -'use strict' - -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { redirector } = require('..') -const { BaseAmoService, keywords } = require('./amo-base') +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {redirector} from '..'; +import {BaseAmoService, keywords} from './amo-base.js'; const documentation = `

@@ -54,7 +52,7 @@ const AmoLegacyRedirect = redirector({ dateAdded: new Date('2019-02-23'), }) -module.exports = { +export default { AmoWeeklyDownloads, AmoLegacyRedirect, -} +}; diff --git a/services/amo/amo-downloads.tester.js b/services/amo/amo-downloads.tester.js index 9ad91c29056be..377c34b6000de 100644 --- a/services/amo/amo-downloads.tester.js +++ b/services/amo/amo-downloads.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isMetricOverTimePeriod } = require('../test-validators') -const t = (module.exports = new ServiceTester({ - id: 'AmoDownloads', - title: 'AmoDownloads', - pathPrefix: '/amo', -})) +import {ServiceTester} from '../tester.js'; +import {isMetricOverTimePeriod} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Weekly Downloads') .get('/dw/duckduckgo-for-firefox.json') diff --git a/services/amo/amo-rating.service.js b/services/amo/amo-rating.service.js index 9943176473f7e..03612d2f5e9d9 100644 --- a/services/amo/amo-rating.service.js +++ b/services/amo/amo-rating.service.js @@ -1,10 +1,8 @@ -'use strict' +import {starRating} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BaseAmoService, keywords} from './amo-base.js'; -const { starRating } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BaseAmoService, keywords } = require('./amo-base') - -module.exports = class AmoRating extends BaseAmoService { +export default class AmoRating extends BaseAmoService { static category = 'rating' static route = { base: 'amo', pattern: ':format(stars|rating)/:addonId' } @@ -38,4 +36,4 @@ module.exports = class AmoRating extends BaseAmoService { const data = await this.fetch({ addonId }) return this.constructor.render({ format, rating: data.ratings.average }) } -} +}; diff --git a/services/amo/amo-rating.tester.js b/services/amo/amo-rating.tester.js index f17a90656f67e..04e39629be28e 100644 --- a/services/amo/amo-rating.tester.js +++ b/services/amo/amo-rating.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isStarRating } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isStarRating} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Rating') .get('/rating/IndieGala-Helper.json') diff --git a/services/amo/amo-users.service.js b/services/amo/amo-users.service.js index 91a774279b16b..a1364812c8c90 100644 --- a/services/amo/amo-users.service.js +++ b/services/amo/amo-users.service.js @@ -1,9 +1,7 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {BaseAmoService, keywords} from './amo-base.js'; -const { metric } = require('../text-formatters') -const { BaseAmoService, keywords } = require('./amo-base') - -module.exports = class AmoUsers extends BaseAmoService { +export default class AmoUsers extends BaseAmoService { static category = 'downloads' static route = { base: 'amo/users', pattern: ':addonId' } @@ -29,4 +27,4 @@ module.exports = class AmoUsers extends BaseAmoService { const data = await this.fetch({ addonId }) return this.constructor.render({ users: data.average_daily_users }) } -} +}; diff --git a/services/amo/amo-users.tester.js b/services/amo/amo-users.tester.js index a0f168ad0fa37..9807e5b107aa2 100644 --- a/services/amo/amo-users.tester.js +++ b/services/amo/amo-users.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Users') .get('/IndieGala-Helper.json') diff --git a/services/amo/amo-version.service.js b/services/amo/amo-version.service.js index 33bf27b85c5c8..7c8f6fdfca6dc 100644 --- a/services/amo/amo-version.service.js +++ b/services/amo/amo-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {BaseAmoService, keywords} from './amo-base.js'; -const { renderVersionBadge } = require('../version') -const { BaseAmoService, keywords } = require('./amo-base') - -module.exports = class AmoVersion extends BaseAmoService { +export default class AmoVersion extends BaseAmoService { static category = 'version' static route = { base: 'amo/v', pattern: ':addonId' } @@ -20,4 +18,4 @@ module.exports = class AmoVersion extends BaseAmoService { const data = await this.fetch({ addonId }) return renderVersionBadge({ version: data.current_version.version }) } -} +}; diff --git a/services/amo/amo-version.tester.js b/services/amo/amo-version.tester.js index 9f63c1b0b0e64..4ed9375411036 100644 --- a/services/amo/amo-version.tester.js +++ b/services/amo/amo-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Version').get('/IndieGala-Helper.json').expectBadge({ label: 'mozilla add-on', diff --git a/services/ansible/ansible-quality.service.js b/services/ansible/ansible-quality.service.js index 43da34f60d477..2082dbabbe757 100644 --- a/services/ansible/ansible-quality.service.js +++ b/services/ansible/ansible-quality.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { floorCount } = require('../color-formatters') -const { BaseJsonService, InvalidResponse } = require('..') +import Joi from 'joi'; +import {floorCount} from '../color-formatters.js'; +import {BaseJsonService, InvalidResponse} from '..'; const ansibleContentSchema = Joi.object({ quality_score: Joi.number().allow(null).required(), @@ -18,7 +16,7 @@ class AnsibleGalaxyContent extends BaseJsonService { } } -module.exports = class AnsibleGalaxyContentQualityScore extends ( +export default class AnsibleGalaxyContentQualityScore extends ( AnsibleGalaxyContent ) { static category = 'analysis' @@ -54,4 +52,4 @@ module.exports = class AnsibleGalaxyContentQualityScore extends ( return this.constructor.render({ qualityScore }) } -} +}; diff --git a/services/ansible/ansible-quality.tester.js b/services/ansible/ansible-quality.tester.js index f9dd14a4d611b..e29aef04eea07 100644 --- a/services/ansible/ansible-quality.tester.js +++ b/services/ansible/ansible-quality.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('quality score (valid)') .get('/432.json') diff --git a/services/ansible/ansible-role.service.js b/services/ansible/ansible-role.service.js index c447859782cb6..3ce9285107162 100644 --- a/services/ansible/ansible-role.service.js +++ b/services/ansible/ansible-role.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { downloadCount } = require('../color-formatters') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {downloadCount} from '../color-formatters.js'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const ansibleRoleSchema = Joi.object({ download_count: nonNegativeInteger, @@ -80,7 +78,7 @@ class AnsibleGalaxyRoleName extends AnsibleGalaxyRole { } } -module.exports = { +export default { AnsibleGalaxyRoleDownloads, AnsibleGalaxyRoleName, -} +}; diff --git a/services/ansible/ansible-role.tester.js b/services/ansible/ansible-role.tester.js index ac1a3980d4585..b99133e6f150d 100644 --- a/services/ansible/ansible-role.tester.js +++ b/services/ansible/ansible-role.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isMetric} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isMetric } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'AnsibleRole', - title: 'AnsibleRole', - pathPrefix: '/ansible/role', -})) +const t = (function() { + export default __a; +}()) t.create('role name (valid)') .get('/14542.json') diff --git a/services/apm/apm.service.js b/services/apm/apm.service.js index 9b52cfe7ed2d7..728ab308ea47c 100644 --- a/services/apm/apm.service.js +++ b/services/apm/apm.service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { renderLicenseBadge } = require('../licenses') -const { renderVersionBadge } = require('../version') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, InvalidResponse } = require('..') +import Joi from 'joi'; +import {renderLicenseBadge} from '../licenses.js'; +import {renderVersionBadge} from '../version.js'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, InvalidResponse} from '..'; const keywords = ['atom'] @@ -116,8 +114,8 @@ class APMLicense extends BaseAPMService { } } -module.exports = { +export default { APMDownloads, APMVersion, APMLicense, -} +}; diff --git a/services/apm/apm.tester.js b/services/apm/apm.tester.js index c7553a491e750..222d2960f26fc 100644 --- a/services/apm/apm.tester.js +++ b/services/apm/apm.tester.js @@ -1,13 +1,10 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {invalidJSON} from '../response-fixtures.js'; +import {isMetric, isVPlusTripleDottedVersion} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { invalidJSON } = require('../response-fixtures') -const { isMetric, isVPlusTripleDottedVersion } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'apm', - title: 'Atom Package Manager', -})) +const t = (function() { + export default __a; +}()) t.create('Downloads') .get('/dm/vim-mode.json') diff --git a/services/appveyor/appveyor-base.js b/services/appveyor/appveyor-base.js index 015612c43c3c0..596d839dd4048 100644 --- a/services/appveyor/appveyor-base.js +++ b/services/appveyor/appveyor-base.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { isBuildStatus } = require('../build-status') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {isBuildStatus} from '../build-status.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ build: Joi.object({ @@ -20,7 +18,7 @@ const schema = Joi.object({ }), }).required() -module.exports = class AppVeyorBase extends BaseJsonService { +export default class AppVeyorBase extends BaseJsonService { static category = 'build' async fetch({ user, repo, branch }) { @@ -41,4 +39,4 @@ module.exports = class AppVeyorBase extends BaseJsonService { pattern: ':user/:repo/:branch*', } } -} +}; diff --git a/services/appveyor/appveyor-build-redirect.service.js b/services/appveyor/appveyor-build-redirect.service.js index df723459997c0..3ccb1bd071222 100644 --- a/services/appveyor/appveyor-build-redirect.service.js +++ b/services/appveyor/appveyor-build-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'build', route: { @@ -13,4 +11,4 @@ module.exports = [ `/appveyor/build/${user}/${repo}${branch ? `/${branch}` : ''}`, dateAdded: new Date('2019-12-10'), }), -] +]; diff --git a/services/appveyor/appveyor-build-redirect.tester.js b/services/appveyor/appveyor-build-redirect.tester.js index 625a1f1a169e8..1040f6c9d907a 100644 --- a/services/appveyor/appveyor-build-redirect.tester.js +++ b/services/appveyor/appveyor-build-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'AppveyorBuildRedirect', - title: 'AppveyorBuildRedirect', - pathPrefix: '/appveyor/ci', -})) +const t = (function() { + export default __a; +}()) t.create('Appveyor CI') .get('/gruntjs/grunt', { diff --git a/services/appveyor/appveyor-build.service.js b/services/appveyor/appveyor-build.service.js index 352a9e7ec836e..3a1c9603f3fdd 100644 --- a/services/appveyor/appveyor-build.service.js +++ b/services/appveyor/appveyor-build.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderBuildStatusBadge} from '../build-status.js'; +import AppVeyorBase from './appveyor-base.js'; -const { renderBuildStatusBadge } = require('../build-status') -const AppVeyorBase = require('./appveyor-base') - -module.exports = class AppVeyorBuild extends AppVeyorBase { +export default class AppVeyorBuild extends AppVeyorBase { static route = this.buildRoute('appveyor/build') static examples = [ @@ -33,4 +31,4 @@ module.exports = class AppVeyorBuild extends AppVeyorBase { } return this.constructor.render({ status: data.build.status }) } -} +}; diff --git a/services/appveyor/appveyor-build.tester.js b/services/appveyor/appveyor-build.tester.js index 9858a91f17385..93c360f21f200 100644 --- a/services/appveyor/appveyor-build.tester.js +++ b/services/appveyor/appveyor-build.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('CI status') .timeout(10000) diff --git a/services/appveyor/appveyor-job-build.service.js b/services/appveyor/appveyor-job-build.service.js index dc389cbde67f4..5f2f31ace5efa 100644 --- a/services/appveyor/appveyor-job-build.service.js +++ b/services/appveyor/appveyor-job-build.service.js @@ -1,10 +1,8 @@ -'use strict' +import {renderBuildStatusBadge} from '../build-status.js'; +import {NotFound} from '..'; +import AppVeyorBase from './appveyor-base.js'; -const { renderBuildStatusBadge } = require('../build-status') -const { NotFound } = require('..') -const AppVeyorBase = require('./appveyor-base') - -module.exports = class AppVeyorJobBuild extends AppVeyorBase { +export default class AppVeyorJobBuild extends AppVeyorBase { static route = { base: 'appveyor/job/build', pattern: ':user/:repo/:job/:branch*', @@ -61,4 +59,4 @@ module.exports = class AppVeyorJobBuild extends AppVeyorBase { const { status } = this.transform({ data, jobName: job }) return renderBuildStatusBadge({ status }) } -} +}; diff --git a/services/appveyor/appveyor-job-build.spec.js b/services/appveyor/appveyor-job-build.spec.js index 5d539a72cd340..d3ae15afff8ba 100644 --- a/services/appveyor/appveyor-job-build.spec.js +++ b/services/appveyor/appveyor-job-build.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { NotFound } = require('..') -const AppveyorJobBuild = require('./appveyor-job-build.service') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {NotFound} from '..'; +import AppveyorJobBuild from './appveyor-job-build.service.js'; describe('AppveyorJobBuild', function () { test(AppveyorJobBuild.prototype.transform, () => { diff --git a/services/appveyor/appveyor-job-build.tester.js b/services/appveyor/appveyor-job-build.tester.js index 81cccb39f252a..0cd4a2d3878e3 100644 --- a/services/appveyor/appveyor-job-build.tester.js +++ b/services/appveyor/appveyor-job-build.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('Job CI status') .timeout(10000) diff --git a/services/appveyor/appveyor-tests.service.js b/services/appveyor/appveyor-tests.service.js index c3efa4e636d2e..c0fdbf288bca7 100644 --- a/services/appveyor/appveyor-tests.service.js +++ b/services/appveyor/appveyor-tests.service.js @@ -1,10 +1,5 @@ -'use strict' - -const { - testResultQueryParamSchema, - renderTestResultBadge, -} = require('../test-results') -const AppVeyorBase = require('./appveyor-base') +import {testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; +import AppVeyorBase from './appveyor-base.js'; const documentation = `

@@ -36,7 +31,7 @@ const commonPreviewProps = { isCompact: false, } -module.exports = class AppVeyorTests extends AppVeyorBase { +export default class AppVeyorTests extends AppVeyorBase { static route = { ...this.buildRoute('appveyor/tests'), queryParamSchema: testResultQueryParamSchema, @@ -163,4 +158,4 @@ module.exports = class AppVeyorTests extends AppVeyorBase { isCompact, }) } -} +}; diff --git a/services/appveyor/appveyor-tests.tester.js b/services/appveyor/appveyor-tests.tester.js index df81a2de2e521..7b9ce73b6da35 100644 --- a/services/appveyor/appveyor-tests.tester.js +++ b/services/appveyor/appveyor-tests.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const queryString = require('querystring') -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import queryString from 'querystring'; +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isAppveyorTestTotals = Joi.string().regex( /^[0-9]+ passed(, [0-9]+ failed)?(, [0-9]+ skipped)?$/ diff --git a/services/archlinux/archlinux.service.js b/services/archlinux/archlinux.service.js index f06a5003a8fde..fee862c60186a 100644 --- a/services/archlinux/archlinux.service.js +++ b/services/archlinux/archlinux.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ pkgver: Joi.string().required(), }).required() -module.exports = class ArchLinux extends BaseJsonService { +export default class ArchLinux extends BaseJsonService { static category = 'version' static route = { base: 'archlinux/v', @@ -40,4 +38,4 @@ module.exports = class ArchLinux extends BaseJsonService { }) return renderVersionBadge({ version: data.pkgver }) } -} +}; diff --git a/services/archlinux/archlinux.tester.js b/services/archlinux/archlinux.tester.js index 379e8133c6f8d..4e735cbf4a721 100644 --- a/services/archlinux/archlinux.tester.js +++ b/services/archlinux/archlinux.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { - isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Arch Linux package (valid)') .get('/core/x86_64/pacman.json') diff --git a/services/aur/aur.service.js b/services/aur/aur.service.js index dbab2748a04cb..a6e5eaef0f508 100644 --- a/services/aur/aur.service.js +++ b/services/aur/aur.service.js @@ -1,13 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { floorCount: floorCountColor } = require('../color-formatters') -const { addv, metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, NotFound } = require('..') -const { formatDate } = require('../text-formatters') -const { age: ageColor } = require('../color-formatters') -const { InvalidResponse } = require('..') +import Joi from 'joi'; +import {floorCount as floorCountColor, age as ageColor} from '../color-formatters.js'; +import {addv, metric, formatDate} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, NotFound, InvalidResponse} from '..'; const aurSchema = Joi.object({ resultcount: nonNegativeInteger, @@ -198,10 +193,10 @@ class AurLastModified extends BaseAurService { } } -module.exports = { +export default { AurLicense, AurVersion, AurVotes, AurMaintainer, AurLastModified, -} +}; diff --git a/services/aur/aur.spec.js b/services/aur/aur.spec.js index 93fd0a8a70bf8..1a79b69ec02fb 100644 --- a/services/aur/aur.spec.js +++ b/services/aur/aur.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { AurVersion } = require('./aur.service') +import {test, given} from 'sazerac'; +import {AurVersion} from './aur.service.js'; describe('AurVersion', function () { test(AurVersion.render, () => { diff --git a/services/aur/aur.tester.js b/services/aur/aur.tester.js index 51b176a4cca06..a350fef687377 100644 --- a/services/aur/aur.tester.js +++ b/services/aur/aur.tester.js @@ -1,16 +1,9 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { - isVPlusDottedVersionNClausesWithOptionalSuffix, - isMetric, -} = require('../test-validators') -const { isFormattedDate } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'aur', - title: 'Arch Linux AUR', -})) +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionNClausesWithOptionalSuffix, isMetric, isFormattedDate} from '../test-validators.js'; + +const t = (function() { + export default __a; +}()) // version tests diff --git a/services/azure-devops/azure-devops-base.js b/services/azure-devops/azure-devops-base.js index 37d0702bd9bd9..a370dce79aba2 100644 --- a/services/azure-devops/azure-devops-base.js +++ b/services/azure-devops/azure-devops-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {BaseJsonService, NotFound} from '..'; const latestBuildSchema = Joi.object({ count: Joi.number().required(), @@ -14,7 +12,7 @@ const latestBuildSchema = Joi.object({ .required(), }).required() -module.exports = class AzureDevOpsBase extends BaseJsonService { +export default class AzureDevOpsBase extends BaseJsonService { static auth = { passKey: 'azure_devops_token', authorizedOrigins: ['https://dev.azure.com'], @@ -67,4 +65,4 @@ module.exports = class AzureDevOpsBase extends BaseJsonService { return json.value[0].id } -} +}; diff --git a/services/azure-devops/azure-devops-build.service.js b/services/azure-devops/azure-devops-build.service.js index 5159c86408231..31bfe723c22d5 100644 --- a/services/azure-devops/azure-devops-build.service.js +++ b/services/azure-devops/azure-devops-build.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService, NotFound } = require('..') -const { keywords, fetch } = require('./azure-devops-helpers') +import Joi from 'joi'; +import {renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService, NotFound} from '..'; +import {keywords, fetch} from './azure-devops-helpers.js'; const queryParamSchema = Joi.object({ stage: Joi.string(), @@ -33,7 +31,7 @@ const documentation = ` alt="PROJECT_ID is in the id property of the API response." /> ` -module.exports = class AzureDevOpsBuild extends BaseSvgScrapingService { +export default class AzureDevOpsBuild extends BaseSvgScrapingService { static category = 'build' static route = { @@ -123,4 +121,4 @@ module.exports = class AzureDevOpsBuild extends BaseSvgScrapingService { } return renderBuildStatusBadge({ status }) } -} +}; diff --git a/services/azure-devops/azure-devops-build.tester.js b/services/azure-devops/azure-devops-build.tester.js index 871d2a89b4d5d..6ed60e2cac2b8 100644 --- a/services/azure-devops/azure-devops-build.tester.js +++ b/services/azure-devops/azure-devops-build.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project // solely created for Shields.io testing. diff --git a/services/azure-devops/azure-devops-coverage.service.js b/services/azure-devops/azure-devops-coverage.service.js index f2c28adeae9e6..92f89e8733861 100644 --- a/services/azure-devops/azure-devops-coverage.service.js +++ b/services/azure-devops/azure-devops-coverage.service.js @@ -1,11 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { - coveragePercentage: coveragePercentageColor, -} = require('../color-formatters') -const AzureDevOpsBase = require('./azure-devops-base') -const { keywords } = require('./azure-devops-helpers') +import Joi from 'joi'; +import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; +import AzureDevOpsBase from './azure-devops-base.js'; +import {keywords} from './azure-devops-helpers.js'; const documentation = `

@@ -46,7 +42,7 @@ const buildCodeCoverageSchema = Joi.object({ .required(), }).required() -module.exports = class AzureDevOpsCoverage extends AzureDevOpsBase { +export default class AzureDevOpsCoverage extends AzureDevOpsBase { static category = 'coverage' static route = { @@ -130,4 +126,4 @@ module.exports = class AzureDevOpsCoverage extends AzureDevOpsBase { const coverage = covered ? (covered / total) * 100 : 0 return this.constructor.render({ coverage }) } -} +}; diff --git a/services/azure-devops/azure-devops-coverage.tester.js b/services/azure-devops/azure-devops-coverage.tester.js index 3de650324fc17..ddd7e5ac8ad18 100644 --- a/services/azure-devops/azure-devops-coverage.tester.js +++ b/services/azure-devops/azure-devops-coverage.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const org = 'swellaby' const project = 'opensource' diff --git a/services/azure-devops/azure-devops-helpers.js b/services/azure-devops/azure-devops-helpers.js index 9b841bb0772ee..d14098b09b434 100644 --- a/services/azure-devops/azure-devops-helpers.js +++ b/services/azure-devops/azure-devops-helpers.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; const keywords = ['vso', 'vsts', 'azure-devops'] @@ -28,4 +26,4 @@ async function fetch(serviceInstance, { url, qs = {}, errorMessages }) { return { status } } -module.exports = { keywords, fetch } +export default { keywords, fetch }; diff --git a/services/azure-devops/azure-devops-release.service.js b/services/azure-devops/azure-devops-release.service.js index eccbfc90c5d15..13197ecfccc1b 100644 --- a/services/azure-devops/azure-devops-release.service.js +++ b/services/azure-devops/azure-devops-release.service.js @@ -1,8 +1,6 @@ -'use strict' - -const { renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService } = require('..') -const { keywords, fetch } = require('./azure-devops-helpers') +import {renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService} from '..'; +import {keywords, fetch} from './azure-devops-helpers.js'; const documentation = `

@@ -22,7 +20,7 @@ const documentation = `

` -module.exports = class AzureDevOpsRelease extends BaseSvgScrapingService { +export default class AzureDevOpsRelease extends BaseSvgScrapingService { static category = 'build' static route = { @@ -59,4 +57,4 @@ module.exports = class AzureDevOpsRelease extends BaseSvgScrapingService { }) return renderBuildStatusBadge(props) } -} +}; diff --git a/services/azure-devops/azure-devops-release.tester.js b/services/azure-devops/azure-devops-release.tester.js index c161bd618b834..1a85a4e11d720 100644 --- a/services/azure-devops/azure-devops-release.tester.js +++ b/services/azure-devops/azure-devops-release.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project // solely created for Shields.io testing. diff --git a/services/azure-devops/azure-devops-tests.service.js b/services/azure-devops/azure-devops-tests.service.js index 5b373a3fe7e1c..c6ce4474ffc40 100644 --- a/services/azure-devops/azure-devops-tests.service.js +++ b/services/azure-devops/azure-devops-tests.service.js @@ -1,11 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { - testResultQueryParamSchema, - renderTestResultBadge, -} = require('../test-results') -const AzureDevOpsBase = require('./azure-devops-base') +import Joi from 'joi'; +import {testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; +import AzureDevOpsBase from './azure-devops-base.js'; const commonAttrs = { keywords: ['vso', 'vsts', 'azure-devops'], @@ -61,7 +56,7 @@ const buildTestResultSummarySchema = Joi.object({ }).required(), }).required() -module.exports = class AzureDevOpsTests extends AzureDevOpsBase { +export default class AzureDevOpsTests extends AzureDevOpsBase { static category = 'build' static route = { @@ -233,4 +228,4 @@ module.exports = class AzureDevOpsTests extends AzureDevOpsBase { isCompact, }) } -} +}; diff --git a/services/azure-devops/azure-devops-tests.tester.js b/services/azure-devops/azure-devops-tests.tester.js index eb3425b89c3b4..daf75ac30801d 100644 --- a/services/azure-devops/azure-devops-tests.tester.js +++ b/services/azure-devops/azure-devops-tests.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const org = 'azuredevops-powershell' const project = 'azuredevops-powershell' diff --git a/services/azure-devops/vso-redirect.service.js b/services/azure-devops/vso-redirect.service.js index a8b5d8435f7f9..c7c4dd2d46aee 100644 --- a/services/azure-devops/vso-redirect.service.js +++ b/services/azure-devops/vso-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'build', route: { @@ -28,4 +26,4 @@ module.exports = [ `/azure-devops/release/${organization}/${projectId}/${definitionId}/${environmentId}`, dateAdded: new Date('2019-02-08'), }), -] +]; diff --git a/services/azure-devops/vso-redirect.tester.js b/services/azure-devops/vso-redirect.tester.js index 7cd544b7d9421..ab27978851bcb 100644 --- a/services/azure-devops/vso-redirect.tester.js +++ b/services/azure-devops/vso-redirect.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'vso', - title: 'VSO', -})) +const t = (function() { + export default __a; +}()) t.create('Build: default branch') .get('/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.svg') diff --git a/services/beerpay/beerpay.service.js b/services/beerpay/beerpay.service.js index 9d2167647cafd..e6a4eaa8970fe 100644 --- a/services/beerpay/beerpay.service.js +++ b/services/beerpay/beerpay.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ total_amount: Joi.number().min(0).required(), }).required() -module.exports = class Beerpay extends BaseJsonService { +export default class Beerpay extends BaseJsonService { static category = 'funding' static route = { base: 'beerpay', pattern: ':user/:project' } @@ -40,4 +38,4 @@ module.exports = class Beerpay extends BaseJsonService { }) return this.constructor.render({ totalAmount }) } -} +}; diff --git a/services/beerpay/beerpay.tester.js b/services/beerpay/beerpay.tester.js index e52ec83c5a7bc..5bb4a7296af73 100644 --- a/services/beerpay/beerpay.tester.js +++ b/services/beerpay/beerpay.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const amountOfMoney = withRegex(/^\$[0-9]+(\.[0-9]+)?/) diff --git a/services/bintray/bintray.service.js b/services/bintray/bintray.service.js index fd19d8e82b39b..953314b473b96 100644 --- a/services/bintray/bintray.service.js +++ b/services/bintray/bintray.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = [ +export default [ deprecatedService({ category: 'downloads', route: { @@ -21,4 +19,4 @@ module.exports = [ label: 'bintray', dateAdded: new Date('2021-04-24'), }), -] +]; diff --git a/services/bintray/bintray.tester.js b/services/bintray/bintray.tester.js index a16e2413c8ae4..a63af17ce4f77 100644 --- a/services/bintray/bintray.tester.js +++ b/services/bintray/bintray.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'bintray', - title: 'Bintray', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously downloads)') .get('/dt/asciidoctor/maven/asciidoctorj.json') diff --git a/services/bit/bit-components.service.js b/services/bit/bit-components.service.js index 3b852d46e6263..a31fcd79031e9 100644 --- a/services/bit/bit-components.service.js +++ b/services/bit/bit-components.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { downloadCount } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {downloadCount} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const collectionSchema = Joi.object({ payload: Joi.object({ @@ -12,7 +10,7 @@ const collectionSchema = Joi.object({ }).required(), }).required() -module.exports = class BitComponents extends BaseJsonService { +export default class BitComponents extends BaseJsonService { static category = 'other' static route = { base: 'bit/collection/total-components', @@ -49,4 +47,4 @@ module.exports = class BitComponents extends BaseJsonService { const json = await this.fetch({ owner, collection }) return this.constructor.render({ count: json.payload.totalComponents }) } -} +}; diff --git a/services/bit/bit-components.tester.js b/services/bit/bit-components.tester.js index 9a51426dd12cb..a7cca0a96b639 100644 --- a/services/bit/bit-components.tester.js +++ b/services/bit/bit-components.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; t.create('collection (valid)').get('/ramda/ramda.json').expectBadge({ label: 'components', diff --git a/services/bitbucket/bitbucket-issues.service.js b/services/bitbucket/bitbucket-issues.service.js index f2399d66cfbb4..4b8b53d18b7fa 100644 --- a/services/bitbucket/bitbucket-issues.service.js +++ b/services/bitbucket/bitbucket-issues.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const bitbucketIssuesSchema = Joi.object({ size: nonNegativeInteger, @@ -59,4 +57,4 @@ function issueClassGenerator(raw) { } } -module.exports = [true, false].map(issueClassGenerator) +export default [true, false].map(issueClassGenerator); diff --git a/services/bitbucket/bitbucket-issues.tester.js b/services/bitbucket/bitbucket-issues.tester.js index 4f05579b3577a..28de6470fa56a 100644 --- a/services/bitbucket/bitbucket-issues.tester.js +++ b/services/bitbucket/bitbucket-issues.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isMetric, isMetricOpenIssues} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isMetric, isMetricOpenIssues } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'BitbucketIssues', - title: 'Bitbucket Issues', - pathPrefix: '/bitbucket', -})) +const t = (function() { + export default __a; +}()) t.create('issues-raw (valid)') .get('/issues-raw/atlassian/python-bitbucket.json') diff --git a/services/bitbucket/bitbucket-pipelines.service.js b/services/bitbucket/bitbucket-pipelines.service.js index 347e1d97cbf07..88b3a2e85656b 100644 --- a/services/bitbucket/bitbucket-pipelines.service.js +++ b/services/bitbucket/bitbucket-pipelines.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderBuildStatusBadge } = require('../build-status') -const { BaseJsonService, redirector } = require('..') +import Joi from 'joi'; +import {renderBuildStatusBadge} from '../build-status.js'; +import {BaseJsonService, redirector} from '..'; const bitbucketPipelinesSchema = Joi.object({ values: Joi.array() @@ -96,7 +94,7 @@ const BitbucketPipelinesRedirector = redirector({ dateAdded: new Date('2020-07-12'), }) -module.exports = { +export default { BitbucketPipelines, BitbucketPipelinesRedirector, -} +}; diff --git a/services/bitbucket/bitbucket-pipelines.tester.js b/services/bitbucket/bitbucket-pipelines.tester.js index 2eeec523f91ad..e0e7ed5f36605 100644 --- a/services/bitbucket/bitbucket-pipelines.tester.js +++ b/services/bitbucket/bitbucket-pipelines.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'BitbucketPipelines', - title: 'Bitbucket Pipelines', - pathPrefix: '/bitbucket/pipelines', -})) +import {isBuildStatus} from '../build-status.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) function bitbucketApiResponse(status) { return JSON.stringify({ diff --git a/services/bitbucket/bitbucket-pull-request.service.js b/services/bitbucket/bitbucket-pull-request.service.js index 3ecc002899733..d96b127e8840c 100644 --- a/services/bitbucket/bitbucket-pull-request.service.js +++ b/services/bitbucket/bitbucket-pull-request.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { AuthHelper } = require('../../core/base-service/auth-helper') -const { metric } = require('../text-formatters') -const { nonNegativeInteger, optionalUrl } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {AuthHelper} from '../../core/base-service/auth-helper.js'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger, optionalUrl} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ size: nonNegativeInteger, @@ -128,4 +126,4 @@ function pullRequestClassGenerator(raw) { } } -module.exports = [true, false].map(pullRequestClassGenerator) +export default [true, false].map(pullRequestClassGenerator); diff --git a/services/bitbucket/bitbucket-pull-request.spec.js b/services/bitbucket/bitbucket-pull-request.spec.js index 39aefaea118af..9ff40764cb1ea 100644 --- a/services/bitbucket/bitbucket-pull-request.spec.js +++ b/services/bitbucket/bitbucket-pull-request.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const [BitbucketPullRequest] = require('./bitbucket-pull-request.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import [BitbucketPullRequest] from './bitbucket-pull-request.service.js'; describe('BitbucketPullRequest', function () { cleanUpNockAfterEach() diff --git a/services/bitbucket/bitbucket-pull-request.tester.js b/services/bitbucket/bitbucket-pull-request.tester.js index 9e9f48ba85f3c..7a0c29a207afb 100644 --- a/services/bitbucket/bitbucket-pull-request.tester.js +++ b/services/bitbucket/bitbucket-pull-request.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isMetric, isMetricOpenIssues} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isMetric, isMetricOpenIssues } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'BitbucketPullRequest', - title: 'Bitbucket Pull Request', - pathPrefix: '/bitbucket', -})) +const t = (function() { + export default __a; +}()) t.create('pr-raw (valid)') .get('/pr-raw/atlassian/python-bitbucket.json') diff --git a/services/bithound/bithound.service.js b/services/bithound/bithound.service.js index 0a36660e956a6..2ea0f9291c3f8 100644 --- a/services/bithound/bithound.service.js +++ b/services/bithound/bithound.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'dependencies', route: { base: 'bithound', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'bithound', dateAdded: new Date('2018-07-08'), -}) +}); diff --git a/services/bithound/bithound.tester.js b/services/bithound/bithound.tester.js index f4c70181654b1..af98510aa1496 100644 --- a/services/bithound/bithound.tester.js +++ b/services/bithound/bithound.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'bithound', - title: 'BitHound', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (code)') .get('/code/github/rexxars/sse-channel.json') diff --git a/services/bitrise/bitrise.service.js b/services/bitrise/bitrise.service.js index c3a27f68388c7..f1d8ff6fec4f6 100644 --- a/services/bitrise/bitrise.service.js +++ b/services/bitrise/bitrise.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; // https://devcenter.bitrise.io/api/app-status-badge/ const schema = Joi.object({ @@ -12,7 +10,7 @@ const queryParamSchema = Joi.object({ token: Joi.string().required(), }).required() -module.exports = class Bitrise extends BaseJsonService { +export default class Bitrise extends BaseJsonService { static category = 'build' static route = { base: 'bitrise', @@ -67,4 +65,4 @@ module.exports = class Bitrise extends BaseJsonService { const { status } = await this.fetch({ appId, branch, token }) return this.constructor.render({ status }) } -} +}; diff --git a/services/bitrise/bitrise.tester.js b/services/bitrise/bitrise.tester.js index b31ba9f78ea99..4210b0112d765 100644 --- a/services/bitrise/bitrise.tester.js +++ b/services/bitrise/bitrise.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('deploy status') .get('/cde737473028420d.json?token=GCIdEzacE4GW32jLVrZb7A') diff --git a/services/bountysource/bountysource.service.js b/services/bountysource/bountysource.service.js index 9834fdd8e66eb..84016927cfdec 100644 --- a/services/bountysource/bountysource.service.js +++ b/services/bountysource/bountysource.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { metric } = require('../text-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {metric} from '../text-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ activity_total: nonNegativeInteger }) -module.exports = class Bountysource extends BaseJsonService { +export default class Bountysource extends BaseJsonService { static category = 'funding' static route = { base: 'bountysource/team', pattern: ':team/activity' } @@ -43,4 +41,4 @@ module.exports = class Bountysource extends BaseJsonService { const json = await this.fetch({ team }) return this.constructor.render({ total: json.activity_total }) } -} +}; diff --git a/services/bountysource/bountysource.tester.js b/services/bountysource/bountysource.tester.js index 634b8adbbc764..7aaed4db024f6 100644 --- a/services/bountysource/bountysource.tester.js +++ b/services/bountysource/bountysource.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {isMetric} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const { isMetric } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'bountysource', - title: 'Bountysource', -})) +const t = (function() { + export default __a; +}()) t.create('bounties (valid)') .get('/team/mozilla-core/activity.json') diff --git a/services/bower/bower-base.js b/services/bower/bower-base.js index 12438ceff84c3..287f68cc71ffe 100644 --- a/services/bower/bower-base.js +++ b/services/bower/bower-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object() .keys({ @@ -19,7 +17,7 @@ const schema = Joi.object() }) .required() -module.exports = class BaseBowerService extends BaseJsonService { +export default class BaseBowerService extends BaseJsonService { async fetch({ packageName }) { return this._requestJson({ schema, @@ -29,4 +27,4 @@ module.exports = class BaseBowerService extends BaseJsonService { }, }) } -} +}; diff --git a/services/bower/bower-license.service.js b/services/bower/bower-license.service.js index 2c454ba11ff6f..199a20f40360b 100644 --- a/services/bower/bower-license.service.js +++ b/services/bower/bower-license.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderLicenseBadge} from '../licenses.js'; +import BaseBowerService from './bower-base.js'; -const { renderLicenseBadge } = require('../licenses') -const BaseBowerService = require('./bower-base') - -module.exports = class BowerLicense extends BaseBowerService { +export default class BowerLicense extends BaseBowerService { static category = 'license' static route = { base: 'bower/l', pattern: ':packageName' } @@ -21,4 +19,4 @@ module.exports = class BowerLicense extends BaseBowerService { const data = await this.fetch({ packageName }) return renderLicenseBadge({ licenses: data.normalized_licenses }) } -} +}; diff --git a/services/bower/bower-license.tester.js b/services/bower/bower-license.tester.js index dc89bdaf96279..4b0564c37c993 100644 --- a/services/bower/bower-license.tester.js +++ b/services/bower/bower-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('licence') .timeout(10000) diff --git a/services/bower/bower-version.service.js b/services/bower/bower-version.service.js index aa34d2ece85bf..8dd71c34f474f 100644 --- a/services/bower/bower-version.service.js +++ b/services/bower/bower-version.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { InvalidResponse, redirector } = require('..') -const BaseBowerService = require('./bower-base') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {InvalidResponse, redirector} from '..'; +import BaseBowerService from './bower-base.js'; const queryParamSchema = Joi.object({ include_prereleases: Joi.equal(''), @@ -57,4 +55,4 @@ const BowerVersionRedirect = redirector({ dateAdded: new Date('2019-12-15'), }) -module.exports = { BowerVersion, BowerVersionRedirect } +export default { BowerVersion, BowerVersionRedirect }; diff --git a/services/bower/bower-version.tester.js b/services/bower/bower-version.tester.js index 2f7129b438b91..d81ab3043f620 100644 --- a/services/bower/bower-version.tester.js +++ b/services/bower/bower-version.tester.js @@ -1,13 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'BowerVersion', - title: 'Bower Version', - pathPrefix: '/bower', -})) +import Joi from 'joi'; +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) const isBowerPrereleaseVersion = Joi.string().regex( /^v\d+(\.\d+)?(\.\d+)?(-?[.\w\d])+?$/ diff --git a/services/bstats/bstats-players.service.js b/services/bstats/bstats-players.service.js index 855875c46754e..7925fcd721b28 100644 --- a/services/bstats/bstats-players.service.js +++ b/services/bstats/bstats-players.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.array() .items(Joi.array().items(Joi.number().required(), Joi.number().required())) .required() -module.exports = class BStatsPlayers extends BaseJsonService { +export default class BStatsPlayers extends BaseJsonService { static category = 'other' static route = { base: 'bstats/players', pattern: ':pluginid' } @@ -54,4 +52,4 @@ module.exports = class BStatsPlayers extends BaseJsonService { const { players } = this.transform({ json }) return this.constructor.render({ players }) } -} +}; diff --git a/services/bstats/bstats-players.tester.js b/services/bstats/bstats-players.tester.js index c4d7a7064e028..9c6977db00181 100644 --- a/services/bstats/bstats-players.tester.js +++ b/services/bstats/bstats-players.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Players').get('/1.json').expectBadge({ label: 'players', diff --git a/services/bstats/bstats-servers.service.js b/services/bstats/bstats-servers.service.js index 156458798b809..1da3683e9911e 100644 --- a/services/bstats/bstats-servers.service.js +++ b/services/bstats/bstats-servers.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.array() .items(Joi.array().items(Joi.number().required(), Joi.number().required())) .required() -module.exports = class BStatsServers extends BaseJsonService { +export default class BStatsServers extends BaseJsonService { static category = 'other' static route = { base: 'bstats/servers', pattern: ':pluginid' } @@ -54,4 +52,4 @@ module.exports = class BStatsServers extends BaseJsonService { const { servers } = this.transform({ json }) return this.constructor.render({ servers }) } -} +}; diff --git a/services/bstats/bstats-servers.tester.js b/services/bstats/bstats-servers.tester.js index 8fee06bcc6af2..18d4200677184 100644 --- a/services/bstats/bstats-servers.tester.js +++ b/services/bstats/bstats-servers.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Servers').get('/1.json').expectBadge({ label: 'servers', diff --git a/services/bugzilla/bugzilla.service.js b/services/bugzilla/bugzilla.service.js index e0acfd608f5a0..135c51c9b35d4 100644 --- a/services/bugzilla/bugzilla.service.js +++ b/services/bugzilla/bugzilla.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {BaseJsonService} from '..'; const queryParamSchema = Joi.object({ baseUrl: optionalUrl, @@ -26,7 +24,7 @@ const documentation = `

` -module.exports = class Bugzilla extends BaseJsonService { +export default class Bugzilla extends BaseJsonService { static category = 'issue-tracking' static route = { base: 'bugzilla', pattern: ':bugNumber', queryParamSchema } @@ -115,4 +113,4 @@ module.exports = class Bugzilla extends BaseJsonService { resolution: data.bugs[0].resolution, }) } -} +}; diff --git a/services/bugzilla/bugzilla.spec.js b/services/bugzilla/bugzilla.spec.js index 64b50f94316be..d172813f881d8 100644 --- a/services/bugzilla/bugzilla.spec.js +++ b/services/bugzilla/bugzilla.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const Bugzilla = require('./bugzilla.service') +import {test, given} from 'sazerac'; +import Bugzilla from './bugzilla.service.js'; describe('getDisplayStatus function', function () { it('formats status correctly', async function () { diff --git a/services/bugzilla/bugzilla.tester.js b/services/bugzilla/bugzilla.tester.js index 3bdffa120a12f..6ff8900cf95f9 100644 --- a/services/bugzilla/bugzilla.tester.js +++ b/services/bugzilla/bugzilla.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const bzBugStatus = Joi.equal( 'unconfirmed', diff --git a/services/build-status.js b/services/build-status.js index 4a088eee45374..07a4ff492ad64 100644 --- a/services/build-status.js +++ b/services/build-status.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; const greenStatuses = [ 'fixed', @@ -74,4 +72,4 @@ function renderBuildStatusBadge({ label, status }) { } } -module.exports = { isBuildStatus, renderBuildStatusBadge } +export default { isBuildStatus, renderBuildStatusBadge }; diff --git a/services/build-status.spec.js b/services/build-status.spec.js index 69b19d2165599..03dc25b2d5c00 100644 --- a/services/build-status.spec.js +++ b/services/build-status.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { test, given, forCases } = require('sazerac') -const { renderBuildStatusBadge } = require('./build-status') +import {expect} from 'chai'; +import {test, given, forCases} from 'sazerac'; +import {renderBuildStatusBadge} from './build-status.js'; test(renderBuildStatusBadge, () => { given({ label: 'build', status: 'passed' }).expect({ diff --git a/services/buildkite/buildkite.service.js b/services/buildkite/buildkite.service.js index 16b298b0cf9c4..49624e0562cb2 100644 --- a/services/buildkite/buildkite.service.js +++ b/services/buildkite/buildkite.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseJsonService} from '..'; // unknown is a valid 'other' status for Buildkite const schema = Joi.object({ status: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')), }).required() -module.exports = class Buildkite extends BaseJsonService { +export default class Buildkite extends BaseJsonService { static category = 'build' static route = { base: 'buildkite', pattern: ':identifier/:branch*' } @@ -49,4 +47,4 @@ module.exports = class Buildkite extends BaseJsonService { const json = await this.fetch({ identifier, branch }) return renderBuildStatusBadge({ status: json.status }) } -} +}; diff --git a/services/buildkite/buildkite.tester.js b/services/buildkite/buildkite.tester.js index bca5c506e74e6..0387ef769ac2b 100644 --- a/services/buildkite/buildkite.tester.js +++ b/services/buildkite/buildkite.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('buildkite invalid pipeline') .get('/unknown-identifier/unknown-branch.json') diff --git a/services/bundlephobia/bundlephobia.service.js b/services/bundlephobia/bundlephobia.service.js index fbc4eb5e6892f..62111758c044c 100644 --- a/services/bundlephobia/bundlephobia.service.js +++ b/services/bundlephobia/bundlephobia.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const prettyBytes = require('pretty-bytes') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import prettyBytes from 'pretty-bytes'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ size: nonNegativeInteger, @@ -12,7 +10,7 @@ const schema = Joi.object({ const keywords = ['node', 'bundlephobia'] -module.exports = class Bundlephobia extends BaseJsonService { +export default class Bundlephobia extends BaseJsonService { static category = 'size' static route = { @@ -97,4 +95,4 @@ module.exports = class Bundlephobia extends BaseJsonService { const size = format === 'min' ? json.size : json.gzip return this.constructor.render({ format, size }) } -} +}; diff --git a/services/bundlephobia/bundlephobia.tester.js b/services/bundlephobia/bundlephobia.tester.js index a4ec4d6f29ff9..1484960165b26 100644 --- a/services/bundlephobia/bundlephobia.tester.js +++ b/services/bundlephobia/bundlephobia.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const formats = { A: '/bundlephobia/:type/:package.:format', diff --git a/services/categories.js b/services/categories.js index fc45a33520bd7..86d3b8af63bdf 100644 --- a/services/categories.js +++ b/services/categories.js @@ -1,6 +1,4 @@ -'use strict' - -module.exports = [ +export default [ { id: 'build', name: 'Build', keywords: ['build'] }, { id: 'coverage', name: 'Code Coverage', keywords: ['coverage'] }, { id: 'analysis', name: 'Analysis', keywords: ['analysis'] }, @@ -22,4 +20,4 @@ module.exports = [ { id: 'monitoring', name: 'Monitoring', keywords: ['monitoring'] }, { id: 'activity', name: 'Activity', keywords: ['activity'] }, { id: 'other', name: 'Other', keywords: [] }, -] +]; diff --git a/services/cauditor/cauditor.service.js b/services/cauditor/cauditor.service.js index 64cfbf49dd2f3..84cd2ea6d3618 100644 --- a/services/cauditor/cauditor.service.js +++ b/services/cauditor/cauditor.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'other', route: { base: 'cauditor', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'cauditor', dateAdded: new Date('2018-02-15'), -}) +}); diff --git a/services/cauditor/cauditor.tester.js b/services/cauditor/cauditor.tester.js index aa23655b92df4..f3ba1bc79be87 100644 --- a/services/cauditor/cauditor.tester.js +++ b/services/cauditor/cauditor.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'cauditor', - title: 'Cauditor', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available') .get('/mi/matthiasmullie/scrapbook/master.json') diff --git a/services/cdnjs/cdnjs.service.js b/services/cdnjs/cdnjs.service.js index 4e3503de27f1e..181ffb6e1a508 100644 --- a/services/cdnjs/cdnjs.service.js +++ b/services/cdnjs/cdnjs.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService, NotFound} from '..'; const cdnjsSchema = Joi.object({ // optional due to non-standard 'not found' condition version: Joi.string(), }).required() -module.exports = class Cdnjs extends BaseJsonService { +export default class Cdnjs extends BaseJsonService { static category = 'version' static route = { base: 'cdnjs/v', pattern: ':library' } @@ -45,4 +43,4 @@ module.exports = class Cdnjs extends BaseJsonService { return this.constructor.render({ version: json.version }) } -} +}; diff --git a/services/cdnjs/cdnjs.tester.js b/services/cdnjs/cdnjs.tester.js index 6f7a3139d24ce..6d2ceb50698a0 100644 --- a/services/cdnjs/cdnjs.tester.js +++ b/services/cdnjs/cdnjs.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusTripleDottedVersion } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusTripleDottedVersion} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('cdnjs (valid)').get('/jquery.json').expectBadge({ label: 'cdnjs', diff --git a/services/check-services.spec.js b/services/check-services.spec.js index a564c340a3e50..63090b7cb8535 100644 --- a/services/check-services.spec.js +++ b/services/check-services.spec.js @@ -1,9 +1,4 @@ -'use strict' - -const { - checkNames, - collectDefinitions, -} = require('../core/base-service/loader') +import {checkNames, collectDefinitions} from '../core/base-service/loader.js'; // When these tests fail, they will throw AssertionErrors. Wrapping them in an // `expect().not.to.throw()` makes the error output unreadable. diff --git a/services/chocolatey/chocolatey.service.js b/services/chocolatey/chocolatey.service.js index c03f3d1a7cda8..734683b2c8e4d 100644 --- a/services/chocolatey/chocolatey.service.js +++ b/services/chocolatey/chocolatey.service.js @@ -1,8 +1,6 @@ -'use strict' +import {createServiceFamily} from '../nuget/nuget-v2-service-family.js'; -const { createServiceFamily } = require('../nuget/nuget-v2-service-family') - -module.exports = createServiceFamily({ +export default createServiceFamily({ defaultLabel: 'chocolatey', serviceBaseUrl: 'chocolatey', apiBaseUrl: 'https://www.chocolatey.org/api/v2', @@ -12,4 +10,4 @@ module.exports = createServiceFamily({ exampleVersion: '2.19.2', examplePrereleaseVersion: '2.19.2', exampleDownloadCount: 2.2e6, -}) +}); diff --git a/services/chocolatey/chocolatey.tester.js b/services/chocolatey/chocolatey.tester.js index f7ac3e9910085..6f0ad42797f6c 100644 --- a/services/chocolatey/chocolatey.tester.js +++ b/services/chocolatey/chocolatey.tester.js @@ -1,16 +1,9 @@ -'use strict' - -const { - isMetric, - isVPlusDottedVersionNClauses, - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'chocolatey', - title: 'Chocolatey', -})) +import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; + +const t = (function() { + export default __a; +}()) // downloads diff --git a/services/chrome-web-store/chrome-web-store-base.js b/services/chrome-web-store/chrome-web-store-base.js index ac0049d37295c..480241a1a339b 100644 --- a/services/chrome-web-store/chrome-web-store-base.js +++ b/services/chrome-web-store/chrome-web-store-base.js @@ -1,10 +1,8 @@ -'use strict' +import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store'; +import checkErrorResponse from '../../core/base-service/check-error-response.js'; +import {BaseService, Inaccessible} from '..'; -const ChromeWebStore = require('webextension-store-meta/lib/chrome-web-store') -const checkErrorResponse = require('../../core/base-service/check-error-response') -const { BaseService, Inaccessible } = require('..') - -module.exports = class BaseChromeWebStoreService extends BaseService { +export default class BaseChromeWebStoreService extends BaseService { async fetch({ storeId }) { try { return await ChromeWebStore.load({ id: storeId }) @@ -17,4 +15,4 @@ module.exports = class BaseChromeWebStoreService extends BaseService { return checkErrorResponse({})({ buffer: '', res: e }) } } -} +}; diff --git a/services/chrome-web-store/chrome-web-store-price.service.js b/services/chrome-web-store/chrome-web-store-price.service.js index e2faa0d67976f..c333973db250a 100644 --- a/services/chrome-web-store/chrome-web-store-price.service.js +++ b/services/chrome-web-store/chrome-web-store-price.service.js @@ -1,10 +1,8 @@ -'use strict' +import {currencyFromCode} from '../text-formatters.js'; +import {NotFound} from '..'; +import BaseChromeWebStoreService from './chrome-web-store-base.js'; -const { currencyFromCode } = require('../text-formatters') -const { NotFound } = require('..') -const BaseChromeWebStoreService = require('./chrome-web-store-base') - -module.exports = class ChromeWebStorePrice extends BaseChromeWebStoreService { +export default class ChromeWebStorePrice extends BaseChromeWebStoreService { static category = 'funding' static route = { base: 'chrome-web-store/price', pattern: ':storeId' } @@ -34,4 +32,4 @@ module.exports = class ChromeWebStorePrice extends BaseChromeWebStoreService { } return this.constructor.render({ priceCurrency, price }) } -} +}; diff --git a/services/chrome-web-store/chrome-web-store-price.tester.js b/services/chrome-web-store/chrome-web-store-price.tester.js index cc2ffaa587f18..c572b3e60ee44 100644 --- a/services/chrome-web-store/chrome-web-store-price.tester.js +++ b/services/chrome-web-store/chrome-web-store-price.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('Price') .get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json') diff --git a/services/chrome-web-store/chrome-web-store-rating.service.js b/services/chrome-web-store/chrome-web-store-rating.service.js index 95bbe0009bef5..2b316b53f243a 100644 --- a/services/chrome-web-store/chrome-web-store-rating.service.js +++ b/services/chrome-web-store/chrome-web-store-rating.service.js @@ -1,9 +1,7 @@ -'use strict' - -const { floorCount: floorCountColor } = require('../color-formatters') -const { metric, starRating } = require('../text-formatters') -const { NotFound } = require('..') -const BaseChromeWebStoreService = require('./chrome-web-store-base') +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {metric, starRating} from '../text-formatters.js'; +import {NotFound} from '..'; +import BaseChromeWebStoreService from './chrome-web-store-base.js'; class BaseChromeWebStoreRating extends BaseChromeWebStoreService { static category = 'rating' @@ -108,8 +106,8 @@ class ChromeWebStoreRatingStars extends BaseChromeWebStoreRating { } } -module.exports = { +export default { ChromeWebStoreRating, ChromeWebStoreRatingCount, ChromeWebStoreRatingStars, -} +}; diff --git a/services/chrome-web-store/chrome-web-store-rating.tester.js b/services/chrome-web-store/chrome-web-store-rating.tester.js index bf5d670442cc6..ea42251e87656 100644 --- a/services/chrome-web-store/chrome-web-store-rating.tester.js +++ b/services/chrome-web-store/chrome-web-store-rating.tester.js @@ -1,14 +1,10 @@ -'use strict' +import Joi from 'joi'; +import {isStarRating} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const Joi = require('joi') -const { isStarRating } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'ChromeWebStoreRating', - title: 'Chrome Web Store Rating', - pathPrefix: '/chrome-web-store', -})) +const t = (function() { + export default __a; +}()) t.create('Rating') .get('/rating/alhjnofcnnpeaphgeakdhkebafjcpeae.json') diff --git a/services/chrome-web-store/chrome-web-store-users.service.js b/services/chrome-web-store/chrome-web-store-users.service.js index 12f5130e9aabf..dae65f0bdd6e4 100644 --- a/services/chrome-web-store/chrome-web-store-users.service.js +++ b/services/chrome-web-store/chrome-web-store-users.service.js @@ -1,9 +1,7 @@ -'use strict' - -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { redirector, NotFound } = require('..') -const BaseChromeWebStoreService = require('./chrome-web-store-base') +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {redirector, NotFound} from '..'; +import BaseChromeWebStoreService from './chrome-web-store-base.js'; class ChromeWebStoreUsers extends BaseChromeWebStoreService { static category = 'downloads' @@ -46,7 +44,7 @@ const ChromeWebStoreDownloads = redirector({ dateAdded: new Date('2019-02-27'), }) -module.exports = { +export default { ChromeWebStoreDownloads, ChromeWebStoreUsers, -} +}; diff --git a/services/chrome-web-store/chrome-web-store-users.tester.js b/services/chrome-web-store/chrome-web-store-users.tester.js index a0f3f5cef538c..1b89a40e2fd9c 100644 --- a/services/chrome-web-store/chrome-web-store-users.tester.js +++ b/services/chrome-web-store/chrome-web-store-users.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {isMetric} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const { isMetric } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'ChromeWebStoreUsers', - title: 'Chrome Web Store Users', - pathPrefix: '/chrome-web-store', -})) +const t = (function() { + export default __a; +}()) t.create('Downloads (redirect)') .get('/d/alhjnofcnnpeaphgeakdhkebafjcpeae.svg') diff --git a/services/chrome-web-store/chrome-web-store-version.service.js b/services/chrome-web-store/chrome-web-store-version.service.js index ea9082779b37d..9cf408e61df35 100644 --- a/services/chrome-web-store/chrome-web-store-version.service.js +++ b/services/chrome-web-store/chrome-web-store-version.service.js @@ -1,10 +1,8 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {NotFound} from '..'; +import BaseChromeWebStoreService from './chrome-web-store-base.js'; -const { renderVersionBadge } = require('../version') -const { NotFound } = require('..') -const BaseChromeWebStoreService = require('./chrome-web-store-base') - -module.exports = class ChromeWebStoreVersion extends BaseChromeWebStoreService { +export default class ChromeWebStoreVersion extends BaseChromeWebStoreService { static category = 'version' static route = { base: 'chrome-web-store/v', pattern: ':storeId' } @@ -26,4 +24,4 @@ module.exports = class ChromeWebStoreVersion extends BaseChromeWebStoreService { } return renderVersionBadge({ version }) } -} +}; diff --git a/services/chrome-web-store/chrome-web-store-version.tester.js b/services/chrome-web-store/chrome-web-store-version.tester.js index 09d49442d4059..209017b220cc2 100644 --- a/services/chrome-web-store/chrome-web-store-version.tester.js +++ b/services/chrome-web-store/chrome-web-store-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Version').get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json').expectBadge({ label: 'chrome web store', diff --git a/services/cii-best-practices/cii-best-practices.service.js b/services/cii-best-practices/cii-best-practices.service.js index 7a38690077940..595e4e313a565 100644 --- a/services/cii-best-practices/cii-best-practices.service.js +++ b/services/cii-best-practices/cii-best-practices.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { colorScale, coveragePercentage } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {colorScale, coveragePercentage} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ badge_level: Joi.string().required(), @@ -30,7 +28,7 @@ const summaryColorScale = colorScale( ] ) -module.exports = class CIIBestPracticesService extends BaseJsonService { +export default class CIIBestPracticesService extends BaseJsonService { static category = 'analysis' static route = { base: 'cii', @@ -130,4 +128,4 @@ module.exports = class CIIBestPracticesService extends BaseJsonService { return this.constructor.renderSummaryBadge({ percentage }) } } -} +}; diff --git a/services/cii-best-practices/cii-best-practices.tester.js b/services/cii-best-practices/cii-best-practices.tester.js index b908976637806..7f5b2b86c868e 100644 --- a/services/cii-best-practices/cii-best-practices.tester.js +++ b/services/cii-best-practices/cii-best-practices.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('level known project') .get(`/level/1.json`) diff --git a/services/circleci/circleci.service.js b/services/circleci/circleci.service.js index 84efe01135c19..728dd8c018d43 100644 --- a/services/circleci/circleci.service.js +++ b/services/circleci/circleci.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService, redirector } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService, redirector} from '..'; const circleSchema = Joi.object({ message: isBuildStatus }).required() const queryParamSchema = Joi.object({ token: Joi.string() }).required() @@ -98,4 +96,4 @@ const legacyRoutes = [ }), ] -module.exports = [...legacyRoutes, CircleCi] +export default [...legacyRoutes, CircleCi]; diff --git a/services/circleci/circleci.tester.js b/services/circleci/circleci.tester.js index ecdded2b10e9a..84403091ba0fc 100644 --- a/services/circleci/circleci.tester.js +++ b/services/circleci/circleci.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {isBuildStatus} from '../build-status.js'; +import {ServiceTester} from '../tester.js'; -const { isBuildStatus } = require('../build-status') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'circleci', - title: 'Circle CI', -})) +const t = (function() { + export default __a; +}()) t.create('circle ci (valid, without branch)') .get('/build/gh/RedSparr0w/node-csgo-parser.json') diff --git a/services/cirrus/cirrus.service.js b/services/cirrus/cirrus.service.js index 7e4b9d07bbaeb..347824b10af42 100644 --- a/services/cirrus/cirrus.service.js +++ b/services/cirrus/cirrus.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ subject: Joi.string().required(), @@ -15,7 +13,7 @@ const queryParamSchema = Joi.object({ script: Joi.string(), }).required() -module.exports = class Cirrus extends BaseJsonService { +export default class Cirrus extends BaseJsonService { static category = 'build' static route = { base: 'cirrus', @@ -72,4 +70,4 @@ module.exports = class Cirrus extends BaseJsonService { return this.constructor.render(json) } -} +}; diff --git a/services/cirrus/cirrus.tester.js b/services/cirrus/cirrus.tester.js index a23d9cc8ce8d4..bc54ab6637bc8 100644 --- a/services/cirrus/cirrus.tester.js +++ b/services/cirrus/cirrus.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('cirrus bad repo') .get('/github/unknown-identifier/unknown-repo.json') diff --git a/services/clojars/clojars-base.js b/services/clojars/clojars-base.js index 9a89c9e6ddadf..558113095824b 100644 --- a/services/clojars/clojars-base.js +++ b/services/clojars/clojars-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const clojarsSchema = Joi.object({ downloads: nonNegativeInteger, @@ -21,4 +19,4 @@ class BaseClojarsService extends BaseJsonService { } } -module.exports = { BaseClojarsService } +export default { BaseClojarsService }; diff --git a/services/clojars/clojars-downloads.service.js b/services/clojars/clojars-downloads.service.js index 3925de5f1e74a..2ecfc5312486d 100644 --- a/services/clojars/clojars-downloads.service.js +++ b/services/clojars/clojars-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {downloadCount as downloadsColor} from '../color-formatters.js'; +import {BaseClojarsService} from './clojars-base.js'; -const { metric } = require('../text-formatters') -const { downloadCount: downloadsColor } = require('../color-formatters') -const { BaseClojarsService } = require('./clojars-base') - -module.exports = class ClojarsDownloads extends BaseClojarsService { +export default class ClojarsDownloads extends BaseClojarsService { static category = 'downloads' static route = { base: 'clojars/dt', pattern: ':clojar+' } @@ -29,4 +27,4 @@ module.exports = class ClojarsDownloads extends BaseClojarsService { const json = await this.fetch({ clojar }) return this.constructor.render({ downloads: json.downloads }) } -} +}; diff --git a/services/clojars/clojars-downloads.tester.js b/services/clojars/clojars-downloads.tester.js index 94ec0aad260b4..bef2f7aedbae3 100644 --- a/services/clojars/clojars-downloads.tester.js +++ b/services/clojars/clojars-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('clojars downloads (valid)').get('/prismic.json').expectBadge({ label: 'downloads', diff --git a/services/clojars/clojars-version.service.js b/services/clojars/clojars-version.service.js index 048161a8ff9ef..7f72343487104 100644 --- a/services/clojars/clojars-version.service.js +++ b/services/clojars/clojars-version.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { version: versionColor } = require('../color-formatters') -const { redirector } = require('..') -const { BaseClojarsService } = require('./clojars-base') +import Joi from 'joi'; +import {version as versionColor} from '../color-formatters.js'; +import {redirector} from '..'; +import {BaseClojarsService} from './clojars-base.js'; const queryParamSchema = Joi.object({ include_prereleases: Joi.equal(''), @@ -63,4 +61,4 @@ const ClojarsVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -module.exports = { ClojarsVersionService, ClojarsVersionRedirector } +export default { ClojarsVersionService, ClojarsVersionRedirector }; diff --git a/services/clojars/clojars-version.tester.js b/services/clojars/clojars-version.tester.js index ee495b9c7e77a..dfcec0fa2a426 100644 --- a/services/clojars/clojars-version.tester.js +++ b/services/clojars/clojars-version.tester.js @@ -1,11 +1,7 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'ClojarsVersion', - title: 'Clojars Version', - pathPrefix: '/clojars', -})) +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('clojars version (valid)') .get('/v/prismic.json') diff --git a/services/cocoapods/cocoapods-apps.service.js b/services/cocoapods/cocoapods-apps.service.js index 277cc6a43cdef..1a417387bb0bd 100644 --- a/services/cocoapods/cocoapods-apps.service.js +++ b/services/cocoapods/cocoapods-apps.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ name: 'CocoapodsApps', category: 'other', route: { @@ -11,4 +9,4 @@ module.exports = deprecatedService({ }, label: 'apps', dateAdded: new Date('2018-01-06'), -}) +}); diff --git a/services/cocoapods/cocoapods-apps.tester.js b/services/cocoapods/cocoapods-apps.tester.js index 07c8e86521161..8ad801f680d0c 100644 --- a/services/cocoapods/cocoapods-apps.tester.js +++ b/services/cocoapods/cocoapods-apps.tester.js @@ -1,11 +1,7 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'CocoapodsApps', - title: 'CocoapodsApps', - pathPrefix: '/cocoapods', -})) +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('apps (valid, weekly)') .get('/aw/AFNetworking.json') diff --git a/services/cocoapods/cocoapods-base.js b/services/cocoapods/cocoapods-base.js index e0ae168661fa0..16e4cff2e7c35 100644 --- a/services/cocoapods/cocoapods-base.js +++ b/services/cocoapods/cocoapods-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ version: Joi.string().required(), @@ -16,11 +14,11 @@ const schema = Joi.object({ platforms: Joi.object().default({ ios: '5.0', osx: '10.7' }), }).required() -module.exports = class BaseCocoaPodsService extends BaseJsonService { +export default class BaseCocoaPodsService extends BaseJsonService { async fetch({ spec }) { return this._requestJson({ schema, url: `https://trunk.cocoapods.org/api/v1/pods/${spec}/specs/latest`, }) } -} +}; diff --git a/services/cocoapods/cocoapods-docs.service.js b/services/cocoapods/cocoapods-docs.service.js index 3f942a24ffbba..54237134a4200 100644 --- a/services/cocoapods/cocoapods-docs.service.js +++ b/services/cocoapods/cocoapods-docs.service.js @@ -1,10 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { - coveragePercentage: coveragePercentageColor, -} = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ cocoadocs: Joi.object({ @@ -12,7 +8,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class CocoapodsDocs extends BaseJsonService { +export default class CocoapodsDocs extends BaseJsonService { static category = 'analysis' static route = { base: 'cocoapods/metrics/doc-percent', pattern: ':spec' } @@ -45,4 +41,4 @@ module.exports = class CocoapodsDocs extends BaseJsonService { const percentage = data.cocoadocs.doc_percent || 0 return this.constructor.render({ percentage }) } -} +}; diff --git a/services/cocoapods/cocoapods-docs.tester.js b/services/cocoapods/cocoapods-docs.tester.js index 7fe160e207cf3..5e93c2e8041d8 100644 --- a/services/cocoapods/cocoapods-docs.tester.js +++ b/services/cocoapods/cocoapods-docs.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('doc percent (valid)').get('/AFNetworking.json').expectBadge({ label: 'docs', diff --git a/services/cocoapods/cocoapods-downloads.service.js b/services/cocoapods/cocoapods-downloads.service.js index c0caf8da6be81..26f5e2781925f 100644 --- a/services/cocoapods/cocoapods-downloads.service.js +++ b/services/cocoapods/cocoapods-downloads.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ name: 'CocoapodsDownloads', category: 'downloads', route: { @@ -11,4 +9,4 @@ module.exports = deprecatedService({ }, label: 'downloads', dateAdded: new Date('2018-01-06'), -}) +}); diff --git a/services/cocoapods/cocoapods-downloads.tester.js b/services/cocoapods/cocoapods-downloads.tester.js index 8e66b7470ed5b..6c35b1b3d317a 100644 --- a/services/cocoapods/cocoapods-downloads.tester.js +++ b/services/cocoapods/cocoapods-downloads.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'CocoapodsDownloads', - title: 'CocoapodsDownloads', - pathPrefix: '/cocoapods', -})) +const t = (function() { + export default __a; +}()) t.create('downloads (valid, monthly)') .get('/dm/AFNetworking.json') diff --git a/services/cocoapods/cocoapods-license.service.js b/services/cocoapods/cocoapods-license.service.js index 65d3c02bc33dd..ec9882c8989f6 100644 --- a/services/cocoapods/cocoapods-license.service.js +++ b/services/cocoapods/cocoapods-license.service.js @@ -1,8 +1,6 @@ -'use strict' +import BaseCocoaPodsService from './cocoapods-base.js'; -const BaseCocoaPodsService = require('./cocoapods-base') - -module.exports = class CocoapodsLicense extends BaseCocoaPodsService { +export default class CocoapodsLicense extends BaseCocoaPodsService { static category = 'license' static route = { base: 'cocoapods/l', pattern: ':spec' } @@ -37,4 +35,4 @@ module.exports = class CocoapodsLicense extends BaseCocoaPodsService { typeof data.license === 'object' ? data.license.type : data.license return this.constructor.render({ license }) } -} +}; diff --git a/services/cocoapods/cocoapods-license.tester.js b/services/cocoapods/cocoapods-license.tester.js index 3f6c633192482..197f8165f1917 100644 --- a/services/cocoapods/cocoapods-license.tester.js +++ b/services/cocoapods/cocoapods-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('license (valid)') .get('/AFNetworking.json') diff --git a/services/cocoapods/cocoapods-platform.service.js b/services/cocoapods/cocoapods-platform.service.js index dc2b4fb4d16ff..01a17e0f4f803 100644 --- a/services/cocoapods/cocoapods-platform.service.js +++ b/services/cocoapods/cocoapods-platform.service.js @@ -1,8 +1,6 @@ -'use strict' +import BaseCocoaPodsService from './cocoapods-base.js'; -const BaseCocoaPodsService = require('./cocoapods-base') - -module.exports = class CocoapodsPlatform extends BaseCocoaPodsService { +export default class CocoapodsPlatform extends BaseCocoaPodsService { static category = 'platform-support' static route = { base: 'cocoapods/p', pattern: ':spec' } @@ -30,4 +28,4 @@ module.exports = class CocoapodsPlatform extends BaseCocoaPodsService { const { platforms } = await this.fetch({ spec }) return this.constructor.render({ platforms: Object.keys(platforms) }) } -} +}; diff --git a/services/cocoapods/cocoapods-platform.tester.js b/services/cocoapods/cocoapods-platform.tester.js index c05aa58bb5b0e..9a429c1eaba08 100644 --- a/services/cocoapods/cocoapods-platform.tester.js +++ b/services/cocoapods/cocoapods-platform.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isPlatform = Joi.string().regex( /^(osx|ios|tvos|watchos)( \| (osx|ios|tvos|watchos))*$/ diff --git a/services/cocoapods/cocoapods-version.service.js b/services/cocoapods/cocoapods-version.service.js index f82fccf2cb85d..3431526d8e398 100644 --- a/services/cocoapods/cocoapods-version.service.js +++ b/services/cocoapods/cocoapods-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import BaseCocoaPodsService from './cocoapods-base.js'; -const { renderVersionBadge } = require('../version') -const BaseCocoaPodsService = require('./cocoapods-base') - -module.exports = class CocoapodsVersion extends BaseCocoaPodsService { +export default class CocoapodsVersion extends BaseCocoaPodsService { static category = 'version' static route = { base: 'cocoapods/v', pattern: ':spec' } @@ -21,4 +19,4 @@ module.exports = class CocoapodsVersion extends BaseCocoaPodsService { const { version } = await this.fetch({ spec }) return renderVersionBadge({ version }) } -} +}; diff --git a/services/cocoapods/cocoapods-version.tester.js b/services/cocoapods/cocoapods-version.tester.js index 468ea4fa2ff82..4a566afcdf428 100644 --- a/services/cocoapods/cocoapods-version.tester.js +++ b/services/cocoapods/cocoapods-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version (valid)').get('/AFNetworking.json').expectBadge({ label: 'pod', diff --git a/services/codacy/codacy-coverage.service.js b/services/codacy/codacy-coverage.service.js index 3c0b4b082e766..6c4af71029ae0 100644 --- a/services/codacy/codacy-coverage.service.js +++ b/services/codacy/codacy-coverage.service.js @@ -1,11 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { - coveragePercentage: coveragePercentageColor, -} = require('../color-formatters') -const { BaseSvgScrapingService } = require('..') -const { NotFound } = require('..') +import Joi from 'joi'; +import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; +import {BaseSvgScrapingService, NotFound} from '..'; const schema = Joi.object({ message: Joi.alternatives() @@ -13,7 +8,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class CodacyCoverage extends BaseSvgScrapingService { +export default class CodacyCoverage extends BaseSvgScrapingService { static category = 'coverage' static route = { base: 'codacy/coverage', pattern: ':projectId/:branch*' } @@ -47,7 +42,7 @@ module.exports = class CodacyCoverage extends BaseSvgScrapingService { static transform({ coverageString }) { return { percentage: parseFloat(coverageString.replace(/%$/, '')), - } + }; } async handle({ projectId, branch }) { @@ -75,4 +70,4 @@ module.exports = class CodacyCoverage extends BaseSvgScrapingService { const { percentage } = this.constructor.transform({ coverageString }) return this.constructor.render({ percentage }) } -} +}; diff --git a/services/codacy/codacy-coverage.tester.js b/services/codacy/codacy-coverage.tester.js index 580018b2b49f0..d549d8383a074 100644 --- a/services/codacy/codacy-coverage.tester.js +++ b/services/codacy/codacy-coverage.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Coverage').get('/59d607d0e311408885e418004068ea58.json').expectBadge({ label: 'coverage', diff --git a/services/codacy/codacy-grade.service.js b/services/codacy/codacy-grade.service.js index 7f417bd26e771..9a7c3698cc4cc 100644 --- a/services/codacy/codacy-grade.service.js +++ b/services/codacy/codacy-grade.service.js @@ -1,12 +1,10 @@ -'use strict' - -const Joi = require('joi') -const { BaseSvgScrapingService } = require('..') -const { codacyGrade } = require('./codacy-helpers') +import Joi from 'joi'; +import {BaseSvgScrapingService} from '..'; +import {codacyGrade} from './codacy-helpers.js'; const schema = Joi.object({ message: codacyGrade }).required() -module.exports = class CodacyGrade extends BaseSvgScrapingService { +export default class CodacyGrade extends BaseSvgScrapingService { static category = 'analysis' static route = { base: 'codacy/grade', pattern: ':projectId/:branch*' } @@ -58,4 +56,4 @@ module.exports = class CodacyGrade extends BaseSvgScrapingService { }) return this.constructor.render({ grade }) } -} +}; diff --git a/services/codacy/codacy-grade.tester.js b/services/codacy/codacy-grade.tester.js index cc8020e2104de..a76c0fdf155c0 100644 --- a/services/codacy/codacy-grade.tester.js +++ b/services/codacy/codacy-grade.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { codacyGrade } = require('./codacy-helpers') +const t = (function() { + export default __a; +}()) +import {codacyGrade} from './codacy-helpers.js'; t.create('Code quality') .get('/e27821fb6289410b8f58338c7e0bc686.json') diff --git a/services/codacy/codacy-helpers.js b/services/codacy/codacy-helpers.js index 9c222194c34c9..19e425138a146 100644 --- a/services/codacy/codacy-helpers.js +++ b/services/codacy/codacy-helpers.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; const codacyGrade = Joi.equal('A', 'B', 'C', 'D', 'E', 'F') -module.exports = { codacyGrade } +export default { codacyGrade }; diff --git a/services/codeclimate/codeclimate-analysis-redirector.service.js b/services/codeclimate/codeclimate-analysis-redirector.service.js index e70062db79129..b508ff1913a1c 100644 --- a/services/codeclimate/codeclimate-analysis-redirector.service.js +++ b/services/codeclimate/codeclimate-analysis-redirector.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ // http://github.com/badges/shields/issues/1387 // https://github.com/badges/shields/pull/3320#issuecomment-483795000 redirector({ @@ -16,4 +14,4 @@ module.exports = [ `/codeclimate/maintainability/${user}/${repo}`, dateAdded: new Date('2019-04-16'), }), -] +]; diff --git a/services/codeclimate/codeclimate-analysis-redirector.tester.js b/services/codeclimate/codeclimate-analysis-redirector.tester.js index 2e6eb7e42c8fe..c08fddafc0604 100644 --- a/services/codeclimate/codeclimate-analysis-redirector.tester.js +++ b/services/codeclimate/codeclimate-analysis-redirector.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'CodeclimateCoverageRedirector', - title: 'Code Climate Coverage Redirector', - pathPrefix: '/codeclimate', -})) +const t = (function() { + export default __a; +}()) t.create('Maintainability letter alias') .get('/maintainability-letter/jekyll/jekyll.svg') diff --git a/services/codeclimate/codeclimate-analysis.service.js b/services/codeclimate/codeclimate-analysis.service.js index 2de65a67a1be4..3133043764b01 100644 --- a/services/codeclimate/codeclimate-analysis.service.js +++ b/services/codeclimate/codeclimate-analysis.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { colorScale, letterScore } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, NotFound } = require('..') -const { keywords, isLetterGrade, fetchRepo } = require('./codeclimate-common') +import Joi from 'joi'; +import {colorScale, letterScore} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; +import {keywords, isLetterGrade, fetchRepo} from './codeclimate-common.js'; const schema = Joi.object({ data: Joi.object({ @@ -87,7 +85,7 @@ const variantMap = { }, } -module.exports = class CodeclimateAnalysis extends BaseJsonService { +export default class CodeclimateAnalysis extends BaseJsonService { static category = 'analysis' static route = { base: 'codeclimate', @@ -166,4 +164,4 @@ module.exports = class CodeclimateAnalysis extends BaseJsonService { ...props, }) } -} +}; diff --git a/services/codeclimate/codeclimate-analysis.tester.js b/services/codeclimate/codeclimate-analysis.tester.js index 33ee8fd13156a..c212feb16c983 100644 --- a/services/codeclimate/codeclimate-analysis.tester.js +++ b/services/codeclimate/codeclimate-analysis.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) // Examples for this service can be found through the explore page: // https://codeclimate.com/explore diff --git a/services/codeclimate/codeclimate-common.js b/services/codeclimate/codeclimate-common.js index 94c441a5ca5e2..9d33193fa4480 100644 --- a/services/codeclimate/codeclimate-common.js +++ b/services/codeclimate/codeclimate-common.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { NotFound } = require('..') +import Joi from 'joi'; +import {NotFound} from '..'; const keywords = ['codeclimate'] @@ -44,8 +42,8 @@ async function fetchRepo(serviceInstance, { user, repo }) { return repoInfo } -module.exports = { +export default { keywords, isLetterGrade, fetchRepo, -} +}; diff --git a/services/codeclimate/codeclimate-coverage-redirector.service.js b/services/codeclimate/codeclimate-coverage-redirector.service.js index 57b440c855aaf..54260f5eea9c5 100644 --- a/services/codeclimate/codeclimate-coverage-redirector.service.js +++ b/services/codeclimate/codeclimate-coverage-redirector.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ // http://github.com/badges/shields/issues/1387 // https://github.com/badges/shields/pull/3320#issuecomment-483795000 redirector({ @@ -36,4 +34,4 @@ module.exports = [ transformPath: ({ user, repo }) => `/codeclimate/coverage/${user}/${repo}`, dateAdded: new Date('2019-04-15'), }), -] +]; diff --git a/services/codeclimate/codeclimate-coverage-redirector.tester.js b/services/codeclimate/codeclimate-coverage-redirector.tester.js index 2ea8184631a30..40c0ead67a3f0 100644 --- a/services/codeclimate/codeclimate-coverage-redirector.tester.js +++ b/services/codeclimate/codeclimate-coverage-redirector.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'CodeclimateCoverageRedirector', - title: 'Code Climate Coverage Redirector', - pathPrefix: '/codeclimate', -})) +const t = (function() { + export default __a; +}()) t.create('Top-level coverage shortcut') .get('/jekyll/jekyll.svg') diff --git a/services/codeclimate/codeclimate-coverage.service.js b/services/codeclimate/codeclimate-coverage.service.js index a58bce7b6db7f..ed5a35de75d36 100644 --- a/services/codeclimate/codeclimate-coverage.service.js +++ b/services/codeclimate/codeclimate-coverage.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage, letterScore } = require('../color-formatters') -const { BaseJsonService, NotFound } = require('..') -const { keywords, isLetterGrade, fetchRepo } = require('./codeclimate-common') +import Joi from 'joi'; +import {coveragePercentage, letterScore} from '../color-formatters.js'; +import {BaseJsonService, NotFound} from '..'; +import {keywords, isLetterGrade, fetchRepo} from './codeclimate-common.js'; const schema = Joi.object({ data: Joi.object({ @@ -16,7 +14,7 @@ const schema = Joi.object({ }).allow(null), }).required() -module.exports = class CodeclimateCoverage extends BaseJsonService { +export default class CodeclimateCoverage extends BaseJsonService { static category = 'coverage' static route = { base: 'codeclimate', @@ -85,4 +83,4 @@ module.exports = class CodeclimateCoverage extends BaseJsonService { percentage, }) } -} +}; diff --git a/services/codeclimate/codeclimate-coverage.tester.js b/services/codeclimate/codeclimate-coverage.tester.js index de7c9acdc9a99..5891df2c6c4ef 100644 --- a/services/codeclimate/codeclimate-coverage.tester.js +++ b/services/codeclimate/codeclimate-coverage.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) // Examples for this service can be found through the explore page: // https://codeclimate.com/explore diff --git a/services/codecov/codecov-redirect.service.js b/services/codecov/codecov-redirect.service.js index 9d56de406e9b0..6bec0a98a20a3 100644 --- a/services/codecov/codecov-redirect.service.js +++ b/services/codecov/codecov-redirect.service.js @@ -1,6 +1,4 @@ -'use strict' - -const { redirector } = require('..') +import {redirector} from '..'; const vcsSNameShortFormMap = { bb: 'bitbucket', @@ -8,7 +6,7 @@ const vcsSNameShortFormMap = { gl: 'gitlab', } -module.exports = [ +export default [ redirector({ category: 'coverage', route: { @@ -23,4 +21,4 @@ module.exports = [ transformQueryParams: ({ token }) => ({ token }), dateAdded: new Date('2019-03-04'), }), -] +]; diff --git a/services/codecov/codecov-redirect.tester.js b/services/codecov/codecov-redirect.tester.js index 1a9154db681c2..9cdcdd0886d78 100644 --- a/services/codecov/codecov-redirect.tester.js +++ b/services/codecov/codecov-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'CodecovTokenRedirect', - title: 'CodecovTokenRedirect', - pathPrefix: '/codecov', -})) +const t = (function() { + export default __a; +}()) t.create('codecov token') .get('/c/token/abc123def456/gh/codecov/private-example.svg') diff --git a/services/codecov/codecov.service.js b/services/codecov/codecov.service.js index 4a8f8ec890f8c..9694a8957e964 100644 --- a/services/codecov/codecov.service.js +++ b/services/codecov/codecov.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage } = require('../color-formatters') -const { BaseSvgScrapingService } = require('..') -const { parseJson } = require('../../core/base-service/json') +import Joi from 'joi'; +import {coveragePercentage} from '../color-formatters.js'; +import {BaseSvgScrapingService} from '..'; +import {parseJson} from '../../core/base-service/json.js'; // https://docs.codecov.io/reference#totals // A new repository that's been added but never had any coverage reports @@ -45,7 +43,7 @@ const documentation = `

` -module.exports = class Codecov extends BaseSvgScrapingService { +export default class Codecov extends BaseSvgScrapingService { static category = 'coverage' static route = { base: 'codecov/c', @@ -177,4 +175,4 @@ module.exports = class Codecov extends BaseSvgScrapingService { const { coverage } = this.transform({ data }) return this.constructor.render({ coverage }) } -} +}; diff --git a/services/codecov/codecov.spec.js b/services/codecov/codecov.spec.js index ed54900d27360..9007307366373 100644 --- a/services/codecov/codecov.spec.js +++ b/services/codecov/codecov.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, forCases, given } = require('sazerac') -const Codecov = require('./codecov.service') +import {test, forCases, given} from 'sazerac'; +import Codecov from './codecov.service.js'; describe('Codecov', function () { test(Codecov.prototype.legacyTransform, () => { diff --git a/services/codecov/codecov.tester.js b/services/codecov/codecov.tester.js index e7e317007311b..770e2b92d6003 100644 --- a/services/codecov/codecov.tester.js +++ b/services/codecov/codecov.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets coverage status') .get('/github/codecov/example-python.json') diff --git a/services/codefactor/codefactor-grade.service.js b/services/codefactor/codefactor-grade.service.js index 613efb13062bb..380f0d1d99946 100644 --- a/services/codefactor/codefactor-grade.service.js +++ b/services/codefactor/codefactor-grade.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { BaseSvgScrapingService } = require('..') -const { isValidGrade, gradeColor } = require('./codefactor-helpers') +import Joi from 'joi'; +import {BaseSvgScrapingService} from '..'; +import {isValidGrade, gradeColor} from './codefactor-helpers.js'; const schema = Joi.object({ message: isValidGrade, }).required() -module.exports = class CodeFactorGrade extends BaseSvgScrapingService { +export default class CodeFactorGrade extends BaseSvgScrapingService { static category = 'analysis' static route = { base: 'codefactor/grade', @@ -47,4 +45,4 @@ module.exports = class CodeFactorGrade extends BaseSvgScrapingService { }) return this.constructor.render({ grade: message }) } -} +}; diff --git a/services/codefactor/codefactor-grade.spec.js b/services/codefactor/codefactor-grade.spec.js index d9b1a80f0d9d5..b6afefe516000 100644 --- a/services/codefactor/codefactor-grade.spec.js +++ b/services/codefactor/codefactor-grade.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const CodeFactorGrade = require('./codefactor-grade.service') +import {test, given} from 'sazerac'; +import CodeFactorGrade from './codefactor-grade.service.js'; describe('CodeFactorGrade', function () { test(CodeFactorGrade.render, () => { diff --git a/services/codefactor/codefactor-grade.tester.js b/services/codefactor/codefactor-grade.tester.js index 1df7970214bb5..8a322e26a7a46 100644 --- a/services/codefactor/codefactor-grade.tester.js +++ b/services/codefactor/codefactor-grade.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isValidGrade } = require('./codefactor-helpers') +const t = (function() { + export default __a; +}()) +import {isValidGrade} from './codefactor-helpers.js'; t.create('Grade').get('/github/google/guava.json').expectBadge({ label: 'code quality', diff --git a/services/codefactor/codefactor-helpers.js b/services/codefactor/codefactor-helpers.js index 1672c89c96814..7f880f7c26fda 100644 --- a/services/codefactor/codefactor-helpers.js +++ b/services/codefactor/codefactor-helpers.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; // https://support.codefactor.io/i14-glossary // https://github.com/badges/shields/issues/4269 @@ -31,4 +29,4 @@ function gradeColor(grade) { return color } -module.exports = { isValidGrade, gradeColor } +export default { isValidGrade, gradeColor }; diff --git a/services/codeship/codeship.service.js b/services/codeship/codeship.service.js index 1cac77ef25c46..0ead10d127954 100644 --- a/services/codeship/codeship.service.js +++ b/services/codeship/codeship.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService} from '..'; const schema = Joi.object({ message: Joi.alternatives() @@ -26,7 +24,7 @@ const statusMap = { infrastructure_failure: 'failed', } -module.exports = class Codeship extends BaseSvgScrapingService { +export default class Codeship extends BaseSvgScrapingService { static category = 'build' static route = { base: 'codeship', pattern: ':projectId/:branch*' } @@ -64,11 +62,11 @@ module.exports = class Codeship extends BaseSvgScrapingService { url, options: { qs: { branch } }, valueMatcher: /(?:[.\s\S]*)\/><\/g> 2) { @@ -20,7 +18,7 @@ function renderContributorBadge({ label, contributorCount }) { } } -module.exports = { +export default { contributorColor, renderContributorBadge, -} +}; diff --git a/services/contributor-count.spec.js b/services/contributor-count.spec.js index 1ebdf4d31e32b..61a8a69a26314 100644 --- a/services/contributor-count.spec.js +++ b/services/contributor-count.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { renderContributorBadge } = require('./contributor-count') +import {test, given} from 'sazerac'; +import {renderContributorBadge} from './contributor-count.js'; describe('Contributor count helpers', function () { test(renderContributorBadge, () => { diff --git a/services/cookbook/cookbook.service.js b/services/cookbook/cookbook.service.js index 0e45f12abcada..bdec4e459babf 100644 --- a/services/cookbook/cookbook.service.js +++ b/services/cookbook/cookbook.service.js @@ -1,12 +1,10 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ version: Joi.string().required() }).required() -module.exports = class Cookbook extends BaseJsonService { +export default class Cookbook extends BaseJsonService { static category = 'version' static route = { base: 'cookbook/v', pattern: ':cookbook' } @@ -29,4 +27,4 @@ module.exports = class Cookbook extends BaseJsonService { const { version } = await this.fetch({ cookbook }) return renderVersionBadge({ version }) } -} +}; diff --git a/services/cookbook/cookbook.tester.js b/services/cookbook/cookbook.tester.js index 9fa5eba654e40..620fbde0e13f3 100644 --- a/services/cookbook/cookbook.tester.js +++ b/services/cookbook/cookbook.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version').get('/chef-sugar.json').expectBadge({ label: 'cookbook', diff --git a/services/coveralls/coveralls-redirector.service.js b/services/coveralls/coveralls-redirector.service.js index b1eb9550f2409..17b4f21ab9c09 100644 --- a/services/coveralls/coveralls-redirector.service.js +++ b/services/coveralls/coveralls-redirector.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ name: 'CoverallsGitHubRedirect', category: 'coverage', @@ -14,4 +12,4 @@ module.exports = [ `/coveralls/github/${user}/${repo}${branch ? `/${branch}` : ''}`, dateAdded: new Date('2021-02-23'), }), -] +]; diff --git a/services/coveralls/coveralls-redirector.tester.js b/services/coveralls/coveralls-redirector.tester.js index 48af1e3356915..81d5e0dc4d458 100644 --- a/services/coveralls/coveralls-redirector.tester.js +++ b/services/coveralls/coveralls-redirector.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'CoverallsGitHubRedirect', - title: 'Coveralls GitHub Redirector', - pathPrefix: '/coveralls', -})) +const t = (function() { + export default __a; +}()) t.create('Coveralls VCS type missing') .get('/lemurheavy/coveralls-ruby.svg') diff --git a/services/coveralls/coveralls.service.js b/services/coveralls/coveralls.service.js index 235927a6b3082..123bbdefbeb03 100644 --- a/services/coveralls/coveralls.service.js +++ b/services/coveralls/coveralls.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {coveragePercentage} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ covered_percent: Joi.number().min(0).max(100).required(), }).required() -module.exports = class Coveralls extends BaseJsonService { +export default class Coveralls extends BaseJsonService { static category = 'coverage' static route = { base: 'coveralls', @@ -75,4 +73,4 @@ module.exports = class Coveralls extends BaseJsonService { const json = await this.fetch({ vcsType, user, repo, branch }) return this.constructor.render({ coverage: json.covered_percent }) } -} +}; diff --git a/services/coveralls/coveralls.tester.js b/services/coveralls/coveralls.tester.js index d530078cb53c7..9a626630a41ec 100644 --- a/services/coveralls/coveralls.tester.js +++ b/services/coveralls/coveralls.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('github coverage') .get('/github/jekyll/jekyll.json') diff --git a/services/coverity/coverity-on-demand.service.js b/services/coverity/coverity-on-demand.service.js index 6f6d0b52b4a4f..061414cbd0b9c 100644 --- a/services/coverity/coverity-on-demand.service.js +++ b/services/coverity/coverity-on-demand.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ route: { base: 'coverity/ondemand', pattern: ':various+', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ label: 'coverity', category: 'analysis', dateAdded: new Date('2018-12-18'), -}) +}); diff --git a/services/coverity/coverity-on-demand.tester.js b/services/coverity/coverity-on-demand.tester.js index 09199d915029a..570b37c757d66 100644 --- a/services/coverity/coverity-on-demand.tester.js +++ b/services/coverity/coverity-on-demand.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'CoverityOnDemand', - title: 'Coverity On Demand', - pathPrefix: '/coverity/ondemand', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (streams)') .get('/streams/44b25sjc9l3ntc2ngfi29tngro.json') diff --git a/services/coverity/coverity-scan.service.js b/services/coverity/coverity-scan.service.js index 1643786e91ea2..f03f7dadcdd8c 100644 --- a/services/coverity/coverity-scan.service.js +++ b/services/coverity/coverity-scan.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const messageRegex = /passed|passed .* new defects|pending|failed/ const schema = Joi.object({ message: Joi.string().regex(messageRegex).required(), }).required() -module.exports = class CoverityScan extends BaseJsonService { +export default class CoverityScan extends BaseJsonService { static category = 'analysis' static route = { base: 'coverity/scan', pattern: ':projectId' } @@ -66,4 +64,4 @@ module.exports = class CoverityScan extends BaseJsonService { }) return this.constructor.render({ message: json.message }) } -} +}; diff --git a/services/coverity/coverity-scan.tester.js b/services/coverity/coverity-scan.tester.js index e8a997cacde5e..ca5196ead50d4 100644 --- a/services/coverity/coverity-scan.tester.js +++ b/services/coverity/coverity-scan.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('known project id') .get('/3997.json') diff --git a/services/cpan/cpan-license.service.js b/services/cpan/cpan-license.service.js index bcf2433863fd8..ba3d4afe080ca 100644 --- a/services/cpan/cpan-license.service.js +++ b/services/cpan/cpan-license.service.js @@ -1,8 +1,6 @@ -'use strict' +import BaseCpanService from './cpan.js'; -const BaseCpanService = require('./cpan') - -module.exports = class CpanLicense extends BaseCpanService { +export default class CpanLicense extends BaseCpanService { static category = 'license' static route = { base: 'cpan/l', pattern: ':packageName' } @@ -27,4 +25,4 @@ module.exports = class CpanLicense extends BaseCpanService { const data = await this.fetch({ packageName }) return this.constructor.render({ license: data.license[0] }) } -} +}; diff --git a/services/cpan/cpan-license.tester.js b/services/cpan/cpan-license.tester.js index fb9f4dfa76dd0..c80135d892b78 100644 --- a/services/cpan/cpan-license.tester.js +++ b/services/cpan/cpan-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('license (valid)').get('/Config-Augeas.json').expectBadge({ label: 'license', diff --git a/services/cpan/cpan-version.service.js b/services/cpan/cpan-version.service.js index b54ec9c98899e..56c350c438583 100644 --- a/services/cpan/cpan-version.service.js +++ b/services/cpan/cpan-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import BaseCpanService from './cpan.js'; -const { renderVersionBadge } = require('../version') -const BaseCpanService = require('./cpan') - -module.exports = class CpanVersion extends BaseCpanService { +export default class CpanVersion extends BaseCpanService { static category = 'version' static route = { base: 'cpan/v', pattern: ':packageName' } @@ -20,4 +18,4 @@ module.exports = class CpanVersion extends BaseCpanService { const { version } = await this.fetch({ packageName }) return renderVersionBadge({ version }) } -} +}; diff --git a/services/cpan/cpan-version.tester.js b/services/cpan/cpan-version.tester.js index a9f6c31c3218c..86a03251531b2 100644 --- a/services/cpan/cpan-version.tester.js +++ b/services/cpan/cpan-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version (valid)').get('/Config-Augeas.json').expectBadge({ label: 'cpan', diff --git a/services/cpan/cpan.js b/services/cpan/cpan.js index 56af7786617a3..c848b5b4262bd 100644 --- a/services/cpan/cpan.js +++ b/services/cpan/cpan.js @@ -1,18 +1,16 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ version: Joi.alternatives(Joi.string().required(), Joi.number().required()), license: Joi.array().items(Joi.string()).min(1).required(), }).required() -module.exports = class BaseCpanService extends BaseJsonService { +export default class BaseCpanService extends BaseJsonService { static defaultBadgeData = { label: 'cpan' } async fetch({ packageName }) { const url = `https://fastapi.metacpan.org/v1/release/${packageName}` return this._requestJson({ schema, url }) } -} +}; diff --git a/services/cran/cran.service.js b/services/cran/cran.service.js index 850d6e976cdd4..dbee2875ff3b1 100644 --- a/services/cran/cran.service.js +++ b/services/cran/cran.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ License: Joi.string().required(), @@ -66,4 +64,4 @@ class CranVersion extends BaseCranService { } } -module.exports = { CranLicense, CranVersion } +export default { CranLicense, CranVersion }; diff --git a/services/cran/cran.tester.js b/services/cran/cran.tester.js index 3a1161e97ca34..026c60e671b9f 100644 --- a/services/cran/cran.tester.js +++ b/services/cran/cran.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isVPlusTripleDottedVersion} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isVPlusTripleDottedVersion } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'cran', - title: 'CRAN/METACRAN', -})) +const t = (function() { + export default __a; +}()) t.create('version (valid)').get('/v/devtools.json').expectBadge({ label: 'cran', diff --git a/services/crates/crates-base.js b/services/crates/crates-base.js index 855072761c4f6..f4a238cbc805b 100644 --- a/services/crates/crates-base.js +++ b/services/crates/crates-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const keywords = ['Rust'] @@ -51,4 +49,4 @@ class BaseCratesService extends BaseJsonService { } } -module.exports = { BaseCratesService, keywords } +export default { BaseCratesService, keywords }; diff --git a/services/crates/crates-downloads.service.js b/services/crates/crates-downloads.service.js index fd89ebcb53117..b009abbeb1957 100644 --- a/services/crates/crates-downloads.service.js +++ b/services/crates/crates-downloads.service.js @@ -1,11 +1,9 @@ -'use strict' +import {downloadCount as downloadCountColor} from '../color-formatters.js'; +import {metric} from '../text-formatters.js'; +import {InvalidParameter, NotFound} from '..'; +import {BaseCratesService, keywords} from './crates-base.js'; -const { downloadCount: downloadCountColor } = require('../color-formatters') -const { metric } = require('../text-formatters') -const { InvalidParameter, NotFound } = require('..') -const { BaseCratesService, keywords } = require('./crates-base') - -module.exports = class CratesDownloads extends BaseCratesService { +export default class CratesDownloads extends BaseCratesService { static category = 'downloads' static route = { base: 'crates', @@ -111,4 +109,4 @@ module.exports = class CratesDownloads extends BaseCratesService { return this.constructor.render({ variant, downloads, version }) } -} +}; diff --git a/services/crates/crates-downloads.tester.js b/services/crates/crates-downloads.tester.js index da064bf954759..544b7391de17f 100644 --- a/services/crates/crates-downloads.tester.js +++ b/services/crates/crates-downloads.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isMetric} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isMetric } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'crates', - title: 'crates.io', - pathPrefix: '/crates', -})) +const t = (function() { + export default __a; +}()) t.create('total downloads') .get('/d/libc.json') diff --git a/services/crates/crates-license.service.js b/services/crates/crates-license.service.js index bb12937c09bf4..b832db33b32c5 100644 --- a/services/crates/crates-license.service.js +++ b/services/crates/crates-license.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseCratesService, keywords} from './crates-base.js'; -const { BaseCratesService, keywords } = require('./crates-base') - -module.exports = class CratesLicense extends BaseCratesService { +export default class CratesLicense extends BaseCratesService { static category = 'license' static route = { base: 'crates/l', pattern: ':crate/:version?' } @@ -47,4 +45,4 @@ module.exports = class CratesLicense extends BaseCratesService { license: json.version ? json.version.license : json.versions[0].license, }) } -} +}; diff --git a/services/crates/crates-license.tester.js b/services/crates/crates-license.tester.js index 79d711034ea09..c72a6880b46aa 100644 --- a/services/crates/crates-license.tester.js +++ b/services/crates/crates-license.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'crates', - title: 'crates.io', - pathPrefix: '/crates/l', -})) +const t = (function() { + export default __a; +}()) t.create('license') .get('/libc.json') diff --git a/services/crates/crates-version.service.js b/services/crates/crates-version.service.js index 4f631dae9ecc9..1f00411b55159 100644 --- a/services/crates/crates-version.service.js +++ b/services/crates/crates-version.service.js @@ -1,10 +1,8 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {InvalidResponse} from '..'; +import {BaseCratesService, keywords} from './crates-base.js'; -const { renderVersionBadge } = require('../version') -const { InvalidResponse } = require('..') -const { BaseCratesService, keywords } = require('./crates-base') - -module.exports = class CratesVersion extends BaseCratesService { +export default class CratesVersion extends BaseCratesService { static category = 'version' static route = { base: 'crates/v', pattern: ':crate' } @@ -29,4 +27,4 @@ module.exports = class CratesVersion extends BaseCratesService { const { version } = this.transform(json) return renderVersionBadge({ version }) } -} +}; diff --git a/services/crates/crates-version.spec.js b/services/crates/crates-version.spec.js index 97898f6b8a4a3..3bb84d8a442bb 100644 --- a/services/crates/crates-version.spec.js +++ b/services/crates/crates-version.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { test, given } = require('sazerac') -const { expect } = require('chai') -const { InvalidResponse } = require('..') -const CratesVersion = require('./crates-version.service') +import {test, given} from 'sazerac'; +import {expect} from 'chai'; +import {InvalidResponse} from '..'; +import CratesVersion from './crates-version.service.js'; describe('CratesVersion', function () { test(CratesVersion.prototype.transform, () => { diff --git a/services/crates/crates-version.tester.js b/services/crates/crates-version.tester.js index 4fc19952d8bd0..f8edbbcc81e45 100644 --- a/services/crates/crates-version.tester.js +++ b/services/crates/crates-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version') .get('/libc.json') diff --git a/services/criterion/constants.js b/services/criterion/constants.js index 15d2c3041e4be..44f90f307d83e 100644 --- a/services/criterion/constants.js +++ b/services/criterion/constants.js @@ -1,8 +1,6 @@ -'use strict' - -module.exports = Object.freeze({ +export default Object.freeze({ IMPROVED_STATUS: 'improved', REGRESSED_STATUS: 'regressed', NO_CHANGE_STATUS: 'no change', NOT_FOUND_STATUS: 'no status found', -}) +}); diff --git a/services/criterion/criterion.service.js b/services/criterion/criterion.service.js index 0fd70f95db410..db715e55bae89 100644 --- a/services/criterion/criterion.service.js +++ b/services/criterion/criterion.service.js @@ -1,13 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { - IMPROVED_STATUS, - NOT_FOUND_STATUS, - REGRESSED_STATUS, - NO_CHANGE_STATUS, -} = require('./constants') +import Joi from 'joi'; +import {BaseJsonService} from '..'; +import {IMPROVED_STATUS, NOT_FOUND_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS} from './constants.js'; const schema = Joi.string() .allow(IMPROVED_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS) @@ -22,7 +15,7 @@ const schema = Joi.string() * API Documentation: * - https://app.swaggerhub.com/apis-docs/chmoder/Criterion.dev */ -module.exports = class Criterion extends BaseJsonService { +export default class Criterion extends BaseJsonService { static category = 'analysis' static route = { base: 'criterion', pattern: ':user/:repo' } @@ -65,4 +58,4 @@ module.exports = class Criterion extends BaseJsonService { return this.constructor.render({ status }) } -} +}; diff --git a/services/criterion/criterion.tester.js b/services/criterion/criterion.tester.js index f297d44d2492e..a3d5890bcff98 100644 --- a/services/criterion/criterion.tester.js +++ b/services/criterion/criterion.tester.js @@ -1,13 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { - IMPROVED_STATUS, - REGRESSED_STATUS, - NO_CHANGE_STATUS, - NOT_FOUND_STATUS, -} = require('./constants') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {IMPROVED_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS, NOT_FOUND_STATUS} from './constants.js'; const isStatus = Joi.string() .allow(IMPROVED_STATUS, REGRESSED_STATUS, NOT_FOUND_STATUS, NO_CHANGE_STATUS) diff --git a/services/ctan/ctan.service.js b/services/ctan/ctan.service.js index 4e8d95c3ee1fc..650dd00793eb9 100644 --- a/services/ctan/ctan.service.js +++ b/services/ctan/ctan.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { renderLicenseBadge } = require('../licenses') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderLicenseBadge} from '../licenses.js'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ license: Joi.array().items(Joi.string()).single(), @@ -73,7 +71,7 @@ class CtanVersion extends BaseCtanService { } } -module.exports = { +export default { CtanLicense, CtanVersion, -} +}; diff --git a/services/ctan/ctan.tester.js b/services/ctan/ctan.tester.js index 29268a604e2db..126670d58f90b 100644 --- a/services/ctan/ctan.tester.js +++ b/services/ctan/ctan.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'ctan', - title: 'Comprehensive TEX Archive Network', -})) +const t = (function() { + export default __a; +}()) t.create('license').get('/l/novel.json').expectBadge({ label: 'license', diff --git a/services/date/date.service.js b/services/date/date.service.js index d01f3f973ef5c..bc7beea41d610 100644 --- a/services/date/date.service.js +++ b/services/date/date.service.js @@ -1,7 +1,5 @@ -'use strict' - -const { formatRelativeDate } = require('../text-formatters') -const { BaseService } = require('..') +import {formatRelativeDate} from '../text-formatters.js'; +import {BaseService} from '..'; const documentation = `

@@ -9,7 +7,7 @@ const documentation = `

` -module.exports = class Date extends BaseService { +export default class Date extends BaseService { static category = 'other' static route = { base: 'date', pattern: ':timestamp([0-9]+)' } @@ -38,4 +36,4 @@ module.exports = class Date extends BaseService { relativeDateString: formatRelativeDate(timestamp), }) } -} +}; diff --git a/services/date/date.tester.js b/services/date/date.tester.js index 3e0135bd01d53..5fb085f80cb9c 100644 --- a/services/date/date.tester.js +++ b/services/date/date.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isRelativeFormattedDate} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isRelativeFormattedDate } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'date', - title: 'Relative Date Tests', -})) +const t = (function() { + export default __a; +}()) t.create('Relative date') .get('/1540814400.json') diff --git a/services/david/david.service.js b/services/david/david.service.js index 18f499aa8d471..22fa083f7fc14 100644 --- a/services/david/david.service.js +++ b/services/david/david.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ status: Joi.allow( @@ -40,7 +38,7 @@ const statusMap = { }, } -module.exports = class David extends BaseJsonService { +export default class David extends BaseJsonService { static category = 'dependencies' static route = { base: 'david', @@ -97,4 +95,4 @@ module.exports = class David extends BaseJsonService { const json = await this.fetch({ kind, user, repo, path }) return this.constructor.render({ status: json.status, kind }) } -} +}; diff --git a/services/david/david.tester.js b/services/david/david.tester.js index 275e702ab17e2..56f05ff8619d9 100644 --- a/services/david/david.tester.js +++ b/services/david/david.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isDependencyStatus = Joi.string().valid( 'insecure', diff --git a/services/debian/debian.service.js b/services/debian/debian.service.js index c113ca13e0d11..aef7030cf05c9 100644 --- a/services/debian/debian.service.js +++ b/services/debian/debian.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { latest, renderVersionBadge } = require('../version') -const { BaseJsonService, NotFound, InvalidResponse } = require('..') +import Joi from 'joi'; +import {latest, renderVersionBadge} from '../version.js'; +import {BaseJsonService, NotFound, InvalidResponse} from '..'; const schema = Joi.array() .items( @@ -18,7 +16,7 @@ const schema = Joi.array() const defaultDistribution = 'stable' -module.exports = class Debian extends BaseJsonService { +export default class Debian extends BaseJsonService { static category = 'version' static route = { base: 'debian/v', @@ -64,4 +62,4 @@ module.exports = class Debian extends BaseJsonService { const versions = Object.keys(packageData[distKeys[0]]) return renderVersionBadge({ version: latest(versions) }) } -} +}; diff --git a/services/debian/debian.tester.js b/services/debian/debian.tester.js index 046c31d1e184b..bd5573f2dea6b 100644 --- a/services/debian/debian.tester.js +++ b/services/debian/debian.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { - isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Debian package (default distribution, valid)') .get('/apt.json') diff --git a/services/debug/debug.service.js b/services/debug/debug.service.js index b24d61c671068..48d285a32bf06 100644 --- a/services/debug/debug.service.js +++ b/services/debug/debug.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { BaseService } = require('..') +import {BaseService} from '..'; const serverStartTime = new Date(new Date().toGMTString()) let bitFlip = false -module.exports = class Debug extends BaseService { +export default class Debug extends BaseService { static category = 'debug' static route = { base: 'debug', pattern: ':variant(time|starttime|flip)' } @@ -41,4 +39,4 @@ module.exports = class Debug extends BaseService { } } } -} +}; diff --git a/services/debug/debug.tester.js b/services/debug/debug.tester.js index 2885b9479d185..3e6725a20d045 100644 --- a/services/debug/debug.tester.js +++ b/services/debug/debug.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('start time') .get('/starttime.json') diff --git a/services/dependabot/dependabot.service.js b/services/dependabot/dependabot.service.js index f3e121f28d578..02fc6263b9eff 100644 --- a/services/dependabot/dependabot.service.js +++ b/services/dependabot/dependabot.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ status: Joi.string().required(), colour: Joi.string().required(), }) -module.exports = class DependabotSemverCompatibility extends BaseJsonService { +export default class DependabotSemverCompatibility extends BaseJsonService { static category = 'analysis' static route = { base: 'dependabot/semver', @@ -52,4 +50,4 @@ module.exports = class DependabotSemverCompatibility extends BaseJsonService { message: json.status, } } -} +}; diff --git a/services/dependabot/dependabot.tester.js b/services/dependabot/dependabot.tester.js index aa920d84d5276..4f9a68c4bddee 100644 --- a/services/dependabot/dependabot.tester.js +++ b/services/dependabot/dependabot.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('semver stability (valid)').get('/bundler/puma.json').expectBadge({ label: 'semver stability', diff --git a/services/depfu/depfu.service.js b/services/depfu/depfu.service.js index 8be46d36a41ea..378c900e0d89c 100644 --- a/services/depfu/depfu.service.js +++ b/services/depfu/depfu.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const depfuSchema = Joi.object({ text: Joi.string().required(), colorscheme: Joi.string().required(), }).required() -module.exports = class Depfu extends BaseJsonService { +export default class Depfu extends BaseJsonService { static category = 'dependencies' static route = { base: 'depfu', pattern: ':user/:repo' } static examples = [ @@ -40,4 +38,4 @@ module.exports = class Depfu extends BaseJsonService { const { text, colorscheme } = await this.fetch({ user, repo }) return this.constructor.render({ text, colorscheme }) } -} +}; diff --git a/services/depfu/depfu.tester.js b/services/depfu/depfu.tester.js index 957704f3c47cb..3b0044d4e1089 100644 --- a/services/depfu/depfu.tester.js +++ b/services/depfu/depfu.tester.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { ServiceTester } = require('../tester') +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; const isDependencyStatus = Joi.string().valid( 'insecure', @@ -10,7 +8,9 @@ const isDependencyStatus = Joi.string().valid( 'stale' ) -const t = (module.exports = new ServiceTester({ id: 'depfu', title: 'Depfu' })) +const t = (function() { + export default __a; +}()) t.create('depfu dependencies (valid)') .get('/depfu/example-ruby.json') diff --git a/services/deprecation-helpers.js b/services/deprecation-helpers.js index d01055bd004d8..943a5b9e18d08 100644 --- a/services/deprecation-helpers.js +++ b/services/deprecation-helpers.js @@ -1,6 +1,4 @@ -'use strict' - -const { Deprecated } = require('.') +import {Deprecated} from '.'; function enforceDeprecation(effectiveDate) { if (Date.now() >= effectiveDate.getTime()) { @@ -8,6 +6,6 @@ function enforceDeprecation(effectiveDate) { } } -module.exports = { +export default { enforceDeprecation, -} +}; diff --git a/services/deprecation-helpers.spec.js b/services/deprecation-helpers.spec.js index 63632cc7e0243..3cef2082d3bcf 100644 --- a/services/deprecation-helpers.spec.js +++ b/services/deprecation-helpers.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { Deprecated } = require('../core/base-service/errors') -const { enforceDeprecation } = require('./deprecation-helpers') +import {expect} from 'chai'; +import {Deprecated} from '../core/base-service/errors.js'; +import {enforceDeprecation} from './deprecation-helpers.js'; describe('enforceDeprecation', function () { it('throws Deprecated for a date in the past', function () { diff --git a/services/discord/discord.service.js b/services/discord/discord.service.js index 7e510d0cad047..46f54001a9805 100644 --- a/services/discord/discord.service.js +++ b/services/discord/discord.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ presence_count: nonNegativeInteger, @@ -24,7 +22,7 @@ const documentation = ` ` -module.exports = class Discord extends BaseJsonService { +export default class Discord extends BaseJsonService { static category = 'chat' static route = { @@ -79,4 +77,4 @@ module.exports = class Discord extends BaseJsonService { const data = await this.fetch({ serverId }) return this.constructor.render({ members: data.presence_count }) } -} +}; diff --git a/services/discord/discord.spec.js b/services/discord/discord.spec.js index 926ac9859da35..7abe355cc7eaa 100644 --- a/services/discord/discord.spec.js +++ b/services/discord/discord.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const Discord = require('./discord.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import Discord from './discord.service.js'; describe('Discord', function () { cleanUpNockAfterEach() diff --git a/services/discord/discord.tester.js b/services/discord/discord.tester.js index 694775133a684..38283b7895077 100644 --- a/services/discord/discord.tester.js +++ b/services/discord/discord.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('gets status for Reactiflux') .get('/102860784329052160.json') diff --git a/services/discourse/discourse-redirect.service.js b/services/discourse/discourse-redirect.service.js index 72d265fe109e7..8ecf1434a9bcd 100644 --- a/services/discourse/discourse-redirect.service.js +++ b/services/discourse/discourse-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'chat', route: { @@ -15,4 +13,4 @@ module.exports = [ }), dateAdded: new Date('2019-09-15'), }), -] +]; diff --git a/services/discourse/discourse-redirect.tester.js b/services/discourse/discourse-redirect.tester.js index 772eb3465873a..1158c18682ba0 100644 --- a/services/discourse/discourse-redirect.tester.js +++ b/services/discourse/discourse-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'DiscourseRedirect', - title: 'DiscourseRedirect', - pathPrefix: '/discourse', -})) +const t = (function() { + export default __a; +}()) t.create('discourse status') .get('/https/meta.discourse.org/status.svg') diff --git a/services/discourse/discourse.service.js b/services/discourse/discourse.service.js index 7037fca298b97..d9244356bd223 100644 --- a/services/discourse/discourse.service.js +++ b/services/discourse/discourse.service.js @@ -1,10 +1,8 @@ -'use strict' - -const camelcase = require('camelcase') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger, optionalUrl } = require('../validators') -const { BaseJsonService } = require('..') +import camelcase from 'camelcase'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger, optionalUrl} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ topic_count: nonNegativeInteger, @@ -105,4 +103,4 @@ const metricIntegrations = [ { metricName: 'likes', property: 'like_count' }, ].map(DiscourseMetricIntegrationFactory) -module.exports = [...metricIntegrations, DiscourseStatus] +export default [...metricIntegrations, DiscourseStatus]; diff --git a/services/discourse/discourse.tester.js b/services/discourse/discourse.tester.js index a074fe85e8dab..fda5c3655e993 100644 --- a/services/discourse/discourse.tester.js +++ b/services/discourse/discourse.tester.js @@ -1,12 +1,9 @@ -'use strict' +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; -const Joi = require('joi') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'discourse', - title: 'Discourse', -})) +const t = (function() { + export default __a; +}()) const data = { topic_count: 22513, diff --git a/services/dockbit/dockbit.service.js b/services/dockbit/dockbit.service.js index f8b2e9028487b..7dc0515cffc27 100644 --- a/services/dockbit/dockbit.service.js +++ b/services/dockbit/dockbit.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'build', route: { base: 'dockbit', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'dockbit', dateAdded: new Date('2017-12-31'), -}) +}); diff --git a/services/dockbit/dockbit.tester.js b/services/dockbit/dockbit.tester.js index 4d9ef389a8321..30fe285c90b0c 100644 --- a/services/dockbit/dockbit.tester.js +++ b/services/dockbit/dockbit.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'dockbit', - title: 'Dockbit', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously image size)') .get('/image-size/_/ubuntu/latest.json') diff --git a/services/docker/docker-automated.service.js b/services/docker/docker-automated.service.js index c48a57d63a730..60689900d79b4 100644 --- a/services/docker/docker-automated.service.js +++ b/services/docker/docker-automated.service.js @@ -1,18 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { - dockerBlue, - buildDockerUrl, - getDockerHubUser, -} = require('./docker-helpers') +import Joi from 'joi'; +import {BaseJsonService} from '..'; +import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; const automatedBuildSchema = Joi.object({ is_automated: Joi.boolean().required(), }).required() -module.exports = class DockerAutomatedBuild extends BaseJsonService { +export default class DockerAutomatedBuild extends BaseJsonService { static category = 'build' static route = buildDockerUrl('automated') static examples = [ @@ -50,4 +44,4 @@ module.exports = class DockerAutomatedBuild extends BaseJsonService { const data = await this.fetch({ user, repo }) return this.constructor.render({ isAutomated: data.is_automated }) } -} +}; diff --git a/services/docker/docker-automated.tester.js b/services/docker/docker-automated.tester.js index 4cc144d7ceb9a..c8765ce0e4d82 100644 --- a/services/docker/docker-automated.tester.js +++ b/services/docker/docker-automated.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { dockerBlue } = require('./docker-helpers') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {dockerBlue} from './docker-helpers.js'; const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-build.service.js b/services/docker/docker-build.service.js index c98d5ada68863..3eba72c8be260 100644 --- a/services/docker/docker-build.service.js +++ b/services/docker/docker-build.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'build', route: { base: 'docker/build', diff --git a/services/docker/docker-build.tester.js b/services/docker/docker-build.tester.js index efc4fb259791f..8d4caa2f7c75d 100644 --- a/services/docker/docker-build.tester.js +++ b/services/docker/docker-build.tester.js @@ -1,6 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') +const t = (function() { + export default __a; +}()) const t = (module.exports = new ServiceTester({ id: 'dockerbuild', diff --git a/services/docker/docker-cloud-automated.service.js b/services/docker/docker-cloud-automated.service.js index 8fc27256d2d89..56d5a4ed37280 100644 --- a/services/docker/docker-cloud-automated.service.js +++ b/services/docker/docker-cloud-automated.service.js @@ -1,10 +1,8 @@ -'use strict' +import {BaseJsonService} from '..'; +import {dockerBlue, buildDockerUrl} from './docker-helpers.js'; +import {fetchBuild} from './docker-cloud-common-fetch.js'; -const { BaseJsonService } = require('..') -const { dockerBlue, buildDockerUrl } = require('./docker-helpers') -const { fetchBuild } = require('./docker-cloud-common-fetch') - -module.exports = class DockerCloudAutomatedBuild extends BaseJsonService { +export default class DockerCloudAutomatedBuild extends BaseJsonService { static category = 'build' static route = buildDockerUrl('cloud/automated') static examples = [ @@ -34,4 +32,4 @@ module.exports = class DockerCloudAutomatedBuild extends BaseJsonService { buildSettings: data.objects[0].build_settings, }) } -} +}; diff --git a/services/docker/docker-cloud-automated.tester.js b/services/docker/docker-cloud-automated.tester.js index 22d508dcc3be2..08c477edc3b71 100644 --- a/services/docker/docker-cloud-automated.tester.js +++ b/services/docker/docker-cloud-automated.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { dockerBlue } = require('./docker-helpers') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {dockerBlue} from './docker-helpers.js'; const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-cloud-build.service.js b/services/docker/docker-cloud-build.service.js index d40b058250729..1456ecfe90596 100644 --- a/services/docker/docker-cloud-build.service.js +++ b/services/docker/docker-cloud-build.service.js @@ -1,10 +1,8 @@ -'use strict' +import {BaseJsonService} from '..'; +import {dockerBlue, buildDockerUrl} from './docker-helpers.js'; +import {fetchBuild} from './docker-cloud-common-fetch.js'; -const { BaseJsonService } = require('..') -const { dockerBlue, buildDockerUrl } = require('./docker-helpers') -const { fetchBuild } = require('./docker-cloud-common-fetch') - -module.exports = class DockerCloudBuild extends BaseJsonService { +export default class DockerCloudBuild extends BaseJsonService { static category = 'build' static route = buildDockerUrl('cloud/build') static examples = [ @@ -35,4 +33,4 @@ module.exports = class DockerCloudBuild extends BaseJsonService { const data = await fetchBuild(this, { user, repo }) return this.constructor.render({ state: data.objects[0].state }) } -} +}; diff --git a/services/docker/docker-cloud-build.tester.js b/services/docker/docker-cloud-build.tester.js index 59a8f8ef7223d..82783d57f6278 100644 --- a/services/docker/docker-cloud-build.tester.js +++ b/services/docker/docker-cloud-build.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) -const { dockerBlue } = require('./docker-helpers') +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) +import {dockerBlue} from './docker-helpers.js'; t.create('docker cloud build status (valid, user)') .get('/jrottenberg/ffmpeg.json') diff --git a/services/docker/docker-cloud-common-fetch.js b/services/docker/docker-cloud-common-fetch.js index 8ac3db1fa4f69..ff4a382eb76cb 100644 --- a/services/docker/docker-cloud-common-fetch.js +++ b/services/docker/docker-cloud-common-fetch.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; const cloudBuildSchema = Joi.object({ objects: Joi.array() @@ -22,6 +20,6 @@ async function fetchBuild(serviceInstance, { user, repo }) { }) } -module.exports = { +export default { fetchBuild, -} +}; diff --git a/services/docker/docker-fixtures.js b/services/docker/docker-fixtures.js index de97cf00b8c3a..98e151e09d68d 100644 --- a/services/docker/docker-fixtures.js +++ b/services/docker/docker-fixtures.js @@ -1,5 +1,3 @@ -'use strict' - const sizeDataNoTagSemVerSort = [ { name: 'master', full_size: 13449470 }, { name: 'feature-smtps-support', full_size: 13449638 }, @@ -3035,11 +3033,11 @@ const versionDataWithVaryingArchitectures = [ { name: '2.6', images: [] }, ] -module.exports = { +export default { sizeDataNoTagSemVerSort, versionDataNoTagDateSort, versionPagedDataNoTagDateSort, versionDataNoTagSemVerSort, versionDataWithTag, versionDataWithVaryingArchitectures, -} +}; diff --git a/services/docker/docker-helpers.js b/services/docker/docker-helpers.js index 87908b00f436a..41562dfb88065 100644 --- a/services/docker/docker-helpers.js +++ b/services/docker/docker-helpers.js @@ -1,7 +1,5 @@ -'use strict' - const dockerBlue = '066da5' // see https://github.com/badges/shields/pull/1690 -const { NotFound } = require('..') +import {NotFound} from '..'; function buildDockerUrl(badgeName, includeTagRoute) { if (includeTagRoute) { @@ -55,10 +53,10 @@ function getDigestSemVerMatches({ data, digest }) { return version } -module.exports = { +export default { dockerBlue, buildDockerUrl, getDockerHubUser, getMultiPageData, getDigestSemVerMatches, -} +}; diff --git a/services/docker/docker-pulls.service.js b/services/docker/docker-pulls.service.js index 5749215cac8ca..fd10a1c2a0e66 100644 --- a/services/docker/docker-pulls.service.js +++ b/services/docker/docker-pulls.service.js @@ -1,20 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') -const { - dockerBlue, - buildDockerUrl, - getDockerHubUser, -} = require('./docker-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; +import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; const pullsSchema = Joi.object({ pull_count: nonNegativeInteger, }).required() -module.exports = class DockerPulls extends BaseJsonService { +export default class DockerPulls extends BaseJsonService { static category = 'downloads' static route = buildDockerUrl('pulls') static examples = [ @@ -51,4 +45,4 @@ module.exports = class DockerPulls extends BaseJsonService { const data = await this.fetch({ user, repo }) return this.constructor.render({ count: data.pull_count }) } -} +}; diff --git a/services/docker/docker-pulls.tester.js b/services/docker/docker-pulls.tester.js index cdf55b257441a..93d95b7baf543 100644 --- a/services/docker/docker-pulls.tester.js +++ b/services/docker/docker-pulls.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) -const { dockerBlue } = require('./docker-helpers') +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) +import {dockerBlue} from './docker-helpers.js'; t.create('docker pulls (valid, library)') .get('/_/ubuntu.json') diff --git a/services/docker/docker-size.service.js b/services/docker/docker-size.service.js index 14ed46232fc10..cdc3edb32908b 100644 --- a/services/docker/docker-size.service.js +++ b/services/docker/docker-size.service.js @@ -1,15 +1,9 @@ -'use strict' - -const Joi = require('joi') -const prettyBytes = require('pretty-bytes') -const { nonNegativeInteger } = require('../validators') -const { latest } = require('../version') -const { BaseJsonService, NotFound } = require('..') -const { - buildDockerUrl, - getDockerHubUser, - getMultiPageData, -} = require('./docker-helpers') +import Joi from 'joi'; +import prettyBytes from 'pretty-bytes'; +import {nonNegativeInteger} from '../validators.js'; +import {latest} from '../version.js'; +import {BaseJsonService, NotFound} from '..'; +import {buildDockerUrl, getDockerHubUser, getMultiPageData} from './docker-helpers.js'; const buildSchema = Joi.object({ name: Joi.string().required(), @@ -30,7 +24,7 @@ const queryParamSchema = Joi.object({ sort: Joi.string().valid('date', 'semver').default('date'), }).required() -module.exports = class DockerSize extends BaseJsonService { +export default class DockerSize extends BaseJsonService { static category = 'size' static route = { ...buildDockerUrl('image-size', true), queryParamSchema } static examples = [ @@ -116,4 +110,4 @@ module.exports = class DockerSize extends BaseJsonService { const { size } = await this.transform({ tag, sort, data }) return this.constructor.render({ size }) } -} +}; diff --git a/services/docker/docker-size.spec.js b/services/docker/docker-size.spec.js index 56857c5fa7e61..44b881965eee0 100644 --- a/services/docker/docker-size.spec.js +++ b/services/docker/docker-size.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { test, given } = require('sazerac') -const DockerSize = require('./docker-size.service') -const { sizeDataNoTagSemVerSort } = require('./docker-fixtures') +import {test, given} from 'sazerac'; +import DockerSize from './docker-size.service.js'; +import {sizeDataNoTagSemVerSort} from './docker-fixtures.js'; describe('DockerSize', function () { test(DockerSize.prototype.transform, () => { diff --git a/services/docker/docker-size.tester.js b/services/docker/docker-size.tester.js index 6707e88967ab8..e948478941920 100644 --- a/services/docker/docker-size.tester.js +++ b/services/docker/docker-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('docker image size (valid, library)') .get('/_/alpine.json') diff --git a/services/docker/docker-stars.service.js b/services/docker/docker-stars.service.js index aec79700c9b9d..f8ef7955389d1 100644 --- a/services/docker/docker-stars.service.js +++ b/services/docker/docker-stars.service.js @@ -1,15 +1,9 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseService} from '..'; +import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseService } = require('..') -const { - dockerBlue, - buildDockerUrl, - getDockerHubUser, -} = require('./docker-helpers') - -module.exports = class DockerStars extends BaseService { +export default class DockerStars extends BaseService { static category = 'rating' static route = buildDockerUrl('stars') static examples = [ @@ -47,4 +41,4 @@ module.exports = class DockerStars extends BaseService { const stars = await this.fetch({ user, repo }) return this.constructor.render({ stars }) } -} +}; diff --git a/services/docker/docker-stars.tester.js b/services/docker/docker-stars.tester.js index 9a732e8564316..2a892d6efed79 100644 --- a/services/docker/docker-stars.tester.js +++ b/services/docker/docker-stars.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) -const { dockerBlue } = require('./docker-helpers') +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) +import {dockerBlue} from './docker-helpers.js'; t.create('docker stars (valid, library)') .get('/_/ubuntu.json') diff --git a/services/docker/docker-version.service.js b/services/docker/docker-version.service.js index 88eabde175b42..64f60b231a4c3 100644 --- a/services/docker/docker-version.service.js +++ b/services/docker/docker-version.service.js @@ -1,15 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { latest, renderVersionBadge } = require('../version') -const { BaseJsonService, NotFound, InvalidResponse } = require('..') -const { - buildDockerUrl, - getDockerHubUser, - getMultiPageData, - getDigestSemVerMatches, -} = require('./docker-helpers') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {latest, renderVersionBadge} from '../version.js'; +import {BaseJsonService, NotFound, InvalidResponse} from '..'; +import {buildDockerUrl, getDockerHubUser, getMultiPageData, getDigestSemVerMatches} from './docker-helpers.js'; const buildSchema = Joi.object({ count: nonNegativeInteger.required(), @@ -47,7 +40,7 @@ const queryParamSchema = Joi.object({ .default('amd64'), }).required() -module.exports = class DockerVersion extends BaseJsonService { +export default class DockerVersion extends BaseJsonService { static category = 'version' static route = { ...buildDockerUrl('v', true), queryParamSchema } static examples = [ @@ -160,4 +153,4 @@ module.exports = class DockerVersion extends BaseJsonService { }) return this.constructor.render({ version }) } -} +}; diff --git a/services/docker/docker-version.spec.js b/services/docker/docker-version.spec.js index 15fdab400f5fc..499e3c690a82a 100644 --- a/services/docker/docker-version.spec.js +++ b/services/docker/docker-version.spec.js @@ -1,16 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { InvalidResponse } = require('..') -const DockerVersion = require('./docker-version.service') -const { - versionDataNoTagDateSort, - versionPagedDataNoTagDateSort, - versionDataNoTagSemVerSort, - versionDataWithTag, - versionDataWithVaryingArchitectures, -} = require('./docker-fixtures') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {InvalidResponse} from '..'; +import DockerVersion from './docker-version.service.js'; +import {versionDataNoTagDateSort, versionPagedDataNoTagDateSort, versionDataNoTagSemVerSort, versionDataWithTag, versionDataWithVaryingArchitectures} from './docker-fixtures.js'; describe('DockerVersion', function () { test(DockerVersion.prototype.transform, () => { diff --git a/services/docker/docker-version.tester.js b/services/docker/docker-version.tester.js index 46ebefdac650a..cc233e90daf3d 100644 --- a/services/docker/docker-version.tester.js +++ b/services/docker/docker-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemVer } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemVer} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('docker version (valid, library)').get('/_/alpine.json').expectBadge({ label: 'version', diff --git a/services/docsrs/docsrs.service.js b/services/docsrs/docsrs.service.js index 309eb6ba41468..5267fac1835a6 100644 --- a/services/docsrs/docsrs.service.js +++ b/services/docsrs/docsrs.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.array() .items( @@ -12,7 +10,7 @@ const schema = Joi.array() .min(1) .required() -module.exports = class DocsRs extends BaseJsonService { +export default class DocsRs extends BaseJsonService { static category = 'build' static route = { base: 'docsrs', pattern: ':crate/:version?' } static examples = [ @@ -59,4 +57,4 @@ module.exports = class DocsRs extends BaseJsonService { ).pop() return this.constructor.render({ version, buildStatus }) } -} +}; diff --git a/services/docsrs/docsrs.tester.js b/services/docsrs/docsrs.tester.js index 0e7c566bfcbc7..9c8cce053174c 100644 --- a/services/docsrs/docsrs.tester.js +++ b/services/docsrs/docsrs.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('Passing docs') .get('/tokio/0.3.0.json') diff --git a/services/dotnetstatus/dotnetstatus.service.js b/services/dotnetstatus/dotnetstatus.service.js index 11a7918cc9801..11f1df47d27ec 100644 --- a/services/dotnetstatus/dotnetstatus.service.js +++ b/services/dotnetstatus/dotnetstatus.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'dependencies', route: { base: 'dotnetstatus', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'dotnet status', dateAdded: new Date('2018-04-01'), -}) +}); diff --git a/services/dotnetstatus/dotnetstatus.tester.js b/services/dotnetstatus/dotnetstatus.tester.js index e2b0ea1b33520..7a71278b79fa3 100644 --- a/services/dotnetstatus/dotnetstatus.tester.js +++ b/services/dotnetstatus/dotnetstatus.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'dotnetstatus', - title: 'dotnet-status', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously get package status)') .get('/gh/jaredcnance/dotnet-status/API.json') diff --git a/services/drone/drone-build.service.js b/services/drone/drone-build.service.js index 13aaa0721d5d6..5691ddab9ca96 100644 --- a/services/drone/drone-build.service.js +++ b/services/drone/drone-build.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { optionalUrl } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {optionalUrl} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ status: Joi.alternatives() @@ -15,7 +13,7 @@ const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class DroneBuild extends BaseJsonService { +export default class DroneBuild extends BaseJsonService { static category = 'build' static route = { base: 'drone/build', @@ -84,4 +82,4 @@ module.exports = class DroneBuild extends BaseJsonService { ) return renderBuildStatusBadge({ status: json.status }) } -} +}; diff --git a/services/drone/drone-build.spec.js b/services/drone/drone-build.spec.js index dc0b914fa521f..d5d59c8890579 100644 --- a/services/drone/drone-build.spec.js +++ b/services/drone/drone-build.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const DroneBuild = require('./drone-build.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import DroneBuild from './drone-build.service.js'; describe('DroneBuild', function () { cleanUpNockAfterEach() diff --git a/services/drone/drone-build.tester.js b/services/drone/drone-build.tester.js index 59882a0089139..e77ecfbd08e99 100644 --- a/services/drone/drone-build.tester.js +++ b/services/drone/drone-build.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) const isDroneBuildStatus = Joi.alternatives().try( isBuildStatus, diff --git a/services/dub/dub-download.service.js b/services/dub/dub-download.service.js index 3c050bc5d901b..96e4c945880b8 100644 --- a/services/dub/dub-download.service.js +++ b/services/dub/dub-download.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { downloadCount: downloadCountColor } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {downloadCount as downloadCountColor} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ downloads: Joi.object({ @@ -34,7 +32,7 @@ const intervalMap = { }, } -module.exports = class DubDownloads extends BaseJsonService { +export default class DubDownloads extends BaseJsonService { static category = 'downloads' static route = { base: 'dub', @@ -103,4 +101,4 @@ module.exports = class DubDownloads extends BaseJsonService { const downloadCount = transform(json) return this.constructor.render({ interval, downloadCount, version }) } -} +}; diff --git a/services/dub/dub-download.tester.js b/services/dub/dub-download.tester.js index 423c091513206..d5af16449a867 100644 --- a/services/dub/dub-download.tester.js +++ b/services/dub/dub-download.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isMetric, isMetricOverTimePeriod } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const isDownloadsColor = Joi.equal( 'red', diff --git a/services/dub/dub-license.service.js b/services/dub/dub-license.service.js index 62f99a0cf2823..bf814e06f296b 100644 --- a/services/dub/dub-license.service.js +++ b/services/dub/dub-license.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { renderLicenseBadge } = require('../licenses') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderLicenseBadge} from '../licenses.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ info: Joi.object({ license: Joi.string().required() }).required(), }) -module.exports = class DubLicense extends BaseJsonService { +export default class DubLicense extends BaseJsonService { static category = 'license' static route = { base: 'dub/l', pattern: ':packageName' } static examples = [ @@ -32,4 +30,4 @@ module.exports = class DubLicense extends BaseJsonService { const data = await this.fetch({ packageName }) return renderLicenseBadge({ licenses: [data.info.license] }) } -} +}; diff --git a/services/dub/dub-license.tester.js b/services/dub/dub-license.tester.js index f40797ac530f0..cc2c9db2da3d0 100644 --- a/services/dub/dub-license.tester.js +++ b/services/dub/dub-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('license (valid)') .get('/vibe-d.json') diff --git a/services/dub/dub-version.service.js b/services/dub/dub-version.service.js index 8aeced3af4739..ab4788e3f99ac 100644 --- a/services/dub/dub-version.service.js +++ b/services/dub/dub-version.service.js @@ -1,12 +1,10 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.string().required() -module.exports = class DubVersion extends BaseJsonService { +export default class DubVersion extends BaseJsonService { static category = 'version' static route = { base: 'dub/v', pattern: ':packageName' } static examples = [ @@ -30,4 +28,4 @@ module.exports = class DubVersion extends BaseJsonService { const version = await this.fetch({ packageName }) return renderVersionBadge({ version }) } -} +}; diff --git a/services/dub/dub-version.tester.js b/services/dub/dub-version.tester.js index 972c7256e377c..6cb040cf5d183 100644 --- a/services/dub/dub-version.tester.js +++ b/services/dub/dub-version.tester.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version (valid)') .get('/vibe-d.json') diff --git a/services/dynamic-common.js b/services/dynamic-common.js index 292c84964e115..8363f3b04d4bf 100644 --- a/services/dynamic-common.js +++ b/services/dynamic-common.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const toArray = require('../core/base-service/to-array') -const validate = require('../core/base-service/validate') -const { InvalidResponse } = require('.') +import Joi from 'joi'; +import toArray from '../core/base-service/to-array.js'; +import validate from '../core/base-service/validate.js'; +import {InvalidResponse} from '.'; const errorMessages = { 404: 'resource not found', @@ -48,9 +46,9 @@ function renderDynamicBadge({ } } -module.exports = { +export default { errorMessages, individualValueSchema, transformAndValidate, renderDynamicBadge, -} +}; diff --git a/services/dynamic/dynamic-helpers.js b/services/dynamic/dynamic-helpers.js index 6921857674490..6866dbbb86144 100644 --- a/services/dynamic/dynamic-helpers.js +++ b/services/dynamic/dynamic-helpers.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; const queryParamSchema = Joi.object({ url: optionalUrl.required(), @@ -20,6 +18,6 @@ function createRoute(which) { } } -module.exports = { +export default { createRoute, -} +}; diff --git a/services/dynamic/dynamic-json.service.js b/services/dynamic/dynamic-json.service.js index 337fe66d2ded0..c4238751a2b17 100644 --- a/services/dynamic/dynamic-json.service.js +++ b/services/dynamic/dynamic-json.service.js @@ -1,11 +1,9 @@ -'use strict' +import {MetricNames} from '../../core/base-service/metric-helper.js'; +import {BaseJsonService} from '..'; +import {createRoute} from './dynamic-helpers.js'; +import jsonPath from './json-path.js'; -const { MetricNames } = require('../../core/base-service/metric-helper') -const { BaseJsonService } = require('..') -const { createRoute } = require('./dynamic-helpers') -const jsonPath = require('./json-path') - -module.exports = class DynamicJson extends jsonPath(BaseJsonService) { +export default class DynamicJson extends jsonPath(BaseJsonService) { static enabledMetrics = [MetricNames.SERVICE_RESPONSE_SIZE] static route = createRoute('json') @@ -16,4 +14,4 @@ module.exports = class DynamicJson extends jsonPath(BaseJsonService) { errorMessages, }) } -} +}; diff --git a/services/dynamic/dynamic-json.tester.js b/services/dynamic/dynamic-json.tester.js index d36dda48a30e4..9d6984a770b5c 100644 --- a/services/dynamic/dynamic-json.tester.js +++ b/services/dynamic/dynamic-json.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { expect } = require('chai') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {expect} from 'chai'; +const t = (function() { + export default __a; +}()) t.create('No URL specified') .get('.json?query=$.name&label=Package Name') diff --git a/services/dynamic/dynamic-response-fixtures.js b/services/dynamic/dynamic-response-fixtures.js index 25af9ff15ad56..15df94a0f30e8 100644 --- a/services/dynamic/dynamic-response-fixtures.js +++ b/services/dynamic/dynamic-response-fixtures.js @@ -1,6 +1,4 @@ -'use strict' - -module.exports = { +export default { exampleXml: ` @@ -122,4 +120,4 @@ module.exports = { `, -} +}; diff --git a/services/dynamic/dynamic-xml.service.js b/services/dynamic/dynamic-xml.service.js index 9c14c59649740..66379708a5012 100644 --- a/services/dynamic/dynamic-xml.service.js +++ b/services/dynamic/dynamic-xml.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { DOMParser } = require('xmldom') -const xpath = require('xpath') -const { MetricNames } = require('../../core/base-service/metric-helper') -const { renderDynamicBadge, errorMessages } = require('../dynamic-common') -const { BaseService, InvalidResponse, InvalidParameter } = require('..') -const { createRoute } = require('./dynamic-helpers') +import {DOMParser} from 'xmldom'; +import xpath from 'xpath'; +import {MetricNames} from '../../core/base-service/metric-helper.js'; +import {renderDynamicBadge, errorMessages} from '../dynamic-common.js'; +import {BaseService, InvalidResponse, InvalidParameter} from '..'; +import {createRoute} from './dynamic-helpers.js'; // This service extends BaseService because it uses a different XML parser // than BaseXmlService which can be used with xpath. @@ -13,7 +11,7 @@ const { createRoute } = require('./dynamic-helpers') // One way to create a more performant version would be to use the BaseXml // JSON parser and write the queries in jsonpath instead. Then eventually // deprecate the old version. -module.exports = class DynamicXml extends BaseService { +export default class DynamicXml extends BaseService { static category = 'dynamic' static enabledMetrics = [MetricNames.SERVICE_RESPONSE_SIZE] static route = createRoute('xml') @@ -78,4 +76,4 @@ module.exports = class DynamicXml extends BaseService { return renderDynamicBadge({ value, prefix, suffix }) } -} +}; diff --git a/services/dynamic/dynamic-xml.spec.js b/services/dynamic/dynamic-xml.spec.js index 7987164cacb2a..61c767f3faa06 100644 --- a/services/dynamic/dynamic-xml.spec.js +++ b/services/dynamic/dynamic-xml.spec.js @@ -1,11 +1,9 @@ -'use strict' - -const { expect } = require('chai') -const sinon = require('sinon') -const xpath = require('xpath') -const { test, given } = require('sazerac') -const { InvalidResponse } = require('..') -const DynamicXml = require('./dynamic-xml.service') +import {expect} from 'chai'; +import sinon from 'sinon'; +import xpath from 'xpath'; +import {test, given} from 'sazerac'; +import {InvalidResponse} from '..'; +import DynamicXml from './dynamic-xml.service.js'; const exampleXml = ` diff --git a/services/dynamic/dynamic-xml.tester.js b/services/dynamic/dynamic-xml.tester.js index d0b76cef41e0d..bd3cd12fb07dd 100644 --- a/services/dynamic/dynamic-xml.tester.js +++ b/services/dynamic/dynamic-xml.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const queryString = require('query-string') -const t = (module.exports = require('../tester').createServiceTester()) -const { exampleXml } = require('./dynamic-response-fixtures') +import queryString from 'query-string'; +const t = (function() { + export default __a; +}()) +import {exampleXml} from './dynamic-response-fixtures.js'; const exampleUrl = 'https://example.test/example.xml' const withExampleXml = nock => diff --git a/services/dynamic/dynamic-yaml.service.js b/services/dynamic/dynamic-yaml.service.js index a77471708606b..2e7ad757bf4d6 100644 --- a/services/dynamic/dynamic-yaml.service.js +++ b/services/dynamic/dynamic-yaml.service.js @@ -1,11 +1,9 @@ -'use strict' +import {MetricNames} from '../../core/base-service/metric-helper.js'; +import {BaseYamlService} from '..'; +import {createRoute} from './dynamic-helpers.js'; +import jsonPath from './json-path.js'; -const { MetricNames } = require('../../core/base-service/metric-helper') -const { BaseYamlService } = require('..') -const { createRoute } = require('./dynamic-helpers') -const jsonPath = require('./json-path') - -module.exports = class DynamicYaml extends jsonPath(BaseYamlService) { +export default class DynamicYaml extends jsonPath(BaseYamlService) { static enabledMetrics = [MetricNames.SERVICE_RESPONSE_SIZE] static route = createRoute('yaml') @@ -16,4 +14,4 @@ module.exports = class DynamicYaml extends jsonPath(BaseYamlService) { errorMessages, }) } -} +}; diff --git a/services/dynamic/dynamic-yaml.tester.js b/services/dynamic/dynamic-yaml.tester.js index cb04be8bcf2e2..2e3f418995d4f 100644 --- a/services/dynamic/dynamic-yaml.tester.js +++ b/services/dynamic/dynamic-yaml.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('No URL specified') .get('.json?query=$.name&label=Package Name') diff --git a/services/dynamic/json-path.js b/services/dynamic/json-path.js index 9797e81673650..82fb867768367 100644 --- a/services/dynamic/json-path.js +++ b/services/dynamic/json-path.js @@ -2,12 +2,10 @@ * @module */ -'use strict' - -const Joi = require('joi') -const jp = require('jsonpath') -const { renderDynamicBadge, errorMessages } = require('../dynamic-common') -const { InvalidParameter, InvalidResponse } = require('..') +import Joi from 'joi'; +import jp from 'jsonpath'; +import {renderDynamicBadge, errorMessages} from '../dynamic-common.js'; +import {InvalidParameter, InvalidResponse} from '..'; /** * Dynamic service class factory which wraps {@link module:core/base-service/base~BaseService} with support of {@link https://jsonpath.com/|JSONPath}. @@ -15,8 +13,8 @@ const { InvalidParameter, InvalidResponse } = require('..') * @param {Function} superclass class to extend * @returns {Function} wrapped class */ -module.exports = superclass => - class extends superclass { +export default superclass => + (class extends superclass { static category = 'dynamic' static defaultBadgeData = { label: 'custom badge' } @@ -77,4 +75,4 @@ module.exports = superclass => return renderDynamicBadge({ value: values, prefix, suffix }) } - } + }); diff --git a/services/dynamic/json-path.spec.js b/services/dynamic/json-path.spec.js index ca30499f8ec31..14d4894e8c9b7 100644 --- a/services/dynamic/json-path.spec.js +++ b/services/dynamic/json-path.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const chai = require('chai') +import chai from 'chai'; const { expect } = chai -const jsonPath = require('./json-path') +import jsonPath from './json-path.js'; chai.use(require('chai-as-promised')) diff --git a/services/eclipse-marketplace/eclipse-marketplace-base.js b/services/eclipse-marketplace/eclipse-marketplace-base.js index fd8c5387b04f0..6d4158829694f 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-base.js +++ b/services/eclipse-marketplace/eclipse-marketplace-base.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseXmlService} from '..'; -const { BaseXmlService } = require('..') - -module.exports = class EclipseMarketplaceBase extends BaseXmlService { +export default class EclipseMarketplaceBase extends BaseXmlService { static buildRoute(base) { return { base, @@ -17,4 +15,4 @@ module.exports = class EclipseMarketplaceBase extends BaseXmlService { errorMessages: { 404: 'solution not found' }, }) } -} +}; diff --git a/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js b/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js index ae4fb3fa39242..54ddc0f511df8 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { downloadCount: downloadCountColor } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const EclipseMarketplaceBase = require('./eclipse-marketplace-base') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {downloadCount as downloadCountColor} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; const monthlyResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -72,4 +70,4 @@ function DownloadsForInterval(interval) { } } -module.exports = ['month', 'total'].map(DownloadsForInterval) +export default ['month', 'total'].map(DownloadsForInterval); diff --git a/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js b/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js index 878fe844c0816..ac19706fbe453 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isMetric, isMetricOverTimePeriod } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'EclipseMarketplaceDownloads', - title: 'EclipseMarketplaceDownloads', - pathPrefix: '/eclipse-marketplace', -})) +const t = (function() { + export default __a; +}()) t.create('total marketplace downloads').get('/dt/notepad4e.json').expectBadge({ label: 'downloads', diff --git a/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js b/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js index 0b648a91ce73c..87311a13dbe47 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const EclipseMarketplaceBase = require('./eclipse-marketplace-base') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; const favoritesResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -12,7 +10,7 @@ const favoritesResponseSchema = Joi.object({ }), }).required() -module.exports = class EclipseMarketplaceFavorites extends ( +export default class EclipseMarketplaceFavorites extends ( EclipseMarketplaceBase ) { static category = 'other' @@ -42,4 +40,4 @@ module.exports = class EclipseMarketplaceFavorites extends ( const favorited = marketplace.node.favorited return this.constructor.render({ favorited }) } -} +}; diff --git a/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js b/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js index 4322263077a89..d6e9dc1687497 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('favorites count').get('/notepad4e.json').expectBadge({ label: 'favorites', diff --git a/services/eclipse-marketplace/eclipse-marketplace-license.service.js b/services/eclipse-marketplace/eclipse-marketplace-license.service.js index 4faf06a48617c..6d061d1051606 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-license.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-license.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const EclipseMarketplaceBase = require('./eclipse-marketplace-base') +import Joi from 'joi'; +import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; const licenseResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -11,7 +9,7 @@ const licenseResponseSchema = Joi.object({ }), }).required() -module.exports = class EclipseMarketplaceLicense extends ( +export default class EclipseMarketplaceLicense extends ( EclipseMarketplaceBase ) { static category = 'license' @@ -46,4 +44,4 @@ module.exports = class EclipseMarketplaceLicense extends ( const license = marketplace.node.license return this.constructor.render({ license }) } -} +}; diff --git a/services/eclipse-marketplace/eclipse-marketplace-license.tester.js b/services/eclipse-marketplace/eclipse-marketplace-license.tester.js index f7b9d8be1a6b5..c8d05bd771abf 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-license.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('license').get('/notepad4e.json').expectBadge({ label: 'license', diff --git a/services/eclipse-marketplace/eclipse-marketplace-update.service.js b/services/eclipse-marketplace/eclipse-marketplace-update.service.js index 68361338e7c87..a605852009713 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-update.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-update.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { formatDate } = require('../text-formatters') -const { age: ageColor } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const EclipseMarketplaceBase = require('./eclipse-marketplace-base') +import Joi from 'joi'; +import {formatDate} from '../text-formatters.js'; +import {age as ageColor} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; const updateResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -14,7 +12,7 @@ const updateResponseSchema = Joi.object({ }), }).required() -module.exports = class EclipseMarketplaceUpdate extends EclipseMarketplaceBase { +export default class EclipseMarketplaceUpdate extends EclipseMarketplaceBase { static category = 'activity' static route = this.buildRoute('eclipse-marketplace/last-update') static examples = [ @@ -42,4 +40,4 @@ module.exports = class EclipseMarketplaceUpdate extends EclipseMarketplaceBase { const date = 1000 * parseInt(marketplace.node.changed) return this.constructor.render({ date }) } -} +}; diff --git a/services/eclipse-marketplace/eclipse-marketplace-update.tester.js b/services/eclipse-marketplace/eclipse-marketplace-update.tester.js index af1b8628d8eed..bfb6a095fa6cb 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-update.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-update.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFormattedDate } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFormattedDate} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('last update date').get('/notepad4e.json').expectBadge({ label: 'updated', diff --git a/services/eclipse-marketplace/eclipse-marketplace-version.service.js b/services/eclipse-marketplace/eclipse-marketplace-version.service.js index 6f15d0b2e305e..846e1757425ed 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-version.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-version.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const EclipseMarketplaceBase = require('./eclipse-marketplace-base') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; const versionResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -12,7 +10,7 @@ const versionResponseSchema = Joi.object({ }), }).required() -module.exports = class EclipseMarketplaceVersion extends ( +export default class EclipseMarketplaceVersion extends ( EclipseMarketplaceBase ) { static category = 'version' @@ -39,4 +37,4 @@ module.exports = class EclipseMarketplaceVersion extends ( const version = marketplace.node.version return this.constructor.render({ version }) } -} +}; diff --git a/services/eclipse-marketplace/eclipse-marketplace-version.tester.js b/services/eclipse-marketplace/eclipse-marketplace-version.tester.js index b3e58b9bc8164..3d30a5a7d1613 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-version.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('marketplace version').get('/notepad4e.json').expectBadge({ label: 'eclipse marketplace', diff --git a/services/ecologi/ecologi-carbon.service.js b/services/ecologi/ecologi-carbon.service.js index b2eb4040e0157..30b14e2edea47 100644 --- a/services/ecologi/ecologi-carbon.service.js +++ b/services/ecologi/ecologi-carbon.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const apiSchema = Joi.object({ total: Joi.number().positive().required(), }).required() -module.exports = class EcologiCarbonOffset extends BaseJsonService { +export default class EcologiCarbonOffset extends BaseJsonService { static category = 'other' static route = { base: 'ecologi/carbon', pattern: ':username' } static examples = [ @@ -43,4 +41,4 @@ module.exports = class EcologiCarbonOffset extends BaseJsonService { return this.constructor.render({ count: total }) } -} +}; diff --git a/services/ecologi/ecologi-carbon.tester.js b/services/ecologi/ecologi-carbon.tester.js index 55cacdf10306d..67378dd294191 100644 --- a/services/ecologi/ecologi-carbon.tester.js +++ b/services/ecologi/ecologi-carbon.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {withRegex} from '../test-validators.js'; t.create('request for existing username') .get('/ecologi.json') diff --git a/services/ecologi/ecologi-trees.service.js b/services/ecologi/ecologi-trees.service.js index d2e0a98f485b6..4af82a1867fea 100644 --- a/services/ecologi/ecologi-trees.service.js +++ b/services/ecologi/ecologi-trees.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const apiSchema = Joi.object({ total: nonNegativeInteger, }).required() -module.exports = class EcologiTrees extends BaseJsonService { +export default class EcologiTrees extends BaseJsonService { static category = 'other' static route = { base: 'ecologi/trees', pattern: ':username' } static examples = [ @@ -43,4 +41,4 @@ module.exports = class EcologiTrees extends BaseJsonService { return this.constructor.render({ count: total }) } -} +}; diff --git a/services/ecologi/ecologi-trees.tester.js b/services/ecologi/ecologi-trees.tester.js index 3627695a48986..c7bc9c82d5203 100644 --- a/services/ecologi/ecologi-trees.tester.js +++ b/services/ecologi/ecologi-trees.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; t.create('request for existing username').get('/ecologi.json').expectBadge({ label: 'trees', diff --git a/services/elm-package/elm-package.service.js b/services/elm-package/elm-package.service.js index f2f7e45736a3b..1fbdd6afbfc42 100644 --- a/services/elm-package/elm-package.service.js +++ b/services/elm-package/elm-package.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { semver } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {semver} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ version: semver }).required() -module.exports = class ElmPackage extends BaseJsonService { +export default class ElmPackage extends BaseJsonService { static category = 'version' static route = { base: 'elm-package/v', pattern: ':user/:packageName' } static examples = [ @@ -35,4 +33,4 @@ module.exports = class ElmPackage extends BaseJsonService { }) return this.constructor.render({ version }) } -} +}; diff --git a/services/elm-package/elm-package.tester.js b/services/elm-package/elm-package.tester.js index d432de124705f..9deb2ce9c212d 100644 --- a/services/elm-package/elm-package.tester.js +++ b/services/elm-package/elm-package.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets the package version of elm/core') .get('/elm/core.json') diff --git a/services/endpoint-common.js b/services/endpoint-common.js index 81e159bf57e0f..5ab0b90d2ded4 100644 --- a/services/endpoint-common.js +++ b/services/endpoint-common.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const validate = require('../core/base-service/validate') -const { InvalidResponse } = require('.') +import Joi from 'joi'; +import validate from '../core/base-service/validate.js'; +import {InvalidResponse} from '.'; const optionalStringWhenNamedLogoPresent = Joi.alternatives().conditional( 'namedLogo', @@ -74,7 +72,7 @@ async function fetchEndpointData( }) } -module.exports = { +export default { validateEndpointData, fetchEndpointData, -} +}; diff --git a/services/endpoint/endpoint-redirect.service.js b/services/endpoint/endpoint-redirect.service.js index 4501e3e6a378c..86787cd424e04 100644 --- a/services/endpoint/endpoint-redirect.service.js +++ b/services/endpoint/endpoint-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = redirector({ +export default redirector({ category: 'other', route: { base: 'badge/endpoint', @@ -10,4 +8,4 @@ module.exports = redirector({ }, transformPath: () => '/endpoint', dateAdded: new Date('2019-02-19'), -}) +}); diff --git a/services/endpoint/endpoint-redirect.tester.js b/services/endpoint/endpoint-redirect.tester.js index 097c083fe4021..7c8a3a5040a50 100644 --- a/services/endpoint/endpoint-redirect.tester.js +++ b/services/endpoint/endpoint-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'EndpointRedirect', - title: 'EndpointRedirect', - pathPrefix: '/badge/endpoint', -})) +const t = (function() { + export default __a; +}()) t.create('Build: default branch') .get('.svg?url=https://example.com/badge.json') diff --git a/services/endpoint/endpoint.service.js b/services/endpoint/endpoint.service.js index 007fc40a07fde..d395e9d3479b4 100644 --- a/services/endpoint/endpoint.service.js +++ b/services/endpoint/endpoint.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { URL } = require('url') -const Joi = require('joi') -const { errorMessages } = require('../dynamic-common') -const { optionalUrl } = require('../validators') -const { fetchEndpointData } = require('../endpoint-common') -const { BaseJsonService, InvalidParameter } = require('..') +import {URL} from 'url'; +import Joi from 'joi'; +import {errorMessages} from '../dynamic-common.js'; +import {optionalUrl} from '../validators.js'; +import {fetchEndpointData} from '../endpoint-common.js'; +import {BaseJsonService, InvalidParameter} from '..'; const blockedDomains = ['github.com', 'shields.io'] @@ -13,7 +11,7 @@ const queryParamSchema = Joi.object({ url: optionalUrl.required(), }).required() -module.exports = class Endpoint extends BaseJsonService { +export default class Endpoint extends BaseJsonService { static category = 'dynamic' static route = { base: 'endpoint', @@ -79,4 +77,4 @@ module.exports = class Endpoint extends BaseJsonService { return this.constructor.render(validated) } -} +}; diff --git a/services/endpoint/endpoint.tester.js b/services/endpoint/endpoint.tester.js index 2001439674cf9..603f5fd63a4c1 100644 --- a/services/endpoint/endpoint.tester.js +++ b/services/endpoint/endpoint.tester.js @@ -1,9 +1,9 @@ -'use strict' - -const zlib = require('zlib') -const { expect } = require('chai') -const { getShieldsIcon } = require('../../lib/logos') -const t = (module.exports = require('../tester').createServiceTester()) +import zlib from 'zlib'; +import {expect} from 'chai'; +import {getShieldsIcon} from '../../lib/logos.js'; +const t = (function() { + export default __a; +}()) t.create('Valid schema') .get('.json?url=https://example.com/badge') diff --git a/services/f-droid/f-droid.service.js b/services/f-droid/f-droid.service.js index 127e426269df7..9f25c8dba2f79 100644 --- a/services/f-droid/f-droid.service.js +++ b/services/f-droid/f-droid.service.js @@ -1,13 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { - optionalNonNegativeInteger, - nonNegativeInteger, -} = require('../validators') -const { addv } = require('../text-formatters') -const { version: versionColor } = require('../color-formatters') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {optionalNonNegativeInteger, nonNegativeInteger} from '../validators.js'; +import {addv} from '../text-formatters.js'; +import {version as versionColor} from '../color-formatters.js'; +import {BaseJsonService, NotFound} from '..'; const schema = Joi.object({ packageName: Joi.string().required(), @@ -22,7 +17,7 @@ const queryParamSchema = Joi.object({ include_prereleases: Joi.equal(''), }).required() -module.exports = class FDroid extends BaseJsonService { +export default class FDroid extends BaseJsonService { static category = 'version' static route = { base: 'f-droid/v', pattern: ':appId', queryParamSchema } static examples = [ @@ -82,4 +77,4 @@ module.exports = class FDroid extends BaseJsonService { const { version } = this.transform({ json, suggested }) return this.constructor.render({ version }) } -} +}; diff --git a/services/f-droid/f-droid.tester.js b/services/f-droid/f-droid.tester.js index 5d77c54eb2f2b..6dbec075e6cdd 100644 --- a/services/f-droid/f-droid.tester.js +++ b/services/f-droid/f-droid.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'f-droid', - title: 'F-Droid', -})) +const t = (function() { + export default __a; +}()) const testPkg = 'org.fdroid.fdroid.privileged' const testJson = ` diff --git a/services/fedora/fedora.service.js b/services/fedora/fedora.service.js index 80e39535411a1..2bf514e72b21b 100644 --- a/services/fedora/fedora.service.js +++ b/services/fedora/fedora.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ version: Joi.string().required(), @@ -11,7 +9,7 @@ const schema = Joi.object({ // No way to permalink to current "stable", https://pagure.io/mdapi/issue/69 const defaultBranch = 'rawhide' -module.exports = class Fedora extends BaseJsonService { +export default class Fedora extends BaseJsonService { static category = 'version' static route = { base: 'fedora/v', pattern: ':packageName/:branch?' } static examples = [ @@ -38,4 +36,4 @@ module.exports = class Fedora extends BaseJsonService { }) return renderVersionBadge({ version: data.version }) } -} +}; diff --git a/services/fedora/fedora.tester.js b/services/fedora/fedora.tester.js index 134b5e84a2595..55189e7d2cf24 100644 --- a/services/fedora/fedora.tester.js +++ b/services/fedora/fedora.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { - isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Fedora package (default branch, valid)') .get('/rpm.json') diff --git a/services/feedz/feedz.service.js b/services/feedz/feedz.service.js index 0e65635588360..02288e2555feb 100644 --- a/services/feedz/feedz.service.js +++ b/services/feedz/feedz.service.js @@ -1,13 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, NotFound } = require('..') -const { - renderVersionBadge, - searchServiceUrl, - stripBuildMetadata, - selectVersion, -} = require('../nuget/nuget-helpers') +import Joi from 'joi'; +import {BaseJsonService, NotFound} from '..'; +import {renderVersionBadge, searchServiceUrl, stripBuildMetadata, selectVersion} from '../nuget/nuget-helpers.js'; const schema = Joi.object({ items: Joi.array() @@ -105,6 +98,6 @@ class FeedzVersionService extends BaseJsonService { } } -module.exports = { +export default { FeedzVersionService, -} +}; diff --git a/services/feedz/feedz.service.spec.js b/services/feedz/feedz.service.spec.js index 47189d6e2c39e..d3baf56910a21 100644 --- a/services/feedz/feedz.service.spec.js +++ b/services/feedz/feedz.service.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { FeedzVersionService } = require('./feedz.service') +import {test, given} from 'sazerac'; +import {FeedzVersionService} from './feedz.service.js'; function json(versions) { return { diff --git a/services/feedz/feedz.tester.js b/services/feedz/feedz.tester.js index 70980d3a5dcba..4c00b5d9f1bd8 100644 --- a/services/feedz/feedz.tester.js +++ b/services/feedz/feedz.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'feedz', - title: 'Feedz', - pathPrefix: '', -})) +const t = (function() { + export default __a; +}()) // The `shieldstests/public` repo is specifically made for these tests. It contains following packages: // - Shields.NoV1: 0.1.0 diff --git a/services/flathub/flathub.service.js b/services/flathub/flathub.service.js index 6f5b9ad89f317..5416e950fb600 100644 --- a/services/flathub/flathub.service.js +++ b/services/flathub/flathub.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ currentReleaseVersion: Joi.string().required(), }).required() -module.exports = class Flathub extends BaseJsonService { +export default class Flathub extends BaseJsonService { static category = 'version' static route = { base: 'flathub/v', pattern: ':packageName' } static examples = [ @@ -30,4 +28,4 @@ module.exports = class Flathub extends BaseJsonService { }) return renderVersionBadge({ version: data.currentReleaseVersion }) } -} +}; diff --git a/services/flathub/flathub.tester.js b/services/flathub/flathub.tester.js index ce276ab7b4900..8c82cd777d423 100644 --- a/services/flathub/flathub.tester.js +++ b/services/flathub/flathub.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionNClauses } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionNClauses} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Flathub (valid)').get('/org.mozilla.firefox.json').expectBadge({ label: 'flathub', diff --git a/services/gem/gem-downloads.service.js b/services/gem/gem-downloads.service.js index f2e697cde370b..c67c77b86becb 100644 --- a/services/gem/gem-downloads.service.js +++ b/services/gem/gem-downloads.service.js @@ -1,12 +1,10 @@ -'use strict' - -const semver = require('semver') -const Joi = require('joi') -const { downloadCount } = require('../color-formatters') -const { metric } = require('../text-formatters') -const { latest: latestVersion } = require('../version') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, InvalidParameter, InvalidResponse } = require('..') +import semver from 'semver'; +import Joi from 'joi'; +import {downloadCount} from '../color-formatters.js'; +import {metric} from '../text-formatters.js'; +import {latest as latestVersion} from '../version.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, InvalidParameter, InvalidResponse} from '..'; const keywords = ['ruby'] @@ -26,7 +24,7 @@ const versionSchema = Joi.array() .min(1) .required() -module.exports = class GemDownloads extends BaseJsonService { +export default class GemDownloads extends BaseJsonService { static category = 'downloads' static route = { base: 'gem', pattern: ':variant(dt|dtv|dv)/:gem/:version?' } static examples = [ @@ -158,4 +156,4 @@ module.exports = class GemDownloads extends BaseJsonService { } return this.constructor.render({ variant, version, downloads }) } -} +}; diff --git a/services/gem/gem-downloads.tester.js b/services/gem/gem-downloads.tester.js index bb3ccfed06819..dbd7103e6c9b4 100644 --- a/services/gem/gem-downloads.tester.js +++ b/services/gem/gem-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('total downloads (valid)').get('/dt/rails.json').expectBadge({ label: 'downloads', diff --git a/services/gem/gem-owner.service.js b/services/gem/gem-owner.service.js index 1be79b524505c..60e013ccd0353 100644 --- a/services/gem/gem-owner.service.js +++ b/services/gem/gem-owner.service.js @@ -1,12 +1,10 @@ -'use strict' - -const Joi = require('joi') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const ownerSchema = Joi.array().required() -module.exports = class GemOwner extends BaseJsonService { +export default class GemOwner extends BaseJsonService { static category = 'other' static route = { base: 'gem/u', pattern: ':user' } static examples = [ @@ -39,4 +37,4 @@ module.exports = class GemOwner extends BaseJsonService { const json = await this.fetch({ user }) return this.constructor.render({ count: json.length }) } -} +}; diff --git a/services/gem/gem-owner.tester.js b/services/gem/gem-owner.tester.js index 80d1d9286c8d7..aed676036955d 100644 --- a/services/gem/gem-owner.tester.js +++ b/services/gem/gem-owner.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('users (valid)') .get('/raphink.json') diff --git a/services/gem/gem-rank.service.js b/services/gem/gem-rank.service.js index 1a78371e9212e..85349e68f8e3c 100644 --- a/services/gem/gem-rank.service.js +++ b/services/gem/gem-rank.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { floorCount } = require('../color-formatters') -const { ordinalNumber } = require('../text-formatters') -const { BaseJsonService, InvalidResponse } = require('..') +import Joi from 'joi'; +import {floorCount} from '../color-formatters.js'; +import {ordinalNumber} from '../text-formatters.js'; +import {BaseJsonService, InvalidResponse} from '..'; const keywords = ['ruby'] @@ -24,7 +22,7 @@ const dailySchema = Joi.array() .min(1) .required() -module.exports = class GemRank extends BaseJsonService { +export default class GemRank extends BaseJsonService { static category = 'downloads' static route = { base: 'gem', pattern: ':period(rt|rd)/:gem' } static examples = [ @@ -84,4 +82,4 @@ module.exports = class GemRank extends BaseJsonService { } return this.constructor.render({ period, rank }) } -} +}; diff --git a/services/gem/gem-rank.tester.js b/services/gem/gem-rank.tester.js index 4cc5d89fcd821..48ceb90a6f0f9 100644 --- a/services/gem/gem-rank.tester.js +++ b/services/gem/gem-rank.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isOrdinalNumber = Joi.string().regex(/^[1-9][0-9]+(ᵗʰ|ˢᵗ|ⁿᵈ|ʳᵈ)$/) const isOrdinalNumberDaily = Joi.string().regex( diff --git a/services/gem/gem-version.service.js b/services/gem/gem-version.service.js index fba13f7d933d4..d4589f542cb18 100644 --- a/services/gem/gem-version.service.js +++ b/services/gem/gem-version.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge, latest } = require('../version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge, latest} from '../version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ // In most cases `version` will be a SemVer but the registry doesn't @@ -23,7 +21,7 @@ const queryParamSchema = Joi.object({ include_prereleases: Joi.equal(''), }).required() -module.exports = class GemVersion extends BaseJsonService { +export default class GemVersion extends BaseJsonService { static category = 'version' static route = { base: 'gem/v', pattern: ':gem', queryParamSchema } static examples = [ @@ -74,4 +72,4 @@ module.exports = class GemVersion extends BaseJsonService { return this.constructor.render({ version }) } } -} +}; diff --git a/services/gem/gem-version.tester.js b/services/gem/gem-version.tester.js index 6877777e14c33..a506ee2eb9807 100644 --- a/services/gem/gem-version.tester.js +++ b/services/gem/gem-version.tester.js @@ -1,10 +1,7 @@ -'use strict' - -const { - isVPlusDottedVersionAtLeastOne, - withRegex, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne, withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version (valid)').get('/formatador.json').expectBadge({ label: 'gem', diff --git a/services/gemnasium/gemnasium.service.js b/services/gemnasium/gemnasium.service.js index b3a76ac147a96..e714b7defec3c 100644 --- a/services/gemnasium/gemnasium.service.js +++ b/services/gemnasium/gemnasium.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'dependencies', route: { base: 'gemnasium', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'gemnasium', dateAdded: new Date('2018-05-15'), -}) +}); diff --git a/services/gemnasium/gemnasium.tester.js b/services/gemnasium/gemnasium.tester.js index 152a1ed98577c..94e57c6d123be 100644 --- a/services/gemnasium/gemnasium.tester.js +++ b/services/gemnasium/gemnasium.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'gemnasium', - title: 'gemnasium', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously dependencies)') .get('/mathiasbynens/he.json') diff --git a/services/gerrit/gerrit.service.js b/services/gerrit/gerrit.service.js index 4a3c4df77ed1e..542e3a5bd8c10 100644 --- a/services/gerrit/gerrit.service.js +++ b/services/gerrit/gerrit.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {BaseJsonService} from '..'; const queryParamSchema = Joi.object({ baseUrl: optionalUrl.required(), @@ -12,7 +10,7 @@ const schema = Joi.object({ status: Joi.equal('NEW', 'MERGED', 'ABANDONED').required(), }).required() -module.exports = class Gerrit extends BaseJsonService { +export default class Gerrit extends BaseJsonService { static category = 'issue-tracking' static route = { base: 'gerrit', pattern: ':changeId', queryParamSchema } static examples = [ @@ -79,4 +77,4 @@ module.exports = class Gerrit extends BaseJsonService { status: data.status, }) } -} +}; diff --git a/services/gerrit/gerrit.tester.js b/services/gerrit/gerrit.tester.js index b4468af421a72..dcd08a008a969 100644 --- a/services/gerrit/gerrit.tester.js +++ b/services/gerrit/gerrit.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) // Change open since December 2010, hopefully won't get merged or abandoned anytime soon. t.create('Gerrit new change') diff --git a/services/github/auth/acceptor.js b/services/github/auth/acceptor.js index 2b6145ea22d0a..7031599276b8d 100644 --- a/services/github/auth/acceptor.js +++ b/services/github/auth/acceptor.js @@ -1,11 +1,7 @@ -'use strict' - -const queryString = require('query-string') -const request = require('request') -const { - userAgent, -} = require('../../../core/base-service/legacy-request-handler') -const log = require('../../../core/server/log') +import queryString from 'query-string'; +import request from 'request'; +import {userAgent} from '../../../core/base-service/legacy-request-handler.js'; +import log from '../../../core/server/log.js'; function setRoutes({ server, authHelper, onTokenAccepted }) { const baseUrl = process.env.GATSBY_BASE_URL || 'https://img.shields.io' @@ -85,4 +81,4 @@ function setRoutes({ server, authHelper, onTokenAccepted }) { }) } -module.exports = { setRoutes } +export default { setRoutes }; diff --git a/services/github/auth/acceptor.spec.js b/services/github/auth/acceptor.spec.js index 523d3589f73e8..bb0a2b97ae182 100644 --- a/services/github/auth/acceptor.spec.js +++ b/services/github/auth/acceptor.spec.js @@ -1,15 +1,13 @@ -'use strict' - -const { expect } = require('chai') -const Camp = require('@shields_io/camp') -const FormData = require('form-data') -const sinon = require('sinon') -const portfinder = require('portfinder') -const queryString = require('query-string') -const nock = require('nock') -const got = require('../../../core/got-test-client') -const GithubConstellation = require('../github-constellation') -const acceptor = require('./acceptor') +import {expect} from 'chai'; +import Camp from '@shields_io/camp'; +import FormData from 'form-data'; +import sinon from 'sinon'; +import portfinder from 'portfinder'; +import queryString from 'query-string'; +import nock from 'nock'; +import got from '../../../core/got-test-client.js'; +import GithubConstellation from '../github-constellation.js'; +import acceptor from './acceptor.js'; const fakeClientId = 'githubdabomb' diff --git a/services/github/auth/admin.js b/services/github/auth/admin.js index 52a8dbd8feb35..04ceff3a6b2b5 100644 --- a/services/github/auth/admin.js +++ b/services/github/auth/admin.js @@ -1,6 +1,4 @@ -'use strict' - -const { makeSecretIsValid } = require('../../../core/server/secret-is-valid') +import {makeSecretIsValid} from '../../../core/server/secret-is-valid.js'; function setRoutes({ shieldsSecret }, { apiProvider, server }) { const secretIsValid = makeSecretIsValid(shieldsSecret) @@ -31,4 +29,4 @@ function setRoutes({ shieldsSecret }, { apiProvider, server }) { }) } -module.exports = { setRoutes } +export default { setRoutes }; diff --git a/services/github/auth/admin.spec.js b/services/github/auth/admin.spec.js index 438c8386d87a6..3de0eb737d5be 100644 --- a/services/github/auth/admin.spec.js +++ b/services/github/auth/admin.spec.js @@ -1,11 +1,9 @@ -'use strict' - -const { expect } = require('chai') -const Camp = require('@shields_io/camp') -const portfinder = require('portfinder') -const got = require('../../../core/got-test-client') -const GithubApiProvider = require('../github-api-provider') -const { setRoutes } = require('./admin') +import {expect} from 'chai'; +import Camp from '@shields_io/camp'; +import portfinder from 'portfinder'; +import got from '../../../core/got-test-client.js'; +import GithubApiProvider from '../github-api-provider.js'; +import {setRoutes} from './admin.js'; describe('GitHub admin route', function () { const shieldsSecret = '7'.repeat(40) diff --git a/services/github/github-all-contributors.service.js b/services/github/github-all-contributors.service.js index a2f2d9fa6a022..5025b13f301f2 100644 --- a/services/github/github-all-contributors.service.js +++ b/services/github/github-all-contributors.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { renderContributorBadge } = require('../contributor-count') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchJsonFromRepo } = require('./github-common-fetch') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {renderContributorBadge} from '../contributor-count.js'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchJsonFromRepo} from './github-common-fetch.js'; +import {documentation} from './github-helpers.js'; const schema = Joi.object({ contributors: Joi.array().required(), }).required() -module.exports = class GithubAllContributorsService extends ( +export default class GithubAllContributorsService extends ( ConditionalGithubAuthV3Service ) { static category = 'activity' @@ -50,4 +48,4 @@ module.exports = class GithubAllContributorsService extends ( const contributorCount = contributors.length return this.constructor.render({ contributorCount }) } -} +}; diff --git a/services/github/github-all-contributors.tester.js b/services/github/github-all-contributors.tester.js index dea4dd6d01f63..3590adee04f67 100644 --- a/services/github/github-all-contributors.tester.js +++ b/services/github/github-all-contributors.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; t.create('all-contributors repo') .get('/all-contributors/all-contributors.json') diff --git a/services/github/github-api-provider.integration.js b/services/github/github-api-provider.integration.js index 0caf068b130da..c55a1dd6710ff 100644 --- a/services/github/github-api-provider.integration.js +++ b/services/github/github-api-provider.integration.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') +import {expect} from 'chai'; const config = require('config').util.toObject() -const GithubApiProvider = require('./github-api-provider') +import GithubApiProvider from './github-api-provider.js'; describe('Github API provider', function () { const baseUrl = process.env.GITHUB_URL || 'https://api.github.com' diff --git a/services/github/github-api-provider.js b/services/github/github-api-provider.js index 74d3607a5a8a8..47b1cfdd401a7 100644 --- a/services/github/github-api-provider.js +++ b/services/github/github-api-provider.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const log = require('../../core/server/log') -const { TokenPool } = require('../../core/token-pooling/token-pool') -const { userAgent } = require('../../core/base-service/legacy-request-handler') -const { nonNegativeInteger } = require('../validators') +import Joi from 'joi'; +import log from '../../core/server/log.js'; +import {TokenPool} from '../../core/token-pooling/token-pool.js'; +import {userAgent} from '../../core/base-service/legacy-request-handler.js'; +import {nonNegativeInteger} from '../validators.js'; const headerSchema = Joi.object({ 'x-ratelimit-limit': nonNegativeInteger, @@ -214,4 +212,4 @@ class GithubApiProvider { } } -module.exports = GithubApiProvider +export default GithubApiProvider; diff --git a/services/github/github-api-provider.spec.js b/services/github/github-api-provider.spec.js index cd2d173f8ea43..8ea7fa162ed42 100644 --- a/services/github/github-api-provider.spec.js +++ b/services/github/github-api-provider.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const sinon = require('sinon') -const GithubApiProvider = require('./github-api-provider') +import {expect} from 'chai'; +import sinon from 'sinon'; +import GithubApiProvider from './github-api-provider.js'; describe('Github API provider', function () { const baseUrl = 'https://github-api.example.com' diff --git a/services/github/github-auth-service.js b/services/github/github-auth-service.js index 16aa35deba9bf..2a4dd3bfb75aa 100644 --- a/services/github/github-auth-service.js +++ b/services/github/github-auth-service.js @@ -1,8 +1,6 @@ -'use strict' - -const gql = require('graphql-tag') -const { mergeQueries } = require('../../core/base-service/graphql') -const { BaseGraphqlService, BaseJsonService } = require('..') +import gql from 'graphql-tag'; +import {mergeQueries} from '../../core/base-service/graphql.js'; +import {BaseGraphqlService, BaseJsonService} from '..'; function createRequestFetcher(context, config) { const { sendAndCacheRequestWithCallbacks, githubApiProvider } = context @@ -89,8 +87,8 @@ All other things being equal, a graphql query will almost always be a smaller number of bytes over the wire and a smaller/simpler object to parse. */ -module.exports = { +export default { GithubAuthV3Service, ConditionalGithubAuthV3Service, GithubAuthV4Service, -} +}; diff --git a/services/github/github-checks-status.service.js b/services/github/github-checks-status.service.js index 79c68724c2066..cc34472948b79 100644 --- a/services/github/github-checks-status.service.js +++ b/services/github/github-checks-status.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ state: isBuildStatus, }).required() -module.exports = class GithubChecksStatus extends GithubAuthV3Service { +export default class GithubChecksStatus extends GithubAuthV3Service { static category = 'build' static route = { base: 'github/checks-status', @@ -69,4 +67,4 @@ module.exports = class GithubChecksStatus extends GithubAuthV3Service { return renderBuildStatusBadge({ status: state }) } -} +}; diff --git a/services/github/github-checks-status.tester.js b/services/github/github-checks-status.tester.js index 5b6f6c9e6a0bc..ab991a82bdf14 100644 --- a/services/github/github-checks-status.tester.js +++ b/services/github/github-checks-status.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isBuildStatus } = require('../build-status') +const t = (function() { + export default __a; +}()) +import {isBuildStatus} from '../build-status.js'; t.create('branch checks (branch)') .get('/badges/shields/master.json') diff --git a/services/github/github-code-size.service.js b/services/github/github-code-size.service.js index e8f1a3548620d..da0f582a17888 100644 --- a/services/github/github-code-size.service.js +++ b/services/github/github-code-size.service.js @@ -1,10 +1,8 @@ -'use strict' +import prettyBytes from 'pretty-bytes'; +import {BaseGithubLanguage} from './github-languages-base.js'; +import {documentation} from './github-helpers.js'; -const prettyBytes = require('pretty-bytes') -const { BaseGithubLanguage } = require('./github-languages-base') -const { documentation } = require('./github-helpers') - -module.exports = class GithubCodeSize extends BaseGithubLanguage { +export default class GithubCodeSize extends BaseGithubLanguage { static category = 'size' static route = { base: 'github/languages/code-size', @@ -36,4 +34,4 @@ module.exports = class GithubCodeSize extends BaseGithubLanguage { const data = await this.fetch({ user, repo }) return this.constructor.render({ size: this.getTotalSize(data) }) } -} +}; diff --git a/services/github/github-code-size.tester.js b/services/github/github-code-size.tester.js index 8a6e52e13c63c..5231247540c85 100644 --- a/services/github/github-code-size.tester.js +++ b/services/github/github-code-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('code size in bytes for all languages') .get('/badges/shields.json') diff --git a/services/github/github-commit-activity.service.js b/services/github/github-commit-activity.service.js index d9190659c2856..0ca6729eab7b1 100644 --- a/services/github/github-commit-activity.service.js +++ b/services/github/github-commit-activity.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { errorMessagesFor, documentation } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {errorMessagesFor, documentation} from './github-helpers.js'; const schema = Joi.array() .items( @@ -14,7 +12,7 @@ const schema = Joi.array() ) .required() -module.exports = class GithubCommitActivity extends GithubAuthV3Service { +export default class GithubCommitActivity extends GithubAuthV3Service { static category = 'activity' static route = { base: 'github/commit-activity', @@ -91,4 +89,4 @@ module.exports = class GithubCommitActivity extends GithubAuthV3Service { const commitCount = this.constructor.transform({ interval, weekData }) return this.constructor.render({ interval, commitCount }) } -} +}; diff --git a/services/github/github-commit-activity.tester.js b/services/github/github-commit-activity.tester.js index 3a401e9bc9547..19bcffb305e15 100644 --- a/services/github/github-commit-activity.tester.js +++ b/services/github/github-commit-activity.tester.js @@ -1,11 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { - isMetricOverTimePeriod, - isZeroOverTimePeriod, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const isCommitActivity = Joi.alternatives().try( isMetricOverTimePeriod, diff --git a/services/github/github-commit-status.service.js b/services/github/github-commit-status.service.js index 613d1f90d8621..6d3211fa858ba 100644 --- a/services/github/github-commit-status.service.js +++ b/services/github/github-commit-status.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { NotFound, InvalidParameter } = require('..') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {NotFound, InvalidParameter} from '..'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ // https://stackoverflow.com/a/23969867/893113 status: Joi.equal('identical', 'ahead', 'behind', 'diverged'), }).required() -module.exports = class GithubCommitStatus extends GithubAuthV3Service { +export default class GithubCommitStatus extends GithubAuthV3Service { static category = 'issue-tracking' static route = { base: 'github/commit-status', @@ -73,4 +71,4 @@ module.exports = class GithubCommitStatus extends GithubAuthV3Service { const isInBranch = status === 'identical' || status === 'behind' return this.constructor.render({ isInBranch, branch }) } -} +}; diff --git a/services/github/github-commit-status.tester.js b/services/github/github-commit-status.tester.js index baeb41a6150e2..89d246ccfea9b 100644 --- a/services/github/github-commit-status.tester.js +++ b/services/github/github-commit-status.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { invalidJSONString } = require('../response-fixtures') -const t = (module.exports = require('../tester').createServiceTester()) +import {invalidJSONString} from '../response-fixtures.js'; +const t = (function() { + export default __a; +}()) t.create('commit status - commit in branch') .get('/badges/shields/master/5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c.json') diff --git a/services/github/github-commits-since.service.js b/services/github/github-commits-since.service.js index bda397e809493..1a64e7588c2a5 100644 --- a/services/github/github-commits-since.service.js +++ b/services/github/github-commits-since.service.js @@ -1,18 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { - fetchLatestRelease, - queryParamSchema, -} = require('./github-common-release') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {fetchLatestRelease, queryParamSchema} from './github-common-release.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ ahead_by: nonNegativeInteger }).required() -module.exports = class GithubCommitsSince extends GithubAuthV3Service { +export default class GithubCommitsSince extends GithubAuthV3Service { static category = 'activity' static route = { base: 'github/commits-since', @@ -158,4 +153,4 @@ module.exports = class GithubCommitsSince extends GithubAuthV3Service { return this.constructor.render({ version, commitCount }) } -} +}; diff --git a/services/github/github-commits-since.tester.js b/services/github/github-commits-since.tester.js index 5376a1358726d..bd004319b40af 100644 --- a/services/github/github-commits-since.tester.js +++ b/services/github/github-commits-since.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex, isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex, isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const isCommitsSince = withRegex(/^(commits since){1}[\s\S]+$/) diff --git a/services/github/github-common-fetch.js b/services/github/github-common-fetch.js index 0ddd022a5e15b..e0ac361a2e804 100644 --- a/services/github/github-common-fetch.js +++ b/services/github/github-common-fetch.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { InvalidResponse } = require('..') -const { errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {InvalidResponse} from '..'; +import {errorMessagesFor} from './github-helpers.js'; const issueSchema = Joi.object({ head: Joi.object({ @@ -77,8 +75,8 @@ async function fetchJsonFromRepo( } } -module.exports = { +export default { fetchIssue, fetchRepoContent, fetchJsonFromRepo, -} +}; diff --git a/services/github/github-common-release.js b/services/github/github-common-release.js index 58bbd2489eb4e..a12cdd4a1f7ee 100644 --- a/services/github/github-common-release.js +++ b/services/github/github-common-release.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { latest } = require('../version') -const { NotFound } = require('..') -const { errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {latest} from '../version.js'; +import {NotFound} from '..'; +import {errorMessagesFor} from './github-helpers.js'; const releaseInfoSchema = Joi.object({ assets: Joi.array() @@ -96,8 +94,8 @@ async function fetchLatestRelease( return latestRelease } -module.exports = { +export default { fetchLatestRelease, queryParamSchema, _getLatestRelease: getLatestRelease, // currently only used for tests -} +}; diff --git a/services/github/github-common-release.spec.js b/services/github/github-common-release.spec.js index 0ecd46fbe4afc..e151821f2d548 100644 --- a/services/github/github-common-release.spec.js +++ b/services/github/github-common-release.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { _getLatestRelease } = require('./github-common-release') +import {test, given} from 'sazerac'; +import {_getLatestRelease} from './github-common-release.js'; describe('GithubRelease', function () { test(_getLatestRelease, () => { diff --git a/services/github/github-constellation.js b/services/github/github-constellation.js index 7b8d32242e085..77fd4b10d8e27 100644 --- a/services/github/github-constellation.js +++ b/services/github/github-constellation.js @@ -1,11 +1,9 @@ -'use strict' - -const { AuthHelper } = require('../../core/base-service/auth-helper') -const RedisTokenPersistence = require('../../core/token-pooling/redis-token-persistence') -const log = require('../../core/server/log') -const GithubApiProvider = require('./github-api-provider') -const { setRoutes: setAdminRoutes } = require('./auth/admin') -const { setRoutes: setAcceptorRoutes } = require('./auth/acceptor') +import {AuthHelper} from '../../core/base-service/auth-helper.js'; +import RedisTokenPersistence from '../../core/token-pooling/redis-token-persistence.js'; +import log from '../../core/server/log.js'; +import GithubApiProvider from './github-api-provider.js'; +import {setRoutes as setAdminRoutes} from './auth/admin.js'; +import {setRoutes as setAcceptorRoutes} from './auth/acceptor.js'; // Convenience class with all the stuff related to the Github API and its // authorization tokens, to simplify server initialization. @@ -130,4 +128,4 @@ class GithubConstellation { } } -module.exports = GithubConstellation +export default GithubConstellation; diff --git a/services/github/github-contributors.service.js b/services/github/github-contributors.service.js index 0103295624dcc..ed34747a0dd30 100644 --- a/services/github/github-contributors.service.js +++ b/services/github/github-contributors.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const parseLinkHeader = require('parse-link-header') -const { renderContributorBadge } = require('../contributor-count') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import parseLinkHeader from 'parse-link-header'; +import {renderContributorBadge} from '../contributor-count.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; // All we do is check its length. const schema = Joi.array().items(Joi.object()) -module.exports = class GithubContributors extends GithubAuthV3Service { +export default class GithubContributors extends GithubAuthV3Service { static category = 'activity' static route = { base: 'github', @@ -56,4 +54,4 @@ module.exports = class GithubContributors extends GithubAuthV3Service { return this.constructor.render({ contributorCount }) } -} +}; diff --git a/services/github/github-contributors.tester.js b/services/github/github-contributors.tester.js index 15bebff1019e4..685dbd755f39b 100644 --- a/services/github/github-contributors.tester.js +++ b/services/github/github-contributors.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; t.create('Contributors').get('/contributors/badges/shields.json').expectBadge({ label: 'contributors', diff --git a/services/github/github-deployments.service.js b/services/github/github-deployments.service.js index 04dfc21cbcb51..df300b0f4c13b 100644 --- a/services/github/github-deployments.service.js +++ b/services/github/github-deployments.service.js @@ -1,10 +1,8 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const { NotFound } = require('..') -const { GithubAuthV4Service } = require('./github-auth-service') -const { documentation, transformErrors } = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import {NotFound} from '..'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation, transformErrors} from './github-helpers.js'; const greenStates = ['SUCCESS'] const redStates = ['ERROR', 'FAILURE'] @@ -44,7 +42,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class GithubDeployments extends GithubAuthV4Service { +export default class GithubDeployments extends GithubAuthV4Service { static category = 'other' static route = { base: 'github/deployments', @@ -129,4 +127,4 @@ module.exports = class GithubDeployments extends GithubAuthV4Service { const { state } = this.transform({ data: json.data }) return this.constructor.render({ state }) } -} +}; diff --git a/services/github/github-deployments.spec.js b/services/github/github-deployments.spec.js index 9f7307c85a81e..ddac38fc0534b 100644 --- a/services/github/github-deployments.spec.js +++ b/services/github/github-deployments.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const GithubDeployments = require('./github-deployments.service') +import {test, given} from 'sazerac'; +import GithubDeployments from './github-deployments.service.js'; describe('GithubDeployments', function () { test(GithubDeployments.render, () => { diff --git a/services/github/github-deployments.tester.js b/services/github/github-deployments.tester.js index 753dd2d390bfb..b4b30e7c029ba 100644 --- a/services/github/github-deployments.tester.js +++ b/services/github/github-deployments.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const validMessages = [ 'success', diff --git a/services/github/github-directory-file-count.service.js b/services/github/github-directory-file-count.service.js index 7b0e4885b0007..57b64275097c0 100644 --- a/services/github/github-directory-file-count.service.js +++ b/services/github/github-directory-file-count.service.js @@ -1,14 +1,9 @@ -'use strict' - -const path = require('path') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { InvalidParameter } = require('..') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { - documentation: commonDocumentation, - errorMessagesFor, -} = require('./github-helpers') +import path from 'path'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {InvalidParameter} from '..'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {documentation as commonDocumentation, errorMessagesFor} from './github-helpers.js'; const documentation = `${commonDocumentation}

@@ -45,7 +40,7 @@ const queryParamSchema = Joi.object({ extension: Joi.string(), }) -module.exports = class GithubDirectoryFileCount extends ( +export default class GithubDirectoryFileCount extends ( ConditionalGithubAuthV3Service ) { static category = 'size' @@ -158,4 +153,4 @@ module.exports = class GithubDirectoryFileCount extends ( const { count } = this.constructor.transform(content, { type, extension }) return this.constructor.render({ count }) } -} +}; diff --git a/services/github/github-directory-file-count.spec.js b/services/github/github-directory-file-count.spec.js index 721691ad5bd61..eefdd14c9fe18 100644 --- a/services/github/github-directory-file-count.spec.js +++ b/services/github/github-directory-file-count.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { InvalidParameter } = require('..') -const GithubDirectoryFileCount = require('./github-directory-file-count.service') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {InvalidParameter} from '..'; +import GithubDirectoryFileCount from './github-directory-file-count.service.js'; describe('GithubDirectoryFileCount', function () { const contents = [ diff --git a/services/github/github-directory-file-count.tester.js b/services/github/github-directory-file-count.tester.js index 2ea38495e371b..b9e6524b63317 100644 --- a/services/github/github-directory-file-count.tester.js +++ b/services/github/github-directory-file-count.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('directory file count').get('/badges/shields.json').expectBadge({ label: 'files', diff --git a/services/github/github-discussions-total.service.js b/services/github/github-discussions-total.service.js index 88bc5c3356438..c603e1e892ade 100644 --- a/services/github/github-discussions-total.service.js +++ b/services/github/github-discussions-total.service.js @@ -1,10 +1,8 @@ -'use strict' - -const { default: gql } = require('graphql-tag') -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV4Service } = require('./github-auth-service') -const { transformErrors } = require('./github-helpers') +import {default as gql} from 'graphql-tag'; +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {transformErrors} from './github-helpers.js'; const schema = Joi.object({ data: Joi.object({ @@ -16,7 +14,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class GithubTotalDiscussions extends GithubAuthV4Service { +export default class GithubTotalDiscussions extends GithubAuthV4Service { static category = 'other' static route = { base: 'github/discussions', @@ -71,4 +69,4 @@ module.exports = class GithubTotalDiscussions extends GithubAuthV4Service { } = json return this.constructor.render({ discussions: `${totalCount} total` }) } -} +}; diff --git a/services/github/github-discussions-total.tester.js b/services/github/github-discussions-total.tester.js index 737419d485378..a594ada567866 100644 --- a/services/github/github-discussions-total.tester.js +++ b/services/github/github-discussions-total.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('GitHub Total Discussions (repo not found)') .get('/not-a-user/not-a-repo.json') diff --git a/services/github/github-downloads.service.js b/services/github/github-downloads.service.js index cb22a498c428a..6ce9be6c751c2 100644 --- a/services/github/github-downloads.service.js +++ b/services/github/github-downloads.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { downloadCount: downloadCountColor } = require('../color-formatters') -const { NotFound } = require('..') -const { GithubAuthV3Service } = require('./github-auth-service') -const { fetchLatestRelease } = require('./github-common-release') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {downloadCount as downloadCountColor} from '../color-formatters.js'; +import {NotFound} from '..'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {fetchLatestRelease} from './github-common-release.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const queryParamSchema = Joi.object({ sort: Joi.string().valid('date', 'semver').default('date'), @@ -27,7 +25,7 @@ const releaseArraySchema = Joi.alternatives().try( Joi.array().length(0) ) -module.exports = class GithubDownloads extends GithubAuthV3Service { +export default class GithubDownloads extends GithubAuthV3Service { static category = 'downloads' static route = { base: 'github', @@ -265,4 +263,4 @@ module.exports = class GithubDownloads extends GithubAuthV3Service { return this.constructor.render({ tag, assetName, downloadCount }) } -} +}; diff --git a/services/github/github-downloads.tester.js b/services/github/github-downloads.tester.js index 099092af95285..25fb87c3bdbf7 100644 --- a/services/github/github-downloads.tester.js +++ b/services/github/github-downloads.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const mockLatestRelease = release => nock => nock('https://api.github.com') diff --git a/services/github/github-followers.service.js b/services/github/github-followers.service.js index f39bf32cbb8f5..effcdb1e3beca 100644 --- a/services/github/github-followers.service.js +++ b/services/github/github-followers.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ followers: nonNegativeInteger, }).required() -module.exports = class GithubFollowers extends GithubAuthV3Service { +export default class GithubFollowers extends GithubAuthV3Service { static category = 'social' static route = { base: 'github/followers', pattern: ':user' } static examples = [ @@ -43,4 +41,4 @@ module.exports = class GithubFollowers extends GithubAuthV3Service { }) return this.constructor.render({ followers }) } -} +}; diff --git a/services/github/github-followers.tester.js b/services/github/github-followers.tester.js index c0db38a83915a..f7de0277596e2 100644 --- a/services/github/github-followers.tester.js +++ b/services/github/github-followers.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Followers').get('/webcaetano.json').expectBadge({ label: 'followers', diff --git a/services/github/github-forks.service.js b/services/github/github-forks.service.js index 67bac545b8003..5a78e2633c644 100644 --- a/services/github/github-forks.service.js +++ b/services/github/github-forks.service.js @@ -1,11 +1,9 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV4Service } = require('./github-auth-service') -const { documentation, transformErrors } = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation, transformErrors} from './github-helpers.js'; const schema = Joi.object({ data: Joi.object({ @@ -15,7 +13,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class GithubForks extends GithubAuthV4Service { +export default class GithubForks extends GithubAuthV4Service { static category = 'social' static route = { base: 'github/forks', pattern: ':user/:repo' } static examples = [ @@ -74,4 +72,4 @@ module.exports = class GithubForks extends GithubAuthV4Service { forkCount: json.data.repository.forkCount, }) } -} +}; diff --git a/services/github/github-forks.tester.js b/services/github/github-forks.tester.js index 9656b806dda09..56bac7426a2be 100644 --- a/services/github/github-forks.tester.js +++ b/services/github/github-forks.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Forks') .get('/badges/shields.json') diff --git a/services/github/github-go-mod.service.js b/services/github/github-go-mod.service.js index cb45aa2a4ce4d..2dc1e131dd80d 100644 --- a/services/github/github-go-mod.service.js +++ b/services/github/github-go-mod.service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { InvalidResponse } = require('..') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchRepoContent } = require('./github-common-fetch') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {InvalidResponse} from '..'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchRepoContent} from './github-common-fetch.js'; +import {documentation} from './github-helpers.js'; const queryParamSchema = Joi.object({ filename: Joi.string(), @@ -15,7 +13,7 @@ const goVersionRegExp = /^go (.+)$/m const keywords = ['golang'] -module.exports = class GithubGoModGoVersion extends ( +export default class GithubGoModGoVersion extends ( ConditionalGithubAuthV3Service ) { static category = 'version' @@ -95,4 +93,4 @@ module.exports = class GithubGoModGoVersion extends ( const { go } = this.constructor.transform(content) return this.constructor.render({ version: go, branch }) } -} +}; diff --git a/services/github/github-go-mod.tester.js b/services/github/github-go-mod.tester.js index e83e4a1d8990d..94adfff994a16 100644 --- a/services/github/github-go-mod.tester.js +++ b/services/github/github-go-mod.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Go version').get('/gohugoio/hugo.json').expectBadge({ label: 'Go', diff --git a/services/github/github-hacktoberfest.service.js b/services/github/github-hacktoberfest.service.js index 85339bd39a8df..d4ff657997351 100644 --- a/services/github/github-hacktoberfest.service.js +++ b/services/github/github-hacktoberfest.service.js @@ -1,15 +1,10 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const moment = require('moment') -const { metric, maybePluralize } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV4Service } = require('./github-auth-service') -const { - documentation: githubDocumentation, - transformErrors, -} = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import moment from 'moment'; +import {metric, maybePluralize} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation as githubDocumentation, transformErrors} from './github-helpers.js'; const documentation = `

@@ -58,7 +53,7 @@ const queryParamSchema = Joi.object({ suggestion_label: Joi.string(), }).required() -module.exports = class GithubHacktoberfestCombinedStatus extends ( +export default class GithubHacktoberfestCombinedStatus extends ( GithubAuthV4Service ) { static category = 'issue-tracking' @@ -237,4 +232,4 @@ module.exports = class GithubHacktoberfestCombinedStatus extends ( year, }) } -} +}; diff --git a/services/github/github-hacktoberfest.spec.js b/services/github/github-hacktoberfest.spec.js index 01916b5a8a2f6..7d86cc0ff9705 100644 --- a/services/github/github-hacktoberfest.spec.js +++ b/services/github/github-hacktoberfest.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const GitHubHacktoberfest = require('./github-hacktoberfest.service') +import {test, given} from 'sazerac'; +import GitHubHacktoberfest from './github-hacktoberfest.service.js'; describe('GitHubHacktoberfest', function () { test(GitHubHacktoberfest.render, () => { diff --git a/services/github/github-hacktoberfest.tester.js b/services/github/github-hacktoberfest.tester.js index b11b1526d0880..9b3bcea694f42 100644 --- a/services/github/github-hacktoberfest.tester.js +++ b/services/github/github-hacktoberfest.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isHacktoberfestNoIssuesStatus = Joi.string().regex( /^[0-9]+ PRs?(, [0-9]+ days? left)?$/ diff --git a/services/github/github-helpers.js b/services/github/github-helpers.js index eb11e24fff321..8fd4b23ebea09 100644 --- a/services/github/github-helpers.js +++ b/services/github/github-helpers.js @@ -1,7 +1,5 @@ -'use strict' - -const { colorScale } = require('../color-formatters') -const { InvalidResponse, NotFound } = require('..') +import {colorScale} from '../color-formatters.js'; +import {InvalidResponse, NotFound} from '..'; const documentation = `

@@ -33,10 +31,10 @@ function transformErrors(errors, entity = 'repo') { const commentsColor = colorScale([1, 3, 10, 25], undefined, true) -module.exports = { +export default { documentation, stateColor, commentsColor, errorMessagesFor, transformErrors, -} +}; diff --git a/services/github/github-issue-detail-redirect.service.js b/services/github/github-issue-detail-redirect.service.js index 40be57b51b99c..76d2a695c2fdc 100644 --- a/services/github/github-issue-detail-redirect.service.js +++ b/services/github/github-issue-detail-redirect.service.js @@ -1,13 +1,11 @@ -'use strict' - -const { redirector } = require('..') +import {redirector} from '..'; const variantMap = { s: 'state', u: 'author', } -module.exports = [ +export default [ redirector({ category: 'issue-tracking', route: { @@ -19,4 +17,4 @@ module.exports = [ `/github/${issueKind}/detail/${variantMap[variant]}/${user}/${repo}/${number}`, dateAdded: new Date('2019-04-04'), }), -] +]; diff --git a/services/github/github-issue-detail-redirect.tester.js b/services/github/github-issue-detail-redirect.tester.js index da07a159e6f0c..c7fb8124d3163 100644 --- a/services/github/github-issue-detail-redirect.tester.js +++ b/services/github/github-issue-detail-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'GithubIssueDetailRedirect', - title: 'GithubIssueDetailRedirect', - pathPrefix: '/github', -})) +const t = (function() { + export default __a; +}()) t.create('github issue detail (s shorthand)') .get('/issues/detail/s/badges/shields/979.svg') diff --git a/services/github/github-issue-detail.service.js b/services/github/github-issue-detail.service.js index 8fca29bee6866..20a5e4ed6e706 100644 --- a/services/github/github-issue-detail.service.js +++ b/services/github/github-issue-detail.service.js @@ -1,17 +1,10 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { formatDate, metric } = require('../text-formatters') -const { age } = require('../color-formatters') -const { InvalidResponse } = require('..') -const { GithubAuthV3Service } = require('./github-auth-service') -const { - documentation, - errorMessagesFor, - stateColor, - commentsColor, -} = require('./github-helpers') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {formatDate, metric} from '../text-formatters.js'; +import {age} from '../color-formatters.js'; +import {InvalidResponse} from '..'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor, stateColor, commentsColor} from './github-helpers.js'; const commonSchemaFields = { number: nonNegativeInteger, @@ -152,7 +145,7 @@ const propertyMap = { 'last-update': ageUpdateMap, } -module.exports = class GithubIssueDetail extends GithubAuthV3Service { +export default class GithubIssueDetail extends GithubAuthV3Service { static category = 'issue-tracking' static route = { base: 'github', @@ -217,4 +210,4 @@ module.exports = class GithubIssueDetail extends GithubAuthV3Service { const { value, isPR } = this.transform({ json, property, issueKind }) return this.constructor.render({ property, value, isPR, number }) } -} +}; diff --git a/services/github/github-issue-detail.spec.js b/services/github/github-issue-detail.spec.js index 3d5ef086f30dd..bf1e9f31b4670 100644 --- a/services/github/github-issue-detail.spec.js +++ b/services/github/github-issue-detail.spec.js @@ -1,12 +1,10 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { age } = require('../color-formatters') -const { formatDate, metric } = require('../text-formatters') -const { InvalidResponse } = require('..') -const GithubIssueDetail = require('./github-issue-detail.service') -const { stateColor, commentsColor } = require('./github-helpers') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {age} from '../color-formatters.js'; +import {formatDate, metric} from '../text-formatters.js'; +import {InvalidResponse} from '..'; +import GithubIssueDetail from './github-issue-detail.service.js'; +import {stateColor, commentsColor} from './github-helpers.js'; describe('GithubIssueDetail', function () { test(GithubIssueDetail.render, () => { diff --git a/services/github/github-issue-detail.tester.js b/services/github/github-issue-detail.tester.js index 0a9de66414ee3..2dc23234d12cf 100644 --- a/services/github/github-issue-detail.tester.js +++ b/services/github/github-issue-detail.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isFormattedDate } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isFormattedDate} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('github issue state') .get('/issues/detail/state/badges/shields/979.json') diff --git a/services/github/github-issues-search.service.js b/services/github/github-issues-search.service.js index 979345af9ef6e..4501e0c904156 100644 --- a/services/github/github-issues-search.service.js +++ b/services/github/github-issues-search.service.js @@ -1,11 +1,9 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV4Service } = require('./github-auth-service') -const { documentation, transformErrors } = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation, transformErrors} from './github-helpers.js'; const issueCountSchema = Joi.object({ data: Joi.object({ @@ -106,7 +104,7 @@ class GithubRepoIssuesSearch extends BaseGithubIssuesSearch { } } -module.exports = { +export default { GithubIssuesSearch, GithubRepoIssuesSearch, -} +}; diff --git a/services/github/github-issues-search.tester.js b/services/github/github-issues-search.tester.js index 04c88c2f24a89..a1531713fc815 100644 --- a/services/github/github-issues-search.tester.js +++ b/services/github/github-issues-search.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'GithubIssuesSearch', - title: 'Github Issues Search', - pathPrefix: '/github', -})) +import {isMetric} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('GitHub issue search (valid query string)') .get( diff --git a/services/github/github-issues.service.js b/services/github/github-issues.service.js index 9f7b37ed2be44..af603094a20aa 100644 --- a/services/github/github-issues.service.js +++ b/services/github/github-issues.service.js @@ -1,11 +1,9 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV4Service } = require('./github-auth-service') -const { documentation, transformErrors } = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation, transformErrors} from './github-helpers.js'; const issueCountSchema = Joi.object({ data: Joi.object({ @@ -37,7 +35,7 @@ const isClosedVariant = { 'issues-pr-closed': true, } -module.exports = class GithubIssues extends GithubAuthV4Service { +export default class GithubIssues extends GithubAuthV4Service { static category = 'issue-tracking' static route = { base: 'github', @@ -401,4 +399,4 @@ module.exports = class GithubIssues extends GithubAuthV4Service { label, }) } -} +}; diff --git a/services/github/github-issues.tester.js b/services/github/github-issues.tester.js index bb25a88dab518..db9d1886a1134 100644 --- a/services/github/github-issues.tester.js +++ b/services/github/github-issues.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isMetric, isMetricOpenIssues } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isMetric, isMetricOpenIssues} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('GitHub closed pull requests') .get('/issues-pr-closed/badges/shields.json') diff --git a/services/github/github-labels.service.js b/services/github/github-labels.service.js index 1bed157eaa96d..3217ca881d3fe 100644 --- a/services/github/github-labels.service.js +++ b/services/github/github-labels.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ color: Joi.string().hex().required(), }).required() -module.exports = class GithubLabels extends GithubAuthV3Service { +export default class GithubLabels extends GithubAuthV3Service { static category = 'issue-tracking' static route = { base: 'github/labels', pattern: ':user/:repo/:name' } static examples = [ @@ -45,4 +43,4 @@ module.exports = class GithubLabels extends GithubAuthV3Service { const { color } = await this.fetch({ user, repo, name }) return this.constructor.render({ name, color }) } -} +}; diff --git a/services/github/github-labels.tester.js b/services/github/github-labels.tester.js index 1cf89586cf731..e47fca24a2db3 100644 --- a/services/github/github-labels.tester.js +++ b/services/github/github-labels.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('labels').get('/badges/shields/bug.json').expectBadge({ message: 'bug', diff --git a/services/github/github-language-count.service.js b/services/github/github-language-count.service.js index 311a097271e09..012dce66d8c41 100644 --- a/services/github/github-language-count.service.js +++ b/services/github/github-language-count.service.js @@ -1,9 +1,7 @@ -'use strict' +import {BaseGithubLanguage} from './github-languages-base.js'; +import {documentation} from './github-helpers.js'; -const { BaseGithubLanguage } = require('./github-languages-base') -const { documentation } = require('./github-helpers') - -module.exports = class GithubLanguageCount extends BaseGithubLanguage { +export default class GithubLanguageCount extends BaseGithubLanguage { static category = 'analysis' static route = { base: 'github/languages/count', pattern: ':user/:repo' } static examples = [ @@ -31,4 +29,4 @@ module.exports = class GithubLanguageCount extends BaseGithubLanguage { const data = await this.fetch({ user, repo }) return this.constructor.render({ count: Object.keys(data).length }) } -} +}; diff --git a/services/github/github-language-count.tester.js b/services/github/github-language-count.tester.js index f7277d884baaa..cef49335100ab 100644 --- a/services/github/github-language-count.tester.js +++ b/services/github/github-language-count.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('language count').get('/badges/shields.json').expectBadge({ label: 'languages', diff --git a/services/github/github-languages-base.js b/services/github/github-languages-base.js index aa6dc250a606d..a7ece5512a862 100644 --- a/services/github/github-languages-base.js +++ b/services/github/github-languages-base.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {errorMessagesFor} from './github-helpers.js'; /* We're expecting a response like { "Python": 39624, "Shell": 104 } @@ -25,4 +23,4 @@ class BaseGithubLanguage extends GithubAuthV3Service { } } -module.exports = { BaseGithubLanguage } +export default { BaseGithubLanguage }; diff --git a/services/github/github-last-commit.service.js b/services/github/github-last-commit.service.js index 76f92fe72a159..e12c9245e02a6 100644 --- a/services/github/github-last-commit.service.js +++ b/services/github/github-last-commit.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { formatDate } = require('../text-formatters') -const { age: ageColor } = require('../color-formatters') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {formatDate} from '../text-formatters.js'; +import {age as ageColor} from '../color-formatters.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const commonExampleAttrs = { keywords: ['latest'], documentation, @@ -22,7 +20,7 @@ const schema = Joi.array() ) .required() -module.exports = class GithubLastCommit extends GithubAuthV3Service { +export default class GithubLastCommit extends GithubAuthV3Service { static category = 'activity' static route = { base: 'github/last-commit', pattern: ':user/:repo/:branch*' } static examples = [ @@ -71,4 +69,4 @@ module.exports = class GithubLastCommit extends GithubAuthV3Service { const body = await this.fetch({ user, repo, branch }) return this.constructor.render({ commitDate: body[0].commit.author.date }) } -} +}; diff --git a/services/github/github-last-commit.tester.js b/services/github/github-last-commit.tester.js index 5ee66e832de3e..516bac2fc1037 100644 --- a/services/github/github-last-commit.tester.js +++ b/services/github/github-last-commit.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFormattedDate } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFormattedDate} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('last commit (recent)') .get('/eslint/eslint.json') diff --git a/services/github/github-lerna-json.service.js b/services/github/github-lerna-json.service.js index 9fabd62df00c8..b114bbd396cff 100644 --- a/services/github/github-lerna-json.service.js +++ b/services/github/github-lerna-json.service.js @@ -1,17 +1,15 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { semver } = require('../validators') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchJsonFromRepo } = require('./github-common-fetch') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {semver} from '../validators.js'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchJsonFromRepo} from './github-common-fetch.js'; +import {documentation} from './github-helpers.js'; const versionSchema = Joi.object({ version: Joi.alternatives().try(semver, Joi.equal('independent').required()), }).required() -module.exports = class GithubLernaJson extends ConditionalGithubAuthV3Service { +export default class GithubLernaJson extends ConditionalGithubAuthV3Service { static category = 'version' static route = { base: 'github/lerna-json/v', @@ -58,4 +56,4 @@ module.exports = class GithubLernaJson extends ConditionalGithubAuthV3Service { }) return this.constructor.render({ version, branch }) } -} +}; diff --git a/services/github/github-lerna-json.tester.js b/services/github/github-lerna-json.tester.js index 907d16942b835..5768adafb0fe4 100644 --- a/services/github/github-lerna-json.tester.js +++ b/services/github/github-lerna-json.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Lerna version').get('/facebook/jest.json').expectBadge({ label: 'lerna', diff --git a/services/github/github-license.service.js b/services/github/github-license.service.js index 0a628700f2fd0..ed038b3b4fc8e 100644 --- a/services/github/github-license.service.js +++ b/services/github/github-license.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { renderLicenseBadge } = require('../licenses') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {renderLicenseBadge} from '../licenses.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ // Some repos do not have a license, in which case GitHub returns `{ license: null }`. license: Joi.object({ spdx_id: Joi.string().required() }).allow(null), }).required() -module.exports = class GithubLicense extends GithubAuthV3Service { +export default class GithubLicense extends GithubAuthV3Service { static category = 'license' static route = { base: 'github/license', pattern: ':user/:repo' } static examples = [ @@ -48,4 +46,4 @@ module.exports = class GithubLicense extends GithubAuthV3Service { const license = licenseObject ? licenseObject.spdx_id : undefined return this.constructor.render({ license }) } -} +}; diff --git a/services/github/github-license.spec.js b/services/github/github-license.spec.js index 82359204cc8db..a80bb68b8504c 100644 --- a/services/github/github-license.spec.js +++ b/services/github/github-license.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const GithubLicense = require('./github-license.service') +import {test, given} from 'sazerac'; +import GithubLicense from './github-license.service.js'; test(GithubLicense.render, () => { given({ license: undefined }).expect({ message: 'not specified' }) diff --git a/services/github/github-license.tester.js b/services/github/github-license.tester.js index 261b4b4126616..eca05279d32e3 100644 --- a/services/github/github-license.tester.js +++ b/services/github/github-license.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { licenseToColor } = require('../licenses') -const t = (module.exports = require('../tester').createServiceTester()) +import {licenseToColor} from '../licenses.js'; +const t = (function() { + export default __a; +}()) const publicDomainLicenseColor = licenseToColor('CC0-1.0') const unknownLicenseColor = licenseToColor() diff --git a/services/github/github-manifest.service.js b/services/github/github-manifest.service.js index 248397a730faa..3a76b954e60f9 100644 --- a/services/github/github-manifest.service.js +++ b/services/github/github-manifest.service.js @@ -1,15 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { - individualValueSchema, - transformAndValidate, - renderDynamicBadge, -} = require('../dynamic-common') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchJsonFromRepo } = require('./github-common-fetch') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {individualValueSchema, transformAndValidate, renderDynamicBadge} from '../dynamic-common.js'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchJsonFromRepo} from './github-common-fetch.js'; +import {documentation} from './github-helpers.js'; const schema = Joi.object({ version: individualValueSchema, @@ -204,7 +198,7 @@ class DynamicGithubManifest extends ConditionalGithubAuthV3Service { } } -module.exports = { +export default { GithubManifestVersion, DynamicGithubManifest, -} +}; diff --git a/services/github/github-manifest.tester.js b/services/github/github-manifest.tester.js index 77c1beb32df47..ecd397c6938a3 100644 --- a/services/github/github-manifest.tester.js +++ b/services/github/github-manifest.tester.js @@ -1,14 +1,10 @@ -'use strict' +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'GithubManifest', - title: 'GithubManifest', - pathPrefix: '/github/manifest-json', -})) +const t = (function() { + export default __a; +}()) t.create('Manifest version') .get('/v/sindresorhus/show-all-github-issues.json') diff --git a/services/github/github-milestone-detail.service.js b/services/github/github-milestone-detail.service.js index c70aa58f705c3..3bebf1882a0fc 100644 --- a/services/github/github-milestone-detail.service.js +++ b/services/github/github-milestone-detail.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ open_issues: nonNegativeInteger, @@ -12,7 +10,7 @@ const schema = Joi.object({ title: Joi.string().required(), }).required() -module.exports = class GithubMilestoneDetail extends GithubAuthV3Service { +export default class GithubMilestoneDetail extends GithubAuthV3Service { static category = 'issue-tracking' static route = { base: 'github/milestones', @@ -95,4 +93,4 @@ module.exports = class GithubMilestoneDetail extends GithubAuthV3Service { const milestone = await this.fetch({ user, repo, number }) return this.constructor.render({ user, repo, variant, number, milestone }) } -} +}; diff --git a/services/github/github-milestone-detail.tester.js b/services/github/github-milestone-detail.tester.js index e1ed8b5003247..bdd2e88cd29ea 100644 --- a/services/github/github-milestone-detail.tester.js +++ b/services/github/github-milestone-detail.tester.js @@ -1,11 +1,7 @@ -'use strict' - -const { - isMetric, - isMetricOverMetric, - isIntegerPercentage, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric, isMetricOverMetric, isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Milestone Open Issues') .get('/issues-open/MacroPower/milestone-test/1.json') diff --git a/services/github/github-milestone.service.js b/services/github/github-milestone.service.js index d345f4ca2a527..744a05be2d7c7 100644 --- a/services/github/github-milestone.service.js +++ b/services/github/github-milestone.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.array() .items( @@ -13,7 +11,7 @@ const schema = Joi.array() ) .required() -module.exports = class GithubMilestone extends GithubAuthV3Service { +export default class GithubMilestone extends GithubAuthV3Service { static category = 'issue-tracking' static route = { base: 'github/milestones', @@ -80,4 +78,4 @@ module.exports = class GithubMilestone extends GithubAuthV3Service { const milestones = await this.fetch({ user, repo, variant }) return this.constructor.render({ user, repo, variant, milestones }) } -} +}; diff --git a/services/github/github-milestone.tester.js b/services/github/github-milestone.tester.js index 30565326578ae..2c89773f265e0 100644 --- a/services/github/github-milestone.tester.js +++ b/services/github/github-milestone.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('All Milestones') .get('/all/MacroPower/milestone-test.json') diff --git a/services/github/github-package-json.service.js b/services/github/github-package-json.service.js index 9b8dc0004bac2..881384d300d45 100644 --- a/services/github/github-package-json.service.js +++ b/services/github/github-package-json.service.js @@ -1,19 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { - transformAndValidate, - renderDynamicBadge, -} = require('../dynamic-common') -const { - isPackageJsonWithDependencies, - getDependencyVersion, -} = require('../package-json-helpers') -const { semver } = require('../validators') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchJsonFromRepo } = require('./github-common-fetch') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {transformAndValidate, renderDynamicBadge} from '../dynamic-common.js'; +import {isPackageJsonWithDependencies, getDependencyVersion} from '../package-json-helpers.js'; +import {semver} from '../validators.js'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchJsonFromRepo} from './github-common-fetch.js'; +import {documentation} from './github-helpers.js'; const keywords = ['npm', 'node'] @@ -247,8 +239,8 @@ class DynamicGithubPackageJson extends ConditionalGithubAuthV3Service { } } -module.exports = [ +export default [ GithubPackageJsonVersion, GithubPackageJsonDependencyVersion, DynamicGithubPackageJson, -] +]; diff --git a/services/github/github-package-json.tester.js b/services/github/github-package-json.tester.js index 5a15ccd3be1bf..89976192ff273 100644 --- a/services/github/github-package-json.tester.js +++ b/services/github/github-package-json.tester.js @@ -1,15 +1,11 @@ -'use strict' +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {isSemver} from '../test-validators.js'; +import {semverRange} from '../validators.js'; -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { isSemver } = require('../test-validators') -const { semverRange } = require('../validators') - -const t = (module.exports = new ServiceTester({ - id: 'GithubPackageJson', - title: 'GithubPackageJson', - pathPrefix: '/github/package-json', -})) +const t = (function() { + export default __a; +}()) t.create('Package version').get('/v/badges/shields.json').expectBadge({ label: 'version', diff --git a/services/github/github-pipenv.service.js b/services/github/github-pipenv.service.js index a36b3cc92789d..daee298794125 100644 --- a/services/github/github-pipenv.service.js +++ b/services/github/github-pipenv.service.js @@ -1,12 +1,10 @@ -'use strict' - -const { renderVersionBadge } = require('../version') -const { isLockfile, getDependencyVersion } = require('../pipenv-helpers') -const { addv } = require('../text-formatters') -const { NotFound } = require('..') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchJsonFromRepo } = require('./github-common-fetch') -const { documentation: githubDocumentation } = require('./github-helpers') +import {renderVersionBadge} from '../version.js'; +import {isLockfile, getDependencyVersion} from '../pipenv-helpers.js'; +import {addv} from '../text-formatters.js'; +import {NotFound} from '..'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchJsonFromRepo} from './github-common-fetch.js'; +import {documentation as githubDocumentation} from './github-helpers.js'; const keywords = ['pipfile'] @@ -174,7 +172,7 @@ class GithubPipenvLockedDependencyVersion extends ConditionalGithubAuthV3Service } } -module.exports = [ +export default [ GithubPipenvLockedPythonVersion, GithubPipenvLockedDependencyVersion, -] +]; diff --git a/services/github/github-pipenv.tester.js b/services/github/github-pipenv.tester.js index 9161c20625805..ab3d897c26b71 100644 --- a/services/github/github-pipenv.tester.js +++ b/services/github/github-pipenv.tester.js @@ -1,21 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { - isVPlusDottedVersionAtLeastOne, - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionAtLeastOne, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; // e.g. v19.3b0 const isBlackVersion = Joi.string().regex(/^v\d+(\.\d+)*(.*)?$/) const isShortSha = Joi.string().regex(/[0-9a-f]{7}/) -const t = (module.exports = new ServiceTester({ - id: 'GithubPipenv', - title: 'GithubPipenv', - pathPrefix: '/github/pipenv', -})) +const t = (function() { + export default __a; +}()) t.create('Locked Python version') .get('/locked/python-version/metabolize/rq-dashboard-on-heroku.json') diff --git a/services/github/github-pull-request-check-state.service.js b/services/github/github-pull-request-check-state.service.js index 4e0d1c861b685..36c73b6b68f4e 100644 --- a/services/github/github-pull-request-check-state.service.js +++ b/services/github/github-pull-request-check-state.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const countBy = require('lodash.countby') -const { GithubAuthV3Service } = require('./github-auth-service') -const { fetchIssue } = require('./github-common-fetch') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import countBy from 'lodash.countby'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {fetchIssue} from './github-common-fetch.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ state: Joi.equal('failure', 'pending', 'success').required(), @@ -19,7 +17,7 @@ const schema = Joi.object({ const keywords = ['pullrequest', 'detail'] -module.exports = class GithubPullRequestCheckState extends GithubAuthV3Service { +export default class GithubPullRequestCheckState extends GithubAuthV3Service { static category = 'build' static route = { base: 'github/status', @@ -100,4 +98,4 @@ module.exports = class GithubPullRequestCheckState extends GithubAuthV3Service { return this.constructor.render({ variant, state, stateCounts }) } -} +}; diff --git a/services/github/github-pull-request-check-state.tester.js b/services/github/github-pull-request-check-state.tester.js index c1215a18c76d6..4ce5edd66c608 100644 --- a/services/github/github-pull-request-check-state.tester.js +++ b/services/github/github-pull-request-check-state.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('github pull request check state') .get('/s/pulls/badges/shields/1110.json') diff --git a/services/github/github-r-package.service.js b/services/github/github-r-package.service.js index 449a23e2bb0c9..f638e7174477b 100644 --- a/services/github/github-r-package.service.js +++ b/services/github/github-r-package.service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { InvalidResponse } = require('..') -const { ConditionalGithubAuthV3Service } = require('./github-auth-service') -const { fetchRepoContent } = require('./github-common-fetch') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {InvalidResponse} from '..'; +import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; +import {fetchRepoContent} from './github-common-fetch.js'; +import {documentation} from './github-helpers.js'; const queryParamSchema = Joi.object({ filename: Joi.string(), @@ -13,7 +11,7 @@ const queryParamSchema = Joi.object({ const versionRegExp = /^Version:[\s]*(.+)$/m -module.exports = class GithubRPackageVersion extends ( +export default class GithubRPackageVersion extends ( ConditionalGithubAuthV3Service ) { static category = 'version' @@ -90,4 +88,4 @@ module.exports = class GithubRPackageVersion extends ( const { version } = this.constructor.transform(content, filename) return this.constructor.render({ version, branch }) } -} +}; diff --git a/services/github/github-r-package.spec.js b/services/github/github-r-package.spec.js index 8bf77d8728712..67d39fd3a79c5 100644 --- a/services/github/github-r-package.spec.js +++ b/services/github/github-r-package.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { InvalidResponse } = require('..') -const GithubRPackageVersion = require('./github-r-package.service') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {InvalidResponse} from '..'; +import GithubRPackageVersion from './github-r-package.service.js'; describe('GithubRPackageVersion', function () { const content = versionLine => diff --git a/services/github/github-r-package.tester.js b/services/github/github-r-package.tester.js index 01d1511674610..4009c65a96376 100644 --- a/services/github/github-r-package.tester.js +++ b/services/github/github-r-package.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('R package version').get('/mixOmicsTeam/mixOmics.json').expectBadge({ label: 'R', diff --git a/services/github/github-release-date.service.js b/services/github/github-release-date.service.js index acca83b2c0e60..2eddcb77dce29 100644 --- a/services/github/github-release-date.service.js +++ b/services/github/github-release-date.service.js @@ -1,11 +1,9 @@ -'use strict' - -const moment = require('moment') -const Joi = require('joi') -const { age } = require('../color-formatters') -const { formatDate } = require('../text-formatters') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import moment from 'moment'; +import Joi from 'joi'; +import {age} from '../color-formatters.js'; +import {formatDate} from '../text-formatters.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.alternatives( Joi.object({ @@ -20,7 +18,7 @@ const schema = Joi.alternatives( .min(1) ) -module.exports = class GithubReleaseDate extends GithubAuthV3Service { +export default class GithubReleaseDate extends GithubAuthV3Service { static category = 'activity' static route = { base: 'github', @@ -79,4 +77,4 @@ module.exports = class GithubReleaseDate extends GithubAuthV3Service { } return this.constructor.render({ date: body.created_at }) } -} +}; diff --git a/services/github/github-release-date.tester.js b/services/github/github-release-date.tester.js index 314edaca0ae3c..7c83c8944f2e1 100644 --- a/services/github/github-release-date.tester.js +++ b/services/github/github-release-date.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFormattedDate } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFormattedDate} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Release Date. e.g release date|today') .get('/release-date/mochajs/mocha.json') diff --git a/services/github/github-release.service.js b/services/github/github-release.service.js index 1329ab06ce80b..71ba4dbcdb5aa 100644 --- a/services/github/github-release.service.js +++ b/services/github/github-release.service.js @@ -1,14 +1,9 @@ -'use strict' - -const { addv } = require('../text-formatters') -const { version: versionColor } = require('../color-formatters') -const { redirector } = require('..') -const { GithubAuthV3Service } = require('./github-auth-service') -const { - fetchLatestRelease, - queryParamSchema, -} = require('./github-common-release') -const { documentation } = require('./github-helpers') +import {addv} from '../text-formatters.js'; +import {version as versionColor} from '../color-formatters.js'; +import {redirector} from '..'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {fetchLatestRelease, queryParamSchema} from './github-common-release.js'; +import {documentation} from './github-helpers.js'; class GithubRelease extends GithubAuthV3Service { static category = 'version' @@ -122,7 +117,7 @@ const redirects = { }), } -module.exports = { +export default { GithubRelease, ...redirects, -} +}; diff --git a/services/github/github-release.tester.js b/services/github/github-release.tester.js index 6fa28a54853de..943e2629841bd 100644 --- a/services/github/github-release.tester.js +++ b/services/github/github-release.tester.js @@ -1,14 +1,10 @@ -'use strict' +import Joi from 'joi'; +import {isSemver} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const Joi = require('joi') -const { isSemver } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'GithubRelease', - title: 'Github Release', - pathPrefix: '/github', -})) +const t = (function() { + export default __a; +}()) t.create('Release') .get('/v/release/expressjs/express.json') diff --git a/services/github/github-repo-size.service.js b/services/github/github-repo-size.service.js index f581076bf307a..d4455699de286 100644 --- a/services/github/github-repo-size.service.js +++ b/services/github/github-repo-size.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const prettyBytes = require('pretty-bytes') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import prettyBytes from 'pretty-bytes'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ size: nonNegativeInteger, }).required() -module.exports = class GithubRepoSize extends GithubAuthV3Service { +export default class GithubRepoSize extends GithubAuthV3Service { static category = 'size' static route = { base: 'github/repo-size', pattern: ':user/:repo' } static examples = [ @@ -47,4 +45,4 @@ module.exports = class GithubRepoSize extends GithubAuthV3Service { const { size } = await this.fetch({ user, repo }) return this.constructor.render({ size }) } -} +}; diff --git a/services/github/github-repo-size.tester.js b/services/github/github-repo-size.tester.js index 5d1e43da21171..da364e189d345 100644 --- a/services/github/github-repo-size.tester.js +++ b/services/github/github-repo-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('repository size').get('/badges/shields.json').expectBadge({ label: 'repo size', diff --git a/services/github/github-search.service.js b/services/github/github-search.service.js index f8f9d9ddd9d51..c927a4efbcebb 100644 --- a/services/github/github-search.service.js +++ b/services/github/github-search.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { errorMessagesFor, documentation } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {errorMessagesFor, documentation} from './github-helpers.js'; const schema = Joi.object({ total_count: nonNegativeInteger }).required() -module.exports = class GithubSearch extends GithubAuthV3Service { +export default class GithubSearch extends GithubAuthV3Service { static category = 'analysis' static route = { @@ -55,4 +53,4 @@ module.exports = class GithubSearch extends GithubAuthV3Service { }) return this.constructor.render({ query, totalCount }) } -} +}; diff --git a/services/github/github-search.tester.js b/services/github/github-search.tester.js index 83dd403194404..73b47ad1286d9 100644 --- a/services/github/github-search.tester.js +++ b/services/github/github-search.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('hit counter') .get('/badges/shields/async%20handle.json') diff --git a/services/github/github-size.service.js b/services/github/github-size.service.js index 97237a81579f7..9eeb1603690dc 100644 --- a/services/github/github-size.service.js +++ b/services/github/github-size.service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const prettyBytes = require('pretty-bytes') -const { nonNegativeInteger } = require('../validators') -const { NotFound } = require('..') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import prettyBytes from 'pretty-bytes'; +import {nonNegativeInteger} from '../validators.js'; +import {NotFound} from '..'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.alternatives( Joi.object({ @@ -14,7 +12,7 @@ const schema = Joi.alternatives( Joi.array().required() ) -module.exports = class GithubSize extends GithubAuthV3Service { +export default class GithubSize extends GithubAuthV3Service { static category = 'size' static route = { @@ -58,4 +56,4 @@ module.exports = class GithubSize extends GithubAuthV3Service { } return this.constructor.render({ size: body.size }) } -} +}; diff --git a/services/github/github-size.tester.js b/services/github/github-size.tester.js index 9645a469eee22..20f5e463deeba 100644 --- a/services/github/github-size.tester.js +++ b/services/github/github-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('File size') .get('/webcaetano/craft/build/phaser-craft.min.js.json') diff --git a/services/github/github-sponsors.service.js b/services/github/github-sponsors.service.js index 6a465bdceb0d5..b8512918cdf8c 100644 --- a/services/github/github-sponsors.service.js +++ b/services/github/github-sponsors.service.js @@ -1,12 +1,10 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { NotFound } = require('..') -const { GithubAuthV4Service } = require('./github-auth-service') -const { documentation, transformErrors } = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {NotFound} from '..'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation, transformErrors} from './github-helpers.js'; const schema = Joi.object({ data: Joi.object({ @@ -18,7 +16,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class GithubSponsors extends GithubAuthV4Service { +export default class GithubSponsors extends GithubAuthV4Service { static category = 'funding' static route = { base: 'github/sponsors', pattern: ':user' } static examples = [ @@ -81,4 +79,4 @@ module.exports = class GithubSponsors extends GithubAuthV4Service { count, }) } -} +}; diff --git a/services/github/github-sponsors.tester.js b/services/github/github-sponsors.tester.js index ebe0cd50c1759..e5464b52c9065 100644 --- a/services/github/github-sponsors.tester.js +++ b/services/github/github-sponsors.tester.js @@ -1,13 +1,9 @@ -'use strict' +import {isMetric} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const { isMetric } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'GithubSponsors', - title: 'Github Sponsors', - pathPrefix: '/github', -})) +const t = (function() { + export default __a; +}()) t.create('Sponsors').get('/sponsors/Homebrew.json').expectBadge({ label: 'sponsors', diff --git a/services/github/github-stars.service.js b/services/github/github-stars.service.js index 49ce512086724..28c1d99943829 100644 --- a/services/github/github-stars.service.js +++ b/services/github/github-stars.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ stargazers_count: nonNegativeInteger, }).required() -module.exports = class GithubStars extends GithubAuthV3Service { +export default class GithubStars extends GithubAuthV3Service { static category = 'social' static route = { @@ -62,4 +60,4 @@ module.exports = class GithubStars extends GithubAuthV3Service { }) return this.constructor.render({ user, repo, stars }) } -} +}; diff --git a/services/github/github-stars.tester.js b/services/github/github-stars.tester.js index fda46a39d1c27..e821445773365 100644 --- a/services/github/github-stars.tester.js +++ b/services/github/github-stars.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Stars') .get('/badges/shields.json') diff --git a/services/github/github-tag.service.js b/services/github/github-tag.service.js index c0475651a43cc..8731caa094e64 100644 --- a/services/github/github-tag.service.js +++ b/services/github/github-tag.service.js @@ -1,14 +1,12 @@ -'use strict' - -const gql = require('graphql-tag') -const Joi = require('joi') -const { addv } = require('../text-formatters') -const { version: versionColor } = require('../color-formatters') -const { latest } = require('../version') -const { NotFound, redirector } = require('..') -const { GithubAuthV4Service } = require('./github-auth-service') -const { queryParamSchema } = require('./github-common-release') -const { documentation, transformErrors } = require('./github-helpers') +import gql from 'graphql-tag'; +import Joi from 'joi'; +import {addv} from '../text-formatters.js'; +import {version as versionColor} from '../color-formatters.js'; +import {latest} from '../version.js'; +import {NotFound, redirector} from '..'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {queryParamSchema} from './github-common-release.js'; +import {documentation, transformErrors} from './github-helpers.js'; const schema = Joi.object({ data: Joi.object({ @@ -163,7 +161,7 @@ const redirects = { }), } -module.exports = { +export default { GithubTag, ...redirects, -} +}; diff --git a/services/github/github-tag.spec.js b/services/github/github-tag.spec.js index 88ebf8b83889a..c396eb4a8ec04 100644 --- a/services/github/github-tag.spec.js +++ b/services/github/github-tag.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { GithubTag } = require('./github-tag.service') +import {test, given} from 'sazerac'; +import {GithubTag} from './github-tag.service.js'; describe('GithubTag', function () { test(GithubTag.getLatestTag, () => { diff --git a/services/github/github-tag.tester.js b/services/github/github-tag.tester.js index 030eb3283e27c..f9cbd2311374f 100644 --- a/services/github/github-tag.tester.js +++ b/services/github/github-tag.tester.js @@ -1,14 +1,10 @@ -'use strict' +import Joi from 'joi'; +import {isSemver} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const Joi = require('joi') -const { isSemver } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'GithubTag', - title: 'Github Tag', - pathPrefix: '/github', -})) +const t = (function() { + export default __a; +}()) t.create('Tag') .get('/v/tag/expressjs/express.json') diff --git a/services/github/github-top-language.service.js b/services/github/github-top-language.service.js index 9c96e95b64b71..56e9008ff08c0 100644 --- a/services/github/github-top-language.service.js +++ b/services/github/github-top-language.service.js @@ -1,9 +1,7 @@ -'use strict' +import {BaseGithubLanguage} from './github-languages-base.js'; +import {documentation} from './github-helpers.js'; -const { BaseGithubLanguage } = require('./github-languages-base') -const { documentation } = require('./github-helpers') - -module.exports = class GithubTopLanguage extends BaseGithubLanguage { +export default class GithubTopLanguage extends BaseGithubLanguage { static category = 'analysis' static route = { @@ -51,4 +49,4 @@ module.exports = class GithubTopLanguage extends BaseGithubLanguage { totalSize: this.getTotalSize(data), }) } -} +}; diff --git a/services/github/github-top-language.tester.js b/services/github/github-top-language.tester.js index 348d0dbf2c5d5..00fecd2bc0df8 100644 --- a/services/github/github-top-language.tester.js +++ b/services/github/github-top-language.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('top language') .get('/badges/shields.json') diff --git a/services/github/github-total-star.service.js b/services/github/github-total-star.service.js index 705f5123545e5..d025727bb3c7b 100644 --- a/services/github/github-total-star.service.js +++ b/services/github/github-total-star.service.js @@ -1,14 +1,9 @@ -'use strict' - -const Joi = require('joi') -const gql = require('graphql-tag') -const { nonNegativeInteger } = require('../validators') -const { metric } = require('../text-formatters') -const { GithubAuthV4Service } = require('./github-auth-service') -const { - documentation: commonDocumentation, - transformErrors, -} = require('./github-helpers') +import Joi from 'joi'; +import gql from 'graphql-tag'; +import {nonNegativeInteger} from '../validators.js'; +import {metric} from '../text-formatters.js'; +import {GithubAuthV4Service} from './github-auth-service.js'; +import {documentation as commonDocumentation, transformErrors} from './github-helpers.js'; const MAX_REPO_LIMIT = 200 @@ -133,7 +128,7 @@ const queryParamSchema = Joi.object({ affiliations: Joi.string().default('OWNER').custom(validateAffiliations), }).required() -module.exports = class GithubTotalStarService extends GithubAuthV4Service { +export default class GithubTotalStarService extends GithubAuthV4Service { static defaultLabel = 'stars' static category = 'social' @@ -243,4 +238,4 @@ module.exports = class GithubTotalStarService extends GithubAuthV4Service { const totalStars = await this.getTotalStars({ user }, queryParams) return this.constructor.render({ totalStars, user }) } -} +}; diff --git a/services/github/github-total-star.tester.js b/services/github/github-total-star.tester.js index 3f4e106746453..90134584eb0f4 100644 --- a/services/github/github-total-star.tester.js +++ b/services/github/github-total-star.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Stars (User)') .get('/hemantsonu20.json') diff --git a/services/github/github-watchers.service.js b/services/github/github-watchers.service.js index 84b1797c23f45..091e5236efa12 100644 --- a/services/github/github-watchers.service.js +++ b/services/github/github-watchers.service.js @@ -1,16 +1,14 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { GithubAuthV3Service } = require('./github-auth-service') -const { documentation, errorMessagesFor } = require('./github-helpers') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {GithubAuthV3Service} from './github-auth-service.js'; +import {documentation, errorMessagesFor} from './github-helpers.js'; const schema = Joi.object({ subscribers_count: nonNegativeInteger, }).required() -module.exports = class GithubWatchers extends GithubAuthV3Service { +export default class GithubWatchers extends GithubAuthV3Service { static category = 'social' static route = { @@ -61,4 +59,4 @@ module.exports = class GithubWatchers extends GithubAuthV3Service { }) return this.constructor.render({ user, repo, watchers }) } -} +}; diff --git a/services/github/github-watchers.tester.js b/services/github/github-watchers.tester.js index 6d58e6ed85b14..2dd702cad9fe9 100644 --- a/services/github/github-watchers.tester.js +++ b/services/github/github-watchers.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('Watchers') .get('/badges/shields.json') diff --git a/services/github/github-workflow-status.service.js b/services/github/github-workflow-status.service.js index bdcbd4056870f..85aa3b27f9d9b 100644 --- a/services/github/github-workflow-status.service.js +++ b/services/github/github-workflow-status.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService } = require('..') -const { documentation } = require('./github-helpers') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService} from '..'; +import {documentation} from './github-helpers.js'; const schema = Joi.object({ message: Joi.alternatives() @@ -17,7 +15,7 @@ const queryParamSchema = Joi.object({ const keywords = ['action', 'actions'] -module.exports = class GithubWorkflowStatus extends BaseSvgScrapingService { +export default class GithubWorkflowStatus extends BaseSvgScrapingService { static category = 'build' static route = { @@ -99,4 +97,4 @@ module.exports = class GithubWorkflowStatus extends BaseSvgScrapingService { const { status } = await this.fetch({ user, repo, workflow, branch, event }) return renderBuildStatusBadge({ status }) } -} +}; diff --git a/services/github/github-workflow-status.tester.js b/services/github/github-workflow-status.tester.js index 380823e4b59f9..6eadf4ba26b9f 100644 --- a/services/github/github-workflow-status.tester.js +++ b/services/github/github-workflow-status.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) const isWorkflowStatus = Joi.alternatives() .try(isBuildStatus, Joi.equal('no status')) diff --git a/services/gitlab/gitlab-coverage.service.js b/services/gitlab/gitlab-coverage.service.js index 8f69c62c84873..f35d42583b569 100644 --- a/services/gitlab/gitlab-coverage.service.js +++ b/services/gitlab/gitlab-coverage.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage } = require('../color-formatters') -const { optionalUrl } = require('../validators') -const { BaseSvgScrapingService, NotFound } = require('..') +import Joi from 'joi'; +import {coveragePercentage} from '../color-formatters.js'; +import {optionalUrl} from '../validators.js'; +import {BaseSvgScrapingService, NotFound} from '..'; const schema = Joi.object({ message: Joi.string() @@ -38,7 +36,7 @@ Also make sure you have set up code covrage parsing as described { diff --git a/services/liberapay/liberapay-goal.tester.js b/services/liberapay/liberapay-goal.tester.js index a340d4d5e5b48..47b8f333a8693 100644 --- a/services/liberapay/liberapay-goal.tester.js +++ b/services/liberapay/liberapay-goal.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Goal Progress (valid)').get('/Liberapay.json').expectBadge({ label: 'goal progress', diff --git a/services/liberapay/liberapay-patrons.service.js b/services/liberapay/liberapay-patrons.service.js index 0bcb1ac74a4fc..e0f46649774b2 100644 --- a/services/liberapay/liberapay-patrons.service.js +++ b/services/liberapay/liberapay-patrons.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {colorScale} from '../color-formatters.js'; +import {LiberapayBase} from './liberapay-base.js'; -const { metric } = require('../text-formatters') -const { colorScale } = require('../color-formatters') -const { LiberapayBase } = require('./liberapay-base') - -module.exports = class LiberapayPatrons extends LiberapayBase { +export default class LiberapayPatrons extends LiberapayBase { static route = this.buildRoute('patrons') static examples = [ @@ -27,4 +25,4 @@ module.exports = class LiberapayPatrons extends LiberapayBase { const data = await this.fetch({ entity }) return this.constructor.render({ patrons: data.npatrons }) } -} +}; diff --git a/services/liberapay/liberapay-patrons.tester.js b/services/liberapay/liberapay-patrons.tester.js index 5eee881d67bb2..646019a7eab6e 100644 --- a/services/liberapay/liberapay-patrons.tester.js +++ b/services/liberapay/liberapay-patrons.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Patrons (valid)').get('/Liberapay.json').expectBadge({ label: 'patrons', diff --git a/services/liberapay/liberapay-receives.service.js b/services/liberapay/liberapay-receives.service.js index b3cf59d91a414..c6953de1ecdee 100644 --- a/services/liberapay/liberapay-receives.service.js +++ b/services/liberapay/liberapay-receives.service.js @@ -1,9 +1,7 @@ -'use strict' +import {InvalidResponse} from '..'; +import {renderCurrencyBadge, LiberapayBase} from './liberapay-base.js'; -const { InvalidResponse } = require('..') -const { renderCurrencyBadge, LiberapayBase } = require('./liberapay-base') - -module.exports = class LiberapayReceives extends LiberapayBase { +export default class LiberapayReceives extends LiberapayBase { static route = this.buildRoute('receives') static examples = [ @@ -30,4 +28,4 @@ module.exports = class LiberapayReceives extends LiberapayBase { throw new InvalidResponse({ prettyMessage: 'no public receiving stats' }) } } -} +}; diff --git a/services/liberapay/liberapay-receives.tester.js b/services/liberapay/liberapay-receives.tester.js index d2b7a71e4f51d..b2cfb1eb227a6 100644 --- a/services/liberapay/liberapay-receives.tester.js +++ b/services/liberapay/liberapay-receives.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isCurrencyOverTime } = require('./liberapay-base') +const t = (function() { + export default __a; +}()) +import {isCurrencyOverTime} from './liberapay-base.js'; t.create('Receiving (valid)').get('/Changaco.json').expectBadge({ label: 'receives', diff --git a/services/librariesio/librariesio-common.js b/services/librariesio/librariesio-common.js index 7421be27f0536..7e1f09cce113f 100644 --- a/services/librariesio/librariesio-common.js +++ b/services/librariesio/librariesio-common.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger, anyInteger } = require('../validators') +import Joi from 'joi'; +import {nonNegativeInteger, anyInteger} from '../validators.js'; // API doc: https://libraries.io/api#project const projectSchema = Joi.object({ @@ -21,6 +19,6 @@ async function fetchProject(serviceInstance, { platform, scope, packageName }) { }) } -module.exports = { +export default { fetchProject, -} +}; diff --git a/services/librariesio/librariesio-dependencies-helpers.js b/services/librariesio/librariesio-dependencies-helpers.js index f9bf0b1908ca5..41fcfc890c38f 100644 --- a/services/librariesio/librariesio-dependencies-helpers.js +++ b/services/librariesio/librariesio-dependencies-helpers.js @@ -1,5 +1,3 @@ -'use strict' - function transform({ dependencies }) { return { deprecatedCount: dependencies.filter(dep => dep.deprecated).length, @@ -28,4 +26,4 @@ function renderDependenciesBadge({ deprecatedCount, outdatedCount }) { } } -module.exports = { transform, renderDependenciesBadge } +export default { transform, renderDependenciesBadge }; diff --git a/services/librariesio/librariesio-dependencies-helpers.spec.js b/services/librariesio/librariesio-dependencies-helpers.spec.js index e073352b1cbbc..2badbbf90d5b4 100644 --- a/services/librariesio/librariesio-dependencies-helpers.spec.js +++ b/services/librariesio/librariesio-dependencies-helpers.spec.js @@ -1,9 +1,5 @@ -'use strict' - -const { test, given, forCases } = require('sazerac') -const { - renderDependenciesBadge, -} = require('./librariesio-dependencies-helpers') +import {test, given, forCases} from 'sazerac'; +import {renderDependenciesBadge} from './librariesio-dependencies-helpers.js'; describe('Libraries.io dependency helpers', function () { test(renderDependenciesBadge, () => { diff --git a/services/librariesio/librariesio-dependencies.service.js b/services/librariesio/librariesio-dependencies.service.js index 2b30e4453c05b..c91e02020b06e 100644 --- a/services/librariesio/librariesio-dependencies.service.js +++ b/services/librariesio/librariesio-dependencies.service.js @@ -1,11 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { - transform, - renderDependenciesBadge, -} = require('./librariesio-dependencies-helpers') +import Joi from 'joi'; +import {BaseJsonService} from '..'; +import {transform, renderDependenciesBadge} from './librariesio-dependencies-helpers.js'; const schema = Joi.object({ dependencies: Joi.array() @@ -134,4 +129,4 @@ class LibrariesIoRepoDependencies extends BaseJsonService { } } -module.exports = [LibrariesIoProjectDependencies, LibrariesIoRepoDependencies] +export default [LibrariesIoProjectDependencies, LibrariesIoRepoDependencies]; diff --git a/services/librariesio/librariesio-dependencies.tester.js b/services/librariesio/librariesio-dependencies.tester.js index 45bcabddbe6d7..c4d5eb02baa8d 100644 --- a/services/librariesio/librariesio-dependencies.tester.js +++ b/services/librariesio/librariesio-dependencies.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isDependencyState } = require('../test-validators') -const t = (module.exports = new ServiceTester({ - id: 'LibrariesIoDependencies', - title: 'LibrariesIoDependencies', - pathPrefix: '/librariesio', -})) +import {ServiceTester} from '../tester.js'; +import {isDependencyState} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('dependencies for package (project name contains dot)') .timeout(10000) diff --git a/services/librariesio/librariesio-dependent-repos.service.js b/services/librariesio/librariesio-dependent-repos.service.js index 8d19449d58540..e5e727e989453 100644 --- a/services/librariesio/librariesio-dependent-repos.service.js +++ b/services/librariesio/librariesio-dependent-repos.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { metric } = require('../text-formatters') -const { BaseJsonService } = require('..') -const { fetchProject } = require('./librariesio-common') +import {metric} from '../text-formatters.js'; +import {BaseJsonService} from '..'; +import {fetchProject} from './librariesio-common.js'; // https://libraries.io/api#project-dependent-repositories -module.exports = class LibrariesIoDependentRepos extends BaseJsonService { +export default class LibrariesIoDependentRepos extends BaseJsonService { static category = 'other' static route = { @@ -57,4 +55,4 @@ module.exports = class LibrariesIoDependentRepos extends BaseJsonService { ) return this.constructor.render({ dependentReposCount }) } -} +}; diff --git a/services/librariesio/librariesio-dependent-repos.tester.js b/services/librariesio/librariesio-dependent-repos.tester.js index f15fe079cda71..61e08195533e0 100644 --- a/services/librariesio/librariesio-dependent-repos.tester.js +++ b/services/librariesio/librariesio-dependent-repos.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('dependent repo count') .timeout(10000) diff --git a/services/librariesio/librariesio-dependents.service.js b/services/librariesio/librariesio-dependents.service.js index 9f849206e0ae0..772903a459c45 100644 --- a/services/librariesio/librariesio-dependents.service.js +++ b/services/librariesio/librariesio-dependents.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { metric } = require('../text-formatters') -const { BaseJsonService } = require('..') -const { fetchProject } = require('./librariesio-common') +import {metric} from '../text-formatters.js'; +import {BaseJsonService} from '..'; +import {fetchProject} from './librariesio-common.js'; // https://libraries.io/api#project-dependents -module.exports = class LibrariesIoDependents extends BaseJsonService { +export default class LibrariesIoDependents extends BaseJsonService { static category = 'other' static route = { @@ -54,4 +52,4 @@ module.exports = class LibrariesIoDependents extends BaseJsonService { }) return this.constructor.render({ dependentCount }) } -} +}; diff --git a/services/librariesio/librariesio-dependents.tester.js b/services/librariesio/librariesio-dependents.tester.js index a0b6a24d7ba28..34729a06c23b3 100644 --- a/services/librariesio/librariesio-dependents.tester.js +++ b/services/librariesio/librariesio-dependents.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('dependent count').timeout(10000).get('/npm/got.json').expectBadge({ label: 'dependents', diff --git a/services/librariesio/librariesio-sourcerank.service.js b/services/librariesio/librariesio-sourcerank.service.js index 98881416b919f..48b0c1b326e0c 100644 --- a/services/librariesio/librariesio-sourcerank.service.js +++ b/services/librariesio/librariesio-sourcerank.service.js @@ -1,12 +1,10 @@ -'use strict' - -const { colorScale } = require('../color-formatters') -const { BaseJsonService } = require('..') -const { fetchProject } = require('./librariesio-common') +import {colorScale} from '../color-formatters.js'; +import {BaseJsonService} from '..'; +import {fetchProject} from './librariesio-common.js'; const sourceRankColor = colorScale([10, 15, 20, 25, 30]) -module.exports = class LibrariesIoSourcerank extends BaseJsonService { +export default class LibrariesIoSourcerank extends BaseJsonService { static category = 'rating' static route = { @@ -55,4 +53,4 @@ module.exports = class LibrariesIoSourcerank extends BaseJsonService { }) return this.constructor.render({ rank }) } -} +}; diff --git a/services/librariesio/librariesio-sourcerank.tester.js b/services/librariesio/librariesio-sourcerank.tester.js index c76d302dc520c..efe0d72a1c11e 100644 --- a/services/librariesio/librariesio-sourcerank.tester.js +++ b/services/librariesio/librariesio-sourcerank.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { anyInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {anyInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('sourcerank').timeout(10000).get('/npm/got.json').expectBadge({ label: 'sourcerank', diff --git a/services/libscore/libscore.service.js b/services/libscore/libscore.service.js index 6dd0a755a9aae..4febb62f60217 100644 --- a/services/libscore/libscore.service.js +++ b/services/libscore/libscore.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'rating', route: { base: 'libscore/s', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'libscore', dateAdded: new Date('2018-09-22'), -}) +}); diff --git a/services/libscore/libscore.tester.js b/services/libscore/libscore.tester.js index 223e8b3d58962..fac80525912e9 100644 --- a/services/libscore/libscore.tester.js +++ b/services/libscore/libscore.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { ServiceTester } = require('../tester') +import {ServiceTester} from '../tester.js'; const t = new ServiceTester({ id: 'libscore', title: 'libscore' }) -module.exports = t +export default t; t.create('no longer available (previously usage statistics)') .get('/s/jQuery.json') diff --git a/services/licenses.js b/services/licenses.js index b6efcb8ae0d15..6782d6ff81cc3 100644 --- a/services/licenses.js +++ b/services/licenses.js @@ -1,6 +1,4 @@ -'use strict' - -const toArray = require('../core/base-service/to-array') +import toArray from '../core/base-service/to-array.js'; const licenseTypes = { // permissive licenses - not public domain and not copyleft @@ -130,4 +128,4 @@ function renderLicenseBadge({ license, licenses }) { } } -module.exports = { licenseToColor, renderLicenseBadge } +export default { licenseToColor, renderLicenseBadge }; diff --git a/services/licenses.spec.js b/services/licenses.spec.js index 58e95285b6496..c7044e83937b0 100644 --- a/services/licenses.spec.js +++ b/services/licenses.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given, forCases } = require('sazerac') -const { licenseToColor, renderLicenseBadge } = require('./licenses') +import {test, given, forCases} from 'sazerac'; +import {licenseToColor, renderLicenseBadge} from './licenses.js'; describe('license helpers', function () { test(licenseToColor, () => { diff --git a/services/localizely/localizely.service.js b/services/localizely/localizely.service.js index d29d50d658125..46e5b82677fed 100644 --- a/services/localizely/localizely.service.js +++ b/services/localizely/localizely.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, InvalidResponse } = require('..') -const { coveragePercentage } = require('../color-formatters') +import Joi from 'joi'; +import {BaseJsonService, InvalidResponse} from '..'; +import {coveragePercentage} from '../color-formatters.js'; const keywords = [ 'l10n', @@ -51,7 +49,7 @@ const queryParamSchema = Joi.object({ languageCode: Joi.string().regex(/^[a-z]{2}(-[A-Z][a-z]{3})?(-[A-Z]{2})?$/), }).required() -module.exports = class Localizely extends BaseJsonService { +export default class Localizely extends BaseJsonService { static category = 'other' static route = { @@ -143,4 +141,4 @@ module.exports = class Localizely extends BaseJsonService { return this.constructor.render({ langName, reviewedProgress }) } -} +}; diff --git a/services/localizely/localizely.tester.js b/services/localizely/localizely.tester.js index 814573a499776..385a000178424 100644 --- a/services/localizely/localizely.tester.js +++ b/services/localizely/localizely.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isIntegerPercentage } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isIntegerPercentage} from '../test-validators.js'; t.create('Overall progress') .get( diff --git a/services/luarocks/luarocks-version-helpers.js b/services/luarocks/luarocks-version-helpers.js index ee1526adc8fd8..d1ff5a5b703ac 100644 --- a/services/luarocks/luarocks-version-helpers.js +++ b/services/luarocks/luarocks-version-helpers.js @@ -24,9 +24,7 @@ * https://github.com/luarocks/luarocks/blob/405ee29ba8444d97646f62e72effeaff2bfe3f79/src/luarocks/search.lua#L182 * https://github.com/luarocks/luarocks/blob/405ee29ba8444d97646f62e72effeaff2bfe3f79/src/luarocks/core/vers.lua#L83 */ -'use strict' - -const { omitv } = require('../text-formatters') +import {omitv} from '../text-formatters.js'; // Compare two arrays containing split and transformed to // positive/negative numbers parts of version strings, @@ -86,8 +84,8 @@ function latestVersion(versions) { .pop() } -module.exports = { +export default { parseVersion, compareVersionLists, latestVersion, -} +}; diff --git a/services/luarocks/luarocks-version-helpers.spec.js b/services/luarocks/luarocks-version-helpers.spec.js index 22064de414d52..06f721ac1832f 100644 --- a/services/luarocks/luarocks-version-helpers.spec.js +++ b/services/luarocks/luarocks-version-helpers.spec.js @@ -1,11 +1,5 @@ -'use strict' - -const { test, given, forCases } = require('sazerac') -const { - parseVersion, - compareVersionLists, - latestVersion, -} = require('./luarocks-version-helpers') +import {test, given, forCases} from 'sazerac'; +import {parseVersion, compareVersionLists, latestVersion} from './luarocks-version-helpers.js'; describe('LuaRocks-specific helpers', function () { test(compareVersionLists, () => { diff --git a/services/luarocks/luarocks.service.js b/services/luarocks/luarocks.service.js index 4ce526f27f2e4..2e8261935bc22 100644 --- a/services/luarocks/luarocks.service.js +++ b/services/luarocks/luarocks.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { addv } = require('../text-formatters') -const { BaseJsonService, NotFound } = require('..') -const { latestVersion } = require('./luarocks-version-helpers') +import Joi from 'joi'; +import {addv} from '../text-formatters.js'; +import {BaseJsonService, NotFound} from '..'; +import {latestVersion} from './luarocks-version-helpers.js'; const schema = Joi.object({ repository: Joi.object() @@ -14,7 +12,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class Luarocks extends BaseJsonService { +export default class Luarocks extends BaseJsonService { static category = 'version' static route = { @@ -88,4 +86,4 @@ module.exports = class Luarocks extends BaseJsonService { } return this.constructor.render({ version }) } -} +}; diff --git a/services/luarocks/luarocks.spec.js b/services/luarocks/luarocks.spec.js index ad6479ef7d501..a2e11fcf70715 100644 --- a/services/luarocks/luarocks.spec.js +++ b/services/luarocks/luarocks.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const Luarocks = require('./luarocks.service') +import {test, given} from 'sazerac'; +import Luarocks from './luarocks.service.js'; test(Luarocks.render, () => { given({ version: 'dev-1' }).expect({ message: 'dev-1', color: 'yellow' }) diff --git a/services/luarocks/luarocks.tester.js b/services/luarocks/luarocks.tester.js index 0e60caf896377..479bfe9b90463 100644 --- a/services/luarocks/luarocks.tester.js +++ b/services/luarocks/luarocks.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isLuaVersion = Joi.string() .regex(/^v\d+\.\d+\.\d+-\d+$/) diff --git a/services/magnumci/magnumci.service.js b/services/magnumci/magnumci.service.js index 5a01a0304b38a..51b31717f046b 100644 --- a/services/magnumci/magnumci.service.js +++ b/services/magnumci/magnumci.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'build', route: { base: 'magnumci/ci', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'magnum ci', dateAdded: new Date('2018-07-08'), -}) +}); diff --git a/services/magnumci/magnumci.tester.js b/services/magnumci/magnumci.tester.js index d88d56f757622..0da8de3546228 100644 --- a/services/magnumci/magnumci.tester.js +++ b/services/magnumci/magnumci.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { ServiceTester } = require('../tester') +import {ServiceTester} from '../tester.js'; const t = new ServiceTester({ id: 'magnumci', title: 'Magnum CI' }) -module.exports = t +export default t; t.create('no longer available') .get('/ci/96ffb83fa700f069024921b0702e76ff.json') diff --git a/services/maintenance/maintenance.service.js b/services/maintenance/maintenance.service.js index e05da9f6bb7b4..c12cb4e025c87 100644 --- a/services/maintenance/maintenance.service.js +++ b/services/maintenance/maintenance.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseService} from '..'; -const { BaseService } = require('..') - -module.exports = class Maintenance extends BaseService { +export default class Maintenance extends BaseService { static category = 'other' static route = { @@ -74,4 +72,4 @@ module.exports = class Maintenance extends BaseService { message: maintained, }) } -} +}; diff --git a/services/maintenance/maintenance.spec.js b/services/maintenance/maintenance.spec.js index 460df7fa941ec..72f2b76a3619f 100644 --- a/services/maintenance/maintenance.spec.js +++ b/services/maintenance/maintenance.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const Maintenance = require('./maintenance.service') +import {test, given} from 'sazerac'; +import Maintenance from './maintenance.service.js'; describe('Maintenance', function () { test(Maintenance.prototype.transform, () => { diff --git a/services/maintenance/maintenance.tester.js b/services/maintenance/maintenance.tester.js index 04e53ee0bea41..7a3fc81510b88 100644 --- a/services/maintenance/maintenance.tester.js +++ b/services/maintenance/maintenance.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) const currentYear = new Date().getUTCFullYear() diff --git a/services/mastodon/mastodon-follow.service.js b/services/mastodon/mastodon-follow.service.js index 9e0881b5adfd7..707f82498bf2e 100644 --- a/services/mastodon/mastodon-follow.service.js +++ b/services/mastodon/mastodon-follow.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { optionalUrl, nonNegativeInteger } = require('../validators') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {optionalUrl, nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; const schema = Joi.object({ username: Joi.string().required(), @@ -20,7 +18,7 @@ const documentation = `

Failing that, you can also visit your profile page, where your user ID will be in the header in a tag like this: <link href='https://your.mastodon.server/api/salmon/{your-user-id}' rel='salmon'>

` -module.exports = class MastodonFollow extends BaseJsonService { +export default class MastodonFollow extends BaseJsonService { static category = 'social' static route = { @@ -78,4 +76,4 @@ module.exports = class MastodonFollow extends BaseJsonService { domain, }) } -} +}; diff --git a/services/mastodon/mastodon-follow.tester.js b/services/mastodon/mastodon-follow.tester.js index 4f68ec5df905a..facacee5904bd 100644 --- a/services/mastodon/mastodon-follow.tester.js +++ b/services/mastodon/mastodon-follow.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Followers - default domain') .get('/26471.json') diff --git a/services/matrix/matrix.service.js b/services/matrix/matrix.service.js index 55239edfa379f..314eb6b6b8789 100644 --- a/services/matrix/matrix.service.js +++ b/services/matrix/matrix.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, InvalidParameter } = require('..') +import Joi from 'joi'; +import {BaseJsonService, InvalidParameter} from '..'; const queryParamSchema = Joi.object({ server_fqdn: Joi.string().hostname(), @@ -52,7 +50,7 @@ const documentation = `

` -module.exports = class Matrix extends BaseJsonService { +export default class Matrix extends BaseJsonService { static category = 'chat' static route = { @@ -196,4 +194,4 @@ module.exports = class Matrix extends BaseJsonService { const members = await this.fetch({ roomAlias, serverFQDN }) return this.constructor.render({ members }) } -} +}; diff --git a/services/matrix/matrix.tester.js b/services/matrix/matrix.tester.js index 564df75ad80b7..e0e6b59a4376f 100644 --- a/services/matrix/matrix.tester.js +++ b/services/matrix/matrix.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('get room state as guest') .get('/ALIAS:DUMMY.dumb.json') diff --git a/services/maven-central/maven-central.service.js b/services/maven-central/maven-central.service.js index dfa9c1d251a25..9bbd322250668 100644 --- a/services/maven-central/maven-central.service.js +++ b/services/maven-central/maven-central.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseXmlService, NotFound } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseXmlService, NotFound} from '..'; const schema = Joi.object({ metadata: Joi.object({ @@ -14,7 +12,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class MavenCentral extends BaseXmlService { +export default class MavenCentral extends BaseXmlService { static category = 'version' static route = { @@ -79,4 +77,4 @@ module.exports = class MavenCentral extends BaseXmlService { } return renderVersionBadge({ version }) } -} +}; diff --git a/services/maven-central/maven-central.tester.js b/services/maven-central/maven-central.tester.js index cde5e050cc004..1f678df58952d 100644 --- a/services/maven-central/maven-central.tester.js +++ b/services/maven-central/maven-central.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('latest version') .get('/com.github.fabriziocucci/yacl4j.json') // http://repo1.maven.org/maven2/com/github/fabriziocucci/yacl4j/ diff --git a/services/maven-metadata/maven-metadata-redirect.service.js b/services/maven-metadata/maven-metadata-redirect.service.js index c713ddd35028b..fb275c6cfd4dc 100644 --- a/services/maven-metadata/maven-metadata-redirect.service.js +++ b/services/maven-metadata/maven-metadata-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = redirector({ +export default redirector({ category: 'version', route: { base: 'maven-metadata/v', @@ -13,4 +11,4 @@ module.exports = redirector({ metadataUrl: `${protocol}://${hostAndPath}`, }), dateAdded: new Date('2019-09-16'), -}) +}); diff --git a/services/maven-metadata/maven-metadata-redirect.tester.js b/services/maven-metadata/maven-metadata-redirect.tester.js index 4694203de109e..445bfaeb7d259 100644 --- a/services/maven-metadata/maven-metadata-redirect.tester.js +++ b/services/maven-metadata/maven-metadata-redirect.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('maven metadata (badge extension)') .get( diff --git a/services/maven-metadata/maven-metadata.service.js b/services/maven-metadata/maven-metadata.service.js index 5ad0d5856e28c..6bc71a8443664 100644 --- a/services/maven-metadata/maven-metadata.service.js +++ b/services/maven-metadata/maven-metadata.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { renderVersionBadge } = require('../version') -const { BaseXmlService } = require('..') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {renderVersionBadge} from '../version.js'; +import {BaseXmlService} from '..'; const queryParamSchema = Joi.object({ metadataUrl: optionalUrl.required(), @@ -19,7 +17,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class MavenMetadata extends BaseXmlService { +export default class MavenMetadata extends BaseXmlService { static category = 'version' static route = { @@ -58,4 +56,4 @@ module.exports = class MavenMetadata extends BaseXmlService { version: data.metadata.versioning.versions.version.slice(-1)[0], }) } -} +}; diff --git a/services/maven-metadata/maven-metadata.tester.js b/services/maven-metadata/maven-metadata.tester.js index 4eda201f4df38..2064b4653fbce 100644 --- a/services/maven-metadata/maven-metadata.tester.js +++ b/services/maven-metadata/maven-metadata.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; t.create('valid maven-metadata.xml uri') .get( diff --git a/services/microbadger/microbadger-base.js b/services/microbadger/microbadger-base.js index 81b98f4b9f8cd..544737dbf2f68 100644 --- a/services/microbadger/microbadger-base.js +++ b/services/microbadger/microbadger-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; const schema = Joi.object({ LayerCount: nonNegativeInteger, @@ -25,7 +23,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class BaseMicrobadgerService extends BaseJsonService { +export default class BaseMicrobadgerService extends BaseJsonService { static category = 'size' async fetch({ user, repo }) { @@ -50,4 +48,4 @@ module.exports = class BaseMicrobadgerService extends BaseJsonService { } return image } -} +}; diff --git a/services/microbadger/microbadger-layers.service.js b/services/microbadger/microbadger-layers.service.js index 46e45ff36ed60..a46b5e7f4f182 100644 --- a/services/microbadger/microbadger-layers.service.js +++ b/services/microbadger/microbadger-layers.service.js @@ -1,8 +1,6 @@ -'use strict' +import BaseMicrobadgerService from './microbadger-base.js'; -const BaseMicrobadgerService = require('./microbadger-base') - -module.exports = class MicrobadgerLayers extends BaseMicrobadgerService { +export default class MicrobadgerLayers extends BaseMicrobadgerService { static route = { base: 'microbadger/layers', pattern: ':user/:repo/:tag*', @@ -39,4 +37,4 @@ module.exports = class MicrobadgerLayers extends BaseMicrobadgerService { const image = this.constructor.getImage(data, tag) return this.constructor.render({ layers: image.LayerCount }) } -} +}; diff --git a/services/microbadger/microbadger-layers.tester.js b/services/microbadger/microbadger-layers.tester.js index d2fd1a828babb..ca503ce16c79e 100644 --- a/services/microbadger/microbadger-layers.tester.js +++ b/services/microbadger/microbadger-layers.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('layers without a specified tag') .get('/_/alpine.json') diff --git a/services/microbadger/microbadger-size.service.js b/services/microbadger/microbadger-size.service.js index afeb7efe281dd..1e20d9543f482 100644 --- a/services/microbadger/microbadger-size.service.js +++ b/services/microbadger/microbadger-size.service.js @@ -1,8 +1,6 @@ -'use strict' - -const prettyBytes = require('pretty-bytes') -const { NotFound } = require('..') -const BaseMicrobadgerService = require('./microbadger-base') +import prettyBytes from 'pretty-bytes'; +import {NotFound} from '..'; +import BaseMicrobadgerService from './microbadger-base.js'; const documentation = `

@@ -27,7 +25,7 @@ const documentation = `

` -module.exports = class MicrobadgerSize extends BaseMicrobadgerService { +export default class MicrobadgerSize extends BaseMicrobadgerService { static route = { base: 'microbadger/image-size', pattern: ':user/:repo/:tag*', @@ -71,4 +69,4 @@ module.exports = class MicrobadgerSize extends BaseMicrobadgerService { } return this.constructor.render({ size: image.DownloadSize }) } -} +}; diff --git a/services/microbadger/microbadger-size.tester.js b/services/microbadger/microbadger-size.tester.js index 4e6613e6e7f0f..80f5615286e12 100644 --- a/services/microbadger/microbadger-size.tester.js +++ b/services/microbadger/microbadger-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('image size without a specified tag') .get('/fedora/apache.json') diff --git a/services/mozilla-observatory/mozilla-observatory.service.js b/services/mozilla-observatory/mozilla-observatory.service.js index 30e9ce43cb8c5..2b388bf541906 100644 --- a/services/mozilla-observatory/mozilla-observatory.service.js +++ b/services/mozilla-observatory/mozilla-observatory.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ state: Joi.string() @@ -45,7 +43,7 @@ const documentation = `

` -module.exports = class MozillaObservatory extends BaseJsonService { +export default class MozillaObservatory extends BaseJsonService { // TODO: Once created, change to a more appropriate category, // see https://github.com/badges/shields/pull/2926#issuecomment-460777017 static category = 'monitoring' @@ -114,4 +112,4 @@ module.exports = class MozillaObservatory extends BaseJsonService { const { state, grade, score } = await this.fetch({ host, publish }) return this.constructor.render({ format, state, grade, score }) } -} +}; diff --git a/services/mozilla-observatory/mozilla-observatory.tester.js b/services/mozilla-observatory/mozilla-observatory.tester.js index a169bac2fc7db..43709a9755cc5 100644 --- a/services/mozilla-observatory/mozilla-observatory.tester.js +++ b/services/mozilla-observatory/mozilla-observatory.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isMessage = Joi.alternatives() .try( diff --git a/services/myget/myget.service.js b/services/myget/myget.service.js index 38f17e5c0883a..13d4feb225d39 100644 --- a/services/myget/myget.service.js +++ b/services/myget/myget.service.js @@ -1,6 +1,4 @@ -'use strict' - -const { createServiceFamily } = require('../nuget/nuget-v3-service-family') +import {createServiceFamily} from '../nuget/nuget-v3-service-family.js'; const { NugetVersionService: Version, NugetDownloadService: Downloads } = createServiceFamily({ @@ -57,7 +55,7 @@ class MyGetDownloadService extends Downloads { ] } -module.exports = { +export default { MyGetVersionService, MyGetDownloadService, -} +}; diff --git a/services/myget/myget.tester.js b/services/myget/myget.tester.js index bb9ca7fa2a8eb..d5c113ef2930d 100644 --- a/services/myget/myget.tester.js +++ b/services/myget/myget.tester.js @@ -1,23 +1,11 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { - isMetric, - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') -const { - queryIndex, - nuGetV3VersionJsonWithDash, - nuGetV3VersionJsonFirstCharZero, - nuGetV3VersionJsonFirstCharNotZero, -} = require('../nuget-fixtures') -const { invalidJSON } = require('../response-fixtures') - -const t = (module.exports = new ServiceTester({ - id: 'myget', - title: 'MyGet', - pathPrefix: '', -})) +import {ServiceTester} from '../tester.js'; +import {isMetric, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import {queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero} from '../nuget-fixtures.js'; +import {invalidJSON} from '../response-fixtures.js'; + +const t = (function() { + export default __a; +}()) // downloads diff --git a/services/netlify/netlify.service.js b/services/netlify/netlify.service.js index 37485fde708d2..4371d292f7912 100644 --- a/services/netlify/netlify.service.js +++ b/services/netlify/netlify.service.js @@ -1,7 +1,5 @@ -'use strict' - -const { renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService } = require('..') +import {renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService} from '..'; const pendingStatus = 'building' const notBuiltStatus = 'not built' @@ -16,7 +14,7 @@ const statusMap = { infrastructure_failure: 'failed', } -module.exports = class Netlify extends BaseSvgScrapingService { +export default class Netlify extends BaseSvgScrapingService { static category = 'build' static route = { @@ -64,4 +62,4 @@ module.exports = class Netlify extends BaseSvgScrapingService { const { message: status } = await this.fetch({ projectId, branch }) return this.constructor.render({ status }) } -} +}; diff --git a/services/netlify/netlify.spec.js b/services/netlify/netlify.spec.js index faee3111220d9..9fa88bb3625de 100644 --- a/services/netlify/netlify.spec.js +++ b/services/netlify/netlify.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const Netlify = require('./netlify.service') +import {test, given} from 'sazerac'; +import Netlify from './netlify.service.js'; const building = { message: 'building', label: undefined, color: 'yellow' } const notBuilt = { message: 'not built', label: undefined, color: undefined } diff --git a/services/netlify/netlify.tester.js b/services/netlify/netlify.tester.js index abea04611958a..9ed0241bc8d73 100644 --- a/services/netlify/netlify.tester.js +++ b/services/netlify/netlify.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('netlify (valid, no branch)') .get('/e6d5a4e0-dee1-4261-833e-2f47f509c68f.json') diff --git a/services/nexus/nexus-redirect.service.js b/services/nexus/nexus-redirect.service.js index fb194284aefa5..605e098910b33 100644 --- a/services/nexus/nexus-redirect.service.js +++ b/services/nexus/nexus-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'version', route: { @@ -18,4 +16,4 @@ module.exports = [ }), dateAdded: new Date('2019-07-26'), }), -] +]; diff --git a/services/nexus/nexus-redirect.tester.js b/services/nexus/nexus-redirect.tester.js index 7e6b3f56a86d2..2c2d496d97206 100644 --- a/services/nexus/nexus-redirect.tester.js +++ b/services/nexus/nexus-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'NexusRedirect', - title: 'NexusRedirect', - pathPrefix: '/nexus', -})) +const t = (function() { + export default __a; +}()) t.create('Nexus release') .get('/r/https/oss.sonatype.org/com.google.guava/guava.svg') diff --git a/services/nexus/nexus-version.js b/services/nexus/nexus-version.js index 89b1f4a66f2c1..5d57dc7d2f0ce 100644 --- a/services/nexus/nexus-version.js +++ b/services/nexus/nexus-version.js @@ -1,10 +1,8 @@ -'use strict' - function isSnapshotVersion(version) { const pattern = /(\d+\.)*[0-9a-f]-SNAPSHOT/ return version && version.match(pattern) } -module.exports = { +export default { isSnapshotVersion, -} +}; diff --git a/services/nexus/nexus.service.js b/services/nexus/nexus.service.js index 7906b6933c500..8350fd9f07dec 100644 --- a/services/nexus/nexus.service.js +++ b/services/nexus/nexus.service.js @@ -1,14 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { version: versionColor } = require('../color-formatters') -const { addv } = require('../text-formatters') -const { optionalUrl } = require('../validators') -const { - optionalDottedVersionNClausesWithOptionalSuffix, -} = require('../validators') -const { BaseJsonService, InvalidResponse, NotFound } = require('..') -const { isSnapshotVersion } = require('./nexus-version') +import Joi from 'joi'; +import {version as versionColor} from '../color-formatters.js'; +import {addv} from '../text-formatters.js'; +import {optionalUrl, optionalDottedVersionNClausesWithOptionalSuffix} from '../validators.js'; +import {BaseJsonService, InvalidResponse, NotFound} from '..'; +import {isSnapshotVersion} from './nexus-version.js'; const nexus2SearchApiSchema = Joi.object({ data: Joi.array() @@ -53,7 +48,7 @@ const queryParamSchema = Joi.object({ nexusVersion: Joi.equal('2', '3'), }).required() -module.exports = class Nexus extends BaseJsonService { +export default class Nexus extends BaseJsonService { static category = 'version' static route = { @@ -337,4 +332,4 @@ module.exports = class Nexus extends BaseJsonService { const { version } = this.transform({ repo, json, actualNexusVersion }) return this.constructor.render({ version }) } -} +}; diff --git a/services/nexus/nexus.spec.js b/services/nexus/nexus.spec.js index d06c051f2672c..c7af2dc639149 100644 --- a/services/nexus/nexus.spec.js +++ b/services/nexus/nexus.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const { InvalidResponse, NotFound } = require('..') -const Nexus = require('./nexus.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import {InvalidResponse, NotFound} from '..'; +import Nexus from './nexus.service.js'; describe('Nexus', function () { context('transform2()', function () { diff --git a/services/nexus/nexus.tester.js b/services/nexus/nexus.tester.js index f2c37a351be82..16a72da362289 100644 --- a/services/nexus/nexus.tester.js +++ b/services/nexus/nexus.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { - isVPlusDottedVersionNClausesWithOptionalSuffix: isVersion, -} = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionNClausesWithOptionalSuffix as isVersion} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Nexus 2 - search release version valid artifact') .timeout(15000) diff --git a/services/node/node-base.js b/services/node/node-base.js index 007ad6e4b93af..90932c84fff4d 100644 --- a/services/node/node-base.js +++ b/services/node/node-base.js @@ -1,10 +1,8 @@ -'use strict' - -const NPMBase = require('../npm/npm-base') +import NPMBase from '../npm/npm-base.js'; const keywords = ['npm'] -module.exports = class NodeVersionBase extends NPMBase { +export default class NodeVersionBase extends NPMBase { static category = 'platform-support' static get examples() { @@ -119,4 +117,4 @@ module.exports = class NodeVersionBase extends NPMBase { return this.constructor.render({ tag, nodeVersionRange }) } -} +}; diff --git a/services/node/node-current.service.js b/services/node/node-current.service.js index cea93959e662e..32ab3a42c0f71 100644 --- a/services/node/node-current.service.js +++ b/services/node/node-current.service.js @@ -1,9 +1,7 @@ -'use strict' +import NodeVersionBase from './node-base.js'; +import {versionColorForRangeCurrent} from './node-version-color.js'; -const NodeVersionBase = require('./node-base') -const { versionColorForRangeCurrent } = require('./node-version-color') - -module.exports = class NodeCurrentVersion extends NodeVersionBase { +export default class NodeCurrentVersion extends NodeVersionBase { static route = this.buildRoute('node/v', { withTag: true }) static defaultBadgeData = { @@ -15,4 +13,4 @@ module.exports = class NodeCurrentVersion extends NodeVersionBase { static colorResolver = versionColorForRangeCurrent static documentation = `This badge indicates whether the package supports the latest release of node` -} +}; diff --git a/services/node/node-current.spec.js b/services/node/node-current.spec.js index 072bf7350dbad..1981232f5566b 100644 --- a/services/node/node-current.spec.js +++ b/services/node/node-current.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const NodeVersion = require('./node-current.service') +import {test, given} from 'sazerac'; +import NodeVersion from './node-current.service.js'; describe('node static renderStaticPreview', function () { it('should have parity with render()', async function () { diff --git a/services/node/node-current.tester.js b/services/node/node-current.tester.js index b9ae1d9e55cb1..48f25928f87e6 100644 --- a/services/node/node-current.tester.js +++ b/services/node/node-current.tester.js @@ -1,9 +1,9 @@ -'use strict' - -const { expect } = require('chai') -const { Range } = require('semver') -const t = (module.exports = require('../tester').createServiceTester()) -const { mockPackageData, mockCurrentSha } = require('./testUtils/test-utils') +import {expect} from 'chai'; +import {Range} from 'semver'; +const t = (function() { + export default __a; +}()) +import {mockPackageData, mockCurrentSha} from './testUtils/test-utils.js'; function expectSemverRange(message) { expect(() => new Range(message)).not.to.throw() diff --git a/services/node/node-lts.service.js b/services/node/node-lts.service.js index 790e7ea9d2fd2..929550d83e7cd 100644 --- a/services/node/node-lts.service.js +++ b/services/node/node-lts.service.js @@ -1,9 +1,7 @@ -'use strict' +import NodeVersionBase from './node-base.js'; +import {versionColorForRangeLts} from './node-version-color.js'; -const NodeVersionBase = require('./node-base') -const { versionColorForRangeLts } = require('./node-version-color') - -module.exports = class NodeLtsVersion extends NodeVersionBase { +export default class NodeLtsVersion extends NodeVersionBase { static route = this.buildRoute('node/v-lts', { withTag: true }) static defaultBadgeData = { @@ -15,4 +13,4 @@ module.exports = class NodeLtsVersion extends NodeVersionBase { static colorResolver = versionColorForRangeLts static documentation = `This badge indicates whether the package supports all LTS node versions` -} +}; diff --git a/services/node/node-lts.spec.js b/services/node/node-lts.spec.js index f1ca6f100297e..782b9300e9608 100644 --- a/services/node/node-lts.spec.js +++ b/services/node/node-lts.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const NodeVersion = require('./node-lts.service') +import {test, given} from 'sazerac'; +import NodeVersion from './node-lts.service.js'; describe('node-lts renderStaticPreview', function () { it('should have parity with render()', async function () { diff --git a/services/node/node-lts.tester.js b/services/node/node-lts.tester.js index f2d47331fee54..a9cd347f64d6e 100644 --- a/services/node/node-lts.tester.js +++ b/services/node/node-lts.tester.js @@ -1,13 +1,9 @@ -'use strict' - -const { expect } = require('chai') -const { Range } = require('semver') -const t = (module.exports = require('../tester').createServiceTester()) -const { - mockPackageData, - mockReleaseSchedule, - mockVersionsSha, -} = require('./testUtils/test-utils') +import {expect} from 'chai'; +import {Range} from 'semver'; +const t = (function() { + export default __a; +}()) +import {mockPackageData, mockReleaseSchedule, mockVersionsSha} from './testUtils/test-utils.js'; function expectSemverRange(message) { expect(() => new Range(message)).not.to.throw() diff --git a/services/node/node-version-color.js b/services/node/node-version-color.js index f13d45e54f4a4..4a9c26b743ca5 100644 --- a/services/node/node-version-color.js +++ b/services/node/node-version-color.js @@ -1,9 +1,7 @@ -'use strict' - -const { promisify } = require('util') -const moment = require('moment') -const semver = require('semver') -const { regularUpdate } = require('../../core/legacy/regular-update') +import {promisify} from 'util'; +import moment from 'moment'; +import semver from 'semver'; +import {regularUpdate} from '../../core/legacy/regular-update.js'; const dateFormat = 'YYYY-MM-DD' @@ -84,7 +82,7 @@ async function versionColorForRangeCurrent(range) { } } -module.exports = { +export default { versionColorForRangeCurrent, versionColorForRangeLts, -} +}; diff --git a/services/node/testUtils/test-utils.js b/services/node/testUtils/test-utils.js index 96b265ee7dac3..92da5db4f552c 100644 --- a/services/node/testUtils/test-utils.js +++ b/services/node/testUtils/test-utils.js @@ -1,8 +1,6 @@ -'use strict' - -const fs = require('fs') -const path = require('path') -const moment = require('moment') +import fs from 'fs'; +import path from 'path'; +import moment from 'moment'; const dateFormat = 'YYYY-MM-DD' @@ -145,9 +143,9 @@ const mockReleaseSchedule = () => nock => { .reply(200, schedule) } -module.exports = { +export default { mockPackageData, mockCurrentSha, mockVersionsSha, mockReleaseSchedule, -} +}; diff --git a/services/nodeping/nodeping-status.service.js b/services/nodeping/nodeping-status.service.js index 6b85f3a3afef8..8b921d51e363c 100644 --- a/services/nodeping/nodeping-status.service.js +++ b/services/nodeping/nodeping-status.service.js @@ -1,12 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { - queryParamSchema, - exampleQueryParams, - renderWebsiteStatus, -} = require('../website-status') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {queryParamSchema, exampleQueryParams, renderWebsiteStatus} from '../website-status.js'; +import {BaseJsonService} from '..'; const schema = Joi.array() .items(Joi.object().keys({ su: Joi.boolean() })) @@ -17,7 +11,7 @@ const schema = Joi.array() */ const exampleCheckUuid = 'jkiwn052-ntpp-4lbb-8d45-ihew6d9ucoei' -module.exports = class NodePingStatus extends BaseJsonService { +export default class NodePingStatus extends BaseJsonService { static category = 'monitoring' static route = { @@ -69,4 +63,4 @@ module.exports = class NodePingStatus extends BaseJsonService { downColor, }) } -} +}; diff --git a/services/nodeping/nodeping-status.tester.js b/services/nodeping/nodeping-status.tester.js index c497f97c8aede..0622b6f3f1f45 100644 --- a/services/nodeping/nodeping-status.tester.js +++ b/services/nodeping/nodeping-status.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('NodePing status') .get('/jkiwn052-ntpp-4lbb-8d45-ihew6d9ucoei.json') diff --git a/services/nodeping/nodeping-uptime.service.js b/services/nodeping/nodeping-uptime.service.js index 1c2c428cc9ce2..93a8df7354ce9 100644 --- a/services/nodeping/nodeping-uptime.service.js +++ b/services/nodeping/nodeping-uptime.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { colorScale } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {colorScale} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const colorFormatter = colorScale([99, 99.5, 100]) @@ -23,7 +21,7 @@ const sampleCheckUuid = 'jkiwn052-ntpp-4lbb-8d45-ihew6d9ucoei' // TODO: support for custom '100%' label // TODO: support for custom # of decimal places -module.exports = class NodePingUptime extends BaseJsonService { +export default class NodePingUptime extends BaseJsonService { static category = 'monitoring' static route = { base: 'nodeping/uptime', pattern: ':checkUuid' } @@ -76,4 +74,4 @@ module.exports = class NodePingUptime extends BaseJsonService { const { uptime } = await this.fetch({ checkUuid }) return this.constructor.render({ uptime }) } -} +}; diff --git a/services/nodeping/nodeping-uptime.tester.js b/services/nodeping/nodeping-uptime.tester.js index 21a02ad42e428..d2aa902f63f06 100644 --- a/services/nodeping/nodeping-uptime.tester.js +++ b/services/nodeping/nodeping-uptime.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isPercentage } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isPercentage} from '../test-validators.js'; t.create('NodePing uptime') .get('/jkiwn052-ntpp-4lbb-8d45-ihew6d9ucoei.json') diff --git a/services/npm/npm-base.js b/services/npm/npm-base.js index dc334d45f7266..e00f002060024 100644 --- a/services/npm/npm-base.js +++ b/services/npm/npm-base.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { isDependencyMap } = require('../package-json-helpers') -const { BaseJsonService, InvalidResponse, NotFound } = require('..') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {isDependencyMap} from '../package-json-helpers.js'; +import {BaseJsonService, InvalidResponse, NotFound} from '..'; const deprecatedLicenseObjectSchema = Joi.object({ type: Joi.string().required(), @@ -32,13 +30,13 @@ const packageDataSchema = Joi.object({ files: Joi.array().items(Joi.string()).default([]), }).required() -const queryParamSchema = Joi.object({ +export const queryParamSchema = Joi.object({ registry_uri: optionalUrl, -}).required() +}).required(); // Abstract class for NPM badges which display data about the latest version // of a package. -module.exports = class NpmBase extends BaseJsonService { +export default class NpmBase extends BaseJsonService { static auth = { passKey: 'npm_token', serviceKey: 'npm', @@ -142,6 +140,4 @@ module.exports = class NpmBase extends BaseJsonService { return this.constructor._validate(packageData, packageDataSchema) } -} - -module.exports.queryParamSchema = queryParamSchema +}; diff --git a/services/npm/npm-base.spec.js b/services/npm/npm-base.spec.js index 710dee6217b2e..f69040f7d19a5 100644 --- a/services/npm/npm-base.spec.js +++ b/services/npm/npm-base.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; // use NPM Version as an example implementation of NpmBase for this test -const NpmVersion = require('./npm-version.service') +import NpmVersion from './npm-version.service.js'; describe('npm', function () { describe('auth', function () { diff --git a/services/npm/npm-collaborators.service.js b/services/npm/npm-collaborators.service.js index 0071abc3c8a6d..9c430a5fad972 100644 --- a/services/npm/npm-collaborators.service.js +++ b/services/npm/npm-collaborators.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { renderContributorBadge } = require('../contributor-count') -const NpmBase = require('./npm-base') +import {renderContributorBadge} from '../contributor-count.js'; +import NpmBase from './npm-base.js'; const keywords = ['node'] -module.exports = class NpmCollaborators extends NpmBase { +export default class NpmCollaborators extends NpmBase { static category = 'activity' static route = this.buildRoute('npm/collaborators', { withTag: false }) @@ -49,4 +47,4 @@ module.exports = class NpmCollaborators extends NpmBase { const collaborators = maintainers.length return this.constructor.render({ collaborators }) } -} +}; diff --git a/services/npm/npm-collaborators.tester.js b/services/npm/npm-collaborators.tester.js index 45f6c9bab680a..837f640e6bd84 100644 --- a/services/npm/npm-collaborators.tester.js +++ b/services/npm/npm-collaborators.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets the contributor count') .get('/prettier.json') diff --git a/services/npm/npm-dependency-version.service.js b/services/npm/npm-dependency-version.service.js index 83b1e352c6f0b..77b38a63c335b 100644 --- a/services/npm/npm-dependency-version.service.js +++ b/services/npm/npm-dependency-version.service.js @@ -1,12 +1,10 @@ -'use strict' - -const { getDependencyVersion } = require('../package-json-helpers') -const NpmBase = require('./npm-base') +import {getDependencyVersion} from '../package-json-helpers.js'; +import NpmBase from './npm-base.js'; const { queryParamSchema } = NpmBase const keywords = ['node'] -module.exports = class NpmDependencyVersion extends NpmBase { +export default class NpmDependencyVersion extends NpmBase { static category = 'platform-support' static route = { @@ -142,4 +140,4 @@ module.exports = class NpmDependencyVersion extends NpmBase { range, }) } -} +}; diff --git a/services/npm/npm-dependency-version.tester.js b/services/npm/npm-dependency-version.tester.js index f72f598b1ed3a..db976097646f5 100644 --- a/services/npm/npm-dependency-version.tester.js +++ b/services/npm/npm-dependency-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { semverRange } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {semverRange} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets the peer dependency version') .get('/react-boxplot/peer/react.json') diff --git a/services/npm/npm-downloads.service.js b/services/npm/npm-downloads.service.js index d263c1f1e4cc7..5119c382c4cf4 100644 --- a/services/npm/npm-downloads.service.js +++ b/services/npm/npm-downloads.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; // https://github.com/npm/registry/blob/master/docs/download-counts.md#output const pointResponseSchema = Joi.object({ @@ -45,7 +43,7 @@ const intervalMap = { // This hits an entirely different API from the rest of the NPM services, so // it does not use NpmBase. -module.exports = class NpmDownloads extends BaseJsonService { +export default class NpmDownloads extends BaseJsonService { static category = 'downloads' static route = { @@ -88,4 +86,4 @@ module.exports = class NpmDownloads extends BaseJsonService { return this.constructor.render({ interval, downloadCount }) } -} +}; diff --git a/services/npm/npm-downloads.spec.js b/services/npm/npm-downloads.spec.js index 4c94a7d2c16fc..33e67646fd5e8 100644 --- a/services/npm/npm-downloads.spec.js +++ b/services/npm/npm-downloads.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const NpmDownloads = require('./npm-downloads.service') +import {test, given} from 'sazerac'; +import NpmDownloads from './npm-downloads.service.js'; describe('NpmDownloads', function () { test(NpmDownloads._intervalMap.dt.transform, () => { diff --git a/services/npm/npm-downloads.tester.js b/services/npm/npm-downloads.tester.js index e3a9c46d7eee8..ae24f3ed7b3b3 100644 --- a/services/npm/npm-downloads.tester.js +++ b/services/npm/npm-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetricOverTimePeriod, isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetricOverTimePeriod, isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('weekly downloads of left-pad').get('/dw/left-pad.json').expectBadge({ label: 'downloads', diff --git a/services/npm/npm-license.service.js b/services/npm/npm-license.service.js index 45394ea3e4581..a4030cf55dd2f 100644 --- a/services/npm/npm-license.service.js +++ b/services/npm/npm-license.service.js @@ -1,10 +1,8 @@ -'use strict' +import {renderLicenseBadge} from '../licenses.js'; +import toArray from '../../core/base-service/to-array.js'; +import NpmBase from './npm-base.js'; -const { renderLicenseBadge } = require('../licenses') -const toArray = require('../../core/base-service/to-array') -const NpmBase = require('./npm-base') - -module.exports = class NpmLicense extends NpmBase { +export default class NpmLicense extends NpmBase { static category = 'license' static route = this.buildRoute('npm/l', { withTag: false }) @@ -46,4 +44,4 @@ module.exports = class NpmLicense extends NpmBase { ) return this.constructor.render({ licenses }) } -} +}; diff --git a/services/npm/npm-license.tester.js b/services/npm/npm-license.tester.js index d30c5783b34b3..93bfdefcc2756 100644 --- a/services/npm/npm-license.tester.js +++ b/services/npm/npm-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('gets the license of express') .get('/express.json') diff --git a/services/npm/npm-type-definitions.service.js b/services/npm/npm-type-definitions.service.js index ff314e75aba5c..1d62485b147ab 100644 --- a/services/npm/npm-type-definitions.service.js +++ b/services/npm/npm-type-definitions.service.js @@ -1,11 +1,9 @@ -'use strict' - -const NpmBase = require('./npm-base') +import NpmBase from './npm-base.js'; // For this badge to correctly detect type definitions, either the relevant // dependencies must be declared, or the `types` key must be set in // package.json. -module.exports = class NpmTypeDefinitions extends NpmBase { +export default class NpmTypeDefinitions extends NpmBase { static category = 'platform-support' static route = this.buildRoute('npm/types', { withTag: false }) @@ -72,4 +70,4 @@ module.exports = class NpmTypeDefinitions extends NpmBase { const props = this.constructor.transform(json) return this.constructor.render(props) } -} +}; diff --git a/services/npm/npm-type-definitions.spec.js b/services/npm/npm-type-definitions.spec.js index 98cefb2e53310..c5e0f1459dc70 100644 --- a/services/npm/npm-type-definitions.spec.js +++ b/services/npm/npm-type-definitions.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given, forCases } = require('sazerac') -const NpmTypeDefinitions = require('./npm-type-definitions.service') +import {test, given, forCases} from 'sazerac'; +import NpmTypeDefinitions from './npm-type-definitions.service.js'; describe('NPM type definitions badge', function () { test(NpmTypeDefinitions.transform, () => { diff --git a/services/npm/npm-type-definitions.tester.js b/services/npm/npm-type-definitions.tester.js index accd7292cb388..dd31cf8f894bf 100644 --- a/services/npm/npm-type-definitions.tester.js +++ b/services/npm/npm-type-definitions.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isTypeDefinition = Joi.string().regex( /^((Flow|TypeScript)|(Flow \| TypeScript))$/ diff --git a/services/npm/npm-version.service.js b/services/npm/npm-version.service.js index ab517815f3df8..cb69debf9464b 100644 --- a/services/npm/npm-version.service.js +++ b/services/npm/npm-version.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { NotFound } = require('..') -const NpmBase = require('./npm-base') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {NotFound} from '..'; +import NpmBase from './npm-base.js'; const keywords = ['node'] @@ -13,7 +11,7 @@ const schema = Joi.object() .pattern(/./, Joi.string()) .required() -module.exports = class NpmVersion extends NpmBase { +export default class NpmVersion extends NpmBase { static category = 'version' static route = this.buildRoute('npm/v', { withTag: true }) @@ -94,4 +92,4 @@ module.exports = class NpmVersion extends NpmBase { version: packageData[tag || 'latest'], }) } -} +}; diff --git a/services/npm/npm-version.tester.js b/services/npm/npm-version.tester.js index c0b97b3e63563..3e1dbcbb35c9c 100644 --- a/services/npm/npm-version.tester.js +++ b/services/npm/npm-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets the package version of left-pad') .get('/left-pad.json') diff --git a/services/nsp/nsp.service.js b/services/nsp/nsp.service.js index ef85af672807f..7f8b5e9649b06 100644 --- a/services/nsp/nsp.service.js +++ b/services/nsp/nsp.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ route: { base: 'nsp/npm', pattern: ':various*', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ label: 'nsp', category: 'other', dateAdded: new Date('2018-12-13'), -}) +}); diff --git a/services/nsp/nsp.tester.js b/services/nsp/nsp.tester.js index 11a33eae1b87c..1815d74ca2d21 100644 --- a/services/nsp/nsp.tester.js +++ b/services/nsp/nsp.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'nsp', - title: 'nsp', - pathPrefix: '/nsp/npm', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously package)') .get('/gh-badges.json') diff --git a/services/nuget-fixtures.js b/services/nuget-fixtures.js index c4e0fe30394f9..ea58e66e942b7 100644 --- a/services/nuget-fixtures.js +++ b/services/nuget-fixtures.js @@ -1,5 +1,3 @@ -'use strict' - const queryIndex = JSON.stringify({ resources: [ { @@ -50,10 +48,10 @@ const nuGetV3VersionJsonBuildMetadataWithDash = JSON.stringify({ ], }) -module.exports = { +export default { queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero, nuGetV3VersionJsonBuildMetadataWithDash, -} +}; diff --git a/services/nuget/nuget-helpers.js b/services/nuget/nuget-helpers.js index 63603c2d5c7e0..278a0f1a51ee0 100644 --- a/services/nuget/nuget-helpers.js +++ b/services/nuget/nuget-helpers.js @@ -1,10 +1,8 @@ -'use strict' - -const { promisify } = require('util') -const semver = require('semver') -const { metric, addv } = require('../text-formatters') -const { downloadCount: downloadCountColor } = require('../color-formatters') -const { regularUpdate } = require('../../core/legacy/regular-update') +import {promisify} from 'util'; +import semver from 'semver'; +import {metric, addv} from '../text-formatters.js'; +import {downloadCount as downloadCountColor} from '../color-formatters.js'; +import {regularUpdate} from '../../core/legacy/regular-update.js'; function renderVersionBadge({ version, feed }) { let color @@ -103,11 +101,11 @@ function selectVersion(versions, includePrereleases) { } } -module.exports = { +export default { renderVersionBadge, renderDownloadBadge, odataToObject, searchServiceUrl, stripBuildMetadata, selectVersion, -} +}; diff --git a/services/nuget/nuget-helpers.spec.js b/services/nuget/nuget-helpers.spec.js index a4e40a94e8ca1..bd96935a6a18d 100644 --- a/services/nuget/nuget-helpers.spec.js +++ b/services/nuget/nuget-helpers.spec.js @@ -1,12 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { - renderVersionBadge, - odataToObject, - stripBuildMetadata, - selectVersion, -} = require('./nuget-helpers') +import {test, given} from 'sazerac'; +import {renderVersionBadge, odataToObject, stripBuildMetadata, selectVersion} from './nuget-helpers.js'; describe('NuGet helpers', function () { test(renderVersionBadge, () => { diff --git a/services/nuget/nuget-v2-service-family.js b/services/nuget/nuget-v2-service-family.js index 582771ddf21a4..4c4fd74731f5b 100644 --- a/services/nuget/nuget-v2-service-family.js +++ b/services/nuget/nuget-v2-service-family.js @@ -1,13 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, BaseXmlService, NotFound, redirector } = require('..') -const { - renderVersionBadge, - renderDownloadBadge, - odataToObject, -} = require('./nuget-helpers') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, BaseXmlService, NotFound, redirector} from '..'; +import {renderVersionBadge, renderDownloadBadge, odataToObject} from './nuget-helpers.js'; function createFilter({ packageName, includePrereleases }) { const releaseTypeFilter = includePrereleases @@ -224,8 +218,8 @@ function createServiceFamily({ return { NugetVersionService, NugetVersionRedirector, NugetDownloadService } } -module.exports = { +export default { createFilter, fetch, createServiceFamily, -} +}; diff --git a/services/nuget/nuget-v3-service-family.js b/services/nuget/nuget-v3-service-family.js index 783cc05a7816d..cd18224fac7d7 100644 --- a/services/nuget/nuget-v3-service-family.js +++ b/services/nuget/nuget-v3-service-family.js @@ -1,15 +1,7 @@ -'use strict' - -const Joi = require('joi') -const RouteBuilder = require('../route-builder') -const { BaseJsonService, NotFound } = require('..') -const { - renderVersionBadge, - renderDownloadBadge, - searchServiceUrl, - stripBuildMetadata, - selectVersion, -} = require('./nuget-helpers') +import Joi from 'joi'; +import RouteBuilder from '../route-builder.js'; +import {BaseJsonService, NotFound} from '..'; +import {renderVersionBadge, renderDownloadBadge, searchServiceUrl, stripBuildMetadata, selectVersion} from './nuget-helpers.js'; /* * Build the Shields service URL object for the given service configuration. Return @@ -213,6 +205,6 @@ function createServiceFamily({ } } -module.exports = { +export default { createServiceFamily, -} +}; diff --git a/services/nuget/nuget-v3-service-family.spec.js b/services/nuget/nuget-v3-service-family.spec.js index 18b92dccd7899..41e616a5ca3a7 100644 --- a/services/nuget/nuget-v3-service-family.spec.js +++ b/services/nuget/nuget-v3-service-family.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { createServiceFamily } = require('./nuget-v3-service-family') +import {test, given} from 'sazerac'; +import {createServiceFamily} from './nuget-v3-service-family.js'; const { NugetVersionService, NugetDownloadService } = createServiceFamily({ defaultLabel: 'nuget', diff --git a/services/nuget/nuget.service.js b/services/nuget/nuget.service.js index 86c33498f0abc..0b9600b8bd6be 100644 --- a/services/nuget/nuget.service.js +++ b/services/nuget/nuget.service.js @@ -1,6 +1,4 @@ -'use strict' - -const { createServiceFamily } = require('./nuget-v3-service-family') +import {createServiceFamily} from './nuget-v3-service-family.js'; const { NugetVersionService: Version, NugetDownloadService: Downloads } = createServiceFamily({ @@ -39,4 +37,4 @@ class NugetDownloadService extends Downloads { ] } -module.exports = { NugetVersionService, NugetDownloadService } +export default { NugetVersionService, NugetDownloadService }; diff --git a/services/nuget/nuget.tester.js b/services/nuget/nuget.tester.js index 6bdbf3d663ec1..7e7363aab8791 100644 --- a/services/nuget/nuget.tester.js +++ b/services/nuget/nuget.tester.js @@ -1,21 +1,11 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { - isMetric, - isVPlusDottedVersionNClauses, - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') -const { - queryIndex, - nuGetV3VersionJsonWithDash, - nuGetV3VersionJsonFirstCharZero, - nuGetV3VersionJsonFirstCharNotZero, - nuGetV3VersionJsonBuildMetadataWithDash, -} = require('../nuget-fixtures') -const { invalidJSON } = require('../response-fixtures') - -const t = (module.exports = new ServiceTester({ id: 'nuget', title: 'NuGet' })) +import {ServiceTester} from '../tester.js'; +import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import {queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero, nuGetV3VersionJsonBuildMetadataWithDash} from '../nuget-fixtures.js'; +import {invalidJSON} from '../response-fixtures.js'; + +const t = (function() { + export default __a; +}()) // downloads diff --git a/services/nycrc/nycrc.service.js b/services/nycrc/nycrc.service.js index 016d45f93d2b2..3723da72846ff 100644 --- a/services/nycrc/nycrc.service.js +++ b/services/nycrc/nycrc.service.js @@ -1,12 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage } = require('../color-formatters') -const { - ConditionalGithubAuthV3Service, -} = require('../github/github-auth-service') -const { fetchJsonFromRepo } = require('../github/github-common-fetch') -const { InvalidParameter, InvalidResponse, NotFound } = require('..') +import Joi from 'joi'; +import {coveragePercentage} from '../color-formatters.js'; +import {ConditionalGithubAuthV3Service} from '../github/github-auth-service.js'; +import {fetchJsonFromRepo} from '../github/github-common-fetch.js'; +import {InvalidParameter, InvalidResponse, NotFound} from '..'; const nycrcSchema = Joi.object({ branches: Joi.number().min(0).max(100), @@ -35,7 +31,7 @@ const documentation = `

const validThresholds = ['branches', 'lines', 'functions'] -module.exports = class Nycrc extends ConditionalGithubAuthV3Service { +export default class Nycrc extends ConditionalGithubAuthV3Service { static category = 'coverage' static route = { @@ -131,4 +127,4 @@ module.exports = class Nycrc extends ConditionalGithubAuthV3Service { } return this.constructor.render({ coverage }) } -} +}; diff --git a/services/nycrc/nycrc.tester.js b/services/nycrc/nycrc.tester.js index 21fed6954f46a..9e6d3c3de5021 100644 --- a/services/nycrc/nycrc.tester.js +++ b/services/nycrc/nycrc.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('valid .nycrc') .get('/yargs/yargs.json?config=.nycrc') diff --git a/services/offset-earth/offset-earth-carbon-redirect.service.js b/services/offset-earth/offset-earth-carbon-redirect.service.js index 0ee89549f7428..45bc4a8ffed8e 100644 --- a/services/offset-earth/offset-earth-carbon-redirect.service.js +++ b/services/offset-earth/offset-earth-carbon-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ // https://github.com/badges/shields/issues/5433 redirector({ name: 'OffsetEarthCarbonRedirect', @@ -14,4 +12,4 @@ module.exports = [ transformPath: ({ username }) => `/ecologi/carbon/${username}`, dateAdded: new Date('2020-08-16'), }), -] +]; diff --git a/services/offset-earth/offset-earth-carbon-redirect.tester.js b/services/offset-earth/offset-earth-carbon-redirect.tester.js index 426efe2eadf59..2ee06ecd0725f 100644 --- a/services/offset-earth/offset-earth-carbon-redirect.tester.js +++ b/services/offset-earth/offset-earth-carbon-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'OffsetEarthCarbonRedirect', - title: 'Offset Earth (Carbon Offset) Redirector', - pathPrefix: '/offset-earth', -})) +const t = (function() { + export default __a; +}()) t.create('Offset Earth carbon alias') .get('/carbon/ecologi.svg') diff --git a/services/offset-earth/offset-earth-trees-redirect.service.js b/services/offset-earth/offset-earth-trees-redirect.service.js index 7f2567e6eac52..60c3671d57e8c 100644 --- a/services/offset-earth/offset-earth-trees-redirect.service.js +++ b/services/offset-earth/offset-earth-trees-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ // https://github.com/badges/shields/issues/5433 redirector({ name: 'OffsetEarthTreesRedirect', @@ -14,4 +12,4 @@ module.exports = [ transformPath: ({ username }) => `/ecologi/trees/${username}`, dateAdded: new Date('2020-08-16'), }), -] +]; diff --git a/services/offset-earth/offset-earth-trees-redirect.tester.js b/services/offset-earth/offset-earth-trees-redirect.tester.js index be8427992bff6..d85c49b9dc584 100644 --- a/services/offset-earth/offset-earth-trees-redirect.tester.js +++ b/services/offset-earth/offset-earth-trees-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'OffsetEarthTreesRedirect', - title: 'Offset Earth (Trees) Redirector', - pathPrefix: '/offset-earth', -})) +const t = (function() { + export default __a; +}()) t.create('Offset Earth trees alias') .get('/trees/ecologi.svg') diff --git a/services/open-vsx/open-vsx-base.js b/services/open-vsx/open-vsx-base.js index 1e0a9049a7f94..408dd23b8c65a 100644 --- a/services/open-vsx/open-vsx-base.js +++ b/services/open-vsx/open-vsx-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { optionalNonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {optionalNonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const extensionQuerySchema = Joi.object({ error: Joi.string(), @@ -17,7 +15,7 @@ const extensionQuerySchema = Joi.object({ }), }).required() -module.exports = class OpenVSXBase extends BaseJsonService { +export default class OpenVSXBase extends BaseJsonService { static keywords = [ 'ovsx', 'open-vsx', @@ -42,4 +40,4 @@ module.exports = class OpenVSXBase extends BaseJsonService { }, }) } -} +}; diff --git a/services/open-vsx/open-vsx-downloads.service.js b/services/open-vsx/open-vsx-downloads.service.js index be6470ba1c3e9..90b65b00a6b0f 100644 --- a/services/open-vsx/open-vsx-downloads.service.js +++ b/services/open-vsx/open-vsx-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import OpenVSXBase from './open-vsx-base.js'; -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const OpenVSXBase = require('./open-vsx-base') - -module.exports = class OpenVSXDownloads extends OpenVSXBase { +export default class OpenVSXDownloads extends OpenVSXBase { static category = 'downloads' static route = { @@ -57,4 +55,4 @@ module.exports = class OpenVSXDownloads extends OpenVSXBase { downloads: downloadCount, }) } -} +}; diff --git a/services/open-vsx/open-vsx-downloads.tester.js b/services/open-vsx/open-vsx-downloads.tester.js index 7e6797386a11b..0fbdfd7a0bbab 100644 --- a/services/open-vsx/open-vsx-downloads.tester.js +++ b/services/open-vsx/open-vsx-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex, isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {withRegex, isMetric} from '../test-validators.js'; const isVersionLabel = withRegex(/^downloads@(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/open-vsx/open-vsx-rating.service.js b/services/open-vsx/open-vsx-rating.service.js index f90eefb54e266..e6e5eab06d159 100644 --- a/services/open-vsx/open-vsx-rating.service.js +++ b/services/open-vsx/open-vsx-rating.service.js @@ -1,10 +1,8 @@ -'use strict' +import {starRating} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import OpenVSXBase from './open-vsx-base.js'; -const { starRating } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const OpenVSXBase = require('./open-vsx-base') - -module.exports = class OpenVSXRating extends OpenVSXBase { +export default class OpenVSXRating extends OpenVSXBase { static category = 'rating' static route = { @@ -77,4 +75,4 @@ module.exports = class OpenVSXRating extends OpenVSXBase { ratingCount: reviewCount, }) } -} +}; diff --git a/services/open-vsx/open-vsx-rating.spec.js b/services/open-vsx/open-vsx-rating.spec.js index 9d0bf7f0ca09a..2ca8131ff7455 100644 --- a/services/open-vsx/open-vsx-rating.spec.js +++ b/services/open-vsx/open-vsx-rating.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const OpenVSXRating = require('./open-vsx-rating.service') +import {test, given} from 'sazerac'; +import OpenVSXRating from './open-vsx-rating.service.js'; describe('OpenVSXRating', function () { test(OpenVSXRating.render, () => { diff --git a/services/open-vsx/open-vsx-rating.tester.js b/services/open-vsx/open-vsx-rating.tester.js index 71b269ebb702f..7ea636cac61f0 100644 --- a/services/open-vsx/open-vsx-rating.tester.js +++ b/services/open-vsx/open-vsx-rating.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex, isStarRating } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {withRegex, isStarRating} from '../test-validators.js'; const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/open-vsx/open-vsx-release-date.service.js b/services/open-vsx/open-vsx-release-date.service.js index 4a4343f649eea..b75a6ee27579c 100644 --- a/services/open-vsx/open-vsx-release-date.service.js +++ b/services/open-vsx/open-vsx-release-date.service.js @@ -1,10 +1,8 @@ -'use strict' +import {age} from '../color-formatters.js'; +import {formatDate} from '../text-formatters.js'; +import OpenVSXBase from './open-vsx-base.js'; -const { age } = require('../color-formatters') -const { formatDate } = require('../text-formatters') -const OpenVSXBase = require('./open-vsx-base') - -module.exports = class OpenVSXReleaseDate extends OpenVSXBase { +export default class OpenVSXReleaseDate extends OpenVSXBase { static category = 'activity' static route = { @@ -41,4 +39,4 @@ module.exports = class OpenVSXReleaseDate extends OpenVSXBase { releaseDate: timestamp, }) } -} +}; diff --git a/services/open-vsx/open-vsx-release-date.tester.js b/services/open-vsx/open-vsx-release-date.tester.js index 5c5e2d111c78d..053738bed3acb 100644 --- a/services/open-vsx/open-vsx-release-date.tester.js +++ b/services/open-vsx/open-vsx-release-date.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isFormattedDate } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isFormattedDate} from '../test-validators.js'; t.create('release date invalid extension') .get('/release-date/badges/shields.json') diff --git a/services/open-vsx/open-vsx-version.service.js b/services/open-vsx/open-vsx-version.service.js index eda1ad0f4b7da..8c32f8b63ab9a 100644 --- a/services/open-vsx/open-vsx-version.service.js +++ b/services/open-vsx/open-vsx-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import OpenVSXBase from './open-vsx-base.js'; -const { renderVersionBadge } = require('../version') -const OpenVSXBase = require('./open-vsx-base') - -module.exports = class OpenVSXVersion extends OpenVSXBase { +export default class OpenVSXVersion extends OpenVSXBase { static category = 'version' static route = { @@ -28,4 +26,4 @@ module.exports = class OpenVSXVersion extends OpenVSXBase { const { version } = await this.fetch({ namespace, extension }) return this.constructor.render({ version }) } -} +}; diff --git a/services/open-vsx/open-vsx-version.tester.js b/services/open-vsx/open-vsx-version.tester.js index 3a0a5e3e73fdb..55d2bf7f81b45 100644 --- a/services/open-vsx/open-vsx-version.tester.js +++ b/services/open-vsx/open-vsx-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {withRegex} from '../test-validators.js'; const isVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/opencollective/opencollective-all.service.js b/services/opencollective/opencollective-all.service.js index 526eb29d9456e..2221a4349ae6c 100644 --- a/services/opencollective/opencollective-all.service.js +++ b/services/opencollective/opencollective-all.service.js @@ -1,8 +1,6 @@ -'use strict' +import OpencollectiveBase from './opencollective-base.js'; -const OpencollectiveBase = require('./opencollective-base') - -module.exports = class OpencollectiveAll extends OpencollectiveBase { +export default class OpencollectiveAll extends OpencollectiveBase { static route = this.buildRoute('all') static examples = [ @@ -22,4 +20,4 @@ module.exports = class OpencollectiveAll extends OpencollectiveBase { const { backersCount } = await this.fetchCollectiveInfo(collective) return this.constructor.render(backersCount) } -} +}; diff --git a/services/opencollective/opencollective-all.tester.js b/services/opencollective/opencollective-all.tester.js index 8ba66a063abce..c7edba53e5245 100644 --- a/services/opencollective/opencollective-all.tester.js +++ b/services/opencollective/opencollective-all.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('renders correctly') .get('/shields.json') diff --git a/services/opencollective/opencollective-backers.service.js b/services/opencollective/opencollective-backers.service.js index ebbc72a717dbe..991c7d477982e 100644 --- a/services/opencollective/opencollective-backers.service.js +++ b/services/opencollective/opencollective-backers.service.js @@ -1,8 +1,6 @@ -'use strict' +import OpencollectiveBase from './opencollective-base.js'; -const OpencollectiveBase = require('./opencollective-base') - -module.exports = class OpencollectiveBackers extends OpencollectiveBase { +export default class OpencollectiveBackers extends OpencollectiveBase { static route = this.buildRoute('backers') static examples = [ @@ -25,4 +23,4 @@ module.exports = class OpencollectiveBackers extends OpencollectiveBase { ) return this.constructor.render(backersCount) } -} +}; diff --git a/services/opencollective/opencollective-backers.tester.js b/services/opencollective/opencollective-backers.tester.js index e9d2c0601b910..5746a11eb3f82 100644 --- a/services/opencollective/opencollective-backers.tester.js +++ b/services/opencollective/opencollective-backers.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('renders correctly') .get('/shields.json') diff --git a/services/opencollective/opencollective-base.js b/services/opencollective/opencollective-base.js index 74ae8ec35e586..ed4ed5c0e6fb6 100644 --- a/services/opencollective/opencollective-base.js +++ b/services/opencollective/opencollective-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; // https://developer.opencollective.com/#/api/collectives?id=get-info const collectiveDetailsSchema = Joi.object().keys({ @@ -21,7 +19,7 @@ function buildMembersArraySchema({ userType, tierRequired }) { return Joi.array().items(Joi.object().keys(keys)) } -module.exports = class OpencollectiveBase extends BaseJsonService { +export default class OpencollectiveBase extends BaseJsonService { static category = 'funding' static buildRoute(base, withTierId) { @@ -81,4 +79,4 @@ module.exports = class OpencollectiveBase extends BaseJsonService { result.tier = members.map(member => member.tier)[0] return result } -} +}; diff --git a/services/opencollective/opencollective-by-tier.service.js b/services/opencollective/opencollective-by-tier.service.js index c2712920d29a2..b2a140b1cd278 100644 --- a/services/opencollective/opencollective-by-tier.service.js +++ b/services/opencollective/opencollective-by-tier.service.js @@ -1,11 +1,9 @@ -'use strict' - -const OpencollectiveBase = require('./opencollective-base') +import OpencollectiveBase from './opencollective-base.js'; const documentation = `

How to get the tierId

According to open collectives documentation, you can find the tierId by looking at the URL after clicking on a Tier Card on the collective page. (e.g. tierId for https://opencollective.com/shields/order/2988 is 2988)

` -module.exports = class OpencollectiveByTier extends OpencollectiveBase { +export default class OpencollectiveByTier extends OpencollectiveBase { static route = this.buildRoute('tier', true) static examples = [ @@ -31,4 +29,4 @@ module.exports = class OpencollectiveByTier extends OpencollectiveBase { } else result.tier = 'new tier' return this.constructor.render(result.backersCount, result.tier) } -} +}; diff --git a/services/opencollective/opencollective-by-tier.tester.js b/services/opencollective/opencollective-by-tier.tester.js index d2b53a8d4e03e..0722053d16dd0 100644 --- a/services/opencollective/opencollective-by-tier.tester.js +++ b/services/opencollective/opencollective-by-tier.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('renders correctly') .get('/shields/2988.json') diff --git a/services/opencollective/opencollective-sponsors.service.js b/services/opencollective/opencollective-sponsors.service.js index 6dface34aa369..905400b2e2132 100644 --- a/services/opencollective/opencollective-sponsors.service.js +++ b/services/opencollective/opencollective-sponsors.service.js @@ -1,8 +1,6 @@ -'use strict' +import OpencollectiveBase from './opencollective-base.js'; -const OpencollectiveBase = require('./opencollective-base') - -module.exports = class OpencollectiveSponsors extends OpencollectiveBase { +export default class OpencollectiveSponsors extends OpencollectiveBase { static route = this.buildRoute('sponsors') static examples = [ @@ -25,4 +23,4 @@ module.exports = class OpencollectiveSponsors extends OpencollectiveBase { ) return this.constructor.render(backersCount) } -} +}; diff --git a/services/opencollective/opencollective-sponsors.tester.js b/services/opencollective/opencollective-sponsors.tester.js index 8784501370aad..078f878bf543f 100644 --- a/services/opencollective/opencollective-sponsors.tester.js +++ b/services/opencollective/opencollective-sponsors.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { nonNegativeInteger } = require('../validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {nonNegativeInteger} from '../validators.js'; +const t = (function() { + export default __a; +}()) t.create('renders correctly') .get('/shields.json') diff --git a/services/opm/opm-version.service.js b/services/opm/opm-version.service.js index 5d84009ce9697..1d4eefbf43563 100644 --- a/services/opm/opm-version.service.js +++ b/services/opm/opm-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {BaseService, NotFound, InvalidResponse} from '..'; -const { renderVersionBadge } = require('../version') -const { BaseService, NotFound, InvalidResponse } = require('..') - -module.exports = class OpmVersion extends BaseService { +export default class OpmVersion extends BaseService { static category = 'version' static route = { @@ -58,4 +56,4 @@ module.exports = class OpmVersion extends BaseService { return renderVersionBadge({ version }) } -} +}; diff --git a/services/opm/opm-version.tester.js b/services/opm/opm-version.tester.js index b6ae397047d20..d07b79a818983 100644 --- a/services/opm/opm-version.tester.js +++ b/services/opm/opm-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isValidVersion = Joi.string() .regex(/^v[\d+.]+$/) diff --git a/services/ore/ore-base.js b/services/ore/ore-base.js index 0158c4d864cdd..d2e2ada5c8e87 100644 --- a/services/ore/ore-base.js +++ b/services/ore/ore-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, InvalidResponse } = require('..') +import Joi from 'joi'; +import {BaseJsonService, InvalidResponse} from '..'; const sessionSchema = Joi.object({ session: Joi.string().required(), @@ -85,4 +83,4 @@ class BaseOreService extends BaseJsonService { BaseOreService.sessionToken = null -module.exports = { keywords, documentation, BaseOreService } +export default { keywords, documentation, BaseOreService }; diff --git a/services/ore/ore-category.service.js b/services/ore/ore-category.service.js index 690dc5397b70f..107364cbb4933 100644 --- a/services/ore/ore-category.service.js +++ b/services/ore/ore-category.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseOreService, documentation, keywords} from './ore-base.js'; -const { BaseOreService, documentation, keywords } = require('./ore-base') - -module.exports = class OreCategory extends BaseOreService { +export default class OreCategory extends BaseOreService { static category = 'other' static route = { @@ -43,4 +41,4 @@ module.exports = class OreCategory extends BaseOreService { const { category } = this.transform({ data }) return this.constructor.render({ category }) } -} +}; diff --git a/services/ore/ore-category.spec.js b/services/ore/ore-category.spec.js index b0572b192ab07..e54e6ec2f5135 100644 --- a/services/ore/ore-category.spec.js +++ b/services/ore/ore-category.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, forCases, given } = require('sazerac') -const OreCategory = require('./ore-category.service') +import {test, forCases, given} from 'sazerac'; +import OreCategory from './ore-category.service.js'; describe('OreCategory', function () { test(OreCategory.prototype.transform, () => { diff --git a/services/ore/ore-category.tester.js b/services/ore/ore-category.tester.js index 7ff6e39b8a643..eea23164d6806 100644 --- a/services/ore/ore-category.tester.js +++ b/services/ore/ore-category.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) // Taken from https://ore.spongepowered.org/api#/Projects/showProject const CATEGORY_ENUM = [ diff --git a/services/ore/ore-downloads.service.js b/services/ore/ore-downloads.service.js index 6817344c33232..324bcd0f88551 100644 --- a/services/ore/ore-downloads.service.js +++ b/services/ore/ore-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {BaseOreService, documentation, keywords} from './ore-base.js'; -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { BaseOreService, documentation, keywords } = require('./ore-base') - -module.exports = class OreDownloads extends BaseOreService { +export default class OreDownloads extends BaseOreService { static category = 'downloads' static route = { @@ -41,4 +39,4 @@ module.exports = class OreDownloads extends BaseOreService { } = await this.fetch({ pluginId }) return this.constructor.render({ downloads }) } -} +}; diff --git a/services/ore/ore-downloads.tester.js b/services/ore/ore-downloads.tester.js index bbe43909138e8..d87a96216b26e 100644 --- a/services/ore/ore-downloads.tester.js +++ b/services/ore/ore-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'downloads', diff --git a/services/ore/ore-license.service.js b/services/ore/ore-license.service.js index 397558ca71831..f8ee6a0482d2f 100644 --- a/services/ore/ore-license.service.js +++ b/services/ore/ore-license.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderLicenseBadge} from '../licenses.js'; +import {BaseOreService, documentation, keywords} from './ore-base.js'; -const { renderLicenseBadge } = require('../licenses') -const { BaseOreService, documentation, keywords } = require('./ore-base') - -module.exports = class OreLicense extends BaseOreService { +export default class OreLicense extends BaseOreService { static category = 'license' static route = { @@ -47,4 +45,4 @@ module.exports = class OreLicense extends BaseOreService { const { license } = this.transform({ data }) return this.constructor.render({ license }) } -} +}; diff --git a/services/ore/ore-license.spec.js b/services/ore/ore-license.spec.js index 166e1c34c2e97..7bfd00d6a7a31 100644 --- a/services/ore/ore-license.spec.js +++ b/services/ore/ore-license.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const OreLicense = require('./ore-license.service') +import {test, given} from 'sazerac'; +import OreLicense from './ore-license.service.js'; describe('OreLicense', function () { test(OreLicense.prototype.transform, () => { diff --git a/services/ore/ore-license.tester.js b/services/ore/ore-license.tester.js index 26617eef67543..b0dad5ff7248b 100644 --- a/services/ore/ore-license.tester.js +++ b/services/ore/ore-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'license', diff --git a/services/ore/ore-sponge-versions.service.js b/services/ore/ore-sponge-versions.service.js index 12b0d2f194b1f..bcbd897ac739d 100644 --- a/services/ore/ore-sponge-versions.service.js +++ b/services/ore/ore-sponge-versions.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseOreService, documentation, keywords} from './ore-base.js'; -const { BaseOreService, documentation, keywords } = require('./ore-base') - -module.exports = class OreSpongeVersions extends BaseOreService { +export default class OreSpongeVersions extends BaseOreService { static category = 'platform-support' static route = { @@ -50,4 +48,4 @@ module.exports = class OreSpongeVersions extends BaseOreService { const { versions } = this.transform({ data }) return this.constructor.render({ versions }) } -} +}; diff --git a/services/ore/ore-sponge-versions.spec.js b/services/ore/ore-sponge-versions.spec.js index 21710194283e9..6f78b900e1d0d 100644 --- a/services/ore/ore-sponge-versions.spec.js +++ b/services/ore/ore-sponge-versions.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, forCases, given } = require('sazerac') -const OreSpongeVersions = require('./ore-sponge-versions.service') +import {test, forCases, given} from 'sazerac'; +import OreSpongeVersions from './ore-sponge-versions.service.js'; const PROMOTED_VERSIONS = [ { diff --git a/services/ore/ore-sponge-versions.tester.js b/services/ore/ore-sponge-versions.tester.js index 7af8fb62a5dd8..ac4a500b24b82 100644 --- a/services/ore/ore-sponge-versions.tester.js +++ b/services/ore/ore-sponge-versions.tester.js @@ -1,5 +1,3 @@ -'use strict' - const Joi = require('joi').extend(joi => ({ base: joi.array(), coerce: (value, helpers) => ({ @@ -8,7 +6,9 @@ const Joi = require('joi').extend(joi => ({ type: 'versionArray', })) const isDottedVersionAtLeastOne = Joi.string().regex(/\d+(\.\d+)?(\.\d+)?$/) -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('Nucleus (pluginId nucleus)') .get('/nucleus.json') diff --git a/services/ore/ore-stars.service.js b/services/ore/ore-stars.service.js index d24b8df07e7c7..2d36af4fa03d1 100644 --- a/services/ore/ore-stars.service.js +++ b/services/ore/ore-stars.service.js @@ -1,9 +1,7 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {BaseOreService, documentation, keywords} from './ore-base.js'; -const { metric } = require('../text-formatters') -const { BaseOreService, documentation, keywords } = require('./ore-base') - -module.exports = class OreStars extends BaseOreService { +export default class OreStars extends BaseOreService { static category = 'rating' static route = { @@ -39,4 +37,4 @@ module.exports = class OreStars extends BaseOreService { const { stars } = stats return this.constructor.render({ stars }) } -} +}; diff --git a/services/ore/ore-stars.tester.js b/services/ore/ore-stars.tester.js index eb01ba380bd6b..ee4059beef5db 100644 --- a/services/ore/ore-stars.tester.js +++ b/services/ore/ore-stars.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'stars', diff --git a/services/ore/ore-version.service.js b/services/ore/ore-version.service.js index 5f85de05e1a20..cd16351110a17 100644 --- a/services/ore/ore-version.service.js +++ b/services/ore/ore-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {BaseOreService, documentation, keywords} from './ore-base.js'; -const { renderVersionBadge } = require('../version') -const { BaseOreService, documentation, keywords } = require('./ore-base') - -module.exports = class OreVersion extends BaseOreService { +export default class OreVersion extends BaseOreService { static category = 'version' static route = { @@ -49,4 +47,4 @@ module.exports = class OreVersion extends BaseOreService { const { version } = this.transform({ data }) return this.constructor.render({ version }) } -} +}; diff --git a/services/ore/ore-version.spec.js b/services/ore/ore-version.spec.js index 4b2cb6656eacf..6740cc6e4a761 100644 --- a/services/ore/ore-version.spec.js +++ b/services/ore/ore-version.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const OreVersion = require('./ore-version.service') +import {test, given} from 'sazerac'; +import OreVersion from './ore-version.service.js'; describe('OreVersion', function () { test(OreVersion.prototype.transform, () => { diff --git a/services/ore/ore-version.tester.js b/services/ore/ore-version.tester.js index a1aa7f8cfe06d..6525d4e70ed72 100644 --- a/services/ore/ore-version.tester.js +++ b/services/ore/ore-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'version', diff --git a/services/osslifecycle/osslifecycle.service.js b/services/osslifecycle/osslifecycle.service.js index 78f110753bf9b..5ba5d950cf3a4 100644 --- a/services/osslifecycle/osslifecycle.service.js +++ b/services/osslifecycle/osslifecycle.service.js @@ -1,6 +1,4 @@ -'use strict' - -const { BaseService, InvalidResponse } = require('..') +import {BaseService, InvalidResponse} from '..'; const documentation = `

@@ -13,7 +11,7 @@ const documentation = `

` -module.exports = class OssTracker extends BaseService { +export default class OssTracker extends BaseService { static category = 'other' static route = { @@ -96,4 +94,4 @@ module.exports = class OssTracker extends BaseService { }) } } -} +}; diff --git a/services/osslifecycle/osslifecycle.tester.js b/services/osslifecycle/osslifecycle.tester.js index a5d40b61d3fa2..fe38ce87c5652 100644 --- a/services/osslifecycle/osslifecycle.tester.js +++ b/services/osslifecycle/osslifecycle.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'osslifecycle', - title: 'OSS Lifecycle', -})) +const t = (function() { + export default __a; +}()) t.create('osslifecycle active status').get('/netflix/sureal.json').expectBadge({ label: 'oss lifecycle', diff --git a/services/package-json-helpers.js b/services/package-json-helpers.js index c41d3ca3fa1fa..648ad79e96fe3 100644 --- a/services/package-json-helpers.js +++ b/services/package-json-helpers.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { InvalidParameter } = require('.') +import Joi from 'joi'; +import {InvalidParameter} from '.'; const isDependencyMap = Joi.object() .pattern( @@ -45,8 +43,8 @@ function getDependencyVersion({ return { range } } -module.exports = { +export default { isDependencyMap, isPackageJsonWithDependencies, getDependencyVersion, -} +}; diff --git a/services/package-json-helpers.spec.js b/services/package-json-helpers.spec.js index 7d6437b0e0185..2e46c419ad19a 100644 --- a/services/package-json-helpers.spec.js +++ b/services/package-json-helpers.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { getDependencyVersion } = require('./package-json-helpers') +import {test, given} from 'sazerac'; +import {getDependencyVersion} from './package-json-helpers.js'; describe('Contributor count helpers', function () { test(getDependencyVersion, () => { diff --git a/services/packagecontrol/packagecontrol.service.js b/services/packagecontrol/packagecontrol.service.js index 595986e13af7e..d907d1a295441 100644 --- a/services/packagecontrol/packagecontrol.service.js +++ b/services/packagecontrol/packagecontrol.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const keywords = ['sublime', 'sublimetext', 'packagecontrol'] @@ -116,4 +114,4 @@ function DownloadsForInterval(interval) { } } -module.exports = ['day', 'week', 'month', 'total'].map(DownloadsForInterval) +export default ['day', 'week', 'month', 'total'].map(DownloadsForInterval); diff --git a/services/packagecontrol/packagecontrol.tester.js b/services/packagecontrol/packagecontrol.tester.js index 305811406aea1..e71462a7cef55 100644 --- a/services/packagecontrol/packagecontrol.tester.js +++ b/services/packagecontrol/packagecontrol.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isMetric, isMetricOverTimePeriod } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'packagecontrol', - title: 'Package Control', -})) +const t = (function() { + export default __a; +}()) t.create('monthly downloads').get('/dm/GitGutter.json').expectBadge({ label: 'downloads', diff --git a/services/packagist/packagist-base.js b/services/packagist/packagist-base.js index 39e645be688d6..95f0a5463bd08 100644 --- a/services/packagist/packagist-base.js +++ b/services/packagist/packagist-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const packageSchema = Joi.object() .pattern( @@ -101,10 +99,10 @@ const cacheDocumentationFragment = `

` -module.exports = { +export default { allVersionsSchema, keywords, BasePackagistService, customServerDocumentationFragment, cacheDocumentationFragment, -} +}; diff --git a/services/packagist/packagist-downloads.service.js b/services/packagist/packagist-downloads.service.js index adf36593fb3a7..ba1a1b49144f3 100644 --- a/services/packagist/packagist-downloads.service.js +++ b/services/packagist/packagist-downloads.service.js @@ -1,15 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { optionalUrl } = require('../validators') -const { - keywords, - BasePackagistService, - customServerDocumentationFragment, - cacheDocumentationFragment, -} = require('./packagist-base') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {optionalUrl} from '../validators.js'; +import {keywords, BasePackagistService, customServerDocumentationFragment, cacheDocumentationFragment} from './packagist-base.js'; const periodMap = { dm: { @@ -40,7 +33,7 @@ const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class PackagistDownloads extends BasePackagistService { +export default class PackagistDownloads extends BasePackagistService { static category = 'downloads' static route = { @@ -103,4 +96,4 @@ module.exports = class PackagistDownloads extends BasePackagistService { interval, }) } -} +}; diff --git a/services/packagist/packagist-downloads.tester.js b/services/packagist/packagist-downloads.tester.js index cd23f75723241..c51bab3d3e688 100644 --- a/services/packagist/packagist-downloads.tester.js +++ b/services/packagist/packagist-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric, isMetricOverTimePeriod } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('daily downloads (valid, no package version specified)') .get('/dd/doctrine/orm.json') diff --git a/services/packagist/packagist-license.service.js b/services/packagist/packagist-license.service.js index c7c99533dbe19..e5f60518f6428 100644 --- a/services/packagist/packagist-license.service.js +++ b/services/packagist/packagist-license.service.js @@ -1,14 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { renderLicenseBadge } = require('../licenses') -const { optionalUrl } = require('../validators') -const { NotFound } = require('..') -const { - keywords, - BasePackagistService, - customServerDocumentationFragment, -} = require('./packagist-base') +import Joi from 'joi'; +import {renderLicenseBadge} from '../licenses.js'; +import {optionalUrl} from '../validators.js'; +import {NotFound} from '..'; +import {keywords, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; const packageSchema = Joi.object() .pattern( @@ -28,7 +22,7 @@ const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class PackagistLicense extends BasePackagistService { +export default class PackagistLicense extends BasePackagistService { static category = 'license' static route = { @@ -72,4 +66,4 @@ module.exports = class PackagistLicense extends BasePackagistService { const { license } = this.transform({ json, user, repo }) return renderLicenseBadge({ license }) } -} +}; diff --git a/services/packagist/packagist-license.spec.js b/services/packagist/packagist-license.spec.js index a9241e10ae78c..765f34c4d767c 100644 --- a/services/packagist/packagist-license.spec.js +++ b/services/packagist/packagist-license.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { NotFound } = require('..') -const PackagistLicense = require('./packagist-license.service') +import {expect} from 'chai'; +import {NotFound} from '..'; +import PackagistLicense from './packagist-license.service.js'; describe('PackagistLicense', function () { it('should throw NotFound when default branch is missing', function () { diff --git a/services/packagist/packagist-license.tester.js b/services/packagist/packagist-license.tester.js index 983da773e4f9b..17111d610ede2 100644 --- a/services/packagist/packagist-license.tester.js +++ b/services/packagist/packagist-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('license (valid)') .get('/symfony/symfony.json') diff --git a/services/packagist/packagist-php-version.service.js b/services/packagist/packagist-php-version.service.js index 2514c2ba460dd..c0d0b7c442847 100644 --- a/services/packagist/packagist-php-version.service.js +++ b/services/packagist/packagist-php-version.service.js @@ -1,19 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { NotFound } = require('..') -const { - allVersionsSchema, - BasePackagistService, - customServerDocumentationFragment, -} = require('./packagist-base') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {NotFound} from '..'; +import {allVersionsSchema, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class PackagistPhpVersion extends BasePackagistService { +export default class PackagistPhpVersion extends BasePackagistService { static category = 'platform-support' static route = { @@ -100,4 +94,4 @@ module.exports = class PackagistPhpVersion extends BasePackagistService { }) return this.constructor.render({ php: phpVersion }) } -} +}; diff --git a/services/packagist/packagist-php-version.spec.js b/services/packagist/packagist-php-version.spec.js index 7af1b66996b34..b02f860284ffb 100644 --- a/services/packagist/packagist-php-version.spec.js +++ b/services/packagist/packagist-php-version.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { NotFound } = require('..') -const PackagistPhpVersion = require('./packagist-php-version.service') +import {expect} from 'chai'; +import {NotFound} from '..'; +import PackagistPhpVersion from './packagist-php-version.service.js'; describe('PackagistPhpVersion', function () { const json = { diff --git a/services/packagist/packagist-php-version.tester.js b/services/packagist/packagist-php-version.tester.js index 0aa385908892e..ef0fcc676095a 100644 --- a/services/packagist/packagist-php-version.tester.js +++ b/services/packagist/packagist-php-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isComposerVersion } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isComposerVersion} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets the package version of symfony') .get('/symfony/symfony.json') diff --git a/services/packagist/packagist-stars.service.js b/services/packagist/packagist-stars.service.js index 847ee6da2abf6..fff65931ec37d 100644 --- a/services/packagist/packagist-stars.service.js +++ b/services/packagist/packagist-stars.service.js @@ -1,15 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { optionalUrl } = require('../validators') -const { - keywords, - BasePackagistService, - customServerDocumentationFragment, - cacheDocumentationFragment, -} = require('./packagist-base') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger, optionalUrl} from '../validators.js'; +import {keywords, BasePackagistService, customServerDocumentationFragment, cacheDocumentationFragment} from './packagist-base.js'; const schema = Joi.object({ package: Joi.object({ @@ -21,7 +13,7 @@ const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class PackagistStars extends BasePackagistService { +export default class PackagistStars extends BasePackagistService { static category = 'rating' static route = { @@ -79,4 +71,4 @@ module.exports = class PackagistStars extends BasePackagistService { stars: favers, }) } -} +}; diff --git a/services/packagist/packagist-stars.tester.js b/services/packagist/packagist-stars.tester.js index e8b40b69af4f4..8537c9804ba43 100644 --- a/services/packagist/packagist-stars.tester.js +++ b/services/packagist/packagist-stars.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Stars (valid package)').get('/guzzlehttp/guzzle.json').expectBadge({ label: 'stars', diff --git a/services/packagist/packagist-version.service.js b/services/packagist/packagist-version.service.js index 900ed33505b48..b56e0aee74f38 100644 --- a/services/packagist/packagist-version.service.js +++ b/services/packagist/packagist-version.service.js @@ -1,16 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { compare, isStable, latest } = require('../php-version') -const { optionalUrl } = require('../validators') -const { NotFound, redirector } = require('..') -const { - allVersionsSchema, - keywords, - BasePackagistService, - customServerDocumentationFragment, -} = require('./packagist-base') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {compare, isStable, latest} from '../php-version.js'; +import {optionalUrl} from '../validators.js'; +import {NotFound, redirector} from '..'; +import {allVersionsSchema, keywords, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; const packageSchema = Joi.object() .pattern( @@ -148,4 +141,4 @@ const PackagistVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -module.exports = { PackagistVersion, PackagistVersionRedirector } +export default { PackagistVersion, PackagistVersionRedirector }; diff --git a/services/packagist/packagist-version.tester.js b/services/packagist/packagist-version.tester.js index b01e1b7935679..7bbccf085e90e 100644 --- a/services/packagist/packagist-version.tester.js +++ b/services/packagist/packagist-version.tester.js @@ -1,15 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'packagist', - title: 'Packagist Version', - pathPrefix: '/packagist', -})) +import Joi from 'joi'; +import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) /* validator for a packagist version number diff --git a/services/php-eye/php-eye-hhvm.service.js b/services/php-eye/php-eye-hhvm.service.js index f157de1eeb853..5c224139d8b55 100644 --- a/services/php-eye/php-eye-hhvm.service.js +++ b/services/php-eye/php-eye-hhvm.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = [ +export default [ deprecatedService({ category: 'platform-support', label: 'hhvm', @@ -12,4 +10,4 @@ module.exports = [ }, dateAdded: new Date('2018-04-20'), }), -] +]; diff --git a/services/php-eye/php-eye-hhvm.tester.js b/services/php-eye/php-eye-hhvm.tester.js index ad4e58852df34..3ce4aa841fdb1 100644 --- a/services/php-eye/php-eye-hhvm.tester.js +++ b/services/php-eye/php-eye-hhvm.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'hhvm', - title: 'hhvm', - pathPrefix: '/hhvm', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously default branch)') .get('/symfony/symfony.json') diff --git a/services/php-eye/php-eye-php-version.service.js b/services/php-eye/php-eye-php-version.service.js index e7f13fb857ba1..53bb0a2f1ae61 100644 --- a/services/php-eye/php-eye-php-version.service.js +++ b/services/php-eye/php-eye-php-version.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = [ +export default [ deprecatedService({ category: 'platform-support', label: 'php tested', @@ -12,4 +10,4 @@ module.exports = [ }, dateAdded: new Date('2018-04-20'), }), -] +]; diff --git a/services/php-eye/php-eye-php-version.tester.js b/services/php-eye/php-eye-php-version.tester.js index ddf754cf481a2..8bc354293fcfc 100644 --- a/services/php-eye/php-eye-php-version.tester.js +++ b/services/php-eye/php-eye-php-version.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'php-eye', - title: 'php-eye', - pathPrefix: '/php-eye', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available (previously default branch)') .get('/symfony/symfony.json') diff --git a/services/php-version.js b/services/php-version.js index 17ede45a6f46d..5b939b4ebbe3f 100644 --- a/services/php-version.js +++ b/services/php-version.js @@ -3,13 +3,11 @@ * using the algorithm followed by Composer (see * https://getcomposer.org/doc/04-schema.md#version). */ -'use strict' - -const { promisify } = require('util') -const request = require('request') -const { regularUpdate } = require('../core/legacy/regular-update') -const { listCompare } = require('./version') -const { omitv } = require('./text-formatters') +import {promisify} from 'util'; +import request from 'request'; +import {regularUpdate} from '../core/legacy/regular-update.js'; +import {listCompare} from './version.js'; +import {omitv} from './text-formatters.js'; // Return a negative value if v1 < v2, // zero if v1 = v2, a positive value otherwise. @@ -237,14 +235,14 @@ async function getPhpReleases(githubApiProvider) { ), request: (url, options, cb) => githubApiProvider.request(request, url, {}, cb), - }) + }); } -module.exports = { +export default { compare, latest, isStable, minorVersion, versionReduction, getPhpReleases, -} +}; diff --git a/services/php-version.spec.js b/services/php-version.spec.js index 607f302ef7eb2..81eaa4763a96f 100644 --- a/services/php-version.spec.js +++ b/services/php-version.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { compare, minorVersion, versionReduction } = require('./php-version') +import {test, given} from 'sazerac'; +import {compare, minorVersion, versionReduction} from './php-version.js'; const phpReleases = [ '5.0', diff --git a/services/pingpong/pingpong-status.service.js b/services/pingpong/pingpong-status.service.js index bdebc42a024de..9a2cd2d498b72 100644 --- a/services/pingpong/pingpong-status.service.js +++ b/services/pingpong/pingpong-status.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, InvalidParameter, InvalidResponse } = require('..') +import Joi from 'joi'; +import {BaseJsonService, InvalidParameter, InvalidResponse} from '..'; const schema = Joi.object({ status: Joi.string().required(), @@ -14,7 +12,7 @@ const pingpongDocumentation = `

` -module.exports = class PingPongStatus extends BaseJsonService { +export default class PingPongStatus extends BaseJsonService { static category = 'monitoring' static route = { base: 'pingpong/status', pattern: ':apiKey' } @@ -67,4 +65,4 @@ module.exports = class PingPongStatus extends BaseJsonService { const { status } = await this.fetch({ apiKey }) return this.constructor.render({ status }) } -} +}; diff --git a/services/pingpong/pingpong-status.tester.js b/services/pingpong/pingpong-status.tester.js index 9f151cc90967e..b32055cb944c8 100644 --- a/services/pingpong/pingpong-status.tester.js +++ b/services/pingpong/pingpong-status.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isCorrectStatus = Joi.string().valid( 'up', diff --git a/services/pingpong/pingpong-uptime.service.js b/services/pingpong/pingpong-uptime.service.js index 29878478269e9..2e16e22d56d0b 100644 --- a/services/pingpong/pingpong-uptime.service.js +++ b/services/pingpong/pingpong-uptime.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage } = require('../color-formatters') -const { BaseJsonService, InvalidParameter } = require('..') +import Joi from 'joi'; +import {coveragePercentage} from '../color-formatters.js'; +import {BaseJsonService, InvalidParameter} from '..'; const schema = Joi.object({ uptime: Joi.number().min(0).max(100).required(), @@ -15,7 +13,7 @@ const pingpongDocumentation = `

` -module.exports = class PingPongUptime extends BaseJsonService { +export default class PingPongUptime extends BaseJsonService { static category = 'monitoring' static route = { base: 'pingpong/uptime', pattern: ':apiKey' } @@ -58,4 +56,4 @@ module.exports = class PingPongUptime extends BaseJsonService { const { uptime } = await this.fetch({ apiKey }) return this.constructor.render({ uptime }) } -} +}; diff --git a/services/pingpong/pingpong-uptime.tester.js b/services/pingpong/pingpong-uptime.tester.js index ea72c86ba3b55..67c7fd07bb8b9 100644 --- a/services/pingpong/pingpong-uptime.tester.js +++ b/services/pingpong/pingpong-uptime.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('PingPong: Uptime (valid)') .get('/sp_eb705b7c189f42e3b574dc790291c33f.json') diff --git a/services/pipenv-helpers.js b/services/pipenv-helpers.js index 4f31f2eaedef7..4154a32cbebfe 100644 --- a/services/pipenv-helpers.js +++ b/services/pipenv-helpers.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { InvalidParameter } = require('.') +import Joi from 'joi'; +import {InvalidParameter} from '.'; const isDependency = Joi.alternatives( Joi.object({ @@ -52,7 +50,7 @@ function getDependencyVersion({ } } -module.exports = { +export default { isLockfile, getDependencyVersion, -} +}; diff --git a/services/pkgreview/package-rating.service.js b/services/pkgreview/package-rating.service.js index fc7045cbc6a1d..af522234c1111 100644 --- a/services/pkgreview/package-rating.service.js +++ b/services/pkgreview/package-rating.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { starRating, metric } = require('../text-formatters') -const { colorScale } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {starRating, metric} from '../text-formatters.js'; +import {colorScale} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const pkgReviewColor = colorScale([2, 3, 4]) @@ -15,7 +13,7 @@ const schema = Joi.object({ // Repository for this service is: https://github.com/iqubex-technologies/pkgreview.dev // Internally the service leverages the npms.io API (https://api.npms.io/v2) -module.exports = class PkgreviewRating extends BaseJsonService { +export default class PkgreviewRating extends BaseJsonService { static category = 'rating' static route = { @@ -82,4 +80,4 @@ module.exports = class PkgreviewRating extends BaseJsonService { rating: rating * 5, }) } -} +}; diff --git a/services/pkgreview/package-rating.tester.js b/services/pkgreview/package-rating.tester.js index a9859265224aa..298fe05c2d2ab 100644 --- a/services/pkgreview/package-rating.tester.js +++ b/services/pkgreview/package-rating.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex, isStarRating } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex, isStarRating} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const isRatingWithReviews = withRegex( /^(([0-4](.?([0-9]))?)|5)\/5?\s*\([0-9]*\)$/ diff --git a/services/poeditor/poeditor.service.js b/services/poeditor/poeditor.service.js index 3dd84aea53465..0d2acec00f3f9 100644 --- a/services/poeditor/poeditor.service.js +++ b/services/poeditor/poeditor.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { coveragePercentage } = require('../color-formatters') -const { BaseJsonService, InvalidResponse } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {coveragePercentage} from '../color-formatters.js'; +import {BaseJsonService, InvalidResponse} from '..'; const documentation = `

@@ -36,7 +34,7 @@ const queryParamSchema = Joi.object({ token: Joi.string().required(), }).required() -module.exports = class POEditor extends BaseJsonService { +export default class POEditor extends BaseJsonService { static category = 'other' static route = { @@ -101,4 +99,4 @@ module.exports = class POEditor extends BaseJsonService { language: languages.find(lang => lang.code === languageCode), }) } -} +}; diff --git a/services/poeditor/poeditor.tester.js b/services/poeditor/poeditor.tester.js index 78db3b1657369..aacf4f6b45bfa 100644 --- a/services/poeditor/poeditor.tester.js +++ b/services/poeditor/poeditor.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets POEditor progress online') .get('/progress/323337/de.json?token=7a666b44c0985d16a7b59748f488275c') diff --git a/services/powershellgallery/powershellgallery.service.js b/services/powershellgallery/powershellgallery.service.js index 60f329ea95521..14c64e52ddb32 100644 --- a/services/powershellgallery/powershellgallery.service.js +++ b/services/powershellgallery/powershellgallery.service.js @@ -1,10 +1,5 @@ -'use strict' - -const { - fetch, - createServiceFamily, -} = require('../nuget/nuget-v2-service-family') -const { BaseXmlService } = require('..') +import {fetch, createServiceFamily} from '../nuget/nuget-v2-service-family.js'; +import {BaseXmlService} from '..'; const WINDOWS_TAG_NAME = 'windows' const MACOS_TAG_NAME = 'macos' @@ -97,9 +92,9 @@ class PowershellGalleryPlatformSupport extends BaseXmlService { } } -module.exports = { +export default { PowershellGalleryVersion, PowershellGalleryVersionRedirector, PowershellGalleryDownloads, PowershellGalleryPlatformSupport, -} +}; diff --git a/services/powershellgallery/powershellgallery.tester.js b/services/powershellgallery/powershellgallery.tester.js index d9999b919a23a..5070709f9cfe0 100644 --- a/services/powershellgallery/powershellgallery.tester.js +++ b/services/powershellgallery/powershellgallery.tester.js @@ -1,12 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { - isMetric, - isVPlusDottedVersionNClauses, - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; const isPlatform = Joi.string().regex( /^(windows|linux|macos)( \| (windows|linux|macos))*$/ ) @@ -15,7 +9,7 @@ const t = new ServiceTester({ id: 'powershellgallery', title: 'PowerShell Gallery', }) -module.exports = t +export default t; t.create('total downloads (valid)').get('/dt/ACMESharp.json').expectBadge({ label: 'downloads', diff --git a/services/pub/pub.service.js b/services/pub/pub.service.js index ccc12017b78c5..f07857dac53d9 100644 --- a/services/pub/pub.service.js +++ b/services/pub/pub.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { latest, renderVersionBadge } = require('../version') -const { BaseJsonService, redirector } = require('..') +import Joi from 'joi'; +import {latest, renderVersionBadge} from '../version.js'; +import {BaseJsonService, redirector} from '..'; const schema = Joi.object({ versions: Joi.array().items(Joi.string()).required(), @@ -68,4 +66,4 @@ const PubVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -module.exports = { PubVersion, PubVersionRedirector } +export default { PubVersion, PubVersionRedirector }; diff --git a/services/pub/pub.tester.js b/services/pub/pub.tester.js index 613447fff620d..a72b975eae68c 100644 --- a/services/pub/pub.tester.js +++ b/services/pub/pub.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { isVPlusTripleDottedVersion } = require('../test-validators') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'PubVersion', - title: 'Pub Version', - pathPrefix: '/pub', -})) +import {isVPlusTripleDottedVersion} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('package version').get('/v/box2d.json').expectBadge({ label: 'pub', diff --git a/services/puppetforge/puppetforge-base.js b/services/puppetforge/puppetforge-base.js index 4e209ca91821f..f0e6b273cc680 100644 --- a/services/puppetforge/puppetforge-base.js +++ b/services/puppetforge/puppetforge-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger, semver } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger, semver} from '../validators.js'; +import {BaseJsonService} from '..'; const usersSchema = Joi.object({ module_count: nonNegativeInteger, @@ -44,7 +42,7 @@ class BasePuppetForgeModulesService extends BaseJsonService { } } -module.exports = { +export default { BasePuppetForgeModulesService, BasePuppetForgeUsersService, -} +}; diff --git a/services/puppetforge/puppetforge-module-downloads.service.js b/services/puppetforge/puppetforge-module-downloads.service.js index 84eddb3225d2b..3133e19278502 100644 --- a/services/puppetforge/puppetforge-module-downloads.service.js +++ b/services/puppetforge/puppetforge-module-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' +import {downloadCount} from '../color-formatters.js'; +import {metric} from '../text-formatters.js'; +import {BasePuppetForgeModulesService} from './puppetforge-base.js'; -const { downloadCount } = require('../color-formatters') -const { metric } = require('../text-formatters') -const { BasePuppetForgeModulesService } = require('./puppetforge-base') - -module.exports = class PuppetforgeModuleDownloads extends ( +export default class PuppetforgeModuleDownloads extends ( BasePuppetForgeModulesService ) { static category = 'downloads' @@ -38,4 +36,4 @@ module.exports = class PuppetforgeModuleDownloads extends ( const data = await this.fetch({ user, moduleName }) return this.constructor.render({ downloads: data.downloads }) } -} +}; diff --git a/services/puppetforge/puppetforge-module-downloads.tester.js b/services/puppetforge/puppetforge-module-downloads.tester.js index f7383969f3d12..ed034ff56f044 100644 --- a/services/puppetforge/puppetforge-module-downloads.tester.js +++ b/services/puppetforge/puppetforge-module-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('module downloads').get('/camptocamp/openssl.json').expectBadge({ label: 'downloads', diff --git a/services/puppetforge/puppetforge-module-endorsement.service.js b/services/puppetforge/puppetforge-module-endorsement.service.js index 4390bff469dd0..11d544fea8448 100644 --- a/services/puppetforge/puppetforge-module-endorsement.service.js +++ b/services/puppetforge/puppetforge-module-endorsement.service.js @@ -1,9 +1,7 @@ -'use strict' +import {NotFound} from '..'; +import {BasePuppetForgeModulesService} from './puppetforge-base.js'; -const { NotFound } = require('..') -const { BasePuppetForgeModulesService } = require('./puppetforge-base') - -module.exports = class PuppetforgeModuleEndorsement extends ( +export default class PuppetforgeModuleEndorsement extends ( BasePuppetForgeModulesService ) { static category = 'rating' @@ -45,4 +43,4 @@ module.exports = class PuppetforgeModuleEndorsement extends ( } return this.constructor.render({ endorsement }) } -} +}; diff --git a/services/puppetforge/puppetforge-module-endorsement.tester.js b/services/puppetforge/puppetforge-module-endorsement.tester.js index 83c5e077585a4..0c4f0eef18119 100644 --- a/services/puppetforge/puppetforge-module-endorsement.tester.js +++ b/services/puppetforge/puppetforge-module-endorsement.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('module endorsement') .get('/camptocamp/openssl.json') diff --git a/services/puppetforge/puppetforge-module-feedback.service.js b/services/puppetforge/puppetforge-module-feedback.service.js index ad2e845cacb9e..207f790703ebc 100644 --- a/services/puppetforge/puppetforge-module-feedback.service.js +++ b/services/puppetforge/puppetforge-module-feedback.service.js @@ -1,12 +1,8 @@ -'use strict' +import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; +import {NotFound} from '..'; +import {BasePuppetForgeModulesService} from './puppetforge-base.js'; -const { - coveragePercentage: coveragePercentageColor, -} = require('../color-formatters') -const { NotFound } = require('..') -const { BasePuppetForgeModulesService } = require('./puppetforge-base') - -module.exports = class PuppetforgeModuleFeedback extends ( +export default class PuppetforgeModuleFeedback extends ( BasePuppetForgeModulesService ) { static category = 'rating' @@ -43,4 +39,4 @@ module.exports = class PuppetforgeModuleFeedback extends ( } return this.constructor.render({ score: data.feedback_score }) } -} +}; diff --git a/services/puppetforge/puppetforge-module-feedback.tester.js b/services/puppetforge/puppetforge-module-feedback.tester.js index 1178ab33de086..bd2b0079f1c84 100644 --- a/services/puppetforge/puppetforge-module-feedback.tester.js +++ b/services/puppetforge/puppetforge-module-feedback.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('module feedback').get('/camptocamp/openssl.json').expectBadge({ label: 'score', diff --git a/services/puppetforge/puppetforge-module-pdk-version.service.js b/services/puppetforge/puppetforge-module-pdk-version.service.js index ced2ff067923f..43129da1072e9 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.service.js +++ b/services/puppetforge/puppetforge-module-pdk-version.service.js @@ -1,10 +1,8 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {NotFound} from '..'; +import {BasePuppetForgeModulesService} from './puppetforge-base.js'; -const { renderVersionBadge } = require('../version') -const { NotFound } = require('..') -const { BasePuppetForgeModulesService } = require('./puppetforge-base') - -module.exports = class PuppetforgeModulePdkVersion extends ( +export default class PuppetforgeModulePdkVersion extends ( BasePuppetForgeModulesService ) { static category = 'platform-support' @@ -37,4 +35,4 @@ module.exports = class PuppetforgeModulePdkVersion extends ( throw new NotFound({ prettyMessage: 'none' }) } } -} +}; diff --git a/services/puppetforge/puppetforge-module-pdk-version.tester.js b/services/puppetforge/puppetforge-module-pdk-version.tester.js index d38efaeb00fa9..fbecff1dfdb53 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.tester.js +++ b/services/puppetforge/puppetforge-module-pdk-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('PDK version').get('/tragiccode/azure_key_vault.json').expectBadge({ label: 'pdk version', diff --git a/services/puppetforge/puppetforge-module-version.service.js b/services/puppetforge/puppetforge-module-version.service.js index 148a800d8c66a..bda35c2cc89b9 100644 --- a/services/puppetforge/puppetforge-module-version.service.js +++ b/services/puppetforge/puppetforge-module-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {BasePuppetForgeModulesService} from './puppetforge-base.js'; -const { renderVersionBadge } = require('../version') -const { BasePuppetForgeModulesService } = require('./puppetforge-base') - -module.exports = class PuppetforgeModuleVersion extends ( +export default class PuppetforgeModuleVersion extends ( BasePuppetForgeModulesService ) { static category = 'version' @@ -30,4 +28,4 @@ module.exports = class PuppetforgeModuleVersion extends ( const data = await this.fetch({ user, moduleName }) return renderVersionBadge({ version: data.current_release.version }) } -} +}; diff --git a/services/puppetforge/puppetforge-module-version.tester.js b/services/puppetforge/puppetforge-module-version.tester.js index a06132f1c5513..a304263ae1c4f 100644 --- a/services/puppetforge/puppetforge-module-version.tester.js +++ b/services/puppetforge/puppetforge-module-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('module version').get('/camptocamp/openssl.json').expectBadge({ label: 'puppetforge', diff --git a/services/puppetforge/puppetforge-user-module-count.service.js b/services/puppetforge/puppetforge-user-module-count.service.js index e45a739a8a225..d0da8557d3892 100644 --- a/services/puppetforge/puppetforge-user-module-count.service.js +++ b/services/puppetforge/puppetforge-user-module-count.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BasePuppetForgeUsersService} from './puppetforge-base.js'; -const { metric } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BasePuppetForgeUsersService } = require('./puppetforge-base') - -module.exports = class PuppetForgeModuleCountService extends ( +export default class PuppetForgeModuleCountService extends ( BasePuppetForgeUsersService ) { static category = 'other' @@ -37,4 +35,4 @@ module.exports = class PuppetForgeModuleCountService extends ( const data = await this.fetch({ user }) return this.constructor.render({ modules: data.module_count }) } -} +}; diff --git a/services/puppetforge/puppetforge-user-module-count.tester.js b/services/puppetforge/puppetforge-user-module-count.tester.js index 1a970d83abb66..73e5aae70e7e6 100644 --- a/services/puppetforge/puppetforge-user-module-count.tester.js +++ b/services/puppetforge/puppetforge-user-module-count.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('modules by user').get('/camptocamp.json').expectBadge({ label: 'modules', diff --git a/services/puppetforge/puppetforge-user-release-count.service.js b/services/puppetforge/puppetforge-user-release-count.service.js index ee2afe4932792..918f01b5f812c 100644 --- a/services/puppetforge/puppetforge-user-release-count.service.js +++ b/services/puppetforge/puppetforge-user-release-count.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BasePuppetForgeUsersService} from './puppetforge-base.js'; -const { metric } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BasePuppetForgeUsersService } = require('./puppetforge-base') - -module.exports = class PuppetForgeReleaseCountService extends ( +export default class PuppetForgeReleaseCountService extends ( BasePuppetForgeUsersService ) { static category = 'other' @@ -37,4 +35,4 @@ module.exports = class PuppetForgeReleaseCountService extends ( const data = await this.fetch({ user }) return this.constructor.render({ releases: data.release_count }) } -} +}; diff --git a/services/puppetforge/puppetforge-user-release-count.tester.js b/services/puppetforge/puppetforge-user-release-count.tester.js index 75ec3023d2b89..ae09b05c6f151 100644 --- a/services/puppetforge/puppetforge-user-release-count.tester.js +++ b/services/puppetforge/puppetforge-user-release-count.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('releases by user').get('/camptocamp.json').expectBadge({ label: 'releases', diff --git a/services/pypi/pypi-base.js b/services/pypi/pypi-base.js index 8ca4d87f77075..540b93244e017 100644 --- a/services/pypi/pypi-base.js +++ b/services/pypi/pypi-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ info: Joi.object({ @@ -24,7 +22,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class PypiBase extends BaseJsonService { +export default class PypiBase extends BaseJsonService { static buildRoute(base) { return { base, @@ -39,4 +37,4 @@ module.exports = class PypiBase extends BaseJsonService { errorMessages: { 404: 'package or version not found' }, }) } -} +}; diff --git a/services/pypi/pypi-django-versions.service.js b/services/pypi/pypi-django-versions.service.js index ca6325ad94ae5..5a742b8ee6cb8 100644 --- a/services/pypi/pypi-django-versions.service.js +++ b/services/pypi/pypi-django-versions.service.js @@ -1,9 +1,7 @@ -'use strict' +import PypiBase from './pypi-base.js'; +import {sortDjangoVersions, parseClassifiers} from './pypi-helpers.js'; -const PypiBase = require('./pypi-base') -const { sortDjangoVersions, parseClassifiers } = require('./pypi-helpers') - -module.exports = class PypiDjangoVersions extends PypiBase { +export default class PypiDjangoVersions extends PypiBase { static category = 'platform-support' static route = this.buildRoute('pypi/djversions') @@ -44,4 +42,4 @@ module.exports = class PypiDjangoVersions extends PypiBase { return this.constructor.render({ versions }) } -} +}; diff --git a/services/pypi/pypi-django-versions.tester.js b/services/pypi/pypi-django-versions.tester.js index 8dba69853c573..240f3268fc43a 100644 --- a/services/pypi/pypi-django-versions.tester.js +++ b/services/pypi/pypi-django-versions.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isPipeSeparatedDjangoVersions = Joi.string().regex( /^([1-9]\.[0-9]+(?: \| )?)+$/ diff --git a/services/pypi/pypi-downloads.service.js b/services/pypi/pypi-downloads.service.js index 900dcf614dd5f..70152d2d1d1be 100644 --- a/services/pypi/pypi-downloads.service.js +++ b/services/pypi/pypi-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { downloadCount } = require('../color-formatters') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {downloadCount} from '../color-formatters.js'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const keywords = ['python'] @@ -33,7 +31,7 @@ const periodMap = { // this badge uses PyPI Stats instead of the PyPI API // so it doesn't extend PypiBase -module.exports = class PypiDownloads extends BaseJsonService { +export default class PypiDownloads extends BaseJsonService { static category = 'downloads' static route = { @@ -77,4 +75,4 @@ module.exports = class PypiDownloads extends BaseJsonService { downloads: json.data[periodMap[period].api_field], }) } -} +}; diff --git a/services/pypi/pypi-downloads.tester.js b/services/pypi/pypi-downloads.tester.js index c8e17b5ea8dca..58083e4376518 100644 --- a/services/pypi/pypi-downloads.tester.js +++ b/services/pypi/pypi-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetricOverTimePeriod } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetricOverTimePeriod} from '../test-validators.js'; t.create('daily downloads (valid)') .get('/dd/djangorestframework.json') diff --git a/services/pypi/pypi-format.service.js b/services/pypi/pypi-format.service.js index b96fc3f4b49e0..127538fecf931 100644 --- a/services/pypi/pypi-format.service.js +++ b/services/pypi/pypi-format.service.js @@ -1,9 +1,7 @@ -'use strict' +import PypiBase from './pypi-base.js'; +import {getPackageFormats} from './pypi-helpers.js'; -const PypiBase = require('./pypi-base') -const { getPackageFormats } = require('./pypi-helpers') - -module.exports = class PypiFormat extends PypiBase { +export default class PypiFormat extends PypiBase { static category = 'other' static route = this.buildRoute('pypi/format') @@ -44,4 +42,4 @@ module.exports = class PypiFormat extends PypiBase { const { hasWheel, hasEgg } = getPackageFormats(packageData) return this.constructor.render({ hasWheel, hasEgg }) } -} +}; diff --git a/services/pypi/pypi-format.tester.js b/services/pypi/pypi-format.tester.js index ffc93f9ea58ea..8cd838cd750d6 100644 --- a/services/pypi/pypi-format.tester.js +++ b/services/pypi/pypi-format.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('format (wheel, package version in request)') .get('/requests/2.18.4.json') diff --git a/services/pypi/pypi-helpers.js b/services/pypi/pypi-helpers.js index 5cdf78ced0809..fedc9fa08fd25 100644 --- a/services/pypi/pypi-helpers.js +++ b/services/pypi/pypi-helpers.js @@ -1,5 +1,3 @@ -'use strict' - /* Django versions will be specified in the form major.minor trying to sort with `semver.compare` will throw e.g: @@ -105,10 +103,10 @@ function getPackageFormats(packageData) { } } -module.exports = { +export default { parseClassifiers, parseDjangoVersionString, sortDjangoVersions, getLicenses, getPackageFormats, -} +}; diff --git a/services/pypi/pypi-implementation.service.js b/services/pypi/pypi-implementation.service.js index 4b423855579d7..27d8b5e1dad4a 100644 --- a/services/pypi/pypi-implementation.service.js +++ b/services/pypi/pypi-implementation.service.js @@ -1,9 +1,7 @@ -'use strict' +import PypiBase from './pypi-base.js'; +import {parseClassifiers} from './pypi-helpers.js'; -const PypiBase = require('./pypi-base') -const { parseClassifiers } = require('./pypi-helpers') - -module.exports = class PypiImplementation extends PypiBase { +export default class PypiImplementation extends PypiBase { static category = 'platform-support' static route = this.buildRoute('pypi/implementation') @@ -41,4 +39,4 @@ module.exports = class PypiImplementation extends PypiBase { return this.constructor.render({ implementations }) } -} +}; diff --git a/services/pypi/pypi-implementation.tester.js b/services/pypi/pypi-implementation.tester.js index 726d4d2912c58..36e38ea7acd1a 100644 --- a/services/pypi/pypi-implementation.tester.js +++ b/services/pypi/pypi-implementation.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('implementation (valid, package version in request)') .get('/beehive/1.0.json') diff --git a/services/pypi/pypi-license.service.js b/services/pypi/pypi-license.service.js index 0844d2a3b86ba..234e200d30947 100644 --- a/services/pypi/pypi-license.service.js +++ b/services/pypi/pypi-license.service.js @@ -1,10 +1,8 @@ -'use strict' +import {renderLicenseBadge} from '../licenses.js'; +import PypiBase from './pypi-base.js'; +import {getLicenses} from './pypi-helpers.js'; -const { renderLicenseBadge } = require('../licenses') -const PypiBase = require('./pypi-base') -const { getLicenses } = require('./pypi-helpers') - -module.exports = class PypiLicense extends PypiBase { +export default class PypiLicense extends PypiBase { static category = 'license' static route = this.buildRoute('pypi/l') @@ -28,4 +26,4 @@ module.exports = class PypiLicense extends PypiBase { const licenses = getLicenses(packageData) return this.constructor.render({ licenses }) } -} +}; diff --git a/services/pypi/pypi-license.tester.js b/services/pypi/pypi-license.tester.js index 31c66deeac69f..71ad8f80236bc 100644 --- a/services/pypi/pypi-license.tester.js +++ b/services/pypi/pypi-license.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('license (valid, package version in request)') .get('/requests/2.18.4.json') diff --git a/services/pypi/pypi-python-versions.service.js b/services/pypi/pypi-python-versions.service.js index 4dcb66a301796..b845f34d4ec02 100644 --- a/services/pypi/pypi-python-versions.service.js +++ b/services/pypi/pypi-python-versions.service.js @@ -1,10 +1,8 @@ -'use strict' +import semver from 'semver'; +import PypiBase from './pypi-base.js'; +import {parseClassifiers} from './pypi-helpers.js'; -const semver = require('semver') -const PypiBase = require('./pypi-base') -const { parseClassifiers } = require('./pypi-helpers') - -module.exports = class PypiPythonVersions extends PypiBase { +export default class PypiPythonVersions extends PypiBase { static category = 'platform-support' static route = this.buildRoute('pypi/pyversions') @@ -65,4 +63,4 @@ module.exports = class PypiPythonVersions extends PypiBase { return this.constructor.render({ versions }) } -} +}; diff --git a/services/pypi/pypi-python-versions.spec.js b/services/pypi/pypi-python-versions.spec.js index 5ce5c07aa1336..3a351e922b051 100644 --- a/services/pypi/pypi-python-versions.spec.js +++ b/services/pypi/pypi-python-versions.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { render } = require('./pypi-python-versions.service') +import {test, given} from 'sazerac'; +import {render} from './pypi-python-versions.service.js'; describe('PyPI Python Version', function () { test(render, function () { diff --git a/services/pypi/pypi-python-versions.tester.js b/services/pypi/pypi-python-versions.tester.js index efb9308317d58..bf3936c8722d9 100644 --- a/services/pypi/pypi-python-versions.tester.js +++ b/services/pypi/pypi-python-versions.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isPipeSeparatedPythonVersions = Joi.string().regex( /^([1-9]\.[0-9]+(?: \| )?)+$/ diff --git a/services/pypi/pypi-status.service.js b/services/pypi/pypi-status.service.js index 4df298a03d523..e4f68afbda472 100644 --- a/services/pypi/pypi-status.service.js +++ b/services/pypi/pypi-status.service.js @@ -1,9 +1,7 @@ -'use strict' +import PypiBase from './pypi-base.js'; +import {parseClassifiers} from './pypi-helpers.js'; -const PypiBase = require('./pypi-base') -const { parseClassifiers } = require('./pypi-helpers') - -module.exports = class PypiStatus extends PypiBase { +export default class PypiStatus extends PypiBase { static category = 'other' static route = this.buildRoute('pypi/status') @@ -62,4 +60,4 @@ module.exports = class PypiStatus extends PypiBase { return this.constructor.render({ status }) } -} +}; diff --git a/services/pypi/pypi-status.tester.js b/services/pypi/pypi-status.tester.js index 751da746de7b0..cee546544e736 100644 --- a/services/pypi/pypi-status.tester.js +++ b/services/pypi/pypi-status.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('status (valid, stable, package version in request)') .get('/django/1.11.json') diff --git a/services/pypi/pypi-version.service.js b/services/pypi/pypi-version.service.js index 68ae1c5d532be..86a34d66f8fce 100644 --- a/services/pypi/pypi-version.service.js +++ b/services/pypi/pypi-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import PypiBase from './pypi-base.js'; -const { renderVersionBadge } = require('../version') -const PypiBase = require('./pypi-base') - -module.exports = class PypiVersion extends PypiBase { +export default class PypiVersion extends PypiBase { static category = 'version' static route = this.buildRoute('pypi/v') @@ -30,4 +28,4 @@ module.exports = class PypiVersion extends PypiBase { } = await this.fetch({ egg }) return this.constructor.render({ version }) } -} +}; diff --git a/services/pypi/pypi-version.tester.js b/services/pypi/pypi-version.tester.js index 65f881456e841..ca262093f0056 100644 --- a/services/pypi/pypi-version.tester.js +++ b/services/pypi/pypi-version.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { isSemver } = require('../test-validators') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {isSemver} from '../test-validators.js'; const isPsycopg2Version = Joi.string().regex(/^v([0-9][.]?)+$/) diff --git a/services/pypi/pypi-wheel.service.js b/services/pypi/pypi-wheel.service.js index 47f23b41b2b96..9525b17b97323 100644 --- a/services/pypi/pypi-wheel.service.js +++ b/services/pypi/pypi-wheel.service.js @@ -1,9 +1,7 @@ -'use strict' +import PypiBase from './pypi-base.js'; +import {getPackageFormats} from './pypi-helpers.js'; -const PypiBase = require('./pypi-base') -const { getPackageFormats } = require('./pypi-helpers') - -module.exports = class PypiWheel extends PypiBase { +export default class PypiWheel extends PypiBase { static category = 'platform-support' static route = this.buildRoute('pypi/wheel') @@ -39,4 +37,4 @@ module.exports = class PypiWheel extends PypiBase { const { hasWheel } = getPackageFormats(packageData) return this.constructor.render({ hasWheel }) } -} +}; diff --git a/services/pypi/pypi-wheel.tester.js b/services/pypi/pypi-wheel.tester.js index d888b6a05df2d..99945b0bac2c0 100644 --- a/services/pypi/pypi-wheel.tester.js +++ b/services/pypi/pypi-wheel.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('wheel (has wheel, package version in request)') .get('/requests/2.18.4.json') diff --git a/services/readthedocs/readthedocs.service.js b/services/readthedocs/readthedocs.service.js index 3b3b15a8a4deb..f3da497a5fae0 100644 --- a/services/readthedocs/readthedocs.service.js +++ b/services/readthedocs/readthedocs.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService, NotFound } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService, NotFound} from '..'; const keywords = ['documentation'] @@ -12,7 +10,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class ReadTheDocs extends BaseSvgScrapingService { +export default class ReadTheDocs extends BaseSvgScrapingService { static category = 'build' static route = { @@ -60,4 +58,4 @@ module.exports = class ReadTheDocs extends BaseSvgScrapingService { } return this.constructor.render({ status }) } -} +}; diff --git a/services/readthedocs/readthedocs.tester.js b/services/readthedocs/readthedocs.tester.js index 2ed6c8bdb45c4..da7ab34be127a 100644 --- a/services/readthedocs/readthedocs.tester.js +++ b/services/readthedocs/readthedocs.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('build status') .get('/pip.json') diff --git a/services/reddit/subreddit-subscribers.service.js b/services/reddit/subreddit-subscribers.service.js index 992d8668090a6..8bf8b843c4030 100644 --- a/services/reddit/subreddit-subscribers.service.js +++ b/services/reddit/subreddit-subscribers.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { optionalNonNegativeInteger } = require('../validators') -const { metric } = require('../text-formatters') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {optionalNonNegativeInteger} from '../validators.js'; +import {metric} from '../text-formatters.js'; +import {BaseJsonService, NotFound} from '..'; const schema = Joi.object({ data: Joi.object({ @@ -11,7 +9,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class RedditSubredditSubscribers extends BaseJsonService { +export default class RedditSubredditSubscribers extends BaseJsonService { static category = 'social' static route = { @@ -73,4 +71,4 @@ module.exports = class RedditSubredditSubscribers extends BaseJsonService { subscribers, }) } -} +}; diff --git a/services/reddit/subreddit-subscribers.tester.js b/services/reddit/subreddit-subscribers.tester.js index b9d4265d5566f..145c69ba335d1 100644 --- a/services/reddit/subreddit-subscribers.tester.js +++ b/services/reddit/subreddit-subscribers.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('subreddit-subscribers (valid subreddit)') .get('/drums.json') diff --git a/services/reddit/user-karma.service.js b/services/reddit/user-karma.service.js index 35483bb409771..3bcbd954317b6 100644 --- a/services/reddit/user-karma.service.js +++ b/services/reddit/user-karma.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { metric } = require('../text-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {metric} from '../text-formatters.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ data: Joi.object({ @@ -12,7 +10,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class RedditUserKarma extends BaseJsonService { +export default class RedditUserKarma extends BaseJsonService { static category = 'social' static route = { @@ -85,4 +83,4 @@ module.exports = class RedditUserKarma extends BaseJsonService { user, }) } -} +}; diff --git a/services/reddit/user-karma.tester.js b/services/reddit/user-karma.tester.js index e02496e5f2844..269b9e3f48157 100644 --- a/services/reddit/user-karma.tester.js +++ b/services/reddit/user-karma.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('user-karma (valid - link)') .get('/link/user_simulator.json') diff --git a/services/redmine/redmine.service.js b/services/redmine/redmine.service.js index 4de51ca74ad23..f2cdc88d48ed2 100644 --- a/services/redmine/redmine.service.js +++ b/services/redmine/redmine.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { starRating } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BaseXmlService } = require('..') +import Joi from 'joi'; +import {starRating} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BaseXmlService} from '..'; const schema = Joi.object({ 'redmine-plugin': Joi.object({ @@ -78,4 +76,4 @@ class RedminePluginStars extends BaseRedminePluginRating { } } -module.exports = { RedminePluginRating, RedminePluginStars } +export default { RedminePluginRating, RedminePluginStars }; diff --git a/services/redmine/redmine.tester.js b/services/redmine/redmine.tester.js index 720d8a77e819d..6676759e87b90 100644 --- a/services/redmine/redmine.tester.js +++ b/services/redmine/redmine.tester.js @@ -1,13 +1,10 @@ -'use strict' +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {isStarRating} from '../test-validators.js'; -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { isStarRating } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'redmine', - title: 'Redmine', -})) +const t = (function() { + export default __a; +}()) t.create('plugin rating') .get('/plugin/rating/redmine_xlsx_format_issue_exporter.json') diff --git a/services/repology/repology-repositories.service.js b/services/repology/repology-repositories.service.js index 7d179bc3f4623..d2c9603e44ee2 100644 --- a/services/repology/repology-repositories.service.js +++ b/services/repology/repology-repositories.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseSvgScrapingService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseSvgScrapingService} from '..'; const schema = Joi.object({ message: nonNegativeInteger, }).required() -module.exports = class RepologyRepositories extends BaseSvgScrapingService { +export default class RepologyRepositories extends BaseSvgScrapingService { static category = 'platform-support' static route = { @@ -44,4 +42,4 @@ module.exports = class RepologyRepositories extends BaseSvgScrapingService { return this.constructor.render({ repositoryCount }) } -} +}; diff --git a/services/repology/repology-repositories.tester.js b/services/repology/repology-repositories.tester.js index b300adc44e05e..1fee4455c6065 100644 --- a/services/repology/repology-repositories.tester.js +++ b/services/repology/repology-repositories.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { nonNegativeInteger } = require('../validators') +const t = (function() { + export default __a; +}()) +import {nonNegativeInteger} from '../validators.js'; t.create('Existing project').get('/starship.json').expectBadge({ label: 'repositories', diff --git a/services/requires/requires.service.js b/services/requires/requires.service.js index b8528900ec41d..7f8c7840c12db 100644 --- a/services/requires/requires.service.js +++ b/services/requires/requires.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const statusSchema = Joi.object({ status: Joi.string().required(), }).required() -module.exports = class RequiresIo extends BaseJsonService { +export default class RequiresIo extends BaseJsonService { static category = 'dependencies' static route = { @@ -64,4 +62,4 @@ module.exports = class RequiresIo extends BaseJsonService { const { status } = await this.fetch({ service, user, repo, branch }) return this.constructor.render({ status }) } -} +}; diff --git a/services/requires/requires.tester.js b/services/requires/requires.tester.js index 92545be604469..4e2d4b5ba5655 100644 --- a/services/requires/requires.tester.js +++ b/services/requires/requires.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isRequireStatus = Joi.string().regex( /^(up to date|outdated|insecure|unknown)$/ diff --git a/services/resharper/resharper.service.js b/services/resharper/resharper.service.js index 60585f7464721..9dca4de372459 100644 --- a/services/resharper/resharper.service.js +++ b/services/resharper/resharper.service.js @@ -1,8 +1,6 @@ -'use strict' +import {createServiceFamily} from '../nuget/nuget-v2-service-family.js'; -const { createServiceFamily } = require('../nuget/nuget-v2-service-family') - -module.exports = createServiceFamily({ +export default createServiceFamily({ name: 'ResharperPlugin', defaultLabel: 'resharper', serviceBaseUrl: 'resharper', @@ -13,4 +11,4 @@ module.exports = createServiceFamily({ exampleVersion: '2017.2.0', examplePrereleaseVersion: '2017.3.0-pre0001', exampleDownloadCount: 9e4, -}) +}); diff --git a/services/resharper/resharper.tester.js b/services/resharper/resharper.tester.js index bc31157ade833..72629611cdfec 100644 --- a/services/resharper/resharper.tester.js +++ b/services/resharper/resharper.tester.js @@ -1,16 +1,9 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { - isMetric, - isVPlusDottedVersionNClauses, - isVPlusDottedVersionNClausesWithOptionalSuffix, -} = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'resharper', - title: 'ReSharper', -})) +import {ServiceTester} from '../tester.js'; +import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; + +const t = (function() { + export default __a; +}()) // downloads diff --git a/services/response-fixtures.js b/services/response-fixtures.js index 18d7439e53af1..6f70cb6253449 100644 --- a/services/response-fixtures.js +++ b/services/response-fixtures.js @@ -1,12 +1,10 @@ -'use strict' - const invalidJSONString = '{{{{{invalid json}}' -module.exports = { +export default { invalidJSON: () => [ 200, invalidJSONString, { 'Content-Type': 'application/json' }, ], invalidJSONString, -} +}; diff --git a/services/reuse/reuse-compliance-helper.js b/services/reuse/reuse-compliance-helper.js index bb25653fdf8b2..4a116d38a9f3f 100644 --- a/services/reuse/reuse-compliance-helper.js +++ b/services/reuse/reuse-compliance-helper.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; const COLOR_MAP = { checking: 'brightgreen', @@ -13,7 +11,7 @@ const isReuseCompliance = Joi.string() .valid('compliant', 'non-compliant', 'checking', 'unregistered') .required() -module.exports = { +export default { isReuseCompliance, COLOR_MAP, -} +}; diff --git a/services/reuse/reuse-compliance.service.js b/services/reuse/reuse-compliance.service.js index c33fb3b2f5bc4..9e09691ff9f5d 100644 --- a/services/reuse/reuse-compliance.service.js +++ b/services/reuse/reuse-compliance.service.js @@ -1,13 +1,12 @@ -'use strict' -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { isReuseCompliance, COLOR_MAP } = require('./reuse-compliance-helper') +import Joi from 'joi'; +import {BaseJsonService} from '..'; +import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; const responseSchema = Joi.object({ status: isReuseCompliance, }).required() -module.exports = class Reuse extends BaseJsonService { +export default class Reuse extends BaseJsonService { static category = 'license' static route = { @@ -52,4 +51,4 @@ module.exports = class Reuse extends BaseJsonService { const { status } = await this.fetch({ remote }) return this.constructor.render({ status }) } -} +}; diff --git a/services/reuse/reuse-compliance.tester.js b/services/reuse/reuse-compliance.tester.js index a160e66107571..53b494e50e3f0 100644 --- a/services/reuse/reuse-compliance.tester.js +++ b/services/reuse/reuse-compliance.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isReuseCompliance, COLOR_MAP } = require('./reuse-compliance-helper') +const t = (function() { + export default __a; +}()) +import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; t.create('valid repo -- live') .get('/github.com/fsfe/reuse-tool.json') diff --git a/services/route-builder.js b/services/route-builder.js index 99679f316176a..aea4839305c51 100644 --- a/services/route-builder.js +++ b/services/route-builder.js @@ -1,6 +1,4 @@ -'use strict' - -const toArray = require('../core/base-service/to-array') +import toArray from '../core/base-service/to-array.js'; /* * Factory class for building a BaseService `route` object. This class is useful @@ -10,7 +8,7 @@ const toArray = require('../core/base-service/to-array') * Patterns based on path-to-regex may obviate the need for this, though they * haven't done so yet. */ -module.exports = class RouteBuilder { +export default class RouteBuilder { constructor({ base = '' } = {}) { this.base = base @@ -33,4 +31,4 @@ module.exports = class RouteBuilder { const { base, format, capture } = this return { base, format, capture } } -} +}; diff --git a/services/scoop/scoop-version.service.js b/services/scoop/scoop-version.service.js index a45310785146e..8d89b8f241c13 100644 --- a/services/scoop/scoop-version.service.js +++ b/services/scoop/scoop-version.service.js @@ -1,12 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { NotFound } = require('..') -const { - ConditionalGithubAuthV3Service, -} = require('../github/github-auth-service') -const { fetchJsonFromRepo } = require('../github/github-common-fetch') -const { renderVersionBadge } = require('../version') +import Joi from 'joi'; +import {NotFound} from '..'; +import {ConditionalGithubAuthV3Service} from '../github/github-auth-service.js'; +import {fetchJsonFromRepo} from '../github/github-common-fetch.js'; +import {renderVersionBadge} from '../version.js'; const gitHubRepoRegExp = /https:\/\/github.com\/(?.*?)\/(?.*?)(\/|$)/ @@ -20,7 +16,7 @@ const queryParamSchema = Joi.object({ bucket: Joi.string(), }) -module.exports = class ScoopVersion extends ConditionalGithubAuthV3Service { +export default class ScoopVersion extends ConditionalGithubAuthV3Service { // The buckets file (https://github.com/lukesampson/scoop/blob/master/buckets.json) changes very rarely. // Cache it for the lifetime of the current Node.js process. buckets = null @@ -89,4 +85,4 @@ module.exports = class ScoopVersion extends ConditionalGithubAuthV3Service { throw error } } -} +}; diff --git a/services/scoop/scoop-version.tester.js b/services/scoop/scoop-version.tester.js index 42b89bdeb56c3..ba5c707a8a5e5 100644 --- a/services/scoop/scoop-version.tester.js +++ b/services/scoop/scoop-version.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionNClauses} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isVPlusDottedVersionNClauses } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'scoop', - title: 'Scoop', -})) +const t = (function() { + export default __a; +}()) // version diff --git a/services/scrutinizer/scrutinizer-base.js b/services/scrutinizer/scrutinizer-base.js index b2a7c59cab849..66f3ba6517cb9 100644 --- a/services/scrutinizer/scrutinizer-base.js +++ b/services/scrutinizer/scrutinizer-base.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseJsonService, NotFound, InvalidResponse} from '..'; -const { BaseJsonService, NotFound, InvalidResponse } = require('..') - -module.exports = class ScrutinizerBase extends BaseJsonService { +export default class ScrutinizerBase extends BaseJsonService { // https://scrutinizer-ci.com/docs/api/#repository-details async fetch({ schema, vcs, slug }) { return this._requestJson({ @@ -44,4 +42,4 @@ module.exports = class ScrutinizerBase extends BaseJsonService { return { value: metricValues[metric] } } -} +}; diff --git a/services/scrutinizer/scrutinizer-build.service.js b/services/scrutinizer/scrutinizer-build.service.js index 71c67312eba67..b03c1ec5c571c 100644 --- a/services/scrutinizer/scrutinizer-build.service.js +++ b/services/scrutinizer/scrutinizer-build.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const ScrutinizerBase = require('./scrutinizer-base') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import ScrutinizerBase from './scrutinizer-base.js'; const schema = Joi.object({ default_branch: Joi.string().required(), @@ -107,8 +105,8 @@ class ScrutinizerPlainGitBuild extends ScrutinizerBuildBase { } } -module.exports = [ +export default [ ScrutinizerBuild, ScrutinizerGitLabBuild, ScrutinizerPlainGitBuild, -] +]; diff --git a/services/scrutinizer/scrutinizer-build.tester.js b/services/scrutinizer/scrutinizer-build.tester.js index a14498e93933b..5462a913144e9 100644 --- a/services/scrutinizer/scrutinizer-build.tester.js +++ b/services/scrutinizer/scrutinizer-build.tester.js @@ -1,13 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'ScrutinizerBuild', - title: 'ScrutinizerBuild', - pathPrefix: '/scrutinizer/build', -})) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('build (GitHub)') .get('/g/filp/whoops.json') diff --git a/services/scrutinizer/scrutinizer-coverage.service.js b/services/scrutinizer/scrutinizer-coverage.service.js index c2b57ba98ea73..611b2d167aebf 100644 --- a/services/scrutinizer/scrutinizer-coverage.service.js +++ b/services/scrutinizer/scrutinizer-coverage.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { colorScale } = require('../color-formatters') -const { NotFound } = require('..') -const ScrutinizerBase = require('./scrutinizer-base') +import Joi from 'joi'; +import {colorScale} from '../color-formatters.js'; +import {NotFound} from '..'; +import ScrutinizerBase from './scrutinizer-base.js'; const schema = Joi.object({ default_branch: Joi.string().required(), @@ -139,8 +137,8 @@ class ScrutinizerCoveragePlainGit extends ScrutinizerCoverageBase { } } -module.exports = [ +export default [ ScrutinizerCoverage, ScrutinizerCoverageGitLab, ScrutinizerCoveragePlainGit, -] +]; diff --git a/services/scrutinizer/scrutinizer-coverage.spec.js b/services/scrutinizer/scrutinizer-coverage.spec.js index c0308172d42de..07a947e87cafb 100644 --- a/services/scrutinizer/scrutinizer-coverage.spec.js +++ b/services/scrutinizer/scrutinizer-coverage.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const { test, given } = require('sazerac') -const { InvalidResponse, NotFound } = require('..') -const [ScrutinizerCoverage] = require('./scrutinizer-coverage.service') +import {expect} from 'chai'; +import {test, given} from 'sazerac'; +import {InvalidResponse, NotFound} from '..'; +import [ScrutinizerCoverage] from './scrutinizer-coverage.service.js'; describe('ScrutinizerCoverage', function () { test(ScrutinizerCoverage.render, () => { diff --git a/services/scrutinizer/scrutinizer-coverage.tester.js b/services/scrutinizer/scrutinizer-coverage.tester.js index ee2ca663b1d3b..7761b076deacd 100644 --- a/services/scrutinizer/scrutinizer-coverage.tester.js +++ b/services/scrutinizer/scrutinizer-coverage.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'ScrutinizerCoverage', - title: 'ScrutinizerCoverage', - pathPrefix: '/scrutinizer/coverage', -})) +import {isIntegerPercentage} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('code coverage (GitHub)').get('/g/filp/whoops.json').expectBadge({ label: 'coverage', diff --git a/services/scrutinizer/scrutinizer-quality.service.js b/services/scrutinizer/scrutinizer-quality.service.js index a5c7406fddcfc..b057fd51d3d4c 100644 --- a/services/scrutinizer/scrutinizer-quality.service.js +++ b/services/scrutinizer/scrutinizer-quality.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { colorScale } = require('../color-formatters') -const ScrutinizerBase = require('./scrutinizer-base') +import Joi from 'joi'; +import {colorScale} from '../color-formatters.js'; +import ScrutinizerBase from './scrutinizer-base.js'; const schema = Joi.object({ default_branch: Joi.string().required(), @@ -127,8 +125,8 @@ class ScrutinizerQualityPlainGit extends ScrutinizerQualityBase { } } -module.exports = [ +export default [ ScrutinizerQuality, ScrutinizerQualityGitLab, ScrutinizerQualityPlainGit, -] +]; diff --git a/services/scrutinizer/scrutinizer-quality.tester.js b/services/scrutinizer/scrutinizer-quality.tester.js index d4e14bd137137..235d7a904cfae 100644 --- a/services/scrutinizer/scrutinizer-quality.tester.js +++ b/services/scrutinizer/scrutinizer-quality.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'ScrutinizerQuality', - title: 'ScrutinizerQuality', - pathPrefix: '/scrutinizer/quality', -})) +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) const isQualityNumber = Joi.number().positive() diff --git a/services/scrutinizer/scrutinizer-redirect.service.js b/services/scrutinizer/scrutinizer-redirect.service.js index 4aee6a5ebfa0c..0d5c4b07c4797 100644 --- a/services/scrutinizer/scrutinizer-redirect.service.js +++ b/services/scrutinizer/scrutinizer-redirect.service.js @@ -1,13 +1,11 @@ -'use strict' - -const { redirector } = require('..') +import {redirector} from '..'; const commonAttrs = { category: 'analysis', dateAdded: new Date('2019-04-24'), } -module.exports = [ +export default [ redirector({ route: { base: 'scrutinizer', @@ -39,4 +37,4 @@ module.exports = [ `/scrutinizer/quality/gp/${slug}${branch ? `/${branch}` : ''}`, ...commonAttrs, }), -] +]; diff --git a/services/scrutinizer/scrutinizer-redirect.tester.js b/services/scrutinizer/scrutinizer-redirect.tester.js index c9ef3fbd569fc..1c35853833903 100644 --- a/services/scrutinizer/scrutinizer-redirect.tester.js +++ b/services/scrutinizer/scrutinizer-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'ScrutinizerQualityRedirect', - title: 'ScrutinizerQualityRedirect', - pathPrefix: '/scrutinizer', -})) +const t = (function() { + export default __a; +}()) t.create('scrutinizer quality GitHub') .get('/g/doctrine/orm.svg') diff --git a/services/security-headers/security-headers.service.js b/services/security-headers/security-headers.service.js index 2816da7adf8ea..4f13457b543a0 100644 --- a/services/security-headers/security-headers.service.js +++ b/services/security-headers/security-headers.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { BaseService, NotFound } = require('..') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {BaseService, NotFound} from '..'; const queryParamSchema = Joi.object({ url: optionalUrl.required(), @@ -20,7 +18,7 @@ const documentation = `

` -module.exports = class SecurityHeaders extends BaseService { +export default class SecurityHeaders extends BaseService { static category = 'monitoring' static route = { @@ -93,4 +91,4 @@ module.exports = class SecurityHeaders extends BaseService { return this.constructor.render({ grade }) } -} +}; diff --git a/services/security-headers/security-headers.tester.js b/services/security-headers/security-headers.tester.js index f3c4e3b1266c3..787c84706576a 100644 --- a/services/security-headers/security-headers.tester.js +++ b/services/security-headers/security-headers.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('grade of https://shields.io') .get('/security-headers.json?url=https://shields.io') diff --git a/services/shippable/shippable.service.js b/services/shippable/shippable.service.js index 6d81d15e2e964..25520ea9b43f5 100644 --- a/services/shippable/shippable.service.js +++ b/services/shippable/shippable.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderBuildStatusBadge } = require('../build-status') -const { BaseJsonService, NotFound, redirector } = require('..') +import Joi from 'joi'; +import {renderBuildStatusBadge} from '../build-status.js'; +import {BaseJsonService, NotFound, redirector} from '..'; // source: https://github.com/badges/shields/pull/1362#discussion_r161693830 const statusCodes = { @@ -79,4 +77,4 @@ const ShippableRedirect = redirector({ dateAdded: new Date('2020-07-18'), }) -module.exports = { Shippable, ShippableRedirect } +export default { Shippable, ShippableRedirect }; diff --git a/services/shippable/shippable.tester.js b/services/shippable/shippable.tester.js index 0290b2bd24b3a..17c8e728bec80 100644 --- a/services/shippable/shippable.tester.js +++ b/services/shippable/shippable.tester.js @@ -1,12 +1,8 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'Shippable', - title: 'Shippable', - pathPrefix: '/shippable', -})) +import {isBuildStatus} from '../build-status.js'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) t.create('build status (valid)') .get('/5444c5ecb904a4b21567b0ff/master.json') diff --git a/services/snap-ci/snap-ci.service.js b/services/snap-ci/snap-ci.service.js index 4b3cf224dc325..4fb1f1cb38fa7 100644 --- a/services/snap-ci/snap-ci.service.js +++ b/services/snap-ci/snap-ci.service.js @@ -1,6 +1,4 @@ -'use strict' - -const { deprecatedService } = require('..') +import {deprecatedService} from '..'; const commonAttrs = { category: 'build', @@ -8,7 +6,7 @@ const commonAttrs = { dateAdded: new Date('2018-01-23'), } -module.exports = [ +export default [ deprecatedService({ route: { base: 'snap', @@ -23,4 +21,4 @@ module.exports = [ }, ...commonAttrs, }), -] +]; diff --git a/services/snap-ci/snap-ci.tester.js b/services/snap-ci/snap-ci.tester.js index fb9659ee3e17b..e114c565af024 100644 --- a/services/snap-ci/snap-ci.tester.js +++ b/services/snap-ci/snap-ci.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { ServiceTester } = require('../tester') +import {ServiceTester} from '../tester.js'; const t = new ServiceTester({ id: 'snap-ci', title: 'Snap CI' }) -module.exports = t +export default t; t.create('no longer available (previously build state)') .get('/snap-ci/ThoughtWorksStudios/eb_deployer/master.json') diff --git a/services/snyk/snyk-test-helpers.js b/services/snyk/snyk-test-helpers.js index 3fea094774e10..cc81366e7e759 100644 --- a/services/snyk/snyk-test-helpers.js +++ b/services/snyk/snyk-test-helpers.js @@ -1,11 +1,9 @@ -'use strict' - const zeroVulnerabilitiesSvg = 'vulnerabilitiesvulnerabilities00' const twoVulnerabilitiesSvg = 'vulnerabilitiesvulnerabilities22' -module.exports = { +export default { zeroVulnerabilitiesSvg, twoVulnerabilitiesSvg, -} +}; diff --git a/services/snyk/snyk-vulnerability-base.js b/services/snyk/snyk-vulnerability-base.js index 4263c32b97034..f8a29afc3523d 100644 --- a/services/snyk/snyk-vulnerability-base.js +++ b/services/snyk/snyk-vulnerability-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseSvgScrapingService } = require('..') +import Joi from 'joi'; +import {BaseSvgScrapingService} from '..'; const schema = Joi.object({ message: Joi.alternatives() @@ -9,7 +7,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class SnykVulnerabilityBase extends BaseSvgScrapingService { +export default class SnykVulnerabilityBase extends BaseSvgScrapingService { static category = 'analysis' static defaultBadgeData = { @@ -39,4 +37,4 @@ module.exports = class SnykVulnerabilityBase extends BaseSvgScrapingService { return { vulnerabilities } } -} +}; diff --git a/services/snyk/snyk-vulnerability-github.service.js b/services/snyk/snyk-vulnerability-github.service.js index 445004f5ff1fb..cb1171c6e1fd1 100644 --- a/services/snyk/snyk-vulnerability-github.service.js +++ b/services/snyk/snyk-vulnerability-github.service.js @@ -1,8 +1,6 @@ -'use strict' +import SynkVulnerabilityBase from './snyk-vulnerability-base.js'; -const SynkVulnerabilityBase = require('./snyk-vulnerability-base') - -module.exports = class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { +export default class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { static route = { base: 'snyk/vulnerabilities/github', pattern: ':user/:repo/:manifestFilePath*', @@ -48,4 +46,4 @@ module.exports = class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { }) return this.constructor.render({ vulnerabilities }) } -} +}; diff --git a/services/snyk/snyk-vulnerability-github.tester.js b/services/snyk/snyk-vulnerability-github.tester.js index 32326e9d313e5..96cee3c27358a 100644 --- a/services/snyk/snyk-vulnerability-github.tester.js +++ b/services/snyk/snyk-vulnerability-github.tester.js @@ -1,11 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { - twoVulnerabilitiesSvg, - zeroVulnerabilitiesSvg, -} = require('./snyk-test-helpers') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; t.create('valid repo').get('/snyk/snyk.json').timeout(20000).expectBadge({ label: 'vulnerabilities', diff --git a/services/snyk/snyk-vulnerability-npm.service.js b/services/snyk/snyk-vulnerability-npm.service.js index 2cbda0c68306f..45aefa3b96134 100644 --- a/services/snyk/snyk-vulnerability-npm.service.js +++ b/services/snyk/snyk-vulnerability-npm.service.js @@ -1,9 +1,7 @@ -'use strict' +import {NotFound} from '..'; +import SynkVulnerabilityBase from './snyk-vulnerability-base.js'; -const { NotFound } = require('..') -const SynkVulnerabilityBase = require('./snyk-vulnerability-base') - -module.exports = class SnykVulnerabilityNpm extends SynkVulnerabilityBase { +export default class SnykVulnerabilityNpm extends SynkVulnerabilityBase { static route = { base: 'snyk/vulnerabilities/npm', pattern: ':packageName(.+?)', @@ -59,4 +57,4 @@ module.exports = class SnykVulnerabilityNpm extends SynkVulnerabilityBase { }) } } -} +}; diff --git a/services/snyk/snyk-vulnerability-npm.tester.js b/services/snyk/snyk-vulnerability-npm.tester.js index 859eaacfe82e1..a9e1ec94b2ad7 100644 --- a/services/snyk/snyk-vulnerability-npm.tester.js +++ b/services/snyk/snyk-vulnerability-npm.tester.js @@ -1,11 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { - twoVulnerabilitiesSvg, - zeroVulnerabilitiesSvg, -} = require('./snyk-test-helpers') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; t.create('valid package latest version') .get('/commander.json') diff --git a/services/sonar/sonar-base.js b/services/sonar/sonar-base.js index 588be428ce2c8..a0a476d33dd6c 100644 --- a/services/sonar/sonar-base.js +++ b/services/sonar/sonar-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, NotFound } = require('..') -const { isLegacyVersion } = require('./sonar-helpers') +import Joi from 'joi'; +import {BaseJsonService, NotFound} from '..'; +import {isLegacyVersion} from './sonar-helpers.js'; // It is possible to see HTTP 404 response codes and HTTP 200 responses // with empty arrays of metric values, with both the legacy (pre v5.3) and modern APIs. @@ -51,7 +49,7 @@ const legacySchema = Joi.array() ) .required() -module.exports = class SonarBase extends BaseJsonService { +export default class SonarBase extends BaseJsonService { static auth = { userKey: 'sonarqube_token', serviceKey: 'sonar' } async fetch({ sonarVersion, server, component, metricName }) { @@ -116,4 +114,4 @@ module.exports = class SonarBase extends BaseJsonService { return metrics } -} +}; diff --git a/services/sonar/sonar-coverage.service.js b/services/sonar/sonar-coverage.service.js index df4edeb9bc18f..afaa09db3d410 100644 --- a/services/sonar/sonar-coverage.service.js +++ b/services/sonar/sonar-coverage.service.js @@ -1,10 +1,8 @@ -'use strict' +import {coveragePercentage} from '../color-formatters.js'; +import SonarBase from './sonar-base.js'; +import {documentation, keywords, queryParamSchema} from './sonar-helpers.js'; -const { coveragePercentage } = require('../color-formatters') -const SonarBase = require('./sonar-base') -const { documentation, keywords, queryParamSchema } = require('./sonar-helpers') - -module.exports = class SonarCoverage extends SonarBase { +export default class SonarCoverage extends SonarBase { static category = 'coverage' static route = { @@ -51,4 +49,4 @@ module.exports = class SonarCoverage extends SonarBase { }) return this.constructor.render({ coverage }) } -} +}; diff --git a/services/sonar/sonar-coverage.tester.js b/services/sonar/sonar-coverage.tester.js index feb31425c22fe..811505bf04b52 100644 --- a/services/sonar/sonar-coverage.tester.js +++ b/services/sonar/sonar-coverage.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isIntegerPercentage } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isIntegerPercentage} from '../test-validators.js'; // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-documented-api-density.service.js b/services/sonar/sonar-documented-api-density.service.js index 684152f5d654f..3909b649f2a02 100644 --- a/services/sonar/sonar-documented-api-density.service.js +++ b/services/sonar/sonar-documented-api-density.service.js @@ -1,17 +1,9 @@ -'use strict' - -const SonarBase = require('./sonar-base') -const { - queryParamSchema, - getLabel, - positiveMetricColorScale, - keywords, - documentation, -} = require('./sonar-helpers') +import SonarBase from './sonar-base.js'; +import {queryParamSchema, getLabel, positiveMetricColorScale, keywords, documentation} from './sonar-helpers.js'; const metric = 'public_documented_api_density' -module.exports = class SonarDocumentedApiDensity extends SonarBase { +export default class SonarDocumentedApiDensity extends SonarBase { static category = 'analysis' static route = { @@ -55,4 +47,4 @@ module.exports = class SonarDocumentedApiDensity extends SonarBase { const metrics = this.transform({ json, sonarVersion }) return this.constructor.render({ density: metrics[metric] }) } -} +}; diff --git a/services/sonar/sonar-documented-api-density.spec.js b/services/sonar/sonar-documented-api-density.spec.js index f2dc4821d2101..5ac2d5de021a8 100644 --- a/services/sonar/sonar-documented-api-density.spec.js +++ b/services/sonar/sonar-documented-api-density.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const SonarDocumentedApiDensity = require('./sonar-documented-api-density.service') +import {test, given} from 'sazerac'; +import SonarDocumentedApiDensity from './sonar-documented-api-density.service.js'; describe('SonarDocumentedApiDensity', function () { test(SonarDocumentedApiDensity.render, () => { diff --git a/services/sonar/sonar-documented-api-density.tester.js b/services/sonar/sonar-documented-api-density.tester.js index b879d6f5b10b0..7c6c2d90b38ad 100644 --- a/services/sonar/sonar-documented-api-density.tester.js +++ b/services/sonar/sonar-documented-api-density.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-fortify-rating.service.js b/services/sonar/sonar-fortify-rating.service.js index 74cf396fb24ec..90ce35f53e2c4 100644 --- a/services/sonar/sonar-fortify-rating.service.js +++ b/services/sonar/sonar-fortify-rating.service.js @@ -1,7 +1,5 @@ -'use strict' - -const SonarBase = require('./sonar-base') -const { queryParamSchema, keywords, documentation } = require('./sonar-helpers') +import SonarBase from './sonar-base.js'; +import {queryParamSchema, keywords, documentation} from './sonar-helpers.js'; const colorMap = { 0: 'red', @@ -12,7 +10,7 @@ const colorMap = { 5: 'brightgreen', } -module.exports = class SonarFortifyRating extends SonarBase { +export default class SonarFortifyRating extends SonarBase { static category = 'analysis' static route = { @@ -65,4 +63,4 @@ module.exports = class SonarFortifyRating extends SonarBase { rating: metrics['fortify-security-rating'], }) } -} +}; diff --git a/services/sonar/sonar-fortify-rating.spec.js b/services/sonar/sonar-fortify-rating.spec.js index 2121c484f55a0..95aeb688da751 100644 --- a/services/sonar/sonar-fortify-rating.spec.js +++ b/services/sonar/sonar-fortify-rating.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const SonarFortifyRating = require('./sonar-fortify-rating.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import SonarFortifyRating from './sonar-fortify-rating.service.js'; const token = 'abc123def456' const config = { diff --git a/services/sonar/sonar-fortify-rating.tester.js b/services/sonar/sonar-fortify-rating.tester.js index 760ba28d09f59..a9a5fceb6fbb3 100644 --- a/services/sonar/sonar-fortify-rating.tester.js +++ b/services/sonar/sonar-fortify-rating.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-generic.service.js b/services/sonar/sonar-generic.service.js index 6b8498675497d..4b8f32f4b4af5 100644 --- a/services/sonar/sonar-generic.service.js +++ b/services/sonar/sonar-generic.service.js @@ -1,8 +1,6 @@ -'use strict' - -const { metric } = require('../text-formatters') -const SonarBase = require('./sonar-base') -const { queryParamSchema, getLabel } = require('./sonar-helpers') +import {metric} from '../text-formatters.js'; +import SonarBase from './sonar-base.js'; +import {queryParamSchema, getLabel} from './sonar-helpers.js'; // This service is intended to be a temporary solution to avoid breaking // any existing users/badges that were utilizing the "other" Sonar metrics @@ -106,7 +104,7 @@ const metricNames = [ ] const metricNameRouteParam = metricNames.join('|') -module.exports = class SonarGeneric extends SonarBase { +export default class SonarGeneric extends SonarBase { static category = 'analysis' static route = { @@ -139,4 +137,4 @@ module.exports = class SonarGeneric extends SonarBase { metricValue: metrics[metricName], }) } -} +}; diff --git a/services/sonar/sonar-generic.tester.js b/services/sonar/sonar-generic.tester.js index 3d5bfffd52834..377d1dff07395 100644 --- a/services/sonar/sonar-generic.tester.js +++ b/services/sonar/sonar-generic.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Security Rating') .timeout(10000) diff --git a/services/sonar/sonar-helpers.js b/services/sonar/sonar-helpers.js index e5764304ead5c..cf96edb0b309a 100644 --- a/services/sonar/sonar-helpers.js +++ b/services/sonar/sonar-helpers.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { colorScale } = require('../color-formatters') -const { optionalUrl } = require('../validators') +import Joi from 'joi'; +import {colorScale} from '../color-formatters.js'; +import {optionalUrl} from '../validators.js'; const ratingPercentageScaleSteps = [10, 20, 50, 100] const ratingScaleColors = [ @@ -28,7 +26,7 @@ function isLegacyVersion({ sonarVersion }) { } function getLabel({ metric }) { - return metric ? metric.replace(/_/g, ' ') : undefined + return metric ? metric.replace(/_/g, ' ') : undefined; } const sonarVersionSchema = Joi.alternatives( Joi.string() @@ -60,7 +58,7 @@ const documentation = `

{ diff --git a/services/sonar/sonar-quality-gate.tester.js b/services/sonar/sonar-quality-gate.tester.js index 518ce9451ba18..cf2e3834f7929 100644 --- a/services/sonar/sonar-quality-gate.tester.js +++ b/services/sonar/sonar-quality-gate.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isQualityGateStatus = Joi.allow('passed', 'failed') diff --git a/services/sonar/sonar-redirector.service.js b/services/sonar/sonar-redirector.service.js index 8698721eb9e0a..3153796eb3f8d 100644 --- a/services/sonar/sonar-redirector.service.js +++ b/services/sonar/sonar-redirector.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ name: 'SonarVersionPrefixRedirector', category: 'analysis', @@ -32,4 +30,4 @@ module.exports = [ }), dateAdded: new Date('2019-07-05'), }), -] +]; diff --git a/services/sonar/sonar-redirector.tester.js b/services/sonar/sonar-redirector.tester.js index 7d80d667d5e2e..027a86d00b533 100644 --- a/services/sonar/sonar-redirector.tester.js +++ b/services/sonar/sonar-redirector.tester.js @@ -1,13 +1,9 @@ -'use strict' +import queryString from 'querystring'; +import {ServiceTester} from '../tester.js'; -const queryString = require('querystring') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'SonarRedirect', - title: 'SonarRedirect', - pathPrefix: '/sonar', -})) +const t = (function() { + export default __a; +}()) t.create('sonar version') .get( diff --git a/services/sonar/sonar-tech-debt.service.js b/services/sonar/sonar-tech-debt.service.js index a54952cbb0800..9655eb9716c18 100644 --- a/services/sonar/sonar-tech-debt.service.js +++ b/services/sonar/sonar-tech-debt.service.js @@ -1,15 +1,7 @@ -'use strict' +import SonarBase from './sonar-base.js'; +import {negativeMetricColorScale, getLabel, documentation, keywords, queryParamSchema} from './sonar-helpers.js'; -const SonarBase = require('./sonar-base') -const { - negativeMetricColorScale, - getLabel, - documentation, - keywords, - queryParamSchema, -} = require('./sonar-helpers') - -module.exports = class SonarTechDebt extends SonarBase { +export default class SonarTechDebt extends SonarBase { static category = 'analysis' static route = { @@ -59,4 +51,4 @@ module.exports = class SonarTechDebt extends SonarBase { const { sqale_debt_ratio: debt } = this.transform({ json, sonarVersion }) return this.constructor.render({ debt, metric }) } -} +}; diff --git a/services/sonar/sonar-tech-debt.spec.js b/services/sonar/sonar-tech-debt.spec.js index b5c8678e6226a..f56c22053a257 100644 --- a/services/sonar/sonar-tech-debt.spec.js +++ b/services/sonar/sonar-tech-debt.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const SonarTechDebt = require('./sonar-tech-debt.service') +import {test, given} from 'sazerac'; +import SonarTechDebt from './sonar-tech-debt.service.js'; describe('SonarTechDebt', function () { test(SonarTechDebt.render, () => { diff --git a/services/sonar/sonar-tech-debt.tester.js b/services/sonar/sonar-tech-debt.tester.js index 651bc43c8ea23..517f3c8c86f95 100644 --- a/services/sonar/sonar-tech-debt.tester.js +++ b/services/sonar/sonar-tech-debt.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-tests.service.js b/services/sonar/sonar-tests.service.js index 67d1226037105..c0383b6a326f7 100644 --- a/services/sonar/sonar-tests.service.js +++ b/services/sonar/sonar-tests.service.js @@ -1,18 +1,7 @@ -'use strict' - -const { - testResultQueryParamSchema, - renderTestResultBadge, - documentation: testResultsDocumentation, -} = require('../test-results') -const { metric: metricCount } = require('../text-formatters') -const SonarBase = require('./sonar-base') -const { - documentation, - keywords, - queryParamSchema, - getLabel, -} = require('./sonar-helpers') +import {testResultQueryParamSchema, renderTestResultBadge, documentation as testResultsDocumentation} from '../test-results.js'; +import {metric as metricCount} from '../text-formatters.js'; +import SonarBase from './sonar-base.js'; +import {documentation, keywords, queryParamSchema, getLabel} from './sonar-helpers.js'; class SonarTestsSummary extends SonarBase { static category = 'build' @@ -241,4 +230,4 @@ class SonarTests extends SonarBase { } } -module.exports = [SonarTestsSummary, SonarTests] +export default [SonarTestsSummary, SonarTests]; diff --git a/services/sonar/sonar-tests.spec.js b/services/sonar/sonar-tests.spec.js index f16dc6137a332..26635f7b75f73 100644 --- a/services/sonar/sonar-tests.spec.js +++ b/services/sonar/sonar-tests.spec.js @@ -1,6 +1,4 @@ -'use strict' - -const { test, given } = require('sazerac') +import {test, given} from 'sazerac'; const SonarTests = require('./sonar-tests.service')[1] describe('SonarTests', function () { diff --git a/services/sonar/sonar-tests.tester.js b/services/sonar/sonar-tests.tester.js index 2b66bd9296f27..8e8fabfb04ddc 100644 --- a/services/sonar/sonar-tests.tester.js +++ b/services/sonar/sonar-tests.tester.js @@ -1,19 +1,9 @@ -'use strict' - -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const t = (module.exports = new ServiceTester({ - id: 'SonarTests', - title: 'SonarTests', - pathPrefix: '/sonar', -})) -const { - isDefaultTestTotals, - isDefaultCompactTestTotals, - isCustomTestTotals, - isCustomCompactTestTotals, -} = require('../test-validators') -const { isIntegerPercentage, isMetric } = require('../test-validators') +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +const t = (function() { + export default __a; +}()) +import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals, isIntegerPercentage, isMetric} from '../test-validators.js'; const isMetricAllowZero = Joi.alternatives( isMetric, Joi.number().valid(0).required() diff --git a/services/sonar/sonar-violations.service.js b/services/sonar/sonar-violations.service.js index 54de34b9bf5b6..52263ea87d2e0 100644 --- a/services/sonar/sonar-violations.service.js +++ b/services/sonar/sonar-violations.service.js @@ -1,14 +1,7 @@ -'use strict' - -const { colorScale } = require('../color-formatters') -const { metric } = require('../text-formatters') -const SonarBase = require('./sonar-base') -const { - getLabel, - documentation, - keywords, - queryParamWithFormatSchema, -} = require('./sonar-helpers') +import {colorScale} from '../color-formatters.js'; +import {metric} from '../text-formatters.js'; +import SonarBase from './sonar-base.js'; +import {getLabel, documentation, keywords, queryParamWithFormatSchema} from './sonar-helpers.js'; const violationsColorScale = colorScale( [1, 2, 3, 5], @@ -23,7 +16,7 @@ const violationCategoryColorMap = { info_violations: 'green', } -module.exports = class SonarViolations extends SonarBase { +export default class SonarViolations extends SonarBase { static category = 'analysis' static route = { @@ -169,4 +162,4 @@ module.exports = class SonarViolations extends SonarBase { }) return this.constructor.render({ violations, metricName: metric, format }) } -} +}; diff --git a/services/sonar/sonar-violations.spec.js b/services/sonar/sonar-violations.spec.js index 3509ac0fd33bc..9f8e4b90cc13d 100644 --- a/services/sonar/sonar-violations.spec.js +++ b/services/sonar/sonar-violations.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { test, given } = require('sazerac') -const { metric } = require('../text-formatters') -const SonarViolations = require('./sonar-violations.service') +import {test, given} from 'sazerac'; +import {metric} from '../text-formatters.js'; +import SonarViolations from './sonar-violations.service.js'; describe('SonarViolations', function () { test(SonarViolations.render, () => { diff --git a/services/sonar/sonar-violations.tester.js b/services/sonar/sonar-violations.tester.js index f5c8095c2e35e..5a13c9bd75a37 100644 --- a/services/sonar/sonar-violations.tester.js +++ b/services/sonar/sonar-violations.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isMetric, withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isMetric, withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const isViolationsLongFormMetric = Joi.alternatives( Joi.allow(0), withRegex( diff --git a/services/sourceforge/sourceforge-open-tickets.service.js b/services/sourceforge/sourceforge-open-tickets.service.js index 6ad2cb4cee231..9e6f500ac722e 100644 --- a/services/sourceforge/sourceforge-open-tickets.service.js +++ b/services/sourceforge/sourceforge-open-tickets.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ count: nonNegativeInteger.required(), }).required() -module.exports = class SourceforgeOpenTickets extends BaseJsonService { +export default class SourceforgeOpenTickets extends BaseJsonService { static category = 'other' static route = { @@ -55,4 +53,4 @@ module.exports = class SourceforgeOpenTickets extends BaseJsonService { const { count } = await this.fetch({ type, project }) return this.constructor.render({ count }) } -} +}; diff --git a/services/sourceforge/sourceforge-open-tickets.tester.js b/services/sourceforge/sourceforge-open-tickets.tester.js index 807a6c38e8bc3..ff62d9225ae7a 100644 --- a/services/sourceforge/sourceforge-open-tickets.tester.js +++ b/services/sourceforge/sourceforge-open-tickets.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('bugs') .get('/sevenzip/bugs.json') diff --git a/services/sourceforge/sourceforge.service.js b/services/sourceforge/sourceforge.service.js index 674337c728705..831ae582fe579 100644 --- a/services/sourceforge/sourceforge.service.js +++ b/services/sourceforge/sourceforge.service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const moment = require('moment') -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import moment from 'moment'; +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ total: nonNegativeInteger, @@ -31,7 +29,7 @@ const intervalMap = { }, } -module.exports = class Sourceforge extends BaseJsonService { +export default class Sourceforge extends BaseJsonService { static category = 'downloads' static route = { @@ -105,4 +103,4 @@ module.exports = class Sourceforge extends BaseJsonService { const json = await this.fetch({ interval, project, folder }) return this.constructor.render({ interval, downloads: json.total }) } -} +}; diff --git a/services/sourceforge/sourceforge.tester.js b/services/sourceforge/sourceforge.tester.js index 6ccd13192dc9a..225d09d54d5bd 100644 --- a/services/sourceforge/sourceforge.tester.js +++ b/services/sourceforge/sourceforge.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric, isMetricOverTimePeriod } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('total downloads').get('/dt/sevenzip.json').expectBadge({ label: 'downloads', diff --git a/services/sourcegraph/sourcegraph.service.js b/services/sourcegraph/sourcegraph.service.js index d2a218672d237..e49a6eb0230fe 100644 --- a/services/sourcegraph/sourcegraph.service.js +++ b/services/sourcegraph/sourcegraph.service.js @@ -1,14 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const projectsCountRegex = /^\s[0-9]*(\.[0-9]k)?\sprojects$/ const schema = Joi.object({ value: Joi.string().regex(projectsCountRegex).required(), }).required() -module.exports = class Sourcegraph extends BaseJsonService { +export default class Sourcegraph extends BaseJsonService { static category = 'other' static route = { @@ -43,4 +41,4 @@ module.exports = class Sourcegraph extends BaseJsonService { }) return this.constructor.render({ projectsCount: json.value.trim() }) } -} +}; diff --git a/services/sourcegraph/sourcegraph.tester.js b/services/sourcegraph/sourcegraph.tester.js index 1f4bd9a2ee6c4..d6c326ce45976 100644 --- a/services/sourcegraph/sourcegraph.tester.js +++ b/services/sourcegraph/sourcegraph.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) // Matches API responses such as "0 projects", "1 projects", "182 projects", "14.0k projects". // There may be other cases not covered by this regex, but hopefully the tested projects won't vary much. diff --git a/services/spack/spack.service.js b/services/spack/spack.service.js index fd0ead60d6641..847710266ee3a 100644 --- a/services/spack/spack.service.js +++ b/services/spack/spack.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('..//version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '..//version.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ latest_version: Joi.string().required(), }).required() -module.exports = class SpackVersion extends BaseJsonService { +export default class SpackVersion extends BaseJsonService { static category = 'version' static route = { @@ -45,4 +43,4 @@ module.exports = class SpackVersion extends BaseJsonService { const pkg = await this.fetch({ packageName }) return this.constructor.render({ version: pkg.latest_version }) } -} +}; diff --git a/services/spack/spack.tester.js b/services/spack/spack.tester.js index f72dd327272cb..29c3ea1cc8277 100644 --- a/services/spack/spack.tester.js +++ b/services/spack/spack.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('version (valid)').get('/adios2.json').expectBadge({ label: 'spack', diff --git a/services/spiget/spiget-base.js b/services/spiget/spiget-base.js index 9a434fe40b7d2..6e021ffcd6092 100644 --- a/services/spiget/spiget-base.js +++ b/services/spiget/spiget-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const resourceSchema = Joi.object({ downloads: Joi.number().required(), @@ -36,4 +34,4 @@ class BaseSpigetService extends BaseJsonService { } } -module.exports = { keywords, documentation, BaseSpigetService } +export default { keywords, documentation, BaseSpigetService }; diff --git a/services/spiget/spiget-download-size.service.js b/services/spiget/spiget-download-size.service.js index 9f8c34fdff735..b46281e51fbea 100644 --- a/services/spiget/spiget-download-size.service.js +++ b/services/spiget/spiget-download-size.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; -const { BaseSpigetService, documentation, keywords } = require('./spiget-base') - -module.exports = class SpigetDownloadSize extends BaseSpigetService { +export default class SpigetDownloadSize extends BaseSpigetService { static category = 'size' static route = { @@ -47,4 +45,4 @@ module.exports = class SpigetDownloadSize extends BaseSpigetService { type: file.type, }) } -} +}; diff --git a/services/spiget/spiget-download-size.tester.js b/services/spiget/spiget-download-size.tester.js index debdca96683c0..a431ddf8b7972 100644 --- a/services/spiget/spiget-download-size.tester.js +++ b/services/spiget/spiget-download-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFileSize } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFileSize} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('EssentialsX (id 9089)') .get('/9089.json') diff --git a/services/spiget/spiget-downloads.service.js b/services/spiget/spiget-downloads.service.js index 379e8fbe59877..ee863607c0d83 100644 --- a/services/spiget/spiget-downloads.service.js +++ b/services/spiget/spiget-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { BaseSpigetService, documentation, keywords } = require('./spiget-base') - -module.exports = class SpigetDownloads extends BaseSpigetService { +export default class SpigetDownloads extends BaseSpigetService { static category = 'downloads' static route = { @@ -39,4 +37,4 @@ module.exports = class SpigetDownloads extends BaseSpigetService { const { downloads } = await this.fetch({ resourceId }) return this.constructor.render({ downloads }) } -} +}; diff --git a/services/spiget/spiget-downloads.tester.js b/services/spiget/spiget-downloads.tester.js index e24e7f5d9f75d..f78ff409d9846 100644 --- a/services/spiget/spiget-downloads.tester.js +++ b/services/spiget/spiget-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('EssentialsX (id 9089)').get('/9089.json').expectBadge({ label: 'downloads', diff --git a/services/spiget/spiget-latest-version.service.js b/services/spiget/spiget-latest-version.service.js index 87dfbd75a5109..668e38cac870a 100644 --- a/services/spiget/spiget-latest-version.service.js +++ b/services/spiget/spiget-latest-version.service.js @@ -1,15 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseSpigetService, documentation, keywords } = require('./spiget-base') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; const versionSchema = Joi.object({ downloads: Joi.number().required(), name: Joi.string().required(), }).required() -module.exports = class SpigetLatestVersion extends BaseSpigetService { +export default class SpigetLatestVersion extends BaseSpigetService { static category = 'version' static route = { @@ -42,4 +40,4 @@ module.exports = class SpigetLatestVersion extends BaseSpigetService { }) return renderVersionBadge({ version: name }) } -} +}; diff --git a/services/spiget/spiget-latest-version.tester.js b/services/spiget/spiget-latest-version.tester.js index a14abc1aaabb7..e9e34723e41c6 100644 --- a/services/spiget/spiget-latest-version.tester.js +++ b/services/spiget/spiget-latest-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) // Note that Spigot versions can be anything (including just a string), so we'll make sure it's not returning 'not found' diff --git a/services/spiget/spiget-rating.service.js b/services/spiget/spiget-rating.service.js index 1a2962e39fb2a..8cfce768b7671 100644 --- a/services/spiget/spiget-rating.service.js +++ b/services/spiget/spiget-rating.service.js @@ -1,10 +1,8 @@ -'use strict' +import {starRating, metric} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; -const { starRating, metric } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const { BaseSpigetService, documentation, keywords } = require('./spiget-base') - -module.exports = class SpigetRatings extends BaseSpigetService { +export default class SpigetRatings extends BaseSpigetService { static category = 'rating' static route = { @@ -61,4 +59,4 @@ module.exports = class SpigetRatings extends BaseSpigetService { average: rating.average.toFixed(2), }) } -} +}; diff --git a/services/spiget/spiget-rating.tester.js b/services/spiget/spiget-rating.tester.js index efe5a6b52dd81..4514b4807f2f8 100644 --- a/services/spiget/spiget-rating.tester.js +++ b/services/spiget/spiget-rating.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isStarRating, withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isStarRating, withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Stars - EssentialsX (id 9089)').get('/stars/9089.json').expectBadge({ label: 'rating', diff --git a/services/spiget/spiget-tested-versions.service.js b/services/spiget/spiget-tested-versions.service.js index dbab624030926..9c2c630c7fc2c 100644 --- a/services/spiget/spiget-tested-versions.service.js +++ b/services/spiget/spiget-tested-versions.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; -const { BaseSpigetService, documentation, keywords } = require('./spiget-base') - -module.exports = class SpigetTestedVersions extends BaseSpigetService { +export default class SpigetTestedVersions extends BaseSpigetService { static category = 'platform-support' static route = { @@ -50,4 +48,4 @@ module.exports = class SpigetTestedVersions extends BaseSpigetService { const { versions } = this.transform({ testedVersions }) return this.constructor.render({ versions }) } -} +}; diff --git a/services/spiget/spiget-tested-versions.tester.js b/services/spiget/spiget-tested-versions.tester.js index 8ab77790e4664..eefe451c44b84 100644 --- a/services/spiget/spiget-tested-versions.tester.js +++ b/services/spiget/spiget-tested-versions.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const multipleVersions = withRegex(/^([+]?\d*\.\d+)(-)([+]?\d*\.\d+)$/) diff --git a/services/stackexchange/stackexchange-helpers.js b/services/stackexchange/stackexchange-helpers.js index edb85404beeef..f2ac9fad70f19 100644 --- a/services/stackexchange/stackexchange-helpers.js +++ b/services/stackexchange/stackexchange-helpers.js @@ -1,9 +1,7 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; -const { metric } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') - -module.exports = function renderQuestionsBadge({ +export default function renderQuestionsBadge({ suffix, stackexchangesite, query, @@ -15,4 +13,4 @@ module.exports = function renderQuestionsBadge({ message: `${metric(numValue)}${suffix}`, color: floorCountColor(numValue, 1000, 10000, 20000), } -} +}; diff --git a/services/stackexchange/stackexchange-monthlyquestions.service.js b/services/stackexchange/stackexchange-monthlyquestions.service.js index 02e2f9f9c0599..57f5c18c67e15 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.service.js +++ b/services/stackexchange/stackexchange-monthlyquestions.service.js @@ -1,16 +1,14 @@ -'use strict' - -const moment = require('moment') -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') -const renderQuestionsBadge = require('./stackexchange-helpers') +import moment from 'moment'; +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; +import renderQuestionsBadge from './stackexchange-helpers.js'; const tagSchema = Joi.object({ total: nonNegativeInteger, }).required() -module.exports = class StackExchangeMonthlyQuestions extends BaseJsonService { +export default class StackExchangeMonthlyQuestions extends BaseJsonService { static category = 'chat' static route = { @@ -76,4 +74,4 @@ module.exports = class StackExchangeMonthlyQuestions extends BaseJsonService { numValue, }) } -} +}; diff --git a/services/stackexchange/stackexchange-monthlyquestions.tester.js b/services/stackexchange/stackexchange-monthlyquestions.tester.js index 88f8b16622c31..725ee9328c0e0 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.tester.js +++ b/services/stackexchange/stackexchange-monthlyquestions.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetricOverTimePeriod } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetricOverTimePeriod} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Monthly Questions for StackOverflow Momentjs') .get('/stackoverflow/qm/momentjs.json') diff --git a/services/stackexchange/stackexchange-reputation.service.js b/services/stackexchange/stackexchange-reputation.service.js index fb0989b412f08..56505ed7d1a92 100644 --- a/services/stackexchange/stackexchange-reputation.service.js +++ b/services/stackexchange/stackexchange-reputation.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const reputationSchema = Joi.object({ items: Joi.array() @@ -16,7 +14,7 @@ const reputationSchema = Joi.object({ .required(), }).required() -module.exports = class StackExchangeReputation extends BaseJsonService { +export default class StackExchangeReputation extends BaseJsonService { static category = 'chat' static route = { @@ -69,4 +67,4 @@ module.exports = class StackExchangeReputation extends BaseJsonService { numValue, }) } -} +}; diff --git a/services/stackexchange/stackexchange-reputation.tester.js b/services/stackexchange/stackexchange-reputation.tester.js index b6e3b4a7d4cff..fa0f613bd9dc8 100644 --- a/services/stackexchange/stackexchange-reputation.tester.js +++ b/services/stackexchange/stackexchange-reputation.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('Invalid parameters') .get('/stackoverflow/r/invalidimage.json') diff --git a/services/stackexchange/stackexchange-taginfo.service.js b/services/stackexchange/stackexchange-taginfo.service.js index 72d6377d31ab3..8e577742f0f41 100644 --- a/services/stackexchange/stackexchange-taginfo.service.js +++ b/services/stackexchange/stackexchange-taginfo.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const renderQuestionsBadge = require('./stackexchange-helpers') +import Joi from 'joi'; +import {BaseJsonService} from '..'; +import renderQuestionsBadge from './stackexchange-helpers.js'; const tagSchema = Joi.object({ items: Joi.array() @@ -15,7 +13,7 @@ const tagSchema = Joi.object({ .required(), }).required() -module.exports = class StackExchangeQuestions extends BaseJsonService { +export default class StackExchangeQuestions extends BaseJsonService { static category = 'chat' static route = { @@ -64,4 +62,4 @@ module.exports = class StackExchangeQuestions extends BaseJsonService { numValue, }) } -} +}; diff --git a/services/stackexchange/stackexchange-taginfo.tester.js b/services/stackexchange/stackexchange-taginfo.tester.js index e80b518ce3a0c..bfc3fe676758d 100644 --- a/services/stackexchange/stackexchange-taginfo.tester.js +++ b/services/stackexchange/stackexchange-taginfo.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isMetric } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isMetric} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('JavaScript Questions') .get('/stackoverflow/t/javascript.json') diff --git a/services/static-badge/query-string-static.service.js b/services/static-badge/query-string-static.service.js index 65afeeaa995e3..dc5709b89b43e 100644 --- a/services/static-badge/query-string-static.service.js +++ b/services/static-badge/query-string-static.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const { BaseStaticService } = require('..') +import Joi from 'joi'; +import {BaseStaticService} from '..'; const queryParamSchema = Joi.object({ message: Joi.string().required(), }).required() -module.exports = class QueryStringStaticBadge extends BaseStaticService { +export default class QueryStringStaticBadge extends BaseStaticService { static category = 'static' static route = { @@ -21,4 +19,4 @@ module.exports = class QueryStringStaticBadge extends BaseStaticService { handle(namedParams, queryParams) { return { message: queryParams.message } } -} +}; diff --git a/services/static-badge/query-string-static.tester.js b/services/static-badge/query-string-static.tester.js index 2e1e7602a6bb8..e47251408b910 100644 --- a/services/static-badge/query-string-static.tester.js +++ b/services/static-badge/query-string-static.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('Missing message') .get('/static/v1.json?label=label&message=&color=blue') diff --git a/services/static-badge/static-badge.service.js b/services/static-badge/static-badge.service.js index 4ce76a780595e..93e1b40a9e0be 100644 --- a/services/static-badge/static-badge.service.js +++ b/services/static-badge/static-badge.service.js @@ -1,9 +1,7 @@ -'use strict' +import {escapeFormat} from '../../core/badge-urls/path-helpers.js'; +import {BaseStaticService} from '..'; -const { escapeFormat } = require('../../core/badge-urls/path-helpers') -const { BaseStaticService } = require('..') - -module.exports = class StaticBadge extends BaseStaticService { +export default class StaticBadge extends BaseStaticService { static category = 'static' static route = { @@ -15,4 +13,4 @@ module.exports = class StaticBadge extends BaseStaticService { handle({ label, message, color }) { return { label: escapeFormat(label), message: escapeFormat(message), color } } -} +}; diff --git a/services/static-badge/static-badge.tester.js b/services/static-badge/static-badge.tester.js index ccbeccc14f338..a6a3cb64c6762 100644 --- a/services/static-badge/static-badge.tester.js +++ b/services/static-badge/static-badge.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('Shields colorscheme color') .get('/badge/label-message-blue.json') diff --git a/services/steam/steam-base.js b/services/steam/steam-base.js index 4c2951c4c90f8..7230a11fd1285 100644 --- a/services/steam/steam-base.js +++ b/services/steam/steam-base.js @@ -1,9 +1,8 @@ -'use strict' /** * @module */ -const { BaseJsonService } = require('..') +import {BaseJsonService} from '..'; /** * The steam api is based like /{interface}/{method}/v{version}/ @@ -54,4 +53,4 @@ class BaseSteamAPI extends BaseJsonService { } } -module.exports = BaseSteamAPI +export default BaseSteamAPI; diff --git a/services/steam/steam-workshop.service.js b/services/steam/steam-workshop.service.js index cd10a7377385b..605221ac99543 100644 --- a/services/steam/steam-workshop.service.js +++ b/services/steam/steam-workshop.service.js @@ -1,11 +1,9 @@ -'use strict' - -const Joi = require('joi') -const prettyBytes = require('pretty-bytes') -const { metric, formatDate } = require('../text-formatters') -const { age: ageColor, downloadCount } = require('../color-formatters') -const { NotFound } = require('..') -const BaseSteamAPI = require('./steam-base') +import Joi from 'joi'; +import prettyBytes from 'pretty-bytes'; +import {metric, formatDate} from '../text-formatters.js'; +import {age as ageColor, downloadCount} from '../color-formatters.js'; +import {NotFound} from '..'; +import BaseSteamAPI from './steam-base.js'; const documentation = `

@@ -402,7 +400,7 @@ class SteamFileViews extends SteamFileService { } } -module.exports = { +export default { SteamCollectionSize, SteamFileSize, SteamFileReleaseDate, @@ -411,4 +409,4 @@ module.exports = { SteamFileFavorites, SteamFileDownloads, SteamFileViews, -} +}; diff --git a/services/steam/steam-workshop.tester.js b/services/steam/steam-workshop.tester.js index c2963e3828d39..e7a4730d43c9c 100644 --- a/services/steam/steam-workshop.tester.js +++ b/services/steam/steam-workshop.tester.js @@ -1,10 +1,8 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isMetric, isFileSize, isFormattedDate } = require('../test-validators') +import {ServiceTester} from '../tester.js'; +import {isMetric, isFileSize, isFormattedDate} from '../test-validators.js'; const t = new ServiceTester({ id: 'steam', title: 'Steam Workshop Tests' }) -module.exports = t +export default t; t.create('Collection Files') .get('/collection-files/180077636.json') diff --git a/services/suggest.integration.js b/services/suggest.integration.js index c000ebbb9c090..13f020efa0122 100644 --- a/services/suggest.integration.js +++ b/services/suggest.integration.js @@ -1,12 +1,10 @@ -'use strict' - -const { expect } = require('chai') -const Camp = require('@shields_io/camp') -const portfinder = require('portfinder') +import {expect} from 'chai'; +import Camp from '@shields_io/camp'; +import portfinder from 'portfinder'; const config = require('config').util.toObject() -const got = require('../core/got-test-client') -const { setRoutes } = require('./suggest') -const GithubApiProvider = require('./github/github-api-provider') +import got from '../core/got-test-client.js'; +import {setRoutes} from './suggest.js'; +import GithubApiProvider from './github/github-api-provider.js'; describe('Badge suggestions for', function () { const githubApiBaseUrl = process.env.GITHUB_URL || 'https://api.github.com' diff --git a/services/suggest.js b/services/suggest.js index 432c000001974..d563e73811923 100644 --- a/services/suggest.js +++ b/services/suggest.js @@ -4,10 +4,8 @@ // // This endpoint is called from frontend/components/suggestion-and-search.js. -'use strict' - -const { URL } = require('url') -const request = require('request') +import {URL} from 'url'; +import request from 'request'; function twitterPage(url) { if (url.protocol === null) { @@ -200,8 +198,8 @@ function setRoutes(allowedOrigin, githubApiProvider, server) { }) } -module.exports = { +export default { findSuggestions, githubLicense, setRoutes, -} +}; diff --git a/services/suggest.spec.js b/services/suggest.spec.js index 0288dc801a46e..03ceb01e3cbd4 100644 --- a/services/suggest.spec.js +++ b/services/suggest.spec.js @@ -1,12 +1,10 @@ -'use strict' - -const Camp = require('@shields_io/camp') -const { expect } = require('chai') -const nock = require('nock') -const portfinder = require('portfinder') -const got = require('../core/got-test-client') -const { setRoutes, githubLicense } = require('./suggest') -const GithubApiProvider = require('./github/github-api-provider') +import Camp from '@shields_io/camp'; +import {expect} from 'chai'; +import nock from 'nock'; +import portfinder from 'portfinder'; +import got from '../core/got-test-client.js'; +import {setRoutes, githubLicense} from './suggest.js'; +import GithubApiProvider from './github/github-api-provider.js'; describe('Badge suggestions', function () { const githubApiBaseUrl = 'https://api.github.test' diff --git a/services/swagger/swagger-redirect.service.js b/services/swagger/swagger-redirect.service.js index 954bd131b0365..b10109ff5a162 100644 --- a/services/swagger/swagger-redirect.service.js +++ b/services/swagger/swagger-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'other', name: 'SwaggerRedirect', @@ -17,4 +15,4 @@ module.exports = [ }, dateAdded: new Date('2019-11-03'), }), -] +]; diff --git a/services/swagger/swagger-redirect.tester.js b/services/swagger/swagger-redirect.tester.js index 3fec29b7d6a9d..19f5a386f5868 100644 --- a/services/swagger/swagger-redirect.tester.js +++ b/services/swagger/swagger-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'SwaggerUrlRedirect', - title: 'SwaggerUrlRedirect', - pathPrefix: '/swagger/valid/2.0', -})) +const t = (function() { + export default __a; +}()) t.create('swagger json') .get('/https/example.com/example.svg') diff --git a/services/swagger/swagger.service.js b/services/swagger/swagger.service.js index 422768dd9977c..90edd6417047d 100644 --- a/services/swagger/swagger.service.js +++ b/services/swagger/swagger.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; const schema = Joi.object() .keys({ @@ -19,7 +17,7 @@ const queryParamSchema = Joi.object({ specUrl: optionalUrl.required(), }).required() -module.exports = class SwaggerValidatorService extends BaseJsonService { +export default class SwaggerValidatorService extends BaseJsonService { static category = 'other' static route = { @@ -85,4 +83,4 @@ module.exports = class SwaggerValidatorService extends BaseJsonService { const { status } = this.transform({ json, specUrl }) return this.constructor.render({ status }) } -} +}; diff --git a/services/swagger/swagger.tester.js b/services/swagger/swagger.tester.js index 3f8749e46ff4e..38015e1b0fed8 100644 --- a/services/swagger/swagger.tester.js +++ b/services/swagger/swagger.tester.js @@ -1,5 +1,3 @@ -'use strict' - const getURL = '/3.0.json?specUrl=https://example.com/example.json' const getURLBase = '/3.0.json?specUrl=' const apiURL = 'http://validator.swagger.io' @@ -8,7 +6,9 @@ const apiGetQueryParams = { url: 'https://example.com/example.json', } -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('Invalid') .get(getURL) diff --git a/services/symfony/sensiolabs-redirect.service.js b/services/symfony/sensiolabs-redirect.service.js index 35cdae90c4f13..497a036f5d9a3 100644 --- a/services/symfony/sensiolabs-redirect.service.js +++ b/services/symfony/sensiolabs-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ // The SymfonyInsight service was previously branded as SensioLabs, and // accordingly the badge path used to be /sensiolabs/i/projectUuid'. redirector({ @@ -14,4 +12,4 @@ module.exports = [ transformPath: ({ projectUuid }) => `/symfony/i/grade/${projectUuid}`, dateAdded: new Date('2019-02-08'), }), -] +]; diff --git a/services/symfony/sensiolabs-redirect.tester.js b/services/symfony/sensiolabs-redirect.tester.js index b5c409a1af024..47354f313dbc7 100644 --- a/services/symfony/sensiolabs-redirect.tester.js +++ b/services/symfony/sensiolabs-redirect.tester.js @@ -1,11 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'sensiolabs', - title: 'SensioLabs', -})) +const t = (function() { + export default __a; +}()) t.create('sensiolabs insight') .get('/i/825be328-29f8-44f7-a750-f82818ae9111.svg') diff --git a/services/symfony/symfony-insight-base.js b/services/symfony/symfony-insight-base.js index 4397492a2cc5f..86648dadec170 100644 --- a/services/symfony/symfony-insight-base.js +++ b/services/symfony/symfony-insight-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseXmlService, NotFound } = require('..') +import Joi from 'joi'; +import {BaseXmlService, NotFound} from '..'; const violationSchema = Joi.object({ severity: Joi.equal('info', 'minor', 'major', 'critical').required(), @@ -126,8 +124,8 @@ class SymfonyInsightBase extends BaseXmlService { } } -module.exports = { +export default { SymfonyInsightBase, keywords, gradeColors, -} +}; diff --git a/services/symfony/symfony-insight-base.spec.js b/services/symfony/symfony-insight-base.spec.js index 19cc1cc41c561..ab03abe62df48 100644 --- a/services/symfony/symfony-insight-base.spec.js +++ b/services/symfony/symfony-insight-base.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { NotFound } = require('..') -const { SymfonyInsightBase } = require('./symfony-insight-base') +import {expect} from 'chai'; +import {NotFound} from '..'; +import {SymfonyInsightBase} from './symfony-insight-base.js'; describe('SymfonyInsightBase', function () { context('transform()', function () { diff --git a/services/symfony/symfony-insight-grade.service.js b/services/symfony/symfony-insight-grade.service.js index 6c0a05594d30c..e0f9d2d58e2d7 100644 --- a/services/symfony/symfony-insight-grade.service.js +++ b/services/symfony/symfony-insight-grade.service.js @@ -1,12 +1,6 @@ -'use strict' +import {SymfonyInsightBase, keywords, gradeColors} from './symfony-insight-base.js'; -const { - SymfonyInsightBase, - keywords, - gradeColors, -} = require('./symfony-insight-base') - -module.exports = class SymfonyInsightGrade extends SymfonyInsightBase { +export default class SymfonyInsightGrade extends SymfonyInsightBase { static route = { base: 'symfony/i/grade', pattern: ':projectUuid', @@ -50,4 +44,4 @@ module.exports = class SymfonyInsightGrade extends SymfonyInsightBase { return this.constructor.render({ grade, status }) } -} +}; diff --git a/services/symfony/symfony-insight-grade.tester.js b/services/symfony/symfony-insight-grade.tester.js index 4c0a741b823bf..5c315a1c63913 100644 --- a/services/symfony/symfony-insight-grade.tester.js +++ b/services/symfony/symfony-insight-grade.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { sampleProjectUuid, noSymfonyToken } = require('./symfony-test-helpers') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; t.create('valid project grade') .skipWhen(noSymfonyToken) diff --git a/services/symfony/symfony-insight-stars.service.js b/services/symfony/symfony-insight-stars.service.js index 78cb0f94bc334..db35fb965e3ad 100644 --- a/services/symfony/symfony-insight-stars.service.js +++ b/services/symfony/symfony-insight-stars.service.js @@ -1,11 +1,5 @@ -'use strict' - -const { starRating } = require('../text-formatters') -const { - SymfonyInsightBase, - keywords, - gradeColors, -} = require('./symfony-insight-base') +import {starRating} from '../text-formatters.js'; +import {SymfonyInsightBase, keywords, gradeColors} from './symfony-insight-base.js'; const gradeStars = { none: 0, @@ -15,7 +9,7 @@ const gradeStars = { platinum: 4, } -module.exports = class SymfonyInsightStars extends SymfonyInsightBase { +export default class SymfonyInsightStars extends SymfonyInsightBase { static route = { base: 'symfony/i/stars', pattern: ':projectUuid', @@ -57,4 +51,4 @@ module.exports = class SymfonyInsightStars extends SymfonyInsightBase { const { grade, status } = this.transform({ data }) return this.constructor.render({ grade, status }) } -} +}; diff --git a/services/symfony/symfony-insight-stars.tester.js b/services/symfony/symfony-insight-stars.tester.js index 7bc4162ae7968..901e14d404aab 100644 --- a/services/symfony/symfony-insight-stars.tester.js +++ b/services/symfony/symfony-insight-stars.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex } = require('../test-validators') -const { sampleProjectUuid, noSymfonyToken } = require('./symfony-test-helpers') +const t = (function() { + export default __a; +}()) +import {withRegex} from '../test-validators.js'; +import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; t.create('valid project stars') .skipWhen(noSymfonyToken) diff --git a/services/symfony/symfony-insight-violations.service.js b/services/symfony/symfony-insight-violations.service.js index a00650865a4f2..47c86bfa08af8 100644 --- a/services/symfony/symfony-insight-violations.service.js +++ b/services/symfony/symfony-insight-violations.service.js @@ -1,8 +1,6 @@ -'use strict' +import {SymfonyInsightBase, keywords} from './symfony-insight-base.js'; -const { SymfonyInsightBase, keywords } = require('./symfony-insight-base') - -module.exports = class SymfonyInsightViolations extends SymfonyInsightBase { +export default class SymfonyInsightViolations extends SymfonyInsightBase { static route = { base: 'symfony/i/violations', pattern: ':projectUuid', @@ -78,4 +76,4 @@ module.exports = class SymfonyInsightViolations extends SymfonyInsightBase { const lastAnalysis = this.transform({ data }) return this.constructor.render(lastAnalysis) } -} +}; diff --git a/services/symfony/symfony-insight-violations.tester.js b/services/symfony/symfony-insight-violations.tester.js index 5d2e0306dd819..bd606e0028c30 100644 --- a/services/symfony/symfony-insight-violations.tester.js +++ b/services/symfony/symfony-insight-violations.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex } = require('../test-validators') -const { sampleProjectUuid, noSymfonyToken } = require('./symfony-test-helpers') +const t = (function() { + export default __a; +}()) +import {withRegex} from '../test-validators.js'; +import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; t.create('valid project violations') .skipWhen(noSymfonyToken) diff --git a/services/symfony/symfony-insight.spec.js b/services/symfony/symfony-insight.spec.js index d2c0b10324829..40c55105ff76a 100644 --- a/services/symfony/symfony-insight.spec.js +++ b/services/symfony/symfony-insight.spec.js @@ -1,29 +1,10 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const SymfonyInsightGrade = require('./symfony-insight-grade.service') -const SymfonyInsightStars = require('./symfony-insight-stars.service') -const SymfonyInsightViolations = require('./symfony-insight-violations.service') -const { - sampleProjectUuid: projectUuid, - runningMockResponse, - platinumMockResponse, - goldMockResponse, - silverMockResponse, - bronzeMockResponse, - noMedalMockResponse, - noGradeMockResponse, - criticalViolation, - majorViolation, - minorViolation, - infoViolation, - multipleViolations, - user, - token, - config, -} = require('./symfony-test-helpers') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import SymfonyInsightGrade from './symfony-insight-grade.service.js'; +import SymfonyInsightStars from './symfony-insight-stars.service.js'; +import SymfonyInsightViolations from './symfony-insight-violations.service.js'; +import {sampleProjectUuid as projectUuid, runningMockResponse, platinumMockResponse, goldMockResponse, silverMockResponse, bronzeMockResponse, noMedalMockResponse, noGradeMockResponse, criticalViolation, majorViolation, minorViolation, infoViolation, multipleViolations, user, token, config} from './symfony-test-helpers.js'; // These tests are organized in a fairly unusual way because the service uses // XML, so it's difficult to decouple the parsing from the transform + render. diff --git a/services/symfony/symfony-test-helpers.js b/services/symfony/symfony-test-helpers.js index 3652fddd7b0db..317cbfe59787e 100644 --- a/services/symfony/symfony-test-helpers.js +++ b/services/symfony/symfony-test-helpers.js @@ -1,5 +1,3 @@ -'use strict' - const sampleProjectUuid = '825be328-29f8-44f7-a750-f82818ae9111' function createMockResponse({ status = 'finished', grade, violations }) { @@ -86,11 +84,11 @@ const config = { }, } -const { noToken } = require('../test-helpers') -const { SymfonyInsightBase } = require('./symfony-insight-base') +import {noToken} from '../test-helpers.js'; +import {SymfonyInsightBase} from './symfony-insight-base.js'; const noSymfonyToken = noToken(SymfonyInsightBase) -module.exports = { +export default { sampleProjectUuid, runningMockResponse, platinumMockResponse, @@ -108,4 +106,4 @@ module.exports = { token, config, noSymfonyToken, -} +}; diff --git a/services/teamcity/teamcity-base.js b/services/teamcity/teamcity-base.js index 4abbac669b731..7feb05b656706 100644 --- a/services/teamcity/teamcity-base.js +++ b/services/teamcity/teamcity-base.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseJsonService} from '..'; -const { BaseJsonService } = require('..') - -module.exports = class TeamCityBase extends BaseJsonService { +export default class TeamCityBase extends BaseJsonService { static auth = { userKey: 'teamcity_user', passKey: 'teamcity_pass', @@ -25,4 +23,4 @@ module.exports = class TeamCityBase extends BaseJsonService { }) ) } -} +}; diff --git a/services/teamcity/teamcity-build-redirect.service.js b/services/teamcity/teamcity-build-redirect.service.js index 09684097b3ba9..7384be0397ae7 100644 --- a/services/teamcity/teamcity-build-redirect.service.js +++ b/services/teamcity/teamcity-build-redirect.service.js @@ -1,13 +1,11 @@ -'use strict' - -const { redirector } = require('..') +import {redirector} from '..'; const commonAttrs = { dateAdded: new Date('2019-09-15'), category: 'build', } -module.exports = [ +export default [ redirector({ ...commonAttrs, name: 'TeamCityBuildLegacyCodeBetterRedirect', @@ -34,4 +32,4 @@ module.exports = [ server: `${protocol}://${hostAndPath}`, }), }), -] +]; diff --git a/services/teamcity/teamcity-build-redirect.tester.js b/services/teamcity/teamcity-build-redirect.tester.js index fc1870445c79b..ade18ec2b9057 100644 --- a/services/teamcity/teamcity-build-redirect.tester.js +++ b/services/teamcity/teamcity-build-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'TeamCityBuildRedirect', - title: 'TeamCityBuildRedirect', - pathPrefix: '/teamcity', -})) +const t = (function() { + export default __a; +}()) t.create('codebetter') .get('/codebetter/IntelliJIdeaCe_JavaDecompilerEngineTests.svg') diff --git a/services/teamcity/teamcity-build.service.js b/services/teamcity/teamcity-build.service.js index b318decf7f897..dd401d18a6eb9 100644 --- a/services/teamcity/teamcity-build.service.js +++ b/services/teamcity/teamcity-build.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const TeamCityBase = require('./teamcity-base') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import TeamCityBase from './teamcity-base.js'; const buildStatusSchema = Joi.object({ status: Joi.equal('SUCCESS', 'FAILURE', 'ERROR').required(), @@ -13,7 +11,7 @@ const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class TeamCityBuild extends TeamCityBase { +export default class TeamCityBuild extends TeamCityBase { static category = 'build' static route = { @@ -96,4 +94,4 @@ module.exports = class TeamCityBuild extends TeamCityBase { useVerbose, }) } -} +}; diff --git a/services/teamcity/teamcity-build.spec.js b/services/teamcity/teamcity-build.spec.js index b19b6148801dd..693779c6ad30e 100644 --- a/services/teamcity/teamcity-build.spec.js +++ b/services/teamcity/teamcity-build.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const TeamCityBuild = require('./teamcity-build.service') -const { user, pass, host, config } = require('./teamcity-test-helpers') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import TeamCityBuild from './teamcity-build.service.js'; +import {user, pass, host, config} from './teamcity-test-helpers.js'; describe('TeamCityBuild', function () { cleanUpNockAfterEach() diff --git a/services/teamcity/teamcity-build.tester.js b/services/teamcity/teamcity-build.tester.js index da29069c45482..d64332b09f6e5 100644 --- a/services/teamcity/teamcity-build.tester.js +++ b/services/teamcity/teamcity-build.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { withRegex } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {withRegex} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) const buildStatusValues = Joi.equal('passing', 'failure', 'error').required() const buildStatusTextRegex = diff --git a/services/teamcity/teamcity-coverage-redirect.service.js b/services/teamcity/teamcity-coverage-redirect.service.js index d41c37dabc312..d42eca87ab9c6 100644 --- a/services/teamcity/teamcity-coverage-redirect.service.js +++ b/services/teamcity/teamcity-coverage-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'coverage', route: { @@ -15,4 +13,4 @@ module.exports = [ }), dateAdded: new Date('2019-09-15'), }), -] +]; diff --git a/services/teamcity/teamcity-coverage-redirect.tester.js b/services/teamcity/teamcity-coverage-redirect.tester.js index df0decb3912b7..3c142013e25f7 100644 --- a/services/teamcity/teamcity-coverage-redirect.tester.js +++ b/services/teamcity/teamcity-coverage-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'TeamCityCoverageRedirect', - title: 'TeamCityCoverageRedirect', - pathPrefix: '/teamcity/coverage', -})) +const t = (function() { + export default __a; +}()) t.create('coverage') .get('/https/teamcity.jetbrains.com/ReactJSNet_PullRequests.svg') diff --git a/services/teamcity/teamcity-coverage.service.js b/services/teamcity/teamcity-coverage.service.js index cffb07ee3a1bc..c98fa8cc4d54a 100644 --- a/services/teamcity/teamcity-coverage.service.js +++ b/services/teamcity/teamcity-coverage.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { coveragePercentage } = require('../color-formatters') -const { optionalUrl } = require('../validators') -const { InvalidResponse } = require('..') -const TeamCityBase = require('./teamcity-base') +import Joi from 'joi'; +import {coveragePercentage} from '../color-formatters.js'; +import {optionalUrl} from '../validators.js'; +import {InvalidResponse} from '..'; +import TeamCityBase from './teamcity-base.js'; const buildStatisticsSchema = Joi.object({ property: Joi.array() @@ -21,7 +19,7 @@ const queryParamSchema = Joi.object({ server: optionalUrl, }).required() -module.exports = class TeamCityCoverage extends TeamCityBase { +export default class TeamCityCoverage extends TeamCityBase { static category = 'coverage' static route = { @@ -89,4 +87,4 @@ module.exports = class TeamCityCoverage extends TeamCityBase { const { coverage } = this.transform({ data }) return this.constructor.render({ coverage }) } -} +}; diff --git a/services/teamcity/teamcity-coverage.spec.js b/services/teamcity/teamcity-coverage.spec.js index b6bcd35fb7a3e..49bc77b9aef3b 100644 --- a/services/teamcity/teamcity-coverage.spec.js +++ b/services/teamcity/teamcity-coverage.spec.js @@ -1,10 +1,8 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const TeamCityCoverage = require('./teamcity-coverage.service') -const { user, pass, host, config } = require('./teamcity-test-helpers') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import TeamCityCoverage from './teamcity-coverage.service.js'; +import {user, pass, host, config} from './teamcity-test-helpers.js'; describe('TeamCityCoverage', function () { cleanUpNockAfterEach() diff --git a/services/teamcity/teamcity-coverage.tester.js b/services/teamcity/teamcity-coverage.tester.js index a259d150512ec..f75688df29e73 100644 --- a/services/teamcity/teamcity-coverage.tester.js +++ b/services/teamcity/teamcity-coverage.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isIntegerPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isIntegerPercentage} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('invalid buildId') .get('/btABC999.json') diff --git a/services/teamcity/teamcity-test-helpers.js b/services/teamcity/teamcity-test-helpers.js index 21d7a8b3ad89c..5cb3ed14e42f7 100644 --- a/services/teamcity/teamcity-test-helpers.js +++ b/services/teamcity/teamcity-test-helpers.js @@ -1,5 +1,3 @@ -'use strict' - const user = 'admin' const pass = 'password' const host = 'mycompany.teamcity.com' @@ -17,9 +15,9 @@ const config = { }, } -module.exports = { +export default { user, pass, host, config, -} +}; diff --git a/services/test-helpers.js b/services/test-helpers.js index cc3013135d4ac..8bfbd351fdff1 100644 --- a/services/test-helpers.js +++ b/services/test-helpers.js @@ -1,9 +1,7 @@ -'use strict' - -const nock = require('nock') -const request = require('request') +import nock from 'nock'; +import request from 'request'; const runnerConfig = require('config').util.toObject() -const { promisify } = require('../core/base-service/legacy-request-handler') +import {promisify} from '../core/base-service/legacy-request-handler.js'; function cleanUpNockAfterEach() { afterEach(function () { @@ -36,9 +34,9 @@ const sendAndCacheRequest = promisify(request) const defaultContext = { sendAndCacheRequest } -module.exports = { +export default { cleanUpNockAfterEach, noToken, sendAndCacheRequest, defaultContext, -} +}; diff --git a/services/test-results.js b/services/test-results.js index a46841939e65a..47828966ec5f0 100644 --- a/services/test-results.js +++ b/services/test-results.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; const testResultQueryParamSchema = Joi.object({ compact_message: Joi.equal(''), @@ -106,9 +104,9 @@ const documentation = `

` -module.exports = { +export default { testResultQueryParamSchema, renderTestResultMessage, renderTestResultBadge, documentation, -} +}; diff --git a/services/test-results.spec.js b/services/test-results.spec.js index 5953f51954a31..e9df50bda1e0c 100644 --- a/services/test-results.spec.js +++ b/services/test-results.spec.js @@ -1,10 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { - renderTestResultMessage, - renderTestResultBadge, -} = require('./test-results') +import {test, given} from 'sazerac'; +import {renderTestResultMessage, renderTestResultBadge} from './test-results.js'; describe('Test result helpers', function () { function renderBothStyles(props) { diff --git a/services/test-validators.js b/services/test-validators.js index c6804831c2c24..186f4ab999108 100644 --- a/services/test-validators.js +++ b/services/test-validators.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { semver: isSemver } = require('./validators') +import Joi from 'joi'; +import {semver as isSemver} from './validators.js'; /* Note: @@ -140,7 +138,7 @@ const isCustomCompactTestTotals = makeCompactTestTotalsValidator({ skipped: '🤷', }) -module.exports = { +export default { isSemver, isVPlusTripleDottedVersion, isVPlusDottedVersionAtLeastOne, @@ -169,4 +167,4 @@ module.exports = { isCustomCompactTestTotals, makeTestTotalsValidator, makeCompactTestTotalsValidator, -} +}; diff --git a/services/tester.js b/services/tester.js index c9d230b0f968c..a8fb86389c7df 100644 --- a/services/tester.js +++ b/services/tester.js @@ -1,9 +1,7 @@ -'use strict' +import createServiceTester from '../core/service-test-runner/create-service-tester.js'; +import ServiceTester from '../core/service-test-runner/service-tester.js'; -const createServiceTester = require('../core/service-test-runner/create-service-tester') -const ServiceTester = require('../core/service-test-runner/service-tester') - -module.exports = { +export default { createServiceTester, ServiceTester, -} +}; diff --git a/services/testspace/testspace-base.js b/services/testspace/testspace-base.js index b35b929f95aeb..ae3998f210105 100644 --- a/services/testspace/testspace-base.js +++ b/services/testspace/testspace-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; // https://help.testspace.com/docs/reference/web-api#list-results // case_counts|array|The contained cases [passed, failed, na, errored]|counters of result @@ -25,7 +23,7 @@ const schema = Joi.array() // Org is owner/account // Project is generally a repository // Space is a container, often a branch -module.exports = class TestspaceBase extends BaseJsonService { +export default class TestspaceBase extends BaseJsonService { static category = 'build' static defaultBadgeData = { label: 'tests' } @@ -58,4 +56,4 @@ module.exports = class TestspaceBase extends BaseJsonService { return { passed, failed, skipped, errored, total } } -} +}; diff --git a/services/testspace/testspace-base.spec.js b/services/testspace/testspace-base.spec.js index 7d46fa8e6c2ea..47c8d82369ee5 100644 --- a/services/testspace/testspace-base.spec.js +++ b/services/testspace/testspace-base.spec.js @@ -1,8 +1,6 @@ -'use strict' - -const { expect } = require('chai') -const { NotFound } = require('..') -const TestspaceBase = require('./testspace-base') +import {expect} from 'chai'; +import {NotFound} from '..'; +import TestspaceBase from './testspace-base.js'; describe('TestspaceBase', function () { it('throws NotFound when response is missing space results', function () { diff --git a/services/testspace/testspace-test-count.service.js b/services/testspace/testspace-test-count.service.js index 38a73558dcc3a..da4afc14d28f7 100644 --- a/services/testspace/testspace-test-count.service.js +++ b/services/testspace/testspace-test-count.service.js @@ -1,9 +1,7 @@ -'use strict' +import {metric as metricCount} from '../text-formatters.js'; +import TestspaceBase from './testspace-base.js'; -const { metric: metricCount } = require('../text-formatters') -const TestspaceBase = require('./testspace-base') - -module.exports = class TestspaceTestCount extends TestspaceBase { +export default class TestspaceTestCount extends TestspaceBase { static route = { base: 'testspace', pattern: @@ -61,4 +59,4 @@ module.exports = class TestspaceTestCount extends TestspaceBase { const { value } = this.transform({ json, metric }) return this.constructor.render({ value, metric }) } -} +}; diff --git a/services/testspace/testspace-test-count.spec.js b/services/testspace/testspace-test-count.spec.js index 9a03d3530ec39..a1524f91bc7da 100644 --- a/services/testspace/testspace-test-count.spec.js +++ b/services/testspace/testspace-test-count.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const TestspaceTestCount = require('./testspace-test-count.service') +import {test, given} from 'sazerac'; +import TestspaceTestCount from './testspace-test-count.service.js'; describe('TestspaceTestCount', function () { test(TestspaceTestCount.render, () => { diff --git a/services/testspace/testspace-test-count.tester.js b/services/testspace/testspace-test-count.tester.js index b57fd9b25f010..08b06e194b25d 100644 --- a/services/testspace/testspace-test-count.tester.js +++ b/services/testspace/testspace-test-count.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; const isMetricAllowZero = Joi.alternatives( isMetric, Joi.number().valid(0).required() diff --git a/services/testspace/testspace-test-pass-ratio.service.js b/services/testspace/testspace-test-pass-ratio.service.js index dbe4526cfd5b6..a57b73af104f0 100644 --- a/services/testspace/testspace-test-pass-ratio.service.js +++ b/services/testspace/testspace-test-pass-ratio.service.js @@ -1,8 +1,6 @@ -'use strict' +import TestspaceBase from './testspace-base.js'; -const TestspaceBase = require('./testspace-base') - -module.exports = class TestspacePassRatio extends TestspaceBase { +export default class TestspacePassRatio extends TestspaceBase { static route = { base: 'testspace/pass-ratio', pattern: ':org/:project/:space+', @@ -42,4 +40,4 @@ module.exports = class TestspacePassRatio extends TestspaceBase { const { passed, total } = this.transform(json) return this.constructor.render({ passed, total }) } -} +}; diff --git a/services/testspace/testspace-test-pass-ratio.spec.js b/services/testspace/testspace-test-pass-ratio.spec.js index 4cf4fe3cd2c49..87c918edd61c3 100644 --- a/services/testspace/testspace-test-pass-ratio.spec.js +++ b/services/testspace/testspace-test-pass-ratio.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const TestspacePassRatio = require('./testspace-test-pass-ratio.service') +import {test, given} from 'sazerac'; +import TestspacePassRatio from './testspace-test-pass-ratio.service.js'; describe('TestspacePassRatio', function () { test(TestspacePassRatio.render, () => { diff --git a/services/testspace/testspace-test-pass-ratio.tester.js b/services/testspace/testspace-test-pass-ratio.tester.js index 42d81db751161..17ee33eec0920 100644 --- a/services/testspace/testspace-test-pass-ratio.tester.js +++ b/services/testspace/testspace-test-pass-ratio.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isIntegerPercentage } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isIntegerPercentage} from '../test-validators.js'; t.create('Non-existent or unauthorized org') .get('/swellaby1239017823123/swellaby:testspace-sample/main.json') diff --git a/services/testspace/testspace-test-summary.service.js b/services/testspace/testspace-test-summary.service.js index ca5fcd5aed33b..8e04fbf1d189d 100644 --- a/services/testspace/testspace-test-summary.service.js +++ b/services/testspace/testspace-test-summary.service.js @@ -1,13 +1,7 @@ -'use strict' +import {documentation, testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; +import TestspaceBase from './testspace-base.js'; -const { - documentation, - testResultQueryParamSchema, - renderTestResultBadge, -} = require('../test-results') -const TestspaceBase = require('./testspace-base') - -module.exports = class TestspaceTests extends TestspaceBase { +export default class TestspaceTests extends TestspaceBase { static route = { base: 'testspace/tests', pattern: ':org/:project/:space+', @@ -100,4 +94,4 @@ module.exports = class TestspaceTests extends TestspaceBase { skippedLabel, }) } -} +}; diff --git a/services/testspace/testspace-test-summary.tester.js b/services/testspace/testspace-test-summary.tester.js index aaebf6868d7ba..5652ac672425c 100644 --- a/services/testspace/testspace-test-summary.tester.js +++ b/services/testspace/testspace-test-summary.tester.js @@ -1,12 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { - isDefaultTestTotals, - isDefaultCompactTestTotals, - isCustomTestTotals, - isCustomCompactTestTotals, -} = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals} from '../test-validators.js'; t.create('Tests') .get('/swellaby/swellaby:testspace-sample/main.json') diff --git a/services/text-formatters.js b/services/text-formatters.js index 95cb600d4e3d0..a64a8a3dd0987 100644 --- a/services/text-formatters.js +++ b/services/text-formatters.js @@ -2,9 +2,7 @@ * Commonly-used functions for formatting text in badge labels. Includes * ordinal numbers, currency codes, star ratings, versions, etc. */ -'use strict' - -const moment = require('moment') +import moment from 'moment'; moment().format() function starRating(rating, max = 5) { @@ -124,7 +122,7 @@ function formatRelativeDate(timestamp) { .toLowerCase() } -module.exports = { +export default { starRating, currencyFromCode, ordinalNumber, @@ -134,4 +132,4 @@ module.exports = { maybePluralize, formatDate, formatRelativeDate, -} +}; diff --git a/services/text-formatters.spec.js b/services/text-formatters.spec.js index a1b5d0ae048b8..af2e5a2c3281d 100644 --- a/services/text-formatters.spec.js +++ b/services/text-formatters.spec.js @@ -1,18 +1,6 @@ -'use strict' - -const { test, given } = require('sazerac') -const sinon = require('sinon') -const { - starRating, - currencyFromCode, - ordinalNumber, - metric, - omitv, - addv, - maybePluralize, - formatDate, - formatRelativeDate, -} = require('./text-formatters') +import {test, given} from 'sazerac'; +import sinon from 'sinon'; +import {starRating, currencyFromCode, ordinalNumber, metric, omitv, addv, maybePluralize, formatDate, formatRelativeDate} from './text-formatters.js'; describe('Text formatters', function () { test(starRating, () => { diff --git a/services/tokei/tokei.service.js b/services/tokei/tokei.service.js index 97124289aee7c..c5d282b836f9c 100644 --- a/services/tokei/tokei.service.js +++ b/services/tokei/tokei.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ lines: nonNegativeInteger, @@ -26,7 +24,7 @@ const documentation = `

` -module.exports = class Tokei extends BaseJsonService { +export default class Tokei extends BaseJsonService { static category = 'size' static route = { base: 'tokei/lines', pattern: ':provider/:user/:repo' } @@ -77,4 +75,4 @@ module.exports = class Tokei extends BaseJsonService { const { lines } = await this.fetch({ provider, user, repo }) return this.constructor.render({ lines }) } -} +}; diff --git a/services/tokei/tokei.tester.js b/services/tokei/tokei.tester.js index 0b310c8288ad2..deac0f1fd18a4 100644 --- a/services/tokei/tokei.tester.js +++ b/services/tokei/tokei.tester.js @@ -1,10 +1,8 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isMetric } = require('../test-validators') +import {ServiceTester} from '../tester.js'; +import {isMetric} from '../test-validators.js'; const t = new ServiceTester({ id: 'tokei', title: 'Tokei LOC Tests' }) -module.exports = t +export default t; t.create('GitHub LOC') .get('/lines/github/badges/shields.json') diff --git a/services/travis/travis-build.service.js b/services/travis/travis-build.service.js index b679ffcdfb592..7aa1fdf954f99 100644 --- a/services/travis/travis-build.service.js +++ b/services/travis/travis-build.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseSvgScrapingService } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseSvgScrapingService} from '..'; const schema = Joi.object({ message: Joi.alternatives() @@ -10,7 +8,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class TravisBuild extends BaseSvgScrapingService { +export default class TravisBuild extends BaseSvgScrapingService { static category = 'build' static route = { @@ -86,4 +84,4 @@ module.exports = class TravisBuild extends BaseSvgScrapingService { return this.constructor.render({ status }) } -} +}; diff --git a/services/travis/travis-build.tester.js b/services/travis/travis-build.tester.js index a7d6fcfef7e28..f64dd6c28c280 100644 --- a/services/travis/travis-build.tester.js +++ b/services/travis/travis-build.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) // Travis (.org) CI diff --git a/services/travis/travis-php-version-redirect.service.js b/services/travis/travis-php-version-redirect.service.js index 3fc26b116d96e..bc6f2721424bf 100644 --- a/services/travis/travis-php-version-redirect.service.js +++ b/services/travis/travis-php-version-redirect.service.js @@ -1,6 +1,4 @@ -'use strict' - -const { redirector } = require('..') +import {redirector} from '..'; const ciRedirect = redirector({ category: 'platform-support', @@ -25,4 +23,4 @@ const branchRedirect = redirector({ dateAdded: new Date('2020-07-12'), }) -module.exports = { ciRedirect, branchRedirect } +export default { ciRedirect, branchRedirect }; diff --git a/services/travis/travis-php-version-redirect.tester.js b/services/travis/travis-php-version-redirect.tester.js index adf9fb66695a7..5e045291bcc74 100644 --- a/services/travis/travis-php-version-redirect.tester.js +++ b/services/travis/travis-php-version-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'TravisPhpVersionRedirect', - title: 'TravisPhpVersionRedirect', - pathPrefix: '/', -})) +const t = (function() { + export default __a; +}()) t.create('travis-ci no branch') .get('travis-ci/php-v/symfony/symfony.svg') diff --git a/services/travis/travis-php-version.service.js b/services/travis/travis-php-version.service.js index e11312cb6fe97..3f4c8a90367fb 100644 --- a/services/travis/travis-php-version.service.js +++ b/services/travis/travis-php-version.service.js @@ -1,12 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { - minorVersion, - versionReduction, - getPhpReleases, -} = require('../php-version') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {minorVersion, versionReduction, getPhpReleases} from '../php-version.js'; +import {BaseJsonService} from '..'; const optionalNumberOrString = Joi.alternatives(Joi.string(), Joi.number()) const schema = Joi.object({ @@ -23,7 +17,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class TravisPhpVersion extends BaseJsonService { +export default class TravisPhpVersion extends BaseJsonService { static category = 'platform-support' static route = { @@ -99,4 +93,4 @@ module.exports = class TravisPhpVersion extends BaseJsonService { const { reduction, hasHhvm } = await this.transform(travisConfig) return this.constructor.render({ reduction, hasHhvm }) } -} +}; diff --git a/services/travis/travis-php-version.tester.js b/services/travis/travis-php-version.tester.js index 4213a167b894d..6319052c94be9 100644 --- a/services/travis/travis-php-version.tester.js +++ b/services/travis/travis-php-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isPhpVersionReduction } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isPhpVersionReduction} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('gets the package version of symfony 5.1') .get('/symfony/symfony/5.1.json') diff --git a/services/treeware/treeware-trees.service.js b/services/treeware/treeware-trees.service.js index 3e27679032367..2f545b5c2b4f5 100644 --- a/services/treeware/treeware-trees.service.js +++ b/services/treeware/treeware-trees.service.js @@ -1,16 +1,14 @@ -'use strict' - -const crypto = require('crypto') -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const { BaseJsonService } = require('..') +import crypto from 'crypto'; +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import {BaseJsonService} from '..'; const apiSchema = Joi.object({ total: Joi.number().required(), }).required() -module.exports = class TreewareTrees extends BaseJsonService { +export default class TreewareTrees extends BaseJsonService { static category = 'other' static route = { @@ -54,4 +52,4 @@ module.exports = class TreewareTrees extends BaseJsonService { return this.constructor.render({ count: total }) } -} +}; diff --git a/services/treeware/treeware-trees.tester.js b/services/treeware/treeware-trees.tester.js index bc2d1a84f4736..d145606db3f88 100644 --- a/services/treeware/treeware-trees.tester.js +++ b/services/treeware/treeware-trees.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; t.create('request for existing package') .get('/stoplightio/spectral.json') diff --git a/services/twitch/twitch-base.js b/services/twitch/twitch-base.js index b6526a50a3553..ebd21e4d89b12 100644 --- a/services/twitch/twitch-base.js +++ b/services/twitch/twitch-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const tokenSchema = Joi.object({ access_token: Joi.string().required(), @@ -16,7 +14,7 @@ function sleep(ms) { } // Abstract class for Twitch badges -module.exports = class TwitchBase extends BaseJsonService { +export default class TwitchBase extends BaseJsonService { static auth = { userKey: 'twitch_client_id', passKey: 'twitch_client_secret', @@ -114,4 +112,4 @@ module.exports = class TwitchBase extends BaseJsonService { // one last time return super._requestJson(request) } -} +}; diff --git a/services/twitch/twitch.service.js b/services/twitch/twitch.service.js index 2bd3f53a320dc..bca06c5712ff0 100644 --- a/services/twitch/twitch.service.js +++ b/services/twitch/twitch.service.js @@ -1,13 +1,11 @@ -'use strict' - -const Joi = require('joi') -const TwitchBase = require('./twitch-base') +import Joi from 'joi'; +import TwitchBase from './twitch-base.js'; const helixSchema = Joi.object({ data: Joi.array().required(), }) -module.exports = class TwitchStatus extends TwitchBase { +export default class TwitchStatus extends TwitchBase { static category = 'social' static route = { @@ -66,4 +64,4 @@ module.exports = class TwitchStatus extends TwitchBase { const data = await this.fetch({ user }) return this.constructor.render({ user, isLive: data.data.length > 0 }) } -} +}; diff --git a/services/twitch/twitch.spec.js b/services/twitch/twitch.spec.js index 7573d5542795d..74b8d7705975c 100644 --- a/services/twitch/twitch.spec.js +++ b/services/twitch/twitch.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const TwitchStatus = require('./twitch.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import TwitchStatus from './twitch.service.js'; describe('TwitchStatus', function () { describe('auth', function () { diff --git a/services/twitch/twitch.tester.js b/services/twitch/twitch.tester.js index 53f3f68f5904c..14d3754b25fee 100644 --- a/services/twitch/twitch.tester.js +++ b/services/twitch/twitch.tester.js @@ -1,14 +1,12 @@ -'use strict' +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {noToken} from '../test-helpers.js'; +import _noTwitchToken from './twitch.service'; +const noTwitchToken = noToken(_noTwitchToken); -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { noToken } = require('../test-helpers') -const noTwitchToken = noToken(require('./twitch.service')) - -const t = (module.exports = new ServiceTester({ - id: 'twitch', - title: 'Twitch', -})) +const t = (function() { + export default __a; +}()) // the first request would take longer since we need to wait for a token t.create('Status of andyonthewings') diff --git a/services/twitter/twitter-redirect.service.js b/services/twitter/twitter-redirect.service.js index b7cacce78661d..c6bee1c552c49 100644 --- a/services/twitter/twitter-redirect.service.js +++ b/services/twitter/twitter-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ redirector({ category: 'social', name: 'TwitterUrlRedirect', @@ -16,4 +14,4 @@ module.exports = [ }), dateAdded: new Date('2019-09-17'), }), -] +]; diff --git a/services/twitter/twitter-redirect.tester.js b/services/twitter/twitter-redirect.tester.js index 84d0f9a2895c4..8ec2723d12708 100644 --- a/services/twitter/twitter-redirect.tester.js +++ b/services/twitter/twitter-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'TwitterUrlRedirect', - title: 'TwitterUrlRedirect', - pathPrefix: '/twitter/url', -})) +const t = (function() { + export default __a; +}()) t.create('twitter') .get('/https/shields.io.svg') diff --git a/services/twitter/twitter.service.js b/services/twitter/twitter.service.js index a46c82142149a..9118824067109 100644 --- a/services/twitter/twitter.service.js +++ b/services/twitter/twitter.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { optionalUrl } = require('../validators') -const { BaseService, BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {optionalUrl} from '../validators.js'; +import {BaseService, BaseJsonService, NotFound} from '..'; const queryParamSchema = Joi.object({ url: optionalUrl.required(), @@ -115,4 +113,4 @@ class TwitterFollow extends BaseJsonService { } } -module.exports = [TwitterUrl, TwitterFollow] +export default [TwitterUrl, TwitterFollow]; diff --git a/services/twitter/twitter.tester.js b/services/twitter/twitter.tester.js index 50941c9838176..2bae9beb44fc6 100644 --- a/services/twitter/twitter.tester.js +++ b/services/twitter/twitter.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {isMetric} from '../test-validators.js'; +import {ServiceTester} from '../tester.js'; -const { isMetric } = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'twitter', - title: 'Twitter', -})) +const t = (function() { + export default __a; +}()) t.create('Followers') .get('/follow/shields_io.json') diff --git a/services/ubuntu/ubuntu.service.js b/services/ubuntu/ubuntu.service.js index c4c407da69262..e76bbca51244c 100644 --- a/services/ubuntu/ubuntu.service.js +++ b/services/ubuntu/ubuntu.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseJsonService, NotFound} from '..'; const schema = Joi.object({ entries: Joi.array() @@ -14,7 +12,7 @@ const schema = Joi.object({ .required(), }).required() -module.exports = class Ubuntu extends BaseJsonService { +export default class Ubuntu extends BaseJsonService { static category = 'version' static route = { @@ -70,4 +68,4 @@ module.exports = class Ubuntu extends BaseJsonService { version: data.entries[0].source_package_version, }) } -} +}; diff --git a/services/ubuntu/ubuntu.tester.js b/services/ubuntu/ubuntu.tester.js index a20217c741641..9e8bb3a6d5170 100644 --- a/services/ubuntu/ubuntu.tester.js +++ b/services/ubuntu/ubuntu.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isUbuntuVersion = Joi.string().regex( /^v(\d+:)?\d+(\.\d+)*([\w\\.]*)?([-+~].*)?$/ diff --git a/services/uptimerobot/uptimerobot-base.js b/services/uptimerobot/uptimerobot-base.js index d929863efd3f5..ae19ff25a492f 100644 --- a/services/uptimerobot/uptimerobot-base.js +++ b/services/uptimerobot/uptimerobot-base.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, InvalidParameter, InvalidResponse } = require('..') +import Joi from 'joi'; +import {BaseJsonService, InvalidParameter, InvalidResponse} from '..'; // https://uptimerobot.com/api // POST getMonitors @@ -38,7 +36,7 @@ const singleMonitorResponseWithUptime = Joi.alternatives( }).required() ) -module.exports = class UptimeRobotBase extends BaseJsonService { +export default class UptimeRobotBase extends BaseJsonService { static category = 'monitoring' static ensureIsMonitorApiKey(value) { @@ -85,4 +83,4 @@ module.exports = class UptimeRobotBase extends BaseJsonService { return { monitors } } -} +}; diff --git a/services/uptimerobot/uptimerobot-ratio.service.js b/services/uptimerobot/uptimerobot-ratio.service.js index ac7fb2bb16fbc..64b5bad074e70 100644 --- a/services/uptimerobot/uptimerobot-ratio.service.js +++ b/services/uptimerobot/uptimerobot-ratio.service.js @@ -1,11 +1,9 @@ -'use strict' - -const { colorScale } = require('../color-formatters') -const UptimeRobotBase = require('./uptimerobot-base') +import {colorScale} from '../color-formatters.js'; +import UptimeRobotBase from './uptimerobot-base.js'; const ratioColor = colorScale([10, 30, 50, 70]) -module.exports = class UptimeRobotRatio extends UptimeRobotBase { +export default class UptimeRobotRatio extends UptimeRobotBase { static route = { base: 'uptimerobot/ratio', pattern: ':numberOfDays(\\d+)?/:monitorSpecificKey', @@ -46,4 +44,4 @@ module.exports = class UptimeRobotRatio extends UptimeRobotBase { const ratio = Number.parseFloat(monitors[0].custom_uptime_ratio) return this.constructor.render({ ratio }) } -} +}; diff --git a/services/uptimerobot/uptimerobot-ratio.tester.js b/services/uptimerobot/uptimerobot-ratio.tester.js index 049fc9c05ac05..4c7bf4500efec 100644 --- a/services/uptimerobot/uptimerobot-ratio.tester.js +++ b/services/uptimerobot/uptimerobot-ratio.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const { isPercentage } = require('../test-validators') -const { invalidJSON } = require('../response-fixtures') -const t = (module.exports = require('../tester').createServiceTester()) +import {isPercentage} from '../test-validators.js'; +import {invalidJSON} from '../response-fixtures.js'; +const t = (function() { + export default __a; +}()) t.create('Uptime Robot: Percentage (valid)') .get('/m778918918-3e92c097147760ee39d02d36.json') diff --git a/services/uptimerobot/uptimerobot-status.service.js b/services/uptimerobot/uptimerobot-status.service.js index c4b5614201d42..71a34f443f79c 100644 --- a/services/uptimerobot/uptimerobot-status.service.js +++ b/services/uptimerobot/uptimerobot-status.service.js @@ -1,8 +1,6 @@ -'use strict' +import UptimeRobotBase from './uptimerobot-base.js'; -const UptimeRobotBase = require('./uptimerobot-base') - -module.exports = class UptimeRobotStatus extends UptimeRobotBase { +export default class UptimeRobotStatus extends UptimeRobotBase { static route = { base: 'uptimerobot/status', pattern: ':monitorSpecificKey', @@ -44,4 +42,4 @@ module.exports = class UptimeRobotStatus extends UptimeRobotBase { const { status } = monitors[0] return this.constructor.render({ status }) } -} +}; diff --git a/services/uptimerobot/uptimerobot-status.tester.js b/services/uptimerobot/uptimerobot-status.tester.js index 319d4c0456166..9fb92618d0953 100644 --- a/services/uptimerobot/uptimerobot-status.tester.js +++ b/services/uptimerobot/uptimerobot-status.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { invalidJSON } = require('../response-fixtures') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {invalidJSON} from '../response-fixtures.js'; +const t = (function() { + export default __a; +}()) const isUptimeStatus = Joi.string().valid( 'paused', diff --git a/services/vaadin-directory/vaadin-directory-base.js b/services/vaadin-directory/vaadin-directory-base.js index fe05d0f1dd2aa..081c445df451a 100644 --- a/services/vaadin-directory/vaadin-directory-base.js +++ b/services/vaadin-directory/vaadin-directory-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService} from '..'; const schema = Joi.object({ ratingCount: nonNegativeInteger, @@ -29,4 +27,4 @@ class BaseVaadinDirectoryService extends BaseJsonService { } } -module.exports = { BaseVaadinDirectoryService } +export default { BaseVaadinDirectoryService }; diff --git a/services/vaadin-directory/vaadin-directory-rating-count.service.js b/services/vaadin-directory/vaadin-directory-rating-count.service.js index 56518f6c8db72..617c1c42b4495 100644 --- a/services/vaadin-directory/vaadin-directory-rating-count.service.js +++ b/services/vaadin-directory/vaadin-directory-rating-count.service.js @@ -1,10 +1,8 @@ -'use strict' +import {metric} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; -const { metric } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') - -module.exports = class VaadinDirectoryRatingCount extends ( +export default class VaadinDirectoryRatingCount extends ( BaseVaadinDirectoryService ) { static category = 'rating' @@ -39,4 +37,4 @@ module.exports = class VaadinDirectoryRatingCount extends ( const { ratingCount } = await this.fetch({ packageName }) return this.constructor.render({ ratingCount }) } -} +}; diff --git a/services/vaadin-directory/vaadin-directory-rating-count.tester.js b/services/vaadin-directory/vaadin-directory-rating-count.tester.js index 75942ed786220..9616090b45adf 100644 --- a/services/vaadin-directory/vaadin-directory-rating-count.tester.js +++ b/services/vaadin-directory/vaadin-directory-rating-count.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('rating count of component') .get('/rating-count/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-rating.service.js b/services/vaadin-directory/vaadin-directory-rating.service.js index a829de8856dbf..f2875eaa7f4ce 100644 --- a/services/vaadin-directory/vaadin-directory-rating.service.js +++ b/services/vaadin-directory/vaadin-directory-rating.service.js @@ -1,10 +1,8 @@ -'use strict' +import {starRating} from '../text-formatters.js'; +import {floorCount as floorCountColor} from '../color-formatters.js'; +import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; -const { starRating } = require('../text-formatters') -const { floorCount: floorCountColor } = require('../color-formatters') -const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') - -module.exports = class VaadinDirectoryRating extends ( +export default class VaadinDirectoryRating extends ( BaseVaadinDirectoryService ) { static category = 'rating' @@ -48,4 +46,4 @@ module.exports = class VaadinDirectoryRating extends ( const { averageRating } = await this.fetch({ packageName }) return this.constructor.render({ format, score: averageRating }) } -} +}; diff --git a/services/vaadin-directory/vaadin-directory-rating.tester.js b/services/vaadin-directory/vaadin-directory-rating.tester.js index ae2466116d478..b264792252537 100644 --- a/services/vaadin-directory/vaadin-directory-rating.tester.js +++ b/services/vaadin-directory/vaadin-directory-rating.tester.js @@ -1,8 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { isStarRating } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +import {isStarRating} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('stars of component displayed in star icons') .get('/star/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-release-date.service.js b/services/vaadin-directory/vaadin-directory-release-date.service.js index 7d9b9a9f3e5da..8080b49cab4a5 100644 --- a/services/vaadin-directory/vaadin-directory-release-date.service.js +++ b/services/vaadin-directory/vaadin-directory-release-date.service.js @@ -1,10 +1,8 @@ -'use strict' +import {formatDate} from '../text-formatters.js'; +import {age as ageColor} from '../color-formatters.js'; +import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; -const { formatDate } = require('../text-formatters') -const { age: ageColor } = require('../color-formatters') -const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') - -module.exports = class VaadinDirectoryReleaseDate extends ( +export default class VaadinDirectoryReleaseDate extends ( BaseVaadinDirectoryService ) { static category = 'activity' @@ -38,4 +36,4 @@ module.exports = class VaadinDirectoryReleaseDate extends ( date: data.latestAvailableRelease.publicationDate, }) } -} +}; diff --git a/services/vaadin-directory/vaadin-directory-release-date.tester.js b/services/vaadin-directory/vaadin-directory-release-date.tester.js index f5102380ea68b..823391bd345a6 100644 --- a/services/vaadin-directory/vaadin-directory-release-date.tester.js +++ b/services/vaadin-directory/vaadin-directory-release-date.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isFormattedDate } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isFormattedDate} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('latest release date of the component (format: yyyy-mm-dd)') .get('/rd/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-status.service.js b/services/vaadin-directory/vaadin-directory-status.service.js index 12263e62859eb..a7c3c5ff42621 100644 --- a/services/vaadin-directory/vaadin-directory-status.service.js +++ b/services/vaadin-directory/vaadin-directory-status.service.js @@ -1,8 +1,6 @@ -'use strict' +import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; -const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') - -module.exports = class VaadinDirectoryStatus extends ( +export default class VaadinDirectoryStatus extends ( BaseVaadinDirectoryService ) { static category = 'other' @@ -36,4 +34,4 @@ module.exports = class VaadinDirectoryStatus extends ( const { status } = await this.fetch({ packageName }) return this.constructor.render({ status }) } -} +}; diff --git a/services/vaadin-directory/vaadin-directory-status.tester.js b/services/vaadin-directory/vaadin-directory-status.tester.js index 770d35a97a21f..e6fcb4e459945 100644 --- a/services/vaadin-directory/vaadin-directory-status.tester.js +++ b/services/vaadin-directory/vaadin-directory-status.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) t.create('publish status of the component') .get('/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-version.service.js b/services/vaadin-directory/vaadin-directory-version.service.js index 0ebbaadc13925..c1897383467a3 100644 --- a/services/vaadin-directory/vaadin-directory-version.service.js +++ b/services/vaadin-directory/vaadin-directory-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; -const { renderVersionBadge } = require('../version') -const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') - -module.exports = class VaadinDirectoryVersion extends ( +export default class VaadinDirectoryVersion extends ( BaseVaadinDirectoryService ) { static category = 'version' @@ -32,4 +30,4 @@ module.exports = class VaadinDirectoryVersion extends ( const lv = data.latestAvailableRelease.name.toLowerCase() return renderVersionBadge({ version: lv }) } -} +}; diff --git a/services/vaadin-directory/vaadin-directory-version.tester.js b/services/vaadin-directory/vaadin-directory-version.tester.js index 51d6c61269e7a..18708b2ae3e11 100644 --- a/services/vaadin-directory/vaadin-directory-version.tester.js +++ b/services/vaadin-directory/vaadin-directory-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isSemver } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import {isSemver} from '../test-validators.js'; +const t = (function() { + export default __a; +}()) t.create('latest version of the component (can have v prefixed or without)') .get('/v/vaadinvaadin-grid.json') diff --git a/services/validators.js b/services/validators.js index 1017a9988445c..22c7410af3aec 100644 --- a/services/validators.js +++ b/services/validators.js @@ -1,11 +1,9 @@ -'use strict' - -const { semver, semverRange } = require('joi-extension-semver') +import {semver, semverRange} from 'joi-extension-semver'; const Joi = require('joi').extend(semver).extend(semverRange) const optionalNonNegativeInteger = Joi.number().integer().min(0) -module.exports = { +export default { optionalNonNegativeInteger, nonNegativeInteger: optionalNonNegativeInteger.required(), @@ -23,4 +21,4 @@ module.exports = { // TODO This accepts URLs with query strings and fragments, which for some // purposes should be rejected. optionalUrl: Joi.string().uri({ scheme: ['http', 'https'] }), -} +}; diff --git a/services/version.js b/services/version.js index bd71881311ba8..a19a5ab079125 100644 --- a/services/version.js +++ b/services/version.js @@ -5,11 +5,9 @@ * * For utilities specific to PHP version ranges, see php-version.js. */ -'use strict' - -const semver = require('semver') -const { addv } = require('./text-formatters') -const { version: versionColor } = require('./color-formatters') +import semver from 'semver'; +import {addv} from './text-formatters.js'; +import {version as versionColor} from './color-formatters.js'; function listCompare(a, b) { const alen = a.length @@ -162,10 +160,10 @@ function renderVersionBadge({ version, tag, defaultLabel }) { } } -module.exports = { +export default { latest, listCompare, slice, rangeStart, renderVersionBadge, -} +}; diff --git a/services/version.spec.js b/services/version.spec.js index f447f43ac87f3..f8d7c57141ea1 100644 --- a/services/version.spec.js +++ b/services/version.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { latest, slice, rangeStart, renderVersionBadge } = require('./version') +import {test, given} from 'sazerac'; +import {latest, slice, rangeStart, renderVersionBadge} from './version.js'; const includePre = true describe('Version helpers', function () { diff --git a/services/versioneye/versioneye.service.js b/services/versioneye/versioneye.service.js index 8fa1d3ce356b7..1ae838cd0186e 100644 --- a/services/versioneye/versioneye.service.js +++ b/services/versioneye/versioneye.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'downloads', route: { base: 'versioneye/d', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ }, label: 'versioneye', dateAdded: new Date('2018-08-20'), -}) +}); diff --git a/services/versioneye/versioneye.tester.js b/services/versioneye/versioneye.tester.js index 8523ffa54bfdc..33f0713933bd2 100644 --- a/services/versioneye/versioneye.tester.js +++ b/services/versioneye/versioneye.tester.js @@ -1,9 +1,7 @@ -'use strict' - -const { ServiceTester } = require('../tester') +import {ServiceTester} from '../tester.js'; const t = new ServiceTester({ id: 'versioneye', title: 'VersionEye' }) -module.exports = t +export default t; t.create('no longer available (previously dependencies status)') .get('/d/ruby/rails.json') diff --git a/services/visual-studio-app-center/visual-studio-app-center-base.js b/services/visual-studio-app-center/visual-studio-app-center-base.js index a4c10f75da757..5c623ab3bab5d 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-base.js +++ b/services/visual-studio-app-center/visual-studio-app-center-base.js @@ -1,6 +1,4 @@ -'use strict' - -const { BaseJsonService } = require('..') +import {BaseJsonService} from '..'; const keywords = [ 'visual-studio', @@ -37,4 +35,4 @@ class BaseVisualStudioAppCenterService extends BaseJsonService { } } -module.exports = { keywords, documentation, BaseVisualStudioAppCenterService } +export default { keywords, documentation, BaseVisualStudioAppCenterService }; diff --git a/services/visual-studio-app-center/visual-studio-app-center-builds.service.js b/services/visual-studio-app-center/visual-studio-app-center-builds.service.js index da790f24d460a..b7f452774ece4 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-builds.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-builds.service.js @@ -1,19 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { NotFound } = require('..') -const { - BaseVisualStudioAppCenterService, - keywords, - documentation, -} = require('./visual-studio-app-center-base') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {NotFound} from '..'; +import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; const schema = Joi.array().items({ result: isBuildStatus.required(), }) -module.exports = class VisualStudioAppCenterBuilds extends ( +export default class VisualStudioAppCenterBuilds extends ( BaseVisualStudioAppCenterService ) { static category = 'build' @@ -53,4 +47,4 @@ module.exports = class VisualStudioAppCenterBuilds extends ( throw new NotFound({ prettyMessage: 'no builds found' }) return renderBuildStatusBadge({ status: json[0].result }) } -} +}; diff --git a/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js b/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js index 062285493987c..ea631afa0cf3b 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) // Mocked response rather than real data as old builds are deleted after some time. t.create('Valid Build') diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js index c7960c4ea62ca..9185092b94b5e 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js @@ -1,18 +1,12 @@ -'use strict' - -const Joi = require('joi') -const { - BaseVisualStudioAppCenterService, - keywords, - documentation, -} = require('./visual-studio-app-center-base') +import Joi from 'joi'; +import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; const schema = Joi.object({ app_os: Joi.string().required(), min_os: Joi.string().required(), }).required() -module.exports = class VisualStudioAppCenterReleasesOSVersion extends ( +export default class VisualStudioAppCenterReleasesOSVersion extends ( BaseVisualStudioAppCenterService ) { static category = 'version' @@ -57,4 +51,4 @@ module.exports = class VisualStudioAppCenterReleasesOSVersion extends ( }) return this.constructor.render({ appOS, minOS }) } -} +}; diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js index e2a590794892a..979aec31ca983 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) // Note: // Unfortunately an Invalid user, invalid project, valid API token test is not possible due to the way Microsoft cache their responses. diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js b/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js index 4fff5e2ecb028..f7c9b064edd00 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js @@ -1,19 +1,13 @@ -'use strict' - -const Joi = require('joi') -const prettyBytes = require('pretty-bytes') -const { nonNegativeInteger } = require('../validators') -const { - BaseVisualStudioAppCenterService, - keywords, - documentation, -} = require('./visual-studio-app-center-base') +import Joi from 'joi'; +import prettyBytes from 'pretty-bytes'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; const schema = Joi.object({ size: nonNegativeInteger, }).required() -module.exports = class VisualStudioAppCenterReleasesSize extends ( +export default class VisualStudioAppCenterReleasesSize extends ( BaseVisualStudioAppCenterService ) { static category = 'size' @@ -52,4 +46,4 @@ module.exports = class VisualStudioAppCenterReleasesSize extends ( const { size } = await this.fetch({ owner, app, token, schema }) return this.constructor.render({ size }) } -} +}; diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js index e3b2964e9b743..150fe1aa2cf64 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isFileSize } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isFileSize} from '../test-validators.js'; t.create('8368844 bytes to 8.37 megabytes') .get('/nock/nock/nock.json') diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js b/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js index 7316fb044819b..576aab96fc4a2 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js @@ -1,19 +1,13 @@ -'use strict' - -const Joi = require('joi') -const { renderVersionBadge } = require('../version') -const { - BaseVisualStudioAppCenterService, - keywords, - documentation, -} = require('./visual-studio-app-center-base') +import Joi from 'joi'; +import {renderVersionBadge} from '../version.js'; +import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; const schema = Joi.object({ version: Joi.string().required(), short_version: Joi.string().required(), }).required() -module.exports = class VisualStudioAppCenterReleasesVersion extends ( +export default class VisualStudioAppCenterReleasesVersion extends ( BaseVisualStudioAppCenterService ) { static category = 'version' @@ -52,4 +46,4 @@ module.exports = class VisualStudioAppCenterReleasesVersion extends ( version: `${shortVersion} (${version})`, }) } -} +}; diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js index 47dd1b650e12d..a1fc24d0c471e 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) // Note: // Unfortunately an Invalid user, invalid project, valid API token test is not possible due to the way Microsoft cache their responses. diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js index 5765adc403397..b1756bf642734 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js @@ -1,8 +1,6 @@ -'use strict' - -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; const documentation = `

@@ -14,7 +12,7 @@ const documentation = ` // This service exists separately from the other Marketplace downloads badges (in ./visual-studio-marketplace-downloads.js) // due differences in how the Marketplace tracks metrics for Azure DevOps extensions vs. other extension types. // See https://github.com/badges/shields/pull/2748 for more information on the discussion and decision. -module.exports = class VisualStudioMarketplaceAzureDevOpsInstalls extends ( +export default class VisualStudioMarketplaceAzureDevOpsInstalls extends ( VisualStudioMarketplaceBase ) { static category = 'downloads' @@ -62,4 +60,4 @@ module.exports = class VisualStudioMarketplaceAzureDevOpsInstalls extends ( return this.constructor.render({ count: statistics.onpremDownloads }) } } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js index 741722d819910..baccf3681efc5 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; const mockResponse = { results: [ diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-base.js b/services/visual-studio-marketplace/visual-studio-marketplace-base.js index 12a7218129d21..7d66defbef893 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-base.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const validate = require('../../core/base-service/validate') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import validate from '../../core/base-service/validate.js'; +import {BaseJsonService, NotFound} from '..'; const extensionQuerySchema = Joi.object({ results: Joi.array() @@ -45,7 +43,7 @@ const statisticSchema = Joi.object().keys({ ratingcount: Joi.number().default(0), }) -module.exports = class VisualStudioMarketplaceBase extends BaseJsonService { +export default class VisualStudioMarketplaceBase extends BaseJsonService { static keywords = [ 'vscode', 'tfs', @@ -110,4 +108,4 @@ module.exports = class VisualStudioMarketplaceBase extends BaseJsonService { return { statistics: value } } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js index 71e459f25390d..c0848974b7af6 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js @@ -1,8 +1,6 @@ -'use strict' - -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; const documentation = `

@@ -13,7 +11,7 @@ const documentation = `

` -module.exports = class VisualStudioMarketplaceDownloads extends ( +export default class VisualStudioMarketplaceDownloads extends ( VisualStudioMarketplaceBase ) { static category = 'downloads' @@ -62,4 +60,4 @@ module.exports = class VisualStudioMarketplaceDownloads extends ( : statistics.install + statistics.updateCount return this.constructor.render({ measure, count }) } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js index 9c6b775de7b0d..3303eae143f6a 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isMetric} from '../test-validators.js'; const mockResponse = { results: [ diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js index db4b5300a7e1e..9ce7bbce05633 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js @@ -1,10 +1,8 @@ -'use strict' +import {age} from '../color-formatters.js'; +import {formatDate} from '../text-formatters.js'; +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; -const { age } = require('../color-formatters') -const { formatDate } = require('../text-formatters') -const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') - -module.exports = class VisualStudioMarketplaceLastUpdated extends ( +export default class VisualStudioMarketplaceLastUpdated extends ( VisualStudioMarketplaceBase ) { static category = 'activity' @@ -47,4 +45,4 @@ module.exports = class VisualStudioMarketplaceLastUpdated extends ( const { lastUpdated } = this.transform({ json }) return this.constructor.render({ lastUpdated }) } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js index 5588f0fdbdaba..15d18bc021e4f 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isFormattedDate } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isFormattedDate} from '../test-validators.js'; t.create('date') .get('/visual-studio-marketplace/last-updated/yasht.terminal-all-in-one.json') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js index 3c9f4312e56b5..117f2d604b6ca 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js @@ -1,10 +1,8 @@ -'use strict' +import {starRating} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; -const { starRating } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') - -module.exports = class VisualStudioMarketplaceRating extends ( +export default class VisualStudioMarketplaceRating extends ( VisualStudioMarketplaceBase ) { static category = 'rating' @@ -63,4 +61,4 @@ module.exports = class VisualStudioMarketplaceRating extends ( ratingCount: statistics.ratingcount, }) } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js index 7457cbc753914..ffde1a841731d 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex, isStarRating } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {withRegex, isStarRating} from '../test-validators.js'; const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js index 4a3bb5d0554fe..9f8d82dbfde93 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js @@ -1,10 +1,8 @@ -'use strict' +import {age} from '../color-formatters.js'; +import {formatDate} from '../text-formatters.js'; +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; -const { age } = require('../color-formatters') -const { formatDate } = require('../text-formatters') -const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') - -module.exports = class VisualStudioMarketplaceReleaseDate extends ( +export default class VisualStudioMarketplaceReleaseDate extends ( VisualStudioMarketplaceBase ) { static category = 'activity' @@ -47,4 +45,4 @@ module.exports = class VisualStudioMarketplaceReleaseDate extends ( const { releaseDate } = this.transform({ json }) return this.constructor.render({ releaseDate }) } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js index 6469ab49c97ad..f8c0413e09977 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isFormattedDate } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {isFormattedDate} from '../test-validators.js'; t.create('date') .get('/visual-studio-marketplace/release-date/yasht.terminal-all-in-one.json') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js index 3d4eff80d4920..d7877a89f9d3f 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js @@ -1,9 +1,7 @@ -'use strict' +import {renderVersionBadge} from '../version.js'; +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; -const { renderVersionBadge } = require('../version') -const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') - -module.exports = class VisualStudioMarketplaceVersion extends ( +export default class VisualStudioMarketplaceVersion extends ( VisualStudioMarketplaceBase ) { static category = 'version' @@ -43,4 +41,4 @@ module.exports = class VisualStudioMarketplaceVersion extends ( return this.constructor.render({ version }) } -} +}; diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js index 6e026eb69928d..109a478a2a56a 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { withRegex } = require('../test-validators') +const t = (function() { + export default __a; +}()) +import {withRegex} from '../test-validators.js'; const isMarketplaceVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/w3c/w3c-validation-helper.js b/services/w3c/w3c-validation-helper.js index 3f0a75f4016db..19aa2bbaa7980 100644 --- a/services/w3c/w3c-validation-helper.js +++ b/services/w3c/w3c-validation-helper.js @@ -1,5 +1,3 @@ -'use strict' - const html5Expression = '^HTML\\s?,\\s?SVG\\s?1\\.1\\s?,\\s?MathML\\s?3\\.0(\\s?,\\s?((ITS\\s?2\\.0)|(RDFa\\s?Lite\\s?1\\.1)))?$' const html4Expression = @@ -147,10 +145,10 @@ const documentation = `

` -module.exports = { +export default { documentation, presetRegex, getColor, getMessage, getSchema, -} +}; diff --git a/services/w3c/w3c-validation-helper.spec.js b/services/w3c/w3c-validation-helper.spec.js index 819f1afd53969..6622d5e008633 100644 --- a/services/w3c/w3c-validation-helper.spec.js +++ b/services/w3c/w3c-validation-helper.spec.js @@ -1,12 +1,6 @@ -'use strict' -const { expect } = require('chai') -const { test, given, forCases } = require('sazerac') -const { - presetRegex, - getMessage, - getColor, - getSchema, -} = require('./w3c-validation-helper') +import {expect} from 'chai'; +import {test, given, forCases} from 'sazerac'; +import {presetRegex, getMessage, getColor, getSchema} from './w3c-validation-helper.js'; describe('w3c-validation-helper', function () { describe('presetRegex', function () { diff --git a/services/w3c/w3c-validation.service.js b/services/w3c/w3c-validation.service.js index a0482c5002d21..f5dcb3c75070b 100644 --- a/services/w3c/w3c-validation.service.js +++ b/services/w3c/w3c-validation.service.js @@ -1,14 +1,7 @@ -'use strict' -const Joi = require('joi') -const { optionalUrl } = require('../validators') -const { BaseJsonService, NotFound } = require('..') -const { - documentation, - presetRegex, - getColor, - getMessage, - getSchema, -} = require('./w3c-validation-helper') +import Joi from 'joi'; +import {optionalUrl} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; +import {documentation, presetRegex, getColor, getMessage, getSchema} from './w3c-validation-helper.js'; const schema = Joi.object({ url: Joi.string().optional(), @@ -30,7 +23,7 @@ const queryParamSchema = Joi.object({ preset: Joi.string().regex(presetRegex).allow(''), }).required() -module.exports = class W3cValidation extends BaseJsonService { +export default class W3cValidation extends BaseJsonService { static category = 'analysis' static route = { @@ -123,4 +116,4 @@ module.exports = class W3cValidation extends BaseJsonService { messageTypes: this.transform(url, messages), }) } -} +}; diff --git a/services/w3c/w3c-validation.tester.js b/services/w3c/w3c-validation.tester.js index 4dc93b6e0d76a..1cdefe8fbbaac 100644 --- a/services/w3c/w3c-validation.tester.js +++ b/services/w3c/w3c-validation.tester.js @@ -1,6 +1,7 @@ -'use strict' -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) const isErrorOnly = Joi.string().regex(/^[0-9]+ errors?$/) diff --git a/services/waffle/waffle-label-redirect.service.js b/services/waffle/waffle-label-redirect.service.js index 0275bc1d5cbf3..fc8c0d16366b9 100644 --- a/services/waffle/waffle-label-redirect.service.js +++ b/services/waffle/waffle-label-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = [ +export default [ // The WaffleLabel service originally had 'label' as an optional parameter // with a default value of 'ready'. However, after some discussion it was // agreed that 'ready' didn't make sense as a default, nor was there any other @@ -18,4 +16,4 @@ module.exports = [ transformPath: ({ user, repo }) => `/waffle/label/${user}/${repo}/ready`, dateAdded: new Date('2019-03-05'), }), -] +]; diff --git a/services/waffle/waffle-label-redirect.tester.js b/services/waffle/waffle-label-redirect.tester.js index fb1b0cd6cabfa..3180f6fb53270 100644 --- a/services/waffle/waffle-label-redirect.tester.js +++ b/services/waffle/waffle-label-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'WaffleLabelRedirect', - title: 'WaffleLabelRedirect', - pathPrefix: '/waffle/label', -})) +const t = (function() { + export default __a; +}()) t.create('waffle label redirect') .get('/waffleio/waffle.io.svg') diff --git a/services/waffle/waffle-label.service.js b/services/waffle/waffle-label.service.js index de28fb92643e2..19718dcbe6239 100644 --- a/services/waffle/waffle-label.service.js +++ b/services/waffle/waffle-label.service.js @@ -1,8 +1,6 @@ -'use strict' +import {deprecatedService} from '..'; -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ route: { base: 'waffle/label', pattern: ':various*', @@ -10,4 +8,4 @@ module.exports = deprecatedService({ label: 'waffle', category: 'issue-tracking', dateAdded: new Date('2019-05-21'), -}) +}); diff --git a/services/waffle/waffle-label.tester.js b/services/waffle/waffle-label.tester.js index 98158d93fc8ff..995ef96d1c41f 100644 --- a/services/waffle/waffle-label.tester.js +++ b/services/waffle/waffle-label.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'Waffle', - title: 'WaffleLabel', - pathPrefix: '/waffle/label', -})) +const t = (function() { + export default __a; +}()) t.create('no longer available') .get('/ritwickdey/vscode-live-server/bug.json') diff --git a/services/website-status.js b/services/website-status.js index c22cf690bde61..3e6896d0eac25 100644 --- a/services/website-status.js +++ b/services/website-status.js @@ -1,6 +1,4 @@ -'use strict' - -const Joi = require('joi') +import Joi from 'joi'; const queryParamSchema = Joi.object({ up_message: Joi.string(), @@ -30,8 +28,8 @@ function renderWebsiteStatus({ } } -module.exports = { +export default { queryParamSchema, exampleQueryParams, renderWebsiteStatus, -} +}; diff --git a/services/website-status.spec.js b/services/website-status.spec.js index d87f33a4a0003..b1473c9f7f54c 100644 --- a/services/website-status.spec.js +++ b/services/website-status.spec.js @@ -1,7 +1,5 @@ -'use strict' - -const { test, given } = require('sazerac') -const { renderWebsiteStatus } = require('./website-status') +import {test, given} from 'sazerac'; +import {renderWebsiteStatus} from './website-status.js'; describe('Website status helpers', function () { const customOptions = { diff --git a/services/website/website-redirect.service.js b/services/website/website-redirect.service.js index f2597dd1ceb72..b43aae3bba3a1 100644 --- a/services/website/website-redirect.service.js +++ b/services/website/website-redirect.service.js @@ -1,14 +1,10 @@ -'use strict' - -const { escapeFormat } = require('../../core/badge-urls/path-helpers') -const { redirector } = require('..') +import {escapeFormat} from '../../core/badge-urls/path-helpers.js'; +import {redirector} from '..'; function escapeFormatSlashes(t) { - return ( - escapeFormat(t) - // Double slash - .replace(/\/\//g, '/') - ) + return escapeFormat(t) + // Double slash + .replace(/\/\//g, '/'); } /* @@ -51,7 +47,7 @@ Old documentation, for reference:

*/ -module.exports = [ +export default [ redirector({ category: 'monitoring', route: { @@ -104,4 +100,4 @@ module.exports = [ }), dateAdded: new Date('2019-09-17'), }), -] +]; diff --git a/services/website/website-redirect.tester.js b/services/website/website-redirect.tester.js index 4e0b27bca2d73..fdc76b3d13c03 100644 --- a/services/website/website-redirect.tester.js +++ b/services/website/website-redirect.tester.js @@ -1,12 +1,8 @@ -'use strict' +import {ServiceTester} from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'WebsiteRedirect', - title: 'WebsiteRedirect', - pathPrefix: '', -})) +const t = (function() { + export default __a; +}()) t.create('Website with custom messages') .get('/website-up-down/https/www.google.com.svg') diff --git a/services/website/website.service.js b/services/website/website.service.js index 0a9b278daa135..4ea20bc26079b 100644 --- a/services/website/website.service.js +++ b/services/website/website.service.js @@ -1,15 +1,9 @@ -'use strict' - -const Joi = require('joi') -const emojic = require('emojic') -const { optionalUrl } = require('../validators') -const { - queryParamSchema, - exampleQueryParams, - renderWebsiteStatus, -} = require('../website-status') -const { BaseService } = require('..') -const trace = require('../../core/base-service/trace') +import Joi from 'joi'; +import emojic from 'emojic'; +import {optionalUrl} from '../validators.js'; +import {queryParamSchema, exampleQueryParams, renderWebsiteStatus} from '../website-status.js'; +import {BaseService} from '..'; +import trace from '../../core/base-service/trace.js'; const documentation = `

@@ -35,7 +29,7 @@ const urlQueryParamSchema = Joi.object({ url: optionalUrl.required(), }).required() -module.exports = class Website extends BaseService { +export default class Website extends BaseService { static category = 'monitoring' static route = { @@ -105,4 +99,4 @@ module.exports = class Website extends BaseService { downColor, }) } -} +}; diff --git a/services/website/website.tester.js b/services/website/website.tester.js index f60fafbd2ac89..ded23b550487d 100644 --- a/services/website/website.tester.js +++ b/services/website/website.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('status of http://shields.io') .get('/website.json?url=http://shields.io') diff --git a/services/wercker/wercker.service.js b/services/wercker/wercker.service.js index 94bb3288ffbd2..0ffe42d732860 100644 --- a/services/wercker/wercker.service.js +++ b/services/wercker/wercker.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; +import {BaseJsonService} from '..'; const werckerSchema = Joi.array() .items( @@ -32,7 +30,7 @@ const werckerCIDocumentation = `

` -module.exports = class Wercker extends BaseJsonService { +export default class Wercker extends BaseJsonService { static category = 'build' static route = { @@ -126,4 +124,4 @@ module.exports = class Wercker extends BaseJsonService { const { result } = json[0] return this.constructor.render({ result }) } -} +}; diff --git a/services/wercker/wercker.tester.js b/services/wercker/wercker.tester.js index 28cba83661019..7cb159c44bb2f 100644 --- a/services/wercker/wercker.tester.js +++ b/services/wercker/wercker.tester.js @@ -1,7 +1,7 @@ -'use strict' - -const { isBuildStatus } = require('../build-status') -const t = (module.exports = require('../tester').createServiceTester()) +import {isBuildStatus} from '../build-status.js'; +const t = (function() { + export default __a; +}()) t.create('Build status') .get('/build/wercker/go-wercker-api.json') diff --git a/services/wheelmap/wheelmap.service.js b/services/wheelmap/wheelmap.service.js index 1973d0b326c42..43f2e4f6b2a0b 100644 --- a/services/wheelmap/wheelmap.service.js +++ b/services/wheelmap/wheelmap.service.js @@ -1,7 +1,5 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') +import Joi from 'joi'; +import {BaseJsonService} from '..'; const schema = Joi.object({ node: Joi.object({ @@ -9,7 +7,7 @@ const schema = Joi.object({ }).required(), }).required() -module.exports = class Wheelmap extends BaseJsonService { +export default class Wheelmap extends BaseJsonService { static category = 'other' static route = { @@ -66,4 +64,4 @@ module.exports = class Wheelmap extends BaseJsonService { const accessibility = json.node.wheelchair return this.constructor.render({ accessibility }) } -} +}; diff --git a/services/wheelmap/wheelmap.spec.js b/services/wheelmap/wheelmap.spec.js index 41b80594b4afa..20c4eeee36d3f 100644 --- a/services/wheelmap/wheelmap.spec.js +++ b/services/wheelmap/wheelmap.spec.js @@ -1,9 +1,7 @@ -'use strict' - -const { expect } = require('chai') -const nock = require('nock') -const { cleanUpNockAfterEach, defaultContext } = require('../test-helpers') -const Wheelmap = require('./wheelmap.service') +import {expect} from 'chai'; +import nock from 'nock'; +import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import Wheelmap from './wheelmap.service.js'; describe('Wheelmap', function () { cleanUpNockAfterEach() diff --git a/services/wheelmap/wheelmap.tester.js b/services/wheelmap/wheelmap.tester.js index 1a618029fd413..2bc5c97011669 100644 --- a/services/wheelmap/wheelmap.tester.js +++ b/services/wheelmap/wheelmap.tester.js @@ -1,8 +1,9 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { noToken } = require('../test-helpers') -const noWheelmapToken = noToken(require('./wheelmap.service')) +const t = (function() { + export default __a; +}()) +import {noToken} from '../test-helpers.js'; +import _noWheelmapToken from './wheelmap.service'; +const noWheelmapToken = noToken(_noWheelmapToken); t.create('node with accessibility') .skipWhen(noWheelmapToken) diff --git a/services/wordpress/wordpress-base.js b/services/wordpress/wordpress-base.js index 36a04628e4bfd..f807879402d15 100644 --- a/services/wordpress/wordpress-base.js +++ b/services/wordpress/wordpress-base.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { nonNegativeInteger } = require('../validators') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi'; +import {nonNegativeInteger} from '../validators.js'; +import {BaseJsonService, NotFound} from '..'; const stringOrFalse = Joi.alternatives(Joi.string(), Joi.bool()) @@ -42,7 +40,7 @@ const notFoundSchema = Joi.object() const pluginSchemas = Joi.alternatives(pluginSchema, notFoundSchema) const themeSchemas = Joi.alternatives(themeSchema, notFoundSchema) -module.exports = class BaseWordpress extends BaseJsonService { +export default class BaseWordpress extends BaseJsonService { async fetch({ extensionType, slug }) { const url = `https://api.wordpress.org/${extensionType}s/info/1.2/` let schemas @@ -81,4 +79,4 @@ module.exports = class BaseWordpress extends BaseJsonService { } return json } -} +}; diff --git a/services/wordpress/wordpress-downloads.service.js b/services/wordpress/wordpress-downloads.service.js index 81a7ae3e381d0..d227a69fba66e 100644 --- a/services/wordpress/wordpress-downloads.service.js +++ b/services/wordpress/wordpress-downloads.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { downloadCount } = require('../color-formatters') -const { NotFound } = require('..') -const BaseWordpress = require('./wordpress-base') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {downloadCount} from '../color-formatters.js'; +import {NotFound} from '..'; +import BaseWordpress from './wordpress-base.js'; const dateSchema = Joi.object() .pattern(Joi.date().iso(), Joi.number().integer()) @@ -158,4 +156,4 @@ function InstallsForExtensionType(extensionType) { const downloadServices = ['plugin', 'theme'].map(DownloadsForExtensionType) const installServices = ['plugin', 'theme'].map(InstallsForExtensionType) const modules = [...downloadServices, ...installServices] -module.exports = modules +export default modules; diff --git a/services/wordpress/wordpress-downloads.tester.js b/services/wordpress/wordpress-downloads.tester.js index 21b48fcd08594..f04a2cfbe90dd 100644 --- a/services/wordpress/wordpress-downloads.tester.js +++ b/services/wordpress/wordpress-downloads.tester.js @@ -1,13 +1,11 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isMetric, isMetricOverTimePeriod } = require('../test-validators') +import {ServiceTester} from '../tester.js'; +import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; const t = new ServiceTester({ id: 'wordpress', title: 'WordPress Download Tests', }) -module.exports = t +export default t; t.create('Plugin Downloads - Total') .get('/plugin/dt/akismet.json') diff --git a/services/wordpress/wordpress-last-update.service.js b/services/wordpress/wordpress-last-update.service.js index cbf018d9319a3..9a987e178f838 100644 --- a/services/wordpress/wordpress-last-update.service.js +++ b/services/wordpress/wordpress-last-update.service.js @@ -1,10 +1,8 @@ -'use strict' - -const moment = require('moment') -const { InvalidResponse } = require('..') -const { formatDate } = require('../text-formatters') -const { age: ageColor } = require('../color-formatters') -const BaseWordpress = require('./wordpress-base') +import moment from 'moment'; +import {InvalidResponse} from '..'; +import {formatDate} from '../text-formatters.js'; +import {age as ageColor} from '../color-formatters.js'; +import BaseWordpress from './wordpress-base.js'; const extensionData = { plugin: { @@ -76,4 +74,4 @@ function LastUpdateForType(extensionType) { } const lastupdate = ['plugin', 'theme'].map(LastUpdateForType) -module.exports = [...lastupdate] +export default [...lastupdate]; diff --git a/services/wordpress/wordpress-last-update.tester.js b/services/wordpress/wordpress-last-update.tester.js index 9301a0d6267b1..e02a0c021905f 100644 --- a/services/wordpress/wordpress-last-update.tester.js +++ b/services/wordpress/wordpress-last-update.tester.js @@ -1,13 +1,11 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isFormattedDate } = require('../test-validators') +import {ServiceTester} from '../tester.js'; +import {isFormattedDate} from '../test-validators.js'; const t = new ServiceTester({ id: 'wordpress', title: 'WordPress Last Update', }) -module.exports = t +export default t; t.create('Plugin Last Update') .get('/plugin/last-updated/akismet.json') diff --git a/services/wordpress/wordpress-platform-redirect.service.js b/services/wordpress/wordpress-platform-redirect.service.js index 10b74f8d99893..814e388459db5 100644 --- a/services/wordpress/wordpress-platform-redirect.service.js +++ b/services/wordpress/wordpress-platform-redirect.service.js @@ -1,8 +1,6 @@ -'use strict' +import {redirector} from '..'; -const { redirector } = require('..') - -module.exports = redirector({ +export default redirector({ category: 'platform-support', route: { base: 'wordpress/v', @@ -10,4 +8,4 @@ module.exports = redirector({ }, transformPath: ({ slug }) => `/wordpress/plugin/tested/${slug}`, dateAdded: new Date('2019-04-17'), -}) +}); diff --git a/services/wordpress/wordpress-platform-redirect.tester.js b/services/wordpress/wordpress-platform-redirect.tester.js index 2e665cadb9266..91c3527fa5301 100644 --- a/services/wordpress/wordpress-platform-redirect.tester.js +++ b/services/wordpress/wordpress-platform-redirect.tester.js @@ -1,6 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +const t = (function() { + export default __a; +}()) t.create('Plugin Tested WP Version (Alias)') .get('/akismet.svg') diff --git a/services/wordpress/wordpress-platform.service.js b/services/wordpress/wordpress-platform.service.js index cca782975c558..00b19bd1cb00e 100644 --- a/services/wordpress/wordpress-platform.service.js +++ b/services/wordpress/wordpress-platform.service.js @@ -1,10 +1,8 @@ -'use strict' - -const { NotFound } = require('..') -const { addv } = require('../text-formatters') -const { version: versionColor } = require('../color-formatters') -const BaseWordpress = require('./wordpress-base') -const { versionColorForWordpressVersion } = require('./wordpress-version-color') +import {NotFound} from '..'; +import {addv} from '../text-formatters.js'; +import {version as versionColor} from '../color-formatters.js'; +import BaseWordpress from './wordpress-base.js'; +import {versionColorForWordpressVersion} from './wordpress-version-color.js'; const extensionData = { plugin: { @@ -164,8 +162,8 @@ function RequiresPHPVersionForType(extensionType) { const requiredPhp = ['plugin', 'theme'].map(RequiresPHPVersionForType) const requiresVersion = ['plugin', 'theme'].map(WordpressRequiresVersion) -module.exports = [ +export default [ ...requiredPhp, ...requiresVersion, WordpressPluginTestedVersion, -] +]; diff --git a/services/wordpress/wordpress-platform.tester.js b/services/wordpress/wordpress-platform.tester.js index 43e7edb27287b..42d394be28e4d 100644 --- a/services/wordpress/wordpress-platform.tester.js +++ b/services/wordpress/wordpress-platform.tester.js @@ -1,17 +1,10 @@ -'use strict' - -const Joi = require('joi') -const { ServiceTester } = require('../tester') -const { - isVPlusDottedVersionAtLeastOne, - isComposerVersion, -} = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'WordpressPlatform', - title: 'WordPress Platform Tests', - pathPrefix: '/wordpress', -})) +import Joi from 'joi'; +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionAtLeastOne, isComposerVersion} from '../test-validators.js'; + +const t = (function() { + export default __a; +}()) t.create('Plugin Required WP Version') .get('/plugin/wp-version/akismet.json') diff --git a/services/wordpress/wordpress-rating.service.js b/services/wordpress/wordpress-rating.service.js index 843915f1e5ab6..9ee53b6428c3d 100644 --- a/services/wordpress/wordpress-rating.service.js +++ b/services/wordpress/wordpress-rating.service.js @@ -1,8 +1,6 @@ -'use strict' - -const { starRating, metric } = require('../text-formatters') -const { floorCount } = require('../color-formatters') -const BaseWordpress = require('./wordpress-base') +import {starRating, metric} from '../text-formatters.js'; +import {floorCount} from '../color-formatters.js'; +import BaseWordpress from './wordpress-base.js'; const extensionData = { plugin: { @@ -103,4 +101,4 @@ const ratingsServices = ['plugin', 'theme'].map(RatingForExtensionType) const starsServices = ['plugin', 'theme'].map(StarsForExtensionType) const modules = [...ratingsServices, ...starsServices] -module.exports = modules +export default modules; diff --git a/services/wordpress/wordpress-rating.tester.js b/services/wordpress/wordpress-rating.tester.js index a1e1b8c3bae2b..bfb0daa0c9af8 100644 --- a/services/wordpress/wordpress-rating.tester.js +++ b/services/wordpress/wordpress-rating.tester.js @@ -1,13 +1,11 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isStarRating } = require('../test-validators') +import {ServiceTester} from '../tester.js'; +import {isStarRating} from '../test-validators.js'; const t = new ServiceTester({ id: 'wordpress', title: 'WordPress Rating Tests', }) -module.exports = t +export default t; t.create('Plugin Rating - Stars') .get('/plugin/stars/akismet.json') diff --git a/services/wordpress/wordpress-version-color.js b/services/wordpress/wordpress-version-color.js index fd46f718987a2..a8bd6f9457c3c 100644 --- a/services/wordpress/wordpress-version-color.js +++ b/services/wordpress/wordpress-version-color.js @@ -1,8 +1,6 @@ -'use strict' - -const { promisify } = require('util') -const semver = require('semver') -const { regularUpdate } = require('../../core/legacy/regular-update') +import {promisify} from 'util'; +import semver from 'semver'; +import {regularUpdate} from '../../core/legacy/regular-update.js'; // TODO: Incorporate this schema. // const schema = Joi.object() @@ -61,8 +59,8 @@ async function versionColorForWordpressVersion(version) { } } -module.exports = { +export default { toSemver, getOfferedVersions, versionColorForWordpressVersion, -} +}; diff --git a/services/wordpress/wordpress-version-color.spec.js b/services/wordpress/wordpress-version-color.spec.js index d7d9d8cb8635f..5f9a9210e8be0 100644 --- a/services/wordpress/wordpress-version-color.spec.js +++ b/services/wordpress/wordpress-version-color.spec.js @@ -1,10 +1,5 @@ -'use strict' - -const { expect } = require('chai') -const { - toSemver, - versionColorForWordpressVersion, -} = require('./wordpress-version-color') +import {expect} from 'chai'; +import {toSemver, versionColorForWordpressVersion} from './wordpress-version-color.js'; describe('toSemver() function', function () { it('coerces versions', function () { diff --git a/services/wordpress/wordpress-version.service.js b/services/wordpress/wordpress-version.service.js index 4980ec7f6a4e2..4127759b5ba4b 100644 --- a/services/wordpress/wordpress-version.service.js +++ b/services/wordpress/wordpress-version.service.js @@ -1,8 +1,6 @@ -'use strict' - -const { addv } = require('../text-formatters') -const { version: versionColor } = require('../color-formatters') -const BaseWordpress = require('./wordpress-base') +import {addv} from '../text-formatters.js'; +import {version as versionColor} from '../color-formatters.js'; +import BaseWordpress from './wordpress-base.js'; function VersionForExtensionType(extensionType) { const { capt, exampleSlug } = { @@ -53,4 +51,4 @@ function VersionForExtensionType(extensionType) { } } -module.exports = ['theme', 'plugin'].map(VersionForExtensionType) +export default ['theme', 'plugin'].map(VersionForExtensionType); diff --git a/services/wordpress/wordpress-version.tester.js b/services/wordpress/wordpress-version.tester.js index e8fc1a94de078..94e419d7c5a5e 100644 --- a/services/wordpress/wordpress-version.tester.js +++ b/services/wordpress/wordpress-version.tester.js @@ -1,12 +1,9 @@ -'use strict' +import {ServiceTester} from '../tester.js'; +import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const { ServiceTester } = require('../tester') -const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ - id: 'wordpress', - title: 'WordPress Version Tests', -})) +const t = (function() { + export default __a; +}()) t.create('Plugin Version').get('/plugin/v/akismet.json').expectBadge({ label: 'plugin', diff --git a/services/youtube/youtube-base.js b/services/youtube/youtube-base.js index ad2bfd83fc3c6..58a0414840ef3 100644 --- a/services/youtube/youtube-base.js +++ b/services/youtube/youtube-base.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService, NotFound } = require('..') -const { metric } = require('../text-formatters') -const { nonNegativeInteger } = require('../validators') +import Joi from 'joi'; +import {BaseJsonService, NotFound} from '..'; +import {metric} from '../text-formatters.js'; +import {nonNegativeInteger} from '../validators.js'; const documentation = `

By using the YouTube badges provided by Shields.io, you are agreeing to be bound by the YouTube Terms of Service. These can be found here: @@ -92,4 +90,4 @@ class YouTubeChannelBase extends YouTubeBase { static type = 'channel' } -module.exports = { documentation, YouTubeVideoBase, YouTubeChannelBase } +export default { documentation, YouTubeVideoBase, YouTubeChannelBase }; diff --git a/services/youtube/youtube-channel-views.service.js b/services/youtube/youtube-channel-views.service.js index 27712d5c83ebf..599fa05d17f89 100644 --- a/services/youtube/youtube-channel-views.service.js +++ b/services/youtube/youtube-channel-views.service.js @@ -1,8 +1,6 @@ -'use strict' +import {documentation, YouTubeChannelBase} from './youtube-base.js'; -const { documentation, YouTubeChannelBase } = require('./youtube-base') - -module.exports = class YouTubeChannelViews extends YouTubeChannelBase { +export default class YouTubeChannelViews extends YouTubeChannelBase { static route = { base: 'youtube/channel/views', pattern: ':channelId', @@ -28,4 +26,4 @@ module.exports = class YouTubeChannelViews extends YouTubeChannelBase { static render({ statistics, id }) { return super.renderSingleStat({ statistics, statisticName: 'view', id }) } -} +}; diff --git a/services/youtube/youtube-channel-views.tester.js b/services/youtube/youtube-channel-views.tester.js index eab2689fd0ec7..972e61dbad600 100644 --- a/services/youtube/youtube-channel-views.tester.js +++ b/services/youtube/youtube-channel-views.tester.js @@ -1,9 +1,10 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { noToken } = require('../test-helpers') -const { isMetric } = require('../test-validators') -const noYouTubeToken = noToken(require('./youtube-channel-views.service')) +const t = (function() { + export default __a; +}()) +import {noToken} from '../test-helpers.js'; +import {isMetric} from '../test-validators.js'; +import _noYouTubeToken from './youtube-channel-views.service'; +const noYouTubeToken = noToken(_noYouTubeToken); t.create('channel view count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-comments.service.js b/services/youtube/youtube-comments.service.js index 679605684cc6a..ca8bc8143f569 100644 --- a/services/youtube/youtube-comments.service.js +++ b/services/youtube/youtube-comments.service.js @@ -1,8 +1,6 @@ -'use strict' +import {documentation, YouTubeVideoBase} from './youtube-base.js'; -const { documentation, YouTubeVideoBase } = require('./youtube-base') - -module.exports = class YouTubeComments extends YouTubeVideoBase { +export default class YouTubeComments extends YouTubeVideoBase { static route = { base: 'youtube/comments', pattern: ':videoId', @@ -28,4 +26,4 @@ module.exports = class YouTubeComments extends YouTubeVideoBase { static render({ statistics, id }) { return super.renderSingleStat({ statistics, statisticName: 'comment', id }) } -} +}; diff --git a/services/youtube/youtube-comments.tester.js b/services/youtube/youtube-comments.tester.js index dfdbde45d49c2..ac1f7ccbf3c80 100644 --- a/services/youtube/youtube-comments.tester.js +++ b/services/youtube/youtube-comments.tester.js @@ -1,9 +1,10 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { noToken } = require('../test-helpers') -const { isMetric } = require('../test-validators') -const noYouTubeToken = noToken(require('./youtube-comments.service')) +const t = (function() { + export default __a; +}()) +import {noToken} from '../test-helpers.js'; +import {isMetric} from '../test-validators.js'; +import _noYouTubeToken from './youtube-comments.service'; +const noYouTubeToken = noToken(_noYouTubeToken); t.create('video comment count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-likes.service.js b/services/youtube/youtube-likes.service.js index e2133cd392c1a..09d3ab4419654 100644 --- a/services/youtube/youtube-likes.service.js +++ b/services/youtube/youtube-likes.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { documentation, YouTubeVideoBase } = require('./youtube-base') +import Joi from 'joi'; +import {metric} from '../text-formatters.js'; +import {documentation, YouTubeVideoBase} from './youtube-base.js'; const documentationWithDislikes = ` ${documentation} @@ -16,7 +14,7 @@ const queryParamSchema = Joi.object({ withDislikes: Joi.equal(''), }).required() -module.exports = class YouTubeLikes extends YouTubeVideoBase { +export default class YouTubeLikes extends YouTubeVideoBase { static route = { base: 'youtube/likes', pattern: ':videoId', @@ -73,4 +71,4 @@ module.exports = class YouTubeLikes extends YouTubeVideoBase { } return renderedBadge } -} +}; diff --git a/services/youtube/youtube-likes.tester.js b/services/youtube/youtube-likes.tester.js index 5c266e0987323..4e12b30a27686 100644 --- a/services/youtube/youtube-likes.tester.js +++ b/services/youtube/youtube-likes.tester.js @@ -1,10 +1,11 @@ -'use strict' - -const Joi = require('joi') -const t = (module.exports = require('../tester').createServiceTester()) -const { noToken } = require('../test-helpers') -const { isMetric } = require('../test-validators') -const noYouTubeToken = noToken(require('./youtube-likes.service')) +import Joi from 'joi'; +const t = (function() { + export default __a; +}()) +import {noToken} from '../test-helpers.js'; +import {isMetric} from '../test-validators.js'; +import _noYouTubeToken from './youtube-likes.service'; +const noYouTubeToken = noToken(_noYouTubeToken); t.create('video like count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-subscribers.service.js b/services/youtube/youtube-subscribers.service.js index 408b451bae908..47bbb0e2ecf6d 100644 --- a/services/youtube/youtube-subscribers.service.js +++ b/services/youtube/youtube-subscribers.service.js @@ -1,8 +1,6 @@ -'use strict' +import {documentation, YouTubeChannelBase} from './youtube-base.js'; -const { documentation, YouTubeChannelBase } = require('./youtube-base') - -module.exports = class YouTubeSubscribes extends YouTubeChannelBase { +export default class YouTubeSubscribes extends YouTubeChannelBase { static route = { base: 'youtube/channel/subscribers', pattern: ':channelId', @@ -32,4 +30,4 @@ module.exports = class YouTubeSubscribes extends YouTubeChannelBase { id, }) } -} +}; diff --git a/services/youtube/youtube-subscribers.tester.js b/services/youtube/youtube-subscribers.tester.js index acff789b0c64b..ef5f5e6d5a464 100644 --- a/services/youtube/youtube-subscribers.tester.js +++ b/services/youtube/youtube-subscribers.tester.js @@ -1,9 +1,10 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { noToken } = require('../test-helpers') -const { isMetric } = require('../test-validators') -const noYouTubeToken = noToken(require('./youtube-subscribers.service')) +const t = (function() { + export default __a; +}()) +import {noToken} from '../test-helpers.js'; +import {isMetric} from '../test-validators.js'; +import _noYouTubeToken from './youtube-subscribers.service'; +const noYouTubeToken = noToken(_noYouTubeToken); t.create('subscriber count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-views.service.js b/services/youtube/youtube-views.service.js index 5259e6818add2..d645c35fb65ac 100644 --- a/services/youtube/youtube-views.service.js +++ b/services/youtube/youtube-views.service.js @@ -1,8 +1,6 @@ -'use strict' +import {documentation, YouTubeVideoBase} from './youtube-base.js'; -const { documentation, YouTubeVideoBase } = require('./youtube-base') - -module.exports = class YouTubeViews extends YouTubeVideoBase { +export default class YouTubeViews extends YouTubeVideoBase { static route = { base: 'youtube/views', pattern: ':videoId', @@ -28,4 +26,4 @@ module.exports = class YouTubeViews extends YouTubeVideoBase { static render({ statistics, id }) { return super.renderSingleStat({ statistics, statisticName: 'view', id }) } -} +}; diff --git a/services/youtube/youtube-views.tester.js b/services/youtube/youtube-views.tester.js index af7c036daff38..bd1ba2b1937b1 100644 --- a/services/youtube/youtube-views.tester.js +++ b/services/youtube/youtube-views.tester.js @@ -1,9 +1,10 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { noToken } = require('../test-helpers') -const { isMetric } = require('../test-validators') -const noYouTubeToken = noToken(require('./youtube-views.service')) +const t = (function() { + export default __a; +}()) +import {noToken} from '../test-helpers.js'; +import {isMetric} from '../test-validators.js'; +import _noYouTubeToken from './youtube-views.service'; +const noYouTubeToken = noToken(_noYouTubeToken); t.create('video view count') .skipWhen(noYouTubeToken) From 819a676a92e3b5a553876dbd92dd3653b924721a Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 15:52:47 +0100 Subject: [PATCH 03/46] Remove incorrect default modifier for named exports --- core/badge-urls/make-badge-url.js | 2 +- core/badge-urls/path-helpers.js | 2 +- core/base-service/auth-helper.js | 2 +- core/base-service/cache-headers.js | 2 +- core/base-service/categories.js | 2 +- core/base-service/errors.js | 2 +- core/base-service/examples.js | 2 +- core/base-service/graphql.js | 2 +- core/base-service/index.js | 2 +- core/base-service/json.js | 2 +- core/base-service/legacy-request-handler.js | 2 +- core/base-service/legacy-result-sender.js | 2 +- core/base-service/loader-test-fixtures/empty-object.fixture.js | 2 +- core/base-service/loader-test-fixtures/valid-object.fixture.js | 2 +- core/base-service/loader.js | 2 +- core/base-service/metric-helper.js | 2 +- core/base-service/route.js | 2 +- core/base-service/service-definitions.js | 2 +- core/legacy/regular-update.js | 2 +- core/server/in-process-server-test-helpers.js | 2 +- core/server/metrics/format-converters.js | 2 +- core/server/secret-is-valid.js | 2 +- core/service-test-runner/infer-pull-request.js | 2 +- core/token-pooling/token-pool.js | 2 +- gatsby-config.js | 2 +- gatsby-node.js | 2 +- lib/logos.js | 2 +- lib/svg-helpers.js | 2 +- services/amo/amo-base.js | 2 +- services/amo/amo-downloads.service.js | 2 +- services/ansible/ansible-role.service.js | 2 +- services/apm/apm.service.js | 2 +- services/aur/aur.service.js | 2 +- services/azure-devops/azure-devops-helpers.js | 2 +- services/bitbucket/bitbucket-pipelines.service.js | 2 +- services/bower/bower-version.service.js | 2 +- services/build-status.js | 2 +- services/chrome-web-store/chrome-web-store-rating.service.js | 2 +- services/chrome-web-store/chrome-web-store-users.service.js | 2 +- services/clojars/clojars-base.js | 2 +- services/clojars/clojars-version.service.js | 2 +- services/codacy/codacy-helpers.js | 2 +- services/codeclimate/codeclimate-common.js | 2 +- services/codefactor/codefactor-helpers.js | 2 +- services/color-formatters.js | 2 +- services/contributor-count.js | 2 +- services/cran/cran.service.js | 2 +- services/crates/crates-base.js | 2 +- services/ctan/ctan.service.js | 2 +- services/deprecation-helpers.js | 2 +- services/docker/docker-cloud-common-fetch.js | 2 +- services/docker/docker-fixtures.js | 2 +- services/docker/docker-helpers.js | 2 +- services/dynamic-common.js | 2 +- services/dynamic/dynamic-helpers.js | 2 +- services/dynamic/dynamic-response-fixtures.js | 2 +- services/endpoint-common.js | 2 +- services/feedz/feedz.service.js | 2 +- services/github/auth/acceptor.js | 2 +- services/github/auth/admin.js | 2 +- services/github/github-auth-service.js | 2 +- services/github/github-common-fetch.js | 2 +- services/github/github-common-release.js | 2 +- services/github/github-helpers.js | 2 +- services/github/github-issues-search.service.js | 2 +- services/github/github-languages-base.js | 2 +- services/github/github-manifest.service.js | 2 +- services/github/github-release.service.js | 2 +- services/github/github-tag.service.js | 2 +- services/gitlab/gitlab-pipeline-status.service.js | 2 +- services/index.js | 2 +- services/jenkins/jenkins-common.js | 2 +- services/jira/jira-common.js | 2 +- services/jira/jira-test-helpers.js | 2 +- services/jsdelivr/jsdelivr-base.js | 2 +- services/lgtm/lgtm-test-helpers.js | 2 +- services/liberapay/liberapay-base.js | 2 +- services/librariesio/librariesio-common.js | 2 +- services/librariesio/librariesio-dependencies-helpers.js | 2 +- services/licenses.js | 2 +- services/luarocks/luarocks-version-helpers.js | 2 +- services/myget/myget.service.js | 2 +- services/nexus/nexus-version.js | 2 +- services/node/node-version-color.js | 2 +- services/node/testUtils/test-utils.js | 2 +- services/nuget-fixtures.js | 2 +- services/nuget/nuget-helpers.js | 2 +- services/nuget/nuget-v2-service-family.js | 2 +- services/nuget/nuget-v3-service-family.js | 2 +- services/nuget/nuget.service.js | 2 +- services/ore/ore-base.js | 2 +- services/package-json-helpers.js | 2 +- services/packagist/packagist-base.js | 2 +- services/packagist/packagist-version.service.js | 2 +- services/php-version.js | 2 +- services/pipenv-helpers.js | 2 +- services/powershellgallery/powershellgallery.service.js | 2 +- services/pub/pub.service.js | 2 +- services/puppetforge/puppetforge-base.js | 2 +- services/pypi/pypi-helpers.js | 2 +- services/redmine/redmine.service.js | 2 +- services/response-fixtures.js | 2 +- services/reuse/reuse-compliance-helper.js | 2 +- services/shippable/shippable.service.js | 2 +- services/snyk/snyk-test-helpers.js | 2 +- services/sonar/sonar-helpers.js | 2 +- services/spiget/spiget-base.js | 2 +- services/steam/steam-workshop.service.js | 2 +- services/suggest.js | 2 +- services/symfony/symfony-insight-base.js | 2 +- services/symfony/symfony-test-helpers.js | 2 +- services/teamcity/teamcity-test-helpers.js | 2 +- services/test-helpers.js | 2 +- services/test-results.js | 2 +- services/test-validators.js | 2 +- services/tester.js | 2 +- services/text-formatters.js | 2 +- services/travis/travis-php-version-redirect.service.js | 2 +- services/vaadin-directory/vaadin-directory-base.js | 2 +- services/validators.js | 2 +- services/version.js | 2 +- .../visual-studio-app-center/visual-studio-app-center-base.js | 2 +- services/w3c/w3c-validation-helper.js | 2 +- services/website-status.js | 2 +- services/wordpress/wordpress-version-color.js | 2 +- services/youtube/youtube-base.js | 2 +- 126 files changed, 126 insertions(+), 126 deletions(-) diff --git a/core/badge-urls/make-badge-url.js b/core/badge-urls/make-badge-url.js index 74d1f2b2530ef..dbe5e8f1b9269 100644 --- a/core/badge-urls/make-badge-url.js +++ b/core/badge-urls/make-badge-url.js @@ -151,7 +151,7 @@ function rasterRedirectUrl({ rasterUrl }, badgeUrl) { return result } -export default { +export { badgeUrlFromPath, badgeUrlFromPattern, encodeField, diff --git a/core/badge-urls/path-helpers.js b/core/badge-urls/path-helpers.js index 8102dc747a76f..fe6796c190bee 100644 --- a/core/badge-urls/path-helpers.js +++ b/core/badge-urls/path-helpers.js @@ -9,6 +9,6 @@ function escapeFormat(t) { .replace(/--/g, '-'); } -export default { +export { escapeFormat, }; diff --git a/core/base-service/auth-helper.js b/core/base-service/auth-helper.js index c39f41afdc042..0050e97fc1d97 100644 --- a/core/base-service/auth-helper.js +++ b/core/base-service/auth-helper.js @@ -205,4 +205,4 @@ class AuthHelper { } } -export default { AuthHelper }; +export { AuthHelper }; diff --git a/core/base-service/cache-headers.js b/core/base-service/cache-headers.js index f17672fb1913e..8b133e38d4a8f 100644 --- a/core/base-service/cache-headers.js +++ b/core/base-service/cache-headers.js @@ -102,7 +102,7 @@ function serverHasBeenUpSinceResourceCached(req) { ) } -export default { +export { coalesceCacheLength, setCacheHeaders, setHeadersForCacheLength, diff --git a/core/base-service/categories.js b/core/base-service/categories.js index e3a1312765ec7..40eeeff0b5098 100644 --- a/core/base-service/categories.js +++ b/core/base-service/categories.js @@ -11,7 +11,7 @@ function assertValidCategory(category, message = undefined) { Joi.assert(category, isValidCategory, message) } -export default { +export { isValidCategory, assertValidCategory, }; diff --git a/core/base-service/errors.js b/core/base-service/errors.js index 753f96ceb4c45..4e351c92d51d1 100644 --- a/core/base-service/errors.js +++ b/core/base-service/errors.js @@ -208,7 +208,7 @@ class Deprecated extends ShieldsRuntimeError { * badge when we catch and render the exception (Optional) */ -export default { +export { ShieldsRuntimeError, NotFound, ImproperlyConfigured, diff --git a/core/base-service/examples.js b/core/base-service/examples.js index 812f8c4c87681..f8fd106e8af1e 100644 --- a/core/base-service/examples.js +++ b/core/base-service/examples.js @@ -153,7 +153,7 @@ function transformExample(inExample, index, ServiceClass) { } } -export default { +export { validateExample, transformExample, }; diff --git a/core/base-service/graphql.js b/core/base-service/graphql.js index 2ad7f2e4ba7ca..8b08fb40106c2 100644 --- a/core/base-service/graphql.js +++ b/core/base-service/graphql.js @@ -48,4 +48,4 @@ function mergeQueries(...queries) { return merged } -export default { mergeQueries }; +export { mergeQueries }; diff --git a/core/base-service/index.js b/core/base-service/index.js index a63eae9e6909b..8cf6a332f0b5b 100644 --- a/core/base-service/index.js +++ b/core/base-service/index.js @@ -9,7 +9,7 @@ import deprecatedService from './deprecated-service.js'; import redirector from './redirector.js'; import {NotFound, InvalidResponse, Inaccessible, InvalidParameter, Deprecated} from './errors.js'; -export default { +export { BaseService, BaseJsonService, BaseGraphqlService, diff --git a/core/base-service/json.js b/core/base-service/json.js index 148685ffee91a..086aaab30e7e3 100644 --- a/core/base-service/json.js +++ b/core/base-service/json.js @@ -21,6 +21,6 @@ function parseJson(buffer) { return json } -export default { +export { parseJson, }; diff --git a/core/base-service/legacy-request-handler.js b/core/base-service/legacy-request-handler.js index 1caef662f17c0..6445a1e8b6974 100644 --- a/core/base-service/legacy-request-handler.js +++ b/core/base-service/legacy-request-handler.js @@ -200,7 +200,7 @@ function handleRequest(cacheHeaderConfig, handlerOptions) { }; } -export default { +export { handleRequest, promisify, userAgent, diff --git a/core/base-service/legacy-result-sender.js b/core/base-service/legacy-result-sender.js index 987feba90235a..2aafb7505f016 100644 --- a/core/base-service/legacy-result-sender.js +++ b/core/base-service/legacy-result-sender.js @@ -30,6 +30,6 @@ function makeSend(format, askres, end) { } } -export default { +export { makeSend, }; diff --git a/core/base-service/loader-test-fixtures/empty-object.fixture.js b/core/base-service/loader-test-fixtures/empty-object.fixture.js index ff8b4c56321a3..cb0ff5c3b541f 100644 --- a/core/base-service/loader-test-fixtures/empty-object.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-object.fixture.js @@ -1 +1 @@ -export default {}; +export {}; diff --git a/core/base-service/loader-test-fixtures/valid-object.fixture.js b/core/base-service/loader-test-fixtures/valid-object.fixture.js index 62aed2bbdb23d..5d11c4d34c7d3 100644 --- a/core/base-service/loader-test-fixtures/valid-object.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-object.fixture.js @@ -9,4 +9,4 @@ class GoodServiceTwo extends BaseJsonService { static route = { base: 'good', pattern: 'two' } } -export default { GoodServiceOne, GoodServiceTwo }; +export { GoodServiceOne, GoodServiceTwo }; diff --git a/core/base-service/loader.js b/core/base-service/loader.js index 3009d5ae80c84..cd83a0fb91e2a 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -107,7 +107,7 @@ function loadTesters() { .map(path => require(path)) } -export default { +export { InvalidService, loadServiceClasses, checkNames, diff --git a/core/base-service/metric-helper.js b/core/base-service/metric-helper.js index 9cae13650456c..c11ebca2a6d3c 100644 --- a/core/base-service/metric-helper.js +++ b/core/base-service/metric-helper.js @@ -57,4 +57,4 @@ const MetricNames = Object.freeze({ SERVICE_RESPONSE_SIZE: Symbol('service-response-size'), }) -export default { MetricHelper, MetricNames }; +export { MetricHelper, MetricNames }; diff --git a/core/base-service/route.js b/core/base-service/route.js index 1890f7094ba34..1c7e8fbea8449 100644 --- a/core/base-service/route.js +++ b/core/base-service/route.js @@ -72,7 +72,7 @@ function getQueryParamNames({ queryParamSchema }) { } } -export default { +export { makeFullUrl, isValidRoute, assertValidRoute, diff --git a/core/base-service/service-definitions.js b/core/base-service/service-definitions.js index 55705f0872cc6..af22df646b785 100644 --- a/core/base-service/service-definitions.js +++ b/core/base-service/service-definitions.js @@ -70,7 +70,7 @@ function assertValidServiceDefinitionExport(examples, message = undefined) { Joi.assert(examples, serviceDefinitionExport, message) } -export default { +export { serviceDefinition, assertValidServiceDefinition, serviceDefinitionExport, diff --git a/core/legacy/regular-update.js b/core/legacy/regular-update.js index 1325e7176698a..5401838f229b4 100644 --- a/core/legacy/regular-update.js +++ b/core/legacy/regular-update.js @@ -93,7 +93,7 @@ function clearRegularUpdateCache() { regularUpdateCache = Object.create(null) } -export default { +export { regularUpdate, clearRegularUpdateCache, }; diff --git a/core/server/in-process-server-test-helpers.js b/core/server/in-process-server-test-helpers.js index 9c6ffcb7fbd27..0638a391d0d89 100644 --- a/core/server/in-process-server-test-helpers.js +++ b/core/server/in-process-server-test-helpers.js @@ -11,6 +11,6 @@ async function createTestServer(customConfig = {}) { return new Server(mergedConfig) } -export default { +export { createTestServer, }; diff --git a/core/server/metrics/format-converters.js b/core/server/metrics/format-converters.js index 538851da0731e..ba92199d1ca64 100644 --- a/core/server/metrics/format-converters.js +++ b/core/server/metrics/format-converters.js @@ -23,4 +23,4 @@ function promClientJsonToInfluxV2(metrics, extraLabels = {}) { .join('\n') } -export default { promClientJsonToInfluxV2 }; +export { promClientJsonToInfluxV2 }; diff --git a/core/server/secret-is-valid.js b/core/server/secret-is-valid.js index 422e570e35fe2..a1e9a232e4e50 100644 --- a/core/server/secret-is-valid.js +++ b/core/server/secret-is-valid.js @@ -15,4 +15,4 @@ function makeSecretIsValid(shieldsSecret) { } } -export default { makeSecretIsValid }; +export { makeSecretIsValid }; diff --git a/core/service-test-runner/infer-pull-request.js b/core/service-test-runner/infer-pull-request.js index ae84f41e95996..51e7a9702d5d6 100644 --- a/core/service-test-runner/infer-pull-request.js +++ b/core/service-test-runner/infer-pull-request.js @@ -97,7 +97,7 @@ function inferPullRequest(env = process.env) { * @property {string} slug owner/repo/#pullRequest */ -export default { +export { parseGithubPullRequestUrl, parseGithubRepoSlug, inferPullRequest, diff --git a/core/token-pooling/token-pool.js b/core/token-pooling/token-pool.js index 98aacfcfee914..28010f8f51e7c 100644 --- a/core/token-pooling/token-pool.js +++ b/core/token-pooling/token-pool.js @@ -353,7 +353,7 @@ class TokenPool { } } -export default { +export { sanitizeToken, Token, TokenPool, diff --git a/gatsby-config.js b/gatsby-config.js index 708f9cde7fea7..a9935ccdb4507 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,6 +1,6 @@ import path from 'path'; -export default { +export { siteMetadata: { title: 'Shields.io: Quality metadata badges for open source projects', description: diff --git a/gatsby-node.js b/gatsby-node.js index 9a2081841b5d8..e92f662ccd862 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -44,4 +44,4 @@ async function createPages({ actions: { createPage } }) { }) } -export default { createPages }; +export { createPages }; diff --git a/lib/logos.js b/lib/logos.js index e072ecf544dc6..cedd3d8478c2f 100644 --- a/lib/logos.js +++ b/lib/logos.js @@ -125,7 +125,7 @@ function makeLogo(defaultNamedLogo, overrides) { } } -export default { +export { prependPrefix, isDataUrl, decodeDataUrlFromQueryParam, diff --git a/lib/svg-helpers.js b/lib/svg-helpers.js index 1e7f8df373cc5..032ee5053fe08 100644 --- a/lib/svg-helpers.js +++ b/lib/svg-helpers.js @@ -2,4 +2,4 @@ function svg2base64(svg) { return `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}` } -export default { svg2base64 }; +export { svg2base64 }; diff --git a/services/amo/amo-base.js b/services/amo/amo-base.js index cc005c370d4a7..14cbd3134ef9a 100644 --- a/services/amo/amo-base.js +++ b/services/amo/amo-base.js @@ -26,4 +26,4 @@ class BaseAmoService extends BaseJsonService { } } -export default { BaseAmoService, keywords }; +export { BaseAmoService, keywords }; diff --git a/services/amo/amo-downloads.service.js b/services/amo/amo-downloads.service.js index 77b3c6801fa1a..e80cef901cc21 100644 --- a/services/amo/amo-downloads.service.js +++ b/services/amo/amo-downloads.service.js @@ -52,7 +52,7 @@ const AmoLegacyRedirect = redirector({ dateAdded: new Date('2019-02-23'), }) -export default { +export { AmoWeeklyDownloads, AmoLegacyRedirect, }; diff --git a/services/ansible/ansible-role.service.js b/services/ansible/ansible-role.service.js index 3ce9285107162..a999047a2ff30 100644 --- a/services/ansible/ansible-role.service.js +++ b/services/ansible/ansible-role.service.js @@ -78,7 +78,7 @@ class AnsibleGalaxyRoleName extends AnsibleGalaxyRole { } } -export default { +export { AnsibleGalaxyRoleDownloads, AnsibleGalaxyRoleName, }; diff --git a/services/apm/apm.service.js b/services/apm/apm.service.js index 728ab308ea47c..5d814b7ae423e 100644 --- a/services/apm/apm.service.js +++ b/services/apm/apm.service.js @@ -114,7 +114,7 @@ class APMLicense extends BaseAPMService { } } -export default { +export { APMDownloads, APMVersion, APMLicense, diff --git a/services/aur/aur.service.js b/services/aur/aur.service.js index a6e5eaef0f508..1b1ecf7aeb3bd 100644 --- a/services/aur/aur.service.js +++ b/services/aur/aur.service.js @@ -193,7 +193,7 @@ class AurLastModified extends BaseAurService { } } -export default { +export { AurLicense, AurVersion, AurVotes, diff --git a/services/azure-devops/azure-devops-helpers.js b/services/azure-devops/azure-devops-helpers.js index d14098b09b434..9004354a7d76a 100644 --- a/services/azure-devops/azure-devops-helpers.js +++ b/services/azure-devops/azure-devops-helpers.js @@ -26,4 +26,4 @@ async function fetch(serviceInstance, { url, qs = {}, errorMessages }) { return { status } } -export default { keywords, fetch }; +export { keywords, fetch }; diff --git a/services/bitbucket/bitbucket-pipelines.service.js b/services/bitbucket/bitbucket-pipelines.service.js index 88b3a2e85656b..ca37739111883 100644 --- a/services/bitbucket/bitbucket-pipelines.service.js +++ b/services/bitbucket/bitbucket-pipelines.service.js @@ -94,7 +94,7 @@ const BitbucketPipelinesRedirector = redirector({ dateAdded: new Date('2020-07-12'), }) -export default { +export { BitbucketPipelines, BitbucketPipelinesRedirector, }; diff --git a/services/bower/bower-version.service.js b/services/bower/bower-version.service.js index 8dd71c34f474f..0264e6f83dd0d 100644 --- a/services/bower/bower-version.service.js +++ b/services/bower/bower-version.service.js @@ -55,4 +55,4 @@ const BowerVersionRedirect = redirector({ dateAdded: new Date('2019-12-15'), }) -export default { BowerVersion, BowerVersionRedirect }; +export { BowerVersion, BowerVersionRedirect }; diff --git a/services/build-status.js b/services/build-status.js index 07a4ff492ad64..49d9175bdd044 100644 --- a/services/build-status.js +++ b/services/build-status.js @@ -72,4 +72,4 @@ function renderBuildStatusBadge({ label, status }) { } } -export default { isBuildStatus, renderBuildStatusBadge }; +export { isBuildStatus, renderBuildStatusBadge }; diff --git a/services/chrome-web-store/chrome-web-store-rating.service.js b/services/chrome-web-store/chrome-web-store-rating.service.js index 2b316b53f243a..e14b8dda4236b 100644 --- a/services/chrome-web-store/chrome-web-store-rating.service.js +++ b/services/chrome-web-store/chrome-web-store-rating.service.js @@ -106,7 +106,7 @@ class ChromeWebStoreRatingStars extends BaseChromeWebStoreRating { } } -export default { +export { ChromeWebStoreRating, ChromeWebStoreRatingCount, ChromeWebStoreRatingStars, diff --git a/services/chrome-web-store/chrome-web-store-users.service.js b/services/chrome-web-store/chrome-web-store-users.service.js index dae65f0bdd6e4..ef9ed6d7674d3 100644 --- a/services/chrome-web-store/chrome-web-store-users.service.js +++ b/services/chrome-web-store/chrome-web-store-users.service.js @@ -44,7 +44,7 @@ const ChromeWebStoreDownloads = redirector({ dateAdded: new Date('2019-02-27'), }) -export default { +export { ChromeWebStoreDownloads, ChromeWebStoreUsers, }; diff --git a/services/clojars/clojars-base.js b/services/clojars/clojars-base.js index 558113095824b..b665ddcc528f4 100644 --- a/services/clojars/clojars-base.js +++ b/services/clojars/clojars-base.js @@ -19,4 +19,4 @@ class BaseClojarsService extends BaseJsonService { } } -export default { BaseClojarsService }; +export { BaseClojarsService }; diff --git a/services/clojars/clojars-version.service.js b/services/clojars/clojars-version.service.js index 7f72343487104..30f08550c53ad 100644 --- a/services/clojars/clojars-version.service.js +++ b/services/clojars/clojars-version.service.js @@ -61,4 +61,4 @@ const ClojarsVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -export default { ClojarsVersionService, ClojarsVersionRedirector }; +export { ClojarsVersionService, ClojarsVersionRedirector }; diff --git a/services/codacy/codacy-helpers.js b/services/codacy/codacy-helpers.js index 19e425138a146..60218268ccd06 100644 --- a/services/codacy/codacy-helpers.js +++ b/services/codacy/codacy-helpers.js @@ -2,4 +2,4 @@ import Joi from 'joi'; const codacyGrade = Joi.equal('A', 'B', 'C', 'D', 'E', 'F') -export default { codacyGrade }; +export { codacyGrade }; diff --git a/services/codeclimate/codeclimate-common.js b/services/codeclimate/codeclimate-common.js index 9d33193fa4480..375abd61ce139 100644 --- a/services/codeclimate/codeclimate-common.js +++ b/services/codeclimate/codeclimate-common.js @@ -42,7 +42,7 @@ async function fetchRepo(serviceInstance, { user, repo }) { return repoInfo } -export default { +export { keywords, isLetterGrade, fetchRepo, diff --git a/services/codefactor/codefactor-helpers.js b/services/codefactor/codefactor-helpers.js index 7f880f7c26fda..4059217a31777 100644 --- a/services/codefactor/codefactor-helpers.js +++ b/services/codefactor/codefactor-helpers.js @@ -29,4 +29,4 @@ function gradeColor(grade) { return color } -export default { isValidGrade, gradeColor }; +export { isValidGrade, gradeColor }; diff --git a/services/color-formatters.js b/services/color-formatters.js index 723ec00c73ced..187ac001376aa 100644 --- a/services/color-formatters.js +++ b/services/color-formatters.js @@ -104,7 +104,7 @@ function age(date) { return colorByAge(daysElapsed) } -export default { +export { version, downloadCount, coveragePercentage, diff --git a/services/contributor-count.js b/services/contributor-count.js index 12159d7c0929e..ab4ef2a868230 100644 --- a/services/contributor-count.js +++ b/services/contributor-count.js @@ -18,7 +18,7 @@ function renderContributorBadge({ label, contributorCount }) { } } -export default { +export { contributorColor, renderContributorBadge, }; diff --git a/services/cran/cran.service.js b/services/cran/cran.service.js index dbee2875ff3b1..5e0657ee249b2 100644 --- a/services/cran/cran.service.js +++ b/services/cran/cran.service.js @@ -64,4 +64,4 @@ class CranVersion extends BaseCranService { } } -export default { CranLicense, CranVersion }; +export { CranLicense, CranVersion }; diff --git a/services/crates/crates-base.js b/services/crates/crates-base.js index f4a238cbc805b..c11fe5177f4a7 100644 --- a/services/crates/crates-base.js +++ b/services/crates/crates-base.js @@ -49,4 +49,4 @@ class BaseCratesService extends BaseJsonService { } } -export default { BaseCratesService, keywords }; +export { BaseCratesService, keywords }; diff --git a/services/ctan/ctan.service.js b/services/ctan/ctan.service.js index 650dd00793eb9..94ec48c745f69 100644 --- a/services/ctan/ctan.service.js +++ b/services/ctan/ctan.service.js @@ -71,7 +71,7 @@ class CtanVersion extends BaseCtanService { } } -export default { +export { CtanLicense, CtanVersion, }; diff --git a/services/deprecation-helpers.js b/services/deprecation-helpers.js index 943a5b9e18d08..3a35dfeb6877b 100644 --- a/services/deprecation-helpers.js +++ b/services/deprecation-helpers.js @@ -6,6 +6,6 @@ function enforceDeprecation(effectiveDate) { } } -export default { +export { enforceDeprecation, }; diff --git a/services/docker/docker-cloud-common-fetch.js b/services/docker/docker-cloud-common-fetch.js index ff4a382eb76cb..29ee356fd8ac6 100644 --- a/services/docker/docker-cloud-common-fetch.js +++ b/services/docker/docker-cloud-common-fetch.js @@ -20,6 +20,6 @@ async function fetchBuild(serviceInstance, { user, repo }) { }) } -export default { +export { fetchBuild, }; diff --git a/services/docker/docker-fixtures.js b/services/docker/docker-fixtures.js index 98e151e09d68d..3f79f5fac7b07 100644 --- a/services/docker/docker-fixtures.js +++ b/services/docker/docker-fixtures.js @@ -3033,7 +3033,7 @@ const versionDataWithVaryingArchitectures = [ { name: '2.6', images: [] }, ] -export default { +export { sizeDataNoTagSemVerSort, versionDataNoTagDateSort, versionPagedDataNoTagDateSort, diff --git a/services/docker/docker-helpers.js b/services/docker/docker-helpers.js index 41562dfb88065..c147577dec642 100644 --- a/services/docker/docker-helpers.js +++ b/services/docker/docker-helpers.js @@ -53,7 +53,7 @@ function getDigestSemVerMatches({ data, digest }) { return version } -export default { +export { dockerBlue, buildDockerUrl, getDockerHubUser, diff --git a/services/dynamic-common.js b/services/dynamic-common.js index 8363f3b04d4bf..42cccf081b50e 100644 --- a/services/dynamic-common.js +++ b/services/dynamic-common.js @@ -46,7 +46,7 @@ function renderDynamicBadge({ } } -export default { +export { errorMessages, individualValueSchema, transformAndValidate, diff --git a/services/dynamic/dynamic-helpers.js b/services/dynamic/dynamic-helpers.js index 6866dbbb86144..8dd5b134cacf6 100644 --- a/services/dynamic/dynamic-helpers.js +++ b/services/dynamic/dynamic-helpers.js @@ -18,6 +18,6 @@ function createRoute(which) { } } -export default { +export { createRoute, }; diff --git a/services/dynamic/dynamic-response-fixtures.js b/services/dynamic/dynamic-response-fixtures.js index 15df94a0f30e8..d9217106d6c03 100644 --- a/services/dynamic/dynamic-response-fixtures.js +++ b/services/dynamic/dynamic-response-fixtures.js @@ -1,4 +1,4 @@ -export default { +export { exampleXml: ` diff --git a/services/endpoint-common.js b/services/endpoint-common.js index 5ab0b90d2ded4..2e21c9ecc6d9a 100644 --- a/services/endpoint-common.js +++ b/services/endpoint-common.js @@ -72,7 +72,7 @@ async function fetchEndpointData( }) } -export default { +export { validateEndpointData, fetchEndpointData, }; diff --git a/services/feedz/feedz.service.js b/services/feedz/feedz.service.js index 02288e2555feb..81a920e060041 100644 --- a/services/feedz/feedz.service.js +++ b/services/feedz/feedz.service.js @@ -98,6 +98,6 @@ class FeedzVersionService extends BaseJsonService { } } -export default { +export { FeedzVersionService, }; diff --git a/services/github/auth/acceptor.js b/services/github/auth/acceptor.js index 7031599276b8d..9ffb6860ea8e1 100644 --- a/services/github/auth/acceptor.js +++ b/services/github/auth/acceptor.js @@ -81,4 +81,4 @@ function setRoutes({ server, authHelper, onTokenAccepted }) { }) } -export default { setRoutes }; +export { setRoutes }; diff --git a/services/github/auth/admin.js b/services/github/auth/admin.js index 04ceff3a6b2b5..db09ecd2b003a 100644 --- a/services/github/auth/admin.js +++ b/services/github/auth/admin.js @@ -29,4 +29,4 @@ function setRoutes({ shieldsSecret }, { apiProvider, server }) { }) } -export default { setRoutes }; +export { setRoutes }; diff --git a/services/github/github-auth-service.js b/services/github/github-auth-service.js index 2a4dd3bfb75aa..aebb6905a7fbb 100644 --- a/services/github/github-auth-service.js +++ b/services/github/github-auth-service.js @@ -87,7 +87,7 @@ All other things being equal, a graphql query will almost always be a smaller number of bytes over the wire and a smaller/simpler object to parse. */ -export default { +export { GithubAuthV3Service, ConditionalGithubAuthV3Service, GithubAuthV4Service, diff --git a/services/github/github-common-fetch.js b/services/github/github-common-fetch.js index e0ac361a2e804..b3e5a9769aadd 100644 --- a/services/github/github-common-fetch.js +++ b/services/github/github-common-fetch.js @@ -75,7 +75,7 @@ async function fetchJsonFromRepo( } } -export default { +export { fetchIssue, fetchRepoContent, fetchJsonFromRepo, diff --git a/services/github/github-common-release.js b/services/github/github-common-release.js index a12cdd4a1f7ee..081ae343013f0 100644 --- a/services/github/github-common-release.js +++ b/services/github/github-common-release.js @@ -94,7 +94,7 @@ async function fetchLatestRelease( return latestRelease } -export default { +export { fetchLatestRelease, queryParamSchema, _getLatestRelease: getLatestRelease, // currently only used for tests diff --git a/services/github/github-helpers.js b/services/github/github-helpers.js index 8fd4b23ebea09..ca6e8a18adc19 100644 --- a/services/github/github-helpers.js +++ b/services/github/github-helpers.js @@ -31,7 +31,7 @@ function transformErrors(errors, entity = 'repo') { const commentsColor = colorScale([1, 3, 10, 25], undefined, true) -export default { +export { documentation, stateColor, commentsColor, diff --git a/services/github/github-issues-search.service.js b/services/github/github-issues-search.service.js index 4501e0c904156..e27308232db2c 100644 --- a/services/github/github-issues-search.service.js +++ b/services/github/github-issues-search.service.js @@ -104,7 +104,7 @@ class GithubRepoIssuesSearch extends BaseGithubIssuesSearch { } } -export default { +export { GithubIssuesSearch, GithubRepoIssuesSearch, }; diff --git a/services/github/github-languages-base.js b/services/github/github-languages-base.js index a7ece5512a862..64ed4d03d6a1f 100644 --- a/services/github/github-languages-base.js +++ b/services/github/github-languages-base.js @@ -23,4 +23,4 @@ class BaseGithubLanguage extends GithubAuthV3Service { } } -export default { BaseGithubLanguage }; +export { BaseGithubLanguage }; diff --git a/services/github/github-manifest.service.js b/services/github/github-manifest.service.js index 3a76b954e60f9..b233746db3fd7 100644 --- a/services/github/github-manifest.service.js +++ b/services/github/github-manifest.service.js @@ -198,7 +198,7 @@ class DynamicGithubManifest extends ConditionalGithubAuthV3Service { } } -export default { +export { GithubManifestVersion, DynamicGithubManifest, }; diff --git a/services/github/github-release.service.js b/services/github/github-release.service.js index 71ba4dbcdb5aa..4ee1ecb56f988 100644 --- a/services/github/github-release.service.js +++ b/services/github/github-release.service.js @@ -117,7 +117,7 @@ const redirects = { }), } -export default { +export { GithubRelease, ...redirects, }; diff --git a/services/github/github-tag.service.js b/services/github/github-tag.service.js index 8731caa094e64..9eaa535fcbb97 100644 --- a/services/github/github-tag.service.js +++ b/services/github/github-tag.service.js @@ -161,7 +161,7 @@ const redirects = { }), } -export default { +export { GithubTag, ...redirects, }; diff --git a/services/gitlab/gitlab-pipeline-status.service.js b/services/gitlab/gitlab-pipeline-status.service.js index f8b960d4daaf2..3e47d1159eaea 100644 --- a/services/gitlab/gitlab-pipeline-status.service.js +++ b/services/gitlab/gitlab-pipeline-status.service.js @@ -97,7 +97,7 @@ const GitlabPipelineStatusRedirector = redirector({ dateAdded: new Date('2020-07-12'), }) -export default { +export { GitlabPipelineStatus, GitlabPipelineStatusRedirector, }; diff --git a/services/index.js b/services/index.js index ee79357bd318b..ba46d3891c03f 100644 --- a/services/index.js +++ b/services/index.js @@ -1,5 +1,5 @@ import base from '../core/base-service.js'; -export default { +export { ...base, }; diff --git a/services/jenkins/jenkins-common.js b/services/jenkins/jenkins-common.js index ac7ebea269a48..e2aee8d3ea81f 100644 --- a/services/jenkins/jenkins-common.js +++ b/services/jenkins/jenkins-common.js @@ -19,7 +19,7 @@ const buildUrl = ({ jobUrl, lastCompletedBuild = true, plugin }) => { return `${jobUrl}/${lastCompletedBuildElement}${pluginElement}api/json` } -export default { +export { queryParamSchema, buildTreeParamQueryString: tree => ({ tree }), buildUrl, diff --git a/services/jira/jira-common.js b/services/jira/jira-common.js index a79803a1be67e..2ded05438deab 100644 --- a/services/jira/jira-common.js +++ b/services/jira/jira-common.js @@ -4,4 +4,4 @@ const authConfig = { serviceKey: 'jira', } -export default { authConfig }; +export { authConfig }; diff --git a/services/jira/jira-test-helpers.js b/services/jira/jira-test-helpers.js index f453e767aa985..fc9ca408434c7 100644 --- a/services/jira/jira-test-helpers.js +++ b/services/jira/jira-test-helpers.js @@ -19,7 +19,7 @@ const config = { private: { jira_user: user, jira_pass: pass }, } -export default { +export { sprintId, sprintQueryString, user, diff --git a/services/jsdelivr/jsdelivr-base.js b/services/jsdelivr/jsdelivr-base.js index 1f72c46c65c09..0dc2d66003457 100644 --- a/services/jsdelivr/jsdelivr-base.js +++ b/services/jsdelivr/jsdelivr-base.js @@ -29,4 +29,4 @@ class BaseJsDelivrService extends BaseJsonService { } } -export default { schema, periodMap, BaseJsDelivrService }; +export { schema, periodMap, BaseJsDelivrService }; diff --git a/services/lgtm/lgtm-test-helpers.js b/services/lgtm/lgtm-test-helpers.js index e766b9e955cfb..22bc59d1228e5 100644 --- a/services/lgtm/lgtm-test-helpers.js +++ b/services/lgtm/lgtm-test-helpers.js @@ -11,6 +11,6 @@ const data = { ], } -export default { +export { data, }; diff --git a/services/liberapay/liberapay-base.js b/services/liberapay/liberapay-base.js index a01edc51e6aa6..59e7204f87560 100644 --- a/services/liberapay/liberapay-base.js +++ b/services/liberapay/liberapay-base.js @@ -62,7 +62,7 @@ class LiberapayBase extends BaseJsonService { } } -export default { +export { renderCurrencyBadge, LiberapayBase, isCurrencyOverTime, diff --git a/services/librariesio/librariesio-common.js b/services/librariesio/librariesio-common.js index 7e1f09cce113f..e24914233e970 100644 --- a/services/librariesio/librariesio-common.js +++ b/services/librariesio/librariesio-common.js @@ -19,6 +19,6 @@ async function fetchProject(serviceInstance, { platform, scope, packageName }) { }) } -export default { +export { fetchProject, }; diff --git a/services/librariesio/librariesio-dependencies-helpers.js b/services/librariesio/librariesio-dependencies-helpers.js index 41fcfc890c38f..5ea483f9e269a 100644 --- a/services/librariesio/librariesio-dependencies-helpers.js +++ b/services/librariesio/librariesio-dependencies-helpers.js @@ -26,4 +26,4 @@ function renderDependenciesBadge({ deprecatedCount, outdatedCount }) { } } -export default { transform, renderDependenciesBadge }; +export { transform, renderDependenciesBadge }; diff --git a/services/licenses.js b/services/licenses.js index 6782d6ff81cc3..df87246b7c92d 100644 --- a/services/licenses.js +++ b/services/licenses.js @@ -128,4 +128,4 @@ function renderLicenseBadge({ license, licenses }) { } } -export default { licenseToColor, renderLicenseBadge }; +export { licenseToColor, renderLicenseBadge }; diff --git a/services/luarocks/luarocks-version-helpers.js b/services/luarocks/luarocks-version-helpers.js index d1ff5a5b703ac..88d1ede996c7b 100644 --- a/services/luarocks/luarocks-version-helpers.js +++ b/services/luarocks/luarocks-version-helpers.js @@ -84,7 +84,7 @@ function latestVersion(versions) { .pop() } -export default { +export { parseVersion, compareVersionLists, latestVersion, diff --git a/services/myget/myget.service.js b/services/myget/myget.service.js index 13d4feb225d39..4d29b76f9b6a5 100644 --- a/services/myget/myget.service.js +++ b/services/myget/myget.service.js @@ -55,7 +55,7 @@ class MyGetDownloadService extends Downloads { ] } -export default { +export { MyGetVersionService, MyGetDownloadService, }; diff --git a/services/nexus/nexus-version.js b/services/nexus/nexus-version.js index 5d57dc7d2f0ce..dc621af6592c6 100644 --- a/services/nexus/nexus-version.js +++ b/services/nexus/nexus-version.js @@ -3,6 +3,6 @@ function isSnapshotVersion(version) { return version && version.match(pattern) } -export default { +export { isSnapshotVersion, }; diff --git a/services/node/node-version-color.js b/services/node/node-version-color.js index 4a9c26b743ca5..25dd6207c13bf 100644 --- a/services/node/node-version-color.js +++ b/services/node/node-version-color.js @@ -82,7 +82,7 @@ async function versionColorForRangeCurrent(range) { } } -export default { +export { versionColorForRangeCurrent, versionColorForRangeLts, }; diff --git a/services/node/testUtils/test-utils.js b/services/node/testUtils/test-utils.js index 92da5db4f552c..fea24a4f62e5d 100644 --- a/services/node/testUtils/test-utils.js +++ b/services/node/testUtils/test-utils.js @@ -143,7 +143,7 @@ const mockReleaseSchedule = () => nock => { .reply(200, schedule) } -export default { +export { mockPackageData, mockCurrentSha, mockVersionsSha, diff --git a/services/nuget-fixtures.js b/services/nuget-fixtures.js index ea58e66e942b7..0b34d0e9e65f0 100644 --- a/services/nuget-fixtures.js +++ b/services/nuget-fixtures.js @@ -48,7 +48,7 @@ const nuGetV3VersionJsonBuildMetadataWithDash = JSON.stringify({ ], }) -export default { +export { queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, diff --git a/services/nuget/nuget-helpers.js b/services/nuget/nuget-helpers.js index 278a0f1a51ee0..753da5353c971 100644 --- a/services/nuget/nuget-helpers.js +++ b/services/nuget/nuget-helpers.js @@ -101,7 +101,7 @@ function selectVersion(versions, includePrereleases) { } } -export default { +export { renderVersionBadge, renderDownloadBadge, odataToObject, diff --git a/services/nuget/nuget-v2-service-family.js b/services/nuget/nuget-v2-service-family.js index 4c4fd74731f5b..57bab6671b076 100644 --- a/services/nuget/nuget-v2-service-family.js +++ b/services/nuget/nuget-v2-service-family.js @@ -218,7 +218,7 @@ function createServiceFamily({ return { NugetVersionService, NugetVersionRedirector, NugetDownloadService } } -export default { +export { createFilter, fetch, createServiceFamily, diff --git a/services/nuget/nuget-v3-service-family.js b/services/nuget/nuget-v3-service-family.js index cd18224fac7d7..008a23d99a180 100644 --- a/services/nuget/nuget-v3-service-family.js +++ b/services/nuget/nuget-v3-service-family.js @@ -205,6 +205,6 @@ function createServiceFamily({ } } -export default { +export { createServiceFamily, }; diff --git a/services/nuget/nuget.service.js b/services/nuget/nuget.service.js index 0b9600b8bd6be..a0da143a69233 100644 --- a/services/nuget/nuget.service.js +++ b/services/nuget/nuget.service.js @@ -37,4 +37,4 @@ class NugetDownloadService extends Downloads { ] } -export default { NugetVersionService, NugetDownloadService }; +export { NugetVersionService, NugetDownloadService }; diff --git a/services/ore/ore-base.js b/services/ore/ore-base.js index d2e2ada5c8e87..5110967393152 100644 --- a/services/ore/ore-base.js +++ b/services/ore/ore-base.js @@ -83,4 +83,4 @@ class BaseOreService extends BaseJsonService { BaseOreService.sessionToken = null -export default { keywords, documentation, BaseOreService }; +export { keywords, documentation, BaseOreService }; diff --git a/services/package-json-helpers.js b/services/package-json-helpers.js index 648ad79e96fe3..1196566430af1 100644 --- a/services/package-json-helpers.js +++ b/services/package-json-helpers.js @@ -43,7 +43,7 @@ function getDependencyVersion({ return { range } } -export default { +export { isDependencyMap, isPackageJsonWithDependencies, getDependencyVersion, diff --git a/services/packagist/packagist-base.js b/services/packagist/packagist-base.js index 95f0a5463bd08..ae5754c862271 100644 --- a/services/packagist/packagist-base.js +++ b/services/packagist/packagist-base.js @@ -99,7 +99,7 @@ const cacheDocumentationFragment = `

` -export default { +export { allVersionsSchema, keywords, BasePackagistService, diff --git a/services/packagist/packagist-version.service.js b/services/packagist/packagist-version.service.js index b56e0aee74f38..9e40b9d42888e 100644 --- a/services/packagist/packagist-version.service.js +++ b/services/packagist/packagist-version.service.js @@ -141,4 +141,4 @@ const PackagistVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -export default { PackagistVersion, PackagistVersionRedirector }; +export { PackagistVersion, PackagistVersionRedirector }; diff --git a/services/php-version.js b/services/php-version.js index 5b939b4ebbe3f..53b0e5cfa2bf9 100644 --- a/services/php-version.js +++ b/services/php-version.js @@ -238,7 +238,7 @@ async function getPhpReleases(githubApiProvider) { }); } -export default { +export { compare, latest, isStable, diff --git a/services/pipenv-helpers.js b/services/pipenv-helpers.js index 4154a32cbebfe..e212850c66364 100644 --- a/services/pipenv-helpers.js +++ b/services/pipenv-helpers.js @@ -50,7 +50,7 @@ function getDependencyVersion({ } } -export default { +export { isLockfile, getDependencyVersion, }; diff --git a/services/powershellgallery/powershellgallery.service.js b/services/powershellgallery/powershellgallery.service.js index 14c64e52ddb32..e7f69cf41e6e2 100644 --- a/services/powershellgallery/powershellgallery.service.js +++ b/services/powershellgallery/powershellgallery.service.js @@ -92,7 +92,7 @@ class PowershellGalleryPlatformSupport extends BaseXmlService { } } -export default { +export { PowershellGalleryVersion, PowershellGalleryVersionRedirector, PowershellGalleryDownloads, diff --git a/services/pub/pub.service.js b/services/pub/pub.service.js index f07857dac53d9..f753c58aa70e5 100644 --- a/services/pub/pub.service.js +++ b/services/pub/pub.service.js @@ -66,4 +66,4 @@ const PubVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -export default { PubVersion, PubVersionRedirector }; +export { PubVersion, PubVersionRedirector }; diff --git a/services/puppetforge/puppetforge-base.js b/services/puppetforge/puppetforge-base.js index f0e6b273cc680..b8dec23a79ae3 100644 --- a/services/puppetforge/puppetforge-base.js +++ b/services/puppetforge/puppetforge-base.js @@ -42,7 +42,7 @@ class BasePuppetForgeModulesService extends BaseJsonService { } } -export default { +export { BasePuppetForgeModulesService, BasePuppetForgeUsersService, }; diff --git a/services/pypi/pypi-helpers.js b/services/pypi/pypi-helpers.js index fedc9fa08fd25..1921bb7655a8a 100644 --- a/services/pypi/pypi-helpers.js +++ b/services/pypi/pypi-helpers.js @@ -103,7 +103,7 @@ function getPackageFormats(packageData) { } } -export default { +export { parseClassifiers, parseDjangoVersionString, sortDjangoVersions, diff --git a/services/redmine/redmine.service.js b/services/redmine/redmine.service.js index f2cdc88d48ed2..7e48dd78f17d9 100644 --- a/services/redmine/redmine.service.js +++ b/services/redmine/redmine.service.js @@ -76,4 +76,4 @@ class RedminePluginStars extends BaseRedminePluginRating { } } -export default { RedminePluginRating, RedminePluginStars }; +export { RedminePluginRating, RedminePluginStars }; diff --git a/services/response-fixtures.js b/services/response-fixtures.js index 6f70cb6253449..b1ceac965a85d 100644 --- a/services/response-fixtures.js +++ b/services/response-fixtures.js @@ -1,6 +1,6 @@ const invalidJSONString = '{{{{{invalid json}}' -export default { +export { invalidJSON: () => [ 200, invalidJSONString, diff --git a/services/reuse/reuse-compliance-helper.js b/services/reuse/reuse-compliance-helper.js index 4a116d38a9f3f..67cd00b65c7c8 100644 --- a/services/reuse/reuse-compliance-helper.js +++ b/services/reuse/reuse-compliance-helper.js @@ -11,7 +11,7 @@ const isReuseCompliance = Joi.string() .valid('compliant', 'non-compliant', 'checking', 'unregistered') .required() -export default { +export { isReuseCompliance, COLOR_MAP, }; diff --git a/services/shippable/shippable.service.js b/services/shippable/shippable.service.js index 25520ea9b43f5..0abe36a357c31 100644 --- a/services/shippable/shippable.service.js +++ b/services/shippable/shippable.service.js @@ -77,4 +77,4 @@ const ShippableRedirect = redirector({ dateAdded: new Date('2020-07-18'), }) -export default { Shippable, ShippableRedirect }; +export { Shippable, ShippableRedirect }; diff --git a/services/snyk/snyk-test-helpers.js b/services/snyk/snyk-test-helpers.js index cc81366e7e759..6c523864abc64 100644 --- a/services/snyk/snyk-test-helpers.js +++ b/services/snyk/snyk-test-helpers.js @@ -3,7 +3,7 @@ const zeroVulnerabilitiesSvg = const twoVulnerabilitiesSvg = 'vulnerabilitiesvulnerabilities22' -export default { +export { zeroVulnerabilitiesSvg, twoVulnerabilitiesSvg, }; diff --git a/services/sonar/sonar-helpers.js b/services/sonar/sonar-helpers.js index cf96edb0b309a..81ed116589531 100644 --- a/services/sonar/sonar-helpers.js +++ b/services/sonar/sonar-helpers.js @@ -58,7 +58,7 @@ const documentation = `

` -export default { +export { testResultQueryParamSchema, renderTestResultMessage, renderTestResultBadge, diff --git a/services/test-validators.js b/services/test-validators.js index 186f4ab999108..c10236eef0bfb 100644 --- a/services/test-validators.js +++ b/services/test-validators.js @@ -138,7 +138,7 @@ const isCustomCompactTestTotals = makeCompactTestTotalsValidator({ skipped: '🤷', }) -export default { +export { isSemver, isVPlusTripleDottedVersion, isVPlusDottedVersionAtLeastOne, diff --git a/services/tester.js b/services/tester.js index a8fb86389c7df..5ed9f88fe0433 100644 --- a/services/tester.js +++ b/services/tester.js @@ -1,7 +1,7 @@ import createServiceTester from '../core/service-test-runner/create-service-tester.js'; import ServiceTester from '../core/service-test-runner/service-tester.js'; -export default { +export { createServiceTester, ServiceTester, }; diff --git a/services/text-formatters.js b/services/text-formatters.js index a64a8a3dd0987..8bf9c259950bd 100644 --- a/services/text-formatters.js +++ b/services/text-formatters.js @@ -122,7 +122,7 @@ function formatRelativeDate(timestamp) { .toLowerCase() } -export default { +export { starRating, currencyFromCode, ordinalNumber, diff --git a/services/travis/travis-php-version-redirect.service.js b/services/travis/travis-php-version-redirect.service.js index bc6f2721424bf..e24e659d908a8 100644 --- a/services/travis/travis-php-version-redirect.service.js +++ b/services/travis/travis-php-version-redirect.service.js @@ -23,4 +23,4 @@ const branchRedirect = redirector({ dateAdded: new Date('2020-07-12'), }) -export default { ciRedirect, branchRedirect }; +export { ciRedirect, branchRedirect }; diff --git a/services/vaadin-directory/vaadin-directory-base.js b/services/vaadin-directory/vaadin-directory-base.js index 081c445df451a..d93647eccdedb 100644 --- a/services/vaadin-directory/vaadin-directory-base.js +++ b/services/vaadin-directory/vaadin-directory-base.js @@ -27,4 +27,4 @@ class BaseVaadinDirectoryService extends BaseJsonService { } } -export default { BaseVaadinDirectoryService }; +export { BaseVaadinDirectoryService }; diff --git a/services/validators.js b/services/validators.js index 22c7410af3aec..580dd1aa31293 100644 --- a/services/validators.js +++ b/services/validators.js @@ -3,7 +3,7 @@ const Joi = require('joi').extend(semver).extend(semverRange) const optionalNonNegativeInteger = Joi.number().integer().min(0) -export default { +export { optionalNonNegativeInteger, nonNegativeInteger: optionalNonNegativeInteger.required(), diff --git a/services/version.js b/services/version.js index a19a5ab079125..96083258577c6 100644 --- a/services/version.js +++ b/services/version.js @@ -160,7 +160,7 @@ function renderVersionBadge({ version, tag, defaultLabel }) { } } -export default { +export { latest, listCompare, slice, diff --git a/services/visual-studio-app-center/visual-studio-app-center-base.js b/services/visual-studio-app-center/visual-studio-app-center-base.js index 5c623ab3bab5d..091c9d9613ec1 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-base.js +++ b/services/visual-studio-app-center/visual-studio-app-center-base.js @@ -35,4 +35,4 @@ class BaseVisualStudioAppCenterService extends BaseJsonService { } } -export default { keywords, documentation, BaseVisualStudioAppCenterService }; +export { keywords, documentation, BaseVisualStudioAppCenterService }; diff --git a/services/w3c/w3c-validation-helper.js b/services/w3c/w3c-validation-helper.js index 19aa2bbaa7980..1c15c08fbc6cf 100644 --- a/services/w3c/w3c-validation-helper.js +++ b/services/w3c/w3c-validation-helper.js @@ -145,7 +145,7 @@ const documentation = `

` -export default { +export { documentation, presetRegex, getColor, diff --git a/services/website-status.js b/services/website-status.js index 3e6896d0eac25..098ad1ee270cd 100644 --- a/services/website-status.js +++ b/services/website-status.js @@ -28,7 +28,7 @@ function renderWebsiteStatus({ } } -export default { +export { queryParamSchema, exampleQueryParams, renderWebsiteStatus, diff --git a/services/wordpress/wordpress-version-color.js b/services/wordpress/wordpress-version-color.js index a8bd6f9457c3c..afe8a61d03c53 100644 --- a/services/wordpress/wordpress-version-color.js +++ b/services/wordpress/wordpress-version-color.js @@ -59,7 +59,7 @@ async function versionColorForWordpressVersion(version) { } } -export default { +export { toSemver, getOfferedVersions, versionColorForWordpressVersion, diff --git a/services/youtube/youtube-base.js b/services/youtube/youtube-base.js index 58a0414840ef3..34115a2c4fcc0 100644 --- a/services/youtube/youtube-base.js +++ b/services/youtube/youtube-base.js @@ -90,4 +90,4 @@ class YouTubeChannelBase extends YouTubeBase { static type = 'channel' } -export default { documentation, YouTubeVideoBase, YouTubeChannelBase }; +export { documentation, YouTubeVideoBase, YouTubeChannelBase }; From 1a939f61f7c633f93f5dc5e53cd7450090a4c03c Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 15:57:36 +0100 Subject: [PATCH 04/46] Fix incorrect array imports --- services/bitbucket/bitbucket-pull-request.spec.js | 2 +- services/scrutinizer/scrutinizer-coverage.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/bitbucket/bitbucket-pull-request.spec.js b/services/bitbucket/bitbucket-pull-request.spec.js index 9ff40764cb1ea..a2a8007027956 100644 --- a/services/bitbucket/bitbucket-pull-request.spec.js +++ b/services/bitbucket/bitbucket-pull-request.spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import nock from 'nock'; import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import [BitbucketPullRequest] from './bitbucket-pull-request.service.js'; +import {BitbucketPullRequest} from './bitbucket-pull-request.service.js'; describe('BitbucketPullRequest', function () { cleanUpNockAfterEach() diff --git a/services/scrutinizer/scrutinizer-coverage.spec.js b/services/scrutinizer/scrutinizer-coverage.spec.js index 07a947e87cafb..cfde5dfa26733 100644 --- a/services/scrutinizer/scrutinizer-coverage.spec.js +++ b/services/scrutinizer/scrutinizer-coverage.spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; import {InvalidResponse, NotFound} from '..'; -import [ScrutinizerCoverage] from './scrutinizer-coverage.service.js'; +import {ScrutinizerCoverage} from './scrutinizer-coverage.service.js'; describe('ScrutinizerCoverage', function () { test(ScrutinizerCoverage.render, () => { From 489a814bdcc0bdacc833014ed541462875b026b4 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 16:02:32 +0100 Subject: [PATCH 05/46] Fix logo loading --- lib/logos.js | 6 ++++-- scripts/export-supported-features-cli.js | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/logos.js b/lib/logos.js index cedd3d8478c2f..b2e3b1fe1e743 100644 --- a/lib/logos.js +++ b/lib/logos.js @@ -2,8 +2,10 @@ import Joi from 'joi'; import {toSvgColor, brightness, normalizeColor} from '../badge-maker/lib/color.js'; import coalesce from '../core/base-service/coalesce.js'; import {svg2base64} from './svg-helpers.js'; -const logos = require('./load-logos')() -const simpleIcons = require('./load-simple-icons')() +import loadLogos from './load-logos.js' +import loadSimpleIcons from './load-simple-icons.js' +const logos = loadLogos() +const simpleIcons = loadSimpleIcons() // for backwards-compatibility with deleted logos const logoAliases = { diff --git a/scripts/export-supported-features-cli.js b/scripts/export-supported-features-cli.js index a3dfb61486d58..004918bd06bd1 100644 --- a/scripts/export-supported-features-cli.js +++ b/scripts/export-supported-features-cli.js @@ -1,9 +1,9 @@ 'use strict' -const logos = require('../lib/load-logos')() -const simpleIcons = require('../lib/load-simple-icons')() - -const shieldsLogos = Object.keys(logos) +import loadLogos from '../lib/load-logos.js' +import loadSimpleIcons from '../lib/load-simple-icons.js' +const shieldsLogos = Object.keys(loadLogos()) +const simpleIcons = loadSimpleIcons() const simpleIconSet = new Set(Object.keys(simpleIcons)) shieldsLogos.forEach(logo => simpleIconSet.delete(logo)) From a25409083f16791e59169338f168443ad130cc97 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 16:11:12 +0100 Subject: [PATCH 06/46] Replace __dirname and __filename --- core/base-service/loader.js | 3 ++- core/server/server.js | 4 ++-- core/server/server.spec.js | 3 ++- gatsby-config.js | 5 +++-- lib/load-logos.js | 3 ++- scripts/badge-cli.js | 4 ++-- server.js | 3 ++- services/node/testUtils/test-utils.js | 5 +++-- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/base-service/loader.js b/core/base-service/loader.js index cd83a0fb91e2a..62603ab8fab60 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -1,11 +1,12 @@ import path from 'path'; +import {fileURLToPath} from 'url'; import glob from 'glob'; import countBy from 'lodash.countby'; import categories from '../../services/categories.js'; import BaseService from './base.js'; import {assertValidServiceDefinitionExport} from './service-definitions.js'; -const serviceDir = path.join(__dirname, '..', '..', 'services') +const serviceDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'services') class InvalidService extends Error { constructor(message) { diff --git a/core/server/server.js b/core/server/server.js index ea32ce96d35ed..84a535b72dc7a 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -3,7 +3,7 @@ */ import path from 'path'; -import url from 'url'; +import url, {fileURLToPath} from 'url'; const { URL } = url import cloudflareMiddleware from 'cloudflare-middleware'; import bytes from 'bytes'; @@ -142,7 +142,7 @@ const publicConfigSchema = Joi.object({ requestTimeoutSeconds: nonNegativeInteger, requestTimeoutMaxAgeSeconds: nonNegativeInteger, documentRoot: Joi.string().default( - path.resolve(__dirname, '..', '..', 'public') + path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'public') ), requireCloudflare: Joi.boolean().required(), }).required() diff --git a/core/server/server.spec.js b/core/server/server.spec.js index 326ea6a0a0bda..07364231e50c0 100644 --- a/core/server/server.spec.js +++ b/core/server/server.spec.js @@ -1,4 +1,5 @@ import path from 'path'; +import {fileURLToPath} from 'url' import {expect} from 'chai'; import isSvg from 'is-svg'; import config from 'config'; @@ -16,7 +17,7 @@ describe('The server', function () { this.timeout(10000) server = await createTestServer({ public: { - documentRoot: path.resolve(__dirname, 'test-public'), + documentRoot: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'test-public'), }, }) baseUrl = server.baseUrl diff --git a/gatsby-config.js b/gatsby-config.js index a9935ccdb4507..004940a49d31b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,4 +1,5 @@ import path from 'path'; +import {fileURLToPath} from 'url' export { siteMetadata: { @@ -11,7 +12,7 @@ export { { resolve: 'gatsby-plugin-page-creator', options: { - path: path.join(__dirname, 'frontend', 'pages'), + path: path.join(path.dirname(fileURLToPath(import.meta.url)), 'frontend', 'pages'), }, }, 'gatsby-plugin-react-helmet', @@ -24,7 +25,7 @@ export { // resolve: 'gatsby-source-filesystem', // options: { // name: 'static', - // path: `${__dirname}/frontend/static`, + // path: `${path.dirname(fileURLToPath(import.meta.url))}/frontend/static`, // }, // }, ], diff --git a/lib/load-logos.js b/lib/load-logos.js index 757cba5ec4e3e..5827fbbf8d941 100644 --- a/lib/load-logos.js +++ b/lib/load-logos.js @@ -1,11 +1,12 @@ import fs from 'fs'; import path from 'path'; +import {fileURLToPath} from 'url'; import {svg2base64} from './svg-helpers.js'; function loadLogos() { // Cache svg logos from disk in base64 string const logos = {} - const logoDir = path.join(__dirname, '..', 'logo') + const logoDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'logo') const logoFiles = fs.readdirSync(logoDir) logoFiles.forEach(filename => { if (filename[0] === '.') { diff --git a/scripts/badge-cli.js b/scripts/badge-cli.js index 4a5383e2663ad..6cea4cff12e3b 100644 --- a/scripts/badge-cli.js +++ b/scripts/badge-cli.js @@ -1,4 +1,4 @@ -import {URL} from 'url'; +import {fileURLToPath, URL} from 'url'; const config = require('config').util.toObject() import got from 'got'; import emojic from 'emojic'; @@ -27,7 +27,7 @@ async function traceBadge(badgeUrl) { async function main() { if (process.argv.length < 3) { - console.error(`Usage: node ${__filename} badge-url`) + console.error(`Usage: node ${fileURLToPath(import.meta.url)} badge-url`) process.exit(1) } const [, , url] = process.argv diff --git a/server.js b/server.js index 4489cfb2b17ab..d8b8bae0c643c 100644 --- a/server.js +++ b/server.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; +import {fileURLToPath} from 'url' // Set up Sentry reporting as early in the process as possible. const config = require('config').util.toObject() @@ -41,7 +42,7 @@ if (fs.existsSync('.env')) { process.exit(1) } -const legacySecretsPath = path.join(__dirname, 'private', 'secret.json') +const legacySecretsPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'private', 'secret.json') if (fs.existsSync(legacySecretsPath)) { console.error( `Legacy secrets file found at ${legacySecretsPath}. It should be deleted and secrets replaced with environment variables or config/local.yml` diff --git a/services/node/testUtils/test-utils.js b/services/node/testUtils/test-utils.js index fea24a4f62e5d..430a89914ae5e 100644 --- a/services/node/testUtils/test-utils.js +++ b/services/node/testUtils/test-utils.js @@ -1,16 +1,17 @@ import fs from 'fs'; import path from 'path'; +import {fileURLToPath} from 'url' import moment from 'moment'; const dateFormat = 'YYYY-MM-DD' const templates = { packageJsonVersionsTemplate: fs.readFileSync( - path.join(__dirname, `packageJsonVersionsTemplate.json`), + path.join(path.dirname(fileURLToPath(import.meta.url)), `packageJsonVersionsTemplate.json`), 'utf-8' ), packageJsonTemplate: fs.readFileSync( - path.join(__dirname, `packageJsonTemplate.json`), + path.join(path.dirname(fileURLToPath(import.meta.url)), `packageJsonTemplate.json`), 'utf-8' ), } From c7dba905849cde29ee01099950a999c521b59948 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 23 May 2021 16:12:56 +0100 Subject: [PATCH 07/46] Fix config loading --- core/base-service/trace.js | 5 +++-- core/server/in-process-server-test-helpers.js | 4 ++-- scripts/badge-cli.js | 4 ++-- scripts/benchmark-performance.js | 4 ++-- scripts/redis-connectivity-test.js | 9 +++++---- server.js | 7 +++---- services/github/github-api-provider.integration.js | 4 ++-- services/suggest.integration.js | 4 ++-- services/test-helpers.js | 3 ++- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/core/base-service/trace.js b/core/base-service/trace.js index 99642037aea7f..5f7527929d55c 100644 --- a/core/base-service/trace.js +++ b/core/base-service/trace.js @@ -1,5 +1,6 @@ import chalk from 'chalk'; -const config = require('config').util.toObject() +import config from 'config'; +const objectConfig = config.util.toObject() // Config is loaded globally but it would be better to inject it. To do that, // there needs to be one instance of the service created at registration time, @@ -8,7 +9,7 @@ const config = require('config').util.toObject() // thereby gaining access to the injected config. const { services: { trace: enableTraceLogging }, -} = config.public +} = objectConfig.public function _formatLabelForStage(stage, label) { const colorFn = { diff --git a/core/server/in-process-server-test-helpers.js b/core/server/in-process-server-test-helpers.js index 0638a391d0d89..455620f0b6e3f 100644 --- a/core/server/in-process-server-test-helpers.js +++ b/core/server/in-process-server-test-helpers.js @@ -1,10 +1,10 @@ import merge from 'deepmerge'; -const config = require('config').util.toObject() +import config from 'config'; import portfinder from 'portfinder'; import Server from './server.js'; async function createTestServer(customConfig = {}) { - const mergedConfig = merge(config, customConfig) + const mergedConfig = merge(config.util.toObject(), customConfig) if (!mergedConfig.public.bind.port) { mergedConfig.public.bind.port = await portfinder.getPortPromise() } diff --git a/scripts/badge-cli.js b/scripts/badge-cli.js index 6cea4cff12e3b..326bd87876230 100644 --- a/scripts/badge-cli.js +++ b/scripts/badge-cli.js @@ -1,5 +1,5 @@ import {fileURLToPath, URL} from 'url'; -const config = require('config').util.toObject() +import config from 'config'; import got from 'got'; import emojic from 'emojic'; import Server from '../core/server/server.js'; @@ -16,7 +16,7 @@ function normalizeBadgeUrl(url) { } async function traceBadge(badgeUrl) { - const server = new Server(config) + const server = new Server(config.util.toObject()) await server.start() const body = await got( `${server.baseUrl.replace(/\/$/, '')}${badgeUrl}` diff --git a/scripts/benchmark-performance.js b/scripts/benchmark-performance.js index 4e446ad3dfd88..9b0c87411c578 100644 --- a/scripts/benchmark-performance.js +++ b/scripts/benchmark-performance.js @@ -1,10 +1,10 @@ -const config = require('config').util.toObject() +import config from 'config'; import got from 'got'; import minimist from 'minimist'; import Server from '../core/server/server.js'; async function main() { - const server = new Server(config) + const server = new Server(config.util.toObject()) await server.start() const args = minimist(process.argv) const iterations = parseInt(args.iterations) || 10000 diff --git a/scripts/redis-connectivity-test.js b/scripts/redis-connectivity-test.js index 31266cd6afc8f..f2849ad17cb36 100644 --- a/scripts/redis-connectivity-test.js +++ b/scripts/redis-connectivity-test.js @@ -1,10 +1,11 @@ -const config = require('config').util.toObject() -console.log(config) +import config from 'config'; +const objectConfig = config.util.toObject() +console.log(objectConfig) import GithubConstellation from '../services/github/github-constellation.js'; const { persistence } = new GithubConstellation({ - service: config.public.services.github, - private: config.private, + service: objectConfig.public.services.github, + private: objectConfig.private, }) async function main() { diff --git a/server.js b/server.js index d8b8bae0c643c..77f2e1914d564 100644 --- a/server.js +++ b/server.js @@ -5,7 +5,8 @@ import path from 'path'; import {fileURLToPath} from 'url' // Set up Sentry reporting as early in the process as possible. -const config = require('config').util.toObject() +import configModule from 'config'; +const config = configModule.util.toObject() import Sentry from '@sentry/node'; const disabledIntegrations = ['Console', 'Http'] Sentry.init({ @@ -51,9 +52,7 @@ if (fs.existsSync(legacySecretsPath)) { } import Server from './core/server/server.js'; -const server = (function() { - export default __a; -}()) +export const server = new Server(config) ;(async () => { try { diff --git a/services/github/github-api-provider.integration.js b/services/github/github-api-provider.integration.js index c55a1dd6710ff..13a5ef2a55059 100644 --- a/services/github/github-api-provider.integration.js +++ b/services/github/github-api-provider.integration.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -const config = require('config').util.toObject() +import config from 'config'; import GithubApiProvider from './github-api-provider.js'; describe('Github API provider', function () { @@ -8,7 +8,7 @@ describe('Github API provider', function () { let token before(function () { - token = config.private.gh_token + token = config.util.toObject().private.gh_token if (!token) { throw Error('The integration tests require a gh_token to be set') } diff --git a/services/suggest.integration.js b/services/suggest.integration.js index 13f020efa0122..94a74a3a90943 100644 --- a/services/suggest.integration.js +++ b/services/suggest.integration.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import Camp from '@shields_io/camp'; import portfinder from 'portfinder'; -const config = require('config').util.toObject() +import config from 'config'; import got from '../core/got-test-client.js'; import {setRoutes} from './suggest.js'; import GithubApiProvider from './github/github-api-provider.js'; @@ -11,7 +11,7 @@ describe('Badge suggestions for', function () { let token, apiProvider before(function () { - token = config.private.gh_token + token = config.util.toObject().private.gh_token if (!token) { throw Error('The integration tests require a gh_token to be set') } diff --git a/services/test-helpers.js b/services/test-helpers.js index 9313d026deb4f..9f4107930e1fe 100644 --- a/services/test-helpers.js +++ b/services/test-helpers.js @@ -1,6 +1,7 @@ import nock from 'nock'; import request from 'request'; -const runnerConfig = require('config').util.toObject() +import config from 'config'; +const runnerConfig = config.util.toObject() import {promisify} from '../core/base-service/legacy-request-handler.js'; function cleanUpNockAfterEach() { From 1593bcd52b272c7decd084557f9b0a4d4367f53c Mon Sep 17 00:00:00 2001 From: PyvesB Date: Tue, 1 Jun 2021 22:12:29 +0100 Subject: [PATCH 08/46] Switch to asynchronous service loading --- core/base-service/loader.js | 75 +++++++++-------------- core/server/server.js | 6 +- core/service-test-runner/cli.js | 2 +- core/service-test-runner/runner.js | 4 +- scripts/export-service-definitions-cli.js | 2 +- services/check-services.spec.js | 4 +- 6 files changed, 38 insertions(+), 55 deletions(-) diff --git a/core/base-service/loader.js b/core/base-service/loader.js index 62603ab8fab60..8904fb41f2df2 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -15,54 +15,37 @@ class InvalidService extends Error { } } -function loadServiceClasses(servicePaths) { +async function loadServiceClasses(servicePaths) { if (!servicePaths) { servicePaths = glob.sync(path.join(serviceDir, '**', '*.service.js')) } - let serviceClasses = [] - servicePaths.forEach(servicePath => { - const module = require(servicePath) - - const theseServiceClasses = [] - if ( - !module || - (module.constructor === Array && module.length === 0) || - (module.constructor === Object && Object.keys(module).length === 0) - ) { - throw new InvalidService( - `Expected ${servicePath} to export a service or a collection of services` - ) - } else if (module.prototype instanceof BaseService) { - theseServiceClasses.push(module) - } else if (module.constructor === Array || module.constructor === Object) { - for (const key in module) { - const serviceClass = module[key] - if (serviceClass.prototype instanceof BaseService) { - theseServiceClasses.push(serviceClass) - } else { - throw new InvalidService( - `Expected ${servicePath} to export a service or a collection of services; one of them was ${serviceClass}` - ) - } - } + const serviceClasses = [] + for await (const servicePath of servicePaths) { + const module = await import(`file://${servicePath}`) + + if (typeof module === 'object' && Object.keys(module).length > 0) { + Object.values(module) + .flatMap(element => typeof element === 'object' ? Object.values(element) : element) + .forEach(serviceClass => { + if (!(serviceClass.prototype instanceof BaseService)) { + throw new InvalidService( + `Expected ${servicePath} to export a service or a collection of services; one of them was ${serviceClass}` + ) + } + // Decorate each service class with the directory that contains it. + serviceClass.serviceFamily = servicePath + .replace(serviceDir, '') + .split(path.sep)[1] + serviceClass.validateDefinition() + return serviceClasses.push(serviceClass) + }) } else { throw new InvalidService( `Expected ${servicePath} to export a service or a collection of services; got ${module}` ) } - - // Decorate each service class with the directory that contains it. - theseServiceClasses.forEach(serviceClass => { - serviceClass.serviceFamily = servicePath - .replace(serviceDir, '') - .split(path.sep)[1] - }) - - serviceClasses = serviceClasses.concat(theseServiceClasses) - }) - - serviceClasses.forEach(ServiceClass => ServiceClass.validateDefinition()) + } return serviceClasses } @@ -79,8 +62,8 @@ function assertNamesUnique(names, { message }) { } } -function checkNames() { - const services = loadServiceClasses() +async function checkNames() { + const services = await loadServiceClasses() assertNamesUnique( services.map(({ name }) => name), { @@ -89,8 +72,8 @@ function checkNames() { ) } -function collectDefinitions() { - const services = loadServiceClasses() +async function collectDefinitions() { + const services = (await loadServiceClasses()) // flatMap. .map(ServiceClass => ServiceClass.getDefinition()) .reduce((accum, these) => accum.concat(these), []) @@ -102,10 +85,10 @@ function collectDefinitions() { return result } -function loadTesters() { - return glob +async function loadTesters() { + return Promise.all(glob .sync(path.join(serviceDir, '**', '*.tester.js')) - .map(path => require(path)) + .map(async path => await import(`file://${path}`))) } export { diff --git a/core/server/server.js b/core/server/server.js index 84a535b72dc7a..8228b8c80db40 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -398,11 +398,11 @@ class Server { * Iterate all the service classes defined in /services, * load each service and register a Scoutcamp route for each service. */ - registerServices() { + async registerServices() { const { config, camp, metricInstance } = this const { apiProvider: githubApiProvider } = this.githubConstellation - loadServiceClasses().forEach(serviceClass => + ;(await loadServiceClasses()).forEach(serviceClass => serviceClass.register( { camp, handleRequest, githubApiProvider, metricInstance }, { @@ -463,7 +463,7 @@ class Server { this.registerErrorHandlers() this.registerRedirects() - this.registerServices() + await this.registerServices() camp.timeout = this.config.public.requestTimeoutSeconds * 1000 if (this.config.public.requestTimeoutSeconds > 0) { diff --git a/core/service-test-runner/cli.js b/core/service-test-runner/cli.js index 979a56fb52c2d..96b4e46e65bb2 100644 --- a/core/service-test-runner/cli.js +++ b/core/service-test-runner/cli.js @@ -90,7 +90,7 @@ if (process.env.TESTED_SERVER_URL) { const skipIntercepted = envFlag(process.env.SKIP_INTERCEPTED, false) const runner = new Runner({ baseUrl, skipIntercepted, retry }) -runner.prepare() +await runner.prepare() // The server's request cache causes side effects between tests. if (!process.env.TESTED_SERVER_URL) { diff --git a/core/service-test-runner/runner.js b/core/service-test-runner/runner.js index f1b2f0a618429..e50d195a9dcbb 100644 --- a/core/service-test-runner/runner.js +++ b/core/service-test-runner/runner.js @@ -23,8 +23,8 @@ class Runner { /** * Prepare the runner by loading up all the ServiceTester objects. */ - prepare() { - this.testers = loadTesters() + async prepare() { + this.testers = await loadTesters() this.testers.forEach(tester => { tester.beforeEach = () => { this.beforeEach() diff --git a/scripts/export-service-definitions-cli.js b/scripts/export-service-definitions-cli.js index 39ddc6b768b16..44ea80f602de4 100644 --- a/scripts/export-service-definitions-cli.js +++ b/scripts/export-service-definitions-cli.js @@ -1,7 +1,7 @@ import yaml from 'js-yaml'; import {collectDefinitions} from '../core/base-service/loader.js'; -const definitions = collectDefinitions() +const definitions = await collectDefinitions() // Omit undefined // https://github.com/nodeca/js-yaml/issues/356#issuecomment-312430599 diff --git a/services/check-services.spec.js b/services/check-services.spec.js index 63090b7cb8535..ca7dcf134a9b4 100644 --- a/services/check-services.spec.js +++ b/services/check-services.spec.js @@ -5,9 +5,9 @@ import {checkNames, collectDefinitions} from '../core/base-service/loader.js'; it('Services have unique names', function () { this.timeout(30000) - checkNames() + await checkNames() }) it('Can collect the service definitions', function () { - collectDefinitions() + await collectDefinitions() }) From 90325729631589c06ca06160426bcfc5044054e4 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 6 Jun 2021 11:07:52 +0100 Subject: [PATCH 09/46] Fix load issues with service classes --- core/base-service/base-graphql.js | 2 +- services/amo/amo-base.js | 2 +- services/amo/amo-downloads.service.js | 2 +- services/ansible/ansible-quality.service.js | 2 +- services/ansible/ansible-role.service.js | 2 +- services/apm/apm.service.js | 2 +- services/appveyor/appveyor-base.js | 2 +- .../appveyor-build-redirect.service.js | 2 +- .../appveyor/appveyor-job-build.service.js | 2 +- services/appveyor/appveyor-job-build.spec.js | 2 +- services/archlinux/archlinux.service.js | 2 +- services/aur/aur.service.js | 2 +- services/azure-devops/azure-devops-base.js | 2 +- .../azure-devops-build.service.js | 2 +- .../azure-devops-release.service.js | 2 +- services/azure-devops/vso-redirect.service.js | 12 ++++---- services/beerpay/beerpay.service.js | 2 +- services/bintray/bintray.service.js | 2 +- services/bit/bit-components.service.js | 2 +- .../bitbucket/bitbucket-issues.service.js | 5 ++-- .../bitbucket/bitbucket-pipelines.service.js | 2 +- .../bitbucket-pull-request.service.js | 5 ++-- services/bithound/bithound.service.js | 2 +- services/bitrise/bitrise.service.js | 2 +- services/bountysource/bountysource.service.js | 2 +- services/bower/bower-base.js | 2 +- services/bower/bower-version.service.js | 2 +- services/bstats/bstats-players.service.js | 2 +- services/bstats/bstats-servers.service.js | 2 +- services/bugzilla/bugzilla.service.js | 2 +- services/buildkite/buildkite.service.js | 2 +- services/bundlephobia/bundlephobia.service.js | 2 +- services/cauditor/cauditor.service.js | 2 +- services/cdnjs/cdnjs.service.js | 2 +- .../chrome-web-store/chrome-web-store-base.js | 4 +-- .../chrome-web-store-price.service.js | 2 +- .../chrome-web-store-rating.service.js | 2 +- .../chrome-web-store-users.service.js | 2 +- .../chrome-web-store-version.service.js | 2 +- .../cii-best-practices.service.js | 2 +- services/circleci/circleci.service.js | 4 +-- services/cirrus/cirrus.service.js | 2 +- services/clojars/clojars-base.js | 2 +- services/clojars/clojars-version.service.js | 2 +- services/cocoapods/cocoapods-apps.service.js | 2 +- services/cocoapods/cocoapods-base.js | 2 +- services/cocoapods/cocoapods-docs.service.js | 2 +- .../cocoapods/cocoapods-downloads.service.js | 2 +- services/codacy/codacy-coverage.service.js | 2 +- services/codacy/codacy-grade.service.js | 2 +- ...codeclimate-analysis-redirector.service.js | 2 +- .../codeclimate-analysis.service.js | 2 +- services/codeclimate/codeclimate-common.js | 2 +- ...codeclimate-coverage-redirector.service.js | 2 +- .../codeclimate-coverage.service.js | 2 +- services/codecov/codecov-redirect.service.js | 2 +- services/codecov/codecov.service.js | 2 +- .../codefactor/codefactor-grade.service.js | 2 +- services/codeship/codeship.service.js | 2 +- services/codetally/codetally.service.js | 2 +- services/conda/conda-base.js | 2 +- .../continuousphp/continuousphp.service.js | 2 +- services/cookbook/cookbook.service.js | 2 +- .../coveralls/coveralls-redirector.service.js | 2 +- services/coveralls/coveralls.service.js | 2 +- .../coverity/coverity-on-demand.service.js | 2 +- services/coverity/coverity-scan.service.js | 2 +- services/cpan/cpan.js | 2 +- services/cran/cran.service.js | 2 +- services/crates/crates-base.js | 2 +- services/crates/crates-downloads.service.js | 2 +- services/crates/crates-version.service.js | 2 +- services/crates/crates-version.spec.js | 2 +- services/criterion/constants.js | 10 +++---- services/criterion/criterion.service.js | 2 +- services/ctan/ctan.service.js | 2 +- services/date/date.service.js | 2 +- services/david/david.service.js | 2 +- services/debian/debian.service.js | 2 +- services/debug/debug.service.js | 2 +- services/dependabot/dependabot.service.js | 2 +- services/depfu/depfu.service.js | 2 +- services/deprecation-helpers.js | 2 +- services/discord/discord.service.js | 2 +- .../discourse/discourse-redirect.service.js | 2 +- services/discourse/discourse.service.js | 2 +- services/dockbit/dockbit.service.js | 2 +- services/docker/docker-automated.service.js | 2 +- services/docker/docker-build.service.js | 2 +- .../docker/docker-cloud-automated.service.js | 2 +- services/docker/docker-cloud-build.service.js | 2 +- services/docker/docker-helpers.js | 2 +- services/docker/docker-pulls.service.js | 2 +- services/docker/docker-size.service.js | 2 +- services/docker/docker-stars.service.js | 2 +- services/docker/docker-version.service.js | 2 +- services/docker/docker-version.spec.js | 2 +- services/docsrs/docsrs.service.js | 2 +- services/dotnetstatus/dotnetstatus.service.js | 2 +- services/drone/drone-build.service.js | 2 +- services/dub/dub-download.service.js | 2 +- services/dub/dub-license.service.js | 2 +- services/dub/dub-version.service.js | 2 +- services/dynamic-common.js | 2 +- services/dynamic/dynamic-json.service.js | 2 +- services/dynamic/dynamic-xml.service.js | 2 +- services/dynamic/dynamic-xml.spec.js | 2 +- services/dynamic/dynamic-yaml.service.js | 2 +- services/dynamic/json-path.js | 2 +- .../eclipse-marketplace-base.js | 2 +- services/ecologi/ecologi-carbon.service.js | 2 +- services/ecologi/ecologi-trees.service.js | 2 +- services/elm-package/elm-package.service.js | 2 +- services/endpoint-common.js | 2 +- .../endpoint/endpoint-redirect.service.js | 2 +- services/endpoint/endpoint.service.js | 2 +- services/f-droid/f-droid.service.js | 2 +- services/fedora/fedora.service.js | 2 +- services/feedz/feedz.service.js | 2 +- services/flathub/flathub.service.js | 2 +- services/gem/gem-downloads.service.js | 2 +- services/gem/gem-owner.service.js | 2 +- services/gem/gem-rank.service.js | 2 +- services/gem/gem-version.service.js | 2 +- services/gemnasium/gemnasium.service.js | 2 +- services/gerrit/gerrit.service.js | 2 +- services/github/github-auth-service.js | 2 +- .../github/github-commit-status.service.js | 2 +- services/github/github-common-fetch.js | 2 +- services/github/github-common-release.js | 4 +-- services/github/github-deployments.service.js | 2 +- .../github-directory-file-count.service.js | 2 +- .../github-directory-file-count.spec.js | 2 +- services/github/github-downloads.service.js | 2 +- services/github/github-go-mod.service.js | 2 +- services/github/github-helpers.js | 2 +- .../github-issue-detail-redirect.service.js | 2 +- .../github/github-issue-detail.service.js | 2 +- services/github/github-issue-detail.spec.js | 2 +- services/github/github-pipenv.service.js | 2 +- services/github/github-r-package.service.js | 2 +- services/github/github-r-package.spec.js | 2 +- services/github/github-release.service.js | 4 +-- services/github/github-size.service.js | 2 +- services/github/github-sponsors.service.js | 2 +- services/github/github-tag.service.js | 4 +-- .../github/github-workflow-status.service.js | 2 +- services/gitlab/gitlab-coverage.service.js | 2 +- .../gitlab/gitlab-pipeline-status.service.js | 2 +- services/gitter/gitter.service.js | 2 +- services/gratipay/gratipay.service.js | 2 +- services/hackage/hackage-deps.service.js | 2 +- services/hackage/hackage-version.service.js | 2 +- services/hexpm/hexpm.service.js | 2 +- services/homebrew/homebrew-cask.service.js | 2 +- .../homebrew/homebrew-downloads.service.js | 2 +- services/homebrew/homebrew-version.service.js | 2 +- services/hsts/hsts.service.js | 2 +- services/imagelayers/imagelayers.service.js | 2 +- services/index.js | 6 +--- services/issuestats/issuestats.service.js | 2 +- services/itunes/itunes.service.js | 2 +- services/jenkins/jenkins-base.js | 2 +- .../jenkins/jenkins-build-redirect.service.js | 2 +- services/jenkins/jenkins-common.js | 2 +- .../jenkins-coverage-redirector.service.js | 2 +- .../jenkins-plugin-installs.service.js | 2 +- .../jenkins/jenkins-plugin-version.service.js | 2 +- .../jenkins-tests-redirector.service.js | 2 +- services/jenkins/jenkins-tests.service.js | 2 +- services/jetbrains/jetbrains-base.js | 2 +- services/jira/jira-issue-redirect.service.js | 2 +- services/jira/jira-issue.service.js | 2 +- services/jira/jira-sprint-redirect.service.js | 2 +- services/jira/jira-sprint.service.js | 2 +- services/jitpack/jitpack-downloads.service.js | 2 +- .../jitpack-version-redirector.service.js | 2 +- services/jitpack/jitpack-version.service.js | 2 +- services/jsdelivr/jsdelivr-base.js | 2 +- services/keybase/keybase-profile.js | 2 +- .../leanpub/leanpub-book-summary.service.js | 2 +- services/lgtm/lgtm-base.js | 2 +- services/lgtm/lgtm-redirector.service.js | 2 +- services/liberapay/liberapay-base.js | 2 +- services/liberapay/liberapay-gives.service.js | 2 +- services/liberapay/liberapay-goal.service.js | 2 +- services/liberapay/liberapay-goal.spec.js | 2 +- .../liberapay/liberapay-receives.service.js | 2 +- .../librariesio-dependencies.service.js | 2 +- .../librariesio-dependent-repos.service.js | 2 +- .../librariesio-dependents.service.js | 2 +- .../librariesio-sourcerank.service.js | 2 +- services/libscore/libscore.service.js | 2 +- services/localizely/localizely.service.js | 2 +- services/luarocks/luarocks.service.js | 2 +- services/magnumci/magnumci.service.js | 2 +- services/maintenance/maintenance.service.js | 2 +- services/mastodon/mastodon-follow.service.js | 2 +- services/matrix/matrix.service.js | 2 +- .../maven-central/maven-central.service.js | 2 +- .../maven-metadata-redirect.service.js | 2 +- .../maven-metadata/maven-metadata.service.js | 2 +- services/microbadger/microbadger-base.js | 2 +- .../microbadger/microbadger-size.service.js | 2 +- .../mozilla-observatory.service.js | 2 +- services/netlify/netlify.service.js | 2 +- services/nexus/nexus-redirect.service.js | 2 +- services/nexus/nexus.service.js | 2 +- services/nexus/nexus.spec.js | 2 +- services/nodeping/nodeping-status.service.js | 2 +- services/nodeping/nodeping-uptime.service.js | 2 +- services/npm/npm-base.js | 2 +- services/npm/npm-downloads.service.js | 2 +- services/npm/npm-version.service.js | 2 +- services/nsp/nsp.service.js | 2 +- services/nuget/nuget-v2-service-family.js | 2 +- services/nuget/nuget-v3-service-family.js | 2 +- services/nycrc/nycrc.service.js | 2 +- .../offset-earth-carbon-redirect.service.js | 2 +- .../offset-earth-trees-redirect.service.js | 2 +- services/open-vsx/open-vsx-base.js | 2 +- .../opencollective/opencollective-base.js | 2 +- services/opm/opm-version.service.js | 2 +- services/ore/ore-base.js | 2 +- services/osslifecycle/osslifecycle.service.js | 2 +- services/package-json-helpers.js | 2 +- .../packagecontrol/packagecontrol.service.js | 2 +- services/packagist/packagist-base.js | 2 +- .../packagist/packagist-license.service.js | 2 +- services/packagist/packagist-license.spec.js | 2 +- .../packagist-php-version.service.js | 2 +- .../packagist/packagist-php-version.spec.js | 2 +- .../packagist/packagist-version.service.js | 2 +- services/php-eye/php-eye-hhvm.service.js | 2 +- .../php-eye/php-eye-php-version.service.js | 2 +- services/pingpong/pingpong-status.service.js | 2 +- services/pingpong/pingpong-uptime.service.js | 2 +- services/pipenv-helpers.js | 2 +- services/pkgreview/package-rating.service.js | 2 +- services/poeditor/poeditor.service.js | 2 +- .../powershellgallery.service.js | 2 +- services/pub/pub.service.js | 2 +- services/puppetforge/puppetforge-base.js | 2 +- .../puppetforge-module-endorsement.service.js | 2 +- .../puppetforge-module-feedback.service.js | 2 +- .../puppetforge-module-pdk-version.service.js | 2 +- services/pypi/pypi-base.js | 2 +- services/pypi/pypi-downloads.service.js | 2 +- services/readthedocs/readthedocs.service.js | 2 +- .../reddit/subreddit-subscribers.service.js | 2 +- services/reddit/user-karma.service.js | 2 +- services/redmine/redmine.service.js | 2 +- .../repology/repology-repositories.service.js | 2 +- services/requires/requires.service.js | 2 +- services/reuse/reuse-compliance.service.js | 2 +- services/scoop/scoop-version.service.js | 2 +- services/scrutinizer/scrutinizer-base.js | 2 +- .../scrutinizer-coverage.service.js | 2 +- .../scrutinizer/scrutinizer-coverage.spec.js | 2 +- .../scrutinizer-redirect.service.js | 2 +- .../security-headers.service.js | 2 +- services/shippable/shippable.service.js | 2 +- services/snap-ci/snap-ci.service.js | 2 +- services/snyk/snyk-vulnerability-base.js | 2 +- .../snyk/snyk-vulnerability-npm.service.js | 2 +- services/sonar/sonar-base.js | 2 +- services/sonar/sonar-redirector.service.js | 2 +- .../sourceforge-open-tickets.service.js | 2 +- services/sourceforge/sourceforge.service.js | 2 +- services/sourcegraph/sourcegraph.service.js | 2 +- services/spack/spack.service.js | 2 +- services/spiget/spiget-base.js | 2 +- .../stackexchange-monthlyquestions.service.js | 2 +- .../stackexchange-reputation.service.js | 2 +- .../stackexchange-taginfo.service.js | 2 +- .../query-string-static.service.js | 2 +- services/static-badge/static-badge.service.js | 2 +- services/steam/steam-base.js | 2 +- services/steam/steam-workshop.service.js | 2 +- services/swagger/swagger-redirect.service.js | 2 +- services/swagger/swagger.service.js | 2 +- .../symfony/sensiolabs-redirect.service.js | 2 +- services/symfony/symfony-insight-base.js | 2 +- services/symfony/symfony-insight-base.spec.js | 2 +- services/teamcity/teamcity-base.js | 2 +- .../teamcity-build-redirect.service.js | 2 +- .../teamcity-coverage-redirect.service.js | 2 +- .../teamcity/teamcity-coverage.service.js | 2 +- services/testspace/testspace-base.js | 2 +- services/testspace/testspace-base.spec.js | 2 +- services/tokei/tokei.service.js | 2 +- services/travis/travis-build.service.js | 2 +- .../travis-php-version-redirect.service.js | 2 +- services/travis/travis-php-version.service.js | 2 +- services/treeware/treeware-trees.service.js | 2 +- services/twitch/twitch-base.js | 2 +- services/twitter/twitter-redirect.service.js | 2 +- services/twitter/twitter.service.js | 2 +- services/ubuntu/ubuntu.service.js | 2 +- services/uptimerobot/uptimerobot-base.js | 2 +- .../vaadin-directory/vaadin-directory-base.js | 2 +- services/validators.js | 29 +++++++------------ services/versioneye/versioneye.service.js | 2 +- .../visual-studio-app-center-base.js | 2 +- ...visual-studio-app-center-builds.service.js | 2 +- .../visual-studio-marketplace-base.js | 2 +- services/w3c/w3c-validation.service.js | 2 +- .../waffle/waffle-label-redirect.service.js | 2 +- services/waffle/waffle-label.service.js | 2 +- services/website/website-redirect.service.js | 2 +- services/website/website.service.js | 2 +- services/wercker/wercker.service.js | 2 +- services/wheelmap/wheelmap.service.js | 2 +- services/wordpress/wordpress-base.js | 2 +- .../wordpress/wordpress-downloads.service.js | 2 +- .../wordpress-last-update.service.js | 2 +- .../wordpress-platform-redirect.service.js | 2 +- .../wordpress/wordpress-platform.service.js | 2 +- services/youtube/youtube-base.js | 2 +- 319 files changed, 345 insertions(+), 358 deletions(-) diff --git a/core/base-service/base-graphql.js b/core/base-service/base-graphql.js index 55de5e0c8f1e7..a6ff3d46b844c 100644 --- a/core/base-service/base-graphql.js +++ b/core/base-service/base-graphql.js @@ -2,7 +2,7 @@ * @module */ -import {print} from 'graphql/language/printer'; +import {print} from 'graphql/language/printer.js'; import BaseService from './base.js'; import {InvalidResponse, ShieldsRuntimeError} from './errors.js'; import {parseJson} from './json.js'; diff --git a/services/amo/amo-base.js b/services/amo/amo-base.js index 14cbd3134ef9a..ec90e1dd1b1e0 100644 --- a/services/amo/amo-base.js +++ b/services/amo/amo-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const keywords = ['amo', 'firefox'] diff --git a/services/amo/amo-downloads.service.js b/services/amo/amo-downloads.service.js index e80cef901cc21..18c952dc95f7c 100644 --- a/services/amo/amo-downloads.service.js +++ b/services/amo/amo-downloads.service.js @@ -1,6 +1,6 @@ import {metric} from '../text-formatters.js'; import {downloadCount} from '../color-formatters.js'; -import {redirector} from '..'; +import {redirector} from '../index.js'; import {BaseAmoService, keywords} from './amo-base.js'; const documentation = ` diff --git a/services/ansible/ansible-quality.service.js b/services/ansible/ansible-quality.service.js index 2082dbabbe757..c9449aaa96fc2 100644 --- a/services/ansible/ansible-quality.service.js +++ b/services/ansible/ansible-quality.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {floorCount} from '../color-formatters.js'; -import {BaseJsonService, InvalidResponse} from '..'; +import {BaseJsonService, InvalidResponse} from '../index.js'; const ansibleContentSchema = Joi.object({ quality_score: Joi.number().allow(null).required(), diff --git a/services/ansible/ansible-role.service.js b/services/ansible/ansible-role.service.js index a999047a2ff30..2553f6f0f03e9 100644 --- a/services/ansible/ansible-role.service.js +++ b/services/ansible/ansible-role.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {downloadCount} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const ansibleRoleSchema = Joi.object({ download_count: nonNegativeInteger, diff --git a/services/apm/apm.service.js b/services/apm/apm.service.js index 5d814b7ae423e..5ac3ab23cce29 100644 --- a/services/apm/apm.service.js +++ b/services/apm/apm.service.js @@ -3,7 +3,7 @@ import {renderLicenseBadge} from '../licenses.js'; import {renderVersionBadge} from '../version.js'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, InvalidResponse} from '..'; +import {BaseJsonService, InvalidResponse} from '../index.js'; const keywords = ['atom'] diff --git a/services/appveyor/appveyor-base.js b/services/appveyor/appveyor-base.js index 596d839dd4048..b5d7e8b6a579c 100644 --- a/services/appveyor/appveyor-base.js +++ b/services/appveyor/appveyor-base.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {isBuildStatus} from '../build-status.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ build: Joi.object({ diff --git a/services/appveyor/appveyor-build-redirect.service.js b/services/appveyor/appveyor-build-redirect.service.js index 3ccb1bd071222..0d2760a7907a5 100644 --- a/services/appveyor/appveyor-build-redirect.service.js +++ b/services/appveyor/appveyor-build-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/appveyor/appveyor-job-build.service.js b/services/appveyor/appveyor-job-build.service.js index 5f2f31ace5efa..a890331dd9af1 100644 --- a/services/appveyor/appveyor-job-build.service.js +++ b/services/appveyor/appveyor-job-build.service.js @@ -1,5 +1,5 @@ import {renderBuildStatusBadge} from '../build-status.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import AppVeyorBase from './appveyor-base.js'; export default class AppVeyorJobBuild extends AppVeyorBase { diff --git a/services/appveyor/appveyor-job-build.spec.js b/services/appveyor/appveyor-job-build.spec.js index d3ae15afff8ba..4cfb58d597382 100644 --- a/services/appveyor/appveyor-job-build.spec.js +++ b/services/appveyor/appveyor-job-build.spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import AppveyorJobBuild from './appveyor-job-build.service.js'; describe('AppveyorJobBuild', function () { diff --git a/services/archlinux/archlinux.service.js b/services/archlinux/archlinux.service.js index fee862c60186a..26d715c4c2978 100644 --- a/services/archlinux/archlinux.service.js +++ b/services/archlinux/archlinux.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ pkgver: Joi.string().required(), diff --git a/services/aur/aur.service.js b/services/aur/aur.service.js index 1b1ecf7aeb3bd..c2b276f7bf598 100644 --- a/services/aur/aur.service.js +++ b/services/aur/aur.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {floorCount as floorCountColor, age as ageColor} from '../color-formatters.js'; import {addv, metric, formatDate} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound, InvalidResponse} from '..'; +import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; const aurSchema = Joi.object({ resultcount: nonNegativeInteger, diff --git a/services/azure-devops/azure-devops-base.js b/services/azure-devops/azure-devops-base.js index a370dce79aba2..3d6dcc516b205 100644 --- a/services/azure-devops/azure-devops-base.js +++ b/services/azure-devops/azure-devops-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const latestBuildSchema = Joi.object({ count: Joi.number().required(), diff --git a/services/azure-devops/azure-devops-build.service.js b/services/azure-devops/azure-devops-build.service.js index 31bfe723c22d5..91042238f747f 100644 --- a/services/azure-devops/azure-devops-build.service.js +++ b/services/azure-devops/azure-devops-build.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService, NotFound} from '..'; +import {BaseSvgScrapingService, NotFound} from '../index.js'; import {keywords, fetch} from './azure-devops-helpers.js'; const queryParamSchema = Joi.object({ diff --git a/services/azure-devops/azure-devops-release.service.js b/services/azure-devops/azure-devops-release.service.js index 13197ecfccc1b..914df9e521355 100644 --- a/services/azure-devops/azure-devops-release.service.js +++ b/services/azure-devops/azure-devops-release.service.js @@ -1,5 +1,5 @@ import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; import {keywords, fetch} from './azure-devops-helpers.js'; const documentation = ` diff --git a/services/azure-devops/vso-redirect.service.js b/services/azure-devops/vso-redirect.service.js index c7c4dd2d46aee..389b091be735c 100644 --- a/services/azure-devops/vso-redirect.service.js +++ b/services/azure-devops/vso-redirect.service.js @@ -1,7 +1,6 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; -export default [ - redirector({ +export const VsoBuildRedirector = redirector({ category: 'build', route: { base: 'vso/build', @@ -15,8 +14,8 @@ export default [ return path }, dateAdded: new Date('2019-02-08'), - }), - redirector({ + }) +export const VsoReleaseRedirector = redirector({ category: 'build', route: { base: 'vso/release', @@ -25,5 +24,4 @@ export default [ transformPath: ({ organization, projectId, definitionId, environmentId }) => `/azure-devops/release/${organization}/${projectId}/${definitionId}/${environmentId}`, dateAdded: new Date('2019-02-08'), - }), -]; + }) diff --git a/services/beerpay/beerpay.service.js b/services/beerpay/beerpay.service.js index e6a4eaa8970fe..1e99d39416fed 100644 --- a/services/beerpay/beerpay.service.js +++ b/services/beerpay/beerpay.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ total_amount: Joi.number().min(0).required(), diff --git a/services/bintray/bintray.service.js b/services/bintray/bintray.service.js index 953314b473b96..7780e4df8f1a6 100644 --- a/services/bintray/bintray.service.js +++ b/services/bintray/bintray.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default [ deprecatedService({ diff --git a/services/bit/bit-components.service.js b/services/bit/bit-components.service.js index a31fcd79031e9..954fe0ecb1ff0 100644 --- a/services/bit/bit-components.service.js +++ b/services/bit/bit-components.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; import {downloadCount} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const collectionSchema = Joi.object({ payload: Joi.object({ diff --git a/services/bitbucket/bitbucket-issues.service.js b/services/bitbucket/bitbucket-issues.service.js index 4b8b53d18b7fa..c87a2caffc816 100644 --- a/services/bitbucket/bitbucket-issues.service.js +++ b/services/bitbucket/bitbucket-issues.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const bitbucketIssuesSchema = Joi.object({ size: nonNegativeInteger, @@ -57,4 +57,5 @@ function issueClassGenerator(raw) { } } -export default [true, false].map(issueClassGenerator); +export const BitbucketRawIssues = issueClassGenerator(true) +export const BitbucketNonRawIssues = issueClassGenerator(false) diff --git a/services/bitbucket/bitbucket-pipelines.service.js b/services/bitbucket/bitbucket-pipelines.service.js index ca37739111883..70262e037357e 100644 --- a/services/bitbucket/bitbucket-pipelines.service.js +++ b/services/bitbucket/bitbucket-pipelines.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService, redirector} from '..'; +import {BaseJsonService, redirector} from '../index.js'; const bitbucketPipelinesSchema = Joi.object({ values: Joi.array() diff --git a/services/bitbucket/bitbucket-pull-request.service.js b/services/bitbucket/bitbucket-pull-request.service.js index d96b127e8840c..f069293c573e3 100644 --- a/services/bitbucket/bitbucket-pull-request.service.js +++ b/services/bitbucket/bitbucket-pull-request.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {AuthHelper} from '../../core/base-service/auth-helper.js'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger, optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ size: nonNegativeInteger, @@ -126,4 +126,5 @@ function pullRequestClassGenerator(raw) { } } -export default [true, false].map(pullRequestClassGenerator); +export const BitbucketRawPullRequests = pullRequestClassGenerator(true) +export const BitbucketNonRawPullRequests = pullRequestClassGenerator(false) diff --git a/services/bithound/bithound.service.js b/services/bithound/bithound.service.js index 2ea0f9291c3f8..fe8746cd812c1 100644 --- a/services/bithound/bithound.service.js +++ b/services/bithound/bithound.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'dependencies', diff --git a/services/bitrise/bitrise.service.js b/services/bitrise/bitrise.service.js index f1d8ff6fec4f6..568cdb40e64f2 100644 --- a/services/bitrise/bitrise.service.js +++ b/services/bitrise/bitrise.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; // https://devcenter.bitrise.io/api/app-status-badge/ const schema = Joi.object({ diff --git a/services/bountysource/bountysource.service.js b/services/bountysource/bountysource.service.js index 84016927cfdec..f6df4f3d10e5f 100644 --- a/services/bountysource/bountysource.service.js +++ b/services/bountysource/bountysource.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ activity_total: nonNegativeInteger }) diff --git a/services/bower/bower-base.js b/services/bower/bower-base.js index 287f68cc71ffe..f144155f8b04d 100644 --- a/services/bower/bower-base.js +++ b/services/bower/bower-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object() .keys({ diff --git a/services/bower/bower-version.service.js b/services/bower/bower-version.service.js index 0264e6f83dd0d..ce03d6910a39d 100644 --- a/services/bower/bower-version.service.js +++ b/services/bower/bower-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {InvalidResponse, redirector} from '..'; +import {InvalidResponse, redirector} from '../index.js'; import BaseBowerService from './bower-base.js'; const queryParamSchema = Joi.object({ diff --git a/services/bstats/bstats-players.service.js b/services/bstats/bstats-players.service.js index 7925fcd721b28..3ce6bbe8cb5a2 100644 --- a/services/bstats/bstats-players.service.js +++ b/services/bstats/bstats-players.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.array() .items(Joi.array().items(Joi.number().required(), Joi.number().required())) diff --git a/services/bstats/bstats-servers.service.js b/services/bstats/bstats-servers.service.js index 1da3683e9911e..f0738b2577db0 100644 --- a/services/bstats/bstats-servers.service.js +++ b/services/bstats/bstats-servers.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.array() .items(Joi.array().items(Joi.number().required(), Joi.number().required())) diff --git a/services/bugzilla/bugzilla.service.js b/services/bugzilla/bugzilla.service.js index 135c51c9b35d4..6bbb58604c674 100644 --- a/services/bugzilla/bugzilla.service.js +++ b/services/bugzilla/bugzilla.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const queryParamSchema = Joi.object({ baseUrl: optionalUrl, diff --git a/services/buildkite/buildkite.service.js b/services/buildkite/buildkite.service.js index 49624e0562cb2..9a645afe88b5e 100644 --- a/services/buildkite/buildkite.service.js +++ b/services/buildkite/buildkite.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; // unknown is a valid 'other' status for Buildkite const schema = Joi.object({ diff --git a/services/bundlephobia/bundlephobia.service.js b/services/bundlephobia/bundlephobia.service.js index 62111758c044c..c17b53658d937 100644 --- a/services/bundlephobia/bundlephobia.service.js +++ b/services/bundlephobia/bundlephobia.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import prettyBytes from 'pretty-bytes'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ size: nonNegativeInteger, diff --git a/services/cauditor/cauditor.service.js b/services/cauditor/cauditor.service.js index 84cd2ea6d3618..0c0fcf36e5785 100644 --- a/services/cauditor/cauditor.service.js +++ b/services/cauditor/cauditor.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'other', diff --git a/services/cdnjs/cdnjs.service.js b/services/cdnjs/cdnjs.service.js index 181ffb6e1a508..ae50273584248 100644 --- a/services/cdnjs/cdnjs.service.js +++ b/services/cdnjs/cdnjs.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const cdnjsSchema = Joi.object({ // optional due to non-standard 'not found' condition diff --git a/services/chrome-web-store/chrome-web-store-base.js b/services/chrome-web-store/chrome-web-store-base.js index 480241a1a339b..f8893b9dc71b8 100644 --- a/services/chrome-web-store/chrome-web-store-base.js +++ b/services/chrome-web-store/chrome-web-store-base.js @@ -1,6 +1,6 @@ -import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store'; +import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store/index.js'; import checkErrorResponse from '../../core/base-service/check-error-response.js'; -import {BaseService, Inaccessible} from '..'; +import {BaseService, Inaccessible} from '../index.js'; export default class BaseChromeWebStoreService extends BaseService { async fetch({ storeId }) { diff --git a/services/chrome-web-store/chrome-web-store-price.service.js b/services/chrome-web-store/chrome-web-store-price.service.js index c333973db250a..b0cd9d3904c00 100644 --- a/services/chrome-web-store/chrome-web-store-price.service.js +++ b/services/chrome-web-store/chrome-web-store-price.service.js @@ -1,5 +1,5 @@ import {currencyFromCode} from '../text-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import BaseChromeWebStoreService from './chrome-web-store-base.js'; export default class ChromeWebStorePrice extends BaseChromeWebStoreService { diff --git a/services/chrome-web-store/chrome-web-store-rating.service.js b/services/chrome-web-store/chrome-web-store-rating.service.js index e14b8dda4236b..5cd3141db7a76 100644 --- a/services/chrome-web-store/chrome-web-store-rating.service.js +++ b/services/chrome-web-store/chrome-web-store-rating.service.js @@ -1,6 +1,6 @@ import {floorCount as floorCountColor} from '../color-formatters.js'; import {metric, starRating} from '../text-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import BaseChromeWebStoreService from './chrome-web-store-base.js'; class BaseChromeWebStoreRating extends BaseChromeWebStoreService { diff --git a/services/chrome-web-store/chrome-web-store-users.service.js b/services/chrome-web-store/chrome-web-store-users.service.js index ef9ed6d7674d3..dd0e8d402ef93 100644 --- a/services/chrome-web-store/chrome-web-store-users.service.js +++ b/services/chrome-web-store/chrome-web-store-users.service.js @@ -1,6 +1,6 @@ import {metric} from '../text-formatters.js'; import {downloadCount} from '../color-formatters.js'; -import {redirector, NotFound} from '..'; +import {redirector, NotFound} from '../index.js'; import BaseChromeWebStoreService from './chrome-web-store-base.js'; class ChromeWebStoreUsers extends BaseChromeWebStoreService { diff --git a/services/chrome-web-store/chrome-web-store-version.service.js b/services/chrome-web-store/chrome-web-store-version.service.js index 9cf408e61df35..a7249241347ae 100644 --- a/services/chrome-web-store/chrome-web-store-version.service.js +++ b/services/chrome-web-store/chrome-web-store-version.service.js @@ -1,5 +1,5 @@ import {renderVersionBadge} from '../version.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import BaseChromeWebStoreService from './chrome-web-store-base.js'; export default class ChromeWebStoreVersion extends BaseChromeWebStoreService { diff --git a/services/cii-best-practices/cii-best-practices.service.js b/services/cii-best-practices/cii-best-practices.service.js index 595e4e313a565..53861f255b48c 100644 --- a/services/cii-best-practices/cii-best-practices.service.js +++ b/services/cii-best-practices/cii-best-practices.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {colorScale, coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ badge_level: Joi.string().required(), diff --git a/services/circleci/circleci.service.js b/services/circleci/circleci.service.js index 728dd8c018d43..7f92a88164b50 100644 --- a/services/circleci/circleci.service.js +++ b/services/circleci/circleci.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService, redirector} from '..'; +import {BaseSvgScrapingService, redirector} from '../index.js'; const circleSchema = Joi.object({ message: isBuildStatus }).required() const queryParamSchema = Joi.object({ token: Joi.string() }).required() @@ -96,4 +96,4 @@ const legacyRoutes = [ }), ] -export default [...legacyRoutes, CircleCi]; +export default {...legacyRoutes, CircleCi}; diff --git a/services/cirrus/cirrus.service.js b/services/cirrus/cirrus.service.js index 347824b10af42..dd1696cac16d0 100644 --- a/services/cirrus/cirrus.service.js +++ b/services/cirrus/cirrus.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ subject: Joi.string().required(), diff --git a/services/clojars/clojars-base.js b/services/clojars/clojars-base.js index b665ddcc528f4..c18ce1c4cbd2e 100644 --- a/services/clojars/clojars-base.js +++ b/services/clojars/clojars-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const clojarsSchema = Joi.object({ downloads: nonNegativeInteger, diff --git a/services/clojars/clojars-version.service.js b/services/clojars/clojars-version.service.js index 30f08550c53ad..3cd0d76731ecc 100644 --- a/services/clojars/clojars-version.service.js +++ b/services/clojars/clojars-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {version as versionColor} from '../color-formatters.js'; -import {redirector} from '..'; +import {redirector} from '../index.js'; import {BaseClojarsService} from './clojars-base.js'; const queryParamSchema = Joi.object({ diff --git a/services/cocoapods/cocoapods-apps.service.js b/services/cocoapods/cocoapods-apps.service.js index 1a417387bb0bd..8aeaa4f171f87 100644 --- a/services/cocoapods/cocoapods-apps.service.js +++ b/services/cocoapods/cocoapods-apps.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ name: 'CocoapodsApps', diff --git a/services/cocoapods/cocoapods-base.js b/services/cocoapods/cocoapods-base.js index 16e4cff2e7c35..fbbd905e6364a 100644 --- a/services/cocoapods/cocoapods-base.js +++ b/services/cocoapods/cocoapods-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: Joi.string().required(), diff --git a/services/cocoapods/cocoapods-docs.service.js b/services/cocoapods/cocoapods-docs.service.js index 54237134a4200..d980fc07a2793 100644 --- a/services/cocoapods/cocoapods-docs.service.js +++ b/services/cocoapods/cocoapods-docs.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ cocoadocs: Joi.object({ diff --git a/services/cocoapods/cocoapods-downloads.service.js b/services/cocoapods/cocoapods-downloads.service.js index 26f5e2781925f..afd7a2b937b2b 100644 --- a/services/cocoapods/cocoapods-downloads.service.js +++ b/services/cocoapods/cocoapods-downloads.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ name: 'CocoapodsDownloads', diff --git a/services/codacy/codacy-coverage.service.js b/services/codacy/codacy-coverage.service.js index 6c4af71029ae0..4a1b6ebcf1b7e 100644 --- a/services/codacy/codacy-coverage.service.js +++ b/services/codacy/codacy-coverage.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import {BaseSvgScrapingService, NotFound} from '..'; +import {BaseSvgScrapingService, NotFound} from '../index.js'; const schema = Joi.object({ message: Joi.alternatives() diff --git a/services/codacy/codacy-grade.service.js b/services/codacy/codacy-grade.service.js index 9a7c3698cc4cc..2333108c916d9 100644 --- a/services/codacy/codacy-grade.service.js +++ b/services/codacy/codacy-grade.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; import {codacyGrade} from './codacy-helpers.js'; const schema = Joi.object({ message: codacyGrade }).required() diff --git a/services/codeclimate/codeclimate-analysis-redirector.service.js b/services/codeclimate/codeclimate-analysis-redirector.service.js index b508ff1913a1c..02810a1479971 100644 --- a/services/codeclimate/codeclimate-analysis-redirector.service.js +++ b/services/codeclimate/codeclimate-analysis-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ // http://github.com/badges/shields/issues/1387 diff --git a/services/codeclimate/codeclimate-analysis.service.js b/services/codeclimate/codeclimate-analysis.service.js index 3133043764b01..9e09aaa2defd7 100644 --- a/services/codeclimate/codeclimate-analysis.service.js +++ b/services/codeclimate/codeclimate-analysis.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {colorScale, letterScore} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {keywords, isLetterGrade, fetchRepo} from './codeclimate-common.js'; const schema = Joi.object({ diff --git a/services/codeclimate/codeclimate-common.js b/services/codeclimate/codeclimate-common.js index 375abd61ce139..b0fc076a65ac3 100644 --- a/services/codeclimate/codeclimate-common.js +++ b/services/codeclimate/codeclimate-common.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; const keywords = ['codeclimate'] diff --git a/services/codeclimate/codeclimate-coverage-redirector.service.js b/services/codeclimate/codeclimate-coverage-redirector.service.js index 54260f5eea9c5..a9686473b0acc 100644 --- a/services/codeclimate/codeclimate-coverage-redirector.service.js +++ b/services/codeclimate/codeclimate-coverage-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ // http://github.com/badges/shields/issues/1387 diff --git a/services/codeclimate/codeclimate-coverage.service.js b/services/codeclimate/codeclimate-coverage.service.js index ed5a35de75d36..9dea3febc6bd6 100644 --- a/services/codeclimate/codeclimate-coverage.service.js +++ b/services/codeclimate/codeclimate-coverage.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {coveragePercentage, letterScore} from '../color-formatters.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {keywords, isLetterGrade, fetchRepo} from './codeclimate-common.js'; const schema = Joi.object({ diff --git a/services/codecov/codecov-redirect.service.js b/services/codecov/codecov-redirect.service.js index 6bec0a98a20a3..35c0509cc0c84 100644 --- a/services/codecov/codecov-redirect.service.js +++ b/services/codecov/codecov-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; const vcsSNameShortFormMap = { bb: 'bitbucket', diff --git a/services/codecov/codecov.service.js b/services/codecov/codecov.service.js index 9694a8957e964..4f5852a3e63b2 100644 --- a/services/codecov/codecov.service.js +++ b/services/codecov/codecov.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {coveragePercentage} from '../color-formatters.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; import {parseJson} from '../../core/base-service/json.js'; // https://docs.codecov.io/reference#totals diff --git a/services/codefactor/codefactor-grade.service.js b/services/codefactor/codefactor-grade.service.js index 380f0d1d99946..b9cf1da86a084 100644 --- a/services/codefactor/codefactor-grade.service.js +++ b/services/codefactor/codefactor-grade.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; import {isValidGrade, gradeColor} from './codefactor-helpers.js'; const schema = Joi.object({ diff --git a/services/codeship/codeship.service.js b/services/codeship/codeship.service.js index 0ead10d127954..9096b6cb6bdf2 100644 --- a/services/codeship/codeship.service.js +++ b/services/codeship/codeship.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; const schema = Joi.object({ message: Joi.alternatives() diff --git a/services/codetally/codetally.service.js b/services/codetally/codetally.service.js index ec6f5134b7500..85733b6307285 100644 --- a/services/codetally/codetally.service.js +++ b/services/codetally/codetally.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default [ deprecatedService({ diff --git a/services/conda/conda-base.js b/services/conda/conda-base.js index 409fb922dd166..2187e71d3c46f 100644 --- a/services/conda/conda-base.js +++ b/services/conda/conda-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const condaSchema = Joi.object({ latest_version: Joi.string().required(), diff --git a/services/continuousphp/continuousphp.service.js b/services/continuousphp/continuousphp.service.js index 2ad786f933718..1fe6dbecacff4 100644 --- a/services/continuousphp/continuousphp.service.js +++ b/services/continuousphp/continuousphp.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'build', diff --git a/services/cookbook/cookbook.service.js b/services/cookbook/cookbook.service.js index bdec4e459babf..10627606e83ff 100644 --- a/services/cookbook/cookbook.service.js +++ b/services/cookbook/cookbook.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: Joi.string().required() }).required() diff --git a/services/coveralls/coveralls-redirector.service.js b/services/coveralls/coveralls-redirector.service.js index 17b4f21ab9c09..5001f8631fd30 100644 --- a/services/coveralls/coveralls-redirector.service.js +++ b/services/coveralls/coveralls-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/coveralls/coveralls.service.js b/services/coveralls/coveralls.service.js index 123bbdefbeb03..80591d6704d5a 100644 --- a/services/coveralls/coveralls.service.js +++ b/services/coveralls/coveralls.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ covered_percent: Joi.number().min(0).max(100).required(), diff --git a/services/coverity/coverity-on-demand.service.js b/services/coverity/coverity-on-demand.service.js index 061414cbd0b9c..18127151579fb 100644 --- a/services/coverity/coverity-on-demand.service.js +++ b/services/coverity/coverity-on-demand.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ route: { diff --git a/services/coverity/coverity-scan.service.js b/services/coverity/coverity-scan.service.js index f03f7dadcdd8c..8df4dbb28f748 100644 --- a/services/coverity/coverity-scan.service.js +++ b/services/coverity/coverity-scan.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const messageRegex = /passed|passed .* new defects|pending|failed/ const schema = Joi.object({ diff --git a/services/cpan/cpan.js b/services/cpan/cpan.js index c848b5b4262bd..6a93799421d08 100644 --- a/services/cpan/cpan.js +++ b/services/cpan/cpan.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: Joi.alternatives(Joi.string().required(), Joi.number().required()), diff --git a/services/cran/cran.service.js b/services/cran/cran.service.js index 5e0657ee249b2..7bf651afe11c8 100644 --- a/services/cran/cran.service.js +++ b/services/cran/cran.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ License: Joi.string().required(), diff --git a/services/crates/crates-base.js b/services/crates/crates-base.js index c11fe5177f4a7..a408f49aff056 100644 --- a/services/crates/crates-base.js +++ b/services/crates/crates-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const keywords = ['Rust'] diff --git a/services/crates/crates-downloads.service.js b/services/crates/crates-downloads.service.js index b009abbeb1957..8dfc32eedc534 100644 --- a/services/crates/crates-downloads.service.js +++ b/services/crates/crates-downloads.service.js @@ -1,6 +1,6 @@ import {downloadCount as downloadCountColor} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; -import {InvalidParameter, NotFound} from '..'; +import {InvalidParameter, NotFound} from '../index.js'; import {BaseCratesService, keywords} from './crates-base.js'; export default class CratesDownloads extends BaseCratesService { diff --git a/services/crates/crates-version.service.js b/services/crates/crates-version.service.js index 1f00411b55159..6929077e89bf4 100644 --- a/services/crates/crates-version.service.js +++ b/services/crates/crates-version.service.js @@ -1,5 +1,5 @@ import {renderVersionBadge} from '../version.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {BaseCratesService, keywords} from './crates-base.js'; export default class CratesVersion extends BaseCratesService { diff --git a/services/crates/crates-version.spec.js b/services/crates/crates-version.spec.js index 3bb84d8a442bb..0ac5bf4a922f8 100644 --- a/services/crates/crates-version.spec.js +++ b/services/crates/crates-version.spec.js @@ -1,6 +1,6 @@ import {test, given} from 'sazerac'; import {expect} from 'chai'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import CratesVersion from './crates-version.service.js'; describe('CratesVersion', function () { diff --git a/services/criterion/constants.js b/services/criterion/constants.js index 44f90f307d83e..440bb822c85d4 100644 --- a/services/criterion/constants.js +++ b/services/criterion/constants.js @@ -1,6 +1,4 @@ -export default Object.freeze({ - IMPROVED_STATUS: 'improved', - REGRESSED_STATUS: 'regressed', - NO_CHANGE_STATUS: 'no change', - NOT_FOUND_STATUS: 'no status found', -}); +export const IMPROVED_STATUS = 'improved' +export const REGRESSED_STATUS = 'regressed' +export const NO_CHANGE_STATUS = 'no change' +export const NOT_FOUND_STATUS = 'no status found' diff --git a/services/criterion/criterion.service.js b/services/criterion/criterion.service.js index db715e55bae89..13d094e0f5f4c 100644 --- a/services/criterion/criterion.service.js +++ b/services/criterion/criterion.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {IMPROVED_STATUS, NOT_FOUND_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS} from './constants.js'; const schema = Joi.string() diff --git a/services/ctan/ctan.service.js b/services/ctan/ctan.service.js index 94ec48c745f69..5a10e373da886 100644 --- a/services/ctan/ctan.service.js +++ b/services/ctan/ctan.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {renderLicenseBadge} from '../licenses.js'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ license: Joi.array().items(Joi.string()).single(), diff --git a/services/date/date.service.js b/services/date/date.service.js index bc7beea41d610..a6b5ef0c660b1 100644 --- a/services/date/date.service.js +++ b/services/date/date.service.js @@ -1,5 +1,5 @@ import {formatRelativeDate} from '../text-formatters.js'; -import {BaseService} from '..'; +import {BaseService} from '../index.js'; const documentation = `

diff --git a/services/david/david.service.js b/services/david/david.service.js index 22fa083f7fc14..6cc68524701f3 100644 --- a/services/david/david.service.js +++ b/services/david/david.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ status: Joi.allow( diff --git a/services/debian/debian.service.js b/services/debian/debian.service.js index aef7030cf05c9..cddfbf2ec93f5 100644 --- a/services/debian/debian.service.js +++ b/services/debian/debian.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {latest, renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound, InvalidResponse} from '..'; +import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; const schema = Joi.array() .items( diff --git a/services/debug/debug.service.js b/services/debug/debug.service.js index 48d285a32bf06..04b0474ba1de5 100644 --- a/services/debug/debug.service.js +++ b/services/debug/debug.service.js @@ -1,4 +1,4 @@ -import {BaseService} from '..'; +import {BaseService} from '../index.js'; const serverStartTime = new Date(new Date().toGMTString()) let bitFlip = false diff --git a/services/dependabot/dependabot.service.js b/services/dependabot/dependabot.service.js index 02fc6263b9eff..00af1095ee393 100644 --- a/services/dependabot/dependabot.service.js +++ b/services/dependabot/dependabot.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ status: Joi.string().required(), diff --git a/services/depfu/depfu.service.js b/services/depfu/depfu.service.js index 378c900e0d89c..74b4d547d7de5 100644 --- a/services/depfu/depfu.service.js +++ b/services/depfu/depfu.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const depfuSchema = Joi.object({ text: Joi.string().required(), diff --git a/services/deprecation-helpers.js b/services/deprecation-helpers.js index 3a35dfeb6877b..bf048c9e6d4d5 100644 --- a/services/deprecation-helpers.js +++ b/services/deprecation-helpers.js @@ -1,4 +1,4 @@ -import {Deprecated} from '.'; +import {Deprecated} from './index.js'; function enforceDeprecation(effectiveDate) { if (Date.now() >= effectiveDate.getTime()) { diff --git a/services/discord/discord.service.js b/services/discord/discord.service.js index 46f54001a9805..bbff2c5ddfa9f 100644 --- a/services/discord/discord.service.js +++ b/services/discord/discord.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ presence_count: nonNegativeInteger, diff --git a/services/discourse/discourse-redirect.service.js b/services/discourse/discourse-redirect.service.js index 8ecf1434a9bcd..083c485d4132b 100644 --- a/services/discourse/discourse-redirect.service.js +++ b/services/discourse/discourse-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/discourse/discourse.service.js b/services/discourse/discourse.service.js index d9244356bd223..b43e5c0a8f9de 100644 --- a/services/discourse/discourse.service.js +++ b/services/discourse/discourse.service.js @@ -2,7 +2,7 @@ import camelcase from 'camelcase'; import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger, optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ topic_count: nonNegativeInteger, diff --git a/services/dockbit/dockbit.service.js b/services/dockbit/dockbit.service.js index 7dc0515cffc27..89eac1cd5d971 100644 --- a/services/dockbit/dockbit.service.js +++ b/services/dockbit/dockbit.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'build', diff --git a/services/docker/docker-automated.service.js b/services/docker/docker-automated.service.js index 60689900d79b4..5badd6c996f79 100644 --- a/services/docker/docker-automated.service.js +++ b/services/docker/docker-automated.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; const automatedBuildSchema = Joi.object({ diff --git a/services/docker/docker-build.service.js b/services/docker/docker-build.service.js index 3eba72c8be260..cbb8be1c7faf7 100644 --- a/services/docker/docker-build.service.js +++ b/services/docker/docker-build.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'build', diff --git a/services/docker/docker-cloud-automated.service.js b/services/docker/docker-cloud-automated.service.js index 56d5a4ed37280..deafeb2cfeaa3 100644 --- a/services/docker/docker-cloud-automated.service.js +++ b/services/docker/docker-cloud-automated.service.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {dockerBlue, buildDockerUrl} from './docker-helpers.js'; import {fetchBuild} from './docker-cloud-common-fetch.js'; diff --git a/services/docker/docker-cloud-build.service.js b/services/docker/docker-cloud-build.service.js index 1456ecfe90596..6840cc5223333 100644 --- a/services/docker/docker-cloud-build.service.js +++ b/services/docker/docker-cloud-build.service.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {dockerBlue, buildDockerUrl} from './docker-helpers.js'; import {fetchBuild} from './docker-cloud-common-fetch.js'; diff --git a/services/docker/docker-helpers.js b/services/docker/docker-helpers.js index c147577dec642..be353c80c1bd5 100644 --- a/services/docker/docker-helpers.js +++ b/services/docker/docker-helpers.js @@ -1,5 +1,5 @@ const dockerBlue = '066da5' // see https://github.com/badges/shields/pull/1690 -import {NotFound} from '..'; +import {NotFound} from '../index.js'; function buildDockerUrl(badgeName, includeTagRoute) { if (includeTagRoute) { diff --git a/services/docker/docker-pulls.service.js b/services/docker/docker-pulls.service.js index fd10a1c2a0e66..12815e5425115 100644 --- a/services/docker/docker-pulls.service.js +++ b/services/docker/docker-pulls.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; const pullsSchema = Joi.object({ diff --git a/services/docker/docker-size.service.js b/services/docker/docker-size.service.js index cdc3edb32908b..9907986fa0d24 100644 --- a/services/docker/docker-size.service.js +++ b/services/docker/docker-size.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import prettyBytes from 'pretty-bytes'; import {nonNegativeInteger} from '../validators.js'; import {latest} from '../version.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {buildDockerUrl, getDockerHubUser, getMultiPageData} from './docker-helpers.js'; const buildSchema = Joi.object({ diff --git a/services/docker/docker-stars.service.js b/services/docker/docker-stars.service.js index f8ef7955389d1..401cb2b3bf072 100644 --- a/services/docker/docker-stars.service.js +++ b/services/docker/docker-stars.service.js @@ -1,6 +1,6 @@ import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseService} from '..'; +import {BaseService} from '../index.js'; import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; export default class DockerStars extends BaseService { diff --git a/services/docker/docker-version.service.js b/services/docker/docker-version.service.js index 64f60b231a4c3..2f2b69b8f1e57 100644 --- a/services/docker/docker-version.service.js +++ b/services/docker/docker-version.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {latest, renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound, InvalidResponse} from '..'; +import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; import {buildDockerUrl, getDockerHubUser, getMultiPageData, getDigestSemVerMatches} from './docker-helpers.js'; const buildSchema = Joi.object({ diff --git a/services/docker/docker-version.spec.js b/services/docker/docker-version.spec.js index 499e3c690a82a..a3e89da2ad2fd 100644 --- a/services/docker/docker-version.spec.js +++ b/services/docker/docker-version.spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import DockerVersion from './docker-version.service.js'; import {versionDataNoTagDateSort, versionPagedDataNoTagDateSort, versionDataNoTagSemVerSort, versionDataWithTag, versionDataWithVaryingArchitectures} from './docker-fixtures.js'; diff --git a/services/docsrs/docsrs.service.js b/services/docsrs/docsrs.service.js index 5267fac1835a6..be8362e402b6c 100644 --- a/services/docsrs/docsrs.service.js +++ b/services/docsrs/docsrs.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.array() .items( diff --git a/services/dotnetstatus/dotnetstatus.service.js b/services/dotnetstatus/dotnetstatus.service.js index 11f1df47d27ec..87a5f3c12f9f7 100644 --- a/services/dotnetstatus/dotnetstatus.service.js +++ b/services/dotnetstatus/dotnetstatus.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'dependencies', diff --git a/services/drone/drone-build.service.js b/services/drone/drone-build.service.js index 5691ddab9ca96..678f71aa8e58d 100644 --- a/services/drone/drone-build.service.js +++ b/services/drone/drone-build.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ status: Joi.alternatives() diff --git a/services/dub/dub-download.service.js b/services/dub/dub-download.service.js index 96e4c945880b8..b6da730864b2d 100644 --- a/services/dub/dub-download.service.js +++ b/services/dub/dub-download.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {downloadCount as downloadCountColor} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ downloads: Joi.object({ diff --git a/services/dub/dub-license.service.js b/services/dub/dub-license.service.js index bf814e06f296b..47e34c1e845f2 100644 --- a/services/dub/dub-license.service.js +++ b/services/dub/dub-license.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderLicenseBadge} from '../licenses.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ info: Joi.object({ license: Joi.string().required() }).required(), diff --git a/services/dub/dub-version.service.js b/services/dub/dub-version.service.js index ab4788e3f99ac..2c1d80eb62b50 100644 --- a/services/dub/dub-version.service.js +++ b/services/dub/dub-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.string().required() diff --git a/services/dynamic-common.js b/services/dynamic-common.js index 42cccf081b50e..d8e97163614fc 100644 --- a/services/dynamic-common.js +++ b/services/dynamic-common.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import toArray from '../core/base-service/to-array.js'; import validate from '../core/base-service/validate.js'; -import {InvalidResponse} from '.'; +import {InvalidResponse} from './index.js'; const errorMessages = { 404: 'resource not found', diff --git a/services/dynamic/dynamic-json.service.js b/services/dynamic/dynamic-json.service.js index c4238751a2b17..631b7cb1821f0 100644 --- a/services/dynamic/dynamic-json.service.js +++ b/services/dynamic/dynamic-json.service.js @@ -1,5 +1,5 @@ import {MetricNames} from '../../core/base-service/metric-helper.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {createRoute} from './dynamic-helpers.js'; import jsonPath from './json-path.js'; diff --git a/services/dynamic/dynamic-xml.service.js b/services/dynamic/dynamic-xml.service.js index 66379708a5012..1990e0d594b44 100644 --- a/services/dynamic/dynamic-xml.service.js +++ b/services/dynamic/dynamic-xml.service.js @@ -2,7 +2,7 @@ import {DOMParser} from 'xmldom'; import xpath from 'xpath'; import {MetricNames} from '../../core/base-service/metric-helper.js'; import {renderDynamicBadge, errorMessages} from '../dynamic-common.js'; -import {BaseService, InvalidResponse, InvalidParameter} from '..'; +import {BaseService, InvalidResponse, InvalidParameter} from '../index.js'; import {createRoute} from './dynamic-helpers.js'; // This service extends BaseService because it uses a different XML parser diff --git a/services/dynamic/dynamic-xml.spec.js b/services/dynamic/dynamic-xml.spec.js index 61c767f3faa06..67d76e6993f9c 100644 --- a/services/dynamic/dynamic-xml.spec.js +++ b/services/dynamic/dynamic-xml.spec.js @@ -2,7 +2,7 @@ import {expect} from 'chai'; import sinon from 'sinon'; import xpath from 'xpath'; import {test, given} from 'sazerac'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import DynamicXml from './dynamic-xml.service.js'; const exampleXml = ` diff --git a/services/dynamic/dynamic-yaml.service.js b/services/dynamic/dynamic-yaml.service.js index 2e7ad757bf4d6..493064f5d5ab7 100644 --- a/services/dynamic/dynamic-yaml.service.js +++ b/services/dynamic/dynamic-yaml.service.js @@ -1,5 +1,5 @@ import {MetricNames} from '../../core/base-service/metric-helper.js'; -import {BaseYamlService} from '..'; +import {BaseYamlService} from '../index.js'; import {createRoute} from './dynamic-helpers.js'; import jsonPath from './json-path.js'; diff --git a/services/dynamic/json-path.js b/services/dynamic/json-path.js index 82fb867768367..6c0c5dd541b99 100644 --- a/services/dynamic/json-path.js +++ b/services/dynamic/json-path.js @@ -5,7 +5,7 @@ import Joi from 'joi'; import jp from 'jsonpath'; import {renderDynamicBadge, errorMessages} from '../dynamic-common.js'; -import {InvalidParameter, InvalidResponse} from '..'; +import {InvalidParameter, InvalidResponse} from '../index.js'; /** * Dynamic service class factory which wraps {@link module:core/base-service/base~BaseService} with support of {@link https://jsonpath.com/|JSONPath}. diff --git a/services/eclipse-marketplace/eclipse-marketplace-base.js b/services/eclipse-marketplace/eclipse-marketplace-base.js index 6d4158829694f..2ed8615434620 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-base.js +++ b/services/eclipse-marketplace/eclipse-marketplace-base.js @@ -1,4 +1,4 @@ -import {BaseXmlService} from '..'; +import {BaseXmlService} from '../index.js'; export default class EclipseMarketplaceBase extends BaseXmlService { static buildRoute(base) { diff --git a/services/ecologi/ecologi-carbon.service.js b/services/ecologi/ecologi-carbon.service.js index 30b14e2edea47..103ebf5bcf7e3 100644 --- a/services/ecologi/ecologi-carbon.service.js +++ b/services/ecologi/ecologi-carbon.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {floorCount} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const apiSchema = Joi.object({ total: Joi.number().positive().required(), diff --git a/services/ecologi/ecologi-trees.service.js b/services/ecologi/ecologi-trees.service.js index 4af82a1867fea..b0aff6d38d781 100644 --- a/services/ecologi/ecologi-trees.service.js +++ b/services/ecologi/ecologi-trees.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {floorCount} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const apiSchema = Joi.object({ total: nonNegativeInteger, diff --git a/services/elm-package/elm-package.service.js b/services/elm-package/elm-package.service.js index 1fbdd6afbfc42..f2d3a32115942 100644 --- a/services/elm-package/elm-package.service.js +++ b/services/elm-package/elm-package.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; import {semver} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: semver }).required() diff --git a/services/endpoint-common.js b/services/endpoint-common.js index 2e21c9ecc6d9a..f193e9e146d1e 100644 --- a/services/endpoint-common.js +++ b/services/endpoint-common.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import validate from '../core/base-service/validate.js'; -import {InvalidResponse} from '.'; +import {InvalidResponse} from './index.js'; const optionalStringWhenNamedLogoPresent = Joi.alternatives().conditional( 'namedLogo', diff --git a/services/endpoint/endpoint-redirect.service.js b/services/endpoint/endpoint-redirect.service.js index 86787cd424e04..31790ebdd5897 100644 --- a/services/endpoint/endpoint-redirect.service.js +++ b/services/endpoint/endpoint-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default redirector({ category: 'other', diff --git a/services/endpoint/endpoint.service.js b/services/endpoint/endpoint.service.js index d395e9d3479b4..46d22cdf388f4 100644 --- a/services/endpoint/endpoint.service.js +++ b/services/endpoint/endpoint.service.js @@ -3,7 +3,7 @@ import Joi from 'joi'; import {errorMessages} from '../dynamic-common.js'; import {optionalUrl} from '../validators.js'; import {fetchEndpointData} from '../endpoint-common.js'; -import {BaseJsonService, InvalidParameter} from '..'; +import {BaseJsonService, InvalidParameter} from '../index.js'; const blockedDomains = ['github.com', 'shields.io'] diff --git a/services/f-droid/f-droid.service.js b/services/f-droid/f-droid.service.js index 9f25c8dba2f79..e3fb53c50e9cc 100644 --- a/services/f-droid/f-droid.service.js +++ b/services/f-droid/f-droid.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {optionalNonNegativeInteger, nonNegativeInteger} from '../validators.js'; import {addv} from '../text-formatters.js'; import {version as versionColor} from '../color-formatters.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object({ packageName: Joi.string().required(), diff --git a/services/fedora/fedora.service.js b/services/fedora/fedora.service.js index 2bf514e72b21b..0a5cb92f4f9fe 100644 --- a/services/fedora/fedora.service.js +++ b/services/fedora/fedora.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: Joi.string().required(), diff --git a/services/feedz/feedz.service.js b/services/feedz/feedz.service.js index 81a920e060041..9c6cd825485cf 100644 --- a/services/feedz/feedz.service.js +++ b/services/feedz/feedz.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {renderVersionBadge, searchServiceUrl, stripBuildMetadata, selectVersion} from '../nuget/nuget-helpers.js'; const schema = Joi.object({ diff --git a/services/flathub/flathub.service.js b/services/flathub/flathub.service.js index 5416e950fb600..c83b61c866b28 100644 --- a/services/flathub/flathub.service.js +++ b/services/flathub/flathub.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ currentReleaseVersion: Joi.string().required(), diff --git a/services/gem/gem-downloads.service.js b/services/gem/gem-downloads.service.js index c67c77b86becb..d9c47df78fce0 100644 --- a/services/gem/gem-downloads.service.js +++ b/services/gem/gem-downloads.service.js @@ -4,7 +4,7 @@ import {downloadCount} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; import {latest as latestVersion} from '../version.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, InvalidParameter, InvalidResponse} from '..'; +import {BaseJsonService, InvalidParameter, InvalidResponse} from '../index.js'; const keywords = ['ruby'] diff --git a/services/gem/gem-owner.service.js b/services/gem/gem-owner.service.js index 60e013ccd0353..2ff80c6e2ed19 100644 --- a/services/gem/gem-owner.service.js +++ b/services/gem/gem-owner.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const ownerSchema = Joi.array().required() diff --git a/services/gem/gem-rank.service.js b/services/gem/gem-rank.service.js index 85349e68f8e3c..51c76e2121bfd 100644 --- a/services/gem/gem-rank.service.js +++ b/services/gem/gem-rank.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {floorCount} from '../color-formatters.js'; import {ordinalNumber} from '../text-formatters.js'; -import {BaseJsonService, InvalidResponse} from '..'; +import {BaseJsonService, InvalidResponse} from '../index.js'; const keywords = ['ruby'] diff --git a/services/gem/gem-version.service.js b/services/gem/gem-version.service.js index d4589f542cb18..9dea28e1922d8 100644 --- a/services/gem/gem-version.service.js +++ b/services/gem/gem-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge, latest} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ // In most cases `version` will be a SemVer but the registry doesn't diff --git a/services/gemnasium/gemnasium.service.js b/services/gemnasium/gemnasium.service.js index e714b7defec3c..d533d55a32408 100644 --- a/services/gemnasium/gemnasium.service.js +++ b/services/gemnasium/gemnasium.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'dependencies', diff --git a/services/gerrit/gerrit.service.js b/services/gerrit/gerrit.service.js index 542e3a5bd8c10..74ffeb8687171 100644 --- a/services/gerrit/gerrit.service.js +++ b/services/gerrit/gerrit.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const queryParamSchema = Joi.object({ baseUrl: optionalUrl.required(), diff --git a/services/github/github-auth-service.js b/services/github/github-auth-service.js index aebb6905a7fbb..b60f88fb1ab73 100644 --- a/services/github/github-auth-service.js +++ b/services/github/github-auth-service.js @@ -1,6 +1,6 @@ import gql from 'graphql-tag'; import {mergeQueries} from '../../core/base-service/graphql.js'; -import {BaseGraphqlService, BaseJsonService} from '..'; +import {BaseGraphqlService, BaseJsonService} from '../index.js'; function createRequestFetcher(context, config) { const { sendAndCacheRequestWithCallbacks, githubApiProvider } = context diff --git a/services/github/github-commit-status.service.js b/services/github/github-commit-status.service.js index 6d3211fa858ba..9776142bed367 100644 --- a/services/github/github-commit-status.service.js +++ b/services/github/github-commit-status.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {NotFound, InvalidParameter} from '..'; +import {NotFound, InvalidParameter} from '../index.js'; import {GithubAuthV3Service} from './github-auth-service.js'; import {documentation, errorMessagesFor} from './github-helpers.js'; diff --git a/services/github/github-common-fetch.js b/services/github/github-common-fetch.js index b3e5a9769aadd..6c753bc6c21f1 100644 --- a/services/github/github-common-fetch.js +++ b/services/github/github-common-fetch.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {errorMessagesFor} from './github-helpers.js'; const issueSchema = Joi.object({ diff --git a/services/github/github-common-release.js b/services/github/github-common-release.js index 081ae343013f0..ef9069a1c1b1d 100644 --- a/services/github/github-common-release.js +++ b/services/github/github-common-release.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {latest} from '../version.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {errorMessagesFor} from './github-helpers.js'; const releaseInfoSchema = Joi.object({ @@ -97,5 +97,5 @@ async function fetchLatestRelease( export { fetchLatestRelease, queryParamSchema, - _getLatestRelease: getLatestRelease, // currently only used for tests }; +export const _getLatestRelease = getLatestRelease // currently only used for tests diff --git a/services/github/github-deployments.service.js b/services/github/github-deployments.service.js index df300b0f4c13b..a339216d4b9c5 100644 --- a/services/github/github-deployments.service.js +++ b/services/github/github-deployments.service.js @@ -1,6 +1,6 @@ import gql from 'graphql-tag'; import Joi from 'joi'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {GithubAuthV4Service} from './github-auth-service.js'; import {documentation, transformErrors} from './github-helpers.js'; diff --git a/services/github/github-directory-file-count.service.js b/services/github/github-directory-file-count.service.js index 57b64275097c0..4d7b4fe351594 100644 --- a/services/github/github-directory-file-count.service.js +++ b/services/github/github-directory-file-count.service.js @@ -1,7 +1,7 @@ import path from 'path'; import Joi from 'joi'; import {metric} from '../text-formatters.js'; -import {InvalidParameter} from '..'; +import {InvalidParameter} from '../index.js'; import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; import {documentation as commonDocumentation, errorMessagesFor} from './github-helpers.js'; diff --git a/services/github/github-directory-file-count.spec.js b/services/github/github-directory-file-count.spec.js index eefdd14c9fe18..fadf9f4a5640b 100644 --- a/services/github/github-directory-file-count.spec.js +++ b/services/github/github-directory-file-count.spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; -import {InvalidParameter} from '..'; +import {InvalidParameter} from '../index.js'; import GithubDirectoryFileCount from './github-directory-file-count.service.js'; describe('GithubDirectoryFileCount', function () { diff --git a/services/github/github-downloads.service.js b/services/github/github-downloads.service.js index 6ce9be6c751c2..7c60a77279aeb 100644 --- a/services/github/github-downloads.service.js +++ b/services/github/github-downloads.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {GithubAuthV3Service} from './github-auth-service.js'; import {fetchLatestRelease} from './github-common-release.js'; import {documentation, errorMessagesFor} from './github-helpers.js'; diff --git a/services/github/github-go-mod.service.js b/services/github/github-go-mod.service.js index 2dc1e131dd80d..1e006c46d09ab 100644 --- a/services/github/github-go-mod.service.js +++ b/services/github/github-go-mod.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; import {fetchRepoContent} from './github-common-fetch.js'; import {documentation} from './github-helpers.js'; diff --git a/services/github/github-helpers.js b/services/github/github-helpers.js index ca6e8a18adc19..261157752ffa2 100644 --- a/services/github/github-helpers.js +++ b/services/github/github-helpers.js @@ -1,5 +1,5 @@ import {colorScale} from '../color-formatters.js'; -import {InvalidResponse, NotFound} from '..'; +import {InvalidResponse, NotFound} from '../index.js'; const documentation = `

diff --git a/services/github/github-issue-detail-redirect.service.js b/services/github/github-issue-detail-redirect.service.js index 76d2a695c2fdc..b95d3da95dc33 100644 --- a/services/github/github-issue-detail-redirect.service.js +++ b/services/github/github-issue-detail-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; const variantMap = { s: 'state', diff --git a/services/github/github-issue-detail.service.js b/services/github/github-issue-detail.service.js index 20a5e4ed6e706..5d2c7fa0d0f33 100644 --- a/services/github/github-issue-detail.service.js +++ b/services/github/github-issue-detail.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {formatDate, metric} from '../text-formatters.js'; import {age} from '../color-formatters.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {GithubAuthV3Service} from './github-auth-service.js'; import {documentation, errorMessagesFor, stateColor, commentsColor} from './github-helpers.js'; diff --git a/services/github/github-issue-detail.spec.js b/services/github/github-issue-detail.spec.js index bf1e9f31b4670..649cc17ad7e28 100644 --- a/services/github/github-issue-detail.spec.js +++ b/services/github/github-issue-detail.spec.js @@ -2,7 +2,7 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; import {age} from '../color-formatters.js'; import {formatDate, metric} from '../text-formatters.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import GithubIssueDetail from './github-issue-detail.service.js'; import {stateColor, commentsColor} from './github-helpers.js'; diff --git a/services/github/github-pipenv.service.js b/services/github/github-pipenv.service.js index daee298794125..8d5b1230e20b6 100644 --- a/services/github/github-pipenv.service.js +++ b/services/github/github-pipenv.service.js @@ -1,7 +1,7 @@ import {renderVersionBadge} from '../version.js'; import {isLockfile, getDependencyVersion} from '../pipenv-helpers.js'; import {addv} from '../text-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; import {fetchJsonFromRepo} from './github-common-fetch.js'; import {documentation as githubDocumentation} from './github-helpers.js'; diff --git a/services/github/github-r-package.service.js b/services/github/github-r-package.service.js index f638e7174477b..b6896024c1e19 100644 --- a/services/github/github-r-package.service.js +++ b/services/github/github-r-package.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; import {fetchRepoContent} from './github-common-fetch.js'; import {documentation} from './github-helpers.js'; diff --git a/services/github/github-r-package.spec.js b/services/github/github-r-package.spec.js index 67d39fd3a79c5..23fd48e57c0d0 100644 --- a/services/github/github-r-package.spec.js +++ b/services/github/github-r-package.spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import GithubRPackageVersion from './github-r-package.service.js'; describe('GithubRPackageVersion', function () { diff --git a/services/github/github-release.service.js b/services/github/github-release.service.js index 4ee1ecb56f988..a2a83afc69b98 100644 --- a/services/github/github-release.service.js +++ b/services/github/github-release.service.js @@ -1,6 +1,6 @@ import {addv} from '../text-formatters.js'; import {version as versionColor} from '../color-formatters.js'; -import {redirector} from '..'; +import {redirector} from '../index.js'; import {GithubAuthV3Service} from './github-auth-service.js'; import {fetchLatestRelease, queryParamSchema} from './github-common-release.js'; import {documentation} from './github-helpers.js'; @@ -119,5 +119,5 @@ const redirects = { export { GithubRelease, - ...redirects, + redirects, }; diff --git a/services/github/github-size.service.js b/services/github/github-size.service.js index 9eeb1603690dc..ca31c7bafc4b8 100644 --- a/services/github/github-size.service.js +++ b/services/github/github-size.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import prettyBytes from 'pretty-bytes'; import {nonNegativeInteger} from '../validators.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {GithubAuthV3Service} from './github-auth-service.js'; import {documentation, errorMessagesFor} from './github-helpers.js'; diff --git a/services/github/github-sponsors.service.js b/services/github/github-sponsors.service.js index b8512918cdf8c..2992e63f9a6fb 100644 --- a/services/github/github-sponsors.service.js +++ b/services/github/github-sponsors.service.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {GithubAuthV4Service} from './github-auth-service.js'; import {documentation, transformErrors} from './github-helpers.js'; diff --git a/services/github/github-tag.service.js b/services/github/github-tag.service.js index 9eaa535fcbb97..6bccae7e15cc3 100644 --- a/services/github/github-tag.service.js +++ b/services/github/github-tag.service.js @@ -3,7 +3,7 @@ import Joi from 'joi'; import {addv} from '../text-formatters.js'; import {version as versionColor} from '../color-formatters.js'; import {latest} from '../version.js'; -import {NotFound, redirector} from '..'; +import {NotFound, redirector} from '../index.js'; import {GithubAuthV4Service} from './github-auth-service.js'; import {queryParamSchema} from './github-common-release.js'; import {documentation, transformErrors} from './github-helpers.js'; @@ -163,5 +163,5 @@ const redirects = { export { GithubTag, - ...redirects, + redirects, }; diff --git a/services/github/github-workflow-status.service.js b/services/github/github-workflow-status.service.js index 85aa3b27f9d9b..122228371a3a7 100644 --- a/services/github/github-workflow-status.service.js +++ b/services/github/github-workflow-status.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; import {documentation} from './github-helpers.js'; const schema = Joi.object({ diff --git a/services/gitlab/gitlab-coverage.service.js b/services/gitlab/gitlab-coverage.service.js index f35d42583b569..6035f9a285e64 100644 --- a/services/gitlab/gitlab-coverage.service.js +++ b/services/gitlab/gitlab-coverage.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {coveragePercentage} from '../color-formatters.js'; import {optionalUrl} from '../validators.js'; -import {BaseSvgScrapingService, NotFound} from '..'; +import {BaseSvgScrapingService, NotFound} from '../index.js'; const schema = Joi.object({ message: Joi.string() diff --git a/services/gitlab/gitlab-pipeline-status.service.js b/services/gitlab/gitlab-pipeline-status.service.js index 3e47d1159eaea..379246124500e 100644 --- a/services/gitlab/gitlab-pipeline-status.service.js +++ b/services/gitlab/gitlab-pipeline-status.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; import {optionalUrl} from '../validators.js'; -import {BaseSvgScrapingService, NotFound, redirector} from '..'; +import {BaseSvgScrapingService, NotFound, redirector} from '../index.js'; const badgeSchema = Joi.object({ message: Joi.alternatives() diff --git a/services/gitter/gitter.service.js b/services/gitter/gitter.service.js index f8ade3ae9872c..bd1ae135c50d9 100644 --- a/services/gitter/gitter.service.js +++ b/services/gitter/gitter.service.js @@ -1,4 +1,4 @@ -import {BaseStaticService} from '..'; +import {BaseStaticService} from '../index.js'; export default class Gitter extends BaseStaticService { static category = 'chat' diff --git a/services/gratipay/gratipay.service.js b/services/gratipay/gratipay.service.js index 5038e1152a01f..b93af93369bc3 100644 --- a/services/gratipay/gratipay.service.js +++ b/services/gratipay/gratipay.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; const commonAttrs = { category: 'funding', diff --git a/services/hackage/hackage-deps.service.js b/services/hackage/hackage-deps.service.js index bffa5d48d2aae..e9648802d14c0 100644 --- a/services/hackage/hackage-deps.service.js +++ b/services/hackage/hackage-deps.service.js @@ -1,4 +1,4 @@ -import {BaseService} from '..'; +import {BaseService} from '../index.js'; export default class HackageDeps extends BaseService { static category = 'dependencies' diff --git a/services/hackage/hackage-version.service.js b/services/hackage/hackage-version.service.js index 93d5cf6b3873f..6d0d50ffa26a0 100644 --- a/services/hackage/hackage-version.service.js +++ b/services/hackage/hackage-version.service.js @@ -1,5 +1,5 @@ import {renderVersionBadge} from '../version.js'; -import {BaseService, InvalidResponse} from '..'; +import {BaseService, InvalidResponse} from '../index.js'; export default class HackageVersion extends BaseService { static category = 'version' diff --git a/services/hexpm/hexpm.service.js b/services/hexpm/hexpm.service.js index e7388697a3f82..d3de6048a6f05 100644 --- a/services/hexpm/hexpm.service.js +++ b/services/hexpm/hexpm.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric, addv, maybePluralize} from '../text-formatters.js'; import {downloadCount, version as versionColor} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const hexSchema = Joi.object({ downloads: Joi.object({ diff --git a/services/homebrew/homebrew-cask.service.js b/services/homebrew/homebrew-cask.service.js index 2d80a62d786c1..75d50563c1eb3 100644 --- a/services/homebrew/homebrew-cask.service.js +++ b/services/homebrew/homebrew-cask.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: Joi.string().required(), diff --git a/services/homebrew/homebrew-downloads.service.js b/services/homebrew/homebrew-downloads.service.js index 31a19c61595f9..430c2e4de8539 100644 --- a/services/homebrew/homebrew-downloads.service.js +++ b/services/homebrew/homebrew-downloads.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {downloadCount} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {nonNegativeInteger} from '../validators.js'; function getSchema({ formula }) { diff --git a/services/homebrew/homebrew-version.service.js b/services/homebrew/homebrew-version.service.js index 93997041bd178..1241f876f7d81 100644 --- a/services/homebrew/homebrew-version.service.js +++ b/services/homebrew/homebrew-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ versions: Joi.object({ diff --git a/services/hsts/hsts.service.js b/services/hsts/hsts.service.js index 2bf7c00229855..9f7682c87bee1 100644 --- a/services/hsts/hsts.service.js +++ b/services/hsts/hsts.service.js @@ -1,6 +1,6 @@ const label = 'hsts preloaded' import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ status: Joi.string().required(), }).required() diff --git a/services/imagelayers/imagelayers.service.js b/services/imagelayers/imagelayers.service.js index b5a771d4a84da..cf58467a44647 100644 --- a/services/imagelayers/imagelayers.service.js +++ b/services/imagelayers/imagelayers.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'size', diff --git a/services/index.js b/services/index.js index ba46d3891c03f..941f68457d777 100644 --- a/services/index.js +++ b/services/index.js @@ -1,5 +1 @@ -import base from '../core/base-service.js'; - -export { - ...base, -}; +export * from '../core/base-service/index.js'; diff --git a/services/issuestats/issuestats.service.js b/services/issuestats/issuestats.service.js index c2261ee361a1c..2035ae7b417b3 100644 --- a/services/issuestats/issuestats.service.js +++ b/services/issuestats/issuestats.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'issue-tracking', diff --git a/services/itunes/itunes.service.js b/services/itunes/itunes.service.js index 7fa9cb63b4c13..adb272b33c520 100644 --- a/services/itunes/itunes.service.js +++ b/services/itunes/itunes.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object({ resultCount: nonNegativeInteger, diff --git a/services/jenkins/jenkins-base.js b/services/jenkins/jenkins-base.js index 62c3ada6044d7..8af64f294c5ed 100644 --- a/services/jenkins/jenkins-base.js +++ b/services/jenkins/jenkins-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; export default class JenkinsBase extends BaseJsonService { static auth = { diff --git a/services/jenkins/jenkins-build-redirect.service.js b/services/jenkins/jenkins-build-redirect.service.js index 3d7f2dcb4c145..2a556521393ec 100644 --- a/services/jenkins/jenkins-build-redirect.service.js +++ b/services/jenkins/jenkins-build-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; import {buildRedirectUrl} from './jenkins-common.js'; const commonProps = { diff --git a/services/jenkins/jenkins-common.js b/services/jenkins/jenkins-common.js index e2aee8d3ea81f..7de91605dcce2 100644 --- a/services/jenkins/jenkins-common.js +++ b/services/jenkins/jenkins-common.js @@ -21,7 +21,7 @@ const buildUrl = ({ jobUrl, lastCompletedBuild = true, plugin }) => { export { queryParamSchema, - buildTreeParamQueryString: tree => ({ tree }), buildUrl, buildRedirectUrl, }; +export const buildTreeParamQueryString = tree => ({ tree }) diff --git a/services/jenkins/jenkins-coverage-redirector.service.js b/services/jenkins/jenkins-coverage-redirector.service.js index e756813345793..b40ac65f5540e 100644 --- a/services/jenkins/jenkins-coverage-redirector.service.js +++ b/services/jenkins/jenkins-coverage-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; import {buildRedirectUrl} from './jenkins-common.js'; const commonProps = { diff --git a/services/jenkins/jenkins-plugin-installs.service.js b/services/jenkins/jenkins-plugin-installs.service.js index e39c8808ead5c..bc9dc98378633 100644 --- a/services/jenkins/jenkins-plugin-installs.service.js +++ b/services/jenkins/jenkins-plugin-installs.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {downloadCount as downloadCountColor} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schemaInstallations = Joi.object() .keys({ diff --git a/services/jenkins/jenkins-plugin-version.service.js b/services/jenkins/jenkins-plugin-version.service.js index 8f876b4bdf464..89e4dd47e10be 100644 --- a/services/jenkins/jenkins-plugin-version.service.js +++ b/services/jenkins/jenkins-plugin-version.service.js @@ -1,7 +1,7 @@ import {promisify} from 'util'; import {regularUpdate} from '../../core/legacy/regular-update.js'; import {renderVersionBadge} from '../version.js'; -import {BaseService, NotFound} from '..'; +import {BaseService, NotFound} from '../index.js'; export default class JenkinsPluginVersion extends BaseService { static category = 'version' diff --git a/services/jenkins/jenkins-tests-redirector.service.js b/services/jenkins/jenkins-tests-redirector.service.js index fdb0c7c6663f3..9368513db9246 100644 --- a/services/jenkins/jenkins-tests-redirector.service.js +++ b/services/jenkins/jenkins-tests-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; import {buildRedirectUrl} from './jenkins-common.js'; const commonProps = { diff --git a/services/jenkins/jenkins-tests.service.js b/services/jenkins/jenkins-tests.service.js index 724f3911023f7..5a1e64a0cfb42 100644 --- a/services/jenkins/jenkins-tests.service.js +++ b/services/jenkins/jenkins-tests.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {documentation, testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; import {optionalNonNegativeInteger} from '../validators.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import JenkinsBase from './jenkins-base.js'; import {buildTreeParamQueryString, buildUrl, queryParamSchema} from './jenkins-common.js'; diff --git a/services/jetbrains/jetbrains-base.js b/services/jetbrains/jetbrains-base.js index 04fc0a7a7d1b7..af6ed9ab1776c 100644 --- a/services/jetbrains/jetbrains-base.js +++ b/services/jetbrains/jetbrains-base.js @@ -1,4 +1,4 @@ -import {BaseXmlService, NotFound} from '..'; +import {BaseXmlService, NotFound} from '../index.js'; import {parseJson} from '../../core/base-service/json.js'; /* diff --git a/services/jira/jira-issue-redirect.service.js b/services/jira/jira-issue-redirect.service.js index 69d3307d7677f..e6d42b3fda771 100644 --- a/services/jira/jira-issue-redirect.service.js +++ b/services/jira/jira-issue-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/jira/jira-issue.service.js b/services/jira/jira-issue.service.js index 7baa6e4a5c9f8..da78639fccb52 100644 --- a/services/jira/jira-issue.service.js +++ b/services/jira/jira-issue.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {authConfig} from './jira-common.js'; const queryParamSchema = Joi.object({ diff --git a/services/jira/jira-sprint-redirect.service.js b/services/jira/jira-sprint-redirect.service.js index 58b5e6a566563..32ff4da3e20c9 100644 --- a/services/jira/jira-sprint-redirect.service.js +++ b/services/jira/jira-sprint-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/jira/jira-sprint.service.js b/services/jira/jira-sprint.service.js index 6ad618b50fcde..9582e0c79eea3 100644 --- a/services/jira/jira-sprint.service.js +++ b/services/jira/jira-sprint.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {authConfig} from './jira-common.js'; const queryParamSchema = Joi.object({ diff --git a/services/jitpack/jitpack-downloads.service.js b/services/jitpack/jitpack-downloads.service.js index 099095e1f6613..fd78726eace48 100644 --- a/services/jitpack/jitpack-downloads.service.js +++ b/services/jitpack/jitpack-downloads.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ route: { diff --git a/services/jitpack/jitpack-version-redirector.service.js b/services/jitpack/jitpack-version-redirector.service.js index aaf95efe83588..ad5ec714c9ac5 100644 --- a/services/jitpack/jitpack-version-redirector.service.js +++ b/services/jitpack/jitpack-version-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/jitpack/jitpack-version.service.js b/services/jitpack/jitpack-version.service.js index 92df88ce8aa45..d463e8028cf05 100644 --- a/services/jitpack/jitpack-version.service.js +++ b/services/jitpack/jitpack-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ version: Joi.string().required(), diff --git a/services/jsdelivr/jsdelivr-base.js b/services/jsdelivr/jsdelivr-base.js index 0dc2d66003457..04a2145e3343d 100644 --- a/services/jsdelivr/jsdelivr-base.js +++ b/services/jsdelivr/jsdelivr-base.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {downloadCount} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ total: Joi.number().required(), diff --git a/services/keybase/keybase-profile.js b/services/keybase/keybase-profile.js index 5c268b985c4f9..45fa744c897df 100644 --- a/services/keybase/keybase-profile.js +++ b/services/keybase/keybase-profile.js @@ -1,4 +1,4 @@ -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; export default class KeybaseProfile extends BaseJsonService { static get apiVersion() { diff --git a/services/leanpub/leanpub-book-summary.service.js b/services/leanpub/leanpub-book-summary.service.js index 15a38b71db232..44cb3a36b0716 100644 --- a/services/leanpub/leanpub-book-summary.service.js +++ b/services/leanpub/leanpub-book-summary.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ route: { diff --git a/services/lgtm/lgtm-base.js b/services/lgtm/lgtm-base.js index e867f80ce5c6a..a32e47f6cb6e7 100644 --- a/services/lgtm/lgtm-base.js +++ b/services/lgtm/lgtm-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ alerts: Joi.number().required(), diff --git a/services/lgtm/lgtm-redirector.service.js b/services/lgtm/lgtm-redirector.service.js index 2c019f5cd4825..a94679fbe016d 100644 --- a/services/lgtm/lgtm-redirector.service.js +++ b/services/lgtm/lgtm-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; const commonAttrs = { category: 'analysis', diff --git a/services/liberapay/liberapay-base.js b/services/liberapay/liberapay-base.js index 59e7204f87560..ed1fd232465d2 100644 --- a/services/liberapay/liberapay-base.js +++ b/services/liberapay/liberapay-base.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {colorScale} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ npatrons: nonNegativeInteger, diff --git a/services/liberapay/liberapay-gives.service.js b/services/liberapay/liberapay-gives.service.js index 879d7ee57530a..42992ef5f2ffe 100644 --- a/services/liberapay/liberapay-gives.service.js +++ b/services/liberapay/liberapay-gives.service.js @@ -1,4 +1,4 @@ -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {renderCurrencyBadge, LiberapayBase} from './liberapay-base.js'; export default class LiberapayGives extends LiberapayBase { diff --git a/services/liberapay/liberapay-goal.service.js b/services/liberapay/liberapay-goal.service.js index 4bf9727e3fbbd..c1053e60f4d93 100644 --- a/services/liberapay/liberapay-goal.service.js +++ b/services/liberapay/liberapay-goal.service.js @@ -1,5 +1,5 @@ import {colorScale} from '../color-formatters.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {LiberapayBase} from './liberapay-base.js'; export default class LiberapayGoal extends LiberapayBase { diff --git a/services/liberapay/liberapay-goal.spec.js b/services/liberapay/liberapay-goal.spec.js index 0e22317df1e8b..096e9d4137a29 100644 --- a/services/liberapay/liberapay-goal.spec.js +++ b/services/liberapay/liberapay-goal.spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import LiberapayGoal from './liberapay-goal.service.js'; describe('LiberapayGoal', function () { diff --git a/services/liberapay/liberapay-receives.service.js b/services/liberapay/liberapay-receives.service.js index c6953de1ecdee..1007da63ce9ec 100644 --- a/services/liberapay/liberapay-receives.service.js +++ b/services/liberapay/liberapay-receives.service.js @@ -1,4 +1,4 @@ -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {renderCurrencyBadge, LiberapayBase} from './liberapay-base.js'; export default class LiberapayReceives extends LiberapayBase { diff --git a/services/librariesio/librariesio-dependencies.service.js b/services/librariesio/librariesio-dependencies.service.js index c91e02020b06e..3aed6a5ea8981 100644 --- a/services/librariesio/librariesio-dependencies.service.js +++ b/services/librariesio/librariesio-dependencies.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {transform, renderDependenciesBadge} from './librariesio-dependencies-helpers.js'; const schema = Joi.object({ diff --git a/services/librariesio/librariesio-dependent-repos.service.js b/services/librariesio/librariesio-dependent-repos.service.js index e5e727e989453..ef5e819835847 100644 --- a/services/librariesio/librariesio-dependent-repos.service.js +++ b/services/librariesio/librariesio-dependent-repos.service.js @@ -1,5 +1,5 @@ import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {fetchProject} from './librariesio-common.js'; // https://libraries.io/api#project-dependent-repositories diff --git a/services/librariesio/librariesio-dependents.service.js b/services/librariesio/librariesio-dependents.service.js index 772903a459c45..6442486d4185a 100644 --- a/services/librariesio/librariesio-dependents.service.js +++ b/services/librariesio/librariesio-dependents.service.js @@ -1,5 +1,5 @@ import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {fetchProject} from './librariesio-common.js'; // https://libraries.io/api#project-dependents diff --git a/services/librariesio/librariesio-sourcerank.service.js b/services/librariesio/librariesio-sourcerank.service.js index 48b0c1b326e0c..451c244f0de41 100644 --- a/services/librariesio/librariesio-sourcerank.service.js +++ b/services/librariesio/librariesio-sourcerank.service.js @@ -1,5 +1,5 @@ import {colorScale} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {fetchProject} from './librariesio-common.js'; const sourceRankColor = colorScale([10, 15, 20, 25, 30]) diff --git a/services/libscore/libscore.service.js b/services/libscore/libscore.service.js index 4febb62f60217..7b73f8ef3c5a1 100644 --- a/services/libscore/libscore.service.js +++ b/services/libscore/libscore.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'rating', diff --git a/services/localizely/localizely.service.js b/services/localizely/localizely.service.js index 46e5b82677fed..833ced776b78d 100644 --- a/services/localizely/localizely.service.js +++ b/services/localizely/localizely.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, InvalidResponse} from '..'; +import {BaseJsonService, InvalidResponse} from '../index.js'; import {coveragePercentage} from '../color-formatters.js'; const keywords = [ diff --git a/services/luarocks/luarocks.service.js b/services/luarocks/luarocks.service.js index 2e8261935bc22..7bc6cef6083b7 100644 --- a/services/luarocks/luarocks.service.js +++ b/services/luarocks/luarocks.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {addv} from '../text-formatters.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {latestVersion} from './luarocks-version-helpers.js'; const schema = Joi.object({ diff --git a/services/magnumci/magnumci.service.js b/services/magnumci/magnumci.service.js index 51b31717f046b..fffa239e6a0cc 100644 --- a/services/magnumci/magnumci.service.js +++ b/services/magnumci/magnumci.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'build', diff --git a/services/maintenance/maintenance.service.js b/services/maintenance/maintenance.service.js index c12cb4e025c87..ed2cfc4b7f4a3 100644 --- a/services/maintenance/maintenance.service.js +++ b/services/maintenance/maintenance.service.js @@ -1,4 +1,4 @@ -import {BaseService} from '..'; +import {BaseService} from '../index.js'; export default class Maintenance extends BaseService { static category = 'other' diff --git a/services/mastodon/mastodon-follow.service.js b/services/mastodon/mastodon-follow.service.js index 707f82498bf2e..9047617d110d6 100644 --- a/services/mastodon/mastodon-follow.service.js +++ b/services/mastodon/mastodon-follow.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {optionalUrl, nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object({ username: Joi.string().required(), diff --git a/services/matrix/matrix.service.js b/services/matrix/matrix.service.js index 314eb6b6b8789..46442844949b1 100644 --- a/services/matrix/matrix.service.js +++ b/services/matrix/matrix.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, InvalidParameter} from '..'; +import {BaseJsonService, InvalidParameter} from '../index.js'; const queryParamSchema = Joi.object({ server_fqdn: Joi.string().hostname(), diff --git a/services/maven-central/maven-central.service.js b/services/maven-central/maven-central.service.js index 9bbd322250668..2cb47457c6dd2 100644 --- a/services/maven-central/maven-central.service.js +++ b/services/maven-central/maven-central.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseXmlService, NotFound} from '..'; +import {BaseXmlService, NotFound} from '../index.js'; const schema = Joi.object({ metadata: Joi.object({ diff --git a/services/maven-metadata/maven-metadata-redirect.service.js b/services/maven-metadata/maven-metadata-redirect.service.js index fb275c6cfd4dc..bf088ea879861 100644 --- a/services/maven-metadata/maven-metadata-redirect.service.js +++ b/services/maven-metadata/maven-metadata-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default redirector({ category: 'version', diff --git a/services/maven-metadata/maven-metadata.service.js b/services/maven-metadata/maven-metadata.service.js index 6bc71a8443664..5d7a56fb929dc 100644 --- a/services/maven-metadata/maven-metadata.service.js +++ b/services/maven-metadata/maven-metadata.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; import {renderVersionBadge} from '../version.js'; -import {BaseXmlService} from '..'; +import {BaseXmlService} from '../index.js'; const queryParamSchema = Joi.object({ metadataUrl: optionalUrl.required(), diff --git a/services/microbadger/microbadger-base.js b/services/microbadger/microbadger-base.js index 544737dbf2f68..afffbc18f1b2f 100644 --- a/services/microbadger/microbadger-base.js +++ b/services/microbadger/microbadger-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object({ LayerCount: nonNegativeInteger, diff --git a/services/microbadger/microbadger-size.service.js b/services/microbadger/microbadger-size.service.js index 1e20d9543f482..2b784d0e1ec18 100644 --- a/services/microbadger/microbadger-size.service.js +++ b/services/microbadger/microbadger-size.service.js @@ -1,5 +1,5 @@ import prettyBytes from 'pretty-bytes'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import BaseMicrobadgerService from './microbadger-base.js'; const documentation = ` diff --git a/services/mozilla-observatory/mozilla-observatory.service.js b/services/mozilla-observatory/mozilla-observatory.service.js index 2b388bf541906..688fa22ed8093 100644 --- a/services/mozilla-observatory/mozilla-observatory.service.js +++ b/services/mozilla-observatory/mozilla-observatory.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ state: Joi.string() diff --git a/services/netlify/netlify.service.js b/services/netlify/netlify.service.js index 4371d292f7912..f2ab3da6080e1 100644 --- a/services/netlify/netlify.service.js +++ b/services/netlify/netlify.service.js @@ -1,5 +1,5 @@ import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; const pendingStatus = 'building' const notBuiltStatus = 'not built' diff --git a/services/nexus/nexus-redirect.service.js b/services/nexus/nexus-redirect.service.js index 605e098910b33..ac06886554022 100644 --- a/services/nexus/nexus-redirect.service.js +++ b/services/nexus/nexus-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/nexus/nexus.service.js b/services/nexus/nexus.service.js index 8350fd9f07dec..60c084027668e 100644 --- a/services/nexus/nexus.service.js +++ b/services/nexus/nexus.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {version as versionColor} from '../color-formatters.js'; import {addv} from '../text-formatters.js'; import {optionalUrl, optionalDottedVersionNClausesWithOptionalSuffix} from '../validators.js'; -import {BaseJsonService, InvalidResponse, NotFound} from '..'; +import {BaseJsonService, InvalidResponse, NotFound} from '../index.js'; import {isSnapshotVersion} from './nexus-version.js'; const nexus2SearchApiSchema = Joi.object({ diff --git a/services/nexus/nexus.spec.js b/services/nexus/nexus.spec.js index c7af2dc639149..63d3b3266e22e 100644 --- a/services/nexus/nexus.spec.js +++ b/services/nexus/nexus.spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import nock from 'nock'; import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import {InvalidResponse, NotFound} from '..'; +import {InvalidResponse, NotFound} from '../index.js'; import Nexus from './nexus.service.js'; describe('Nexus', function () { diff --git a/services/nodeping/nodeping-status.service.js b/services/nodeping/nodeping-status.service.js index 8b921d51e363c..5461f6fd573fa 100644 --- a/services/nodeping/nodeping-status.service.js +++ b/services/nodeping/nodeping-status.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {queryParamSchema, exampleQueryParams, renderWebsiteStatus} from '../website-status.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.array() .items(Joi.object().keys({ su: Joi.boolean() })) diff --git a/services/nodeping/nodeping-uptime.service.js b/services/nodeping/nodeping-uptime.service.js index 93a8df7354ce9..92b4240af56ac 100644 --- a/services/nodeping/nodeping-uptime.service.js +++ b/services/nodeping/nodeping-uptime.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {colorScale} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const colorFormatter = colorScale([99, 99.5, 100]) diff --git a/services/npm/npm-base.js b/services/npm/npm-base.js index e00f002060024..a2656cadbadca 100644 --- a/services/npm/npm-base.js +++ b/services/npm/npm-base.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; import {isDependencyMap} from '../package-json-helpers.js'; -import {BaseJsonService, InvalidResponse, NotFound} from '..'; +import {BaseJsonService, InvalidResponse, NotFound} from '../index.js'; const deprecatedLicenseObjectSchema = Joi.object({ type: Joi.string().required(), diff --git a/services/npm/npm-downloads.service.js b/services/npm/npm-downloads.service.js index 5119c382c4cf4..fd03ce813bf88 100644 --- a/services/npm/npm-downloads.service.js +++ b/services/npm/npm-downloads.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; // https://github.com/npm/registry/blob/master/docs/download-counts.md#output const pointResponseSchema = Joi.object({ diff --git a/services/npm/npm-version.service.js b/services/npm/npm-version.service.js index cb69debf9464b..c6f6f21909e13 100644 --- a/services/npm/npm-version.service.js +++ b/services/npm/npm-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import NpmBase from './npm-base.js'; const keywords = ['node'] diff --git a/services/nsp/nsp.service.js b/services/nsp/nsp.service.js index 7f8b5e9649b06..d9189cee000fa 100644 --- a/services/nsp/nsp.service.js +++ b/services/nsp/nsp.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ route: { diff --git a/services/nuget/nuget-v2-service-family.js b/services/nuget/nuget-v2-service-family.js index 57bab6671b076..6a2abf558476f 100644 --- a/services/nuget/nuget-v2-service-family.js +++ b/services/nuget/nuget-v2-service-family.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, BaseXmlService, NotFound, redirector} from '..'; +import {BaseJsonService, BaseXmlService, NotFound, redirector} from '../index.js'; import {renderVersionBadge, renderDownloadBadge, odataToObject} from './nuget-helpers.js'; function createFilter({ packageName, includePrereleases }) { diff --git a/services/nuget/nuget-v3-service-family.js b/services/nuget/nuget-v3-service-family.js index 008a23d99a180..8569f8b681f43 100644 --- a/services/nuget/nuget-v3-service-family.js +++ b/services/nuget/nuget-v3-service-family.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import RouteBuilder from '../route-builder.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {renderVersionBadge, renderDownloadBadge, searchServiceUrl, stripBuildMetadata, selectVersion} from './nuget-helpers.js'; /* diff --git a/services/nycrc/nycrc.service.js b/services/nycrc/nycrc.service.js index 3723da72846ff..b08d6a8dfd377 100644 --- a/services/nycrc/nycrc.service.js +++ b/services/nycrc/nycrc.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {coveragePercentage} from '../color-formatters.js'; import {ConditionalGithubAuthV3Service} from '../github/github-auth-service.js'; import {fetchJsonFromRepo} from '../github/github-common-fetch.js'; -import {InvalidParameter, InvalidResponse, NotFound} from '..'; +import {InvalidParameter, InvalidResponse, NotFound} from '../index.js'; const nycrcSchema = Joi.object({ branches: Joi.number().min(0).max(100), diff --git a/services/offset-earth/offset-earth-carbon-redirect.service.js b/services/offset-earth/offset-earth-carbon-redirect.service.js index 45bc4a8ffed8e..26f284e81cfde 100644 --- a/services/offset-earth/offset-earth-carbon-redirect.service.js +++ b/services/offset-earth/offset-earth-carbon-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ // https://github.com/badges/shields/issues/5433 diff --git a/services/offset-earth/offset-earth-trees-redirect.service.js b/services/offset-earth/offset-earth-trees-redirect.service.js index 60c3671d57e8c..cd29c30c9dc5f 100644 --- a/services/offset-earth/offset-earth-trees-redirect.service.js +++ b/services/offset-earth/offset-earth-trees-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ // https://github.com/badges/shields/issues/5433 diff --git a/services/open-vsx/open-vsx-base.js b/services/open-vsx/open-vsx-base.js index 408dd23b8c65a..1b069ac78889a 100644 --- a/services/open-vsx/open-vsx-base.js +++ b/services/open-vsx/open-vsx-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalNonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const extensionQuerySchema = Joi.object({ error: Joi.string(), diff --git a/services/opencollective/opencollective-base.js b/services/opencollective/opencollective-base.js index ed4ed5c0e6fb6..f6f8e96177d0c 100644 --- a/services/opencollective/opencollective-base.js +++ b/services/opencollective/opencollective-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; // https://developer.opencollective.com/#/api/collectives?id=get-info const collectiveDetailsSchema = Joi.object().keys({ diff --git a/services/opm/opm-version.service.js b/services/opm/opm-version.service.js index 1d4eefbf43563..71231728355f0 100644 --- a/services/opm/opm-version.service.js +++ b/services/opm/opm-version.service.js @@ -1,5 +1,5 @@ import {renderVersionBadge} from '../version.js'; -import {BaseService, NotFound, InvalidResponse} from '..'; +import {BaseService, NotFound, InvalidResponse} from '../index.js'; export default class OpmVersion extends BaseService { static category = 'version' diff --git a/services/ore/ore-base.js b/services/ore/ore-base.js index 5110967393152..bf19ea22c3887 100644 --- a/services/ore/ore-base.js +++ b/services/ore/ore-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, InvalidResponse} from '..'; +import {BaseJsonService, InvalidResponse} from '../index.js'; const sessionSchema = Joi.object({ session: Joi.string().required(), diff --git a/services/osslifecycle/osslifecycle.service.js b/services/osslifecycle/osslifecycle.service.js index 5ba5d950cf3a4..acefdf0810767 100644 --- a/services/osslifecycle/osslifecycle.service.js +++ b/services/osslifecycle/osslifecycle.service.js @@ -1,4 +1,4 @@ -import {BaseService, InvalidResponse} from '..'; +import {BaseService, InvalidResponse} from '../index.js'; const documentation = `

diff --git a/services/package-json-helpers.js b/services/package-json-helpers.js index 1196566430af1..1d17bb8cba0e2 100644 --- a/services/package-json-helpers.js +++ b/services/package-json-helpers.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {InvalidParameter} from '.'; +import {InvalidParameter} from './index.js'; const isDependencyMap = Joi.object() .pattern( diff --git a/services/packagecontrol/packagecontrol.service.js b/services/packagecontrol/packagecontrol.service.js index d907d1a295441..c0c3752f46123 100644 --- a/services/packagecontrol/packagecontrol.service.js +++ b/services/packagecontrol/packagecontrol.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {downloadCount} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const keywords = ['sublime', 'sublimetext', 'packagecontrol'] diff --git a/services/packagist/packagist-base.js b/services/packagist/packagist-base.js index ae5754c862271..53fafe00577ce 100644 --- a/services/packagist/packagist-base.js +++ b/services/packagist/packagist-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const packageSchema = Joi.object() .pattern( diff --git a/services/packagist/packagist-license.service.js b/services/packagist/packagist-license.service.js index e5f60518f6428..65f55817323dd 100644 --- a/services/packagist/packagist-license.service.js +++ b/services/packagist/packagist-license.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {renderLicenseBadge} from '../licenses.js'; import {optionalUrl} from '../validators.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {keywords, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; const packageSchema = Joi.object() diff --git a/services/packagist/packagist-license.spec.js b/services/packagist/packagist-license.spec.js index 765f34c4d767c..fce371877dca9 100644 --- a/services/packagist/packagist-license.spec.js +++ b/services/packagist/packagist-license.spec.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import PackagistLicense from './packagist-license.service.js'; describe('PackagistLicense', function () { diff --git a/services/packagist/packagist-php-version.service.js b/services/packagist/packagist-php-version.service.js index c0d0b7c442847..b2db629d8fda2 100644 --- a/services/packagist/packagist-php-version.service.js +++ b/services/packagist/packagist-php-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {allVersionsSchema, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; const queryParamSchema = Joi.object({ diff --git a/services/packagist/packagist-php-version.spec.js b/services/packagist/packagist-php-version.spec.js index b02f860284ffb..18a2dd6411c2e 100644 --- a/services/packagist/packagist-php-version.spec.js +++ b/services/packagist/packagist-php-version.spec.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import PackagistPhpVersion from './packagist-php-version.service.js'; describe('PackagistPhpVersion', function () { diff --git a/services/packagist/packagist-version.service.js b/services/packagist/packagist-version.service.js index 9e40b9d42888e..387b5a971c0c8 100644 --- a/services/packagist/packagist-version.service.js +++ b/services/packagist/packagist-version.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; import {compare, isStable, latest} from '../php-version.js'; import {optionalUrl} from '../validators.js'; -import {NotFound, redirector} from '..'; +import {NotFound, redirector} from '../index.js'; import {allVersionsSchema, keywords, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; const packageSchema = Joi.object() diff --git a/services/php-eye/php-eye-hhvm.service.js b/services/php-eye/php-eye-hhvm.service.js index 5c224139d8b55..bdb2a744df966 100644 --- a/services/php-eye/php-eye-hhvm.service.js +++ b/services/php-eye/php-eye-hhvm.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default [ deprecatedService({ diff --git a/services/php-eye/php-eye-php-version.service.js b/services/php-eye/php-eye-php-version.service.js index 53bb0a2f1ae61..4235c930456e7 100644 --- a/services/php-eye/php-eye-php-version.service.js +++ b/services/php-eye/php-eye-php-version.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default [ deprecatedService({ diff --git a/services/pingpong/pingpong-status.service.js b/services/pingpong/pingpong-status.service.js index 9a2cd2d498b72..8c47ead1a2122 100644 --- a/services/pingpong/pingpong-status.service.js +++ b/services/pingpong/pingpong-status.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, InvalidParameter, InvalidResponse} from '..'; +import {BaseJsonService, InvalidParameter, InvalidResponse} from '../index.js'; const schema = Joi.object({ status: Joi.string().required(), diff --git a/services/pingpong/pingpong-uptime.service.js b/services/pingpong/pingpong-uptime.service.js index 2e16e22d56d0b..3dea3e0f43363 100644 --- a/services/pingpong/pingpong-uptime.service.js +++ b/services/pingpong/pingpong-uptime.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService, InvalidParameter} from '..'; +import {BaseJsonService, InvalidParameter} from '../index.js'; const schema = Joi.object({ uptime: Joi.number().min(0).max(100).required(), diff --git a/services/pipenv-helpers.js b/services/pipenv-helpers.js index e212850c66364..2992617a89bb4 100644 --- a/services/pipenv-helpers.js +++ b/services/pipenv-helpers.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {InvalidParameter} from '.'; +import {InvalidParameter} from './index.js'; const isDependency = Joi.alternatives( Joi.object({ diff --git a/services/pkgreview/package-rating.service.js b/services/pkgreview/package-rating.service.js index af522234c1111..6297d67ad0dd4 100644 --- a/services/pkgreview/package-rating.service.js +++ b/services/pkgreview/package-rating.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {starRating, metric} from '../text-formatters.js'; import {colorScale} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const pkgReviewColor = colorScale([2, 3, 4]) diff --git a/services/poeditor/poeditor.service.js b/services/poeditor/poeditor.service.js index 0d2acec00f3f9..1671050b549f3 100644 --- a/services/poeditor/poeditor.service.js +++ b/services/poeditor/poeditor.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService, InvalidResponse} from '..'; +import {BaseJsonService, InvalidResponse} from '../index.js'; const documentation = `

diff --git a/services/powershellgallery/powershellgallery.service.js b/services/powershellgallery/powershellgallery.service.js index e7f69cf41e6e2..9d07486bad1ae 100644 --- a/services/powershellgallery/powershellgallery.service.js +++ b/services/powershellgallery/powershellgallery.service.js @@ -1,5 +1,5 @@ import {fetch, createServiceFamily} from '../nuget/nuget-v2-service-family.js'; -import {BaseXmlService} from '..'; +import {BaseXmlService} from '../index.js'; const WINDOWS_TAG_NAME = 'windows' const MACOS_TAG_NAME = 'macos' diff --git a/services/pub/pub.service.js b/services/pub/pub.service.js index f753c58aa70e5..cda5e01bfb896 100644 --- a/services/pub/pub.service.js +++ b/services/pub/pub.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {latest, renderVersionBadge} from '../version.js'; -import {BaseJsonService, redirector} from '..'; +import {BaseJsonService, redirector} from '../index.js'; const schema = Joi.object({ versions: Joi.array().items(Joi.string()).required(), diff --git a/services/puppetforge/puppetforge-base.js b/services/puppetforge/puppetforge-base.js index b8dec23a79ae3..4446670a888a0 100644 --- a/services/puppetforge/puppetforge-base.js +++ b/services/puppetforge/puppetforge-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger, semver} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const usersSchema = Joi.object({ module_count: nonNegativeInteger, diff --git a/services/puppetforge/puppetforge-module-endorsement.service.js b/services/puppetforge/puppetforge-module-endorsement.service.js index 11d544fea8448..425cd02157a6e 100644 --- a/services/puppetforge/puppetforge-module-endorsement.service.js +++ b/services/puppetforge/puppetforge-module-endorsement.service.js @@ -1,4 +1,4 @@ -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {BasePuppetForgeModulesService} from './puppetforge-base.js'; export default class PuppetforgeModuleEndorsement extends ( diff --git a/services/puppetforge/puppetforge-module-feedback.service.js b/services/puppetforge/puppetforge-module-feedback.service.js index 207f790703ebc..a1420f18aa149 100644 --- a/services/puppetforge/puppetforge-module-feedback.service.js +++ b/services/puppetforge/puppetforge-module-feedback.service.js @@ -1,5 +1,5 @@ import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {BasePuppetForgeModulesService} from './puppetforge-base.js'; export default class PuppetforgeModuleFeedback extends ( diff --git a/services/puppetforge/puppetforge-module-pdk-version.service.js b/services/puppetforge/puppetforge-module-pdk-version.service.js index 43129da1072e9..e9ac7cb12049b 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.service.js +++ b/services/puppetforge/puppetforge-module-pdk-version.service.js @@ -1,5 +1,5 @@ import {renderVersionBadge} from '../version.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {BasePuppetForgeModulesService} from './puppetforge-base.js'; export default class PuppetforgeModulePdkVersion extends ( diff --git a/services/pypi/pypi-base.js b/services/pypi/pypi-base.js index 540b93244e017..bb5d81b87c9f2 100644 --- a/services/pypi/pypi-base.js +++ b/services/pypi/pypi-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ info: Joi.object({ diff --git a/services/pypi/pypi-downloads.service.js b/services/pypi/pypi-downloads.service.js index 70152d2d1d1be..147ac8144c573 100644 --- a/services/pypi/pypi-downloads.service.js +++ b/services/pypi/pypi-downloads.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import {downloadCount} from '../color-formatters.js'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const keywords = ['python'] diff --git a/services/readthedocs/readthedocs.service.js b/services/readthedocs/readthedocs.service.js index f3da497a5fae0..a441fd9c3f245 100644 --- a/services/readthedocs/readthedocs.service.js +++ b/services/readthedocs/readthedocs.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService, NotFound} from '..'; +import {BaseSvgScrapingService, NotFound} from '../index.js'; const keywords = ['documentation'] diff --git a/services/reddit/subreddit-subscribers.service.js b/services/reddit/subreddit-subscribers.service.js index 8bf8b843c4030..3537662d85296 100644 --- a/services/reddit/subreddit-subscribers.service.js +++ b/services/reddit/subreddit-subscribers.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {optionalNonNegativeInteger} from '../validators.js'; import {metric} from '../text-formatters.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object({ data: Joi.object({ diff --git a/services/reddit/user-karma.service.js b/services/reddit/user-karma.service.js index 3bcbd954317b6..014c9807029e4 100644 --- a/services/reddit/user-karma.service.js +++ b/services/reddit/user-karma.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ data: Joi.object({ diff --git a/services/redmine/redmine.service.js b/services/redmine/redmine.service.js index 7e48dd78f17d9..7dc06bc5b13d7 100644 --- a/services/redmine/redmine.service.js +++ b/services/redmine/redmine.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {starRating} from '../text-formatters.js'; import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseXmlService} from '..'; +import {BaseXmlService} from '../index.js'; const schema = Joi.object({ 'redmine-plugin': Joi.object({ diff --git a/services/repology/repology-repositories.service.js b/services/repology/repology-repositories.service.js index d2c9603e44ee2..a49453065f767 100644 --- a/services/repology/repology-repositories.service.js +++ b/services/repology/repology-repositories.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; const schema = Joi.object({ message: nonNegativeInteger, diff --git a/services/requires/requires.service.js b/services/requires/requires.service.js index 7f8c7840c12db..90836be2aad67 100644 --- a/services/requires/requires.service.js +++ b/services/requires/requires.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const statusSchema = Joi.object({ status: Joi.string().required(), diff --git a/services/reuse/reuse-compliance.service.js b/services/reuse/reuse-compliance.service.js index 9e09691ff9f5d..25d99a92275f1 100644 --- a/services/reuse/reuse-compliance.service.js +++ b/services/reuse/reuse-compliance.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; const responseSchema = Joi.object({ diff --git a/services/scoop/scoop-version.service.js b/services/scoop/scoop-version.service.js index 8d89b8f241c13..d565c3f2b7431 100644 --- a/services/scoop/scoop-version.service.js +++ b/services/scoop/scoop-version.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {ConditionalGithubAuthV3Service} from '../github/github-auth-service.js'; import {fetchJsonFromRepo} from '../github/github-common-fetch.js'; import {renderVersionBadge} from '../version.js'; diff --git a/services/scrutinizer/scrutinizer-base.js b/services/scrutinizer/scrutinizer-base.js index 66f3ba6517cb9..babeb83caadba 100644 --- a/services/scrutinizer/scrutinizer-base.js +++ b/services/scrutinizer/scrutinizer-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService, NotFound, InvalidResponse} from '..'; +import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; export default class ScrutinizerBase extends BaseJsonService { // https://scrutinizer-ci.com/docs/api/#repository-details diff --git a/services/scrutinizer/scrutinizer-coverage.service.js b/services/scrutinizer/scrutinizer-coverage.service.js index 611b2d167aebf..1be3405078d83 100644 --- a/services/scrutinizer/scrutinizer-coverage.service.js +++ b/services/scrutinizer/scrutinizer-coverage.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {colorScale} from '../color-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import ScrutinizerBase from './scrutinizer-base.js'; const schema = Joi.object({ diff --git a/services/scrutinizer/scrutinizer-coverage.spec.js b/services/scrutinizer/scrutinizer-coverage.spec.js index cfde5dfa26733..34821fe47940e 100644 --- a/services/scrutinizer/scrutinizer-coverage.spec.js +++ b/services/scrutinizer/scrutinizer-coverage.spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {test, given} from 'sazerac'; -import {InvalidResponse, NotFound} from '..'; +import {InvalidResponse, NotFound} from '../index.js'; import {ScrutinizerCoverage} from './scrutinizer-coverage.service.js'; describe('ScrutinizerCoverage', function () { diff --git a/services/scrutinizer/scrutinizer-redirect.service.js b/services/scrutinizer/scrutinizer-redirect.service.js index 0d5c4b07c4797..5a6581cbaac6d 100644 --- a/services/scrutinizer/scrutinizer-redirect.service.js +++ b/services/scrutinizer/scrutinizer-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; const commonAttrs = { category: 'analysis', diff --git a/services/security-headers/security-headers.service.js b/services/security-headers/security-headers.service.js index 4f13457b543a0..b7723c10763b0 100644 --- a/services/security-headers/security-headers.service.js +++ b/services/security-headers/security-headers.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseService, NotFound} from '..'; +import {BaseService, NotFound} from '../index.js'; const queryParamSchema = Joi.object({ url: optionalUrl.required(), diff --git a/services/shippable/shippable.service.js b/services/shippable/shippable.service.js index 0abe36a357c31..3a35e2025b8e5 100644 --- a/services/shippable/shippable.service.js +++ b/services/shippable/shippable.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService, NotFound, redirector} from '..'; +import {BaseJsonService, NotFound, redirector} from '../index.js'; // source: https://github.com/badges/shields/pull/1362#discussion_r161693830 const statusCodes = { diff --git a/services/snap-ci/snap-ci.service.js b/services/snap-ci/snap-ci.service.js index 4fb1f1cb38fa7..dbb29fad744c4 100644 --- a/services/snap-ci/snap-ci.service.js +++ b/services/snap-ci/snap-ci.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; const commonAttrs = { category: 'build', diff --git a/services/snyk/snyk-vulnerability-base.js b/services/snyk/snyk-vulnerability-base.js index f8a29afc3523d..ff983a21042cd 100644 --- a/services/snyk/snyk-vulnerability-base.js +++ b/services/snyk/snyk-vulnerability-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; const schema = Joi.object({ message: Joi.alternatives() diff --git a/services/snyk/snyk-vulnerability-npm.service.js b/services/snyk/snyk-vulnerability-npm.service.js index 45aefa3b96134..463545e3cfff0 100644 --- a/services/snyk/snyk-vulnerability-npm.service.js +++ b/services/snyk/snyk-vulnerability-npm.service.js @@ -1,4 +1,4 @@ -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import SynkVulnerabilityBase from './snyk-vulnerability-base.js'; export default class SnykVulnerabilityNpm extends SynkVulnerabilityBase { diff --git a/services/sonar/sonar-base.js b/services/sonar/sonar-base.js index a0a476d33dd6c..aed5d2f5ea2c0 100644 --- a/services/sonar/sonar-base.js +++ b/services/sonar/sonar-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {isLegacyVersion} from './sonar-helpers.js'; // It is possible to see HTTP 404 response codes and HTTP 200 responses diff --git a/services/sonar/sonar-redirector.service.js b/services/sonar/sonar-redirector.service.js index 3153796eb3f8d..2530afeb8c22d 100644 --- a/services/sonar/sonar-redirector.service.js +++ b/services/sonar/sonar-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/sourceforge/sourceforge-open-tickets.service.js b/services/sourceforge/sourceforge-open-tickets.service.js index 9e6f500ac722e..9266f32879446 100644 --- a/services/sourceforge/sourceforge-open-tickets.service.js +++ b/services/sourceforge/sourceforge-open-tickets.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ count: nonNegativeInteger.required(), diff --git a/services/sourceforge/sourceforge.service.js b/services/sourceforge/sourceforge.service.js index 831ae582fe579..7fed8dcd01635 100644 --- a/services/sourceforge/sourceforge.service.js +++ b/services/sourceforge/sourceforge.service.js @@ -3,7 +3,7 @@ import moment from 'moment'; import {metric} from '../text-formatters.js'; import {downloadCount} from '../color-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ total: nonNegativeInteger, diff --git a/services/sourcegraph/sourcegraph.service.js b/services/sourcegraph/sourcegraph.service.js index e49a6eb0230fe..1a35bdd4022d2 100644 --- a/services/sourcegraph/sourcegraph.service.js +++ b/services/sourcegraph/sourcegraph.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const projectsCountRegex = /^\s[0-9]*(\.[0-9]k)?\sprojects$/ const schema = Joi.object({ diff --git a/services/spack/spack.service.js b/services/spack/spack.service.js index 847710266ee3a..50b7a8a9bd83f 100644 --- a/services/spack/spack.service.js +++ b/services/spack/spack.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '..//version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ latest_version: Joi.string().required(), }).required() diff --git a/services/spiget/spiget-base.js b/services/spiget/spiget-base.js index 0162114808461..83f1d81afff36 100644 --- a/services/spiget/spiget-base.js +++ b/services/spiget/spiget-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const resourceSchema = Joi.object({ downloads: Joi.number().required(), diff --git a/services/stackexchange/stackexchange-monthlyquestions.service.js b/services/stackexchange/stackexchange-monthlyquestions.service.js index 57f5c18c67e15..fa56898021b19 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.service.js +++ b/services/stackexchange/stackexchange-monthlyquestions.service.js @@ -1,7 +1,7 @@ import moment from 'moment'; import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import renderQuestionsBadge from './stackexchange-helpers.js'; const tagSchema = Joi.object({ diff --git a/services/stackexchange/stackexchange-reputation.service.js b/services/stackexchange/stackexchange-reputation.service.js index 56505ed7d1a92..13ffe894d5264 100644 --- a/services/stackexchange/stackexchange-reputation.service.js +++ b/services/stackexchange/stackexchange-reputation.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const reputationSchema = Joi.object({ items: Joi.array() diff --git a/services/stackexchange/stackexchange-taginfo.service.js b/services/stackexchange/stackexchange-taginfo.service.js index 8e577742f0f41..67787171c41a6 100644 --- a/services/stackexchange/stackexchange-taginfo.service.js +++ b/services/stackexchange/stackexchange-taginfo.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; import renderQuestionsBadge from './stackexchange-helpers.js'; const tagSchema = Joi.object({ diff --git a/services/static-badge/query-string-static.service.js b/services/static-badge/query-string-static.service.js index dc5709b89b43e..5445539613880 100644 --- a/services/static-badge/query-string-static.service.js +++ b/services/static-badge/query-string-static.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseStaticService} from '..'; +import {BaseStaticService} from '../index.js'; const queryParamSchema = Joi.object({ message: Joi.string().required(), diff --git a/services/static-badge/static-badge.service.js b/services/static-badge/static-badge.service.js index 93e1b40a9e0be..12e4280e99b0f 100644 --- a/services/static-badge/static-badge.service.js +++ b/services/static-badge/static-badge.service.js @@ -1,5 +1,5 @@ import {escapeFormat} from '../../core/badge-urls/path-helpers.js'; -import {BaseStaticService} from '..'; +import {BaseStaticService} from '../index.js'; export default class StaticBadge extends BaseStaticService { static category = 'static' diff --git a/services/steam/steam-base.js b/services/steam/steam-base.js index 7230a11fd1285..a3b7afd55d48c 100644 --- a/services/steam/steam-base.js +++ b/services/steam/steam-base.js @@ -2,7 +2,7 @@ * @module */ -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; /** * The steam api is based like /{interface}/{method}/v{version}/ diff --git a/services/steam/steam-workshop.service.js b/services/steam/steam-workshop.service.js index 05fd53a298685..68cf48606af72 100644 --- a/services/steam/steam-workshop.service.js +++ b/services/steam/steam-workshop.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import prettyBytes from 'pretty-bytes'; import {metric, formatDate} from '../text-formatters.js'; import {age as ageColor, downloadCount} from '../color-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import BaseSteamAPI from './steam-base.js'; const documentation = ` diff --git a/services/swagger/swagger-redirect.service.js b/services/swagger/swagger-redirect.service.js index b10109ff5a162..150d41d0ff7e6 100644 --- a/services/swagger/swagger-redirect.service.js +++ b/services/swagger/swagger-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/swagger/swagger.service.js b/services/swagger/swagger.service.js index 90edd6417047d..13e6516d4038e 100644 --- a/services/swagger/swagger.service.js +++ b/services/swagger/swagger.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object() .keys({ diff --git a/services/symfony/sensiolabs-redirect.service.js b/services/symfony/sensiolabs-redirect.service.js index 497a036f5d9a3..df889ca1fd6d7 100644 --- a/services/symfony/sensiolabs-redirect.service.js +++ b/services/symfony/sensiolabs-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ // The SymfonyInsight service was previously branded as SensioLabs, and diff --git a/services/symfony/symfony-insight-base.js b/services/symfony/symfony-insight-base.js index ad13462243f65..19276a155c0a5 100644 --- a/services/symfony/symfony-insight-base.js +++ b/services/symfony/symfony-insight-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseXmlService, NotFound} from '..'; +import {BaseXmlService, NotFound} from '../index.js'; const violationSchema = Joi.object({ severity: Joi.equal('info', 'minor', 'major', 'critical').required(), diff --git a/services/symfony/symfony-insight-base.spec.js b/services/symfony/symfony-insight-base.spec.js index ab03abe62df48..36bbe44317c12 100644 --- a/services/symfony/symfony-insight-base.spec.js +++ b/services/symfony/symfony-insight-base.spec.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {SymfonyInsightBase} from './symfony-insight-base.js'; describe('SymfonyInsightBase', function () { diff --git a/services/teamcity/teamcity-base.js b/services/teamcity/teamcity-base.js index 7feb05b656706..d1769d58663c2 100644 --- a/services/teamcity/teamcity-base.js +++ b/services/teamcity/teamcity-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; export default class TeamCityBase extends BaseJsonService { static auth = { diff --git a/services/teamcity/teamcity-build-redirect.service.js b/services/teamcity/teamcity-build-redirect.service.js index 7384be0397ae7..865a973a89868 100644 --- a/services/teamcity/teamcity-build-redirect.service.js +++ b/services/teamcity/teamcity-build-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; const commonAttrs = { dateAdded: new Date('2019-09-15'), diff --git a/services/teamcity/teamcity-coverage-redirect.service.js b/services/teamcity/teamcity-coverage-redirect.service.js index d42eca87ab9c6..400b436697164 100644 --- a/services/teamcity/teamcity-coverage-redirect.service.js +++ b/services/teamcity/teamcity-coverage-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/teamcity/teamcity-coverage.service.js b/services/teamcity/teamcity-coverage.service.js index c98fa8cc4d54a..8909d4dcbde47 100644 --- a/services/teamcity/teamcity-coverage.service.js +++ b/services/teamcity/teamcity-coverage.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {coveragePercentage} from '../color-formatters.js'; import {optionalUrl} from '../validators.js'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import TeamCityBase from './teamcity-base.js'; const buildStatisticsSchema = Joi.object({ diff --git a/services/testspace/testspace-base.js b/services/testspace/testspace-base.js index ae3998f210105..16e038f54ebb1 100644 --- a/services/testspace/testspace-base.js +++ b/services/testspace/testspace-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; // https://help.testspace.com/docs/reference/web-api#list-results // case_counts|array|The contained cases [passed, failed, na, errored]|counters of result diff --git a/services/testspace/testspace-base.spec.js b/services/testspace/testspace-base.spec.js index 47c8d82369ee5..9ffb803096f20 100644 --- a/services/testspace/testspace-base.spec.js +++ b/services/testspace/testspace-base.spec.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import TestspaceBase from './testspace-base.js'; describe('TestspaceBase', function () { diff --git a/services/tokei/tokei.service.js b/services/tokei/tokei.service.js index c5d282b836f9c..0b207358ebaad 100644 --- a/services/tokei/tokei.service.js +++ b/services/tokei/tokei.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ lines: nonNegativeInteger, diff --git a/services/travis/travis-build.service.js b/services/travis/travis-build.service.js index 7aa1fdf954f99..4acb847d62b62 100644 --- a/services/travis/travis-build.service.js +++ b/services/travis/travis-build.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '..'; +import {BaseSvgScrapingService} from '../index.js'; const schema = Joi.object({ message: Joi.alternatives() diff --git a/services/travis/travis-php-version-redirect.service.js b/services/travis/travis-php-version-redirect.service.js index e24e659d908a8..3f292fbd9f3e0 100644 --- a/services/travis/travis-php-version-redirect.service.js +++ b/services/travis/travis-php-version-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; const ciRedirect = redirector({ category: 'platform-support', diff --git a/services/travis/travis-php-version.service.js b/services/travis/travis-php-version.service.js index 3f4c8a90367fb..e03fc9b578b0d 100644 --- a/services/travis/travis-php-version.service.js +++ b/services/travis/travis-php-version.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {minorVersion, versionReduction, getPhpReleases} from '../php-version.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const optionalNumberOrString = Joi.alternatives(Joi.string(), Joi.number()) const schema = Joi.object({ diff --git a/services/treeware/treeware-trees.service.js b/services/treeware/treeware-trees.service.js index 2f545b5c2b4f5..f5487f54c50a9 100644 --- a/services/treeware/treeware-trees.service.js +++ b/services/treeware/treeware-trees.service.js @@ -2,7 +2,7 @@ import crypto from 'crypto'; import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {floorCount} from '../color-formatters.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const apiSchema = Joi.object({ total: Joi.number().required(), diff --git a/services/twitch/twitch-base.js b/services/twitch/twitch-base.js index ebd21e4d89b12..b11a03ffb0157 100644 --- a/services/twitch/twitch-base.js +++ b/services/twitch/twitch-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const tokenSchema = Joi.object({ access_token: Joi.string().required(), diff --git a/services/twitter/twitter-redirect.service.js b/services/twitter/twitter-redirect.service.js index c6bee1c552c49..29b85ac1e796d 100644 --- a/services/twitter/twitter-redirect.service.js +++ b/services/twitter/twitter-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ redirector({ diff --git a/services/twitter/twitter.service.js b/services/twitter/twitter.service.js index 9118824067109..013a9f21b1fd1 100644 --- a/services/twitter/twitter.service.js +++ b/services/twitter/twitter.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {optionalUrl} from '../validators.js'; -import {BaseService, BaseJsonService, NotFound} from '..'; +import {BaseService, BaseJsonService, NotFound} from '../index.js'; const queryParamSchema = Joi.object({ url: optionalUrl.required(), diff --git a/services/ubuntu/ubuntu.service.js b/services/ubuntu/ubuntu.service.js index e76bbca51244c..7f85fbeeaf5d4 100644 --- a/services/ubuntu/ubuntu.service.js +++ b/services/ubuntu/ubuntu.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const schema = Joi.object({ entries: Joi.array() diff --git a/services/uptimerobot/uptimerobot-base.js b/services/uptimerobot/uptimerobot-base.js index ae19ff25a492f..eb972726a5903 100644 --- a/services/uptimerobot/uptimerobot-base.js +++ b/services/uptimerobot/uptimerobot-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, InvalidParameter, InvalidResponse} from '..'; +import {BaseJsonService, InvalidParameter, InvalidResponse} from '../index.js'; // https://uptimerobot.com/api // POST getMonitors diff --git a/services/vaadin-directory/vaadin-directory-base.js b/services/vaadin-directory/vaadin-directory-base.js index d93647eccdedb..26a58fe31d1a4 100644 --- a/services/vaadin-directory/vaadin-directory-base.js +++ b/services/vaadin-directory/vaadin-directory-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ ratingCount: nonNegativeInteger, diff --git a/services/validators.js b/services/validators.js index 580dd1aa31293..424c6d4593f35 100644 --- a/services/validators.js +++ b/services/validators.js @@ -1,24 +1,17 @@ -import {semver, semverRange} from 'joi-extension-semver'; -const Joi = require('joi').extend(semver).extend(semverRange) +import {semver as joiSemver, semverRange as joiSemverRange} from 'joi-extension-semver'; +import joi from 'joi' +const Joi = joi.extend(joiSemver).extend(joiSemverRange) const optionalNonNegativeInteger = Joi.number().integer().min(0) -export { - optionalNonNegativeInteger, - - nonNegativeInteger: optionalNonNegativeInteger.required(), - - anyInteger: Joi.number().integer().required(), - - semver: Joi.semver().valid().required(), - - semverRange: Joi.semverRange().valid().required(), - - optionalDottedVersionNClausesWithOptionalSuffix: Joi.string().regex( +export { optionalNonNegativeInteger } +export const nonNegativeInteger = optionalNonNegativeInteger.required() +export const anyInteger = Joi.number().integer().required() +export const semver = Joi.semver().valid().required() +export const semverRange = Joi.semverRange().valid().required() +export const optionalDottedVersionNClausesWithOptionalSuffix = Joi.string().regex( /^\d+(\.\d+)*([-+].*)?$/ - ), - +) // TODO This accepts URLs with query strings and fragments, which for some // purposes should be rejected. - optionalUrl: Joi.string().uri({ scheme: ['http', 'https'] }), -}; +export const optionalUrl = Joi.string().uri({ scheme: ['http', 'https'] }) diff --git a/services/versioneye/versioneye.service.js b/services/versioneye/versioneye.service.js index 1ae838cd0186e..575c7925f9e98 100644 --- a/services/versioneye/versioneye.service.js +++ b/services/versioneye/versioneye.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ category: 'downloads', diff --git a/services/visual-studio-app-center/visual-studio-app-center-base.js b/services/visual-studio-app-center/visual-studio-app-center-base.js index 091c9d9613ec1..46132d1f9c67b 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-base.js +++ b/services/visual-studio-app-center/visual-studio-app-center-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const keywords = [ 'visual-studio', diff --git a/services/visual-studio-app-center/visual-studio-app-center-builds.service.js b/services/visual-studio-app-center/visual-studio-app-center-builds.service.js index b7f452774ece4..fcd9ba715d6b9 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-builds.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-builds.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; const schema = Joi.array().items({ diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-base.js b/services/visual-studio-marketplace/visual-studio-marketplace-base.js index 7d66defbef893..e07dd0d62b9f5 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-base.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import validate from '../../core/base-service/validate.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const extensionQuerySchema = Joi.object({ results: Joi.array() diff --git a/services/w3c/w3c-validation.service.js b/services/w3c/w3c-validation.service.js index f5dcb3c75070b..2b83604b40368 100644 --- a/services/w3c/w3c-validation.service.js +++ b/services/w3c/w3c-validation.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {optionalUrl} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {documentation, presetRegex, getColor, getMessage, getSchema} from './w3c-validation-helper.js'; const schema = Joi.object({ diff --git a/services/waffle/waffle-label-redirect.service.js b/services/waffle/waffle-label-redirect.service.js index fc8c0d16366b9..f857c77ee1c88 100644 --- a/services/waffle/waffle-label-redirect.service.js +++ b/services/waffle/waffle-label-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default [ // The WaffleLabel service originally had 'label' as an optional parameter diff --git a/services/waffle/waffle-label.service.js b/services/waffle/waffle-label.service.js index 19718dcbe6239..cb665ff3db25f 100644 --- a/services/waffle/waffle-label.service.js +++ b/services/waffle/waffle-label.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '..'; +import {deprecatedService} from '../index.js'; export default deprecatedService({ route: { diff --git a/services/website/website-redirect.service.js b/services/website/website-redirect.service.js index b43aae3bba3a1..3b0f21e338841 100644 --- a/services/website/website-redirect.service.js +++ b/services/website/website-redirect.service.js @@ -1,5 +1,5 @@ import {escapeFormat} from '../../core/badge-urls/path-helpers.js'; -import {redirector} from '..'; +import {redirector} from '../index.js'; function escapeFormatSlashes(t) { return escapeFormat(t) diff --git a/services/website/website.service.js b/services/website/website.service.js index 4ea20bc26079b..7e1c61a1d4e65 100644 --- a/services/website/website.service.js +++ b/services/website/website.service.js @@ -2,7 +2,7 @@ import Joi from 'joi'; import emojic from 'emojic'; import {optionalUrl} from '../validators.js'; import {queryParamSchema, exampleQueryParams, renderWebsiteStatus} from '../website-status.js'; -import {BaseService} from '..'; +import {BaseService} from '../index.js'; import trace from '../../core/base-service/trace.js'; const documentation = ` diff --git a/services/wercker/wercker.service.js b/services/wercker/wercker.service.js index 0ffe42d732860..d9523e34a1b79 100644 --- a/services/wercker/wercker.service.js +++ b/services/wercker/wercker.service.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const werckerSchema = Joi.array() .items( diff --git a/services/wheelmap/wheelmap.service.js b/services/wheelmap/wheelmap.service.js index 43f2e4f6b2a0b..c739a768af6d1 100644 --- a/services/wheelmap/wheelmap.service.js +++ b/services/wheelmap/wheelmap.service.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService} from '..'; +import {BaseJsonService} from '../index.js'; const schema = Joi.object({ node: Joi.object({ diff --git a/services/wordpress/wordpress-base.js b/services/wordpress/wordpress-base.js index f807879402d15..2cf4c55c93e46 100644 --- a/services/wordpress/wordpress-base.js +++ b/services/wordpress/wordpress-base.js @@ -1,6 +1,6 @@ import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; const stringOrFalse = Joi.alternatives(Joi.string(), Joi.bool()) diff --git a/services/wordpress/wordpress-downloads.service.js b/services/wordpress/wordpress-downloads.service.js index d227a69fba66e..ca33b07597dcd 100644 --- a/services/wordpress/wordpress-downloads.service.js +++ b/services/wordpress/wordpress-downloads.service.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {metric} from '../text-formatters.js'; import {downloadCount} from '../color-formatters.js'; -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import BaseWordpress from './wordpress-base.js'; const dateSchema = Joi.object() diff --git a/services/wordpress/wordpress-last-update.service.js b/services/wordpress/wordpress-last-update.service.js index 9a987e178f838..e73e58b5335b1 100644 --- a/services/wordpress/wordpress-last-update.service.js +++ b/services/wordpress/wordpress-last-update.service.js @@ -1,5 +1,5 @@ import moment from 'moment'; -import {InvalidResponse} from '..'; +import {InvalidResponse} from '../index.js'; import {formatDate} from '../text-formatters.js'; import {age as ageColor} from '../color-formatters.js'; import BaseWordpress from './wordpress-base.js'; diff --git a/services/wordpress/wordpress-platform-redirect.service.js b/services/wordpress/wordpress-platform-redirect.service.js index 814e388459db5..414e88374e568 100644 --- a/services/wordpress/wordpress-platform-redirect.service.js +++ b/services/wordpress/wordpress-platform-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '..'; +import {redirector} from '../index.js'; export default redirector({ category: 'platform-support', diff --git a/services/wordpress/wordpress-platform.service.js b/services/wordpress/wordpress-platform.service.js index 00b19bd1cb00e..e81e2d723f741 100644 --- a/services/wordpress/wordpress-platform.service.js +++ b/services/wordpress/wordpress-platform.service.js @@ -1,4 +1,4 @@ -import {NotFound} from '..'; +import {NotFound} from '../index.js'; import {addv} from '../text-formatters.js'; import {version as versionColor} from '../color-formatters.js'; import BaseWordpress from './wordpress-base.js'; diff --git a/services/youtube/youtube-base.js b/services/youtube/youtube-base.js index 34115a2c4fcc0..1aa69759c2347 100644 --- a/services/youtube/youtube-base.js +++ b/services/youtube/youtube-base.js @@ -1,5 +1,5 @@ import Joi from 'joi'; -import {BaseJsonService, NotFound} from '..'; +import {BaseJsonService, NotFound} from '../index.js'; import {metric} from '../text-formatters.js'; import {nonNegativeInteger} from '../validators.js'; From 183d0e0882cf62b88a3346a1d1cf83971912bade Mon Sep 17 00:00:00 2001 From: PyvesB Date: Wed, 16 Jun 2021 08:15:48 +0100 Subject: [PATCH 10/46] Fix service test loading and running --- core/server/server.js | 4 ++-- core/service-test-runner/cli.js | 4 ++-- core/service-test-runner/create-service-tester.js | 4 ++-- core/service-test-runner/runner.js | 2 +- core/service-test-runner/service-tester.js | 8 ++++---- services/amo/amo-downloads.tester.js | 8 +++++--- services/amo/amo-rating.tester.js | 5 ++--- services/amo/amo-users.tester.js | 5 ++--- services/amo/amo-version.tester.js | 5 ++--- services/ansible/ansible-quality.tester.js | 5 ++--- services/ansible/ansible-role.tester.js | 10 ++++++---- services/apm/apm.tester.js | 7 ++++--- .../appveyor/appveyor-build-redirect.tester.js | 8 +++++--- services/appveyor/appveyor-build.tester.js | 5 ++--- services/appveyor/appveyor-job-build.tester.js | 5 ++--- services/appveyor/appveyor-tests.tester.js | 5 ++--- services/archlinux/archlinux.tester.js | 5 ++--- services/aur/aur.tester.js | 7 ++++--- .../azure-devops/azure-devops-build.tester.js | 5 ++--- .../azure-devops/azure-devops-coverage.tester.js | 5 ++--- .../azure-devops/azure-devops-release.tester.js | 5 ++--- .../azure-devops/azure-devops-tests.tester.js | 5 ++--- services/azure-devops/vso-redirect.tester.js | 7 ++++--- services/beerpay/beerpay.tester.js | 5 ++--- services/bintray/bintray.tester.js | 7 ++++--- services/bit/bit-components.tester.js | 5 ++--- services/bitbucket/bitbucket-issues.tester.js | 8 +++++--- services/bitbucket/bitbucket-pipelines.tester.js | 8 +++++--- .../bitbucket/bitbucket-pull-request.tester.js | 8 +++++--- services/bithound/bithound.tester.js | 7 ++++--- services/bitrise/bitrise.tester.js | 5 ++--- services/bountysource/bountysource.tester.js | 7 ++++--- services/bower/bower-license.tester.js | 5 ++--- services/bower/bower-version.tester.js | 8 +++++--- services/bstats/bstats-players.tester.js | 5 ++--- services/bstats/bstats-servers.tester.js | 5 ++--- services/bugzilla/bugzilla.tester.js | 5 ++--- services/buildkite/buildkite.tester.js | 5 ++--- services/bundlephobia/bundlephobia.tester.js | 5 ++--- services/cauditor/cauditor.tester.js | 7 ++++--- services/cdnjs/cdnjs.tester.js | 5 ++--- services/chocolatey/chocolatey.tester.js | 7 ++++--- .../chrome-web-store-price.tester.js | 5 ++--- .../chrome-web-store-rating.tester.js | 8 +++++--- .../chrome-web-store-users.tester.js | 8 +++++--- .../chrome-web-store-version.tester.js | 5 ++--- .../cii-best-practices.tester.js | 5 ++--- services/circleci/circleci.tester.js | 7 ++++--- services/cirrus/cirrus.tester.js | 5 ++--- services/clojars/clojars-downloads.tester.js | 5 ++--- services/clojars/clojars-version.tester.js | 8 +++++--- services/cocoapods/cocoapods-apps.tester.js | 8 +++++--- services/cocoapods/cocoapods-docs.tester.js | 5 ++--- services/cocoapods/cocoapods-downloads.tester.js | 8 +++++--- services/cocoapods/cocoapods-license.tester.js | 5 ++--- services/cocoapods/cocoapods-platform.tester.js | 5 ++--- services/cocoapods/cocoapods-version.tester.js | 5 ++--- services/codacy/codacy-coverage.tester.js | 5 ++--- services/codacy/codacy-grade.tester.js | 5 ++--- .../codeclimate-analysis-redirector.tester.js | 8 +++++--- .../codeclimate/codeclimate-analysis.tester.js | 5 ++--- .../codeclimate-coverage-redirector.tester.js | 8 +++++--- .../codeclimate/codeclimate-coverage.tester.js | 5 ++--- services/codecov/codecov-redirect.tester.js | 8 +++++--- services/codecov/codecov.tester.js | 5 ++--- services/codefactor/codefactor-grade.tester.js | 5 ++--- services/codeship/codeship.tester.js | 5 ++--- services/codetally/codetally.tester.js | 8 +++++--- services/conda/conda-downloads.tester.js | 5 ++--- services/conda/conda-license.tester.js | 5 ++--- services/conda/conda-platform.tester.js | 5 ++--- services/conda/conda-version.tester.js | 5 ++--- services/continuousphp/continuousphp.tester.js | 7 ++++--- services/cookbook/cookbook.tester.js | 5 ++--- services/coveralls/coveralls-redirector.tester.js | 8 +++++--- services/coveralls/coveralls.tester.js | 5 ++--- services/coverity/coverity-on-demand.tester.js | 8 +++++--- services/coverity/coverity-scan.tester.js | 5 ++--- services/cpan/cpan-license.tester.js | 5 ++--- services/cpan/cpan-version.tester.js | 5 ++--- services/cran/cran.tester.js | 7 ++++--- services/crates/crates-downloads.tester.js | 8 +++++--- services/crates/crates-license.tester.js | 8 +++++--- services/crates/crates-version.tester.js | 5 ++--- services/criterion/criterion.tester.js | 5 ++--- services/ctan/ctan.tester.js | 7 ++++--- services/date/date.tester.js | 7 ++++--- services/david/david.tester.js | 5 ++--- services/debian/debian.tester.js | 5 ++--- services/debug/debug.tester.js | 5 ++--- services/dependabot/dependabot.tester.js | 5 ++--- services/depfu/depfu.tester.js | 4 +--- services/discord/discord.tester.js | 5 ++--- services/discourse/discourse-redirect.tester.js | 8 +++++--- services/discourse/discourse.tester.js | 7 ++++--- services/dockbit/dockbit.tester.js | 7 ++++--- services/docker/docker-automated.tester.js | 5 ++--- services/docker/docker-build.tester.js | 8 ++------ services/docker/docker-cloud-automated.tester.js | 5 ++--- services/docker/docker-cloud-build.tester.js | 5 ++--- services/docker/docker-pulls.tester.js | 5 ++--- services/docker/docker-size.tester.js | 5 ++--- services/docker/docker-stars.tester.js | 5 ++--- services/docker/docker-version.tester.js | 15 +++++++-------- services/docsrs/docsrs.tester.js | 5 ++--- services/dotnetstatus/dotnetstatus.tester.js | 7 ++++--- services/drone/drone-build.tester.js | 5 ++--- services/dub/dub-download.tester.js | 5 ++--- services/dub/dub-license.tester.js | 5 ++--- services/dub/dub-version.tester.js | 5 ++--- services/dynamic/dynamic-json.tester.js | 5 ++--- services/dynamic/dynamic-response-fixtures.js | 6 ++---- services/dynamic/dynamic-xml.tester.js | 5 ++--- services/dynamic/dynamic-yaml.tester.js | 5 ++--- .../eclipse-marketplace-downloads.tester.js | 8 +++++--- .../eclipse-marketplace-favorites.tester.js | 5 ++--- .../eclipse-marketplace-license.tester.js | 5 ++--- .../eclipse-marketplace-update.tester.js | 5 ++--- .../eclipse-marketplace-version.tester.js | 5 ++--- services/ecologi/ecologi-carbon.tester.js | 5 ++--- services/ecologi/ecologi-trees.tester.js | 5 ++--- services/elm-package/elm-package.tester.js | 5 ++--- services/endpoint/endpoint-redirect.tester.js | 8 +++++--- services/endpoint/endpoint.tester.js | 5 ++--- services/f-droid/f-droid.tester.js | 7 ++++--- services/fedora/fedora.tester.js | 5 ++--- services/feedz/feedz.tester.js | 8 +++++--- services/flathub/flathub.tester.js | 5 ++--- services/gem/gem-downloads.tester.js | 5 ++--- services/gem/gem-owner.tester.js | 5 ++--- services/gem/gem-rank.tester.js | 5 ++--- services/gem/gem-version.tester.js | 5 ++--- services/gemnasium/gemnasium.tester.js | 7 ++++--- services/gerrit/gerrit.tester.js | 5 ++--- services/github/github-all-contributors.tester.js | 5 ++--- services/github/github-checks-status.tester.js | 5 ++--- services/github/github-code-size.tester.js | 5 ++--- services/github/github-commit-activity.tester.js | 5 ++--- services/github/github-commit-status.tester.js | 5 ++--- services/github/github-commits-since.tester.js | 5 ++--- services/github/github-contributors.tester.js | 5 ++--- services/github/github-deployments.tester.js | 5 ++--- .../github/github-directory-file-count.tester.js | 5 ++--- .../github/github-discussions-total.service.js | 2 +- .../github/github-discussions-total.tester.js | 5 ++--- services/github/github-downloads.tester.js | 5 ++--- services/github/github-followers.tester.js | 5 ++--- services/github/github-forks.tester.js | 5 ++--- services/github/github-go-mod.tester.js | 5 ++--- services/github/github-hacktoberfest.tester.js | 5 ++--- .../github/github-issue-detail-redirect.tester.js | 8 +++++--- services/github/github-issue-detail.tester.js | 5 ++--- services/github/github-issues-search.tester.js | 8 +++++--- services/github/github-issues.tester.js | 5 ++--- services/github/github-labels.tester.js | 5 ++--- services/github/github-language-count.tester.js | 5 ++--- services/github/github-last-commit.tester.js | 5 ++--- services/github/github-lerna-json.tester.js | 5 ++--- services/github/github-license.tester.js | 5 ++--- services/github/github-manifest.tester.js | 8 +++++--- services/github/github-milestone-detail.tester.js | 5 ++--- services/github/github-milestone.tester.js | 5 ++--- services/github/github-package-json.tester.js | 8 +++++--- services/github/github-pipenv.tester.js | 8 +++++--- .../github-pull-request-check-state.tester.js | 5 ++--- services/github/github-r-package.tester.js | 5 ++--- services/github/github-release-date.tester.js | 5 ++--- services/github/github-release.tester.js | 8 +++++--- services/github/github-repo-size.tester.js | 5 ++--- services/github/github-search.tester.js | 5 ++--- services/github/github-size.tester.js | 5 ++--- services/github/github-sponsors.tester.js | 8 +++++--- services/github/github-stars.tester.js | 5 ++--- services/github/github-tag.tester.js | 8 +++++--- services/github/github-top-language.tester.js | 5 ++--- services/github/github-total-star.tester.js | 5 ++--- services/github/github-watchers.tester.js | 5 ++--- services/github/github-workflow-status.tester.js | 5 ++--- services/gitlab/gitlab-coverage.tester.js | 5 ++--- services/gitlab/gitlab-pipeline-status.tester.js | 8 +++++--- services/gitter/gitter.tester.js | 5 ++--- services/gratipay/gratipay.tester.js | 7 ++++--- services/hackage/hackage-deps.tester.js | 5 ++--- services/hackage/hackage-version.tester.js | 5 ++--- services/hexpm/hexpm.tester.js | 4 +--- services/homebrew/homebrew-cask.tester.js | 5 ++--- services/homebrew/homebrew-downloads.tester.js | 5 ++--- services/homebrew/homebrew-version.tester.js | 5 ++--- services/hsts/hsts.tester.js | 5 ++--- services/imagelayers/imagelayers.tester.js | 7 ++++--- services/issuestats/issuestats.tester.js | 3 +-- services/itunes/itunes.tester.js | 5 ++--- services/jenkins/jenkins-build-redirect.tester.js | 8 +++++--- services/jenkins/jenkins-build.tester.js | 5 ++--- .../jenkins/jenkins-coverage-redirector.tester.js | 8 +++++--- services/jenkins/jenkins-coverage.tester.js | 5 ++--- .../jenkins/jenkins-plugin-installs.tester.js | 5 ++--- services/jenkins/jenkins-plugin-version.tester.js | 3 +-- .../jenkins/jenkins-tests-redirector.tester.js | 8 +++++--- services/jenkins/jenkins-tests.tester.js | 5 ++--- services/jetbrains/jetbrains-downloads.tester.js | 5 ++--- services/jetbrains/jetbrains-rating.tester.js | 5 ++--- services/jetbrains/jetbrains-version.tester.js | 5 ++--- services/jira/jira-issue-redirect.tester.js | 8 +++++--- services/jira/jira-issue.tester.js | 5 ++--- services/jira/jira-sprint-redirect.tester.js | 8 +++++--- services/jira/jira-sprint.tester.js | 5 ++--- services/jitpack/jitpack-downloads.tester.js | 8 +++++--- .../jitpack/jitpack-version-redirector.tester.js | 8 +++++--- services/jitpack/jitpack-version.tester.js | 5 ++--- services/jsdelivr/jsdelivr-hits-github.tester.js | 5 ++--- services/jsdelivr/jsdelivr-hits-npm.tester.js | 5 ++--- services/keybase/keybase-btc.tester.js | 5 ++--- services/keybase/keybase-pgp.tester.js | 5 ++--- services/keybase/keybase-xlm.tester.js | 5 ++--- services/keybase/keybase-zec.tester.js | 5 ++--- services/leanpub/leanpub-book-summary.tester.js | 8 +++++--- services/lgtm/lgtm-alerts.tester.js | 5 ++--- services/lgtm/lgtm-grade.tester.js | 5 ++--- services/lgtm/lgtm-redirector.tester.js | 8 +++++--- services/liberapay/liberapay-gives.tester.js | 5 ++--- services/liberapay/liberapay-goal.tester.js | 5 ++--- services/liberapay/liberapay-patrons.tester.js | 5 ++--- services/liberapay/liberapay-receives.tester.js | 5 ++--- .../librariesio-dependencies.tester.js | 8 +++++--- .../librariesio-dependent-repos.tester.js | 5 ++--- .../librariesio/librariesio-dependents.tester.js | 5 ++--- .../librariesio/librariesio-sourcerank.tester.js | 5 ++--- services/libscore/libscore.tester.js | 3 +-- services/localizely/localizely.tester.js | 5 ++--- services/luarocks/luarocks.tester.js | 5 ++--- services/magnumci/magnumci.tester.js | 3 +-- services/maintenance/maintenance.tester.js | 5 ++--- services/mastodon/mastodon-follow.tester.js | 5 ++--- services/matrix/matrix.tester.js | 5 ++--- services/maven-central/maven-central.tester.js | 5 ++--- .../maven-metadata-redirect.tester.js | 5 ++--- services/maven-metadata/maven-metadata.tester.js | 5 ++--- services/microbadger/microbadger-layers.tester.js | 5 ++--- services/microbadger/microbadger-size.tester.js | 5 ++--- .../mozilla-observatory.tester.js | 5 ++--- services/myget/myget.tester.js | 8 +++++--- services/netlify/netlify.tester.js | 5 ++--- services/nexus/nexus-redirect.tester.js | 8 +++++--- services/nexus/nexus.tester.js | 5 ++--- services/node/node-current.tester.js | 8 ++++---- services/node/node-lts.tester.js | 8 ++++---- services/nodeping/nodeping-status.tester.js | 5 ++--- services/nodeping/nodeping-uptime.tester.js | 5 ++--- services/npm/npm-collaborators.tester.js | 5 ++--- services/npm/npm-dependency-version.tester.js | 5 ++--- services/npm/npm-downloads.tester.js | 5 ++--- services/npm/npm-license.tester.js | 5 ++--- services/npm/npm-type-definitions.tester.js | 5 ++--- services/npm/npm-version.tester.js | 5 ++--- services/nsp/nsp.tester.js | 8 +++++--- services/nuget/nuget.tester.js | 4 +--- services/nycrc/nycrc.tester.js | 5 ++--- .../offset-earth-carbon-redirect.tester.js | 8 +++++--- .../offset-earth-trees-redirect.tester.js | 8 +++++--- services/open-vsx/open-vsx-downloads.tester.js | 5 ++--- services/open-vsx/open-vsx-rating.tester.js | 5 ++--- services/open-vsx/open-vsx-release-date.tester.js | 5 ++--- services/open-vsx/open-vsx-version.tester.js | 5 ++--- .../opencollective/opencollective-all.tester.js | 5 ++--- .../opencollective-backers.tester.js | 5 ++--- .../opencollective-by-tier.tester.js | 5 ++--- .../opencollective-sponsors.tester.js | 5 ++--- services/opm/opm-version.tester.js | 5 ++--- services/ore/ore-category.tester.js | 5 ++--- services/ore/ore-downloads.tester.js | 5 ++--- services/ore/ore-license.tester.js | 5 ++--- services/ore/ore-sponge-versions.tester.js | 8 ++++---- services/ore/ore-stars.tester.js | 5 ++--- services/ore/ore-version.tester.js | 5 ++--- services/osslifecycle/osslifecycle.tester.js | 7 ++++--- services/packagecontrol/packagecontrol.tester.js | 7 ++++--- services/packagist/packagist-downloads.tester.js | 5 ++--- services/packagist/packagist-license.tester.js | 5 ++--- .../packagist/packagist-php-version.tester.js | 5 ++--- services/packagist/packagist-stars.tester.js | 5 ++--- services/packagist/packagist-version.tester.js | 8 +++++--- services/php-eye/php-eye-hhvm.tester.js | 8 +++++--- services/php-eye/php-eye-php-version.tester.js | 8 +++++--- services/pingpong/pingpong-status.tester.js | 5 ++--- services/pingpong/pingpong-uptime.tester.js | 5 ++--- services/pkgreview/package-rating.tester.js | 5 ++--- services/poeditor/poeditor.tester.js | 5 ++--- .../powershellgallery/powershellgallery.tester.js | 3 +-- services/pub/pub.tester.js | 8 +++++--- .../puppetforge-module-downloads.tester.js | 5 ++--- .../puppetforge-module-endorsement.tester.js | 5 ++--- .../puppetforge-module-feedback.tester.js | 5 ++--- .../puppetforge-module-pdk-version.tester.js | 5 ++--- .../puppetforge-module-version.tester.js | 5 ++--- .../puppetforge-user-module-count.tester.js | 5 ++--- .../puppetforge-user-release-count.tester.js | 5 ++--- services/pypi/pypi-django-versions.tester.js | 5 ++--- services/pypi/pypi-downloads.tester.js | 5 ++--- services/pypi/pypi-format.tester.js | 5 ++--- services/pypi/pypi-implementation.tester.js | 5 ++--- services/pypi/pypi-license.tester.js | 5 ++--- services/pypi/pypi-python-versions.tester.js | 5 ++--- services/pypi/pypi-status.tester.js | 5 ++--- services/pypi/pypi-version.tester.js | 5 ++--- services/pypi/pypi-wheel.tester.js | 5 ++--- services/readthedocs/readthedocs.tester.js | 5 ++--- services/reddit/subreddit-subscribers.tester.js | 5 ++--- services/reddit/user-karma.tester.js | 5 ++--- services/redmine/redmine.tester.js | 7 ++++--- services/repology/repology-repositories.tester.js | 5 ++--- services/requires/requires.tester.js | 5 ++--- services/resharper/resharper.tester.js | 7 ++++--- services/response-fixtures.js | 9 +++------ services/reuse/reuse-compliance.tester.js | 5 ++--- services/scoop/scoop-version.tester.js | 7 ++++--- services/scrutinizer/scrutinizer-build.tester.js | 8 +++++--- .../scrutinizer/scrutinizer-coverage.tester.js | 8 +++++--- .../scrutinizer/scrutinizer-quality.tester.js | 8 +++++--- .../scrutinizer/scrutinizer-redirect.tester.js | 8 +++++--- .../security-headers/security-headers.tester.js | 5 ++--- services/shippable/shippable.tester.js | 8 +++++--- services/snap-ci/snap-ci.tester.js | 3 +-- services/snyk/snyk-vulnerability-github.tester.js | 5 ++--- services/snyk/snyk-vulnerability-npm.tester.js | 5 ++--- services/sonar/sonar-coverage.tester.js | 5 ++--- .../sonar/sonar-documented-api-density.tester.js | 5 ++--- services/sonar/sonar-fortify-rating.tester.js | 5 ++--- services/sonar/sonar-generic.tester.js | 5 ++--- services/sonar/sonar-quality-gate.tester.js | 5 ++--- services/sonar/sonar-redirector.tester.js | 8 +++++--- services/sonar/sonar-tech-debt.tester.js | 5 ++--- services/sonar/sonar-tests.tester.js | 8 +++++--- services/sonar/sonar-violations.tester.js | 5 ++--- .../sourceforge-open-tickets.tester.js | 5 ++--- services/sourceforge/sourceforge.tester.js | 5 ++--- services/sourcegraph/sourcegraph.tester.js | 5 ++--- services/spack/spack.tester.js | 5 ++--- services/spiget/spiget-download-size.tester.js | 5 ++--- services/spiget/spiget-downloads.tester.js | 5 ++--- services/spiget/spiget-latest-version.tester.js | 5 ++--- services/spiget/spiget-rating.tester.js | 5 ++--- services/spiget/spiget-tested-versions.tester.js | 5 ++--- .../stackexchange-monthlyquestions.tester.js | 5 ++--- .../stackexchange-reputation.tester.js | 5 ++--- .../stackexchange/stackexchange-taginfo.tester.js | 5 ++--- .../static-badge/query-string-static.tester.js | 5 ++--- services/static-badge/static-badge.tester.js | 5 ++--- services/steam/steam-workshop.tester.js | 3 +-- services/swagger/swagger-redirect.tester.js | 8 +++++--- services/swagger/swagger.tester.js | 5 ++--- services/symfony/sensiolabs-redirect.tester.js | 7 ++++--- services/symfony/symfony-insight-grade.tester.js | 5 ++--- services/symfony/symfony-insight-stars.tester.js | 5 ++--- .../symfony/symfony-insight-violations.tester.js | 5 ++--- .../teamcity/teamcity-build-redirect.tester.js | 8 +++++--- services/teamcity/teamcity-build.tester.js | 5 ++--- .../teamcity/teamcity-coverage-redirect.tester.js | 8 +++++--- services/teamcity/teamcity-coverage.tester.js | 5 ++--- services/testspace/testspace-test-count.tester.js | 5 ++--- .../testspace/testspace-test-pass-ratio.tester.js | 5 ++--- .../testspace/testspace-test-summary.tester.js | 5 ++--- services/tokei/tokei.tester.js | 3 +-- services/travis/travis-build.tester.js | 5 ++--- .../travis/travis-php-version-redirect.tester.js | 8 +++++--- services/travis/travis-php-version.tester.js | 5 ++--- services/treeware/treeware-trees.tester.js | 5 ++--- services/twitch/twitch.tester.js | 9 +++++---- services/twitter/twitter-redirect.tester.js | 8 +++++--- services/twitter/twitter.tester.js | 7 ++++--- services/ubuntu/ubuntu.tester.js | 5 ++--- services/uptimerobot/uptimerobot-ratio.tester.js | 5 ++--- services/uptimerobot/uptimerobot-status.tester.js | 5 ++--- .../vaadin-directory-rating-count.tester.js | 5 ++--- .../vaadin-directory-rating.tester.js | 5 ++--- .../vaadin-directory-release-date.tester.js | 5 ++--- .../vaadin-directory-status.tester.js | 5 ++--- .../vaadin-directory-version.tester.js | 5 ++--- services/versioneye/versioneye.tester.js | 3 +-- .../visual-studio-app-center-builds.tester.js | 5 ++--- ...studio-app-center-releases-osversion.tester.js | 5 ++--- ...sual-studio-app-center-releases-size.tester.js | 5 ++--- ...l-studio-app-center-releases-version.tester.js | 5 ++--- ...io-marketplace-azure-devops-installs.tester.js | 5 ++--- .../visual-studio-marketplace-downloads.tester.js | 5 ++--- ...sual-studio-marketplace-last-updated.tester.js | 5 ++--- .../visual-studio-marketplace-rating.tester.js | 5 ++--- ...sual-studio-marketplace-release-date.tester.js | 5 ++--- .../visual-studio-marketplace-version.tester.js | 5 ++--- services/w3c/w3c-validation.tester.js | 5 ++--- services/waffle/waffle-label-redirect.tester.js | 8 +++++--- services/waffle/waffle-label.tester.js | 8 +++++--- services/website/website-redirect.tester.js | 8 +++++--- services/website/website.tester.js | 5 ++--- services/wercker/wercker.tester.js | 5 ++--- services/wheelmap/wheelmap.tester.js | 7 +++---- services/wordpress/wordpress-downloads.tester.js | 3 +-- .../wordpress/wordpress-last-update.tester.js | 3 +-- .../wordpress-platform-redirect.tester.js | 5 ++--- services/wordpress/wordpress-platform.tester.js | 8 +++++--- services/wordpress/wordpress-rating.tester.js | 3 +-- services/wordpress/wordpress-version.tester.js | 7 ++++--- services/youtube/youtube-channel-views.tester.js | 7 +++---- services/youtube/youtube-comments.tester.js | 7 +++---- services/youtube/youtube-likes.tester.js | 7 +++---- services/youtube/youtube-subscribers.tester.js | 7 +++---- services/youtube/youtube-views.tester.js | 7 +++---- 407 files changed, 1081 insertions(+), 1226 deletions(-) diff --git a/core/server/server.js b/core/server/server.js index 8228b8c80db40..4ec75cb0b284c 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -11,7 +11,7 @@ import Camp from '@shields_io/camp'; import originalJoi from 'joi'; import makeBadge from '../../badge-maker/lib/make-badge.js'; import GithubConstellation from '../../services/github/github-constellation.js'; -import suggest from '../../services/suggest.js'; +import {setRoutes} from '../../services/suggest.js'; import {loadServiceClasses} from '../base-service/loader.js'; import {makeSend} from '../base-service/legacy-result-sender.js'; import {handleRequest} from '../base-service/legacy-request-handler.js'; @@ -459,7 +459,7 @@ class Server { } const { apiProvider: githubApiProvider } = this.githubConstellation - suggest.setRoutes(allowedOrigin, githubApiProvider, camp) + setRoutes(allowedOrigin, githubApiProvider, camp) this.registerErrorHandlers() this.registerRedirects() diff --git a/core/service-test-runner/cli.js b/core/service-test-runner/cli.js index 96b4e46e65bb2..6f6725c0ff4d4 100644 --- a/core/service-test-runner/cli.js +++ b/core/service-test-runner/cli.js @@ -60,7 +60,7 @@ import readAllStdinSync from 'read-all-stdin-sync'; import {createTestServer} from '../server/in-process-server-test-helpers.js'; import Runner from './runner.js'; -import('../unhandled-rejection.spec'); +import('../unhandled-rejection.spec.js'); const retry = {} retry.count = parseInt(process.env.RETRY_COUNT) || 0 @@ -79,7 +79,7 @@ if (process.env.TESTED_SERVER_URL) { }, }, }) - server.start() + await server.start() }) after('Shut down the server', async function () { if (server) { diff --git a/core/service-test-runner/create-service-tester.js b/core/service-test-runner/create-service-tester.js index 0b59ffcfcad7c..a6ce13bae14d3 100644 --- a/core/service-test-runner/create-service-tester.js +++ b/core/service-test-runner/create-service-tester.js @@ -18,9 +18,9 @@ import ServiceTester from './service-tester.js'; * @returns {module:core/service-test-runner/service-tester~ServiceTester} * ServiceTester instance */ -function createServiceTester() { +async function createServiceTester() { const servicePath = caller().replace('.tester.js', '.service.js') - const ServiceClass = require(servicePath) + const ServiceClass = Object.values(await import(servicePath))[0] if (!(ServiceClass.prototype instanceof BaseService)) { throw Error( `${servicePath} does not export a single service. Invoke new ServiceTester() directly.` diff --git a/core/service-test-runner/runner.js b/core/service-test-runner/runner.js index e50d195a9dcbb..f2afc1460e7a3 100644 --- a/core/service-test-runner/runner.js +++ b/core/service-test-runner/runner.js @@ -24,7 +24,7 @@ class Runner { * Prepare the runner by loading up all the ServiceTester objects. */ async prepare() { - this.testers = await loadTesters() + this.testers = (await loadTesters()).flatMap(testerModule => Object.values(testerModule)) this.testers.forEach(tester => { tester.beforeEach = () => { this.beforeEach() diff --git a/core/service-test-runner/service-tester.js b/core/service-test-runner/service-tester.js index fd8207546587a..410debc241268 100644 --- a/core/service-test-runner/service-tester.js +++ b/core/service-test-runner/service-tester.js @@ -4,10 +4,10 @@ import emojic from 'emojic'; import trace from '../base-service/trace.js'; -const frisby = require('./icedfrisby-shields')( - // eslint-disable-next-line import/order - require('icedfrisby-nock')(require('icedfrisby')) -) +import icedfrisbyShieldsModule from './icedfrisby-shields.js' +import icedfrisbyNockModule from 'icedfrisby-nock' +import icedfrisbyModule from 'icedfrisby' +const frisby = icedfrisbyShieldsModule(icedfrisbyNockModule(icedfrisbyModule)) /** * Encapsulate a suite of tests. Create new tests using create() and register diff --git a/services/amo/amo-downloads.tester.js b/services/amo/amo-downloads.tester.js index 377c34b6000de..f7147d4579da4 100644 --- a/services/amo/amo-downloads.tester.js +++ b/services/amo/amo-downloads.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'AmoDownloads', + title: 'AmoDownloads', + pathPrefix: '/amo', +}) t.create('Weekly Downloads') .get('/dw/duckduckgo-for-firefox.json') diff --git a/services/amo/amo-rating.tester.js b/services/amo/amo-rating.tester.js index 04e39629be28e..8a38d67fdb90c 100644 --- a/services/amo/amo-rating.tester.js +++ b/services/amo/amo-rating.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isStarRating} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Rating') .get('/rating/IndieGala-Helper.json') diff --git a/services/amo/amo-users.tester.js b/services/amo/amo-users.tester.js index 9807e5b107aa2..70d95207a538e 100644 --- a/services/amo/amo-users.tester.js +++ b/services/amo/amo-users.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Users') .get('/IndieGala-Helper.json') diff --git a/services/amo/amo-version.tester.js b/services/amo/amo-version.tester.js index 4ed9375411036..215a3d6ffea89 100644 --- a/services/amo/amo-version.tester.js +++ b/services/amo/amo-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Version').get('/IndieGala-Helper.json').expectBadge({ label: 'mozilla add-on', diff --git a/services/ansible/ansible-quality.tester.js b/services/ansible/ansible-quality.tester.js index e29aef04eea07..d7606a8a5881a 100644 --- a/services/ansible/ansible-quality.tester.js +++ b/services/ansible/ansible-quality.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('quality score (valid)') .get('/432.json') diff --git a/services/ansible/ansible-role.tester.js b/services/ansible/ansible-role.tester.js index b99133e6f150d..c9d72ee963d7f 100644 --- a/services/ansible/ansible-role.tester.js +++ b/services/ansible/ansible-role.tester.js @@ -1,9 +1,11 @@ -import {ServiceTester} from '../tester.js'; import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {ServiceTester} from '../tester.js' +export const t = new ServiceTester({ + id: 'AnsibleRole', + title: 'AnsibleRole', + pathPrefix: '/ansible/role', +}) t.create('role name (valid)') .get('/14542.json') diff --git a/services/apm/apm.tester.js b/services/apm/apm.tester.js index 222d2960f26fc..2ce60c8b30eec 100644 --- a/services/apm/apm.tester.js +++ b/services/apm/apm.tester.js @@ -2,9 +2,10 @@ import {ServiceTester} from '../tester.js'; import {invalidJSON} from '../response-fixtures.js'; import {isMetric, isVPlusTripleDottedVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'apm', + title: 'Atom Package Manager', +}) t.create('Downloads') .get('/dm/vim-mode.json') diff --git a/services/appveyor/appveyor-build-redirect.tester.js b/services/appveyor/appveyor-build-redirect.tester.js index 1040f6c9d907a..474822da9fca5 100644 --- a/services/appveyor/appveyor-build-redirect.tester.js +++ b/services/appveyor/appveyor-build-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'AppveyorBuildRedirect', + title: 'AppveyorBuildRedirect', + pathPrefix: '/appveyor/ci', +}) t.create('Appveyor CI') .get('/gruntjs/grunt', { diff --git a/services/appveyor/appveyor-build.tester.js b/services/appveyor/appveyor-build.tester.js index 93c360f21f200..6b491f96f1765 100644 --- a/services/appveyor/appveyor-build.tester.js +++ b/services/appveyor/appveyor-build.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('CI status') .timeout(10000) diff --git a/services/appveyor/appveyor-job-build.tester.js b/services/appveyor/appveyor-job-build.tester.js index 0cd4a2d3878e3..5bc2b52ec19ed 100644 --- a/services/appveyor/appveyor-job-build.tester.js +++ b/services/appveyor/appveyor-job-build.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Job CI status') .timeout(10000) diff --git a/services/appveyor/appveyor-tests.tester.js b/services/appveyor/appveyor-tests.tester.js index 7b9ce73b6da35..eaee7f907544c 100644 --- a/services/appveyor/appveyor-tests.tester.js +++ b/services/appveyor/appveyor-tests.tester.js @@ -1,8 +1,7 @@ import queryString from 'querystring'; import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isAppveyorTestTotals = Joi.string().regex( /^[0-9]+ passed(, [0-9]+ failed)?(, [0-9]+ skipped)?$/ diff --git a/services/archlinux/archlinux.tester.js b/services/archlinux/archlinux.tester.js index 4e735cbf4a721..15a0099afaafe 100644 --- a/services/archlinux/archlinux.tester.js +++ b/services/archlinux/archlinux.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Arch Linux package (valid)') .get('/core/x86_64/pacman.json') diff --git a/services/aur/aur.tester.js b/services/aur/aur.tester.js index a350fef687377..73332274bff26 100644 --- a/services/aur/aur.tester.js +++ b/services/aur/aur.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionNClausesWithOptionalSuffix, isMetric, isFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'aur', + title: 'Arch Linux AUR', +}) // version tests diff --git a/services/azure-devops/azure-devops-build.tester.js b/services/azure-devops/azure-devops-build.tester.js index 6ed60e2cac2b8..819b2e632a706 100644 --- a/services/azure-devops/azure-devops-build.tester.js +++ b/services/azure-devops/azure-devops-build.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project // solely created for Shields.io testing. diff --git a/services/azure-devops/azure-devops-coverage.tester.js b/services/azure-devops/azure-devops-coverage.tester.js index ddd7e5ac8ad18..d1c181cb756b7 100644 --- a/services/azure-devops/azure-devops-coverage.tester.js +++ b/services/azure-devops/azure-devops-coverage.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const org = 'swellaby' const project = 'opensource' diff --git a/services/azure-devops/azure-devops-release.tester.js b/services/azure-devops/azure-devops-release.tester.js index 1a85a4e11d720..bc577047d6c9c 100644 --- a/services/azure-devops/azure-devops-release.tester.js +++ b/services/azure-devops/azure-devops-release.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project // solely created for Shields.io testing. diff --git a/services/azure-devops/azure-devops-tests.tester.js b/services/azure-devops/azure-devops-tests.tester.js index daf75ac30801d..5b36fc968fc1e 100644 --- a/services/azure-devops/azure-devops-tests.tester.js +++ b/services/azure-devops/azure-devops-tests.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const org = 'azuredevops-powershell' const project = 'azuredevops-powershell' diff --git a/services/azure-devops/vso-redirect.tester.js b/services/azure-devops/vso-redirect.tester.js index ab27978851bcb..a42a75b861ed7 100644 --- a/services/azure-devops/vso-redirect.tester.js +++ b/services/azure-devops/vso-redirect.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'vso', + title: 'VSO', +}) t.create('Build: default branch') .get('/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.svg') diff --git a/services/beerpay/beerpay.tester.js b/services/beerpay/beerpay.tester.js index 5bb4a7296af73..1010f26a20552 100644 --- a/services/beerpay/beerpay.tester.js +++ b/services/beerpay/beerpay.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const amountOfMoney = withRegex(/^\$[0-9]+(\.[0-9]+)?/) diff --git a/services/bintray/bintray.tester.js b/services/bintray/bintray.tester.js index a63af17ce4f77..c93a2f8cefcea 100644 --- a/services/bintray/bintray.tester.js +++ b/services/bintray/bintray.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'bintray', + title: 'Bintray', +}) t.create('no longer available (previously downloads)') .get('/dt/asciidoctor/maven/asciidoctorj.json') diff --git a/services/bit/bit-components.tester.js b/services/bit/bit-components.tester.js index a7cca0a96b639..ac8cc82cc84c5 100644 --- a/services/bit/bit-components.tester.js +++ b/services/bit/bit-components.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; t.create('collection (valid)').get('/ramda/ramda.json').expectBadge({ diff --git a/services/bitbucket/bitbucket-issues.tester.js b/services/bitbucket/bitbucket-issues.tester.js index 28de6470fa56a..f4d9f01824e0b 100644 --- a/services/bitbucket/bitbucket-issues.tester.js +++ b/services/bitbucket/bitbucket-issues.tester.js @@ -1,9 +1,11 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isMetricOpenIssues} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'BitbucketIssues', + title: 'Bitbucket Issues', + pathPrefix: '/bitbucket', +}) t.create('issues-raw (valid)') .get('/issues-raw/atlassian/python-bitbucket.json') diff --git a/services/bitbucket/bitbucket-pipelines.tester.js b/services/bitbucket/bitbucket-pipelines.tester.js index e0e7ed5f36605..56b07053c639c 100644 --- a/services/bitbucket/bitbucket-pipelines.tester.js +++ b/services/bitbucket/bitbucket-pipelines.tester.js @@ -1,8 +1,10 @@ import {isBuildStatus} from '../build-status.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'BitbucketPipelines', + title: 'Bitbucket Pipelines', + pathPrefix: '/bitbucket/pipelines', +}) function bitbucketApiResponse(status) { return JSON.stringify({ diff --git a/services/bitbucket/bitbucket-pull-request.tester.js b/services/bitbucket/bitbucket-pull-request.tester.js index 7a0c29a207afb..b5fde795cefd6 100644 --- a/services/bitbucket/bitbucket-pull-request.tester.js +++ b/services/bitbucket/bitbucket-pull-request.tester.js @@ -1,9 +1,11 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isMetricOpenIssues} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'BitbucketPullRequest', + title: 'Bitbucket Pull Request', + pathPrefix: '/bitbucket', +}) t.create('pr-raw (valid)') .get('/pr-raw/atlassian/python-bitbucket.json') diff --git a/services/bithound/bithound.tester.js b/services/bithound/bithound.tester.js index af98510aa1496..41531ff39fc74 100644 --- a/services/bithound/bithound.tester.js +++ b/services/bithound/bithound.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'bithound', + title: 'BitHound', +}) t.create('no longer available (code)') .get('/code/github/rexxars/sse-channel.json') diff --git a/services/bitrise/bitrise.tester.js b/services/bitrise/bitrise.tester.js index 4210b0112d765..5df6deafd619d 100644 --- a/services/bitrise/bitrise.tester.js +++ b/services/bitrise/bitrise.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('deploy status') .get('/cde737473028420d.json?token=GCIdEzacE4GW32jLVrZb7A') diff --git a/services/bountysource/bountysource.tester.js b/services/bountysource/bountysource.tester.js index 7aaed4db024f6..1eaf2b42df877 100644 --- a/services/bountysource/bountysource.tester.js +++ b/services/bountysource/bountysource.tester.js @@ -1,9 +1,10 @@ import {isMetric} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'bountysource', + title: 'Bountysource', +}) t.create('bounties (valid)') .get('/team/mozilla-core/activity.json') diff --git a/services/bower/bower-license.tester.js b/services/bower/bower-license.tester.js index 4b0564c37c993..10ddaf8b7e178 100644 --- a/services/bower/bower-license.tester.js +++ b/services/bower/bower-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('licence') .timeout(10000) diff --git a/services/bower/bower-version.tester.js b/services/bower/bower-version.tester.js index d81ab3043f620..0648198205da2 100644 --- a/services/bower/bower-version.tester.js +++ b/services/bower/bower-version.tester.js @@ -1,9 +1,11 @@ import Joi from 'joi'; import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'BowerVersion', + title: 'Bower Version', + pathPrefix: '/bower', +}) const isBowerPrereleaseVersion = Joi.string().regex( /^v\d+(\.\d+)?(\.\d+)?(-?[.\w\d])+?$/ diff --git a/services/bstats/bstats-players.tester.js b/services/bstats/bstats-players.tester.js index 9c6977db00181..6c91419c94ddf 100644 --- a/services/bstats/bstats-players.tester.js +++ b/services/bstats/bstats-players.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Players').get('/1.json').expectBadge({ label: 'players', diff --git a/services/bstats/bstats-servers.tester.js b/services/bstats/bstats-servers.tester.js index 18d4200677184..cf87b30ae9757 100644 --- a/services/bstats/bstats-servers.tester.js +++ b/services/bstats/bstats-servers.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Servers').get('/1.json').expectBadge({ label: 'servers', diff --git a/services/bugzilla/bugzilla.tester.js b/services/bugzilla/bugzilla.tester.js index 6ff8900cf95f9..507fd16c8e01a 100644 --- a/services/bugzilla/bugzilla.tester.js +++ b/services/bugzilla/bugzilla.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const bzBugStatus = Joi.equal( 'unconfirmed', diff --git a/services/buildkite/buildkite.tester.js b/services/buildkite/buildkite.tester.js index 0387ef769ac2b..02f457bebe3a0 100644 --- a/services/buildkite/buildkite.tester.js +++ b/services/buildkite/buildkite.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('buildkite invalid pipeline') .get('/unknown-identifier/unknown-branch.json') diff --git a/services/bundlephobia/bundlephobia.tester.js b/services/bundlephobia/bundlephobia.tester.js index 1484960165b26..95222627a95d1 100644 --- a/services/bundlephobia/bundlephobia.tester.js +++ b/services/bundlephobia/bundlephobia.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const formats = { A: '/bundlephobia/:type/:package.:format', diff --git a/services/cauditor/cauditor.tester.js b/services/cauditor/cauditor.tester.js index f3ba1bc79be87..75a5768faae38 100644 --- a/services/cauditor/cauditor.tester.js +++ b/services/cauditor/cauditor.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'cauditor', + title: 'Cauditor', +}) t.create('no longer available') .get('/mi/matthiasmullie/scrapbook/master.json') diff --git a/services/cdnjs/cdnjs.tester.js b/services/cdnjs/cdnjs.tester.js index 6d2ceb50698a0..8c113be24e0d4 100644 --- a/services/cdnjs/cdnjs.tester.js +++ b/services/cdnjs/cdnjs.tester.js @@ -1,7 +1,6 @@ import {isVPlusTripleDottedVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('cdnjs (valid)').get('/jquery.json').expectBadge({ label: 'cdnjs', diff --git a/services/chocolatey/chocolatey.tester.js b/services/chocolatey/chocolatey.tester.js index 6f0ad42797f6c..e185869640943 100644 --- a/services/chocolatey/chocolatey.tester.js +++ b/services/chocolatey/chocolatey.tester.js @@ -1,9 +1,10 @@ import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'chocolatey', + title: 'Chocolatey', +}) // downloads diff --git a/services/chrome-web-store/chrome-web-store-price.tester.js b/services/chrome-web-store/chrome-web-store-price.tester.js index c572b3e60ee44..7eacd88daa68f 100644 --- a/services/chrome-web-store/chrome-web-store-price.tester.js +++ b/services/chrome-web-store/chrome-web-store-price.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Price') .get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json') diff --git a/services/chrome-web-store/chrome-web-store-rating.tester.js b/services/chrome-web-store/chrome-web-store-rating.tester.js index ea42251e87656..6c32e2eb2775d 100644 --- a/services/chrome-web-store/chrome-web-store-rating.tester.js +++ b/services/chrome-web-store/chrome-web-store-rating.tester.js @@ -2,9 +2,11 @@ import Joi from 'joi'; import {isStarRating} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ChromeWebStoreRating', + title: 'Chrome Web Store Rating', + pathPrefix: '/chrome-web-store', +}) t.create('Rating') .get('/rating/alhjnofcnnpeaphgeakdhkebafjcpeae.json') diff --git a/services/chrome-web-store/chrome-web-store-users.tester.js b/services/chrome-web-store/chrome-web-store-users.tester.js index 1b89a40e2fd9c..e27644a4752c8 100644 --- a/services/chrome-web-store/chrome-web-store-users.tester.js +++ b/services/chrome-web-store/chrome-web-store-users.tester.js @@ -1,9 +1,11 @@ import {isMetric} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ChromeWebStoreUsers', + title: 'Chrome Web Store Users', + pathPrefix: '/chrome-web-store', +}) t.create('Downloads (redirect)') .get('/d/alhjnofcnnpeaphgeakdhkebafjcpeae.svg') diff --git a/services/chrome-web-store/chrome-web-store-version.tester.js b/services/chrome-web-store/chrome-web-store-version.tester.js index 209017b220cc2..fa688e4f41d78 100644 --- a/services/chrome-web-store/chrome-web-store-version.tester.js +++ b/services/chrome-web-store/chrome-web-store-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Version').get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json').expectBadge({ label: 'chrome web store', diff --git a/services/cii-best-practices/cii-best-practices.tester.js b/services/cii-best-practices/cii-best-practices.tester.js index 7f5b2b86c868e..8de52d01a16b3 100644 --- a/services/cii-best-practices/cii-best-practices.tester.js +++ b/services/cii-best-practices/cii-best-practices.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('level known project') .get(`/level/1.json`) diff --git a/services/circleci/circleci.tester.js b/services/circleci/circleci.tester.js index 84403091ba0fc..014d186361a9a 100644 --- a/services/circleci/circleci.tester.js +++ b/services/circleci/circleci.tester.js @@ -1,9 +1,10 @@ import {isBuildStatus} from '../build-status.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'circleci', + title: 'Circle CI', +}) t.create('circle ci (valid, without branch)') .get('/build/gh/RedSparr0w/node-csgo-parser.json') diff --git a/services/cirrus/cirrus.tester.js b/services/cirrus/cirrus.tester.js index bc54ab6637bc8..d867aab8d7ae8 100644 --- a/services/cirrus/cirrus.tester.js +++ b/services/cirrus/cirrus.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('cirrus bad repo') .get('/github/unknown-identifier/unknown-repo.json') diff --git a/services/clojars/clojars-downloads.tester.js b/services/clojars/clojars-downloads.tester.js index bef2f7aedbae3..e2125b596a6a8 100644 --- a/services/clojars/clojars-downloads.tester.js +++ b/services/clojars/clojars-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('clojars downloads (valid)').get('/prismic.json').expectBadge({ label: 'downloads', diff --git a/services/clojars/clojars-version.tester.js b/services/clojars/clojars-version.tester.js index dfcec0fa2a426..6cd3b3d3d29d6 100644 --- a/services/clojars/clojars-version.tester.js +++ b/services/clojars/clojars-version.tester.js @@ -1,7 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ClojarsVersion', + title: 'Clojars Version', + pathPrefix: '/clojars', +}) t.create('clojars version (valid)') .get('/v/prismic.json') diff --git a/services/cocoapods/cocoapods-apps.tester.js b/services/cocoapods/cocoapods-apps.tester.js index 8ad801f680d0c..0fb4e0edef241 100644 --- a/services/cocoapods/cocoapods-apps.tester.js +++ b/services/cocoapods/cocoapods-apps.tester.js @@ -1,7 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CocoapodsApps', + title: 'CocoapodsApps', + pathPrefix: '/cocoapods', +}) t.create('apps (valid, weekly)') .get('/aw/AFNetworking.json') diff --git a/services/cocoapods/cocoapods-docs.tester.js b/services/cocoapods/cocoapods-docs.tester.js index 5e93c2e8041d8..4c7315f5f593b 100644 --- a/services/cocoapods/cocoapods-docs.tester.js +++ b/services/cocoapods/cocoapods-docs.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('doc percent (valid)').get('/AFNetworking.json').expectBadge({ label: 'docs', diff --git a/services/cocoapods/cocoapods-downloads.tester.js b/services/cocoapods/cocoapods-downloads.tester.js index 6c35b1b3d317a..b6f81138a7a83 100644 --- a/services/cocoapods/cocoapods-downloads.tester.js +++ b/services/cocoapods/cocoapods-downloads.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CocoapodsDownloads', + title: 'CocoapodsDownloads', + pathPrefix: '/cocoapods', +}) t.create('downloads (valid, monthly)') .get('/dm/AFNetworking.json') diff --git a/services/cocoapods/cocoapods-license.tester.js b/services/cocoapods/cocoapods-license.tester.js index 197f8165f1917..c466bf9f8ffae 100644 --- a/services/cocoapods/cocoapods-license.tester.js +++ b/services/cocoapods/cocoapods-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license (valid)') .get('/AFNetworking.json') diff --git a/services/cocoapods/cocoapods-platform.tester.js b/services/cocoapods/cocoapods-platform.tester.js index 9a429c1eaba08..a67d8cf7588b1 100644 --- a/services/cocoapods/cocoapods-platform.tester.js +++ b/services/cocoapods/cocoapods-platform.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isPlatform = Joi.string().regex( /^(osx|ios|tvos|watchos)( \| (osx|ios|tvos|watchos))*$/ diff --git a/services/cocoapods/cocoapods-version.tester.js b/services/cocoapods/cocoapods-version.tester.js index 4a566afcdf428..a92fadc9d12c5 100644 --- a/services/cocoapods/cocoapods-version.tester.js +++ b/services/cocoapods/cocoapods-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version (valid)').get('/AFNetworking.json').expectBadge({ label: 'pod', diff --git a/services/codacy/codacy-coverage.tester.js b/services/codacy/codacy-coverage.tester.js index d549d8383a074..ab777a69119fc 100644 --- a/services/codacy/codacy-coverage.tester.js +++ b/services/codacy/codacy-coverage.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Coverage').get('/59d607d0e311408885e418004068ea58.json').expectBadge({ label: 'coverage', diff --git a/services/codacy/codacy-grade.tester.js b/services/codacy/codacy-grade.tester.js index a76c0fdf155c0..c690bce2d8145 100644 --- a/services/codacy/codacy-grade.tester.js +++ b/services/codacy/codacy-grade.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {codacyGrade} from './codacy-helpers.js'; t.create('Code quality') diff --git a/services/codeclimate/codeclimate-analysis-redirector.tester.js b/services/codeclimate/codeclimate-analysis-redirector.tester.js index c08fddafc0604..f142d787263d6 100644 --- a/services/codeclimate/codeclimate-analysis-redirector.tester.js +++ b/services/codeclimate/codeclimate-analysis-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CodeclimateCoverageRedirector', + title: 'Code Climate Coverage Redirector', + pathPrefix: '/codeclimate', +}) t.create('Maintainability letter alias') .get('/maintainability-letter/jekyll/jekyll.svg') diff --git a/services/codeclimate/codeclimate-analysis.tester.js b/services/codeclimate/codeclimate-analysis.tester.js index c212feb16c983..cf0951be5b866 100644 --- a/services/codeclimate/codeclimate-analysis.tester.js +++ b/services/codeclimate/codeclimate-analysis.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Examples for this service can be found through the explore page: // https://codeclimate.com/explore diff --git a/services/codeclimate/codeclimate-coverage-redirector.tester.js b/services/codeclimate/codeclimate-coverage-redirector.tester.js index 40c0ead67a3f0..1287af63667e0 100644 --- a/services/codeclimate/codeclimate-coverage-redirector.tester.js +++ b/services/codeclimate/codeclimate-coverage-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CodeclimateCoverageRedirector', + title: 'Code Climate Coverage Redirector', + pathPrefix: '/codeclimate', +}) t.create('Top-level coverage shortcut') .get('/jekyll/jekyll.svg') diff --git a/services/codeclimate/codeclimate-coverage.tester.js b/services/codeclimate/codeclimate-coverage.tester.js index 5891df2c6c4ef..e6727e70d292e 100644 --- a/services/codeclimate/codeclimate-coverage.tester.js +++ b/services/codeclimate/codeclimate-coverage.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Examples for this service can be found through the explore page: // https://codeclimate.com/explore diff --git a/services/codecov/codecov-redirect.tester.js b/services/codecov/codecov-redirect.tester.js index 9cdcdd0886d78..e0a8581136483 100644 --- a/services/codecov/codecov-redirect.tester.js +++ b/services/codecov/codecov-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CodecovTokenRedirect', + title: 'CodecovTokenRedirect', + pathPrefix: '/codecov', +}) t.create('codecov token') .get('/c/token/abc123def456/gh/codecov/private-example.svg') diff --git a/services/codecov/codecov.tester.js b/services/codecov/codecov.tester.js index 770e2b92d6003..c83ed61bb74ea 100644 --- a/services/codecov/codecov.tester.js +++ b/services/codecov/codecov.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets coverage status') .get('/github/codecov/example-python.json') diff --git a/services/codefactor/codefactor-grade.tester.js b/services/codefactor/codefactor-grade.tester.js index 8a322e26a7a46..567750f797e69 100644 --- a/services/codefactor/codefactor-grade.tester.js +++ b/services/codefactor/codefactor-grade.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isValidGrade} from './codefactor-helpers.js'; t.create('Grade').get('/github/google/guava.json').expectBadge({ diff --git a/services/codeship/codeship.tester.js b/services/codeship/codeship.tester.js index 61a847a95ca90..6d11f2f1180ce 100644 --- a/services/codeship/codeship.tester.js +++ b/services/codeship/codeship.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('codeship (valid, no branch)') .get('/d6c1ddd0-16a3-0132-5f85-2e35c05e22b1.json') diff --git a/services/codetally/codetally.tester.js b/services/codetally/codetally.tester.js index 1254e13b233b5..72d24da6b8b84 100644 --- a/services/codetally/codetally.tester.js +++ b/services/codetally/codetally.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'Codetally', + title: 'Codetally', + pathPrefix: '/codetally', +}) t.create('no longer available') .get('/triggerman722/colorstrap.json') diff --git a/services/conda/conda-downloads.tester.js b/services/conda/conda-downloads.tester.js index 73adcd17d02ad..2538fab194310 100644 --- a/services/conda/conda-downloads.tester.js +++ b/services/conda/conda-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('downloads').get('/d/conda-forge/zlib.json').expectBadge({ label: 'conda|downloads', diff --git a/services/conda/conda-license.tester.js b/services/conda/conda-license.tester.js index 7557fbb6c7e16..49833dc58d944 100644 --- a/services/conda/conda-license.tester.js +++ b/services/conda/conda-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license') .get('/l/conda-forge/setuptools.json') diff --git a/services/conda/conda-platform.tester.js b/services/conda/conda-platform.tester.js index bfd936a95aa34..973a5c100dcce 100644 --- a/services/conda/conda-platform.tester.js +++ b/services/conda/conda-platform.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; const isCondaPlatform = Joi.string().regex(/^\w+-[\w\d]+( \| \w+-[\w\d]+)*$/) -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('platform').get('/p/conda-forge/zlib.json').expectBadge({ label: 'conda|platform', diff --git a/services/conda/conda-version.tester.js b/services/conda/conda-version.tester.js index d7c2bf9bc4bbd..36d624807261b 100644 --- a/services/conda/conda-version.tester.js +++ b/services/conda/conda-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusTripleDottedVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version').get('/v/conda-forge/zlib.json').expectBadge({ label: 'conda|conda-forge', diff --git a/services/continuousphp/continuousphp.tester.js b/services/continuousphp/continuousphp.tester.js index e451e53dd23fa..259d9fce5e17e 100644 --- a/services/continuousphp/continuousphp.tester.js +++ b/services/continuousphp/continuousphp.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'continuousphp', + title: 'Continuousphp', +}) t.create('no longer available (previously build status on default branch)') .get('/git-hub/doctrine/dbal.json') diff --git a/services/cookbook/cookbook.tester.js b/services/cookbook/cookbook.tester.js index 620fbde0e13f3..987a7e4bd0e22 100644 --- a/services/cookbook/cookbook.tester.js +++ b/services/cookbook/cookbook.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version').get('/chef-sugar.json').expectBadge({ label: 'cookbook', diff --git a/services/coveralls/coveralls-redirector.tester.js b/services/coveralls/coveralls-redirector.tester.js index 81d5e0dc4d458..22948a59213f4 100644 --- a/services/coveralls/coveralls-redirector.tester.js +++ b/services/coveralls/coveralls-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CoverallsGitHubRedirect', + title: 'Coveralls GitHub Redirector', + pathPrefix: '/coveralls', +}) t.create('Coveralls VCS type missing') .get('/lemurheavy/coveralls-ruby.svg') diff --git a/services/coveralls/coveralls.tester.js b/services/coveralls/coveralls.tester.js index 9a626630a41ec..e5845db45e32b 100644 --- a/services/coveralls/coveralls.tester.js +++ b/services/coveralls/coveralls.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('github coverage') .get('/github/jekyll/jekyll.json') diff --git a/services/coverity/coverity-on-demand.tester.js b/services/coverity/coverity-on-demand.tester.js index 570b37c757d66..6e4ada15ce870 100644 --- a/services/coverity/coverity-on-demand.tester.js +++ b/services/coverity/coverity-on-demand.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'CoverityOnDemand', + title: 'Coverity On Demand', + pathPrefix: '/coverity/ondemand', +}) t.create('no longer available (streams)') .get('/streams/44b25sjc9l3ntc2ngfi29tngro.json') diff --git a/services/coverity/coverity-scan.tester.js b/services/coverity/coverity-scan.tester.js index ca5196ead50d4..0492338e2facf 100644 --- a/services/coverity/coverity-scan.tester.js +++ b/services/coverity/coverity-scan.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('known project id') .get('/3997.json') diff --git a/services/cpan/cpan-license.tester.js b/services/cpan/cpan-license.tester.js index c80135d892b78..0986d81c23107 100644 --- a/services/cpan/cpan-license.tester.js +++ b/services/cpan/cpan-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license (valid)').get('/Config-Augeas.json').expectBadge({ label: 'license', diff --git a/services/cpan/cpan-version.tester.js b/services/cpan/cpan-version.tester.js index 86a03251531b2..1d1f4b7fd5d63 100644 --- a/services/cpan/cpan-version.tester.js +++ b/services/cpan/cpan-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version (valid)').get('/Config-Augeas.json').expectBadge({ label: 'cpan', diff --git a/services/cran/cran.tester.js b/services/cran/cran.tester.js index 026c60e671b9f..01c4ebb5f0948 100644 --- a/services/cran/cran.tester.js +++ b/services/cran/cran.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isVPlusTripleDottedVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'cran', + title: 'CRAN/METACRAN', +}) t.create('version (valid)').get('/v/devtools.json').expectBadge({ label: 'cran', diff --git a/services/crates/crates-downloads.tester.js b/services/crates/crates-downloads.tester.js index 544b7391de17f..f451b4a5ad1e8 100644 --- a/services/crates/crates-downloads.tester.js +++ b/services/crates/crates-downloads.tester.js @@ -1,9 +1,11 @@ import {ServiceTester} from '../tester.js'; import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'crates', + title: 'crates.io', + pathPrefix: '/crates', +}) t.create('total downloads') .get('/d/libc.json') diff --git a/services/crates/crates-license.tester.js b/services/crates/crates-license.tester.js index c72a6880b46aa..7d8d459a297c7 100644 --- a/services/crates/crates-license.tester.js +++ b/services/crates/crates-license.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'crates', + title: 'crates.io', + pathPrefix: '/crates/l', +}) t.create('license') .get('/libc.json') diff --git a/services/crates/crates-version.tester.js b/services/crates/crates-version.tester.js index f8edbbcc81e45..fe31ab2401687 100644 --- a/services/crates/crates-version.tester.js +++ b/services/crates/crates-version.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version') .get('/libc.json') diff --git a/services/criterion/criterion.tester.js b/services/criterion/criterion.tester.js index a3d5890bcff98..a698aef879f74 100644 --- a/services/criterion/criterion.tester.js +++ b/services/criterion/criterion.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {IMPROVED_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS, NOT_FOUND_STATUS} from './constants.js'; const isStatus = Joi.string() diff --git a/services/ctan/ctan.tester.js b/services/ctan/ctan.tester.js index 126670d58f90b..15a3cc2b5a8f2 100644 --- a/services/ctan/ctan.tester.js +++ b/services/ctan/ctan.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ctan', + title: 'Comprehensive TEX Archive Network', +}) t.create('license').get('/l/novel.json').expectBadge({ label: 'license', diff --git a/services/date/date.tester.js b/services/date/date.tester.js index 5fb085f80cb9c..117ee7166c54b 100644 --- a/services/date/date.tester.js +++ b/services/date/date.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isRelativeFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'date', + title: 'Relative Date Tests', +}) t.create('Relative date') .get('/1540814400.json') diff --git a/services/david/david.tester.js b/services/david/david.tester.js index 56f05ff8619d9..dec9e5c49118b 100644 --- a/services/david/david.tester.js +++ b/services/david/david.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isDependencyStatus = Joi.string().valid( 'insecure', diff --git a/services/debian/debian.tester.js b/services/debian/debian.tester.js index bd5573f2dea6b..c03f2cd9b747d 100644 --- a/services/debian/debian.tester.js +++ b/services/debian/debian.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Debian package (default distribution, valid)') .get('/apt.json') diff --git a/services/debug/debug.tester.js b/services/debug/debug.tester.js index 3e6725a20d045..c6922666cbf93 100644 --- a/services/debug/debug.tester.js +++ b/services/debug/debug.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('start time') .get('/starttime.json') diff --git a/services/dependabot/dependabot.tester.js b/services/dependabot/dependabot.tester.js index 4f9a68c4bddee..b5bdc0dcdec56 100644 --- a/services/dependabot/dependabot.tester.js +++ b/services/dependabot/dependabot.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('semver stability (valid)').get('/bundler/puma.json').expectBadge({ label: 'semver stability', diff --git a/services/depfu/depfu.tester.js b/services/depfu/depfu.tester.js index 3b0044d4e1089..2aa1864b94d06 100644 --- a/services/depfu/depfu.tester.js +++ b/services/depfu/depfu.tester.js @@ -8,9 +8,7 @@ const isDependencyStatus = Joi.string().valid( 'stale' ) -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ id: 'depfu', title: 'Depfu' }) t.create('depfu dependencies (valid)') .get('/depfu/example-ruby.json') diff --git a/services/discord/discord.tester.js b/services/discord/discord.tester.js index 38283b7895077..4f701fa2f7a2b 100644 --- a/services/discord/discord.tester.js +++ b/services/discord/discord.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets status for Reactiflux') .get('/102860784329052160.json') diff --git a/services/discourse/discourse-redirect.tester.js b/services/discourse/discourse-redirect.tester.js index 1158c18682ba0..64cc98e888609 100644 --- a/services/discourse/discourse-redirect.tester.js +++ b/services/discourse/discourse-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'DiscourseRedirect', + title: 'DiscourseRedirect', + pathPrefix: '/discourse', +}) t.create('discourse status') .get('/https/meta.discourse.org/status.svg') diff --git a/services/discourse/discourse.tester.js b/services/discourse/discourse.tester.js index fda5c3655e993..281add0ad884f 100644 --- a/services/discourse/discourse.tester.js +++ b/services/discourse/discourse.tester.js @@ -1,9 +1,10 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'discourse', + title: 'Discourse', +}) const data = { topic_count: 22513, diff --git a/services/dockbit/dockbit.tester.js b/services/dockbit/dockbit.tester.js index 30fe285c90b0c..e6a1b307c1f6f 100644 --- a/services/dockbit/dockbit.tester.js +++ b/services/dockbit/dockbit.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'dockbit', + title: 'Dockbit', +}) t.create('no longer available (previously image size)') .get('/image-size/_/ubuntu/latest.json') diff --git a/services/docker/docker-automated.tester.js b/services/docker/docker-automated.tester.js index c8765ce0e4d82..f242fb923759a 100644 --- a/services/docker/docker-automated.tester.js +++ b/services/docker/docker-automated.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-build.tester.js b/services/docker/docker-build.tester.js index 8d4caa2f7c75d..7a685c485b342 100644 --- a/services/docker/docker-build.tester.js +++ b/services/docker/docker-build.tester.js @@ -1,14 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) - -const t = (module.exports = new ServiceTester({ +export const t = new ServiceTester({ id: 'dockerbuild', title: 'DockerBuild', pathPrefix: '/docker/build', -})) +}) t.create('no longer available').get('/jrottenberg/ffmpeg.json').expectBadge({ label: 'docker build', diff --git a/services/docker/docker-cloud-automated.tester.js b/services/docker/docker-cloud-automated.tester.js index 08c477edc3b71..c77d5fa27306c 100644 --- a/services/docker/docker-cloud-automated.tester.js +++ b/services/docker/docker-cloud-automated.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-cloud-build.tester.js b/services/docker/docker-cloud-build.tester.js index 82783d57f6278..95db5f8c88d1c 100644 --- a/services/docker/docker-cloud-build.tester.js +++ b/services/docker/docker-cloud-build.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; t.create('docker cloud build status (valid, user)') diff --git a/services/docker/docker-pulls.tester.js b/services/docker/docker-pulls.tester.js index 93d95b7baf543..ff6e867bf222f 100644 --- a/services/docker/docker-pulls.tester.js +++ b/services/docker/docker-pulls.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; t.create('docker pulls (valid, library)') diff --git a/services/docker/docker-size.tester.js b/services/docker/docker-size.tester.js index e948478941920..231781dc714ab 100644 --- a/services/docker/docker-size.tester.js +++ b/services/docker/docker-size.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('docker image size (valid, library)') .get('/_/alpine.json') diff --git a/services/docker/docker-stars.tester.js b/services/docker/docker-stars.tester.js index 2a892d6efed79..8c92998194e3d 100644 --- a/services/docker/docker-stars.tester.js +++ b/services/docker/docker-stars.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; t.create('docker stars (valid, library)') diff --git a/services/docker/docker-version.tester.js b/services/docker/docker-version.tester.js index cc233e90daf3d..f31467b0d8753 100644 --- a/services/docker/docker-version.tester.js +++ b/services/docker/docker-version.tester.js @@ -1,32 +1,31 @@ -import {isSemVer} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {isSemver} from '../test-validators.js'; +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('docker version (valid, library)').get('/_/alpine.json').expectBadge({ label: 'version', - message: isSemVer, + message: isSemver, }) t.create('docker version (valid, library with tag)') .get('/_/alpine/latest.json') .expectBadge({ label: 'version', - message: isSemVer, + message: isSemver, }) t.create('docker version (valid, user)') .get('/jrottenberg/ffmpeg.json') .expectBadge({ label: 'version', - message: isSemVer, + message: isSemver, }) t.create('docker version (valid, user with tag)') .get('/jrottenberg/ffmpeg/3.2-alpine.json') .expectBadge({ label: 'version', - message: isSemVer, + message: isSemver, }) t.create('docker version (invalid, incorrect tag)') diff --git a/services/docsrs/docsrs.tester.js b/services/docsrs/docsrs.tester.js index 9c8cce053174c..0fce39fdba917 100644 --- a/services/docsrs/docsrs.tester.js +++ b/services/docsrs/docsrs.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Passing docs') .get('/tokio/0.3.0.json') diff --git a/services/dotnetstatus/dotnetstatus.tester.js b/services/dotnetstatus/dotnetstatus.tester.js index 7a71278b79fa3..a290f8cc10012 100644 --- a/services/dotnetstatus/dotnetstatus.tester.js +++ b/services/dotnetstatus/dotnetstatus.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'dotnetstatus', + title: 'dotnet-status', +}) t.create('no longer available (previously get package status)') .get('/gh/jaredcnance/dotnet-status/API.json') diff --git a/services/drone/drone-build.tester.js b/services/drone/drone-build.tester.js index e77ecfbd08e99..f8ce864215471 100644 --- a/services/drone/drone-build.tester.js +++ b/services/drone/drone-build.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isDroneBuildStatus = Joi.alternatives().try( isBuildStatus, diff --git a/services/dub/dub-download.tester.js b/services/dub/dub-download.tester.js index d5af16449a867..f7f13b2a54582 100644 --- a/services/dub/dub-download.tester.js +++ b/services/dub/dub-download.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isDownloadsColor = Joi.equal( 'red', diff --git a/services/dub/dub-license.tester.js b/services/dub/dub-license.tester.js index cc2c9db2da3d0..77f7578f37d1e 100644 --- a/services/dub/dub-license.tester.js +++ b/services/dub/dub-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license (valid)') .get('/vibe-d.json') diff --git a/services/dub/dub-version.tester.js b/services/dub/dub-version.tester.js index 6cb040cf5d183..7032d5acc1624 100644 --- a/services/dub/dub-version.tester.js +++ b/services/dub/dub-version.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version (valid)') .get('/vibe-d.json') diff --git a/services/dynamic/dynamic-json.tester.js b/services/dynamic/dynamic-json.tester.js index 9d6984a770b5c..93a4a9e94a67c 100644 --- a/services/dynamic/dynamic-json.tester.js +++ b/services/dynamic/dynamic-json.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {expect} from 'chai'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('No URL specified') .get('.json?query=$.name&label=Package Name') diff --git a/services/dynamic/dynamic-response-fixtures.js b/services/dynamic/dynamic-response-fixtures.js index d9217106d6c03..774483608e89b 100644 --- a/services/dynamic/dynamic-response-fixtures.js +++ b/services/dynamic/dynamic-response-fixtures.js @@ -1,5 +1,4 @@ -export { - exampleXml: ` +export const exampleXml = ` Gambardella, Matthew @@ -119,5 +118,4 @@ export { environment. -`, -}; +` diff --git a/services/dynamic/dynamic-xml.tester.js b/services/dynamic/dynamic-xml.tester.js index bd3cd12fb07dd..c81e9b3521159 100644 --- a/services/dynamic/dynamic-xml.tester.js +++ b/services/dynamic/dynamic-xml.tester.js @@ -1,7 +1,6 @@ import queryString from 'query-string'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {exampleXml} from './dynamic-response-fixtures.js'; const exampleUrl = 'https://example.test/example.xml' diff --git a/services/dynamic/dynamic-yaml.tester.js b/services/dynamic/dynamic-yaml.tester.js index 2e3f418995d4f..24299a9273a60 100644 --- a/services/dynamic/dynamic-yaml.tester.js +++ b/services/dynamic/dynamic-yaml.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('No URL specified') .get('.json?query=$.name&label=Package Name') diff --git a/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js b/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js index ac19706fbe453..7ebcf5da9799d 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js @@ -1,9 +1,11 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'EclipseMarketplaceDownloads', + title: 'EclipseMarketplaceDownloads', + pathPrefix: '/eclipse-marketplace', +}) t.create('total marketplace downloads').get('/dt/notepad4e.json').expectBadge({ label: 'downloads', diff --git a/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js b/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js index d6e9dc1687497..bc96d9387fbdf 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('favorites count').get('/notepad4e.json').expectBadge({ label: 'favorites', diff --git a/services/eclipse-marketplace/eclipse-marketplace-license.tester.js b/services/eclipse-marketplace/eclipse-marketplace-license.tester.js index c8d05bd771abf..0fe3c29f5f337 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-license.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license').get('/notepad4e.json').expectBadge({ label: 'license', diff --git a/services/eclipse-marketplace/eclipse-marketplace-update.tester.js b/services/eclipse-marketplace/eclipse-marketplace-update.tester.js index bfb6a095fa6cb..7001997f2ebfe 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-update.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-update.tester.js @@ -1,7 +1,6 @@ import {isFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('last update date').get('/notepad4e.json').expectBadge({ label: 'updated', diff --git a/services/eclipse-marketplace/eclipse-marketplace-version.tester.js b/services/eclipse-marketplace/eclipse-marketplace-version.tester.js index 3d30a5a7d1613..20f171e420dfe 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-version.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('marketplace version').get('/notepad4e.json').expectBadge({ label: 'eclipse marketplace', diff --git a/services/ecologi/ecologi-carbon.tester.js b/services/ecologi/ecologi-carbon.tester.js index 67378dd294191..969775c3ee828 100644 --- a/services/ecologi/ecologi-carbon.tester.js +++ b/services/ecologi/ecologi-carbon.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; t.create('request for existing username') diff --git a/services/ecologi/ecologi-trees.tester.js b/services/ecologi/ecologi-trees.tester.js index c7bc9c82d5203..46807780159d3 100644 --- a/services/ecologi/ecologi-trees.tester.js +++ b/services/ecologi/ecologi-trees.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; t.create('request for existing username').get('/ecologi.json').expectBadge({ diff --git a/services/elm-package/elm-package.tester.js b/services/elm-package/elm-package.tester.js index 9deb2ce9c212d..afe06737a25ee 100644 --- a/services/elm-package/elm-package.tester.js +++ b/services/elm-package/elm-package.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the package version of elm/core') .get('/elm/core.json') diff --git a/services/endpoint/endpoint-redirect.tester.js b/services/endpoint/endpoint-redirect.tester.js index 7c8a3a5040a50..ed332eabacc11 100644 --- a/services/endpoint/endpoint-redirect.tester.js +++ b/services/endpoint/endpoint-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'EndpointRedirect', + title: 'EndpointRedirect', + pathPrefix: '/badge/endpoint', +}) t.create('Build: default branch') .get('.svg?url=https://example.com/badge.json') diff --git a/services/endpoint/endpoint.tester.js b/services/endpoint/endpoint.tester.js index 603f5fd63a4c1..d20280b8d377d 100644 --- a/services/endpoint/endpoint.tester.js +++ b/services/endpoint/endpoint.tester.js @@ -1,9 +1,8 @@ import zlib from 'zlib'; import {expect} from 'chai'; import {getShieldsIcon} from '../../lib/logos.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Valid schema') .get('.json?url=https://example.com/badge') diff --git a/services/f-droid/f-droid.tester.js b/services/f-droid/f-droid.tester.js index 6dbec075e6cdd..e7897b682b4d2 100644 --- a/services/f-droid/f-droid.tester.js +++ b/services/f-droid/f-droid.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'f-droid', + title: 'F-Droid', +}) const testPkg = 'org.fdroid.fdroid.privileged' const testJson = ` diff --git a/services/fedora/fedora.tester.js b/services/fedora/fedora.tester.js index 55189e7d2cf24..5dfa3d7b0844f 100644 --- a/services/fedora/fedora.tester.js +++ b/services/fedora/fedora.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Fedora package (default branch, valid)') .get('/rpm.json') diff --git a/services/feedz/feedz.tester.js b/services/feedz/feedz.tester.js index 4c00b5d9f1bd8..ddad129d3cce8 100644 --- a/services/feedz/feedz.tester.js +++ b/services/feedz/feedz.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'feedz', + title: 'Feedz', + pathPrefix: '', +}) // The `shieldstests/public` repo is specifically made for these tests. It contains following packages: // - Shields.NoV1: 0.1.0 diff --git a/services/flathub/flathub.tester.js b/services/flathub/flathub.tester.js index 8c82cd777d423..9da5c2ac2bbb0 100644 --- a/services/flathub/flathub.tester.js +++ b/services/flathub/flathub.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClauses} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Flathub (valid)').get('/org.mozilla.firefox.json').expectBadge({ label: 'flathub', diff --git a/services/gem/gem-downloads.tester.js b/services/gem/gem-downloads.tester.js index dbd7103e6c9b4..dc7439f72f62a 100644 --- a/services/gem/gem-downloads.tester.js +++ b/services/gem/gem-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('total downloads (valid)').get('/dt/rails.json').expectBadge({ label: 'downloads', diff --git a/services/gem/gem-owner.tester.js b/services/gem/gem-owner.tester.js index aed676036955d..d7a3f4da213fe 100644 --- a/services/gem/gem-owner.tester.js +++ b/services/gem/gem-owner.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('users (valid)') .get('/raphink.json') diff --git a/services/gem/gem-rank.tester.js b/services/gem/gem-rank.tester.js index 48ceb90a6f0f9..3d6afcf84fdd4 100644 --- a/services/gem/gem-rank.tester.js +++ b/services/gem/gem-rank.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isOrdinalNumber = Joi.string().regex(/^[1-9][0-9]+(ᵗʰ|ˢᵗ|ⁿᵈ|ʳᵈ)$/) const isOrdinalNumberDaily = Joi.string().regex( diff --git a/services/gem/gem-version.tester.js b/services/gem/gem-version.tester.js index a506ee2eb9807..609d07c076d70 100644 --- a/services/gem/gem-version.tester.js +++ b/services/gem/gem-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne, withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version (valid)').get('/formatador.json').expectBadge({ label: 'gem', diff --git a/services/gemnasium/gemnasium.tester.js b/services/gemnasium/gemnasium.tester.js index 94e57c6d123be..d2cf75d06ef37 100644 --- a/services/gemnasium/gemnasium.tester.js +++ b/services/gemnasium/gemnasium.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'gemnasium', + title: 'gemnasium', +}) t.create('no longer available (previously dependencies)') .get('/mathiasbynens/he.json') diff --git a/services/gerrit/gerrit.tester.js b/services/gerrit/gerrit.tester.js index dcd08a008a969..ed79cb9643129 100644 --- a/services/gerrit/gerrit.tester.js +++ b/services/gerrit/gerrit.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Change open since December 2010, hopefully won't get merged or abandoned anytime soon. t.create('Gerrit new change') diff --git a/services/github/github-all-contributors.tester.js b/services/github/github-all-contributors.tester.js index 3590adee04f67..c334fe6c2f9d3 100644 --- a/services/github/github-all-contributors.tester.js +++ b/services/github/github-all-contributors.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; t.create('all-contributors repo') diff --git a/services/github/github-checks-status.tester.js b/services/github/github-checks-status.tester.js index ab991a82bdf14..0c6fc4e2ceda2 100644 --- a/services/github/github-checks-status.tester.js +++ b/services/github/github-checks-status.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isBuildStatus} from '../build-status.js'; t.create('branch checks (branch)') diff --git a/services/github/github-code-size.tester.js b/services/github/github-code-size.tester.js index 5231247540c85..588eb80e9fc5f 100644 --- a/services/github/github-code-size.tester.js +++ b/services/github/github-code-size.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('code size in bytes for all languages') .get('/badges/shields.json') diff --git a/services/github/github-commit-activity.tester.js b/services/github/github-commit-activity.tester.js index 19bcffb305e15..38725875e9998 100644 --- a/services/github/github-commit-activity.tester.js +++ b/services/github/github-commit-activity.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isCommitActivity = Joi.alternatives().try( isMetricOverTimePeriod, diff --git a/services/github/github-commit-status.tester.js b/services/github/github-commit-status.tester.js index 89d246ccfea9b..df4ad36137f6b 100644 --- a/services/github/github-commit-status.tester.js +++ b/services/github/github-commit-status.tester.js @@ -1,7 +1,6 @@ import {invalidJSONString} from '../response-fixtures.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('commit status - commit in branch') .get('/badges/shields/master/5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c.json') diff --git a/services/github/github-commits-since.tester.js b/services/github/github-commits-since.tester.js index bd004319b40af..b74ff7a64cc7e 100644 --- a/services/github/github-commits-since.tester.js +++ b/services/github/github-commits-since.tester.js @@ -1,7 +1,6 @@ import {withRegex, isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isCommitsSince = withRegex(/^(commits since){1}[\s\S]+$/) diff --git a/services/github/github-contributors.tester.js b/services/github/github-contributors.tester.js index 685dbd755f39b..d563c52d3239b 100644 --- a/services/github/github-contributors.tester.js +++ b/services/github/github-contributors.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; t.create('Contributors').get('/contributors/badges/shields.json').expectBadge({ diff --git a/services/github/github-deployments.tester.js b/services/github/github-deployments.tester.js index b4b30e7c029ba..b9cf5d6ff3944 100644 --- a/services/github/github-deployments.tester.js +++ b/services/github/github-deployments.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const validMessages = [ 'success', diff --git a/services/github/github-directory-file-count.tester.js b/services/github/github-directory-file-count.tester.js index b9e6524b63317..8248648bd372d 100644 --- a/services/github/github-directory-file-count.tester.js +++ b/services/github/github-directory-file-count.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('directory file count').get('/badges/shields.json').expectBadge({ label: 'files', diff --git a/services/github/github-discussions-total.service.js b/services/github/github-discussions-total.service.js index c603e1e892ade..cc89cefc51342 100644 --- a/services/github/github-discussions-total.service.js +++ b/services/github/github-discussions-total.service.js @@ -1,4 +1,4 @@ -import {default as gql} from 'graphql-tag'; +import gql from 'graphql-tag'; import Joi from 'joi'; import {nonNegativeInteger} from '../validators.js'; import {GithubAuthV4Service} from './github-auth-service.js'; diff --git a/services/github/github-discussions-total.tester.js b/services/github/github-discussions-total.tester.js index a594ada567866..e73c64f3c3f35 100644 --- a/services/github/github-discussions-total.tester.js +++ b/services/github/github-discussions-total.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('GitHub Total Discussions (repo not found)') .get('/not-a-user/not-a-repo.json') diff --git a/services/github/github-downloads.tester.js b/services/github/github-downloads.tester.js index 25fb87c3bdbf7..22f2873785f8a 100644 --- a/services/github/github-downloads.tester.js +++ b/services/github/github-downloads.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const mockLatestRelease = release => nock => nock('https://api.github.com') diff --git a/services/github/github-followers.tester.js b/services/github/github-followers.tester.js index f7de0277596e2..ce5c9856d1ca4 100644 --- a/services/github/github-followers.tester.js +++ b/services/github/github-followers.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Followers').get('/webcaetano.json').expectBadge({ label: 'followers', diff --git a/services/github/github-forks.tester.js b/services/github/github-forks.tester.js index 56bac7426a2be..3f61e5d9bae24 100644 --- a/services/github/github-forks.tester.js +++ b/services/github/github-forks.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Forks') .get('/badges/shields.json') diff --git a/services/github/github-go-mod.tester.js b/services/github/github-go-mod.tester.js index 94adfff994a16..b055aad8d5b2d 100644 --- a/services/github/github-go-mod.tester.js +++ b/services/github/github-go-mod.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Go version').get('/gohugoio/hugo.json').expectBadge({ label: 'Go', diff --git a/services/github/github-hacktoberfest.tester.js b/services/github/github-hacktoberfest.tester.js index 9b3bcea694f42..99c861f7d0e75 100644 --- a/services/github/github-hacktoberfest.tester.js +++ b/services/github/github-hacktoberfest.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isHacktoberfestNoIssuesStatus = Joi.string().regex( /^[0-9]+ PRs?(, [0-9]+ days? left)?$/ diff --git a/services/github/github-issue-detail-redirect.tester.js b/services/github/github-issue-detail-redirect.tester.js index c7fb8124d3163..aa25d1c3ed3b5 100644 --- a/services/github/github-issue-detail-redirect.tester.js +++ b/services/github/github-issue-detail-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubIssueDetailRedirect', + title: 'GithubIssueDetailRedirect', + pathPrefix: '/github', +}) t.create('github issue detail (s shorthand)') .get('/issues/detail/s/badges/shields/979.svg') diff --git a/services/github/github-issue-detail.tester.js b/services/github/github-issue-detail.tester.js index 2dc23234d12cf..d023b254a2e72 100644 --- a/services/github/github-issue-detail.tester.js +++ b/services/github/github-issue-detail.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('github issue state') .get('/issues/detail/state/badges/shields/979.json') diff --git a/services/github/github-issues-search.tester.js b/services/github/github-issues-search.tester.js index a1531713fc815..f787d8abb717e 100644 --- a/services/github/github-issues-search.tester.js +++ b/services/github/github-issues-search.tester.js @@ -1,8 +1,10 @@ import {isMetric} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubIssuesSearch', + title: 'Github Issues Search', + pathPrefix: '/github', +}) t.create('GitHub issue search (valid query string)') .get( diff --git a/services/github/github-issues.tester.js b/services/github/github-issues.tester.js index db9d1886a1134..193c4127c08ea 100644 --- a/services/github/github-issues.tester.js +++ b/services/github/github-issues.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetric, isMetricOpenIssues} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('GitHub closed pull requests') .get('/issues-pr-closed/badges/shields.json') diff --git a/services/github/github-labels.tester.js b/services/github/github-labels.tester.js index e47fca24a2db3..1a1d6b6246fbd 100644 --- a/services/github/github-labels.tester.js +++ b/services/github/github-labels.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('labels').get('/badges/shields/bug.json').expectBadge({ message: 'bug', diff --git a/services/github/github-language-count.tester.js b/services/github/github-language-count.tester.js index cef49335100ab..2440aa1937506 100644 --- a/services/github/github-language-count.tester.js +++ b/services/github/github-language-count.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('language count').get('/badges/shields.json').expectBadge({ label: 'languages', diff --git a/services/github/github-last-commit.tester.js b/services/github/github-last-commit.tester.js index 516bac2fc1037..cadeff74c25e6 100644 --- a/services/github/github-last-commit.tester.js +++ b/services/github/github-last-commit.tester.js @@ -1,7 +1,6 @@ import {isFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('last commit (recent)') .get('/eslint/eslint.json') diff --git a/services/github/github-lerna-json.tester.js b/services/github/github-lerna-json.tester.js index 5768adafb0fe4..7e6478db8974b 100644 --- a/services/github/github-lerna-json.tester.js +++ b/services/github/github-lerna-json.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Lerna version').get('/facebook/jest.json').expectBadge({ label: 'lerna', diff --git a/services/github/github-license.tester.js b/services/github/github-license.tester.js index eca05279d32e3..40508f9c3928f 100644 --- a/services/github/github-license.tester.js +++ b/services/github/github-license.tester.js @@ -1,7 +1,6 @@ import {licenseToColor} from '../licenses.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const publicDomainLicenseColor = licenseToColor('CC0-1.0') const unknownLicenseColor = licenseToColor() diff --git a/services/github/github-manifest.tester.js b/services/github/github-manifest.tester.js index ecd397c6938a3..4dec6dd2c8edd 100644 --- a/services/github/github-manifest.tester.js +++ b/services/github/github-manifest.tester.js @@ -2,9 +2,11 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubManifest', + title: 'GithubManifest', + pathPrefix: '/github/manifest-json', +}) t.create('Manifest version') .get('/v/sindresorhus/show-all-github-issues.json') diff --git a/services/github/github-milestone-detail.tester.js b/services/github/github-milestone-detail.tester.js index bdd2e88cd29ea..24581d66a23e8 100644 --- a/services/github/github-milestone-detail.tester.js +++ b/services/github/github-milestone-detail.tester.js @@ -1,7 +1,6 @@ import {isMetric, isMetricOverMetric, isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Milestone Open Issues') .get('/issues-open/MacroPower/milestone-test/1.json') diff --git a/services/github/github-milestone.tester.js b/services/github/github-milestone.tester.js index 2c89773f265e0..a91bb820bf142 100644 --- a/services/github/github-milestone.tester.js +++ b/services/github/github-milestone.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('All Milestones') .get('/all/MacroPower/milestone-test.json') diff --git a/services/github/github-package-json.tester.js b/services/github/github-package-json.tester.js index 89976192ff273..0bfdb806decee 100644 --- a/services/github/github-package-json.tester.js +++ b/services/github/github-package-json.tester.js @@ -3,9 +3,11 @@ import {ServiceTester} from '../tester.js'; import {isSemver} from '../test-validators.js'; import {semverRange} from '../validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubPackageJson', + title: 'GithubPackageJson', + pathPrefix: '/github/package-json', +}) t.create('Package version').get('/v/badges/shields.json').expectBadge({ label: 'version', diff --git a/services/github/github-pipenv.tester.js b/services/github/github-pipenv.tester.js index ab3d897c26b71..584f101179ce9 100644 --- a/services/github/github-pipenv.tester.js +++ b/services/github/github-pipenv.tester.js @@ -6,9 +6,11 @@ import {isVPlusDottedVersionAtLeastOne, isVPlusDottedVersionNClausesWithOptional const isBlackVersion = Joi.string().regex(/^v\d+(\.\d+)*(.*)?$/) const isShortSha = Joi.string().regex(/[0-9a-f]{7}/) -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubPipenv', + title: 'GithubPipenv', + pathPrefix: '/github/pipenv', +}) t.create('Locked Python version') .get('/locked/python-version/metabolize/rq-dashboard-on-heroku.json') diff --git a/services/github/github-pull-request-check-state.tester.js b/services/github/github-pull-request-check-state.tester.js index 4ce5edd66c608..4ba9dc033dc1d 100644 --- a/services/github/github-pull-request-check-state.tester.js +++ b/services/github/github-pull-request-check-state.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('github pull request check state') .get('/s/pulls/badges/shields/1110.json') diff --git a/services/github/github-r-package.tester.js b/services/github/github-r-package.tester.js index 4009c65a96376..b8ef328f07d2c 100644 --- a/services/github/github-r-package.tester.js +++ b/services/github/github-r-package.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('R package version').get('/mixOmicsTeam/mixOmics.json').expectBadge({ label: 'R', diff --git a/services/github/github-release-date.tester.js b/services/github/github-release-date.tester.js index 7c83c8944f2e1..2c9443e6991d2 100644 --- a/services/github/github-release-date.tester.js +++ b/services/github/github-release-date.tester.js @@ -1,7 +1,6 @@ import {isFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Release Date. e.g release date|today') .get('/release-date/mochajs/mocha.json') diff --git a/services/github/github-release.tester.js b/services/github/github-release.tester.js index 943e2629841bd..ae255d17f17e1 100644 --- a/services/github/github-release.tester.js +++ b/services/github/github-release.tester.js @@ -2,9 +2,11 @@ import Joi from 'joi'; import {isSemver} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubRelease', + title: 'Github Release', + pathPrefix: '/github', +}) t.create('Release') .get('/v/release/expressjs/express.json') diff --git a/services/github/github-repo-size.tester.js b/services/github/github-repo-size.tester.js index da364e189d345..5be24a5b8072e 100644 --- a/services/github/github-repo-size.tester.js +++ b/services/github/github-repo-size.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('repository size').get('/badges/shields.json').expectBadge({ label: 'repo size', diff --git a/services/github/github-search.tester.js b/services/github/github-search.tester.js index 73b47ad1286d9..115d2885a5333 100644 --- a/services/github/github-search.tester.js +++ b/services/github/github-search.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('hit counter') .get('/badges/shields/async%20handle.json') diff --git a/services/github/github-size.tester.js b/services/github/github-size.tester.js index 20f5e463deeba..2625aac379d37 100644 --- a/services/github/github-size.tester.js +++ b/services/github/github-size.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('File size') .get('/webcaetano/craft/build/phaser-craft.min.js.json') diff --git a/services/github/github-sponsors.tester.js b/services/github/github-sponsors.tester.js index e5464b52c9065..d97dcccd09e2c 100644 --- a/services/github/github-sponsors.tester.js +++ b/services/github/github-sponsors.tester.js @@ -1,9 +1,11 @@ import {isMetric} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubSponsors', + title: 'Github Sponsors', + pathPrefix: '/github', +}) t.create('Sponsors').get('/sponsors/Homebrew.json').expectBadge({ label: 'sponsors', diff --git a/services/github/github-stars.tester.js b/services/github/github-stars.tester.js index e821445773365..bb957208e78f3 100644 --- a/services/github/github-stars.tester.js +++ b/services/github/github-stars.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Stars') .get('/badges/shields.json') diff --git a/services/github/github-tag.tester.js b/services/github/github-tag.tester.js index f9cbd2311374f..c98e32e00b019 100644 --- a/services/github/github-tag.tester.js +++ b/services/github/github-tag.tester.js @@ -2,9 +2,11 @@ import Joi from 'joi'; import {isSemver} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GithubTag', + title: 'Github Tag', + pathPrefix: '/github', +}) t.create('Tag') .get('/v/tag/expressjs/express.json') diff --git a/services/github/github-top-language.tester.js b/services/github/github-top-language.tester.js index 00fecd2bc0df8..ee20fbd97bfa4 100644 --- a/services/github/github-top-language.tester.js +++ b/services/github/github-top-language.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('top language') .get('/badges/shields.json') diff --git a/services/github/github-total-star.tester.js b/services/github/github-total-star.tester.js index 90134584eb0f4..1724c28bcc50a 100644 --- a/services/github/github-total-star.tester.js +++ b/services/github/github-total-star.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Stars (User)') .get('/hemantsonu20.json') diff --git a/services/github/github-watchers.tester.js b/services/github/github-watchers.tester.js index 2dd702cad9fe9..5a8de82291172 100644 --- a/services/github/github-watchers.tester.js +++ b/services/github/github-watchers.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Watchers') .get('/badges/shields.json') diff --git a/services/github/github-workflow-status.tester.js b/services/github/github-workflow-status.tester.js index 6eadf4ba26b9f..8594851a979fa 100644 --- a/services/github/github-workflow-status.tester.js +++ b/services/github/github-workflow-status.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isWorkflowStatus = Joi.alternatives() .try(isBuildStatus, Joi.equal('no status')) diff --git a/services/gitlab/gitlab-coverage.tester.js b/services/gitlab/gitlab-coverage.tester.js index 20c8a78728b0e..22d2b6d6e9145 100644 --- a/services/gitlab/gitlab-coverage.tester.js +++ b/services/gitlab/gitlab-coverage.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Coverage (branch)') .get('/gitlab-org/gitlab-runner/12-0-stable.json') diff --git a/services/gitlab/gitlab-pipeline-status.tester.js b/services/gitlab/gitlab-pipeline-status.tester.js index 9f8e63769bb87..293af5becd9b2 100644 --- a/services/gitlab/gitlab-pipeline-status.tester.js +++ b/services/gitlab/gitlab-pipeline-status.tester.js @@ -1,8 +1,10 @@ import {isBuildStatus} from '../build-status.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'GitlabPipeline', + title: 'Gitlab Pipeline', + pathPrefix: '/gitlab/pipeline', +}) t.create('Pipeline status').get('/gitlab-org/gitlab/v10.7.6.json').expectBadge({ label: 'build', diff --git a/services/gitter/gitter.tester.js b/services/gitter/gitter.tester.js index 96de64af17d34..16abaebf2765d 100644 --- a/services/gitter/gitter.tester.js +++ b/services/gitter/gitter.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('on gitter').get('/nwjs/nw.js.json').expectBadge({ label: 'chat', diff --git a/services/gratipay/gratipay.tester.js b/services/gratipay/gratipay.tester.js index 352883e215d7c..a41a387c1d694 100644 --- a/services/gratipay/gratipay.tester.js +++ b/services/gratipay/gratipay.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'gratipay', + title: 'Gratipay', +}) t.create('Receiving').get('/Gratipay.json').expectBadge({ label: 'gratipay', diff --git a/services/hackage/hackage-deps.tester.js b/services/hackage/hackage-deps.tester.js index 689c914934831..b40c95fe46356 100644 --- a/services/hackage/hackage-deps.tester.js +++ b/services/hackage/hackage-deps.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('hackage deps (valid)') .get('/lens.json') diff --git a/services/hackage/hackage-version.tester.js b/services/hackage/hackage-version.tester.js index 0c52ca0181a36..c97554e4dc0cb 100644 --- a/services/hackage/hackage-version.tester.js +++ b/services/hackage/hackage-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('hackage version (valid)').get('/lens.json').expectBadge({ label: 'hackage', diff --git a/services/hexpm/hexpm.tester.js b/services/hexpm/hexpm.tester.js index c2554e9d1778a..b37cf8f51b3bc 100644 --- a/services/hexpm/hexpm.tester.js +++ b/services/hexpm/hexpm.tester.js @@ -4,9 +4,7 @@ import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; const isHexpmVersion = Joi.string().regex(/^v\d+.\d+.?\d?$/) -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ id: 'hexpm', title: 'Hex.pm' }) t.create('downloads per week') .get('/dw/cowboy.json') diff --git a/services/homebrew/homebrew-cask.tester.js b/services/homebrew/homebrew-cask.tester.js index cf333131b0bd6..cf1a61996ccd3 100644 --- a/services/homebrew/homebrew-cask.tester.js +++ b/services/homebrew/homebrew-cask.tester.js @@ -1,7 +1,6 @@ import {isVPlusTripleDottedVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('homebrew cask (valid)').get('/iterm2.json').expectBadge({ label: 'homebrew cask', diff --git a/services/homebrew/homebrew-downloads.tester.js b/services/homebrew/homebrew-downloads.tester.js index 9cbd36a5d093d..9cac14c77a841 100644 --- a/services/homebrew/homebrew-downloads.tester.js +++ b/services/homebrew/homebrew-downloads.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetricOverTimePeriod} from '../test-validators.js'; t.create('daily downloads (valid)') diff --git a/services/homebrew/homebrew-version.tester.js b/services/homebrew/homebrew-version.tester.js index a99e5d6510b76..2b12d613fde1e 100644 --- a/services/homebrew/homebrew-version.tester.js +++ b/services/homebrew/homebrew-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusTripleDottedVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('homebrew (valid)').get('/cake.json').expectBadge({ label: 'homebrew', diff --git a/services/hsts/hsts.tester.js b/services/hsts/hsts.tester.js index 84bbc9bc09a5a..cce34f120a7c1 100644 --- a/services/hsts/hsts.tester.js +++ b/services/hsts/hsts.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const label = 'hsts preloaded' t.create('gets the hsts status of github').get('/github.com.json').expectBadge({ diff --git a/services/imagelayers/imagelayers.tester.js b/services/imagelayers/imagelayers.tester.js index 85df33175051c..34fd66b7d4eb7 100644 --- a/services/imagelayers/imagelayers.tester.js +++ b/services/imagelayers/imagelayers.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'imagelayers', + title: 'ImageLayers', +}) t.create('no longer available (previously image size)') .get('/image-size/_/ubuntu/latest.json') diff --git a/services/issuestats/issuestats.tester.js b/services/issuestats/issuestats.tester.js index 42b9ca280a757..362200550b68d 100644 --- a/services/issuestats/issuestats.tester.js +++ b/services/issuestats/issuestats.tester.js @@ -1,7 +1,6 @@ import {ServiceTester} from '../tester.js'; -const t = new ServiceTester({ id: 'issuestats', title: 'Issue Stats' }) -export default t; +export const t = new ServiceTester({ id: 'issuestats', title: 'Issue Stats' }) t.create('no longer available (previously issue analysis)') .get('/i/github/expressjs/express.json') diff --git a/services/itunes/itunes.tester.js b/services/itunes/itunes.tester.js index 1199b4406166a..d759bb385539f 100644 --- a/services/itunes/itunes.tester.js +++ b/services/itunes/itunes.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('iTunes version (valid)').get('/324684580.json').expectBadge({ label: 'itunes app store', diff --git a/services/jenkins/jenkins-build-redirect.tester.js b/services/jenkins/jenkins-build-redirect.tester.js index c0fba5e857990..3ab7f2d8e4c3c 100644 --- a/services/jenkins/jenkins-build-redirect.tester.js +++ b/services/jenkins/jenkins-build-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JenkinsBuildRedirect', + title: 'JenkinsBuildRedirect', + pathPrefix: '/', +}) t.create('old jenkins ci prefix + job url in path') .get('jenkins-ci/s/https/updates.jenkins-ci.org/job/foo.svg') diff --git a/services/jenkins/jenkins-build.tester.js b/services/jenkins/jenkins-build.tester.js index 2b5fab58ee97c..001a2c3a4e4ef 100644 --- a/services/jenkins/jenkins-build.tester.js +++ b/services/jenkins/jenkins-build.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isJenkinsBuildStatus = Joi.alternatives( isBuildStatus, diff --git a/services/jenkins/jenkins-coverage-redirector.tester.js b/services/jenkins/jenkins-coverage-redirector.tester.js index c042b6c249d00..f5a1d58219d7d 100644 --- a/services/jenkins/jenkins-coverage-redirector.tester.js +++ b/services/jenkins/jenkins-coverage-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JenkinsCoverageRedirector', + title: 'JenkinsCoverageRedirector', + pathPrefix: '/jenkins', +}) t.create('old Jacoco prefix + job url in path') .get( diff --git a/services/jenkins/jenkins-coverage.tester.js b/services/jenkins/jenkins-coverage.tester.js index 24a7491461423..56c021ec676a0 100644 --- a/services/jenkins/jenkins-coverage.tester.js +++ b/services/jenkins/jenkins-coverage.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // The below page includes links to various publicly accessible Jenkins instances // although many of the links are dead, it is is still a helpful resource for finding diff --git a/services/jenkins/jenkins-plugin-installs.tester.js b/services/jenkins/jenkins-plugin-installs.tester.js index b79c1b8af7c0d..0f43bb8e78084 100644 --- a/services/jenkins/jenkins-plugin-installs.tester.js +++ b/services/jenkins/jenkins-plugin-installs.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // total installs diff --git a/services/jenkins/jenkins-plugin-version.tester.js b/services/jenkins/jenkins-plugin-version.tester.js index fc6999af23b85..e700417b89e80 100644 --- a/services/jenkins/jenkins-plugin-version.tester.js +++ b/services/jenkins/jenkins-plugin-version.tester.js @@ -1,12 +1,11 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; -const t = new ServiceTester({ +export const t = new ServiceTester({ id: 'jenkins-plugin', title: 'JenkinsPluginVersion', pathPrefix: '/jenkins', }) -export default t; t.create('latest version') .get('/plugin/v/blueocean.json') diff --git a/services/jenkins/jenkins-tests-redirector.tester.js b/services/jenkins/jenkins-tests-redirector.tester.js index 56c0a571d6a6b..7939df6d9330e 100644 --- a/services/jenkins/jenkins-tests-redirector.tester.js +++ b/services/jenkins/jenkins-tests-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JenkinsTestsRedirector', + title: 'JenkinsTestsRedirector', + pathPrefix: '/jenkins', +}) t.create('old tests prefix + job url in path') .get( diff --git a/services/jenkins/jenkins-tests.tester.js b/services/jenkins/jenkins-tests.tester.js index 1043037ba3004..d576ef2f5f995 100644 --- a/services/jenkins/jenkins-tests.tester.js +++ b/services/jenkins/jenkins-tests.tester.js @@ -1,7 +1,6 @@ import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // The below page includes links to various publicly accessible Jenkins instances // although many of the links are dead, it is is still a helpful resource for finding diff --git a/services/jetbrains/jetbrains-downloads.tester.js b/services/jetbrains/jetbrains-downloads.tester.js index 40c56711a8f3e..86b49cfa2891c 100644 --- a/services/jetbrains/jetbrains-downloads.tester.js +++ b/services/jetbrains/jetbrains-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('downloads (number as a plugin id)') .get('/7495.json') diff --git a/services/jetbrains/jetbrains-rating.tester.js b/services/jetbrains/jetbrains-rating.tester.js index dac93aa9273c6..8913cc2988f28 100644 --- a/services/jetbrains/jetbrains-rating.tester.js +++ b/services/jetbrains/jetbrains-rating.tester.js @@ -1,7 +1,6 @@ import {withRegex, isStarRating} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isRating = withRegex(/^(([0-4](.?([0-9]))?)|5)\/5$/) diff --git a/services/jetbrains/jetbrains-version.tester.js b/services/jetbrains/jetbrains-version.tester.js index 60859c6a7cca8..ad3741af64ca0 100644 --- a/services/jetbrains/jetbrains-version.tester.js +++ b/services/jetbrains/jetbrains-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClauses} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version (user friendly plugin id)') .get('/1347-scala.json') diff --git a/services/jira/jira-issue-redirect.tester.js b/services/jira/jira-issue-redirect.tester.js index 6101fcc0731fc..983fbdab9043e 100644 --- a/services/jira/jira-issue-redirect.tester.js +++ b/services/jira/jira-issue-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JiraIssueRedirect', + title: 'JiraIssueRedirect', + pathPrefix: '/jira/issue', +}) t.create('jira issue') .get('/https/issues.apache.org/jira/kafka-2896.svg') diff --git a/services/jira/jira-issue.tester.js b/services/jira/jira-issue.tester.js index 45aae6952868d..551e05c2f8f03 100644 --- a/services/jira/jira-issue.tester.js +++ b/services/jira/jira-issue.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('unknown issue') .get('/notArealIssue-000.json?baseUrl=https://issues.apache.org/jira') diff --git a/services/jira/jira-sprint-redirect.tester.js b/services/jira/jira-sprint-redirect.tester.js index 58b5b5ffdc189..7610665e4d682 100644 --- a/services/jira/jira-sprint-redirect.tester.js +++ b/services/jira/jira-sprint-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JiraSprintRedirect', + title: 'JiraSprintRedirect', + pathPrefix: '/jira/sprint', +}) t.create('jira sprint') .get('/https/jira.spring.io/94.svg') diff --git a/services/jira/jira-sprint.tester.js b/services/jira/jira-sprint.tester.js index 367bdde25a9c4..d5eb14e4450cf 100644 --- a/services/jira/jira-sprint.tester.js +++ b/services/jira/jira-sprint.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; import {sprintId, sprintQueryString} from './jira-test-helpers.js'; diff --git a/services/jitpack/jitpack-downloads.tester.js b/services/jitpack/jitpack-downloads.tester.js index e403856d692c2..01efff3fabaef 100644 --- a/services/jitpack/jitpack-downloads.tester.js +++ b/services/jitpack/jitpack-downloads.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JitPackDownloads', + title: 'JitPackDownloads', + pathPrefix: '/jitpack', +}) t.create('no longer available (dw)') .get('/dw/github/jitpack/maven-simple.json') diff --git a/services/jitpack/jitpack-version-redirector.tester.js b/services/jitpack/jitpack-version-redirector.tester.js index c1fc3bcddbaac..bcab419915165 100644 --- a/services/jitpack/jitpack-version-redirector.tester.js +++ b/services/jitpack/jitpack-version-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'JitpackVersionRedirect', + title: 'JitpackVersionRedirect', + pathPrefix: '/jitpack/v', +}) t.create('jitpack version redirect') .get('/jitpack/maven-simple.svg') diff --git a/services/jitpack/jitpack-version.tester.js b/services/jitpack/jitpack-version.tester.js index 49c34eb61e76f..8ce17264baee6 100644 --- a/services/jitpack/jitpack-version.tester.js +++ b/services/jitpack/jitpack-version.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Github allows versions with chars, etc. const isAnyV = Joi.string().regex(/^v.+$/) diff --git a/services/jsdelivr/jsdelivr-hits-github.tester.js b/services/jsdelivr/jsdelivr-hits-github.tester.js index 22ef5cc32b71a..a81d8a66b4142 100644 --- a/services/jsdelivr/jsdelivr-hits-github.tester.js +++ b/services/jsdelivr/jsdelivr-hits-github.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isDownloadsOverTimePeriod = Joi.alternatives().try( isMetricOverTimePeriod, diff --git a/services/jsdelivr/jsdelivr-hits-npm.tester.js b/services/jsdelivr/jsdelivr-hits-npm.tester.js index f8ee94b8357c1..92bfb94a2df9a 100644 --- a/services/jsdelivr/jsdelivr-hits-npm.tester.js +++ b/services/jsdelivr/jsdelivr-hits-npm.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isDownloadsOverTimePeriod = Joi.alternatives().try( isMetricOverTimePeriod, diff --git a/services/keybase/keybase-btc.tester.js b/services/keybase/keybase-btc.tester.js index ed6c526fe8e59..9ba36a0ba2fe8 100644 --- a/services/keybase/keybase-btc.tester.js +++ b/services/keybase/keybase-btc.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('existing bitcoin address') .get('/skyplabs.json') diff --git a/services/keybase/keybase-pgp.tester.js b/services/keybase/keybase-pgp.tester.js index 3c43faa5b246d..d51bec66b7d53 100644 --- a/services/keybase/keybase-pgp.tester.js +++ b/services/keybase/keybase-pgp.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('existing key fingerprint') .get('/skyplabs.json') diff --git a/services/keybase/keybase-xlm.tester.js b/services/keybase/keybase-xlm.tester.js index bb5cfd2633d18..6ca00d3837657 100644 --- a/services/keybase/keybase-xlm.tester.js +++ b/services/keybase/keybase-xlm.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('existing stellar address') .get('/skyplabs.json') diff --git a/services/keybase/keybase-zec.tester.js b/services/keybase/keybase-zec.tester.js index 9e0351a518062..198ebc2c0d348 100644 --- a/services/keybase/keybase-zec.tester.js +++ b/services/keybase/keybase-zec.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('existing zcash address') .get('/skyplabs.json') diff --git a/services/leanpub/leanpub-book-summary.tester.js b/services/leanpub/leanpub-book-summary.tester.js index e1870ee2e05e2..e3ab0e65ce803 100644 --- a/services/leanpub/leanpub-book-summary.tester.js +++ b/services/leanpub/leanpub-book-summary.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'LeanPub', + title: 'LeanPub', + pathPrefix: '/leanpub/book', +}) t.create('no longer available (previously book pages)') .get('/pages/juice-shop.json') diff --git a/services/lgtm/lgtm-alerts.tester.js b/services/lgtm/lgtm-alerts.tester.js index 265887d416c9c..6d3f3ede0e42a 100644 --- a/services/lgtm/lgtm-alerts.tester.js +++ b/services/lgtm/lgtm-alerts.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {data} from './lgtm-test-helpers.js'; t.create('alerts: total alerts for a project') diff --git a/services/lgtm/lgtm-grade.tester.js b/services/lgtm/lgtm-grade.tester.js index 93343dcbe6e39..ffecd11cdaa4c 100644 --- a/services/lgtm/lgtm-grade.tester.js +++ b/services/lgtm/lgtm-grade.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {data} from './lgtm-test-helpers.js'; t.create('grade: missing project') diff --git a/services/lgtm/lgtm-redirector.tester.js b/services/lgtm/lgtm-redirector.tester.js index 3e5400bb2c7f7..5dcb4c4b6a197 100644 --- a/services/lgtm/lgtm-redirector.tester.js +++ b/services/lgtm/lgtm-redirector.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'LgtmRedirect', + title: 'LgtmRedirect', + pathPrefix: '/lgtm', +}) t.create('alerts') .get('/alerts/g/badges/shields.svg') diff --git a/services/liberapay/liberapay-gives.tester.js b/services/liberapay/liberapay-gives.tester.js index dd873657f6ab4..1ed18e900581e 100644 --- a/services/liberapay/liberapay-gives.tester.js +++ b/services/liberapay/liberapay-gives.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isCurrencyOverTime} from './liberapay-base.js'; t.create('Giving (valid)').get('/Changaco.json').expectBadge({ diff --git a/services/liberapay/liberapay-goal.tester.js b/services/liberapay/liberapay-goal.tester.js index 47b8f333a8693..522a57db0c072 100644 --- a/services/liberapay/liberapay-goal.tester.js +++ b/services/liberapay/liberapay-goal.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Goal Progress (valid)').get('/Liberapay.json').expectBadge({ label: 'goal progress', diff --git a/services/liberapay/liberapay-patrons.tester.js b/services/liberapay/liberapay-patrons.tester.js index 646019a7eab6e..8ec17eaeed8db 100644 --- a/services/liberapay/liberapay-patrons.tester.js +++ b/services/liberapay/liberapay-patrons.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Patrons (valid)').get('/Liberapay.json').expectBadge({ label: 'patrons', diff --git a/services/liberapay/liberapay-receives.tester.js b/services/liberapay/liberapay-receives.tester.js index b2cfb1eb227a6..c21b967f10e58 100644 --- a/services/liberapay/liberapay-receives.tester.js +++ b/services/liberapay/liberapay-receives.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isCurrencyOverTime} from './liberapay-base.js'; t.create('Receiving (valid)').get('/Changaco.json').expectBadge({ diff --git a/services/librariesio/librariesio-dependencies.tester.js b/services/librariesio/librariesio-dependencies.tester.js index c4d5eb02baa8d..0fa02a7a0f7a0 100644 --- a/services/librariesio/librariesio-dependencies.tester.js +++ b/services/librariesio/librariesio-dependencies.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isDependencyState} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'LibrariesIoDependencies', + title: 'LibrariesIoDependencies', + pathPrefix: '/librariesio', +}) t.create('dependencies for package (project name contains dot)') .timeout(10000) diff --git a/services/librariesio/librariesio-dependent-repos.tester.js b/services/librariesio/librariesio-dependent-repos.tester.js index 61e08195533e0..789b38c4230bf 100644 --- a/services/librariesio/librariesio-dependent-repos.tester.js +++ b/services/librariesio/librariesio-dependent-repos.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('dependent repo count') .timeout(10000) diff --git a/services/librariesio/librariesio-dependents.tester.js b/services/librariesio/librariesio-dependents.tester.js index 34729a06c23b3..f401b23a752c9 100644 --- a/services/librariesio/librariesio-dependents.tester.js +++ b/services/librariesio/librariesio-dependents.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('dependent count').timeout(10000).get('/npm/got.json').expectBadge({ label: 'dependents', diff --git a/services/librariesio/librariesio-sourcerank.tester.js b/services/librariesio/librariesio-sourcerank.tester.js index efe0d72a1c11e..988fe629a2a7f 100644 --- a/services/librariesio/librariesio-sourcerank.tester.js +++ b/services/librariesio/librariesio-sourcerank.tester.js @@ -1,7 +1,6 @@ import {anyInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('sourcerank').timeout(10000).get('/npm/got.json').expectBadge({ label: 'sourcerank', diff --git a/services/libscore/libscore.tester.js b/services/libscore/libscore.tester.js index fac80525912e9..31d5d0592b6eb 100644 --- a/services/libscore/libscore.tester.js +++ b/services/libscore/libscore.tester.js @@ -1,7 +1,6 @@ import {ServiceTester} from '../tester.js'; -const t = new ServiceTester({ id: 'libscore', title: 'libscore' }) -export default t; +export const t = new ServiceTester({ id: 'libscore', title: 'libscore' }) t.create('no longer available (previously usage statistics)') .get('/s/jQuery.json') diff --git a/services/localizely/localizely.tester.js b/services/localizely/localizely.tester.js index 385a000178424..4a72551149788 100644 --- a/services/localizely/localizely.tester.js +++ b/services/localizely/localizely.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; t.create('Overall progress') diff --git a/services/luarocks/luarocks.tester.js b/services/luarocks/luarocks.tester.js index 479bfe9b90463..e5ffcd690ff17 100644 --- a/services/luarocks/luarocks.tester.js +++ b/services/luarocks/luarocks.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isLuaVersion = Joi.string() .regex(/^v\d+\.\d+\.\d+-\d+$/) diff --git a/services/magnumci/magnumci.tester.js b/services/magnumci/magnumci.tester.js index 0da8de3546228..fef5c1a8d71ee 100644 --- a/services/magnumci/magnumci.tester.js +++ b/services/magnumci/magnumci.tester.js @@ -1,7 +1,6 @@ import {ServiceTester} from '../tester.js'; -const t = new ServiceTester({ id: 'magnumci', title: 'Magnum CI' }) -export default t; +export const t = new ServiceTester({ id: 'magnumci', title: 'Magnum CI' }) t.create('no longer available') .get('/ci/96ffb83fa700f069024921b0702e76ff.json') diff --git a/services/maintenance/maintenance.tester.js b/services/maintenance/maintenance.tester.js index 7a3fc81510b88..2e68f673566f0 100644 --- a/services/maintenance/maintenance.tester.js +++ b/services/maintenance/maintenance.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const currentYear = new Date().getUTCFullYear() diff --git a/services/mastodon/mastodon-follow.tester.js b/services/mastodon/mastodon-follow.tester.js index facacee5904bd..51995393683e0 100644 --- a/services/mastodon/mastodon-follow.tester.js +++ b/services/mastodon/mastodon-follow.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Followers - default domain') .get('/26471.json') diff --git a/services/matrix/matrix.tester.js b/services/matrix/matrix.tester.js index e0e6b59a4376f..86f796c1eb439 100644 --- a/services/matrix/matrix.tester.js +++ b/services/matrix/matrix.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('get room state as guest') .get('/ALIAS:DUMMY.dumb.json') diff --git a/services/maven-central/maven-central.tester.js b/services/maven-central/maven-central.tester.js index 1f678df58952d..76f8f27299d15 100644 --- a/services/maven-central/maven-central.tester.js +++ b/services/maven-central/maven-central.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('latest version') .get('/com.github.fabriziocucci/yacl4j.json') // http://repo1.maven.org/maven2/com/github/fabriziocucci/yacl4j/ diff --git a/services/maven-metadata/maven-metadata-redirect.tester.js b/services/maven-metadata/maven-metadata-redirect.tester.js index 445bfaeb7d259..6da5ffefb6777 100644 --- a/services/maven-metadata/maven-metadata-redirect.tester.js +++ b/services/maven-metadata/maven-metadata-redirect.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('maven metadata (badge extension)') .get( diff --git a/services/maven-metadata/maven-metadata.tester.js b/services/maven-metadata/maven-metadata.tester.js index 2064b4653fbce..d6a158d19bda2 100644 --- a/services/maven-metadata/maven-metadata.tester.js +++ b/services/maven-metadata/maven-metadata.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; t.create('valid maven-metadata.xml uri') diff --git a/services/microbadger/microbadger-layers.tester.js b/services/microbadger/microbadger-layers.tester.js index ca503ce16c79e..ace6a63f89ae8 100644 --- a/services/microbadger/microbadger-layers.tester.js +++ b/services/microbadger/microbadger-layers.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('layers without a specified tag') .get('/_/alpine.json') diff --git a/services/microbadger/microbadger-size.tester.js b/services/microbadger/microbadger-size.tester.js index 80f5615286e12..d6066b26a8bc9 100644 --- a/services/microbadger/microbadger-size.tester.js +++ b/services/microbadger/microbadger-size.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('image size without a specified tag') .get('/fedora/apache.json') diff --git a/services/mozilla-observatory/mozilla-observatory.tester.js b/services/mozilla-observatory/mozilla-observatory.tester.js index 43709a9755cc5..6996cc42f1ee4 100644 --- a/services/mozilla-observatory/mozilla-observatory.tester.js +++ b/services/mozilla-observatory/mozilla-observatory.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isMessage = Joi.alternatives() .try( diff --git a/services/myget/myget.tester.js b/services/myget/myget.tester.js index d5c113ef2930d..ac8f57d1b566a 100644 --- a/services/myget/myget.tester.js +++ b/services/myget/myget.tester.js @@ -3,9 +3,11 @@ import {isMetric, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test- import {queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero} from '../nuget-fixtures.js'; import {invalidJSON} from '../response-fixtures.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'myget', + title: 'MyGet', + pathPrefix: '', +}) // downloads diff --git a/services/netlify/netlify.tester.js b/services/netlify/netlify.tester.js index 9ed0241bc8d73..ef99bface87ff 100644 --- a/services/netlify/netlify.tester.js +++ b/services/netlify/netlify.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('netlify (valid, no branch)') .get('/e6d5a4e0-dee1-4261-833e-2f47f509c68f.json') diff --git a/services/nexus/nexus-redirect.tester.js b/services/nexus/nexus-redirect.tester.js index 2c2d496d97206..bfd1c6815b075 100644 --- a/services/nexus/nexus-redirect.tester.js +++ b/services/nexus/nexus-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'NexusRedirect', + title: 'NexusRedirect', + pathPrefix: '/nexus', +}) t.create('Nexus release') .get('/r/https/oss.sonatype.org/com.google.guava/guava.svg') diff --git a/services/nexus/nexus.tester.js b/services/nexus/nexus.tester.js index 16a72da362289..ba74f2bd12154 100644 --- a/services/nexus/nexus.tester.js +++ b/services/nexus/nexus.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionNClausesWithOptionalSuffix as isVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Nexus 2 - search release version valid artifact') .timeout(15000) diff --git a/services/node/node-current.tester.js b/services/node/node-current.tester.js index 48f25928f87e6..1a3384585fb3c 100644 --- a/services/node/node-current.tester.js +++ b/services/node/node-current.tester.js @@ -1,8 +1,8 @@ import {expect} from 'chai'; -import {Range} from 'semver'; -const t = (function() { - export default __a; -}()) +import semverModule from 'semver'; +const {Range} = semverModule; +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {mockPackageData, mockCurrentSha} from './testUtils/test-utils.js'; function expectSemverRange(message) { diff --git a/services/node/node-lts.tester.js b/services/node/node-lts.tester.js index a9cd347f64d6e..9736376465117 100644 --- a/services/node/node-lts.tester.js +++ b/services/node/node-lts.tester.js @@ -1,8 +1,8 @@ import {expect} from 'chai'; -import {Range} from 'semver'; -const t = (function() { - export default __a; -}()) +import semverModule from 'semver'; +const {Range} = semverModule; +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {mockPackageData, mockReleaseSchedule, mockVersionsSha} from './testUtils/test-utils.js'; function expectSemverRange(message) { diff --git a/services/nodeping/nodeping-status.tester.js b/services/nodeping/nodeping-status.tester.js index 0622b6f3f1f45..16a73d72256d6 100644 --- a/services/nodeping/nodeping-status.tester.js +++ b/services/nodeping/nodeping-status.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('NodePing status') .get('/jkiwn052-ntpp-4lbb-8d45-ihew6d9ucoei.json') diff --git a/services/nodeping/nodeping-uptime.tester.js b/services/nodeping/nodeping-uptime.tester.js index d2aa902f63f06..96b6580ab7878 100644 --- a/services/nodeping/nodeping-uptime.tester.js +++ b/services/nodeping/nodeping-uptime.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isPercentage} from '../test-validators.js'; t.create('NodePing uptime') diff --git a/services/npm/npm-collaborators.tester.js b/services/npm/npm-collaborators.tester.js index 837f640e6bd84..9f40bdfaa09c7 100644 --- a/services/npm/npm-collaborators.tester.js +++ b/services/npm/npm-collaborators.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the contributor count') .get('/prettier.json') diff --git a/services/npm/npm-dependency-version.tester.js b/services/npm/npm-dependency-version.tester.js index db976097646f5..191f54c4de059 100644 --- a/services/npm/npm-dependency-version.tester.js +++ b/services/npm/npm-dependency-version.tester.js @@ -1,7 +1,6 @@ import {semverRange} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the peer dependency version') .get('/react-boxplot/peer/react.json') diff --git a/services/npm/npm-downloads.tester.js b/services/npm/npm-downloads.tester.js index ae24f3ed7b3b3..8e8389c964092 100644 --- a/services/npm/npm-downloads.tester.js +++ b/services/npm/npm-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetricOverTimePeriod, isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('weekly downloads of left-pad').get('/dw/left-pad.json').expectBadge({ label: 'downloads', diff --git a/services/npm/npm-license.tester.js b/services/npm/npm-license.tester.js index 93bfdefcc2756..e600d933f0edd 100644 --- a/services/npm/npm-license.tester.js +++ b/services/npm/npm-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the license of express') .get('/express.json') diff --git a/services/npm/npm-type-definitions.tester.js b/services/npm/npm-type-definitions.tester.js index dd31cf8f894bf..ba32c98563a24 100644 --- a/services/npm/npm-type-definitions.tester.js +++ b/services/npm/npm-type-definitions.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isTypeDefinition = Joi.string().regex( /^((Flow|TypeScript)|(Flow \| TypeScript))$/ diff --git a/services/npm/npm-version.tester.js b/services/npm/npm-version.tester.js index 3e1dbcbb35c9c..0f2bda1582763 100644 --- a/services/npm/npm-version.tester.js +++ b/services/npm/npm-version.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the package version of left-pad') .get('/left-pad.json') diff --git a/services/nsp/nsp.tester.js b/services/nsp/nsp.tester.js index 1815d74ca2d21..1c42eee5e60f0 100644 --- a/services/nsp/nsp.tester.js +++ b/services/nsp/nsp.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'nsp', + title: 'nsp', + pathPrefix: '/nsp/npm', +}) t.create('no longer available (previously package)') .get('/gh-badges.json') diff --git a/services/nuget/nuget.tester.js b/services/nuget/nuget.tester.js index 7e7363aab8791..1ab349eecfe5f 100644 --- a/services/nuget/nuget.tester.js +++ b/services/nuget/nuget.tester.js @@ -3,9 +3,7 @@ import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWith import {queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero, nuGetV3VersionJsonBuildMetadataWithDash} from '../nuget-fixtures.js'; import {invalidJSON} from '../response-fixtures.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ id: 'nuget', title: 'NuGet' }) // downloads diff --git a/services/nycrc/nycrc.tester.js b/services/nycrc/nycrc.tester.js index 9e6d3c3de5021..11e05513934de 100644 --- a/services/nycrc/nycrc.tester.js +++ b/services/nycrc/nycrc.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('valid .nycrc') .get('/yargs/yargs.json?config=.nycrc') diff --git a/services/offset-earth/offset-earth-carbon-redirect.tester.js b/services/offset-earth/offset-earth-carbon-redirect.tester.js index 2ee06ecd0725f..7dfa632c7ad61 100644 --- a/services/offset-earth/offset-earth-carbon-redirect.tester.js +++ b/services/offset-earth/offset-earth-carbon-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'OffsetEarthCarbonRedirect', + title: 'Offset Earth (Carbon Offset) Redirector', + pathPrefix: '/offset-earth', +}) t.create('Offset Earth carbon alias') .get('/carbon/ecologi.svg') diff --git a/services/offset-earth/offset-earth-trees-redirect.tester.js b/services/offset-earth/offset-earth-trees-redirect.tester.js index d85c49b9dc584..6b92b56025d4f 100644 --- a/services/offset-earth/offset-earth-trees-redirect.tester.js +++ b/services/offset-earth/offset-earth-trees-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'OffsetEarthTreesRedirect', + title: 'Offset Earth (Trees) Redirector', + pathPrefix: '/offset-earth', +}) t.create('Offset Earth trees alias') .get('/trees/ecologi.svg') diff --git a/services/open-vsx/open-vsx-downloads.tester.js b/services/open-vsx/open-vsx-downloads.tester.js index 0fbdfd7a0bbab..d1b78e5c192f0 100644 --- a/services/open-vsx/open-vsx-downloads.tester.js +++ b/services/open-vsx/open-vsx-downloads.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex, isMetric} from '../test-validators.js'; const isVersionLabel = withRegex(/^downloads@(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/open-vsx/open-vsx-rating.tester.js b/services/open-vsx/open-vsx-rating.tester.js index 7ea636cac61f0..8d23a0a29efb7 100644 --- a/services/open-vsx/open-vsx-rating.tester.js +++ b/services/open-vsx/open-vsx-rating.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex, isStarRating} from '../test-validators.js'; const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/open-vsx/open-vsx-release-date.tester.js b/services/open-vsx/open-vsx-release-date.tester.js index 053738bed3acb..c988f1dcfc5b2 100644 --- a/services/open-vsx/open-vsx-release-date.tester.js +++ b/services/open-vsx/open-vsx-release-date.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isFormattedDate} from '../test-validators.js'; t.create('release date invalid extension') diff --git a/services/open-vsx/open-vsx-version.tester.js b/services/open-vsx/open-vsx-version.tester.js index 55d2bf7f81b45..bfe70f2dd25b0 100644 --- a/services/open-vsx/open-vsx-version.tester.js +++ b/services/open-vsx/open-vsx-version.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; const isVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/opencollective/opencollective-all.tester.js b/services/opencollective/opencollective-all.tester.js index c7edba53e5245..fdaab6d9a5a43 100644 --- a/services/opencollective/opencollective-all.tester.js +++ b/services/opencollective/opencollective-all.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('renders correctly') .get('/shields.json') diff --git a/services/opencollective/opencollective-backers.tester.js b/services/opencollective/opencollective-backers.tester.js index 5746a11eb3f82..4b40d276a74ec 100644 --- a/services/opencollective/opencollective-backers.tester.js +++ b/services/opencollective/opencollective-backers.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('renders correctly') .get('/shields.json') diff --git a/services/opencollective/opencollective-by-tier.tester.js b/services/opencollective/opencollective-by-tier.tester.js index 0722053d16dd0..9907fa5c4d30c 100644 --- a/services/opencollective/opencollective-by-tier.tester.js +++ b/services/opencollective/opencollective-by-tier.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('renders correctly') .get('/shields/2988.json') diff --git a/services/opencollective/opencollective-sponsors.tester.js b/services/opencollective/opencollective-sponsors.tester.js index 078f878bf543f..9119e5578eac7 100644 --- a/services/opencollective/opencollective-sponsors.tester.js +++ b/services/opencollective/opencollective-sponsors.tester.js @@ -1,7 +1,6 @@ import {nonNegativeInteger} from '../validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('renders correctly') .get('/shields.json') diff --git a/services/opm/opm-version.tester.js b/services/opm/opm-version.tester.js index d07b79a818983..33c3dc1be1c7f 100644 --- a/services/opm/opm-version.tester.js +++ b/services/opm/opm-version.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isValidVersion = Joi.string() .regex(/^v[\d+.]+$/) diff --git a/services/ore/ore-category.tester.js b/services/ore/ore-category.tester.js index eea23164d6806..fa4b810814066 100644 --- a/services/ore/ore-category.tester.js +++ b/services/ore/ore-category.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Taken from https://ore.spongepowered.org/api#/Projects/showProject const CATEGORY_ENUM = [ diff --git a/services/ore/ore-downloads.tester.js b/services/ore/ore-downloads.tester.js index d87a96216b26e..0b89105f51b8e 100644 --- a/services/ore/ore-downloads.tester.js +++ b/services/ore/ore-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'downloads', diff --git a/services/ore/ore-license.tester.js b/services/ore/ore-license.tester.js index b0dad5ff7248b..c7a45c06af074 100644 --- a/services/ore/ore-license.tester.js +++ b/services/ore/ore-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'license', diff --git a/services/ore/ore-sponge-versions.tester.js b/services/ore/ore-sponge-versions.tester.js index ac4a500b24b82..c351f3762cfc7 100644 --- a/services/ore/ore-sponge-versions.tester.js +++ b/services/ore/ore-sponge-versions.tester.js @@ -1,4 +1,5 @@ -const Joi = require('joi').extend(joi => ({ +import joiModule from 'joi'; +const Joi = joiModule.extend(joi => ({ base: joi.array(), coerce: (value, helpers) => ({ value: value.split ? value.split(' | ') : value, @@ -6,9 +7,8 @@ const Joi = require('joi').extend(joi => ({ type: 'versionArray', })) const isDottedVersionAtLeastOne = Joi.string().regex(/\d+(\.\d+)?(\.\d+)?$/) -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)') .get('/nucleus.json') diff --git a/services/ore/ore-stars.tester.js b/services/ore/ore-stars.tester.js index ee4059beef5db..85b0234f367c1 100644 --- a/services/ore/ore-stars.tester.js +++ b/services/ore/ore-stars.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'stars', diff --git a/services/ore/ore-version.tester.js b/services/ore/ore-version.tester.js index 6525d4e70ed72..57c1155536a29 100644 --- a/services/ore/ore-version.tester.js +++ b/services/ore/ore-version.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ label: 'version', diff --git a/services/osslifecycle/osslifecycle.tester.js b/services/osslifecycle/osslifecycle.tester.js index fe38ce87c5652..a2a1248056aa9 100644 --- a/services/osslifecycle/osslifecycle.tester.js +++ b/services/osslifecycle/osslifecycle.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'osslifecycle', + title: 'OSS Lifecycle', +}) t.create('osslifecycle active status').get('/netflix/sureal.json').expectBadge({ label: 'oss lifecycle', diff --git a/services/packagecontrol/packagecontrol.tester.js b/services/packagecontrol/packagecontrol.tester.js index e71462a7cef55..3ff353fdbfaae 100644 --- a/services/packagecontrol/packagecontrol.tester.js +++ b/services/packagecontrol/packagecontrol.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'packagecontrol', + title: 'Package Control', +}) t.create('monthly downloads').get('/dm/GitGutter.json').expectBadge({ label: 'downloads', diff --git a/services/packagist/packagist-downloads.tester.js b/services/packagist/packagist-downloads.tester.js index c51bab3d3e688..c9daf2a44fe02 100644 --- a/services/packagist/packagist-downloads.tester.js +++ b/services/packagist/packagist-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('daily downloads (valid, no package version specified)') .get('/dd/doctrine/orm.json') diff --git a/services/packagist/packagist-license.tester.js b/services/packagist/packagist-license.tester.js index 17111d610ede2..6d5093c8c0f00 100644 --- a/services/packagist/packagist-license.tester.js +++ b/services/packagist/packagist-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license (valid)') .get('/symfony/symfony.json') diff --git a/services/packagist/packagist-php-version.tester.js b/services/packagist/packagist-php-version.tester.js index ef0fcc676095a..cd2142bc6347c 100644 --- a/services/packagist/packagist-php-version.tester.js +++ b/services/packagist/packagist-php-version.tester.js @@ -1,7 +1,6 @@ import {isComposerVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the package version of symfony') .get('/symfony/symfony.json') diff --git a/services/packagist/packagist-stars.tester.js b/services/packagist/packagist-stars.tester.js index 8537c9804ba43..f994def8dfdf6 100644 --- a/services/packagist/packagist-stars.tester.js +++ b/services/packagist/packagist-stars.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Stars (valid package)').get('/guzzlehttp/guzzle.json').expectBadge({ label: 'stars', diff --git a/services/packagist/packagist-version.tester.js b/services/packagist/packagist-version.tester.js index 7bbccf085e90e..500b35c20acd2 100644 --- a/services/packagist/packagist-version.tester.js +++ b/services/packagist/packagist-version.tester.js @@ -1,9 +1,11 @@ import Joi from 'joi'; import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'packagist', + title: 'Packagist Version', + pathPrefix: '/packagist', +}) /* validator for a packagist version number diff --git a/services/php-eye/php-eye-hhvm.tester.js b/services/php-eye/php-eye-hhvm.tester.js index 3ce4aa841fdb1..b97e2b6557353 100644 --- a/services/php-eye/php-eye-hhvm.tester.js +++ b/services/php-eye/php-eye-hhvm.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'hhvm', + title: 'hhvm', + pathPrefix: '/hhvm', +}) t.create('no longer available (previously default branch)') .get('/symfony/symfony.json') diff --git a/services/php-eye/php-eye-php-version.tester.js b/services/php-eye/php-eye-php-version.tester.js index 8bc354293fcfc..4ff362b17acd5 100644 --- a/services/php-eye/php-eye-php-version.tester.js +++ b/services/php-eye/php-eye-php-version.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'php-eye', + title: 'php-eye', + pathPrefix: '/php-eye', +}) t.create('no longer available (previously default branch)') .get('/symfony/symfony.json') diff --git a/services/pingpong/pingpong-status.tester.js b/services/pingpong/pingpong-status.tester.js index b32055cb944c8..49eb2ae17cfb0 100644 --- a/services/pingpong/pingpong-status.tester.js +++ b/services/pingpong/pingpong-status.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isCorrectStatus = Joi.string().valid( 'up', diff --git a/services/pingpong/pingpong-uptime.tester.js b/services/pingpong/pingpong-uptime.tester.js index 67c7fd07bb8b9..02abb346f7c71 100644 --- a/services/pingpong/pingpong-uptime.tester.js +++ b/services/pingpong/pingpong-uptime.tester.js @@ -1,7 +1,6 @@ import {isPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('PingPong: Uptime (valid)') .get('/sp_eb705b7c189f42e3b574dc790291c33f.json') diff --git a/services/pkgreview/package-rating.tester.js b/services/pkgreview/package-rating.tester.js index 298fe05c2d2ab..dd00a4bf4c0b9 100644 --- a/services/pkgreview/package-rating.tester.js +++ b/services/pkgreview/package-rating.tester.js @@ -1,7 +1,6 @@ import {withRegex, isStarRating} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isRatingWithReviews = withRegex( /^(([0-4](.?([0-9]))?)|5)\/5?\s*\([0-9]*\)$/ diff --git a/services/poeditor/poeditor.tester.js b/services/poeditor/poeditor.tester.js index aacf4f6b45bfa..688f9a5cb7d66 100644 --- a/services/poeditor/poeditor.tester.js +++ b/services/poeditor/poeditor.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets POEditor progress online') .get('/progress/323337/de.json?token=7a666b44c0985d16a7b59748f488275c') diff --git a/services/powershellgallery/powershellgallery.tester.js b/services/powershellgallery/powershellgallery.tester.js index 5070709f9cfe0..0ef0845fb7494 100644 --- a/services/powershellgallery/powershellgallery.tester.js +++ b/services/powershellgallery/powershellgallery.tester.js @@ -5,11 +5,10 @@ const isPlatform = Joi.string().regex( /^(windows|linux|macos)( \| (windows|linux|macos))*$/ ) -const t = new ServiceTester({ +export const t = new ServiceTester({ id: 'powershellgallery', title: 'PowerShell Gallery', }) -export default t; t.create('total downloads (valid)').get('/dt/ACMESharp.json').expectBadge({ label: 'downloads', diff --git a/services/pub/pub.tester.js b/services/pub/pub.tester.js index a72b975eae68c..d3b853fc85126 100644 --- a/services/pub/pub.tester.js +++ b/services/pub/pub.tester.js @@ -1,8 +1,10 @@ import {isVPlusTripleDottedVersion} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'PubVersion', + title: 'Pub Version', + pathPrefix: '/pub', +}) t.create('package version').get('/v/box2d.json').expectBadge({ label: 'pub', diff --git a/services/puppetforge/puppetforge-module-downloads.tester.js b/services/puppetforge/puppetforge-module-downloads.tester.js index ed034ff56f044..ea52b3c71eaae 100644 --- a/services/puppetforge/puppetforge-module-downloads.tester.js +++ b/services/puppetforge/puppetforge-module-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('module downloads').get('/camptocamp/openssl.json').expectBadge({ label: 'downloads', diff --git a/services/puppetforge/puppetforge-module-endorsement.tester.js b/services/puppetforge/puppetforge-module-endorsement.tester.js index 0c4f0eef18119..04aa3593c76f1 100644 --- a/services/puppetforge/puppetforge-module-endorsement.tester.js +++ b/services/puppetforge/puppetforge-module-endorsement.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('module endorsement') .get('/camptocamp/openssl.json') diff --git a/services/puppetforge/puppetforge-module-feedback.tester.js b/services/puppetforge/puppetforge-module-feedback.tester.js index bd2b0079f1c84..be75019d37782 100644 --- a/services/puppetforge/puppetforge-module-feedback.tester.js +++ b/services/puppetforge/puppetforge-module-feedback.tester.js @@ -1,7 +1,6 @@ import {isPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('module feedback').get('/camptocamp/openssl.json').expectBadge({ label: 'score', diff --git a/services/puppetforge/puppetforge-module-pdk-version.tester.js b/services/puppetforge/puppetforge-module-pdk-version.tester.js index fbecff1dfdb53..f8697b61e30f7 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.tester.js +++ b/services/puppetforge/puppetforge-module-pdk-version.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('PDK version').get('/tragiccode/azure_key_vault.json').expectBadge({ label: 'pdk version', diff --git a/services/puppetforge/puppetforge-module-version.tester.js b/services/puppetforge/puppetforge-module-version.tester.js index a304263ae1c4f..d3b483f9366d1 100644 --- a/services/puppetforge/puppetforge-module-version.tester.js +++ b/services/puppetforge/puppetforge-module-version.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('module version').get('/camptocamp/openssl.json').expectBadge({ label: 'puppetforge', diff --git a/services/puppetforge/puppetforge-user-module-count.tester.js b/services/puppetforge/puppetforge-user-module-count.tester.js index 73e5aae70e7e6..dde1b482f8b10 100644 --- a/services/puppetforge/puppetforge-user-module-count.tester.js +++ b/services/puppetforge/puppetforge-user-module-count.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('modules by user').get('/camptocamp.json').expectBadge({ label: 'modules', diff --git a/services/puppetforge/puppetforge-user-release-count.tester.js b/services/puppetforge/puppetforge-user-release-count.tester.js index ae09b05c6f151..d6d6c40edfbaa 100644 --- a/services/puppetforge/puppetforge-user-release-count.tester.js +++ b/services/puppetforge/puppetforge-user-release-count.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('releases by user').get('/camptocamp.json').expectBadge({ label: 'releases', diff --git a/services/pypi/pypi-django-versions.tester.js b/services/pypi/pypi-django-versions.tester.js index 240f3268fc43a..e57e87c71e999 100644 --- a/services/pypi/pypi-django-versions.tester.js +++ b/services/pypi/pypi-django-versions.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isPipeSeparatedDjangoVersions = Joi.string().regex( /^([1-9]\.[0-9]+(?: \| )?)+$/ diff --git a/services/pypi/pypi-downloads.tester.js b/services/pypi/pypi-downloads.tester.js index 58083e4376518..fc5e2c13cfd70 100644 --- a/services/pypi/pypi-downloads.tester.js +++ b/services/pypi/pypi-downloads.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetricOverTimePeriod} from '../test-validators.js'; t.create('daily downloads (valid)') diff --git a/services/pypi/pypi-format.tester.js b/services/pypi/pypi-format.tester.js index 8cd838cd750d6..ccded77bcb274 100644 --- a/services/pypi/pypi-format.tester.js +++ b/services/pypi/pypi-format.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('format (wheel, package version in request)') .get('/requests/2.18.4.json') diff --git a/services/pypi/pypi-implementation.tester.js b/services/pypi/pypi-implementation.tester.js index 36e38ea7acd1a..f15de78ce3ac5 100644 --- a/services/pypi/pypi-implementation.tester.js +++ b/services/pypi/pypi-implementation.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('implementation (valid, package version in request)') .get('/beehive/1.0.json') diff --git a/services/pypi/pypi-license.tester.js b/services/pypi/pypi-license.tester.js index 71ad8f80236bc..96c6748739e3e 100644 --- a/services/pypi/pypi-license.tester.js +++ b/services/pypi/pypi-license.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('license (valid, package version in request)') .get('/requests/2.18.4.json') diff --git a/services/pypi/pypi-python-versions.tester.js b/services/pypi/pypi-python-versions.tester.js index bf3936c8722d9..fef7586e021ce 100644 --- a/services/pypi/pypi-python-versions.tester.js +++ b/services/pypi/pypi-python-versions.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isPipeSeparatedPythonVersions = Joi.string().regex( /^([1-9]\.[0-9]+(?: \| )?)+$/ diff --git a/services/pypi/pypi-status.tester.js b/services/pypi/pypi-status.tester.js index cee546544e736..f24621976461c 100644 --- a/services/pypi/pypi-status.tester.js +++ b/services/pypi/pypi-status.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('status (valid, stable, package version in request)') .get('/django/1.11.json') diff --git a/services/pypi/pypi-version.tester.js b/services/pypi/pypi-version.tester.js index ca262093f0056..83e3b37a10e11 100644 --- a/services/pypi/pypi-version.tester.js +++ b/services/pypi/pypi-version.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isSemver} from '../test-validators.js'; const isPsycopg2Version = Joi.string().regex(/^v([0-9][.]?)+$/) diff --git a/services/pypi/pypi-wheel.tester.js b/services/pypi/pypi-wheel.tester.js index 99945b0bac2c0..0cd52775e71ba 100644 --- a/services/pypi/pypi-wheel.tester.js +++ b/services/pypi/pypi-wheel.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('wheel (has wheel, package version in request)') .get('/requests/2.18.4.json') diff --git a/services/readthedocs/readthedocs.tester.js b/services/readthedocs/readthedocs.tester.js index da7ab34be127a..762e843fff868 100644 --- a/services/readthedocs/readthedocs.tester.js +++ b/services/readthedocs/readthedocs.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('build status') .get('/pip.json') diff --git a/services/reddit/subreddit-subscribers.tester.js b/services/reddit/subreddit-subscribers.tester.js index 145c69ba335d1..839e030e0db9d 100644 --- a/services/reddit/subreddit-subscribers.tester.js +++ b/services/reddit/subreddit-subscribers.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('subreddit-subscribers (valid subreddit)') .get('/drums.json') diff --git a/services/reddit/user-karma.tester.js b/services/reddit/user-karma.tester.js index 269b9e3f48157..ff39e32b5b773 100644 --- a/services/reddit/user-karma.tester.js +++ b/services/reddit/user-karma.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('user-karma (valid - link)') .get('/link/user_simulator.json') diff --git a/services/redmine/redmine.tester.js b/services/redmine/redmine.tester.js index 6676759e87b90..79a8242ce640e 100644 --- a/services/redmine/redmine.tester.js +++ b/services/redmine/redmine.tester.js @@ -2,9 +2,10 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; import {isStarRating} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'redmine', + title: 'Redmine', +}) t.create('plugin rating') .get('/plugin/rating/redmine_xlsx_format_issue_exporter.json') diff --git a/services/repology/repology-repositories.tester.js b/services/repology/repology-repositories.tester.js index 1fee4455c6065..5a03c67b3d0e3 100644 --- a/services/repology/repology-repositories.tester.js +++ b/services/repology/repology-repositories.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {nonNegativeInteger} from '../validators.js'; t.create('Existing project').get('/starship.json').expectBadge({ diff --git a/services/requires/requires.tester.js b/services/requires/requires.tester.js index 4e2d4b5ba5655..a319423ca111f 100644 --- a/services/requires/requires.tester.js +++ b/services/requires/requires.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isRequireStatus = Joi.string().regex( /^(up to date|outdated|insecure|unknown)$/ diff --git a/services/resharper/resharper.tester.js b/services/resharper/resharper.tester.js index 72629611cdfec..31bb81c7e49db 100644 --- a/services/resharper/resharper.tester.js +++ b/services/resharper/resharper.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'resharper', + title: 'ReSharper', +}) // downloads diff --git a/services/response-fixtures.js b/services/response-fixtures.js index b1ceac965a85d..575a9fea98dfe 100644 --- a/services/response-fixtures.js +++ b/services/response-fixtures.js @@ -1,10 +1,7 @@ -const invalidJSONString = '{{{{{invalid json}}' +export const invalidJSONString = '{{{{{invalid json}}' -export { - invalidJSON: () => [ +export const invalidJSON = () => [ 200, invalidJSONString, { 'Content-Type': 'application/json' }, - ], - invalidJSONString, -}; + ] diff --git a/services/reuse/reuse-compliance.tester.js b/services/reuse/reuse-compliance.tester.js index 53b494e50e3f0..493284f086118 100644 --- a/services/reuse/reuse-compliance.tester.js +++ b/services/reuse/reuse-compliance.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; t.create('valid repo -- live') diff --git a/services/scoop/scoop-version.tester.js b/services/scoop/scoop-version.tester.js index ba5c707a8a5e5..57e13d41c973c 100644 --- a/services/scoop/scoop-version.tester.js +++ b/services/scoop/scoop-version.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionNClauses} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'scoop', + title: 'Scoop', +}) // version diff --git a/services/scrutinizer/scrutinizer-build.tester.js b/services/scrutinizer/scrutinizer-build.tester.js index 5462a913144e9..4955ecbb18180 100644 --- a/services/scrutinizer/scrutinizer-build.tester.js +++ b/services/scrutinizer/scrutinizer-build.tester.js @@ -1,9 +1,11 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ScrutinizerBuild', + title: 'ScrutinizerBuild', + pathPrefix: '/scrutinizer/build', +}) t.create('build (GitHub)') .get('/g/filp/whoops.json') diff --git a/services/scrutinizer/scrutinizer-coverage.tester.js b/services/scrutinizer/scrutinizer-coverage.tester.js index 7761b076deacd..0f9c953d29340 100644 --- a/services/scrutinizer/scrutinizer-coverage.tester.js +++ b/services/scrutinizer/scrutinizer-coverage.tester.js @@ -1,8 +1,10 @@ import {isIntegerPercentage} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ScrutinizerCoverage', + title: 'ScrutinizerCoverage', + pathPrefix: '/scrutinizer/coverage', +}) t.create('code coverage (GitHub)').get('/g/filp/whoops.json').expectBadge({ label: 'coverage', diff --git a/services/scrutinizer/scrutinizer-quality.tester.js b/services/scrutinizer/scrutinizer-quality.tester.js index 235d7a904cfae..6865efae884fb 100644 --- a/services/scrutinizer/scrutinizer-quality.tester.js +++ b/services/scrutinizer/scrutinizer-quality.tester.js @@ -1,8 +1,10 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ScrutinizerQuality', + title: 'ScrutinizerQuality', + pathPrefix: '/scrutinizer/quality', +}) const isQualityNumber = Joi.number().positive() diff --git a/services/scrutinizer/scrutinizer-redirect.tester.js b/services/scrutinizer/scrutinizer-redirect.tester.js index 1c35853833903..ad70f3614d70f 100644 --- a/services/scrutinizer/scrutinizer-redirect.tester.js +++ b/services/scrutinizer/scrutinizer-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'ScrutinizerQualityRedirect', + title: 'ScrutinizerQualityRedirect', + pathPrefix: '/scrutinizer', +}) t.create('scrutinizer quality GitHub') .get('/g/doctrine/orm.svg') diff --git a/services/security-headers/security-headers.tester.js b/services/security-headers/security-headers.tester.js index 787c84706576a..b51c27114d161 100644 --- a/services/security-headers/security-headers.tester.js +++ b/services/security-headers/security-headers.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('grade of https://shields.io') .get('/security-headers.json?url=https://shields.io') diff --git a/services/shippable/shippable.tester.js b/services/shippable/shippable.tester.js index 17c8e728bec80..4c911d386c1d4 100644 --- a/services/shippable/shippable.tester.js +++ b/services/shippable/shippable.tester.js @@ -1,8 +1,10 @@ import {isBuildStatus} from '../build-status.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'Shippable', + title: 'Shippable', + pathPrefix: '/shippable', +}) t.create('build status (valid)') .get('/5444c5ecb904a4b21567b0ff/master.json') diff --git a/services/snap-ci/snap-ci.tester.js b/services/snap-ci/snap-ci.tester.js index e114c565af024..295ee2c9a8b79 100644 --- a/services/snap-ci/snap-ci.tester.js +++ b/services/snap-ci/snap-ci.tester.js @@ -1,7 +1,6 @@ import {ServiceTester} from '../tester.js'; -const t = new ServiceTester({ id: 'snap-ci', title: 'Snap CI' }) -export default t; +export const t = new ServiceTester({ id: 'snap-ci', title: 'Snap CI' }) t.create('no longer available (previously build state)') .get('/snap-ci/ThoughtWorksStudios/eb_deployer/master.json') diff --git a/services/snyk/snyk-vulnerability-github.tester.js b/services/snyk/snyk-vulnerability-github.tester.js index 96cee3c27358a..120d3abf3750b 100644 --- a/services/snyk/snyk-vulnerability-github.tester.js +++ b/services/snyk/snyk-vulnerability-github.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; t.create('valid repo').get('/snyk/snyk.json').timeout(20000).expectBadge({ diff --git a/services/snyk/snyk-vulnerability-npm.tester.js b/services/snyk/snyk-vulnerability-npm.tester.js index a9e1ec94b2ad7..4f7486a2564dc 100644 --- a/services/snyk/snyk-vulnerability-npm.tester.js +++ b/services/snyk/snyk-vulnerability-npm.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; t.create('valid package latest version') diff --git a/services/sonar/sonar-coverage.tester.js b/services/sonar/sonar-coverage.tester.js index 811505bf04b52..23b879182b64b 100644 --- a/services/sonar/sonar-coverage.tester.js +++ b/services/sonar/sonar-coverage.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; // The service tests targeting the legacy SonarQube API are mocked diff --git a/services/sonar/sonar-documented-api-density.tester.js b/services/sonar/sonar-documented-api-density.tester.js index 7c6c2d90b38ad..f8d41073518e3 100644 --- a/services/sonar/sonar-documented-api-density.tester.js +++ b/services/sonar/sonar-documented-api-density.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-fortify-rating.tester.js b/services/sonar/sonar-fortify-rating.tester.js index a9a5fceb6fbb3..51b3c1aa0df66 100644 --- a/services/sonar/sonar-fortify-rating.tester.js +++ b/services/sonar/sonar-fortify-rating.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-generic.tester.js b/services/sonar/sonar-generic.tester.js index 377d1dff07395..c962c4f156366 100644 --- a/services/sonar/sonar-generic.tester.js +++ b/services/sonar/sonar-generic.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Security Rating') .timeout(10000) diff --git a/services/sonar/sonar-quality-gate.tester.js b/services/sonar/sonar-quality-gate.tester.js index cf2e3834f7929..72697bf693fd6 100644 --- a/services/sonar/sonar-quality-gate.tester.js +++ b/services/sonar/sonar-quality-gate.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isQualityGateStatus = Joi.allow('passed', 'failed') diff --git a/services/sonar/sonar-redirector.tester.js b/services/sonar/sonar-redirector.tester.js index 027a86d00b533..4f939b6563cab 100644 --- a/services/sonar/sonar-redirector.tester.js +++ b/services/sonar/sonar-redirector.tester.js @@ -1,9 +1,11 @@ import queryString from 'querystring'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'SonarRedirect', + title: 'SonarRedirect', + pathPrefix: '/sonar', +}) t.create('sonar version') .get( diff --git a/services/sonar/sonar-tech-debt.tester.js b/services/sonar/sonar-tech-debt.tester.js index 517f3c8c86f95..aed40ea1093e1 100644 --- a/services/sonar/sonar-tech-debt.tester.js +++ b/services/sonar/sonar-tech-debt.tester.js @@ -1,7 +1,6 @@ import {isPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-tests.tester.js b/services/sonar/sonar-tests.tester.js index 8e8fabfb04ddc..737296845c057 100644 --- a/services/sonar/sonar-tests.tester.js +++ b/services/sonar/sonar-tests.tester.js @@ -1,8 +1,10 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'SonarTests', + title: 'SonarTests', + pathPrefix: '/sonar', +}) import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals, isIntegerPercentage, isMetric} from '../test-validators.js'; const isMetricAllowZero = Joi.alternatives( isMetric, diff --git a/services/sonar/sonar-violations.tester.js b/services/sonar/sonar-violations.tester.js index 5a13c9bd75a37..460a913984fa2 100644 --- a/services/sonar/sonar-violations.tester.js +++ b/services/sonar/sonar-violations.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isMetric, withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isViolationsLongFormMetric = Joi.alternatives( Joi.allow(0), withRegex( diff --git a/services/sourceforge/sourceforge-open-tickets.tester.js b/services/sourceforge/sourceforge-open-tickets.tester.js index ff62d9225ae7a..67a83b9c4fdf5 100644 --- a/services/sourceforge/sourceforge-open-tickets.tester.js +++ b/services/sourceforge/sourceforge-open-tickets.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('bugs') .get('/sevenzip/bugs.json') diff --git a/services/sourceforge/sourceforge.tester.js b/services/sourceforge/sourceforge.tester.js index 225d09d54d5bd..ffbc408c800dd 100644 --- a/services/sourceforge/sourceforge.tester.js +++ b/services/sourceforge/sourceforge.tester.js @@ -1,7 +1,6 @@ import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('total downloads').get('/dt/sevenzip.json').expectBadge({ label: 'downloads', diff --git a/services/sourcegraph/sourcegraph.tester.js b/services/sourcegraph/sourcegraph.tester.js index d6c326ce45976..aab80ff36f1a3 100644 --- a/services/sourcegraph/sourcegraph.tester.js +++ b/services/sourcegraph/sourcegraph.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Matches API responses such as "0 projects", "1 projects", "182 projects", "14.0k projects". // There may be other cases not covered by this regex, but hopefully the tested projects won't vary much. diff --git a/services/spack/spack.tester.js b/services/spack/spack.tester.js index 29c3ea1cc8277..2ad6d5b82d747 100644 --- a/services/spack/spack.tester.js +++ b/services/spack/spack.tester.js @@ -1,7 +1,6 @@ import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('version (valid)').get('/adios2.json').expectBadge({ label: 'spack', diff --git a/services/spiget/spiget-download-size.tester.js b/services/spiget/spiget-download-size.tester.js index a431ddf8b7972..d444eadf37139 100644 --- a/services/spiget/spiget-download-size.tester.js +++ b/services/spiget/spiget-download-size.tester.js @@ -1,7 +1,6 @@ import {isFileSize} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('EssentialsX (id 9089)') .get('/9089.json') diff --git a/services/spiget/spiget-downloads.tester.js b/services/spiget/spiget-downloads.tester.js index f78ff409d9846..1c1e6cd11b4a3 100644 --- a/services/spiget/spiget-downloads.tester.js +++ b/services/spiget/spiget-downloads.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('EssentialsX (id 9089)').get('/9089.json').expectBadge({ label: 'downloads', diff --git a/services/spiget/spiget-latest-version.tester.js b/services/spiget/spiget-latest-version.tester.js index e9e34723e41c6..31fc1464a21a1 100644 --- a/services/spiget/spiget-latest-version.tester.js +++ b/services/spiget/spiget-latest-version.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Note that Spigot versions can be anything (including just a string), so we'll make sure it's not returning 'not found' diff --git a/services/spiget/spiget-rating.tester.js b/services/spiget/spiget-rating.tester.js index 4514b4807f2f8..81e0ce1336881 100644 --- a/services/spiget/spiget-rating.tester.js +++ b/services/spiget/spiget-rating.tester.js @@ -1,7 +1,6 @@ import {isStarRating, withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Stars - EssentialsX (id 9089)').get('/stars/9089.json').expectBadge({ label: 'rating', diff --git a/services/spiget/spiget-tested-versions.tester.js b/services/spiget/spiget-tested-versions.tester.js index eefe451c44b84..2d3ed5e10879b 100644 --- a/services/spiget/spiget-tested-versions.tester.js +++ b/services/spiget/spiget-tested-versions.tester.js @@ -1,7 +1,6 @@ import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const multipleVersions = withRegex(/^([+]?\d*\.\d+)(-)([+]?\d*\.\d+)$/) diff --git a/services/stackexchange/stackexchange-monthlyquestions.tester.js b/services/stackexchange/stackexchange-monthlyquestions.tester.js index 725ee9328c0e0..8fbc906c3852c 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.tester.js +++ b/services/stackexchange/stackexchange-monthlyquestions.tester.js @@ -1,7 +1,6 @@ import {isMetricOverTimePeriod} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Monthly Questions for StackOverflow Momentjs') .get('/stackoverflow/qm/momentjs.json') diff --git a/services/stackexchange/stackexchange-reputation.tester.js b/services/stackexchange/stackexchange-reputation.tester.js index fa0f613bd9dc8..f2f8d6a03d8e9 100644 --- a/services/stackexchange/stackexchange-reputation.tester.js +++ b/services/stackexchange/stackexchange-reputation.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Invalid parameters') .get('/stackoverflow/r/invalidimage.json') diff --git a/services/stackexchange/stackexchange-taginfo.tester.js b/services/stackexchange/stackexchange-taginfo.tester.js index bfc3fe676758d..3680582dff1de 100644 --- a/services/stackexchange/stackexchange-taginfo.tester.js +++ b/services/stackexchange/stackexchange-taginfo.tester.js @@ -1,7 +1,6 @@ import {isMetric} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('JavaScript Questions') .get('/stackoverflow/t/javascript.json') diff --git a/services/static-badge/query-string-static.tester.js b/services/static-badge/query-string-static.tester.js index e47251408b910..5d5f007dab6ba 100644 --- a/services/static-badge/query-string-static.tester.js +++ b/services/static-badge/query-string-static.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Missing message') .get('/static/v1.json?label=label&message=&color=blue') diff --git a/services/static-badge/static-badge.tester.js b/services/static-badge/static-badge.tester.js index a6a3cb64c6762..f1b122c7d8746 100644 --- a/services/static-badge/static-badge.tester.js +++ b/services/static-badge/static-badge.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Shields colorscheme color') .get('/badge/label-message-blue.json') diff --git a/services/steam/steam-workshop.tester.js b/services/steam/steam-workshop.tester.js index e7a4730d43c9c..66962f29a103f 100644 --- a/services/steam/steam-workshop.tester.js +++ b/services/steam/steam-workshop.tester.js @@ -1,8 +1,7 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isFileSize, isFormattedDate} from '../test-validators.js'; -const t = new ServiceTester({ id: 'steam', title: 'Steam Workshop Tests' }) -export default t; +export const t = new ServiceTester({ id: 'steam', title: 'Steam Workshop Tests' }) t.create('Collection Files') .get('/collection-files/180077636.json') diff --git a/services/swagger/swagger-redirect.tester.js b/services/swagger/swagger-redirect.tester.js index 19f5a386f5868..51bb1019a4f39 100644 --- a/services/swagger/swagger-redirect.tester.js +++ b/services/swagger/swagger-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'SwaggerUrlRedirect', + title: 'SwaggerUrlRedirect', + pathPrefix: '/swagger/valid/2.0', +}) t.create('swagger json') .get('/https/example.com/example.svg') diff --git a/services/swagger/swagger.tester.js b/services/swagger/swagger.tester.js index 38015e1b0fed8..f431f89a025a3 100644 --- a/services/swagger/swagger.tester.js +++ b/services/swagger/swagger.tester.js @@ -6,9 +6,8 @@ const apiGetQueryParams = { url: 'https://example.com/example.json', } -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Invalid') .get(getURL) diff --git a/services/symfony/sensiolabs-redirect.tester.js b/services/symfony/sensiolabs-redirect.tester.js index 47354f313dbc7..be8366fb6de2d 100644 --- a/services/symfony/sensiolabs-redirect.tester.js +++ b/services/symfony/sensiolabs-redirect.tester.js @@ -1,8 +1,9 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'sensiolabs', + title: 'SensioLabs', +}) t.create('sensiolabs insight') .get('/i/825be328-29f8-44f7-a750-f82818ae9111.svg') diff --git a/services/symfony/symfony-insight-grade.tester.js b/services/symfony/symfony-insight-grade.tester.js index 5c315a1c63913..f3a4706f6ea64 100644 --- a/services/symfony/symfony-insight-grade.tester.js +++ b/services/symfony/symfony-insight-grade.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; t.create('valid project grade') diff --git a/services/symfony/symfony-insight-stars.tester.js b/services/symfony/symfony-insight-stars.tester.js index 901e14d404aab..59378ed2975f4 100644 --- a/services/symfony/symfony-insight-stars.tester.js +++ b/services/symfony/symfony-insight-stars.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; diff --git a/services/symfony/symfony-insight-violations.tester.js b/services/symfony/symfony-insight-violations.tester.js index bd606e0028c30..4a1aecd83a07f 100644 --- a/services/symfony/symfony-insight-violations.tester.js +++ b/services/symfony/symfony-insight-violations.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; diff --git a/services/teamcity/teamcity-build-redirect.tester.js b/services/teamcity/teamcity-build-redirect.tester.js index ade18ec2b9057..117df1ab95900 100644 --- a/services/teamcity/teamcity-build-redirect.tester.js +++ b/services/teamcity/teamcity-build-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'TeamCityBuildRedirect', + title: 'TeamCityBuildRedirect', + pathPrefix: '/teamcity', +}) t.create('codebetter') .get('/codebetter/IntelliJIdeaCe_JavaDecompilerEngineTests.svg') diff --git a/services/teamcity/teamcity-build.tester.js b/services/teamcity/teamcity-build.tester.js index d64332b09f6e5..10009fae49c78 100644 --- a/services/teamcity/teamcity-build.tester.js +++ b/services/teamcity/teamcity-build.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {withRegex} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const buildStatusValues = Joi.equal('passing', 'failure', 'error').required() const buildStatusTextRegex = diff --git a/services/teamcity/teamcity-coverage-redirect.tester.js b/services/teamcity/teamcity-coverage-redirect.tester.js index 3c142013e25f7..7853711679f76 100644 --- a/services/teamcity/teamcity-coverage-redirect.tester.js +++ b/services/teamcity/teamcity-coverage-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'TeamCityCoverageRedirect', + title: 'TeamCityCoverageRedirect', + pathPrefix: '/teamcity/coverage', +}) t.create('coverage') .get('/https/teamcity.jetbrains.com/ReactJSNet_PullRequests.svg') diff --git a/services/teamcity/teamcity-coverage.tester.js b/services/teamcity/teamcity-coverage.tester.js index f75688df29e73..7867c19d994d8 100644 --- a/services/teamcity/teamcity-coverage.tester.js +++ b/services/teamcity/teamcity-coverage.tester.js @@ -1,7 +1,6 @@ import {isIntegerPercentage} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('invalid buildId') .get('/btABC999.json') diff --git a/services/testspace/testspace-test-count.tester.js b/services/testspace/testspace-test-count.tester.js index 08b06e194b25d..078dd6266afd3 100644 --- a/services/testspace/testspace-test-count.tester.js +++ b/services/testspace/testspace-test-count.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; const isMetricAllowZero = Joi.alternatives( isMetric, diff --git a/services/testspace/testspace-test-pass-ratio.tester.js b/services/testspace/testspace-test-pass-ratio.tester.js index 17ee33eec0920..55d61582ac438 100644 --- a/services/testspace/testspace-test-pass-ratio.tester.js +++ b/services/testspace/testspace-test-pass-ratio.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; t.create('Non-existent or unauthorized org') diff --git a/services/testspace/testspace-test-summary.tester.js b/services/testspace/testspace-test-summary.tester.js index 5652ac672425c..28c0a10ec71b2 100644 --- a/services/testspace/testspace-test-summary.tester.js +++ b/services/testspace/testspace-test-summary.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals} from '../test-validators.js'; t.create('Tests') diff --git a/services/tokei/tokei.tester.js b/services/tokei/tokei.tester.js index deac0f1fd18a4..27a71c92c7fb6 100644 --- a/services/tokei/tokei.tester.js +++ b/services/tokei/tokei.tester.js @@ -1,8 +1,7 @@ import {ServiceTester} from '../tester.js'; import {isMetric} from '../test-validators.js'; -const t = new ServiceTester({ id: 'tokei', title: 'Tokei LOC Tests' }) -export default t; +export const t = new ServiceTester({ id: 'tokei', title: 'Tokei LOC Tests' }) t.create('GitHub LOC') .get('/lines/github/badges/shields.json') diff --git a/services/travis/travis-build.tester.js b/services/travis/travis-build.tester.js index f64dd6c28c280..ca4b9c9aadcbb 100644 --- a/services/travis/travis-build.tester.js +++ b/services/travis/travis-build.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Travis (.org) CI diff --git a/services/travis/travis-php-version-redirect.tester.js b/services/travis/travis-php-version-redirect.tester.js index 5e045291bcc74..997c84862ffe3 100644 --- a/services/travis/travis-php-version-redirect.tester.js +++ b/services/travis/travis-php-version-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'TravisPhpVersionRedirect', + title: 'TravisPhpVersionRedirect', + pathPrefix: '/', +}) t.create('travis-ci no branch') .get('travis-ci/php-v/symfony/symfony.svg') diff --git a/services/travis/travis-php-version.tester.js b/services/travis/travis-php-version.tester.js index 6319052c94be9..7819f3f5d47f5 100644 --- a/services/travis/travis-php-version.tester.js +++ b/services/travis/travis-php-version.tester.js @@ -1,7 +1,6 @@ import {isPhpVersionReduction} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gets the package version of symfony 5.1') .get('/symfony/symfony/5.1.json') diff --git a/services/treeware/treeware-trees.tester.js b/services/treeware/treeware-trees.tester.js index d145606db3f88..6615400f9cff2 100644 --- a/services/treeware/treeware-trees.tester.js +++ b/services/treeware/treeware-trees.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; t.create('request for existing package') diff --git a/services/twitch/twitch.tester.js b/services/twitch/twitch.tester.js index 14d3754b25fee..e9e2fbcc41695 100644 --- a/services/twitch/twitch.tester.js +++ b/services/twitch/twitch.tester.js @@ -1,12 +1,13 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; import {noToken} from '../test-helpers.js'; -import _noTwitchToken from './twitch.service'; +import _noTwitchToken from './twitch.service.js'; const noTwitchToken = noToken(_noTwitchToken); -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'twitch', + title: 'Twitch', +}) // the first request would take longer since we need to wait for a token t.create('Status of andyonthewings') diff --git a/services/twitter/twitter-redirect.tester.js b/services/twitter/twitter-redirect.tester.js index 8ec2723d12708..b479d4b808ca0 100644 --- a/services/twitter/twitter-redirect.tester.js +++ b/services/twitter/twitter-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'TwitterUrlRedirect', + title: 'TwitterUrlRedirect', + pathPrefix: '/twitter/url', +}) t.create('twitter') .get('/https/shields.io.svg') diff --git a/services/twitter/twitter.tester.js b/services/twitter/twitter.tester.js index 2bae9beb44fc6..1243440450594 100644 --- a/services/twitter/twitter.tester.js +++ b/services/twitter/twitter.tester.js @@ -1,9 +1,10 @@ import {isMetric} from '../test-validators.js'; import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'twitter', + title: 'Twitter', +}) t.create('Followers') .get('/follow/shields_io.json') diff --git a/services/ubuntu/ubuntu.tester.js b/services/ubuntu/ubuntu.tester.js index 9e8bb3a6d5170..244b7871d0839 100644 --- a/services/ubuntu/ubuntu.tester.js +++ b/services/ubuntu/ubuntu.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isUbuntuVersion = Joi.string().regex( /^v(\d+:)?\d+(\.\d+)*([\w\\.]*)?([-+~].*)?$/ diff --git a/services/uptimerobot/uptimerobot-ratio.tester.js b/services/uptimerobot/uptimerobot-ratio.tester.js index 4c7bf4500efec..83dc62262fd20 100644 --- a/services/uptimerobot/uptimerobot-ratio.tester.js +++ b/services/uptimerobot/uptimerobot-ratio.tester.js @@ -1,8 +1,7 @@ import {isPercentage} from '../test-validators.js'; import {invalidJSON} from '../response-fixtures.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Uptime Robot: Percentage (valid)') .get('/m778918918-3e92c097147760ee39d02d36.json') diff --git a/services/uptimerobot/uptimerobot-status.tester.js b/services/uptimerobot/uptimerobot-status.tester.js index 9fb92618d0953..94f6d12ade2c2 100644 --- a/services/uptimerobot/uptimerobot-status.tester.js +++ b/services/uptimerobot/uptimerobot-status.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {invalidJSON} from '../response-fixtures.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isUptimeStatus = Joi.string().valid( 'paused', diff --git a/services/vaadin-directory/vaadin-directory-rating-count.tester.js b/services/vaadin-directory/vaadin-directory-rating-count.tester.js index 9616090b45adf..89728d433e996 100644 --- a/services/vaadin-directory/vaadin-directory-rating-count.tester.js +++ b/services/vaadin-directory/vaadin-directory-rating-count.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('rating count of component') .get('/rating-count/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-rating.tester.js b/services/vaadin-directory/vaadin-directory-rating.tester.js index b264792252537..8598086732f8c 100644 --- a/services/vaadin-directory/vaadin-directory-rating.tester.js +++ b/services/vaadin-directory/vaadin-directory-rating.tester.js @@ -1,8 +1,7 @@ import Joi from 'joi'; import {isStarRating} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('stars of component displayed in star icons') .get('/star/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-release-date.tester.js b/services/vaadin-directory/vaadin-directory-release-date.tester.js index 823391bd345a6..328aee392d4f4 100644 --- a/services/vaadin-directory/vaadin-directory-release-date.tester.js +++ b/services/vaadin-directory/vaadin-directory-release-date.tester.js @@ -1,7 +1,6 @@ import {isFormattedDate} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('latest release date of the component (format: yyyy-mm-dd)') .get('/rd/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-status.tester.js b/services/vaadin-directory/vaadin-directory-status.tester.js index e6fcb4e459945..645bb3ea66c57 100644 --- a/services/vaadin-directory/vaadin-directory-status.tester.js +++ b/services/vaadin-directory/vaadin-directory-status.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('publish status of the component') .get('/vaadinvaadin-grid.json') diff --git a/services/vaadin-directory/vaadin-directory-version.tester.js b/services/vaadin-directory/vaadin-directory-version.tester.js index 18708b2ae3e11..df18d5a6bb35a 100644 --- a/services/vaadin-directory/vaadin-directory-version.tester.js +++ b/services/vaadin-directory/vaadin-directory-version.tester.js @@ -1,7 +1,6 @@ import {isSemver} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('latest version of the component (can have v prefixed or without)') .get('/v/vaadinvaadin-grid.json') diff --git a/services/versioneye/versioneye.tester.js b/services/versioneye/versioneye.tester.js index 33f0713933bd2..3bcfb52c58870 100644 --- a/services/versioneye/versioneye.tester.js +++ b/services/versioneye/versioneye.tester.js @@ -1,7 +1,6 @@ import {ServiceTester} from '../tester.js'; -const t = new ServiceTester({ id: 'versioneye', title: 'VersionEye' }) -export default t; +export const t = new ServiceTester({ id: 'versioneye', title: 'VersionEye' }) t.create('no longer available (previously dependencies status)') .get('/d/ruby/rails.json') diff --git a/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js b/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js index ea631afa0cf3b..f27c84d5ebabc 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Mocked response rather than real data as old builds are deleted after some time. t.create('Valid Build') diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js index 979aec31ca983..ce30a448e4cb3 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Note: // Unfortunately an Invalid user, invalid project, valid API token test is not possible due to the way Microsoft cache their responses. diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js index 150fe1aa2cf64..7b9a7876a46ef 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isFileSize} from '../test-validators.js'; t.create('8368844 bytes to 8.37 megabytes') diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js index a1fc24d0c471e..975ad98ce80b7 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() // Note: // Unfortunately an Invalid user, invalid project, valid API token test is not possible due to the way Microsoft cache their responses. diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js index baccf3681efc5..74604f9b9f909 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; const mockResponse = { diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js index 3303eae143f6a..9880ada45977f 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; const mockResponse = { diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js index 15d18bc021e4f..ef5ae388025da 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isFormattedDate} from '../test-validators.js'; t.create('date') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js index ffde1a841731d..0cb520a455a9c 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex, isStarRating} from '../test-validators.js'; const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js index f8c0413e09977..3fd0d894da9be 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {isFormattedDate} from '../test-validators.js'; t.create('date') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js index 109a478a2a56a..1f2fcd5226afd 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; const isMarketplaceVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/w3c/w3c-validation.tester.js b/services/w3c/w3c-validation.tester.js index 1cdefe8fbbaac..bc2db6ec9480e 100644 --- a/services/w3c/w3c-validation.tester.js +++ b/services/w3c/w3c-validation.tester.js @@ -1,7 +1,6 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() const isErrorOnly = Joi.string().regex(/^[0-9]+ errors?$/) diff --git a/services/waffle/waffle-label-redirect.tester.js b/services/waffle/waffle-label-redirect.tester.js index 3180f6fb53270..150f144b91671 100644 --- a/services/waffle/waffle-label-redirect.tester.js +++ b/services/waffle/waffle-label-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'WaffleLabelRedirect', + title: 'WaffleLabelRedirect', + pathPrefix: '/waffle/label', +}) t.create('waffle label redirect') .get('/waffleio/waffle.io.svg') diff --git a/services/waffle/waffle-label.tester.js b/services/waffle/waffle-label.tester.js index 995ef96d1c41f..60f734b903ff5 100644 --- a/services/waffle/waffle-label.tester.js +++ b/services/waffle/waffle-label.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'Waffle', + title: 'WaffleLabel', + pathPrefix: '/waffle/label', +}) t.create('no longer available') .get('/ritwickdey/vscode-live-server/bug.json') diff --git a/services/website/website-redirect.tester.js b/services/website/website-redirect.tester.js index fdc76b3d13c03..5b5c53ed55b44 100644 --- a/services/website/website-redirect.tester.js +++ b/services/website/website-redirect.tester.js @@ -1,8 +1,10 @@ import {ServiceTester} from '../tester.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'WebsiteRedirect', + title: 'WebsiteRedirect', + pathPrefix: '', +}) t.create('Website with custom messages') .get('/website-up-down/https/www.google.com.svg') diff --git a/services/website/website.tester.js b/services/website/website.tester.js index ded23b550487d..d84d9475ee064 100644 --- a/services/website/website.tester.js +++ b/services/website/website.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('status of http://shields.io') .get('/website.json?url=http://shields.io') diff --git a/services/wercker/wercker.tester.js b/services/wercker/wercker.tester.js index 7cb159c44bb2f..864a430d7f071 100644 --- a/services/wercker/wercker.tester.js +++ b/services/wercker/wercker.tester.js @@ -1,7 +1,6 @@ import {isBuildStatus} from '../build-status.js'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Build status') .get('/build/wercker/go-wercker-api.json') diff --git a/services/wheelmap/wheelmap.tester.js b/services/wheelmap/wheelmap.tester.js index 2bc5c97011669..5f75531f584d6 100644 --- a/services/wheelmap/wheelmap.tester.js +++ b/services/wheelmap/wheelmap.tester.js @@ -1,8 +1,7 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; -import _noWheelmapToken from './wheelmap.service'; +import _noWheelmapToken from './wheelmap.service.js'; const noWheelmapToken = noToken(_noWheelmapToken); t.create('node with accessibility') diff --git a/services/wordpress/wordpress-downloads.tester.js b/services/wordpress/wordpress-downloads.tester.js index f04a2cfbe90dd..1702c237731ce 100644 --- a/services/wordpress/wordpress-downloads.tester.js +++ b/services/wordpress/wordpress-downloads.tester.js @@ -1,11 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -const t = new ServiceTester({ +export const t = new ServiceTester({ id: 'wordpress', title: 'WordPress Download Tests', }) -export default t; t.create('Plugin Downloads - Total') .get('/plugin/dt/akismet.json') diff --git a/services/wordpress/wordpress-last-update.tester.js b/services/wordpress/wordpress-last-update.tester.js index e02a0c021905f..2e2c214eac08d 100644 --- a/services/wordpress/wordpress-last-update.tester.js +++ b/services/wordpress/wordpress-last-update.tester.js @@ -1,11 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isFormattedDate} from '../test-validators.js'; -const t = new ServiceTester({ +export const t = new ServiceTester({ id: 'wordpress', title: 'WordPress Last Update', }) -export default t; t.create('Plugin Last Update') .get('/plugin/last-updated/akismet.json') diff --git a/services/wordpress/wordpress-platform-redirect.tester.js b/services/wordpress/wordpress-platform-redirect.tester.js index 91c3527fa5301..22cc78000449b 100644 --- a/services/wordpress/wordpress-platform-redirect.tester.js +++ b/services/wordpress/wordpress-platform-redirect.tester.js @@ -1,6 +1,5 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('Plugin Tested WP Version (Alias)') .get('/akismet.svg') diff --git a/services/wordpress/wordpress-platform.tester.js b/services/wordpress/wordpress-platform.tester.js index 42d394be28e4d..b388ccf88e91e 100644 --- a/services/wordpress/wordpress-platform.tester.js +++ b/services/wordpress/wordpress-platform.tester.js @@ -2,9 +2,11 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionAtLeastOne, isComposerVersion} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'WordpressPlatform', + title: 'WordPress Platform Tests', + pathPrefix: '/wordpress', +}) t.create('Plugin Required WP Version') .get('/plugin/wp-version/akismet.json') diff --git a/services/wordpress/wordpress-rating.tester.js b/services/wordpress/wordpress-rating.tester.js index bfb0daa0c9af8..b1007bffb0dc8 100644 --- a/services/wordpress/wordpress-rating.tester.js +++ b/services/wordpress/wordpress-rating.tester.js @@ -1,11 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isStarRating} from '../test-validators.js'; -const t = new ServiceTester({ +export const t = new ServiceTester({ id: 'wordpress', title: 'WordPress Rating Tests', }) -export default t; t.create('Plugin Rating - Stars') .get('/plugin/stars/akismet.json') diff --git a/services/wordpress/wordpress-version.tester.js b/services/wordpress/wordpress-version.tester.js index 94e419d7c5a5e..d999436fe01fd 100644 --- a/services/wordpress/wordpress-version.tester.js +++ b/services/wordpress/wordpress-version.tester.js @@ -1,9 +1,10 @@ import {ServiceTester} from '../tester.js'; import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -const t = (function() { - export default __a; -}()) +export const t = new ServiceTester({ + id: 'wordpress', + title: 'WordPress Version Tests', +}) t.create('Plugin Version').get('/plugin/v/akismet.json').expectBadge({ label: 'plugin', diff --git a/services/youtube/youtube-channel-views.tester.js b/services/youtube/youtube-channel-views.tester.js index 972e61dbad600..074aea55364d6 100644 --- a/services/youtube/youtube-channel-views.tester.js +++ b/services/youtube/youtube-channel-views.tester.js @@ -1,9 +1,8 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-channel-views.service'; +import _noYouTubeToken from './youtube-channel-views.service.js'; const noYouTubeToken = noToken(_noYouTubeToken); t.create('channel view count') diff --git a/services/youtube/youtube-comments.tester.js b/services/youtube/youtube-comments.tester.js index ac1f7ccbf3c80..1cb1fcf0eff90 100644 --- a/services/youtube/youtube-comments.tester.js +++ b/services/youtube/youtube-comments.tester.js @@ -1,9 +1,8 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-comments.service'; +import _noYouTubeToken from './youtube-comments.service.js'; const noYouTubeToken = noToken(_noYouTubeToken); t.create('video comment count') diff --git a/services/youtube/youtube-likes.tester.js b/services/youtube/youtube-likes.tester.js index 4e12b30a27686..ae2c5b26d152f 100644 --- a/services/youtube/youtube-likes.tester.js +++ b/services/youtube/youtube-likes.tester.js @@ -1,10 +1,9 @@ import Joi from 'joi'; -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-likes.service'; +import _noYouTubeToken from './youtube-likes.service.js'; const noYouTubeToken = noToken(_noYouTubeToken); t.create('video like count') diff --git a/services/youtube/youtube-subscribers.tester.js b/services/youtube/youtube-subscribers.tester.js index ef5f5e6d5a464..b8a8eab441dad 100644 --- a/services/youtube/youtube-subscribers.tester.js +++ b/services/youtube/youtube-subscribers.tester.js @@ -1,9 +1,8 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-subscribers.service'; +import _noYouTubeToken from './youtube-subscribers.service.js'; const noYouTubeToken = noToken(_noYouTubeToken); t.create('subscriber count') diff --git a/services/youtube/youtube-views.tester.js b/services/youtube/youtube-views.tester.js index bd1ba2b1937b1..e8ef523ee5c14 100644 --- a/services/youtube/youtube-views.tester.js +++ b/services/youtube/youtube-views.tester.js @@ -1,9 +1,8 @@ -const t = (function() { - export default __a; -}()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-views.service'; +import _noYouTubeToken from './youtube-views.service.js'; const noYouTubeToken = noToken(_noYouTubeToken); t.create('video view count') From 2a8b1e9331b2e83301158e8e80ab82cc80203b57 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 19 Jun 2021 09:39:57 +0100 Subject: [PATCH 11/46] Fix core tests --- core/base-service/base.spec.js | 5 +- core/base-service/cache-headers.spec.js | 17 ++-- core/base-service/graphql.spec.js | 4 +- .../invalid-mixed.fixture.js | 5 +- core/base-service/loader.js | 33 ++++--- core/base-service/loader.spec.js | 89 ++++++++++--------- core/legacy/regular-update.js | 8 +- core/register-chai-plugins.spec.js | 6 +- core/server/influx-metrics.spec.js | 2 +- core/server/log.js | 17 ++-- core/server/server.js | 2 +- .../bitbucket/bitbucket-pull-request.spec.js | 6 +- services/check-services.spec.js | 4 +- services/dynamic/json-path.spec.js | 4 +- services/github/auth/acceptor.js | 2 +- services/github/auth/acceptor.spec.js | 4 +- services/github/github-constellation.js | 4 +- services/pypi/pypi-helpers.spec.js | 6 +- services/pypi/pypi-python-versions.spec.js | 4 +- .../scrutinizer-coverage.service.js | 4 +- services/sonar/sonar-tests.service.js | 2 +- services/sonar/sonar-tests.spec.js | 2 +- 22 files changed, 123 insertions(+), 107 deletions(-) diff --git a/core/base-service/base.spec.js b/core/base-service/base.spec.js index 426514840e5d7..fbb3bf8b7fbc6 100644 --- a/core/base-service/base.spec.js +++ b/core/base-service/base.spec.js @@ -8,8 +8,9 @@ import trace from './trace.js'; import {NotFound, Inaccessible, InvalidResponse, InvalidParameter, Deprecated} from './errors.js'; import BaseService from './base.js'; import {MetricHelper, MetricNames} from './metric-helper.js'; -import('../register-chai-plugins.spec'); -chai.use(require('chai-as-promised')) +import '../register-chai-plugins.spec.js'; +import chaiAsPromised from 'chai-as-promised' +chai.use(chaiAsPromised) const queryParamSchema = Joi.object({ queryParamA: Joi.string(), diff --git a/core/base-service/cache-headers.spec.js b/core/base-service/cache-headers.spec.js index c6f5d6afb5c51..b0bd79021486b 100644 --- a/core/base-service/cache-headers.spec.js +++ b/core/base-service/cache-headers.spec.js @@ -1,19 +1,18 @@ 'use strict' -const { test, given } = require('sazerac') -const chai = require('chai') -const { expect } = require('chai') -const sinon = require('sinon') -const httpMocks = require('node-mocks-http') -const { +import { test, given } from 'sazerac' +import chai, {expect} from 'chai' +import sinon from 'sinon' +import httpMocks from 'node-mocks-http' +import { coalesceCacheLength, setHeadersForCacheLength, setCacheHeaders, setCacheHeadersForStaticResource, serverHasBeenUpSinceResourceCached, -} = require('./cache-headers') - -chai.use(require('chai-datetime')) +} from './cache-headers.js' +import chaiDatetime from 'chai-datetime' +chai.use(chaiDatetime) describe('Cache header functions', function () { let res diff --git a/core/base-service/graphql.spec.js b/core/base-service/graphql.spec.js index aa5adf322d3c4..f853b1fb6145d 100644 --- a/core/base-service/graphql.spec.js +++ b/core/base-service/graphql.spec.js @@ -1,9 +1,9 @@ import {expect} from 'chai'; import gql from 'graphql-tag'; -import {print} from 'graphql/language/printer'; +import {print} from 'graphql/language/printer.js'; import {mergeQueries} from './graphql.js'; -import('../register-chai-plugins.spec'); +import '../register-chai-plugins.spec.js'; describe('mergeQueries function', function () { it('merges valid gql queries', function () { diff --git a/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js b/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js index 8a35cd1d48488..25cc6a46a25c1 100644 --- a/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js @@ -1,7 +1,10 @@ import BaseJsonService from '../base-json.js'; class BadBaseService {} -class GoodService extends BaseJsonService {} +class GoodService extends BaseJsonService { + static category = 'build' + static route = { base: 'it/is', pattern: 'good' } +} class BadService extends BadBaseService {} export default [GoodService, BadService]; diff --git a/core/base-service/loader.js b/core/base-service/loader.js index 8904fb41f2df2..5b953d4483807 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -22,29 +22,28 @@ async function loadServiceClasses(servicePaths) { const serviceClasses = [] for await (const servicePath of servicePaths) { - const module = await import(`file://${servicePath}`) - - if (typeof module === 'object' && Object.keys(module).length > 0) { - Object.values(module) - .flatMap(element => typeof element === 'object' ? Object.values(element) : element) - .forEach(serviceClass => { - if (!(serviceClass.prototype instanceof BaseService)) { - throw new InvalidService( - `Expected ${servicePath} to export a service or a collection of services; one of them was ${serviceClass}` - ) - } + const currentServiceClasses = Object.values(await import(`file://${servicePath}`)) + .flatMap(element => typeof element === 'object' ? Object.values(element) : element) + + if (currentServiceClasses.length === 0) { + throw new InvalidService( + `Expected ${servicePath} to export a service or a collection of services` + ) + } + currentServiceClasses + .forEach(serviceClass => { + if (serviceClass && serviceClass.prototype instanceof BaseService) { // Decorate each service class with the directory that contains it. serviceClass.serviceFamily = servicePath .replace(serviceDir, '') .split(path.sep)[1] serviceClass.validateDefinition() return serviceClasses.push(serviceClass) - }) - } else { - throw new InvalidService( - `Expected ${servicePath} to export a service or a collection of services; got ${module}` - ) - } + } + throw new InvalidService( + `Expected ${servicePath} to export a service or a collection of services; one of them was ${serviceClass}` + ) + }) } return serviceClasses diff --git a/core/base-service/loader.spec.js b/core/base-service/loader.spec.js index 3a10e31819ee6..2b7094850b20c 100644 --- a/core/base-service/loader.spec.js +++ b/core/base-service/loader.spec.js @@ -1,57 +1,62 @@ -import {expect} from 'chai'; +import path from 'path'; +import {fileURLToPath} from 'url'; +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised' import {loadServiceClasses, InvalidService} from './loader.js'; +chai.use(chaiAsPromised) + +const { expect } = chai +const fixturesDir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'loader-test-fixtures') describe('loadServiceClasses function', function () { - it('throws if module exports empty', function () { - expect(() => - loadServiceClasses(['./loader-test-fixtures/empty-undefined.fixture.js']) - ).to.throw(InvalidService) - expect(() => - loadServiceClasses(['./loader-test-fixtures/empty-array.fixture.js']) - ).to.throw() - expect(() => - loadServiceClasses(['./loader-test-fixtures/empty-object.fixture.js']) - ).to.throw(InvalidService) - expect(() => - loadServiceClasses(['./loader-test-fixtures/empty-no-export.fixture.js']) - ).to.throw(InvalidService) - expect(() => + it('throws if module exports empty', async function () { + await expect( + loadServiceClasses([path.join(fixturesDir, 'empty-undefined.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( + loadServiceClasses([path.join(fixturesDir, 'empty-array.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( + loadServiceClasses([path.join(fixturesDir, 'empty-object.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( + loadServiceClasses([path.join(fixturesDir, 'empty-no-export.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( loadServiceClasses([ - './loader-test-fixtures/valid-array.fixture.js', - './loader-test-fixtures/valid-class.fixture.js', - './loader-test-fixtures/empty-array.fixture.js', + path.join(fixturesDir, 'valid-array.fixture.js'), + path.join(fixturesDir, 'valid-class.fixture.js'), + path.join(fixturesDir, 'empty-array.fixture.js'), ]) - ).to.throw(InvalidService) + ).to.be.rejectedWith(InvalidService) }) - it('throws if module exports invalid', function () { - expect(() => - loadServiceClasses(['./loader-test-fixtures/invalid-no-base.fixture.js']) - ).to.throw(InvalidService) - expect(() => - loadServiceClasses([ - './loader-test-fixtures/invalid-wrong-base.fixture.js', - ]) - ).to.throw(InvalidService) - expect(() => - loadServiceClasses(['./loader-test-fixtures/invalid-mixed.fixture.js']) - ).to.throw(InvalidService) - expect(() => + it('throws if module exports invalid', async function () { + await expect( + loadServiceClasses([path.join(fixturesDir, 'invalid-no-base.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( + loadServiceClasses([path.join(fixturesDir, 'invalid-wrong-base.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( + loadServiceClasses([path.join(fixturesDir, 'invalid-mixed.fixture.js')]) + ).to.be.rejectedWith(InvalidService) + await expect( loadServiceClasses([ - './loader-test-fixtures/valid-array.fixture.js', - './loader-test-fixtures/valid-class.fixture.js', - './loader-test-fixtures/invalid-no-base.fixture.js', + path.join(fixturesDir, 'valid-array.fixture.js'), + path.join(fixturesDir, 'valid-class.fixture.js'), + path.join(fixturesDir, 'invalid-no-base.fixture.js'), ]) - ).to.throw(InvalidService) + ).to.be.rejectedWith(InvalidService) }) - it('registers services if module exports valid service classes', function () { - expect( + it('registers services if module exports valid service classes', async function () { + await expect( loadServiceClasses([ - './loader-test-fixtures/valid-array.fixture.js', - './loader-test-fixtures/valid-object.fixture.js', - './loader-test-fixtures/valid-class.fixture.js', + path.join(fixturesDir, 'valid-array.fixture.js'), + path.join(fixturesDir, 'valid-object.fixture.js'), + path.join(fixturesDir, 'valid-class.fixture.js'), ]) - ).to.have.length(5) + ).to.eventually.have.length(5) }) }) diff --git a/core/legacy/regular-update.js b/core/legacy/regular-update.js index 5401838f229b4..2f040f911b1a4 100644 --- a/core/legacy/regular-update.js +++ b/core/legacy/regular-update.js @@ -1,3 +1,5 @@ +import requestModule from 'request'; +const { request } = requestModule; import {Inaccessible, InvalidResponse} from '../base-service/errors.js'; // Map from URL to { timestamp: last fetch time, data: data }. @@ -9,8 +11,8 @@ let regularUpdateCache = Object.create(null) // // To use this from a service: // -// const { promisify } = require('util') -// const { regularUpdate } = require('../../core/legacy/regular-update') +// import { promisify } from 'util' +// import { regularUpdate } from '../../core/legacy/regular-update.js' // // function getThing() { // return promisify(regularUpdate)({ @@ -30,7 +32,7 @@ function regularUpdate( json = true, scraper = buffer => buffer, options = {}, - request = require('request'), + request = requestModule, }, cb ) { diff --git a/core/register-chai-plugins.spec.js b/core/register-chai-plugins.spec.js index 4126b28366494..4680ccfb0d0ba 100644 --- a/core/register-chai-plugins.spec.js +++ b/core/register-chai-plugins.spec.js @@ -1,4 +1,6 @@ import {use} from 'chai'; -use(require('chai-string')) -use(require('sinon-chai')) +import chaiString from'chai-string' +import sinonChai from'sinon-chai' +use(chaiString) +use(sinonChai) diff --git a/core/server/influx-metrics.spec.js b/core/server/influx-metrics.spec.js index 860a37c9e5b96..f4c815b25f378 100644 --- a/core/server/influx-metrics.spec.js +++ b/core/server/influx-metrics.spec.js @@ -4,7 +4,7 @@ import sinon from 'sinon'; import {expect} from 'chai'; import log from './log.js'; import InfluxMetrics from './influx-metrics.js'; -import('../register-chai-plugins.spec'); +import '../register-chai-plugins.spec.js'; describe('Influx metrics', function () { const metricInstance = { metrics() { diff --git a/core/server/log.js b/core/server/log.js index 513cfb0125b07..a675fc1e4b053 100644 --- a/core/server/log.js +++ b/core/server/log.js @@ -22,27 +22,32 @@ function date() { ) } -export default function log(...msg) { +const log = (...msg) => { const d = date() listeners.forEach(f => f(d, ...msg)) console.log(d, ...msg) }; -export const error = function error(err) { +const error = err => { const d = date() listeners.forEach(f => f(d, err)) Sentry.captureException(err) console.error(d, err) }; -export const addListener = function addListener(func) { - listeners.push(func) -}; +const addListener = func => listeners.push(func) -export const removeListener = function removeListener(func) { +const removeListener = func => { const index = listeners.indexOf(func) if (index < 0) { return } listeners.splice(index, 1) }; + +export default { + log, + error, + addListener, + removeListener, +}; diff --git a/core/server/server.js b/core/server/server.js index 4ec75cb0b284c..fffebbd0e0a30 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -431,7 +431,7 @@ class Server { requireCloudflare, } = this.config.public - log(`Server is starting up: ${this.baseUrl}`) + log.log(`Server is starting up: ${this.baseUrl}`) const camp = (this.camp = Camp.create({ documentRoot: this.config.public.documentRoot, diff --git a/services/bitbucket/bitbucket-pull-request.spec.js b/services/bitbucket/bitbucket-pull-request.spec.js index a2a8007027956..5b085b5f97310 100644 --- a/services/bitbucket/bitbucket-pull-request.spec.js +++ b/services/bitbucket/bitbucket-pull-request.spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import nock from 'nock'; import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import {BitbucketPullRequest} from './bitbucket-pull-request.service.js'; +import {BitbucketRawPullRequests} from './bitbucket-pull-request.service.js'; describe('BitbucketPullRequest', function () { cleanUpNockAfterEach() @@ -16,7 +16,7 @@ describe('BitbucketPullRequest', function () { .reply(200, { size: 42 }) expect( - await BitbucketPullRequest.invoke( + await BitbucketRawPullRequests.invoke( defaultContext, { public: { @@ -45,7 +45,7 @@ describe('BitbucketPullRequest', function () { .reply(200, { size: 42 }) expect( - await BitbucketPullRequest.invoke( + await BitbucketRawPullRequests.invoke( defaultContext, { public: { diff --git a/services/check-services.spec.js b/services/check-services.spec.js index ca7dcf134a9b4..e99253c6d98af 100644 --- a/services/check-services.spec.js +++ b/services/check-services.spec.js @@ -3,11 +3,11 @@ import {checkNames, collectDefinitions} from '../core/base-service/loader.js'; // When these tests fail, they will throw AssertionErrors. Wrapping them in an // `expect().not.to.throw()` makes the error output unreadable. -it('Services have unique names', function () { +it('Services have unique names', async function () { this.timeout(30000) await checkNames() }) -it('Can collect the service definitions', function () { +it('Can collect the service definitions', async function () { await collectDefinitions() }) diff --git a/services/dynamic/json-path.spec.js b/services/dynamic/json-path.spec.js index 14d4894e8c9b7..4ce1af71322f4 100644 --- a/services/dynamic/json-path.spec.js +++ b/services/dynamic/json-path.spec.js @@ -1,8 +1,8 @@ import chai from 'chai'; const { expect } = chai import jsonPath from './json-path.js'; - -chai.use(require('chai-as-promised')) +import chaiAsPromised from 'chai-as-promised' +chai.use(chaiAsPromised) describe('JSON Path service factory', function () { describe('fetch()', function () { diff --git a/services/github/auth/acceptor.js b/services/github/auth/acceptor.js index 9ffb6860ea8e1..5ac3f771ac6e4 100644 --- a/services/github/auth/acceptor.js +++ b/services/github/auth/acceptor.js @@ -25,7 +25,7 @@ function setRoutes({ server, authHelper, onTokenAccepted }) { server.route(/^\/github-auth\/done$/, (data, match, end, ask) => { if (!data.code) { - log(`GitHub OAuth data: ${JSON.stringify(data)}`) + log.log(`GitHub OAuth data: ${JSON.stringify(data)}`) return end('GitHub OAuth authentication failed to provide a code.') } diff --git a/services/github/auth/acceptor.spec.js b/services/github/auth/acceptor.spec.js index bb0a2b97ae182..429ba49852923 100644 --- a/services/github/auth/acceptor.spec.js +++ b/services/github/auth/acceptor.spec.js @@ -7,7 +7,7 @@ import queryString from 'query-string'; import nock from 'nock'; import got from '../../../core/got-test-client.js'; import GithubConstellation from '../github-constellation.js'; -import acceptor from './acceptor.js'; +import {setRoutes} from './acceptor.js'; const fakeClientId = 'githubdabomb' @@ -37,7 +37,7 @@ describe('Github token acceptor', function () { let onTokenAccepted beforeEach(function () { onTokenAccepted = sinon.stub() - acceptor.setRoutes({ + setRoutes({ server: camp, authHelper: oauthHelper, onTokenAccepted, diff --git a/services/github/github-constellation.js b/services/github/github-constellation.js index 77fd4b10d8e27..6a5f0d1d0c393 100644 --- a/services/github/github-constellation.js +++ b/services/github/github-constellation.js @@ -27,7 +27,7 @@ class GithubConstellation { const { redis_url: redisUrl, gh_token: globalToken } = config.private if (redisUrl) { - log('Token persistence configured with redisUrl') + log.log('Token persistence configured with redisUrl') this.persistence = new RedisTokenPersistence({ url: redisUrl, key: 'githubUserTokens', @@ -47,7 +47,7 @@ class GithubConstellation { scheduleDebugLogging() { if (this._debugEnabled) { this.debugInterval = setInterval(() => { - log(this.apiProvider.getTokenDebugInfo()) + log.log(this.apiProvider.getTokenDebugInfo()) }, 1000 * this._debugIntervalSeconds) } } diff --git a/services/pypi/pypi-helpers.spec.js b/services/pypi/pypi-helpers.spec.js index a236489a8410f..f77f628dccf65 100644 --- a/services/pypi/pypi-helpers.spec.js +++ b/services/pypi/pypi-helpers.spec.js @@ -1,13 +1,13 @@ 'use strict' -const { test, given, forCases } = require('sazerac') -const { +import { test, given, forCases } from 'sazerac' +import { parseClassifiers, parseDjangoVersionString, sortDjangoVersions, getLicenses, getPackageFormats, -} = require('./pypi-helpers') +} from './pypi-helpers.js' const classifiersFixture = { info: { diff --git a/services/pypi/pypi-python-versions.spec.js b/services/pypi/pypi-python-versions.spec.js index 3a351e922b051..3b7595bf60717 100644 --- a/services/pypi/pypi-python-versions.spec.js +++ b/services/pypi/pypi-python-versions.spec.js @@ -1,8 +1,8 @@ import {test, given} from 'sazerac'; -import {render} from './pypi-python-versions.service.js'; +import PypiPythonVersions from './pypi-python-versions.service.js'; describe('PyPI Python Version', function () { - test(render, function () { + test(PypiPythonVersions.render, function () { // Major versions are hidden if minor are present. given({ versions: ['3', '3.4', '3.5', '3.6', '2', '2.7'] }).expect({ message: '2.7 | 3.4 | 3.5 | 3.6', diff --git a/services/scrutinizer/scrutinizer-coverage.service.js b/services/scrutinizer/scrutinizer-coverage.service.js index 1be3405078d83..0679ebeee4717 100644 --- a/services/scrutinizer/scrutinizer-coverage.service.js +++ b/services/scrutinizer/scrutinizer-coverage.service.js @@ -137,8 +137,8 @@ class ScrutinizerCoveragePlainGit extends ScrutinizerCoverageBase { } } -export default [ +export { ScrutinizerCoverage, ScrutinizerCoverageGitLab, ScrutinizerCoveragePlainGit, -]; +}; diff --git a/services/sonar/sonar-tests.service.js b/services/sonar/sonar-tests.service.js index c0383b6a326f7..1932c18b9bd9b 100644 --- a/services/sonar/sonar-tests.service.js +++ b/services/sonar/sonar-tests.service.js @@ -230,4 +230,4 @@ class SonarTests extends SonarBase { } } -export default [SonarTestsSummary, SonarTests]; +export {SonarTestsSummary, SonarTests}; diff --git a/services/sonar/sonar-tests.spec.js b/services/sonar/sonar-tests.spec.js index 26635f7b75f73..54abce8b1ecb3 100644 --- a/services/sonar/sonar-tests.spec.js +++ b/services/sonar/sonar-tests.spec.js @@ -1,5 +1,5 @@ import {test, given} from 'sazerac'; -const SonarTests = require('./sonar-tests.service')[1] +import {SonarTests} from './sonar-tests.service.js' describe('SonarTests', function () { test(SonarTests.render, () => { From 2d2f7207bef189313b6b63199d11cc33105d88c6 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 19 Jun 2021 10:03:45 +0100 Subject: [PATCH 12/46] Fix entrypoint test --- entrypoint.spec.js | 11 ++++++----- server.js | 14 ++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/entrypoint.spec.js b/entrypoint.spec.js index 0469394701571..7378ef059c682 100644 --- a/entrypoint.spec.js +++ b/entrypoint.spec.js @@ -2,20 +2,21 @@ import {expect} from 'chai'; import isSvg from 'is-svg'; import got from './core/got-test-client.js'; -let server -before(function () { - this.timeout('5s') +let serverModule +before(async function () { + this.timeout('30s') // remove args coming from mocha // https://github.com/badges/shields/issues/3365 process.argv = [] - server = require('./server') + serverModule = await import('./server.js') }) after('shut down the server', async function () { - await server.stop() + await serverModule.server.stop() }) it('should render a badge', async function () { + this.timeout('30s') const { statusCode, body } = await got( 'http://localhost:1111/badge/fruit-apple-green.svg' ) diff --git a/server.js b/server.js index 77f2e1914d564..1ca76f73cd58e 100644 --- a/server.js +++ b/server.js @@ -54,11 +54,9 @@ if (fs.existsSync(legacySecretsPath)) { import Server from './core/server/server.js'; export const server = new Server(config) -;(async () => { - try { - await server.start() - } catch (e) { - console.error(e) - process.exit(1) - } -})() +try { + await server.start() +} catch (e) { + console.error(e) + process.exit(1) +} From ad6a1fc64b09774ddc94ef5d91260c5fb53028a8 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 19 Jun 2021 10:23:01 +0100 Subject: [PATCH 13/46] Fix integration tests --- services/github/github-api-provider.integration.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/github/github-api-provider.integration.js b/services/github/github-api-provider.integration.js index 13a5ef2a55059..3bc838f9c44f5 100644 --- a/services/github/github-api-provider.integration.js +++ b/services/github/github-api-provider.integration.js @@ -1,5 +1,6 @@ import {expect} from 'chai'; import config from 'config'; +import request from 'request'; import GithubApiProvider from './github-api-provider.js'; describe('Github API provider', function () { @@ -30,7 +31,7 @@ describe('Github API provider', function () { this.timeout('20s') for (let i = 0; i < 10; ++i) { await githubApiProvider.requestAsPromise( - require('request'), + request, '/repos/rust-lang/rust', {} ) @@ -52,7 +53,7 @@ describe('Github API provider', function () { const headers = [] async function performOneRequest() { const { res } = await githubApiProvider.requestAsPromise( - require('request'), + request, '/repos/rust-lang/rust', {} ) From 7c4781da304f3c4ff7b07fd64313c77a3914f14f Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 10:46:57 +0100 Subject: [PATCH 14/46] Remove strict linting rule --- .eslintrc.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 3662cf5b3bb1f..0614f9a0134af 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -136,7 +136,6 @@ rules: # Shields additions. no-var: 'error' prefer-const: 'error' - strict: 'error' arrow-body-style: ['error', 'as-needed'] no-extension-in-require/main: 'error' object-shorthand: ['error', 'properties'] From 6295041eedb12315f1b0641b269fd08720b591cc Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 10:47:22 +0100 Subject: [PATCH 15/46] Fix Dangerfile --- dangerfile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dangerfile.js b/dangerfile.js index 6395c45e006df..45758affc1ed8 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -9,7 +9,7 @@ // DANGER_GITHUB_API_TOKEN=your-github-api-token npm run danger -- pr https://github.com/badges/shields/pull/2665 import {danger, fail, message, warn} from 'danger'; -import {default as noTestShortcuts} from 'danger-plugin-no-test-shortcuts'; +import noTestShortcuts from 'danger-plugin-no-test-shortcuts'; const { fileMatch } = danger.git const documentation = fileMatch( @@ -129,7 +129,7 @@ if (allFiles.length > 100) { ) } - if (diff.includes("require('@hapi/joi')")) { + if (diff.includes("from '@hapi/joi'")) { fail( [ `Found import of '@hapi/joi' in \`${file}\`.
`, From 6ab7cb5b779dec4d9b023d722f281b0df5362a78 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 11:01:01 +0100 Subject: [PATCH 16/46] Update documentation --- doc/TUTORIAL.md | 77 ++++++++++++++++++--------------------- doc/deprecating-badges.md | 20 ++++------ doc/service-tests.md | 8 ++-- 3 files changed, 47 insertions(+), 58 deletions(-) diff --git a/doc/TUTORIAL.md b/doc/TUTORIAL.md index 0030948092f34..1b891e74db5c2 100644 --- a/doc/TUTORIAL.md +++ b/doc/TUTORIAL.md @@ -109,19 +109,17 @@ As a first step we will look at the code for an example which generates a badge ```js // (1) -'use strict' -// (2) -const { BaseService } = require('..') +import { BaseService } from '../index.js' -// (3) -module.exports = class Example extends BaseService { - // (4) +// (2) +export default class Example extends BaseService { + // (3) static category = 'build' - // (5) + // (4) static route = { base: 'example', pattern: ':text' } - // (6) + // (5) async handle({ text }) { return { label: 'example', @@ -134,18 +132,17 @@ module.exports = class Example extends BaseService { Description of the code: -1. We declare strict mode at the start of each file. This prevents certain classes of error such as undeclared variables. -2. Our service badge class will extend `BaseService` so we need to require it. Variables are declared with `const` and `let` in preference to `var`. -3. Our module must export a class which extends `BaseService`. -4. Returns the name of the category to sort this badge into (eg. "build"). Used to sort the examples on the main [shields.io](https://shields.io) website. [Here](https://github.com/badges/shields/blob/master/services/categories.js) is the list of the valid categories. See [section 4.4](#44-adding-an-example-to-the-front-page) for more details on examples. -5. `route()` declares the URL path at which the service operates. It also maps components of the URL path to handler parameters. +1. Our service badge class will extend `BaseService` so we need to require it. Variables are declared with `const` and `let` in preference to `var`. +2. Our module must export a class which extends `BaseService`. +3. Returns the name of the category to sort this badge into (eg. "build"). Used to sort the examples on the main [shields.io](https://shields.io) website. [Here](https://github.com/badges/shields/blob/master/services/categories.js) is the list of the valid categories. See [section 4.4](#44-adding-an-example-to-the-front-page) for more details on examples. +4. `route()` declares the URL path at which the service operates. It also maps components of the URL path to handler parameters. - `base` defines the first part of the URL that doesn't change, e.g. `/example/`. - `pattern` defines the variable part of the route, everything that comes after `/example/`. It can include any number of named parameters. These are converted into regular expressions by [`path-to-regexp`][path-to-regexp]. Because a service instance won't be created until it's time to handle a request, the route and other metadata must be obtained by examining the classes themselves. [That's why they're marked `static`.][static] - There is additional documentation on conventions for [designing badge URLs](./badge-urls.md) -6. All badges must implement the `async handle()` function that receives parameters to render the badge. Parameters of `handle()` will match the name defined in `route()` Because we're capturing a single variable called `text` our function signature is `async handle({ text })`. `async` is needed to let JavaScript do other things while we are waiting for result from external API. Although in this simple case, we don't make any external calls. Our `handle()` function should return an object with 3 properties: +5. All badges must implement the `async handle()` function that receives parameters to render the badge. Parameters of `handle()` will match the name defined in `route()` Because we're capturing a single variable called `text` our function signature is `async handle({ text })`. `async` is needed to let JavaScript do other things while we are waiting for result from external API. Although in this simple case, we don't make any external calls. Our `handle()` function should return an object with 3 properties: - `label`: the text on the left side of the badge - `message`: the text on the right side of the badge - here we are passing through the parameter we captured in the route regex - `color`: the background color of the right side of the badge @@ -171,36 +168,33 @@ This example is based on the [Ruby Gems version](https://github.com/badges/shiel ```js // (1) -'use strict' - +import { renderVersionBadge } from '../version.js' // (2) -const { renderVersionBadge } = require('..//version') -// (3) -const { BaseJsonService } = require('..') +import { BaseJsonService } from '../index.js' -// (4) -const Joi = require('joi') +// (3) +import Joi from 'joi' const schema = Joi.object({ version: Joi.string().required(), }).required() -// (5) -module.exports = class GemVersion extends BaseJsonService { - // (6) +// (4) +export default class GemVersion extends BaseJsonService { + // (5) static category = 'version' - // (7) + // (6) static route = { base: 'gem/v', pattern: ':gem' } - // (8) + // (7) static defaultBadgeData = { label: 'gem' } - // (11) + // (10) static render({ version }) { return renderVersionBadge({ version }) } - // (10) + // (9) async fetch({ gem }) { return this._requestJson({ schema, @@ -208,7 +202,7 @@ module.exports = class GemVersion extends BaseJsonService { }) } - // (9) + // (8) async handle({ gem }) { const { version } = await this.fetch({ gem }) return this.constructor.render({ version }) @@ -218,21 +212,20 @@ module.exports = class GemVersion extends BaseJsonService { Description of the code: -1. As with the first example, we declare strict mode at the start of each file. -2. In this case we are making a version badge, which is a common pattern. Instead of directly returning an object in this badge we will use a helper function to format our data consistently. There are a variety of helper functions to help with common tasks in `/services`. Some useful generic helpers can be found in: +1. In this case we are making a version badge, which is a common pattern. Instead of directly returning an object in this badge we will use a helper function to format our data consistently. There are a variety of helper functions to help with common tasks in `/services`. Some useful generic helpers can be found in: - [build-status.js](https://github.com/badges/shields/blob/master/services/build-status.js) - [color-formatters.js](https://github.com/badges/shields/blob/master/services/color-formatters.js) - [licenses.js](https://github.com/badges/shields/blob/master/services/licenses.js) - [text-formatters.js](https://github.com/badges/shields/blob/master/services/text-formatters.js) - [version.js](https://github.com/badges/shields/blob/master/services/version.js) -3. Our badge will query a JSON API so we will extend `BaseJsonService` instead of `BaseService`. This contains some helpers to reduce the need for boilerplate when calling a JSON API. -4. We perform input validation by defining a schema which we expect the JSON we receive to conform to. This is done using [Joi](https://github.com/hapijs/joi). Defining a schema means we can ensure the JSON we receive meets our expectations and throw an error if we receive unexpected input without having to explicitly code validation checks. The schema also acts as a filter on the JSON object. Any properties we're going to reference need to be validated, otherwise they will be filtered out. In this case our schema declares that we expect to receive an object which must have a property called 'version', which is a string. There is further documentation on [input validation](input-validation.md). -5. Our module exports a class which extends `BaseJsonService` -6. Returns the name of the category to sort this badge into (eg. "build"). Used to sort the examples on the main [shields.io](https://shields.io) website. [Here](https://github.com/badges/shields/blob/master/services/categories.js) is the list of the valid categories. See [section 4.4](#44-adding-an-example-to-the-front-page) for more details on examples. -7. As with our previous badge, we need to declare a route. This time we will capture a variable called `gem`. -8. We can use `defaultBadgeData()` to set a default `color`, `logo` and/or `label`. If `handle()` doesn't return any of these keys, we'll use the default. Instead of explicitly setting the label text when we return a badge object, we'll use `defaultBadgeData()` here to define it declaratively. -9. We now jump to the bottom of the example code to the function all badges must implement: `async handle()`. This is the function the server will invoke to handle an incoming request. Because our URL pattern captures a variable called `gem`, our function signature is `async handle({ gem })`. We usually separate the process of generating a badge into 2 stages or concerns: fetch and render. The `fetch()` function is responsible for calling an API endpoint to get data. The `render()` function formats the data for display. In a case where there is a lot of calculation or intermediate steps, this pattern may be thought of as fetch, transform, render and it might be necessary to define some helper functions to assist with the 'transform' step. -10. Working our way upward, the `async fetch()` method is responsible for calling an API endpoint to get data. Extending `BaseJsonService` gives us the helper function `_requestJson()`. Note here that we pass the schema we defined in step 4 as an argument. `_requestJson()` will deal with validating the response against the schema and throwing an error if necessary. +2. Our badge will query a JSON API so we will extend `BaseJsonService` instead of `BaseService`. This contains some helpers to reduce the need for boilerplate when calling a JSON API. +3. We perform input validation by defining a schema which we expect the JSON we receive to conform to. This is done using [Joi](https://github.com/hapijs/joi). Defining a schema means we can ensure the JSON we receive meets our expectations and throw an error if we receive unexpected input without having to explicitly code validation checks. The schema also acts as a filter on the JSON object. Any properties we're going to reference need to be validated, otherwise they will be filtered out. In this case our schema declares that we expect to receive an object which must have a property called 'version', which is a string. There is further documentation on [input validation](input-validation.md). +4. Our module exports a class which extends `BaseJsonService` +5. Returns the name of the category to sort this badge into (eg. "build"). Used to sort the examples on the main [shields.io](https://shields.io) website. [Here](https://github.com/badges/shields/blob/master/services/categories.js) is the list of the valid categories. See [section 4.4](#44-adding-an-example-to-the-front-page) for more details on examples. +6. As with our previous badge, we need to declare a route. This time we will capture a variable called `gem`. +7. We can use `defaultBadgeData()` to set a default `color`, `logo` and/or `label`. If `handle()` doesn't return any of these keys, we'll use the default. Instead of explicitly setting the label text when we return a badge object, we'll use `defaultBadgeData()` here to define it declaratively. +8. We now jump to the bottom of the example code to the function all badges must implement: `async handle()`. This is the function the server will invoke to handle an incoming request. Because our URL pattern captures a variable called `gem`, our function signature is `async handle({ gem })`. We usually separate the process of generating a badge into 2 stages or concerns: fetch and render. The `fetch()` function is responsible for calling an API endpoint to get data. The `render()` function formats the data for display. In a case where there is a lot of calculation or intermediate steps, this pattern may be thought of as fetch, transform, render and it might be necessary to define some helper functions to assist with the 'transform' step. +9. Working our way upward, the `async fetch()` method is responsible for calling an API endpoint to get data. Extending `BaseJsonService` gives us the helper function `_requestJson()`. Note here that we pass the schema we defined in step 4 as an argument. `_requestJson()` will deal with validating the response against the schema and throwing an error if necessary. - `_requestJson()` automatically adds an Accept header, checks the status code, parses the response as JSON, and returns the parsed response. - `_requestJson()` uses [request](https://github.com/request/request) to perform the HTTP request. Options can be passed to request, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `request` docs for [supported options](https://github.com/request/request#requestoptions-callback). @@ -250,7 +243,7 @@ Description of the code: }) ``` -11. Upward still, the `static render()` method is responsible for formatting the data for display. `render()` is a pure function so we can make it a `static` method. By convention we declare functions which don't reference `this` as `static`. We could explicitly return an object here, as we did in the previous example. In this case, we will hand the version string off to `renderVersionBadge()` which will format it consistently and set an appropriate color. Because `renderVersionBadge()` doesn't return a `label` key, the default label we defined in `defaultBadgeData()` will be used when we generate the badge. +10. Upward still, the `static render()` method is responsible for formatting the data for display. `render()` is a pure function so we can make it a `static` method. By convention we declare functions which don't reference `this` as `static`. We could explicitly return an object here, as we did in the previous example. In this case, we will hand the version string off to `renderVersionBadge()` which will format it consistently and set an appropriate color. Because `renderVersionBadge()` doesn't return a `label` key, the default label we defined in `defaultBadgeData()` will be used when we generate the badge. This code allows us to call this URL to generate this badge: ![](https://img.shields.io/gem/v/formatador) @@ -269,7 +262,7 @@ non-standard error condition. If so, there are several standard exceptions that and can be imported via the import shortcut and then thrown: ```js -const { NotFound } = require('..') +import { NotFound } from '../index.js' throw new NotFound({ prettyMessage: 'package not found' }) ``` @@ -279,7 +272,7 @@ throw new NotFound({ prettyMessage: 'package not found' }) Once we have implemented our badge, we can add it to the index so that users can discover it. We will do this by adding an additional method `examples()` to our class. ```js -module.exports = class GemVersion extends BaseJsonService { +export default class GemVersion extends BaseJsonService { // ... // (1) diff --git a/doc/deprecating-badges.md b/doc/deprecating-badges.md index 353b56de6b5a6..1278fde64448a 100644 --- a/doc/deprecating-badges.md +++ b/doc/deprecating-badges.md @@ -14,11 +14,9 @@ Locate the source file(s) for the service, which can be found in `*.service.js` Replace the existing service class implementation with the `DeprecatedService` class from `./core/base-service/deprecated-service.js` using the respective `category`, `route`, and `label` values for that service. For example: ```js -'use strict' +import {deprecatedService} from '../index.js' -const { deprecatedService } = require('..') - -module.exports = deprecatedService({ +export default deprecatedService({ category: 'size', route: { base: 'imagelayers', @@ -36,12 +34,12 @@ Locate the test file(s) for the service, which can be found in `*.tester.js` fil With `DeprecatedService` classes we cannot use `createServiceTester()` so you will need to create the `ServiceTester` class directly. For example: ```js -const { ServiceTester } = require('../tester') +import { ServiceTester } from '../tester.js'; -const t = (module.exports = new ServiceTester({ +export const t = new ServiceTester({ id: 'imagelayers', title: 'ImageLayers', -})) +}) ``` Next you will need to replace/refactor the existing tests to validate the new deprecated badge behavior for this service. Deprecated badges always return a message of `no longer available` (such as `imagelayers | no longer available`) so the tests need to be updated to reflect that message value. For example: @@ -60,14 +58,12 @@ Make sure to have a live (non-mocked) test for each badge the service provides t Here is an example of what the final result would look like for a test file: ```js -'use strict' +import { ServiceTester } from '../tester.js'; -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ +export const t = new ServiceTester({ id: 'imagelayers', title: 'ImageLayers', -})) +}) t.create('no longer available (previously image size)') .get('/image-size/_/ubuntu/latest.json') diff --git a/doc/service-tests.md b/doc/service-tests.md index a7816e7c18c36..0a332806bc9e6 100644 --- a/doc/service-tests.md +++ b/doc/service-tests.md @@ -33,13 +33,13 @@ The code for our badge is in `services/wercker/wercker.service.js`. Tests for th We'll start by adding some boilerplate to our file: ```js -'use strict' +import { createServiceTester } from '../tester.js' -const t = (module.exports = require('../tester').createServiceTester()) +export const t = await createServiceTester() ``` If our `.service.js` module exports a single class, we can -`require('../tester').createServiceTester()`, which uses convention to create a +`createServiceTester`, which uses convention to create a `ServiceTester` object. Calling this inside `services/wercker/wercker.tester.js` will create a `ServiceTester` object configured for the service exported in `services/wercker/wercker.service.js`. @@ -51,7 +51,7 @@ from the module. First we'll add a test for the typical case: ```js -const { isBuildStatus } = require('../test-validators') +import { isBuildStatus } from '../test-validators.js' t.create('Build status') .get('/build/wercker/go-wercker-api.json') From b0de9ebf89fc42384ac2925b63b6485951111463 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 11:02:50 +0100 Subject: [PATCH 17/46] Remove remaining 'use strict' --- core/base-service/cache-headers.spec.js | 2 -- .../loader-test-fixtures/empty-no-export.fixture.js | 2 -- core/unhandled-rejection.spec.js | 2 -- cypress/integration/main-page.spec.js | 2 -- scripts/export-supported-features-cli.js | 2 -- services/pypi/pypi-helpers.spec.js | 2 -- 6 files changed, 12 deletions(-) diff --git a/core/base-service/cache-headers.spec.js b/core/base-service/cache-headers.spec.js index b0bd79021486b..a4489694a1170 100644 --- a/core/base-service/cache-headers.spec.js +++ b/core/base-service/cache-headers.spec.js @@ -1,5 +1,3 @@ -'use strict' - import { test, given } from 'sazerac' import chai, {expect} from 'chai' import sinon from 'sinon' diff --git a/core/base-service/loader-test-fixtures/empty-no-export.fixture.js b/core/base-service/loader-test-fixtures/empty-no-export.fixture.js index 883cb52b674f6..3d846dd7f22cf 100644 --- a/core/base-service/loader-test-fixtures/empty-no-export.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-no-export.fixture.js @@ -1,4 +1,2 @@ /* eslint-disable */ -'use strict' - class BadService {} diff --git a/core/unhandled-rejection.spec.js b/core/unhandled-rejection.spec.js index b155793b9b04f..17c42ac09beb1 100644 --- a/core/unhandled-rejection.spec.js +++ b/core/unhandled-rejection.spec.js @@ -1,5 +1,3 @@ -'use strict' - // Cause unhandled promise rejections to fail unit tests, and print with stack // traces. process.on('unhandledRejection', error => { diff --git a/cypress/integration/main-page.spec.js b/cypress/integration/main-page.spec.js index 412c50e37584e..009371ecffb80 100644 --- a/cypress/integration/main-page.spec.js +++ b/cypress/integration/main-page.spec.js @@ -1,5 +1,3 @@ -'use strict' - describe('Main page', function () { const backendUrl = Cypress.env('backend_url') const SEARCH_INPUT = 'input[placeholder="search / project URL"]' diff --git a/scripts/export-supported-features-cli.js b/scripts/export-supported-features-cli.js index 004918bd06bd1..bf84d46ea8d56 100644 --- a/scripts/export-supported-features-cli.js +++ b/scripts/export-supported-features-cli.js @@ -1,5 +1,3 @@ -'use strict' - import loadLogos from '../lib/load-logos.js' import loadSimpleIcons from '../lib/load-simple-icons.js' const shieldsLogos = Object.keys(loadLogos()) diff --git a/services/pypi/pypi-helpers.spec.js b/services/pypi/pypi-helpers.spec.js index f77f628dccf65..eca6fed39b4b4 100644 --- a/services/pypi/pypi-helpers.spec.js +++ b/services/pypi/pypi-helpers.spec.js @@ -1,5 +1,3 @@ -'use strict' - import { test, given, forCases } from 'sazerac' import { parseClassifiers, From 626ffa52d5164750de0b30c6d33e33655ee7a42a Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 12:02:58 +0100 Subject: [PATCH 18/46] Fix new gradle-plugin-portal service --- .../gradle-plugin-portal/gradle-plugin-portal.service.js | 6 ++---- .../gradle-plugin-portal/gradle-plugin-portal.tester.js | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/services/gradle-plugin-portal/gradle-plugin-portal.service.js b/services/gradle-plugin-portal/gradle-plugin-portal.service.js index 25f82e9307bae..cb09d3ddea837 100644 --- a/services/gradle-plugin-portal/gradle-plugin-portal.service.js +++ b/services/gradle-plugin-portal/gradle-plugin-portal.service.js @@ -1,8 +1,6 @@ -'use strict' +import { redirector } from '../index.js' -const { redirector } = require('..') - -module.exports = redirector({ +export default redirector({ category: 'version', isDeprecated: false, route: { diff --git a/services/gradle-plugin-portal/gradle-plugin-portal.tester.js b/services/gradle-plugin-portal/gradle-plugin-portal.tester.js index 6de2421c8bbe1..8614b81f66461 100644 --- a/services/gradle-plugin-portal/gradle-plugin-portal.tester.js +++ b/services/gradle-plugin-portal/gradle-plugin-portal.tester.js @@ -1,6 +1,5 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +import {createServiceTester} from '../tester.js' +export const t = await createServiceTester() t.create('gradle plugin portal') .get('/com.gradle.plugin-publish') From fabf736c7393fd5c1a916ec6a0994b9f330f92ae Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 12:23:01 +0100 Subject: [PATCH 19/46] Fix Gatsby files --- gatsby-config.js | 54 +++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index 004940a49d31b..ea9abec5f6309 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,32 +1,30 @@ import path from 'path'; import {fileURLToPath} from 'url' -export { - siteMetadata: { - title: 'Shields.io: Quality metadata badges for open source projects', - description: - 'We serve fast and scalable informational images as badges for GitHub, Travis CI, Jenkins, WordPress and many more services. Use them to track the state of your projects, or for promotional purposes.', - author: '@shields_io', - }, - plugins: [ - { - resolve: 'gatsby-plugin-page-creator', - options: { - path: path.join(path.dirname(fileURLToPath(import.meta.url)), 'frontend', 'pages'), - }, +export const siteMetadata = { + title: 'Shields.io: Quality metadata badges for open source projects', + description: + 'We serve fast and scalable informational images as badges for GitHub, Travis CI, Jenkins, WordPress and many more services. Use them to track the state of your projects, or for promotional purposes.', + author: '@shields_io', +} +export const plugins = [ + { + resolve: 'gatsby-plugin-page-creator', + options: { + path: path.join(path.dirname(fileURLToPath(import.meta.url)), 'frontend', 'pages'), }, - 'gatsby-plugin-react-helmet', - 'gatsby-plugin-catch-links', - 'gatsby-plugin-styled-components', - 'gatsby-plugin-remove-trailing-slashes', - 'gatsby-plugin-typescript', - // This currently is not being used. - // { - // resolve: 'gatsby-source-filesystem', - // options: { - // name: 'static', - // path: `${path.dirname(fileURLToPath(import.meta.url))}/frontend/static`, - // }, - // }, - ], -}; + }, + 'gatsby-plugin-react-helmet', + 'gatsby-plugin-catch-links', + 'gatsby-plugin-styled-components', + 'gatsby-plugin-remove-trailing-slashes', + 'gatsby-plugin-typescript', + // This currently is not being used. + // { + // resolve: 'gatsby-source-filesystem', + // options: { + // name: 'static', + // path: `${path.dirname(fileURLToPath(import.meta.url))}/frontend/static`, + // }, + // }, +] From 17bd0a667513fafcda5e21de5591a9354cd2a561 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 12:26:50 +0100 Subject: [PATCH 20/46] Fix linting issues --- core/base-service/base.spec.js | 4 ++-- core/base-service/cache-headers.spec.js | 2 +- core/legacy/regular-update.js | 1 - core/register-chai-plugins.spec.js | 1 - core/server/server.js | 2 +- core/service-test-runner/service-tester.js | 4 ++-- scripts/redis-connectivity-test.js | 2 +- server.js | 6 +++--- services/ansible/ansible-role.tester.js | 1 - services/bit/bit-components.tester.js | 2 +- services/codacy/codacy-grade.tester.js | 2 +- services/codefactor/codefactor-grade.tester.js | 2 +- services/conda/conda-platform.tester.js | 2 +- services/criterion/criterion.tester.js | 2 +- services/docker/docker-automated.tester.js | 2 +- services/docker/docker-cloud-automated.tester.js | 2 +- services/docker/docker-cloud-build.tester.js | 2 +- services/docker/docker-helpers.js | 4 ++-- services/docker/docker-pulls.tester.js | 2 +- services/docker/docker-stars.tester.js | 2 +- services/dynamic/dynamic-xml.tester.js | 2 +- services/dynamic/json-path.spec.js | 4 ++-- services/ecologi/ecologi-carbon.tester.js | 2 +- services/ecologi/ecologi-trees.tester.js | 2 +- services/github/github-all-contributors.tester.js | 2 +- services/github/github-checks-status.tester.js | 2 +- services/github/github-contributors.tester.js | 2 +- services/homebrew/homebrew-downloads.tester.js | 2 +- services/hsts/hsts.service.js | 2 +- services/jira/jira-sprint.tester.js | 2 +- services/lgtm/lgtm-alerts.tester.js | 2 +- services/lgtm/lgtm-grade.tester.js | 2 +- services/liberapay/liberapay-gives.tester.js | 2 +- services/liberapay/liberapay-receives.tester.js | 2 +- services/localizely/localizely.tester.js | 2 +- services/maven-metadata/maven-metadata.tester.js | 2 +- services/node/node-current.tester.js | 4 ++-- services/node/node-lts.tester.js | 4 ++-- services/nodeping/nodeping-uptime.tester.js | 2 +- services/open-vsx/open-vsx-downloads.tester.js | 2 +- services/open-vsx/open-vsx-rating.tester.js | 2 +- services/open-vsx/open-vsx-release-date.tester.js | 2 +- services/open-vsx/open-vsx-version.tester.js | 2 +- services/ore/ore-sponge-versions.tester.js | 2 +- services/pypi/pypi-downloads.tester.js | 2 +- services/pypi/pypi-version.tester.js | 2 +- services/repology/repology-repositories.tester.js | 2 +- services/reuse/reuse-compliance.tester.js | 2 +- services/snyk/snyk-vulnerability-github.tester.js | 2 +- services/snyk/snyk-vulnerability-npm.tester.js | 2 +- services/sonar/sonar-coverage.tester.js | 2 +- services/sonar/sonar-tests.tester.js | 2 +- services/swagger/swagger.tester.js | 4 ++-- services/symfony/symfony-insight-grade.tester.js | 2 +- services/symfony/symfony-insight-stars.tester.js | 2 +- services/symfony/symfony-insight-violations.tester.js | 2 +- services/symfony/symfony-test-helpers.js | 6 +++--- services/test-helpers.js | 2 +- services/testspace/testspace-test-count.tester.js | 2 +- services/testspace/testspace-test-pass-ratio.tester.js | 2 +- services/testspace/testspace-test-summary.tester.js | 2 +- services/treeware/treeware-trees.tester.js | 2 +- .../visual-studio-app-center-releases-size.tester.js | 2 +- ...isual-studio-marketplace-azure-devops-installs.tester.js | 2 +- .../visual-studio-marketplace-downloads.tester.js | 2 +- .../visual-studio-marketplace-last-updated.tester.js | 2 +- .../visual-studio-marketplace-rating.tester.js | 2 +- .../visual-studio-marketplace-release-date.tester.js | 2 +- .../visual-studio-marketplace-version.tester.js | 2 +- services/wheelmap/wheelmap.tester.js | 2 +- services/youtube/youtube-channel-views.tester.js | 2 +- services/youtube/youtube-comments.tester.js | 2 +- services/youtube/youtube-likes.tester.js | 2 +- services/youtube/youtube-subscribers.tester.js | 2 +- services/youtube/youtube-views.tester.js | 2 +- 75 files changed, 83 insertions(+), 86 deletions(-) diff --git a/core/base-service/base.spec.js b/core/base-service/base.spec.js index fbb3bf8b7fbc6..fad084a735e40 100644 --- a/core/base-service/base.spec.js +++ b/core/base-service/base.spec.js @@ -1,15 +1,15 @@ import Joi from 'joi'; import chai from 'chai'; -const { expect } = chai import sinon from 'sinon'; import prometheus from 'prom-client'; +import chaiAsPromised from 'chai-as-promised' import PrometheusMetrics from '../server/prometheus-metrics.js'; import trace from './trace.js'; import {NotFound, Inaccessible, InvalidResponse, InvalidParameter, Deprecated} from './errors.js'; import BaseService from './base.js'; import {MetricHelper, MetricNames} from './metric-helper.js'; import '../register-chai-plugins.spec.js'; -import chaiAsPromised from 'chai-as-promised' +const { expect } = chai chai.use(chaiAsPromised) const queryParamSchema = Joi.object({ diff --git a/core/base-service/cache-headers.spec.js b/core/base-service/cache-headers.spec.js index a4489694a1170..e23d715ee0076 100644 --- a/core/base-service/cache-headers.spec.js +++ b/core/base-service/cache-headers.spec.js @@ -2,6 +2,7 @@ import { test, given } from 'sazerac' import chai, {expect} from 'chai' import sinon from 'sinon' import httpMocks from 'node-mocks-http' +import chaiDatetime from 'chai-datetime' import { coalesceCacheLength, setHeadersForCacheLength, @@ -9,7 +10,6 @@ import { setCacheHeadersForStaticResource, serverHasBeenUpSinceResourceCached, } from './cache-headers.js' -import chaiDatetime from 'chai-datetime' chai.use(chaiDatetime) describe('Cache header functions', function () { diff --git a/core/legacy/regular-update.js b/core/legacy/regular-update.js index 2f040f911b1a4..314333a38d8ce 100644 --- a/core/legacy/regular-update.js +++ b/core/legacy/regular-update.js @@ -1,5 +1,4 @@ import requestModule from 'request'; -const { request } = requestModule; import {Inaccessible, InvalidResponse} from '../base-service/errors.js'; // Map from URL to { timestamp: last fetch time, data: data }. diff --git a/core/register-chai-plugins.spec.js b/core/register-chai-plugins.spec.js index 4680ccfb0d0ba..77d3df348cb60 100644 --- a/core/register-chai-plugins.spec.js +++ b/core/register-chai-plugins.spec.js @@ -1,5 +1,4 @@ import {use} from 'chai'; - import chaiString from'chai-string' import sinonChai from'sinon-chai' use(chaiString) diff --git a/core/server/server.js b/core/server/server.js index fffebbd0e0a30..952ee3484ae44 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -4,7 +4,6 @@ import path from 'path'; import url, {fileURLToPath} from 'url'; -const { URL } = url import cloudflareMiddleware from 'cloudflare-middleware'; import bytes from 'bytes'; import Camp from '@shields_io/camp'; @@ -21,6 +20,7 @@ import {nonNegativeInteger} from '../../services/validators.js'; import log from './log.js'; import PrometheusMetrics from './prometheus-metrics.js'; import InfluxMetrics from './influx-metrics.js'; +const { URL } = url const Joi = originalJoi .extend(base => ({ diff --git a/core/service-test-runner/service-tester.js b/core/service-test-runner/service-tester.js index 410debc241268..73f20301e6faf 100644 --- a/core/service-test-runner/service-tester.js +++ b/core/service-test-runner/service-tester.js @@ -3,10 +3,10 @@ */ import emojic from 'emojic'; -import trace from '../base-service/trace.js'; -import icedfrisbyShieldsModule from './icedfrisby-shields.js' import icedfrisbyNockModule from 'icedfrisby-nock' import icedfrisbyModule from 'icedfrisby' +import trace from '../base-service/trace.js'; +import icedfrisbyShieldsModule from './icedfrisby-shields.js' const frisby = icedfrisbyShieldsModule(icedfrisbyNockModule(icedfrisbyModule)) /** diff --git a/scripts/redis-connectivity-test.js b/scripts/redis-connectivity-test.js index f2849ad17cb36..c5726c31f9cc5 100644 --- a/scripts/redis-connectivity-test.js +++ b/scripts/redis-connectivity-test.js @@ -1,7 +1,7 @@ import config from 'config'; +import GithubConstellation from '../services/github/github-constellation.js'; const objectConfig = config.util.toObject() console.log(objectConfig) -import GithubConstellation from '../services/github/github-constellation.js'; const { persistence } = new GithubConstellation({ service: objectConfig.public.services.github, diff --git a/server.js b/server.js index 1ca76f73cd58e..1754f8e93d35e 100644 --- a/server.js +++ b/server.js @@ -6,8 +6,10 @@ import {fileURLToPath} from 'url' // Set up Sentry reporting as early in the process as possible. import configModule from 'config'; -const config = configModule.util.toObject() import Sentry from '@sentry/node'; + +import Server from './core/server/server.js'; +const config = configModule.util.toObject() const disabledIntegrations = ['Console', 'Http'] Sentry.init({ dsn: process.env.SENTRY_DSN || config.private.sentry_dsn, @@ -50,8 +52,6 @@ if (fs.existsSync(legacySecretsPath)) { ) process.exit(1) } - -import Server from './core/server/server.js'; export const server = new Server(config) try { diff --git a/services/ansible/ansible-role.tester.js b/services/ansible/ansible-role.tester.js index c9d72ee963d7f..4ab60f330efd2 100644 --- a/services/ansible/ansible-role.tester.js +++ b/services/ansible/ansible-role.tester.js @@ -1,5 +1,4 @@ import {isMetric} from '../test-validators.js'; - import {ServiceTester} from '../tester.js' export const t = new ServiceTester({ id: 'AnsibleRole', diff --git a/services/bit/bit-components.tester.js b/services/bit/bit-components.tester.js index ac8cc82cc84c5..64363242b2851 100644 --- a/services/bit/bit-components.tester.js +++ b/services/bit/bit-components.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() t.create('collection (valid)').get('/ramda/ramda.json').expectBadge({ label: 'components', diff --git a/services/codacy/codacy-grade.tester.js b/services/codacy/codacy-grade.tester.js index c690bce2d8145..6c7081600f965 100644 --- a/services/codacy/codacy-grade.tester.js +++ b/services/codacy/codacy-grade.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {codacyGrade} from './codacy-helpers.js'; +export const t = await createServiceTester() t.create('Code quality') .get('/e27821fb6289410b8f58338c7e0bc686.json') diff --git a/services/codefactor/codefactor-grade.tester.js b/services/codefactor/codefactor-grade.tester.js index 567750f797e69..ebec37cf2c169 100644 --- a/services/codefactor/codefactor-grade.tester.js +++ b/services/codefactor/codefactor-grade.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isValidGrade} from './codefactor-helpers.js'; +export const t = await createServiceTester() t.create('Grade').get('/github/google/guava.json').expectBadge({ label: 'code quality', diff --git a/services/conda/conda-platform.tester.js b/services/conda/conda-platform.tester.js index 973a5c100dcce..65d20b2c90df2 100644 --- a/services/conda/conda-platform.tester.js +++ b/services/conda/conda-platform.tester.js @@ -1,6 +1,6 @@ import Joi from 'joi'; -const isCondaPlatform = Joi.string().regex(/^\w+-[\w\d]+( \| \w+-[\w\d]+)*$/) import {createServiceTester} from '../tester.js' +const isCondaPlatform = Joi.string().regex(/^\w+-[\w\d]+( \| \w+-[\w\d]+)*$/) export const t = await createServiceTester() t.create('platform').get('/p/conda-forge/zlib.json').expectBadge({ diff --git a/services/criterion/criterion.tester.js b/services/criterion/criterion.tester.js index a698aef879f74..f031ab82463de 100644 --- a/services/criterion/criterion.tester.js +++ b/services/criterion/criterion.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {IMPROVED_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS, NOT_FOUND_STATUS} from './constants.js'; +export const t = await createServiceTester() const isStatus = Joi.string() .allow(IMPROVED_STATUS, REGRESSED_STATUS, NOT_FOUND_STATUS, NO_CHANGE_STATUS) diff --git a/services/docker/docker-automated.tester.js b/services/docker/docker-automated.tester.js index f242fb923759a..b85272b37be21 100644 --- a/services/docker/docker-automated.tester.js +++ b/services/docker/docker-automated.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; +export const t = await createServiceTester() const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-cloud-automated.tester.js b/services/docker/docker-cloud-automated.tester.js index c77d5fa27306c..da9fae0b0baae 100644 --- a/services/docker/docker-cloud-automated.tester.js +++ b/services/docker/docker-cloud-automated.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; +export const t = await createServiceTester() const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-cloud-build.tester.js b/services/docker/docker-cloud-build.tester.js index 95db5f8c88d1c..e7147a9dbbc47 100644 --- a/services/docker/docker-cloud-build.tester.js +++ b/services/docker/docker-cloud-build.tester.js @@ -1,7 +1,7 @@ import {isBuildStatus} from '../build-status.js'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; +export const t = await createServiceTester() t.create('docker cloud build status (valid, user)') .get('/jrottenberg/ffmpeg.json') diff --git a/services/docker/docker-helpers.js b/services/docker/docker-helpers.js index be353c80c1bd5..59b56d97d4424 100644 --- a/services/docker/docker-helpers.js +++ b/services/docker/docker-helpers.js @@ -1,5 +1,5 @@ -const dockerBlue = '066da5' // see https://github.com/badges/shields/pull/1690 -import {NotFound} from '../index.js'; +// see https://github.com/badges/shields/pull/1690 +import {NotFound} from '../index.js'; const dockerBlue = '066da5' function buildDockerUrl(badgeName, includeTagRoute) { if (includeTagRoute) { diff --git a/services/docker/docker-pulls.tester.js b/services/docker/docker-pulls.tester.js index ff6e867bf222f..3d670073325fe 100644 --- a/services/docker/docker-pulls.tester.js +++ b/services/docker/docker-pulls.tester.js @@ -1,7 +1,7 @@ import {isMetric} from '../test-validators.js'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; +export const t = await createServiceTester() t.create('docker pulls (valid, library)') .get('/_/ubuntu.json') diff --git a/services/docker/docker-stars.tester.js b/services/docker/docker-stars.tester.js index 8c92998194e3d..6390e71e4ca77 100644 --- a/services/docker/docker-stars.tester.js +++ b/services/docker/docker-stars.tester.js @@ -1,7 +1,7 @@ import {isMetric} from '../test-validators.js'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {dockerBlue} from './docker-helpers.js'; +export const t = await createServiceTester() t.create('docker stars (valid, library)') .get('/_/ubuntu.json') diff --git a/services/dynamic/dynamic-xml.tester.js b/services/dynamic/dynamic-xml.tester.js index c81e9b3521159..3e774d4697b19 100644 --- a/services/dynamic/dynamic-xml.tester.js +++ b/services/dynamic/dynamic-xml.tester.js @@ -1,7 +1,7 @@ import queryString from 'query-string'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {exampleXml} from './dynamic-response-fixtures.js'; +export const t = await createServiceTester() const exampleUrl = 'https://example.test/example.xml' const withExampleXml = nock => diff --git a/services/dynamic/json-path.spec.js b/services/dynamic/json-path.spec.js index 4ce1af71322f4..825ccaa20d29d 100644 --- a/services/dynamic/json-path.spec.js +++ b/services/dynamic/json-path.spec.js @@ -1,7 +1,7 @@ import chai from 'chai'; -const { expect } = chai -import jsonPath from './json-path.js'; import chaiAsPromised from 'chai-as-promised' +import jsonPath from './json-path.js'; +const { expect } = chai chai.use(chaiAsPromised) describe('JSON Path service factory', function () { diff --git a/services/ecologi/ecologi-carbon.tester.js b/services/ecologi/ecologi-carbon.tester.js index 969775c3ee828..893cc8aaa69b9 100644 --- a/services/ecologi/ecologi-carbon.tester.js +++ b/services/ecologi/ecologi-carbon.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; +export const t = await createServiceTester() t.create('request for existing username') .get('/ecologi.json') diff --git a/services/ecologi/ecologi-trees.tester.js b/services/ecologi/ecologi-trees.tester.js index 46807780159d3..44a4d42e02376 100644 --- a/services/ecologi/ecologi-trees.tester.js +++ b/services/ecologi/ecologi-trees.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() t.create('request for existing username').get('/ecologi.json').expectBadge({ label: 'trees', diff --git a/services/github/github-all-contributors.tester.js b/services/github/github-all-contributors.tester.js index c334fe6c2f9d3..dd4ade81d2ec2 100644 --- a/services/github/github-all-contributors.tester.js +++ b/services/github/github-all-contributors.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() t.create('all-contributors repo') .get('/all-contributors/all-contributors.json') diff --git a/services/github/github-checks-status.tester.js b/services/github/github-checks-status.tester.js index 0c6fc4e2ceda2..85ea8ad8be4b5 100644 --- a/services/github/github-checks-status.tester.js +++ b/services/github/github-checks-status.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isBuildStatus} from '../build-status.js'; +export const t = await createServiceTester() t.create('branch checks (branch)') .get('/badges/shields/master.json') diff --git a/services/github/github-contributors.tester.js b/services/github/github-contributors.tester.js index d563c52d3239b..469832ac7ab77 100644 --- a/services/github/github-contributors.tester.js +++ b/services/github/github-contributors.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() t.create('Contributors').get('/contributors/badges/shields.json').expectBadge({ label: 'contributors', diff --git a/services/homebrew/homebrew-downloads.tester.js b/services/homebrew/homebrew-downloads.tester.js index 9cac14c77a841..2ef9c280d0b22 100644 --- a/services/homebrew/homebrew-downloads.tester.js +++ b/services/homebrew/homebrew-downloads.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetricOverTimePeriod} from '../test-validators.js'; +export const t = await createServiceTester() t.create('daily downloads (valid)') .get('/installs/dm/cake.json') diff --git a/services/hsts/hsts.service.js b/services/hsts/hsts.service.js index 9f7682c87bee1..79967c68a6e5f 100644 --- a/services/hsts/hsts.service.js +++ b/services/hsts/hsts.service.js @@ -1,6 +1,6 @@ -const label = 'hsts preloaded' import Joi from 'joi'; import {BaseJsonService} from '../index.js'; +const label = 'hsts preloaded' const schema = Joi.object({ status: Joi.string().required(), }).required() diff --git a/services/jira/jira-sprint.tester.js b/services/jira/jira-sprint.tester.js index d5eb14e4450cf..4b873e4b0d046 100644 --- a/services/jira/jira-sprint.tester.js +++ b/services/jira/jira-sprint.tester.js @@ -1,7 +1,7 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; import {sprintId, sprintQueryString} from './jira-test-helpers.js'; +export const t = await createServiceTester() t.create('unknown sprint') .get('/abc.json?baseUrl=https://jira.spring.io') diff --git a/services/lgtm/lgtm-alerts.tester.js b/services/lgtm/lgtm-alerts.tester.js index 6d3f3ede0e42a..5358a8e95b01e 100644 --- a/services/lgtm/lgtm-alerts.tester.js +++ b/services/lgtm/lgtm-alerts.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {data} from './lgtm-test-helpers.js'; +export const t = await createServiceTester() t.create('alerts: total alerts for a project') .get('/github/apache/cloudstack.json') diff --git a/services/lgtm/lgtm-grade.tester.js b/services/lgtm/lgtm-grade.tester.js index ffecd11cdaa4c..167cb0a022932 100644 --- a/services/lgtm/lgtm-grade.tester.js +++ b/services/lgtm/lgtm-grade.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {data} from './lgtm-test-helpers.js'; +export const t = await createServiceTester() t.create('grade: missing project') .get('/java/github/some-org/this-project-doesnt-exist.json') diff --git a/services/liberapay/liberapay-gives.tester.js b/services/liberapay/liberapay-gives.tester.js index 1ed18e900581e..22c158d6ab4fd 100644 --- a/services/liberapay/liberapay-gives.tester.js +++ b/services/liberapay/liberapay-gives.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isCurrencyOverTime} from './liberapay-base.js'; +export const t = await createServiceTester() t.create('Giving (valid)').get('/Changaco.json').expectBadge({ label: 'gives', diff --git a/services/liberapay/liberapay-receives.tester.js b/services/liberapay/liberapay-receives.tester.js index c21b967f10e58..60909abc7c79a 100644 --- a/services/liberapay/liberapay-receives.tester.js +++ b/services/liberapay/liberapay-receives.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isCurrencyOverTime} from './liberapay-base.js'; +export const t = await createServiceTester() t.create('Receiving (valid)').get('/Changaco.json').expectBadge({ label: 'receives', diff --git a/services/localizely/localizely.tester.js b/services/localizely/localizely.tester.js index 4a72551149788..f79f8a4d9311f 100644 --- a/services/localizely/localizely.tester.js +++ b/services/localizely/localizely.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; +export const t = await createServiceTester() t.create('Overall progress') .get( diff --git a/services/maven-metadata/maven-metadata.tester.js b/services/maven-metadata/maven-metadata.tester.js index d6a158d19bda2..37f1be7753608 100644 --- a/services/maven-metadata/maven-metadata.tester.js +++ b/services/maven-metadata/maven-metadata.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +export const t = await createServiceTester() t.create('valid maven-metadata.xml uri') .get( diff --git a/services/node/node-current.tester.js b/services/node/node-current.tester.js index 1a3384585fb3c..cd99c47df366c 100644 --- a/services/node/node-current.tester.js +++ b/services/node/node-current.tester.js @@ -1,9 +1,9 @@ import {expect} from 'chai'; import semverModule from 'semver'; -const {Range} = semverModule; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {mockPackageData, mockCurrentSha} from './testUtils/test-utils.js'; +const {Range} = semverModule; +export const t = await createServiceTester() function expectSemverRange(message) { expect(() => new Range(message)).not.to.throw() diff --git a/services/node/node-lts.tester.js b/services/node/node-lts.tester.js index 9736376465117..2be1b3359e35e 100644 --- a/services/node/node-lts.tester.js +++ b/services/node/node-lts.tester.js @@ -1,9 +1,9 @@ import {expect} from 'chai'; import semverModule from 'semver'; -const {Range} = semverModule; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {mockPackageData, mockReleaseSchedule, mockVersionsSha} from './testUtils/test-utils.js'; +const {Range} = semverModule; +export const t = await createServiceTester() function expectSemverRange(message) { expect(() => new Range(message)).not.to.throw() diff --git a/services/nodeping/nodeping-uptime.tester.js b/services/nodeping/nodeping-uptime.tester.js index 96b6580ab7878..2dbc6b055c0bf 100644 --- a/services/nodeping/nodeping-uptime.tester.js +++ b/services/nodeping/nodeping-uptime.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isPercentage} from '../test-validators.js'; +export const t = await createServiceTester() t.create('NodePing uptime') .get('/jkiwn052-ntpp-4lbb-8d45-ihew6d9ucoei.json') diff --git a/services/open-vsx/open-vsx-downloads.tester.js b/services/open-vsx/open-vsx-downloads.tester.js index d1b78e5c192f0..9ef3c2c7df79d 100644 --- a/services/open-vsx/open-vsx-downloads.tester.js +++ b/services/open-vsx/open-vsx-downloads.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex, isMetric} from '../test-validators.js'; +export const t = await createServiceTester() const isVersionLabel = withRegex(/^downloads@(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/open-vsx/open-vsx-rating.tester.js b/services/open-vsx/open-vsx-rating.tester.js index 8d23a0a29efb7..d37f6d20412b6 100644 --- a/services/open-vsx/open-vsx-rating.tester.js +++ b/services/open-vsx/open-vsx-rating.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex, isStarRating} from '../test-validators.js'; +export const t = await createServiceTester() const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/open-vsx/open-vsx-release-date.tester.js b/services/open-vsx/open-vsx-release-date.tester.js index c988f1dcfc5b2..05bb2281aadb2 100644 --- a/services/open-vsx/open-vsx-release-date.tester.js +++ b/services/open-vsx/open-vsx-release-date.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isFormattedDate} from '../test-validators.js'; +export const t = await createServiceTester() t.create('release date invalid extension') .get('/release-date/badges/shields.json') diff --git a/services/open-vsx/open-vsx-version.tester.js b/services/open-vsx/open-vsx-version.tester.js index bfe70f2dd25b0..64539f67808cb 100644 --- a/services/open-vsx/open-vsx-version.tester.js +++ b/services/open-vsx/open-vsx-version.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; +export const t = await createServiceTester() const isVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/ore/ore-sponge-versions.tester.js b/services/ore/ore-sponge-versions.tester.js index c351f3762cfc7..d8664f1359911 100644 --- a/services/ore/ore-sponge-versions.tester.js +++ b/services/ore/ore-sponge-versions.tester.js @@ -1,4 +1,5 @@ import joiModule from 'joi'; +import {createServiceTester} from '../tester.js' const Joi = joiModule.extend(joi => ({ base: joi.array(), coerce: (value, helpers) => ({ @@ -7,7 +8,6 @@ const Joi = joiModule.extend(joi => ({ type: 'versionArray', })) const isDottedVersionAtLeastOne = Joi.string().regex(/\d+(\.\d+)?(\.\d+)?$/) -import {createServiceTester} from '../tester.js' export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)') diff --git a/services/pypi/pypi-downloads.tester.js b/services/pypi/pypi-downloads.tester.js index fc5e2c13cfd70..d119ed41fe8bb 100644 --- a/services/pypi/pypi-downloads.tester.js +++ b/services/pypi/pypi-downloads.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetricOverTimePeriod} from '../test-validators.js'; +export const t = await createServiceTester() t.create('daily downloads (valid)') .get('/dd/djangorestframework.json') diff --git a/services/pypi/pypi-version.tester.js b/services/pypi/pypi-version.tester.js index 83e3b37a10e11..de7ff70af4d95 100644 --- a/services/pypi/pypi-version.tester.js +++ b/services/pypi/pypi-version.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isSemver} from '../test-validators.js'; +export const t = await createServiceTester() const isPsycopg2Version = Joi.string().regex(/^v([0-9][.]?)+$/) diff --git a/services/repology/repology-repositories.tester.js b/services/repology/repology-repositories.tester.js index 5a03c67b3d0e3..1ceaff00b53b4 100644 --- a/services/repology/repology-repositories.tester.js +++ b/services/repology/repology-repositories.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {nonNegativeInteger} from '../validators.js'; +export const t = await createServiceTester() t.create('Existing project').get('/starship.json').expectBadge({ label: 'repositories', diff --git a/services/reuse/reuse-compliance.tester.js b/services/reuse/reuse-compliance.tester.js index 493284f086118..bf059a8f55040 100644 --- a/services/reuse/reuse-compliance.tester.js +++ b/services/reuse/reuse-compliance.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; +export const t = await createServiceTester() t.create('valid repo -- live') .get('/github.com/fsfe/reuse-tool.json') diff --git a/services/snyk/snyk-vulnerability-github.tester.js b/services/snyk/snyk-vulnerability-github.tester.js index 120d3abf3750b..d9de80703a25d 100644 --- a/services/snyk/snyk-vulnerability-github.tester.js +++ b/services/snyk/snyk-vulnerability-github.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; +export const t = await createServiceTester() t.create('valid repo').get('/snyk/snyk.json').timeout(20000).expectBadge({ label: 'vulnerabilities', diff --git a/services/snyk/snyk-vulnerability-npm.tester.js b/services/snyk/snyk-vulnerability-npm.tester.js index 4f7486a2564dc..2ecc84f37754b 100644 --- a/services/snyk/snyk-vulnerability-npm.tester.js +++ b/services/snyk/snyk-vulnerability-npm.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; +export const t = await createServiceTester() t.create('valid package latest version') .get('/commander.json') diff --git a/services/sonar/sonar-coverage.tester.js b/services/sonar/sonar-coverage.tester.js index 23b879182b64b..b6cbd32954742 100644 --- a/services/sonar/sonar-coverage.tester.js +++ b/services/sonar/sonar-coverage.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; +export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked // because of the lack of publicly accessible, self-hosted, legacy SonarQube instances diff --git a/services/sonar/sonar-tests.tester.js b/services/sonar/sonar-tests.tester.js index 737296845c057..aaede3bfc98b2 100644 --- a/services/sonar/sonar-tests.tester.js +++ b/services/sonar/sonar-tests.tester.js @@ -1,11 +1,11 @@ import Joi from 'joi'; import {ServiceTester} from '../tester.js'; +import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals, isIntegerPercentage, isMetric} from '../test-validators.js'; export const t = new ServiceTester({ id: 'SonarTests', title: 'SonarTests', pathPrefix: '/sonar', }) -import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals, isIntegerPercentage, isMetric} from '../test-validators.js'; const isMetricAllowZero = Joi.alternatives( isMetric, Joi.number().valid(0).required() diff --git a/services/swagger/swagger.tester.js b/services/swagger/swagger.tester.js index f431f89a025a3..659cdb03e0069 100644 --- a/services/swagger/swagger.tester.js +++ b/services/swagger/swagger.tester.js @@ -1,3 +1,5 @@ +import {createServiceTester} from '../tester.js' + const getURL = '/3.0.json?specUrl=https://example.com/example.json' const getURLBase = '/3.0.json?specUrl=' const apiURL = 'http://validator.swagger.io' @@ -5,8 +7,6 @@ const apiGetURL = '/validator/debug' const apiGetQueryParams = { url: 'https://example.com/example.json', } - -import {createServiceTester} from '../tester.js' export const t = await createServiceTester() t.create('Invalid') diff --git a/services/symfony/symfony-insight-grade.tester.js b/services/symfony/symfony-insight-grade.tester.js index f3a4706f6ea64..491194f57073e 100644 --- a/services/symfony/symfony-insight-grade.tester.js +++ b/services/symfony/symfony-insight-grade.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; +export const t = await createServiceTester() t.create('valid project grade') .skipWhen(noSymfonyToken) diff --git a/services/symfony/symfony-insight-stars.tester.js b/services/symfony/symfony-insight-stars.tester.js index 59378ed2975f4..c5068a4bab1af 100644 --- a/services/symfony/symfony-insight-stars.tester.js +++ b/services/symfony/symfony-insight-stars.tester.js @@ -1,7 +1,7 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; +export const t = await createServiceTester() t.create('valid project stars') .skipWhen(noSymfonyToken) diff --git a/services/symfony/symfony-insight-violations.tester.js b/services/symfony/symfony-insight-violations.tester.js index 4a1aecd83a07f..4d858fe62fad3 100644 --- a/services/symfony/symfony-insight-violations.tester.js +++ b/services/symfony/symfony-insight-violations.tester.js @@ -1,7 +1,7 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; +export const t = await createServiceTester() t.create('valid project violations') .skipWhen(noSymfonyToken) diff --git a/services/symfony/symfony-test-helpers.js b/services/symfony/symfony-test-helpers.js index 767301af5977e..870ade4533d6e 100644 --- a/services/symfony/symfony-test-helpers.js +++ b/services/symfony/symfony-test-helpers.js @@ -1,3 +1,6 @@ +import {noToken} from '../test-helpers.js'; +import {SymfonyInsightBase} from './symfony-insight-base.js'; + const sampleProjectUuid = '825be328-29f8-44f7-a750-f82818ae9111' function createMockResponse({ status = 'finished', grade, violations }) { @@ -83,9 +86,6 @@ const config = { sl_insight_apiToken: token, }, } - -import {noToken} from '../test-helpers.js'; -import {SymfonyInsightBase} from './symfony-insight-base.js'; const noSymfonyToken = noToken(SymfonyInsightBase) export { diff --git a/services/test-helpers.js b/services/test-helpers.js index 9f4107930e1fe..b1687e245990d 100644 --- a/services/test-helpers.js +++ b/services/test-helpers.js @@ -1,8 +1,8 @@ import nock from 'nock'; import request from 'request'; import config from 'config'; -const runnerConfig = config.util.toObject() import {promisify} from '../core/base-service/legacy-request-handler.js'; +const runnerConfig = config.util.toObject() function cleanUpNockAfterEach() { afterEach(function () { diff --git a/services/testspace/testspace-test-count.tester.js b/services/testspace/testspace-test-count.tester.js index 078dd6266afd3..32d47a1ecd36d 100644 --- a/services/testspace/testspace-test-count.tester.js +++ b/services/testspace/testspace-test-count.tester.js @@ -1,7 +1,7 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() const isMetricAllowZero = Joi.alternatives( isMetric, Joi.number().valid(0).required() diff --git a/services/testspace/testspace-test-pass-ratio.tester.js b/services/testspace/testspace-test-pass-ratio.tester.js index 55d61582ac438..e1ca861205313 100644 --- a/services/testspace/testspace-test-pass-ratio.tester.js +++ b/services/testspace/testspace-test-pass-ratio.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isIntegerPercentage} from '../test-validators.js'; +export const t = await createServiceTester() t.create('Non-existent or unauthorized org') .get('/swellaby1239017823123/swellaby:testspace-sample/main.json') diff --git a/services/testspace/testspace-test-summary.tester.js b/services/testspace/testspace-test-summary.tester.js index 28c0a10ec71b2..760eefcd36775 100644 --- a/services/testspace/testspace-test-summary.tester.js +++ b/services/testspace/testspace-test-summary.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals} from '../test-validators.js'; +export const t = await createServiceTester() t.create('Tests') .get('/swellaby/swellaby:testspace-sample/main.json') diff --git a/services/treeware/treeware-trees.tester.js b/services/treeware/treeware-trees.tester.js index 6615400f9cff2..5b61e45ee8d3e 100644 --- a/services/treeware/treeware-trees.tester.js +++ b/services/treeware/treeware-trees.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() t.create('request for existing package') .get('/stoplightio/spectral.json') diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js index 7b9a7876a46ef..c0f7bd80f4f99 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isFileSize} from '../test-validators.js'; +export const t = await createServiceTester() t.create('8368844 bytes to 8.37 megabytes') .get('/nock/nock/nock.json') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js index 74604f9b9f909..800c358f9bd18 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() const mockResponse = { results: [ diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js index 9880ada45977f..777c8eaa8c38c 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isMetric} from '../test-validators.js'; +export const t = await createServiceTester() const mockResponse = { results: [ diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js index ef5ae388025da..92fc5ac60b6d1 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isFormattedDate} from '../test-validators.js'; +export const t = await createServiceTester() t.create('date') .get('/visual-studio-marketplace/last-updated/yasht.terminal-all-in-one.json') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js index 0cb520a455a9c..2a4a114cffac8 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex, isStarRating} from '../test-validators.js'; +export const t = await createServiceTester() const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js index 3fd0d894da9be..155bbe96d56b8 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {isFormattedDate} from '../test-validators.js'; +export const t = await createServiceTester() t.create('date') .get('/visual-studio-marketplace/release-date/yasht.terminal-all-in-one.json') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js index 1f2fcd5226afd..d9a7234278559 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js @@ -1,6 +1,6 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {withRegex} from '../test-validators.js'; +export const t = await createServiceTester() const isMarketplaceVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/wheelmap/wheelmap.tester.js b/services/wheelmap/wheelmap.tester.js index 5f75531f584d6..954361e2764d8 100644 --- a/services/wheelmap/wheelmap.tester.js +++ b/services/wheelmap/wheelmap.tester.js @@ -1,7 +1,7 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import _noWheelmapToken from './wheelmap.service.js'; +export const t = await createServiceTester() const noWheelmapToken = noToken(_noWheelmapToken); t.create('node with accessibility') diff --git a/services/youtube/youtube-channel-views.tester.js b/services/youtube/youtube-channel-views.tester.js index 074aea55364d6..0ece891f7d7d1 100644 --- a/services/youtube/youtube-channel-views.tester.js +++ b/services/youtube/youtube-channel-views.tester.js @@ -1,8 +1,8 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; import _noYouTubeToken from './youtube-channel-views.service.js'; +export const t = await createServiceTester() const noYouTubeToken = noToken(_noYouTubeToken); t.create('channel view count') diff --git a/services/youtube/youtube-comments.tester.js b/services/youtube/youtube-comments.tester.js index 1cb1fcf0eff90..3727eb145bd2b 100644 --- a/services/youtube/youtube-comments.tester.js +++ b/services/youtube/youtube-comments.tester.js @@ -1,8 +1,8 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; import _noYouTubeToken from './youtube-comments.service.js'; +export const t = await createServiceTester() const noYouTubeToken = noToken(_noYouTubeToken); t.create('video comment count') diff --git a/services/youtube/youtube-likes.tester.js b/services/youtube/youtube-likes.tester.js index ae2c5b26d152f..e830032e71a2d 100644 --- a/services/youtube/youtube-likes.tester.js +++ b/services/youtube/youtube-likes.tester.js @@ -1,9 +1,9 @@ import Joi from 'joi'; import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; import _noYouTubeToken from './youtube-likes.service.js'; +export const t = await createServiceTester() const noYouTubeToken = noToken(_noYouTubeToken); t.create('video like count') diff --git a/services/youtube/youtube-subscribers.tester.js b/services/youtube/youtube-subscribers.tester.js index b8a8eab441dad..48f5608c5a4fb 100644 --- a/services/youtube/youtube-subscribers.tester.js +++ b/services/youtube/youtube-subscribers.tester.js @@ -1,8 +1,8 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; import _noYouTubeToken from './youtube-subscribers.service.js'; +export const t = await createServiceTester() const noYouTubeToken = noToken(_noYouTubeToken); t.create('subscriber count') diff --git a/services/youtube/youtube-views.tester.js b/services/youtube/youtube-views.tester.js index e8ef523ee5c14..cd69757421e66 100644 --- a/services/youtube/youtube-views.tester.js +++ b/services/youtube/youtube-views.tester.js @@ -1,8 +1,8 @@ import {createServiceTester} from '../tester.js' -export const t = await createServiceTester() import {noToken} from '../test-helpers.js'; import {isMetric} from '../test-validators.js'; import _noYouTubeToken from './youtube-views.service.js'; +export const t = await createServiceTester() const noYouTubeToken = noToken(_noYouTubeToken); t.create('video view count') From 3fb195cc5cc92a40e733ff547e338476224136b2 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 12:29:28 +0100 Subject: [PATCH 21/46] Run Prettier --- core/badge-urls/make-badge-url.js | 10 +-- core/badge-urls/make-badge-url.spec.js | 11 ++- core/badge-urls/path-helpers.js | 18 ++--- core/badge-urls/path-helpers.spec.js | 4 +- core/base-service/auth-helper.js | 6 +- core/base-service/auth-helper.spec.js | 8 +-- core/base-service/base-graphql.js | 10 +-- core/base-service/base-graphql.spec.js | 12 ++-- core/base-service/base-json.js | 6 +- core/base-service/base-json.spec.js | 8 +-- core/base-service/base-static.js | 19 +++--- core/base-service/base-svg-scraping.js | 10 +-- core/base-service/base-svg-scraping.spec.js | 12 ++-- core/base-service/base-xml.js | 12 ++-- core/base-service/base-xml.spec.js | 8 +-- core/base-service/base-yaml.js | 12 ++-- core/base-service/base-yaml.spec.js | 8 +-- core/base-service/base.js | 43 +++++++----- core/base-service/base.spec.js | 30 +++++---- core/base-service/cache-headers.js | 8 +-- core/base-service/cache-headers.spec.js | 2 +- core/base-service/categories.js | 9 +-- core/base-service/check-error-response.js | 4 +- .../base-service/check-error-response.spec.js | 6 +- core/base-service/coalesce-badge.js | 13 ++-- core/base-service/coalesce-badge.spec.js | 6 +- core/base-service/coalesce.js | 2 +- core/base-service/coalesce.spec.js | 4 +- core/base-service/deprecated-service.js | 16 ++--- core/base-service/deprecated-service.spec.js | 4 +- core/base-service/errors.js | 2 +- core/base-service/examples.js | 15 ++--- core/base-service/examples.spec.js | 6 +- core/base-service/graphql.js | 2 +- core/base-service/graphql.spec.js | 10 +-- core/base-service/index.js | 28 +++++--- core/base-service/json.js | 10 ++- core/base-service/legacy-request-handler.js | 20 +++--- .../legacy-request-handler.spec.js | 14 ++-- core/base-service/legacy-result-sender.js | 6 +- .../empty-array.fixture.js | 2 +- .../empty-object.fixture.js | 2 +- .../empty-undefined.fixture.js | 2 +- .../invalid-mixed.fixture.js | 4 +- .../invalid-no-base.fixture.js | 2 +- .../invalid-wrong-base.fixture.js | 2 +- .../valid-array.fixture.js | 4 +- .../valid-class.fixture.js | 4 +- .../valid-object.fixture.js | 4 +- core/base-service/loader.js | 67 +++++++++++-------- core/base-service/loader.spec.js | 17 +++-- core/base-service/metric-helper.js | 4 +- core/base-service/redirector.js | 27 ++++---- core/base-service/redirector.spec.js | 10 +-- core/base-service/route.js | 8 +-- core/base-service/route.spec.js | 12 ++-- core/base-service/service-definitions.js | 4 +- core/base-service/to-array.js | 2 +- core/base-service/trace.js | 6 +- core/base-service/validate.js | 8 +-- core/base-service/validate.spec.js | 12 ++-- core/got-test-client.js | 4 +- core/legacy/regular-update.js | 9 +-- core/register-chai-plugins.spec.js | 6 +- core/server/in-process-server-test-helpers.js | 12 ++-- core/server/influx-metrics.js | 12 ++-- core/server/influx-metrics.spec.js | 14 ++-- core/server/instance-id-generator.js | 2 +- core/server/log.js | 12 ++-- core/server/metrics/format-converters.js | 4 +- core/server/metrics/format-converters.spec.js | 6 +- core/server/prometheus-metrics.js | 6 +- core/server/prometheus-metrics.spec.js | 10 +-- core/server/secret-is-valid.js | 2 +- core/server/server.js | 45 +++++++------ core/server/server.spec.js | 25 ++++--- core/service-test-runner/cli.js | 12 ++-- .../create-service-tester.js | 8 +-- .../service-test-runner/icedfrisby-shields.js | 10 +-- .../service-test-runner/infer-pull-request.js | 8 +-- .../infer-pull-request.spec.js | 7 +- .../pull-request-services-cli.js | 8 +-- core/service-test-runner/runner.js | 8 ++- core/service-test-runner/service-tester.js | 6 +- .../service-test-runner/services-for-title.js | 4 +- .../services-for-title.spec.js | 4 +- .../redis-token-persistence.integration.js | 8 +-- core/token-pooling/redis-token-persistence.js | 8 +-- core/token-pooling/token-pool.js | 10 +-- core/token-pooling/token-pool.spec.js | 8 +-- dangerfile.js | 4 +- doc/TUTORIAL.md | 30 ++++----- doc/deprecating-badges.md | 6 +- entrypoint.spec.js | 6 +- gatsby-config.js | 10 ++- gatsby-node.js | 8 +-- lib/load-logos.js | 16 +++-- lib/load-simple-icons.js | 6 +- lib/load-simple-icons.spec.js | 4 +- lib/logos.js | 16 +++-- lib/logos.spec.js | 12 +++- lib/svg-helpers.js | 2 +- lib/svg-helpers.spec.js | 4 +- scripts/badge-cli.js | 14 ++-- scripts/benchmark-performance.js | 10 +-- scripts/capture-timings.js | 6 +- scripts/export-service-definitions-cli.js | 4 +- scripts/redis-connectivity-test.js | 6 +- server.js | 18 +++-- services/amo/amo-base.js | 8 +-- services/amo/amo-downloads.service.js | 13 ++-- services/amo/amo-downloads.tester.js | 4 +- services/amo/amo-rating.service.js | 8 +-- services/amo/amo-rating.tester.js | 6 +- services/amo/amo-users.service.js | 6 +- services/amo/amo-users.tester.js | 4 +- services/amo/amo-version.service.js | 6 +- services/amo/amo-version.tester.js | 4 +- services/ansible/ansible-quality.service.js | 12 ++-- services/ansible/ansible-quality.tester.js | 4 +- services/ansible/ansible-role.service.js | 15 ++--- services/ansible/ansible-role.tester.js | 4 +- services/apm/apm.service.js | 18 ++--- services/apm/apm.tester.js | 6 +- services/appveyor/appveyor-base.js | 10 +-- .../appveyor-build-redirect.service.js | 4 +- .../appveyor-build-redirect.tester.js | 2 +- services/appveyor/appveyor-build.service.js | 6 +- services/appveyor/appveyor-build.tester.js | 4 +- .../appveyor/appveyor-job-build.service.js | 8 +-- services/appveyor/appveyor-job-build.spec.js | 8 +-- .../appveyor/appveyor-job-build.tester.js | 4 +- services/appveyor/appveyor-tests.service.js | 9 ++- services/appveyor/appveyor-tests.tester.js | 6 +- services/archlinux/archlinux.service.js | 8 +-- services/archlinux/archlinux.tester.js | 4 +- services/aur/aur.service.js | 21 +++--- services/aur/aur.spec.js | 4 +- services/aur/aur.tester.js | 8 ++- services/azure-devops/azure-devops-base.js | 6 +- .../azure-devops-build.service.js | 10 +-- .../azure-devops/azure-devops-build.tester.js | 4 +- .../azure-devops-coverage.service.js | 10 +-- .../azure-devops-coverage.tester.js | 4 +- services/azure-devops/azure-devops-helpers.js | 6 +- .../azure-devops-release.service.js | 8 +-- .../azure-devops-release.tester.js | 4 +- .../azure-devops-tests.service.js | 11 +-- .../azure-devops/azure-devops-tests.tester.js | 4 +- services/azure-devops/vso-redirect.service.js | 48 ++++++------- services/azure-devops/vso-redirect.tester.js | 2 +- services/beerpay/beerpay.service.js | 6 +- services/beerpay/beerpay.tester.js | 4 +- services/bintray/bintray.service.js | 4 +- services/bintray/bintray.tester.js | 2 +- services/bit/bit-components.service.js | 12 ++-- services/bit/bit-components.tester.js | 4 +- .../bitbucket/bitbucket-issues.service.js | 8 +-- services/bitbucket/bitbucket-issues.tester.js | 4 +- .../bitbucket/bitbucket-pipelines.service.js | 11 ++- .../bitbucket/bitbucket-pipelines.tester.js | 4 +- .../bitbucket-pull-request.service.js | 10 +-- .../bitbucket/bitbucket-pull-request.spec.js | 8 +-- .../bitbucket-pull-request.tester.js | 4 +- services/bithound/bithound.service.js | 4 +- services/bithound/bithound.tester.js | 2 +- services/bitrise/bitrise.service.js | 6 +- services/bitrise/bitrise.tester.js | 4 +- services/bountysource/bountysource.service.js | 10 +-- services/bountysource/bountysource.tester.js | 4 +- services/bower/bower-base.js | 6 +- services/bower/bower-license.service.js | 6 +- services/bower/bower-license.tester.js | 2 +- services/bower/bower-version.service.js | 10 +-- services/bower/bower-version.tester.js | 6 +- services/bstats/bstats-players.service.js | 8 +-- services/bstats/bstats-players.tester.js | 4 +- services/bstats/bstats-servers.service.js | 8 +-- services/bstats/bstats-servers.tester.js | 4 +- services/bugzilla/bugzilla.service.js | 8 +-- services/bugzilla/bugzilla.spec.js | 4 +- services/bugzilla/bugzilla.tester.js | 4 +- services/build-status.js | 4 +- services/build-status.spec.js | 6 +- services/buildkite/buildkite.service.js | 8 +-- services/buildkite/buildkite.tester.js | 6 +- services/bundlephobia/bundlephobia.service.js | 10 +-- services/bundlephobia/bundlephobia.tester.js | 4 +- services/categories.js | 2 +- services/cauditor/cauditor.service.js | 4 +- services/cauditor/cauditor.tester.js | 2 +- services/cdnjs/cdnjs.service.js | 8 +-- services/cdnjs/cdnjs.tester.js | 4 +- services/check-services.spec.js | 2 +- services/chocolatey/chocolatey.service.js | 4 +- services/chocolatey/chocolatey.tester.js | 8 ++- .../chrome-web-store/chrome-web-store-base.js | 8 +-- .../chrome-web-store-price.service.js | 8 +-- .../chrome-web-store-price.tester.js | 4 +- .../chrome-web-store-rating.service.js | 10 +-- .../chrome-web-store-rating.tester.js | 6 +- .../chrome-web-store-users.service.js | 13 ++-- .../chrome-web-store-users.tester.js | 4 +- .../chrome-web-store-version.service.js | 8 +-- .../chrome-web-store-version.tester.js | 4 +- .../cii-best-practices.service.js | 8 +-- .../cii-best-practices.tester.js | 4 +- services/circleci/circleci.service.js | 8 +-- services/circleci/circleci.tester.js | 4 +- services/cirrus/cirrus.service.js | 8 +-- services/cirrus/cirrus.tester.js | 6 +- services/clojars/clojars-base.js | 8 +-- services/clojars/clojars-downloads.service.js | 8 +-- services/clojars/clojars-downloads.tester.js | 4 +- services/clojars/clojars-version.service.js | 10 +-- services/clojars/clojars-version.tester.js | 2 +- services/cocoapods/cocoapods-apps.service.js | 4 +- services/cocoapods/cocoapods-apps.tester.js | 2 +- services/cocoapods/cocoapods-base.js | 6 +- services/cocoapods/cocoapods-docs.service.js | 8 +-- services/cocoapods/cocoapods-docs.tester.js | 4 +- .../cocoapods/cocoapods-downloads.service.js | 4 +- .../cocoapods/cocoapods-downloads.tester.js | 2 +- .../cocoapods/cocoapods-license.service.js | 4 +- .../cocoapods/cocoapods-license.tester.js | 2 +- .../cocoapods/cocoapods-platform.service.js | 4 +- .../cocoapods/cocoapods-platform.tester.js | 4 +- .../cocoapods/cocoapods-version.service.js | 6 +- .../cocoapods/cocoapods-version.tester.js | 4 +- services/codacy/codacy-coverage.service.js | 10 +-- services/codacy/codacy-coverage.tester.js | 4 +- services/codacy/codacy-grade.service.js | 8 +-- services/codacy/codacy-grade.tester.js | 4 +- services/codacy/codacy-helpers.js | 4 +- ...codeclimate-analysis-redirector.service.js | 4 +- .../codeclimate-analysis-redirector.tester.js | 2 +- .../codeclimate-analysis.service.js | 12 ++-- .../codeclimate-analysis.tester.js | 6 +- services/codeclimate/codeclimate-common.js | 10 +-- ...codeclimate-coverage-redirector.service.js | 4 +- .../codeclimate-coverage-redirector.tester.js | 2 +- .../codeclimate-coverage.service.js | 10 +-- .../codeclimate-coverage.tester.js | 6 +- services/codecov/codecov-redirect.service.js | 4 +- services/codecov/codecov-redirect.tester.js | 2 +- services/codecov/codecov.service.js | 10 +-- services/codecov/codecov.spec.js | 4 +- services/codecov/codecov.tester.js | 4 +- .../codefactor/codefactor-grade.service.js | 8 +-- services/codefactor/codefactor-grade.spec.js | 4 +- .../codefactor/codefactor-grade.tester.js | 4 +- services/codefactor/codefactor-helpers.js | 4 +- services/codeship/codeship.service.js | 10 +-- services/codeship/codeship.spec.js | 4 +- services/codeship/codeship.tester.js | 4 +- services/codetally/codetally.service.js | 4 +- services/codetally/codetally.tester.js | 2 +- services/color-formatters.js | 4 +- services/color-formatters.spec.js | 12 +++- services/conda/conda-base.js | 8 +-- services/conda/conda-downloads.service.js | 8 +-- services/conda/conda-downloads.tester.js | 4 +- services/conda/conda-license.service.js | 10 +-- services/conda/conda-license.tester.js | 2 +- services/conda/conda-platform.service.js | 4 +- services/conda/conda-platform.tester.js | 4 +- services/conda/conda-version.service.js | 8 +-- services/conda/conda-version.tester.js | 4 +- .../continuousphp/continuousphp.service.js | 4 +- .../continuousphp/continuousphp.tester.js | 2 +- services/contributor-count.js | 7 +- services/contributor-count.spec.js | 4 +- services/cookbook/cookbook.service.js | 8 +-- services/cookbook/cookbook.tester.js | 4 +- .../coveralls/coveralls-redirector.service.js | 4 +- .../coveralls/coveralls-redirector.tester.js | 2 +- services/coveralls/coveralls.service.js | 8 +-- services/coveralls/coveralls.tester.js | 4 +- .../coverity/coverity-on-demand.service.js | 4 +- .../coverity/coverity-on-demand.tester.js | 2 +- services/coverity/coverity-scan.service.js | 6 +- services/coverity/coverity-scan.tester.js | 4 +- services/cpan/cpan-license.service.js | 4 +- services/cpan/cpan-license.tester.js | 2 +- services/cpan/cpan-version.service.js | 6 +- services/cpan/cpan-version.tester.js | 4 +- services/cpan/cpan.js | 6 +- services/cran/cran.service.js | 8 +-- services/cran/cran.tester.js | 4 +- services/crates/crates-base.js | 8 +-- services/crates/crates-downloads.service.js | 10 +-- services/crates/crates-downloads.tester.js | 4 +- services/crates/crates-license.service.js | 4 +- services/crates/crates-license.tester.js | 2 +- services/crates/crates-version.service.js | 8 +-- services/crates/crates-version.spec.js | 8 +-- services/crates/crates-version.tester.js | 4 +- services/criterion/criterion.service.js | 13 ++-- services/criterion/criterion.tester.js | 11 ++- services/ctan/ctan.service.js | 13 ++-- services/ctan/ctan.tester.js | 4 +- services/date/date.service.js | 6 +- services/date/date.tester.js | 4 +- services/david/david.service.js | 6 +- services/david/david.tester.js | 4 +- services/debian/debian.service.js | 8 +-- services/debian/debian.tester.js | 4 +- services/debug/debug.service.js | 4 +- services/debug/debug.tester.js | 4 +- services/dependabot/dependabot.service.js | 6 +- services/dependabot/dependabot.tester.js | 4 +- services/depfu/depfu.service.js | 6 +- services/depfu/depfu.tester.js | 4 +- services/deprecation-helpers.js | 6 +- services/deprecation-helpers.spec.js | 6 +- services/discord/discord.service.js | 8 +-- services/discord/discord.spec.js | 8 +-- services/discord/discord.tester.js | 4 +- .../discourse/discourse-redirect.service.js | 4 +- .../discourse/discourse-redirect.tester.js | 2 +- services/discourse/discourse.service.js | 12 ++-- services/discourse/discourse.tester.js | 4 +- services/dockbit/dockbit.service.js | 4 +- services/dockbit/dockbit.tester.js | 2 +- services/docker/docker-automated.service.js | 12 ++-- services/docker/docker-automated.tester.js | 6 +- services/docker/docker-build.service.js | 2 +- services/docker/docker-build.tester.js | 2 +- .../docker/docker-cloud-automated.service.js | 8 +-- .../docker/docker-cloud-automated.tester.js | 6 +- services/docker/docker-cloud-build.service.js | 8 +-- services/docker/docker-cloud-build.tester.js | 6 +- services/docker/docker-cloud-common-fetch.js | 6 +- services/docker/docker-fixtures.js | 2 +- services/docker/docker-helpers.js | 5 +- services/docker/docker-pulls.service.js | 16 +++-- services/docker/docker-pulls.tester.js | 6 +- services/docker/docker-size.service.js | 18 +++-- services/docker/docker-size.spec.js | 6 +- services/docker/docker-size.tester.js | 4 +- services/docker/docker-stars.service.js | 14 ++-- services/docker/docker-stars.tester.js | 6 +- services/docker/docker-version.service.js | 17 +++-- services/docker/docker-version.spec.js | 16 +++-- services/docker/docker-version.tester.js | 4 +- services/docsrs/docsrs.service.js | 6 +- services/docsrs/docsrs.tester.js | 4 +- services/dotnetstatus/dotnetstatus.service.js | 4 +- services/dotnetstatus/dotnetstatus.tester.js | 2 +- services/drone/drone-build.service.js | 10 +-- services/drone/drone-build.spec.js | 8 +-- services/drone/drone-build.tester.js | 6 +- services/dub/dub-download.service.js | 12 ++-- services/dub/dub-download.tester.js | 6 +- services/dub/dub-license.service.js | 8 +-- services/dub/dub-license.tester.js | 2 +- services/dub/dub-version.service.js | 8 +-- services/dub/dub-version.tester.js | 6 +- services/dynamic-common.js | 10 +-- services/dynamic/dynamic-helpers.js | 8 +-- services/dynamic/dynamic-json.service.js | 10 +-- services/dynamic/dynamic-json.tester.js | 6 +- services/dynamic/dynamic-xml.service.js | 14 ++-- services/dynamic/dynamic-xml.spec.js | 12 ++-- services/dynamic/dynamic-xml.tester.js | 6 +- services/dynamic/dynamic-yaml.service.js | 10 +-- services/dynamic/dynamic-yaml.tester.js | 2 +- services/dynamic/json-path.js | 12 ++-- services/dynamic/json-path.spec.js | 4 +- .../eclipse-marketplace-base.js | 4 +- .../eclipse-marketplace-downloads.service.js | 12 ++-- .../eclipse-marketplace-downloads.tester.js | 4 +- .../eclipse-marketplace-favorites.service.js | 12 ++-- .../eclipse-marketplace-favorites.tester.js | 4 +- .../eclipse-marketplace-license.service.js | 10 ++- .../eclipse-marketplace-license.tester.js | 2 +- .../eclipse-marketplace-update.service.js | 12 ++-- .../eclipse-marketplace-update.tester.js | 4 +- .../eclipse-marketplace-version.service.js | 12 ++-- .../eclipse-marketplace-version.tester.js | 4 +- services/ecologi/ecologi-carbon.service.js | 10 +-- services/ecologi/ecologi-carbon.tester.js | 4 +- services/ecologi/ecologi-trees.service.js | 12 ++-- services/ecologi/ecologi-trees.tester.js | 4 +- services/elm-package/elm-package.service.js | 10 +-- services/elm-package/elm-package.tester.js | 4 +- services/endpoint-common.js | 11 ++- .../endpoint/endpoint-redirect.service.js | 4 +- services/endpoint/endpoint-redirect.tester.js | 2 +- services/endpoint/endpoint.service.js | 14 ++-- services/endpoint/endpoint.tester.js | 8 +-- services/f-droid/f-droid.service.js | 15 +++-- services/f-droid/f-droid.tester.js | 4 +- services/fedora/fedora.service.js | 8 +-- services/fedora/fedora.tester.js | 4 +- services/feedz/feedz.service.js | 15 +++-- services/feedz/feedz.service.spec.js | 4 +- services/feedz/feedz.tester.js | 2 +- services/flathub/flathub.service.js | 8 +-- services/flathub/flathub.tester.js | 4 +- services/gem/gem-downloads.service.js | 16 ++--- services/gem/gem-downloads.tester.js | 4 +- services/gem/gem-owner.service.js | 8 +-- services/gem/gem-owner.tester.js | 4 +- services/gem/gem-rank.service.js | 10 +-- services/gem/gem-rank.tester.js | 4 +- services/gem/gem-version.service.js | 8 +-- services/gem/gem-version.tester.js | 7 +- services/gemnasium/gemnasium.service.js | 4 +- services/gemnasium/gemnasium.tester.js | 2 +- services/gerrit/gerrit.service.js | 8 +-- services/gerrit/gerrit.tester.js | 2 +- services/github/auth/acceptor.js | 10 +-- services/github/auth/acceptor.spec.js | 20 +++--- services/github/auth/admin.js | 4 +- services/github/auth/admin.spec.js | 12 ++-- .../github/github-all-contributors.service.js | 16 ++--- .../github/github-all-contributors.tester.js | 4 +- .../github/github-api-provider.integration.js | 8 +-- services/github/github-api-provider.js | 12 ++-- services/github/github-api-provider.spec.js | 6 +- services/github/github-auth-service.js | 8 +-- .../github/github-checks-status.service.js | 10 +-- .../github/github-checks-status.tester.js | 4 +- services/github/github-code-size.service.js | 8 +-- services/github/github-code-size.tester.js | 4 +- .../github/github-commit-activity.service.js | 12 ++-- .../github/github-commit-activity.tester.js | 9 ++- .../github/github-commit-status.service.js | 10 +-- .../github/github-commit-status.tester.js | 4 +- .../github/github-commits-since.service.js | 17 +++-- .../github/github-commits-since.tester.js | 4 +- services/github/github-common-fetch.js | 12 ++-- services/github/github-common-release.js | 15 ++--- services/github/github-common-release.spec.js | 4 +- services/github/github-constellation.js | 14 ++-- .../github/github-contributors.service.js | 12 ++-- services/github/github-contributors.tester.js | 4 +- services/github/github-deployments.service.js | 12 ++-- services/github/github-deployments.spec.js | 4 +- services/github/github-deployments.tester.js | 4 +- .../github-directory-file-count.service.js | 21 +++--- .../github-directory-file-count.spec.js | 8 +-- .../github-directory-file-count.tester.js | 4 +- .../github-discussions-total.service.js | 12 ++-- .../github/github-discussions-total.tester.js | 4 +- services/github/github-downloads.service.js | 18 ++--- services/github/github-downloads.tester.js | 6 +- services/github/github-followers.service.js | 12 ++-- services/github/github-followers.tester.js | 4 +- services/github/github-forks.service.js | 14 ++-- services/github/github-forks.tester.js | 4 +- services/github/github-go-mod.service.js | 18 +++-- services/github/github-go-mod.tester.js | 4 +- .../github/github-hacktoberfest.service.js | 23 ++++--- services/github/github-hacktoberfest.spec.js | 4 +- .../github/github-hacktoberfest.tester.js | 4 +- services/github/github-helpers.js | 6 +- .../github-issue-detail-redirect.service.js | 4 +- .../github-issue-detail-redirect.tester.js | 2 +- .../github/github-issue-detail.service.js | 21 +++--- services/github/github-issue-detail.spec.js | 14 ++-- services/github/github-issue-detail.tester.js | 6 +- .../github/github-issues-search.service.js | 17 ++--- .../github/github-issues-search.tester.js | 4 +- services/github/github-issues.service.js | 14 ++-- services/github/github-issues.tester.js | 6 +- services/github/github-labels.service.js | 8 +-- services/github/github-labels.tester.js | 2 +- .../github/github-language-count.service.js | 6 +- .../github/github-language-count.tester.js | 4 +- services/github/github-languages-base.js | 10 +-- services/github/github-last-commit.service.js | 12 ++-- services/github/github-last-commit.tester.js | 4 +- services/github/github-lerna-json.service.js | 14 ++-- services/github/github-lerna-json.tester.js | 4 +- services/github/github-license.service.js | 10 +-- services/github/github-license.spec.js | 4 +- services/github/github-license.tester.js | 4 +- services/github/github-manifest.service.js | 21 +++--- services/github/github-manifest.tester.js | 6 +- .../github/github-milestone-detail.service.js | 12 ++-- .../github/github-milestone-detail.tester.js | 8 ++- services/github/github-milestone.service.js | 10 +-- services/github/github-milestone.tester.js | 4 +- .../github/github-package-json.service.js | 21 +++--- services/github/github-package-json.tester.js | 8 +-- services/github/github-pipenv.service.js | 16 ++--- services/github/github-pipenv.tester.js | 9 ++- ...github-pull-request-check-state.service.js | 12 ++-- .../github-pull-request-check-state.tester.js | 2 +- services/github/github-r-package.service.js | 18 +++-- services/github/github-r-package.spec.js | 8 +-- services/github/github-r-package.tester.js | 4 +- .../github/github-release-date.service.js | 14 ++-- services/github/github-release-date.tester.js | 4 +- services/github/github-release.service.js | 20 +++--- services/github/github-release.tester.js | 6 +- services/github/github-repo-size.service.js | 12 ++-- services/github/github-repo-size.tester.js | 4 +- services/github/github-search.service.js | 12 ++-- services/github/github-search.tester.js | 4 +- services/github/github-size.service.js | 14 ++-- services/github/github-size.tester.js | 4 +- services/github/github-sponsors.service.js | 16 ++--- services/github/github-sponsors.tester.js | 4 +- services/github/github-stars.service.js | 12 ++-- services/github/github-stars.tester.js | 4 +- services/github/github-tag.service.js | 23 +++---- services/github/github-tag.spec.js | 4 +- services/github/github-tag.tester.js | 6 +- .../github/github-top-language.service.js | 6 +- services/github/github-top-language.tester.js | 4 +- services/github/github-total-star.service.js | 17 +++-- services/github/github-total-star.tester.js | 4 +- services/github/github-watchers.service.js | 12 ++-- services/github/github-watchers.tester.js | 4 +- .../github/github-workflow-status.service.js | 10 +-- .../github/github-workflow-status.tester.js | 6 +- services/gitlab/gitlab-coverage.service.js | 10 +-- services/gitlab/gitlab-coverage.tester.js | 4 +- .../gitlab/gitlab-pipeline-status.service.js | 13 ++-- .../gitlab/gitlab-pipeline-status.tester.js | 4 +- services/gitter/gitter.service.js | 4 +- services/gitter/gitter.tester.js | 2 +- .../gradle-plugin-portal.tester.js | 2 +- services/gratipay/gratipay.service.js | 4 +- services/gratipay/gratipay.tester.js | 2 +- services/hackage/hackage-deps.service.js | 4 +- services/hackage/hackage-deps.tester.js | 4 +- services/hackage/hackage-version.service.js | 8 +-- services/hackage/hackage-version.tester.js | 4 +- services/hexpm/hexpm.service.js | 10 +-- services/hexpm/hexpm.tester.js | 6 +- services/homebrew/homebrew-cask.service.js | 8 +-- services/homebrew/homebrew-cask.tester.js | 4 +- .../homebrew/homebrew-downloads.service.js | 12 ++-- .../homebrew/homebrew-downloads.tester.js | 4 +- services/homebrew/homebrew-version.service.js | 8 +-- services/homebrew/homebrew-version.tester.js | 4 +- services/hsts/hsts.service.js | 6 +- services/hsts/hsts.tester.js | 2 +- services/imagelayers/imagelayers.service.js | 4 +- services/imagelayers/imagelayers.tester.js | 2 +- services/index.js | 2 +- services/issuestats/issuestats.service.js | 4 +- services/issuestats/issuestats.tester.js | 2 +- services/itunes/itunes.service.js | 10 +-- services/itunes/itunes.tester.js | 4 +- services/jenkins/jenkins-base.js | 4 +- .../jenkins/jenkins-build-redirect.service.js | 6 +- .../jenkins/jenkins-build-redirect.tester.js | 2 +- services/jenkins/jenkins-build.service.js | 14 ++-- services/jenkins/jenkins-build.spec.js | 12 ++-- services/jenkins/jenkins-build.tester.js | 6 +- services/jenkins/jenkins-common.js | 10 +-- services/jenkins/jenkins-common.spec.js | 4 +- .../jenkins-coverage-redirector.service.js | 6 +- .../jenkins-coverage-redirector.tester.js | 2 +- services/jenkins/jenkins-coverage.service.js | 14 ++-- services/jenkins/jenkins-coverage.tester.js | 4 +- .../jenkins-plugin-installs.service.js | 12 ++-- .../jenkins/jenkins-plugin-installs.tester.js | 4 +- .../jenkins/jenkins-plugin-version.service.js | 10 +-- .../jenkins/jenkins-plugin-version.tester.js | 4 +- .../jenkins-tests-redirector.service.js | 6 +- .../jenkins-tests-redirector.tester.js | 2 +- services/jenkins/jenkins-tests.service.js | 22 ++++-- services/jenkins/jenkins-tests.tester.js | 9 ++- services/jetbrains/jetbrains-base.js | 8 +-- .../jetbrains/jetbrains-downloads.service.js | 12 ++-- .../jetbrains/jetbrains-downloads.tester.js | 4 +- .../jetbrains/jetbrains-rating.service.js | 10 +-- services/jetbrains/jetbrains-rating.tester.js | 4 +- .../jetbrains/jetbrains-version.service.js | 8 +-- .../jetbrains/jetbrains-version.tester.js | 4 +- services/jira/jira-common.js | 2 +- services/jira/jira-issue-redirect.service.js | 4 +- services/jira/jira-issue-redirect.tester.js | 2 +- services/jira/jira-issue.service.js | 10 +-- services/jira/jira-issue.spec.js | 10 +-- services/jira/jira-issue.tester.js | 2 +- services/jira/jira-sprint-redirect.service.js | 4 +- services/jira/jira-sprint-redirect.tester.js | 2 +- services/jira/jira-sprint.service.js | 10 +-- services/jira/jira-sprint.spec.js | 17 +++-- services/jira/jira-sprint.tester.js | 6 +- services/jira/jira-test-helpers.js | 9 +-- services/jitpack/jitpack-downloads.service.js | 4 +- services/jitpack/jitpack-downloads.tester.js | 2 +- .../jitpack-version-redirector.service.js | 4 +- .../jitpack-version-redirector.tester.js | 2 +- services/jitpack/jitpack-version.service.js | 8 +-- services/jitpack/jitpack-version.tester.js | 4 +- services/jsdelivr/jsdelivr-base.js | 10 +-- .../jsdelivr/jsdelivr-hits-github.service.js | 4 +- .../jsdelivr/jsdelivr-hits-github.tester.js | 9 ++- .../jsdelivr/jsdelivr-hits-npm.service.js | 4 +- services/jsdelivr/jsdelivr-hits-npm.tester.js | 9 ++- services/keybase/keybase-btc.service.js | 8 +-- services/keybase/keybase-btc.tester.js | 4 +- services/keybase/keybase-pgp.service.js | 8 +-- services/keybase/keybase-pgp.tester.js | 4 +- services/keybase/keybase-profile.js | 4 +- services/keybase/keybase-xlm.service.js | 8 +-- services/keybase/keybase-xlm.tester.js | 4 +- services/keybase/keybase-zec.service.js | 8 +-- services/keybase/keybase-zec.tester.js | 4 +- .../leanpub/leanpub-book-summary.service.js | 4 +- .../leanpub/leanpub-book-summary.tester.js | 2 +- services/lgtm/lgtm-alerts.service.js | 6 +- services/lgtm/lgtm-alerts.tester.js | 6 +- services/lgtm/lgtm-base.js | 6 +- services/lgtm/lgtm-grade.service.js | 4 +- services/lgtm/lgtm-grade.tester.js | 6 +- services/lgtm/lgtm-redirector.service.js | 4 +- services/lgtm/lgtm-redirector.tester.js | 2 +- services/lgtm/lgtm-test-helpers.js | 4 +- services/liberapay/liberapay-base.js | 16 ++--- services/liberapay/liberapay-gives.service.js | 6 +- services/liberapay/liberapay-gives.tester.js | 4 +- services/liberapay/liberapay-goal.service.js | 8 +-- services/liberapay/liberapay-goal.spec.js | 8 +-- services/liberapay/liberapay-goal.tester.js | 4 +- .../liberapay/liberapay-patrons.service.js | 8 +-- .../liberapay/liberapay-patrons.tester.js | 4 +- .../liberapay/liberapay-receives.service.js | 6 +- .../liberapay/liberapay-receives.tester.js | 4 +- services/librariesio/librariesio-common.js | 8 +-- .../librariesio-dependencies-helpers.js | 2 +- .../librariesio-dependencies-helpers.spec.js | 4 +- .../librariesio-dependencies.service.js | 11 +-- .../librariesio-dependencies.tester.js | 4 +- .../librariesio-dependent-repos.service.js | 8 +-- .../librariesio-dependent-repos.tester.js | 4 +- .../librariesio-dependents.service.js | 8 +-- .../librariesio-dependents.tester.js | 4 +- .../librariesio-sourcerank.service.js | 8 +-- .../librariesio-sourcerank.tester.js | 4 +- services/libscore/libscore.service.js | 4 +- services/libscore/libscore.tester.js | 2 +- services/licenses.js | 4 +- services/licenses.spec.js | 4 +- services/localizely/localizely.service.js | 8 +-- services/localizely/localizely.tester.js | 4 +- services/luarocks/luarocks-version-helpers.js | 8 +-- .../luarocks/luarocks-version-helpers.spec.js | 8 ++- services/luarocks/luarocks.service.js | 10 +-- services/luarocks/luarocks.spec.js | 4 +- services/luarocks/luarocks.tester.js | 4 +- services/magnumci/magnumci.service.js | 4 +- services/magnumci/magnumci.tester.js | 2 +- services/maintenance/maintenance.service.js | 4 +- services/maintenance/maintenance.spec.js | 4 +- services/maintenance/maintenance.tester.js | 2 +- services/mastodon/mastodon-follow.service.js | 10 +-- services/mastodon/mastodon-follow.tester.js | 4 +- services/matrix/matrix.service.js | 6 +- services/matrix/matrix.tester.js | 4 +- .../maven-central/maven-central.service.js | 8 +-- .../maven-central/maven-central.tester.js | 4 +- .../maven-metadata-redirect.service.js | 4 +- .../maven-metadata-redirect.tester.js | 2 +- .../maven-metadata/maven-metadata.service.js | 10 +-- .../maven-metadata/maven-metadata.tester.js | 4 +- services/microbadger/microbadger-base.js | 8 +-- .../microbadger/microbadger-layers.service.js | 4 +- .../microbadger/microbadger-layers.tester.js | 4 +- .../microbadger/microbadger-size.service.js | 8 +-- .../microbadger/microbadger-size.tester.js | 4 +- .../mozilla-observatory.service.js | 6 +- .../mozilla-observatory.tester.js | 4 +- services/myget/myget.service.js | 7 +- services/myget/myget.tester.js | 16 +++-- services/netlify/netlify.service.js | 6 +- services/netlify/netlify.spec.js | 4 +- services/netlify/netlify.tester.js | 4 +- services/nexus/nexus-redirect.service.js | 4 +- services/nexus/nexus-redirect.tester.js | 2 +- services/nexus/nexus-version.js | 4 +- services/nexus/nexus.service.js | 17 +++-- services/nexus/nexus.spec.js | 10 +-- services/nexus/nexus.tester.js | 4 +- services/node/node-base.js | 4 +- services/node/node-current.service.js | 6 +- services/node/node-current.spec.js | 4 +- services/node/node-current.tester.js | 10 +-- services/node/node-lts.service.js | 6 +- services/node/node-lts.spec.js | 4 +- services/node/node-lts.tester.js | 14 ++-- services/node/node-version-color.js | 13 ++-- services/node/testUtils/test-utils.js | 25 +++---- services/nodeping/nodeping-status.service.js | 12 ++-- services/nodeping/nodeping-status.tester.js | 4 +- services/nodeping/nodeping-uptime.service.js | 8 +-- services/nodeping/nodeping-uptime.tester.js | 4 +- services/npm/npm-base.js | 12 ++-- services/npm/npm-base.spec.js | 8 +-- services/npm/npm-collaborators.service.js | 6 +- services/npm/npm-collaborators.tester.js | 4 +- .../npm/npm-dependency-version.service.js | 6 +- services/npm/npm-dependency-version.tester.js | 4 +- services/npm/npm-downloads.service.js | 10 +-- services/npm/npm-downloads.spec.js | 4 +- services/npm/npm-downloads.tester.js | 4 +- services/npm/npm-license.service.js | 8 +-- services/npm/npm-license.tester.js | 2 +- services/npm/npm-type-definitions.service.js | 4 +- services/npm/npm-type-definitions.spec.js | 4 +- services/npm/npm-type-definitions.tester.js | 4 +- services/npm/npm-version.service.js | 10 +-- services/npm/npm-version.tester.js | 4 +- services/nsp/nsp.service.js | 4 +- services/nsp/nsp.tester.js | 2 +- services/nuget-fixtures.js | 2 +- services/nuget/nuget-helpers.js | 12 ++-- services/nuget/nuget-helpers.spec.js | 9 ++- services/nuget/nuget-v2-service-family.js | 23 ++++--- services/nuget/nuget-v3-service-family.js | 18 +++-- .../nuget/nuget-v3-service-family.spec.js | 4 +- services/nuget/nuget.service.js | 4 +- services/nuget/nuget.tester.js | 18 +++-- services/nycrc/nycrc.service.js | 12 ++-- services/nycrc/nycrc.tester.js | 4 +- .../offset-earth-carbon-redirect.service.js | 4 +- .../offset-earth-carbon-redirect.tester.js | 2 +- .../offset-earth-trees-redirect.service.js | 4 +- .../offset-earth-trees-redirect.tester.js | 2 +- services/open-vsx/open-vsx-base.js | 8 +-- .../open-vsx/open-vsx-downloads.service.js | 8 +-- .../open-vsx/open-vsx-downloads.tester.js | 4 +- services/open-vsx/open-vsx-rating.service.js | 8 +-- services/open-vsx/open-vsx-rating.spec.js | 4 +- services/open-vsx/open-vsx-rating.tester.js | 4 +- .../open-vsx/open-vsx-release-date.service.js | 8 +-- .../open-vsx/open-vsx-release-date.tester.js | 4 +- services/open-vsx/open-vsx-version.service.js | 6 +- services/open-vsx/open-vsx-version.tester.js | 4 +- .../opencollective-all.service.js | 4 +- .../opencollective-all.tester.js | 4 +- .../opencollective-backers.service.js | 4 +- .../opencollective-backers.tester.js | 4 +- .../opencollective/opencollective-base.js | 8 +-- .../opencollective-by-tier.service.js | 4 +- .../opencollective-by-tier.tester.js | 4 +- .../opencollective-sponsors.service.js | 4 +- .../opencollective-sponsors.tester.js | 4 +- services/opm/opm-version.service.js | 6 +- services/opm/opm-version.tester.js | 4 +- services/ore/ore-base.js | 6 +- services/ore/ore-category.service.js | 4 +- services/ore/ore-category.spec.js | 4 +- services/ore/ore-category.tester.js | 4 +- services/ore/ore-downloads.service.js | 8 +-- services/ore/ore-downloads.tester.js | 4 +- services/ore/ore-license.service.js | 6 +- services/ore/ore-license.spec.js | 4 +- services/ore/ore-license.tester.js | 2 +- services/ore/ore-sponge-versions.service.js | 4 +- services/ore/ore-sponge-versions.spec.js | 4 +- services/ore/ore-sponge-versions.tester.js | 4 +- services/ore/ore-stars.service.js | 6 +- services/ore/ore-stars.tester.js | 4 +- services/ore/ore-version.service.js | 6 +- services/ore/ore-version.spec.js | 4 +- services/ore/ore-version.tester.js | 4 +- services/osslifecycle/osslifecycle.service.js | 4 +- services/osslifecycle/osslifecycle.tester.js | 2 +- services/package-json-helpers.js | 10 +-- services/package-json-helpers.spec.js | 4 +- .../packagecontrol/packagecontrol.service.js | 12 ++-- .../packagecontrol/packagecontrol.tester.js | 4 +- services/packagist/packagist-base.js | 6 +- .../packagist/packagist-downloads.service.js | 17 +++-- .../packagist/packagist-downloads.tester.js | 4 +- .../packagist/packagist-license.service.js | 16 +++-- services/packagist/packagist-license.spec.js | 6 +- .../packagist/packagist-license.tester.js | 2 +- .../packagist-php-version.service.js | 14 ++-- .../packagist/packagist-php-version.spec.js | 6 +- .../packagist/packagist-php-version.tester.js | 4 +- services/packagist/packagist-stars.service.js | 15 +++-- services/packagist/packagist-stars.tester.js | 4 +- .../packagist/packagist-version.service.js | 19 ++++-- .../packagist/packagist-version.tester.js | 6 +- services/php-eye/php-eye-hhvm.service.js | 4 +- services/php-eye/php-eye-hhvm.tester.js | 2 +- .../php-eye/php-eye-php-version.service.js | 4 +- .../php-eye/php-eye-php-version.tester.js | 2 +- services/php-version.js | 14 ++-- services/php-version.spec.js | 4 +- services/pingpong/pingpong-status.service.js | 6 +- services/pingpong/pingpong-status.tester.js | 4 +- services/pingpong/pingpong-uptime.service.js | 8 +-- services/pingpong/pingpong-uptime.tester.js | 4 +- services/pipenv-helpers.js | 9 +-- services/pkgreview/package-rating.service.js | 12 ++-- services/pkgreview/package-rating.tester.js | 4 +- services/poeditor/poeditor.service.js | 10 +-- services/poeditor/poeditor.tester.js | 4 +- .../powershellgallery.service.js | 6 +- .../powershellgallery.tester.js | 10 ++- services/pub/pub.service.js | 8 +-- services/pub/pub.tester.js | 4 +- services/puppetforge/puppetforge-base.js | 11 ++- .../puppetforge-module-downloads.service.js | 12 ++-- .../puppetforge-module-downloads.tester.js | 4 +- .../puppetforge-module-endorsement.service.js | 10 ++- .../puppetforge-module-endorsement.tester.js | 4 +- .../puppetforge-module-feedback.service.js | 12 ++-- .../puppetforge-module-feedback.tester.js | 4 +- .../puppetforge-module-pdk-version.service.js | 12 ++-- .../puppetforge-module-pdk-version.tester.js | 4 +- .../puppetforge-module-version.service.js | 10 ++- .../puppetforge-module-version.tester.js | 4 +- .../puppetforge-user-module-count.service.js | 12 ++-- .../puppetforge-user-module-count.tester.js | 4 +- .../puppetforge-user-release-count.service.js | 12 ++-- .../puppetforge-user-release-count.tester.js | 4 +- services/pypi/pypi-base.js | 6 +- services/pypi/pypi-django-versions.service.js | 6 +- services/pypi/pypi-django-versions.tester.js | 4 +- services/pypi/pypi-downloads.service.js | 12 ++-- services/pypi/pypi-downloads.tester.js | 4 +- services/pypi/pypi-format.service.js | 6 +- services/pypi/pypi-format.tester.js | 2 +- services/pypi/pypi-helpers.js | 2 +- services/pypi/pypi-implementation.service.js | 6 +- services/pypi/pypi-implementation.tester.js | 2 +- services/pypi/pypi-license.service.js | 8 +-- services/pypi/pypi-license.tester.js | 2 +- services/pypi/pypi-python-versions.service.js | 8 +-- services/pypi/pypi-python-versions.spec.js | 4 +- services/pypi/pypi-python-versions.tester.js | 4 +- services/pypi/pypi-status.service.js | 6 +- services/pypi/pypi-status.tester.js | 2 +- services/pypi/pypi-version.service.js | 6 +- services/pypi/pypi-version.tester.js | 6 +- services/pypi/pypi-wheel.service.js | 6 +- services/pypi/pypi-wheel.tester.js | 2 +- services/readthedocs/readthedocs.service.js | 8 +-- services/readthedocs/readthedocs.tester.js | 6 +- .../reddit/subreddit-subscribers.service.js | 10 +-- .../reddit/subreddit-subscribers.tester.js | 4 +- services/reddit/user-karma.service.js | 10 +-- services/reddit/user-karma.tester.js | 4 +- services/redmine/redmine.service.js | 10 +-- services/redmine/redmine.tester.js | 6 +- .../repology/repology-repositories.service.js | 10 +-- .../repology/repology-repositories.tester.js | 4 +- services/requires/requires.service.js | 6 +- services/requires/requires.tester.js | 4 +- services/resharper/resharper.service.js | 4 +- services/resharper/resharper.tester.js | 8 ++- services/response-fixtures.js | 8 +-- services/reuse/reuse-compliance-helper.js | 7 +- services/reuse/reuse-compliance.service.js | 8 +-- services/reuse/reuse-compliance.tester.js | 4 +- services/route-builder.js | 4 +- services/scoop/scoop-version.service.js | 12 ++-- services/scoop/scoop-version.tester.js | 4 +- services/scrutinizer/scrutinizer-base.js | 4 +- .../scrutinizer/scrutinizer-build.service.js | 8 +-- .../scrutinizer/scrutinizer-build.tester.js | 6 +- .../scrutinizer-coverage.service.js | 10 +-- .../scrutinizer/scrutinizer-coverage.spec.js | 8 +-- .../scrutinizer-coverage.tester.js | 4 +- .../scrutinizer-quality.service.js | 8 +-- .../scrutinizer/scrutinizer-quality.tester.js | 4 +- .../scrutinizer-redirect.service.js | 4 +- .../scrutinizer-redirect.tester.js | 2 +- .../security-headers.service.js | 8 +-- .../security-headers.tester.js | 2 +- services/shippable/shippable.service.js | 8 +-- services/shippable/shippable.tester.js | 4 +- services/snap-ci/snap-ci.service.js | 4 +- services/snap-ci/snap-ci.tester.js | 2 +- services/snyk/snyk-test-helpers.js | 5 +- services/snyk/snyk-vulnerability-base.js | 6 +- .../snyk/snyk-vulnerability-github.service.js | 4 +- .../snyk/snyk-vulnerability-github.tester.js | 9 ++- .../snyk/snyk-vulnerability-npm.service.js | 6 +- .../snyk/snyk-vulnerability-npm.tester.js | 9 ++- services/sonar/sonar-base.js | 8 +-- services/sonar/sonar-coverage.service.js | 8 +-- services/sonar/sonar-coverage.tester.js | 4 +- .../sonar-documented-api-density.service.js | 12 +++- .../sonar-documented-api-density.spec.js | 4 +- .../sonar-documented-api-density.tester.js | 2 +- .../sonar/sonar-fortify-rating.service.js | 6 +- services/sonar/sonar-fortify-rating.spec.js | 8 +-- services/sonar/sonar-fortify-rating.tester.js | 2 +- services/sonar/sonar-generic.service.js | 8 +-- services/sonar/sonar-generic.tester.js | 4 +- services/sonar/sonar-helpers.js | 10 +-- services/sonar/sonar-quality-gate.service.js | 6 +- services/sonar/sonar-quality-gate.spec.js | 4 +- services/sonar/sonar-quality-gate.tester.js | 4 +- services/sonar/sonar-redirector.service.js | 4 +- services/sonar/sonar-redirector.tester.js | 4 +- services/sonar/sonar-tech-debt.service.js | 12 +++- services/sonar/sonar-tech-debt.spec.js | 4 +- services/sonar/sonar-tech-debt.tester.js | 4 +- services/sonar/sonar-tests.service.js | 19 ++++-- services/sonar/sonar-tests.spec.js | 4 +- services/sonar/sonar-tests.tester.js | 13 +++- services/sonar/sonar-violations.service.js | 15 +++-- services/sonar/sonar-violations.spec.js | 6 +- services/sonar/sonar-violations.tester.js | 6 +- .../sourceforge-open-tickets.service.js | 10 +-- .../sourceforge-open-tickets.tester.js | 4 +- services/sourceforge/sourceforge.service.js | 14 ++-- services/sourceforge/sourceforge.tester.js | 4 +- services/sourcegraph/sourcegraph.service.js | 6 +- services/sourcegraph/sourcegraph.tester.js | 4 +- services/spack/spack.service.js | 8 +-- services/spack/spack.tester.js | 4 +- services/spiget/spiget-base.js | 6 +- .../spiget/spiget-download-size.service.js | 4 +- .../spiget/spiget-download-size.tester.js | 4 +- services/spiget/spiget-downloads.service.js | 8 +-- services/spiget/spiget-downloads.tester.js | 4 +- .../spiget/spiget-latest-version.service.js | 8 +-- .../spiget/spiget-latest-version.tester.js | 4 +- services/spiget/spiget-rating.service.js | 8 +-- services/spiget/spiget-rating.tester.js | 4 +- .../spiget/spiget-tested-versions.service.js | 4 +- .../spiget/spiget-tested-versions.tester.js | 4 +- .../stackexchange/stackexchange-helpers.js | 6 +- .../stackexchange-monthlyquestions.service.js | 12 ++-- .../stackexchange-monthlyquestions.tester.js | 4 +- .../stackexchange-reputation.service.js | 10 +-- .../stackexchange-reputation.tester.js | 4 +- .../stackexchange-taginfo.service.js | 8 +-- .../stackexchange-taginfo.tester.js | 4 +- .../query-string-static.service.js | 6 +- .../query-string-static.tester.js | 2 +- services/static-badge/static-badge.service.js | 6 +- services/static-badge/static-badge.tester.js | 4 +- services/steam/steam-base.js | 4 +- services/steam/steam-workshop.service.js | 14 ++-- services/steam/steam-workshop.tester.js | 9 ++- services/suggest.integration.js | 14 ++-- services/suggest.js | 10 +-- services/suggest.spec.js | 14 ++-- services/swagger/swagger-redirect.service.js | 4 +- services/swagger/swagger-redirect.tester.js | 2 +- services/swagger/swagger.service.js | 8 +-- services/swagger/swagger.tester.js | 2 +- .../symfony/sensiolabs-redirect.service.js | 4 +- .../symfony/sensiolabs-redirect.tester.js | 2 +- services/symfony/symfony-insight-base.js | 10 +-- services/symfony/symfony-insight-base.spec.js | 6 +- .../symfony/symfony-insight-grade.service.js | 8 ++- .../symfony/symfony-insight-grade.tester.js | 6 +- .../symfony/symfony-insight-stars.service.js | 10 ++- .../symfony/symfony-insight-stars.tester.js | 6 +- .../symfony-insight-violations.service.js | 4 +- .../symfony-insight-violations.tester.js | 6 +- services/symfony/symfony-insight.spec.js | 31 +++++++-- services/symfony/symfony-test-helpers.js | 6 +- services/teamcity/teamcity-base.js | 4 +- .../teamcity-build-redirect.service.js | 4 +- .../teamcity-build-redirect.tester.js | 2 +- services/teamcity/teamcity-build.service.js | 8 +-- services/teamcity/teamcity-build.spec.js | 10 +-- services/teamcity/teamcity-build.tester.js | 6 +- .../teamcity-coverage-redirect.service.js | 4 +- .../teamcity-coverage-redirect.tester.js | 2 +- .../teamcity/teamcity-coverage.service.js | 12 ++-- services/teamcity/teamcity-coverage.spec.js | 10 +-- services/teamcity/teamcity-coverage.tester.js | 4 +- services/teamcity/teamcity-test-helpers.js | 7 +- services/test-helpers.js | 15 ++--- services/test-results.js | 4 +- services/test-results.spec.js | 7 +- services/test-validators.js | 6 +- services/tester.js | 9 +-- services/testspace/testspace-base.js | 8 +-- services/testspace/testspace-base.spec.js | 6 +- .../testspace/testspace-test-count.service.js | 6 +- .../testspace/testspace-test-count.spec.js | 4 +- .../testspace/testspace-test-count.tester.js | 6 +- .../testspace-test-pass-ratio.service.js | 4 +- .../testspace-test-pass-ratio.spec.js | 4 +- .../testspace-test-pass-ratio.tester.js | 4 +- .../testspace-test-summary.service.js | 10 ++- .../testspace-test-summary.tester.js | 9 ++- services/text-formatters.js | 4 +- services/text-formatters.spec.js | 16 ++++- services/tokei/tokei.service.js | 10 +-- services/tokei/tokei.tester.js | 4 +- services/travis/travis-build.service.js | 8 +-- services/travis/travis-build.tester.js | 6 +- .../travis-php-version-redirect.service.js | 4 +- .../travis-php-version-redirect.tester.js | 2 +- services/travis/travis-php-version.service.js | 12 ++-- services/travis/travis-php-version.tester.js | 4 +- services/treeware/treeware-trees.service.js | 12 ++-- services/treeware/treeware-trees.tester.js | 4 +- services/twitch/twitch-base.js | 6 +- services/twitch/twitch.service.js | 6 +- services/twitch/twitch.spec.js | 8 +-- services/twitch/twitch.tester.js | 10 +-- services/twitter/twitter-redirect.service.js | 4 +- services/twitter/twitter-redirect.tester.js | 2 +- services/twitter/twitter.service.js | 10 +-- services/twitter/twitter.tester.js | 4 +- services/ubuntu/ubuntu.service.js | 8 +-- services/ubuntu/ubuntu.tester.js | 4 +- services/uptimerobot/uptimerobot-base.js | 6 +- .../uptimerobot/uptimerobot-ratio.service.js | 6 +- .../uptimerobot/uptimerobot-ratio.tester.js | 6 +- .../uptimerobot/uptimerobot-status.service.js | 4 +- .../uptimerobot/uptimerobot-status.tester.js | 6 +- .../vaadin-directory/vaadin-directory-base.js | 8 +-- .../vaadin-directory-rating-count.service.js | 12 ++-- .../vaadin-directory-rating-count.tester.js | 4 +- .../vaadin-directory-rating.service.js | 12 ++-- .../vaadin-directory-rating.tester.js | 6 +- .../vaadin-directory-release-date.service.js | 12 ++-- .../vaadin-directory-release-date.tester.js | 4 +- .../vaadin-directory-status.service.js | 8 +-- .../vaadin-directory-status.tester.js | 4 +- .../vaadin-directory-version.service.js | 10 ++- .../vaadin-directory-version.tester.js | 4 +- services/validators.js | 22 +++--- services/version.js | 14 ++-- services/version.spec.js | 4 +- services/versioneye/versioneye.service.js | 4 +- services/versioneye/versioneye.tester.js | 2 +- .../visual-studio-app-center-base.js | 4 +- ...visual-studio-app-center-builds.service.js | 18 ++--- .../visual-studio-app-center-builds.tester.js | 2 +- ...o-app-center-releases-osversion.service.js | 14 ++-- ...io-app-center-releases-osversion.tester.js | 2 +- ...studio-app-center-releases-size.service.js | 18 ++--- ...-studio-app-center-releases-size.tester.js | 4 +- ...dio-app-center-releases-version.service.js | 16 +++-- ...udio-app-center-releases-version.tester.js | 2 +- ...rketplace-azure-devops-installs.service.js | 12 ++-- ...arketplace-azure-devops-installs.tester.js | 4 +- .../visual-studio-marketplace-base.js | 8 +-- ...al-studio-marketplace-downloads.service.js | 12 ++-- ...ual-studio-marketplace-downloads.tester.js | 4 +- ...studio-marketplace-last-updated.service.js | 12 ++-- ...-studio-marketplace-last-updated.tester.js | 4 +- ...isual-studio-marketplace-rating.service.js | 12 ++-- ...visual-studio-marketplace-rating.tester.js | 4 +- ...studio-marketplace-release-date.service.js | 12 ++-- ...-studio-marketplace-release-date.tester.js | 4 +- ...sual-studio-marketplace-version.service.js | 10 ++- ...isual-studio-marketplace-version.tester.js | 4 +- services/w3c/w3c-validation-helper.js | 8 +-- services/w3c/w3c-validation-helper.spec.js | 11 ++- services/w3c/w3c-validation.service.js | 16 +++-- services/w3c/w3c-validation.tester.js | 4 +- .../waffle/waffle-label-redirect.service.js | 4 +- .../waffle/waffle-label-redirect.tester.js | 2 +- services/waffle/waffle-label.service.js | 4 +- services/waffle/waffle-label.tester.js | 2 +- services/website-status.js | 8 +-- services/website-status.spec.js | 4 +- services/website/website-redirect.service.js | 14 ++-- services/website/website-redirect.tester.js | 2 +- services/website/website.service.js | 18 +++-- services/website/website.tester.js | 2 +- services/wercker/wercker.service.js | 8 +-- services/wercker/wercker.tester.js | 4 +- services/wheelmap/wheelmap.service.js | 6 +- services/wheelmap/wheelmap.spec.js | 8 +-- services/wheelmap/wheelmap.tester.js | 8 +-- services/wordpress/wordpress-base.js | 8 +-- .../wordpress/wordpress-downloads.service.js | 12 ++-- .../wordpress/wordpress-downloads.tester.js | 4 +- .../wordpress-last-update.service.js | 12 ++-- .../wordpress/wordpress-last-update.tester.js | 4 +- .../wordpress-platform-redirect.service.js | 4 +- .../wordpress-platform-redirect.tester.js | 2 +- .../wordpress/wordpress-platform.service.js | 12 ++-- .../wordpress/wordpress-platform.tester.js | 9 ++- .../wordpress/wordpress-rating.service.js | 8 +-- services/wordpress/wordpress-rating.tester.js | 4 +- services/wordpress/wordpress-version-color.js | 12 ++-- .../wordpress/wordpress-version-color.spec.js | 7 +- .../wordpress/wordpress-version.service.js | 8 +-- .../wordpress/wordpress-version.tester.js | 4 +- services/youtube/youtube-base.js | 10 +-- .../youtube/youtube-channel-views.service.js | 4 +- .../youtube/youtube-channel-views.tester.js | 10 +-- services/youtube/youtube-comments.service.js | 4 +- services/youtube/youtube-comments.tester.js | 10 +-- services/youtube/youtube-likes.service.js | 8 +-- services/youtube/youtube-likes.tester.js | 12 ++-- .../youtube/youtube-subscribers.service.js | 4 +- .../youtube/youtube-subscribers.tester.js | 10 +-- services/youtube/youtube-views.service.js | 4 +- services/youtube/youtube-views.tester.js | 10 +-- 1098 files changed, 4020 insertions(+), 3809 deletions(-) diff --git a/core/badge-urls/make-badge-url.js b/core/badge-urls/make-badge-url.js index dbe5e8f1b9269..74ebeab099e6b 100644 --- a/core/badge-urls/make-badge-url.js +++ b/core/badge-urls/make-badge-url.js @@ -1,6 +1,6 @@ -import {URL} from 'url'; -import queryString from 'query-string'; -import {compile} from 'path-to-regexp'; +import { URL } from 'url' +import queryString from 'query-string' +import { compile } from 'path-to-regexp' function badgeUrlFromPath({ baseUrl = '', @@ -50,7 +50,7 @@ function badgeUrlFromPattern({ } function encodeField(s) { - return encodeURIComponent(s.replace(/-/g, '--').replace(/_/g, '__')); + return encodeURIComponent(s.replace(/-/g, '--').replace(/_/g, '__')) } function staticBadgeUrl({ @@ -159,4 +159,4 @@ export { queryStringStaticBadgeUrl, dynamicBadgeUrl, rasterRedirectUrl, -}; +} diff --git a/core/badge-urls/make-badge-url.spec.js b/core/badge-urls/make-badge-url.spec.js index 9b9711516be6e..da0b156d5ea71 100644 --- a/core/badge-urls/make-badge-url.spec.js +++ b/core/badge-urls/make-badge-url.spec.js @@ -1,5 +1,12 @@ -import {test, given} from 'sazerac'; -import {badgeUrlFromPath, badgeUrlFromPattern, encodeField, staticBadgeUrl, queryStringStaticBadgeUrl, dynamicBadgeUrl} from './make-badge-url.js'; +import { test, given } from 'sazerac' +import { + badgeUrlFromPath, + badgeUrlFromPattern, + encodeField, + staticBadgeUrl, + queryStringStaticBadgeUrl, + dynamicBadgeUrl, +} from './make-badge-url.js' describe('Badge URL generation functions', function () { test(badgeUrlFromPath, () => { diff --git a/core/badge-urls/path-helpers.js b/core/badge-urls/path-helpers.js index fe6796c190bee..74c1004f30e42 100644 --- a/core/badge-urls/path-helpers.js +++ b/core/badge-urls/path-helpers.js @@ -1,14 +1,14 @@ // Escapes `t` using the format specified in // function escapeFormat(t) { - return t - // Single underscore. - .replace(/(^|[^_])((?:__)*)_(?!_)/g, '$1$2 ') - // Double underscore and double dash. - .replace(/__/g, '_') - .replace(/--/g, '-'); + return ( + t + // Single underscore. + .replace(/(^|[^_])((?:__)*)_(?!_)/g, '$1$2 ') + // Double underscore and double dash. + .replace(/__/g, '_') + .replace(/--/g, '-') + ) } -export { - escapeFormat, -}; +export { escapeFormat } diff --git a/core/badge-urls/path-helpers.spec.js b/core/badge-urls/path-helpers.spec.js index c0adbfdbace2c..88de5a4869ebd 100644 --- a/core/badge-urls/path-helpers.spec.js +++ b/core/badge-urls/path-helpers.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {escapeFormat} from './path-helpers.js'; +import { test, given } from 'sazerac' +import { escapeFormat } from './path-helpers.js' describe('Badge URL helper functions', function () { test(escapeFormat, () => { diff --git a/core/base-service/auth-helper.js b/core/base-service/auth-helper.js index 0050e97fc1d97..8c9c7976be972 100644 --- a/core/base-service/auth-helper.js +++ b/core/base-service/auth-helper.js @@ -1,5 +1,5 @@ -import {URL} from 'url'; -import {InvalidParameter} from './errors.js'; +import { URL } from 'url' +import { InvalidParameter } from './errors.js' class AuthHelper { constructor( @@ -205,4 +205,4 @@ class AuthHelper { } } -export { AuthHelper }; +export { AuthHelper } diff --git a/core/base-service/auth-helper.spec.js b/core/base-service/auth-helper.spec.js index 6a3903b7dc0d3..fd36f950575ac 100644 --- a/core/base-service/auth-helper.spec.js +++ b/core/base-service/auth-helper.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import {test, given, forCases} from 'sazerac'; -import {AuthHelper} from './auth-helper.js'; -import {InvalidParameter} from './errors.js'; +import { expect } from 'chai' +import { test, given, forCases } from 'sazerac' +import { AuthHelper } from './auth-helper.js' +import { InvalidParameter } from './errors.js' describe('AuthHelper', function () { describe('constructor checks', function () { diff --git a/core/base-service/base-graphql.js b/core/base-service/base-graphql.js index a6ff3d46b844c..bbdcb9224802c 100644 --- a/core/base-service/base-graphql.js +++ b/core/base-service/base-graphql.js @@ -2,10 +2,10 @@ * @module */ -import {print} from 'graphql/language/printer.js'; -import BaseService from './base.js'; -import {InvalidResponse, ShieldsRuntimeError} from './errors.js'; -import {parseJson} from './json.js'; +import { print } from 'graphql/language/printer.js' +import BaseService from './base.js' +import { InvalidResponse, ShieldsRuntimeError } from './errors.js' +import { parseJson } from './json.js' function defaultTransformErrors(errors) { return new InvalidResponse({ prettyMessage: errors[0].message }) @@ -91,4 +91,4 @@ class BaseGraphqlService extends BaseService { } } -export default BaseGraphqlService; +export default BaseGraphqlService diff --git a/core/base-service/base-graphql.spec.js b/core/base-service/base-graphql.spec.js index 2c3ecfd5d1851..ee59b8ddecd87 100644 --- a/core/base-service/base-graphql.spec.js +++ b/core/base-service/base-graphql.spec.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import {expect} from 'chai'; -import gql from 'graphql-tag'; -import sinon from 'sinon'; -import BaseGraphqlService from './base-graphql.js'; -import {InvalidResponse} from './errors.js'; +import Joi from 'joi' +import { expect } from 'chai' +import gql from 'graphql-tag' +import sinon from 'sinon' +import BaseGraphqlService from './base-graphql.js' +import { InvalidResponse } from './errors.js' const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base-json.js b/core/base-service/base-json.js index d534620b224c6..7f4730d2d2058 100644 --- a/core/base-service/base-json.js +++ b/core/base-service/base-json.js @@ -2,8 +2,8 @@ * @module */ -import BaseService from './base.js'; -import {parseJson} from './json.js'; +import BaseService from './base.js' +import { parseJson } from './json.js' /** * Services which query a JSON endpoint should extend BaseJsonService @@ -52,4 +52,4 @@ class BaseJsonService extends BaseService { } } -export default BaseJsonService; +export default BaseJsonService diff --git a/core/base-service/base-json.spec.js b/core/base-service/base-json.spec.js index 31f35dd6ef09e..45665e4702893 100644 --- a/core/base-service/base-json.spec.js +++ b/core/base-service/base-json.spec.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {expect} from 'chai'; -import sinon from 'sinon'; -import BaseJsonService from './base-json.js'; +import Joi from 'joi' +import { expect } from 'chai' +import sinon from 'sinon' +import BaseJsonService from './base-json.js' const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base-static.js b/core/base-service/base-static.js index a5454f425fd57..df9eae5efb953 100644 --- a/core/base-service/base-static.js +++ b/core/base-service/base-static.js @@ -1,10 +1,13 @@ -import makeBadge from '../../badge-maker/lib/make-badge.js'; -import BaseService from './base.js'; -import {serverHasBeenUpSinceResourceCached, setCacheHeadersForStaticResource} from './cache-headers.js'; -import {makeSend} from './legacy-result-sender.js'; -import {MetricHelper} from './metric-helper.js'; -import coalesceBadge from './coalesce-badge.js'; -import {prepareRoute, namedParamsForMatch} from './route.js'; +import makeBadge from '../../badge-maker/lib/make-badge.js' +import BaseService from './base.js' +import { + serverHasBeenUpSinceResourceCached, + setCacheHeadersForStaticResource, +} from './cache-headers.js' +import { makeSend } from './legacy-result-sender.js' +import { MetricHelper } from './metric-helper.js' +import coalesceBadge from './coalesce-badge.js' +import { prepareRoute, namedParamsForMatch } from './route.js' export default class BaseStaticService extends BaseService { static register({ camp, metricInstance }, serviceConfig) { @@ -52,4 +55,4 @@ export default class BaseStaticService extends BaseService { metricHandle.noteResponseSent() }) } -}; +} diff --git a/core/base-service/base-svg-scraping.js b/core/base-service/base-svg-scraping.js index 26379c86647b8..993e0b584bdc5 100644 --- a/core/base-service/base-svg-scraping.js +++ b/core/base-service/base-svg-scraping.js @@ -3,10 +3,10 @@ */ // See available emoji at http://emoji.muan.co/ -import emojic from 'emojic'; -import BaseService from './base.js'; -import trace from './trace.js'; -import {InvalidResponse} from './errors.js'; +import emojic from 'emojic' +import BaseService from './base.js' +import trace from './trace.js' +import { InvalidResponse } from './errors.js' const defaultValueMatcher = />([^<>]+)<\/text><\/g>/ const leadingWhitespace = /(?:\r\n\s*|\r\s*|\n\s*)/g @@ -88,4 +88,4 @@ class BaseSvgScrapingService extends BaseService { } } -export default BaseSvgScrapingService; +export default BaseSvgScrapingService diff --git a/core/base-service/base-svg-scraping.spec.js b/core/base-service/base-svg-scraping.spec.js index 8cb3c812ca072..728f3bd188c7b 100644 --- a/core/base-service/base-svg-scraping.spec.js +++ b/core/base-service/base-svg-scraping.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import sinon from 'sinon'; -import Joi from 'joi'; -import makeBadge from '../../badge-maker/lib/make-badge.js'; -import BaseSvgScrapingService from './base-svg-scraping.js'; +import { expect } from 'chai' +import sinon from 'sinon' +import Joi from 'joi' +import makeBadge from '../../badge-maker/lib/make-badge.js' +import BaseSvgScrapingService from './base-svg-scraping.js' const schema = Joi.object({ message: Joi.string().required(), @@ -114,7 +114,7 @@ describe('BaseSvgScrapingService', function () { schema, valueMatcher: />([^<>]+)<\/desc>/, url: 'http://example.com/foo.svg', - }); + }) } } const sendAndCacheRequest = async () => ({ diff --git a/core/base-service/base-xml.js b/core/base-service/base-xml.js index 7dcd73aac634e..ee0c5e9020a0b 100644 --- a/core/base-service/base-xml.js +++ b/core/base-service/base-xml.js @@ -3,11 +3,11 @@ */ // See available emoji at http://emoji.muan.co/ -import emojic from 'emojic'; -import fastXmlParser from 'fast-xml-parser'; -import BaseService from './base.js'; -import trace from './trace.js'; -import {InvalidResponse} from './errors.js'; +import emojic from 'emojic' +import fastXmlParser from 'fast-xml-parser' +import BaseService from './base.js' +import trace from './trace.js' +import { InvalidResponse } from './errors.js' /** * Services which query a XML endpoint should extend BaseXmlService @@ -66,4 +66,4 @@ class BaseXmlService extends BaseService { } } -export default BaseXmlService; +export default BaseXmlService diff --git a/core/base-service/base-xml.spec.js b/core/base-service/base-xml.spec.js index 135360aaf7197..8db8dfc6f7a10 100644 --- a/core/base-service/base-xml.spec.js +++ b/core/base-service/base-xml.spec.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {expect} from 'chai'; -import sinon from 'sinon'; -import BaseXmlService from './base-xml.js'; +import Joi from 'joi' +import { expect } from 'chai' +import sinon from 'sinon' +import BaseXmlService from './base-xml.js' const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base-yaml.js b/core/base-service/base-yaml.js index 7b3264675ccc8..0dd75930cac42 100644 --- a/core/base-service/base-yaml.js +++ b/core/base-service/base-yaml.js @@ -2,11 +2,11 @@ * @module */ -import emojic from 'emojic'; -import yaml from 'js-yaml'; -import BaseService from './base.js'; -import {InvalidResponse} from './errors.js'; -import trace from './trace.js'; +import emojic from 'emojic' +import yaml from 'js-yaml' +import BaseService from './base.js' +import { InvalidResponse } from './errors.js' +import trace from './trace.js' /** * Services which query a YAML endpoint should extend BaseYamlService @@ -70,4 +70,4 @@ class BaseYamlService extends BaseService { } } -export default BaseYamlService; +export default BaseYamlService diff --git a/core/base-service/base-yaml.spec.js b/core/base-service/base-yaml.spec.js index f7b5efe320704..50b42990c1701 100644 --- a/core/base-service/base-yaml.spec.js +++ b/core/base-service/base-yaml.spec.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {expect} from 'chai'; -import sinon from 'sinon'; -import BaseYamlService from './base-yaml.js'; +import Joi from 'joi' +import { expect } from 'chai' +import sinon from 'sinon' +import BaseYamlService from './base-yaml.js' const dummySchema = Joi.object({ requiredString: Joi.string().required(), diff --git a/core/base-service/base.js b/core/base-service/base.js index de1784f4360bb..0a22086601bce 100644 --- a/core/base-service/base.js +++ b/core/base-service/base.js @@ -3,20 +3,33 @@ */ // See available emoji at http://emoji.muan.co/ -import emojic from 'emojic'; -import Joi from 'joi'; -import log from '../server/log.js'; -import {AuthHelper} from './auth-helper.js'; -import {MetricHelper, MetricNames} from './metric-helper.js'; -import {assertValidCategory} from './categories.js'; -import checkErrorResponse from './check-error-response.js'; -import coalesceBadge from './coalesce-badge.js'; -import {NotFound, InvalidResponse, Inaccessible, ImproperlyConfigured, InvalidParameter, Deprecated} from './errors.js'; -import {validateExample, transformExample} from './examples.js'; -import {makeFullUrl, assertValidRoute, prepareRoute, namedParamsForMatch, getQueryParamNames} from './route.js'; -import {assertValidServiceDefinition} from './service-definitions.js'; -import trace from './trace.js'; -import validate from './validate.js'; +import emojic from 'emojic' +import Joi from 'joi' +import log from '../server/log.js' +import { AuthHelper } from './auth-helper.js' +import { MetricHelper, MetricNames } from './metric-helper.js' +import { assertValidCategory } from './categories.js' +import checkErrorResponse from './check-error-response.js' +import coalesceBadge from './coalesce-badge.js' +import { + NotFound, + InvalidResponse, + Inaccessible, + ImproperlyConfigured, + InvalidParameter, + Deprecated, +} from './errors.js' +import { validateExample, transformExample } from './examples.js' +import { + makeFullUrl, + assertValidRoute, + prepareRoute, + namedParamsForMatch, + getQueryParamNames, +} from './route.js' +import { assertValidServiceDefinition } from './service-definitions.js' +import trace from './trace.js' +import validate from './validate.js' const defaultBadgeDataSchema = Joi.object({ label: Joi.string(), @@ -551,4 +564,4 @@ class BaseService { * An HTML string that is included in the badge popup. */ -export default BaseService; +export default BaseService diff --git a/core/base-service/base.spec.js b/core/base-service/base.spec.js index fad084a735e40..ac58c86598203 100644 --- a/core/base-service/base.spec.js +++ b/core/base-service/base.spec.js @@ -1,14 +1,20 @@ -import Joi from 'joi'; -import chai from 'chai'; -import sinon from 'sinon'; -import prometheus from 'prom-client'; +import Joi from 'joi' +import chai from 'chai' +import sinon from 'sinon' +import prometheus from 'prom-client' import chaiAsPromised from 'chai-as-promised' -import PrometheusMetrics from '../server/prometheus-metrics.js'; -import trace from './trace.js'; -import {NotFound, Inaccessible, InvalidResponse, InvalidParameter, Deprecated} from './errors.js'; -import BaseService from './base.js'; -import {MetricHelper, MetricNames} from './metric-helper.js'; -import '../register-chai-plugins.spec.js'; +import PrometheusMetrics from '../server/prometheus-metrics.js' +import trace from './trace.js' +import { + NotFound, + Inaccessible, + InvalidResponse, + InvalidParameter, + Deprecated, +} from './errors.js' +import BaseService from './base.js' +import { MetricHelper, MetricNames } from './metric-helper.js' +import '../register-chai-plugins.spec.js' const { expect } = chai chai.use(chaiAsPromised) @@ -98,7 +104,7 @@ describe('BaseService', function () { it('Should throw if route is not overridden', function () { return expect(BaseService.invoke({}, {}, {})).to.be.rejectedWith( /^Route not defined for BaseService$/ - ); + ) }) class WithRoute extends BaseService { @@ -107,7 +113,7 @@ describe('BaseService', function () { it('Should throw if handle() is not overridden', function () { return expect(WithRoute.invoke({}, {}, {})).to.be.rejectedWith( /^Handler not implemented for WithRoute$/ - ); + ) }) it('Should throw if category is not overridden', function () { diff --git a/core/base-service/cache-headers.js b/core/base-service/cache-headers.js index 8b133e38d4a8f..14a707efae7e3 100644 --- a/core/base-service/cache-headers.js +++ b/core/base-service/cache-headers.js @@ -1,6 +1,6 @@ -import assert from 'assert'; -import Joi from 'joi'; -import coalesce from './coalesce.js'; +import assert from 'assert' +import Joi from 'joi' +import coalesce from './coalesce.js' const serverStartTimeGMTString = new Date().toGMTString() const serverStartTimestamp = Date.now() @@ -108,4 +108,4 @@ export { setHeadersForCacheLength, setCacheHeadersForStaticResource, serverHasBeenUpSinceResourceCached, -}; +} diff --git a/core/base-service/cache-headers.spec.js b/core/base-service/cache-headers.spec.js index e23d715ee0076..9c705116a2fe7 100644 --- a/core/base-service/cache-headers.spec.js +++ b/core/base-service/cache-headers.spec.js @@ -1,5 +1,5 @@ import { test, given } from 'sazerac' -import chai, {expect} from 'chai' +import chai, { expect } from 'chai' import sinon from 'sinon' import httpMocks from 'node-mocks-http' import chaiDatetime from 'chai-datetime' diff --git a/core/base-service/categories.js b/core/base-service/categories.js index 40eeeff0b5098..14042f9a4d7ed 100644 --- a/core/base-service/categories.js +++ b/core/base-service/categories.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import categories from '../../services/categories.js'; +import Joi from 'joi' +import categories from '../../services/categories.js' const isRealCategory = Joi.equal(...categories.map(({ id }) => id)).required() @@ -11,7 +11,4 @@ function assertValidCategory(category, message = undefined) { Joi.assert(category, isValidCategory, message) } -export { - isValidCategory, - assertValidCategory, -}; +export { isValidCategory, assertValidCategory } diff --git a/core/base-service/check-error-response.js b/core/base-service/check-error-response.js index 31029b39e135d..ea21344f3639f 100644 --- a/core/base-service/check-error-response.js +++ b/core/base-service/check-error-response.js @@ -1,4 +1,4 @@ -import {NotFound, InvalidResponse, Inaccessible} from './errors.js'; +import { NotFound, InvalidResponse, Inaccessible } from './errors.js' const defaultErrorMessages = { 404: 'not found', @@ -32,4 +32,4 @@ export default function checkErrorResponse(errorMessages = {}) { return { buffer, res } } } -}; +} diff --git a/core/base-service/check-error-response.spec.js b/core/base-service/check-error-response.spec.js index 2bfc3c329430e..82d239bec1cec 100644 --- a/core/base-service/check-error-response.spec.js +++ b/core/base-service/check-error-response.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {NotFound, InvalidResponse, Inaccessible} from './errors.js'; -import checkErrorResponse from './check-error-response.js'; +import { expect } from 'chai' +import { NotFound, InvalidResponse, Inaccessible } from './errors.js' +import checkErrorResponse from './check-error-response.js' describe('async error handler', function () { const buffer = Buffer.from('some stuff') diff --git a/core/base-service/coalesce-badge.js b/core/base-service/coalesce-badge.js index 29478e3d7139c..db171fee347b4 100644 --- a/core/base-service/coalesce-badge.js +++ b/core/base-service/coalesce-badge.js @@ -1,7 +1,10 @@ -import {decodeDataUrlFromQueryParam, prepareNamedLogo} from '../../lib/logos.js'; -import {svg2base64} from '../../lib/svg-helpers.js'; -import coalesce from './coalesce.js'; -import toArray from './to-array.js'; +import { + decodeDataUrlFromQueryParam, + prepareNamedLogo, +} from '../../lib/logos.js' +import { svg2base64 } from '../../lib/svg-helpers.js' +import coalesce from './coalesce.js' +import toArray from './to-array.js' // Translate modern badge data to the legacy schema understood by the badge // maker. Allow the user to override the label, color, logo, etc. through the @@ -180,4 +183,4 @@ export default function coalesceBadge( links: toArray(overrideLink || serviceLink), cacheLengthSeconds: coalesce(serviceCacheSeconds, defaultCacheSeconds), } -}; +} diff --git a/core/base-service/coalesce-badge.spec.js b/core/base-service/coalesce-badge.spec.js index f7c347ca1ce15..07ffedbe2010c 100644 --- a/core/base-service/coalesce-badge.spec.js +++ b/core/base-service/coalesce-badge.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {getShieldsIcon, getSimpleIcon} from '../../lib/logos.js'; -import coalesceBadge from './coalesce-badge.js'; +import { expect } from 'chai' +import { getShieldsIcon, getSimpleIcon } from '../../lib/logos.js' +import coalesceBadge from './coalesce-badge.js' describe('coalesceBadge', function () { describe('Label', function () { diff --git a/core/base-service/coalesce.js b/core/base-service/coalesce.js index 845c896d2ab2c..8a55ff4c89dd7 100644 --- a/core/base-service/coalesce.js +++ b/core/base-service/coalesce.js @@ -1,3 +1,3 @@ export default function coalesce(...candidates) { return candidates.find(c => c !== undefined && c !== null) -}; +} diff --git a/core/base-service/coalesce.spec.js b/core/base-service/coalesce.spec.js index 901e67963479d..361f2bd8a7d32 100644 --- a/core/base-service/coalesce.spec.js +++ b/core/base-service/coalesce.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import coalesce from './coalesce.js'; +import { test, given } from 'sazerac' +import coalesce from './coalesce.js' // Sticking with our one-line spread implementation, and defaulting to // `undefined` instead of `null`, though h/t to diff --git a/core/base-service/deprecated-service.js b/core/base-service/deprecated-service.js index 9bc927c0ef573..03ce5b2485e74 100644 --- a/core/base-service/deprecated-service.js +++ b/core/base-service/deprecated-service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import camelcase from 'camelcase'; -import BaseService from './base.js'; -import {isValidCategory} from './categories.js'; -import {Deprecated} from './errors.js'; -import {isValidRoute} from './route.js'; +import Joi from 'joi' +import camelcase from 'camelcase' +import BaseService from './base.js' +import { isValidCategory } from './categories.js' +import { Deprecated } from './errors.js' +import { isValidRoute } from './route.js' const attrSchema = Joi.object({ route: isValidRoute, @@ -39,7 +39,7 @@ function deprecatedService(attrs) { async handle() { throw new Deprecated({ prettyMessage: message }) } - }; + } } -export default deprecatedService; +export default deprecatedService diff --git a/core/base-service/deprecated-service.spec.js b/core/base-service/deprecated-service.spec.js index 4167f0a6d4ed4..58ca62b6d9a12 100644 --- a/core/base-service/deprecated-service.spec.js +++ b/core/base-service/deprecated-service.spec.js @@ -1,5 +1,5 @@ -import {expect} from 'chai'; -import deprecatedService from './deprecated-service.js'; +import { expect } from 'chai' +import deprecatedService from './deprecated-service.js' describe('DeprecatedService', function () { const route = { diff --git a/core/base-service/errors.js b/core/base-service/errors.js index 4e351c92d51d1..a1c897ff6d0e9 100644 --- a/core/base-service/errors.js +++ b/core/base-service/errors.js @@ -216,4 +216,4 @@ export { Inaccessible, InvalidParameter, Deprecated, -}; +} diff --git a/core/base-service/examples.js b/core/base-service/examples.js index f8fd106e8af1e..6aa9ff03ed891 100644 --- a/core/base-service/examples.js +++ b/core/base-service/examples.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {pathToRegexp, compile} from 'path-to-regexp'; -import categories from '../../services/categories.js'; -import coalesceBadge from './coalesce-badge.js'; -import {makeFullUrl} from './route.js'; +import Joi from 'joi' +import { pathToRegexp, compile } from 'path-to-regexp' +import categories from '../../services/categories.js' +import coalesceBadge from './coalesce-badge.js' +import { makeFullUrl } from './route.js' const optionalObjectOfKeyValues = Joi.object().pattern( /./, @@ -153,7 +153,4 @@ function transformExample(inExample, index, ServiceClass) { } } -export { - validateExample, - transformExample, -}; +export { validateExample, transformExample } diff --git a/core/base-service/examples.spec.js b/core/base-service/examples.spec.js index 8259922d75dd1..770b257165999 100644 --- a/core/base-service/examples.spec.js +++ b/core/base-service/examples.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {validateExample, transformExample} from './examples.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { validateExample, transformExample } from './examples.js' describe('validateExample function', function () { it('passes valid examples', function () { diff --git a/core/base-service/graphql.js b/core/base-service/graphql.js index 8b08fb40106c2..416fc735d7602 100644 --- a/core/base-service/graphql.js +++ b/core/base-service/graphql.js @@ -48,4 +48,4 @@ function mergeQueries(...queries) { return merged } -export { mergeQueries }; +export { mergeQueries } diff --git a/core/base-service/graphql.spec.js b/core/base-service/graphql.spec.js index f853b1fb6145d..2267ecf41b722 100644 --- a/core/base-service/graphql.spec.js +++ b/core/base-service/graphql.spec.js @@ -1,9 +1,9 @@ -import {expect} from 'chai'; -import gql from 'graphql-tag'; -import {print} from 'graphql/language/printer.js'; -import {mergeQueries} from './graphql.js'; +import { expect } from 'chai' +import gql from 'graphql-tag' +import { print } from 'graphql/language/printer.js' +import { mergeQueries } from './graphql.js' -import '../register-chai-plugins.spec.js'; +import '../register-chai-plugins.spec.js' describe('mergeQueries function', function () { it('merges valid gql queries', function () { diff --git a/core/base-service/index.js b/core/base-service/index.js index 8cf6a332f0b5b..502ede424bd31 100644 --- a/core/base-service/index.js +++ b/core/base-service/index.js @@ -1,13 +1,19 @@ -import BaseService from './base.js'; -import BaseJsonService from './base-json.js'; -import BaseGraphqlService from './base-graphql.js'; -import BaseStaticService from './base-static.js'; -import BaseSvgScrapingService from './base-svg-scraping.js'; -import BaseXmlService from './base-xml.js'; -import BaseYamlService from './base-yaml.js'; -import deprecatedService from './deprecated-service.js'; -import redirector from './redirector.js'; -import {NotFound, InvalidResponse, Inaccessible, InvalidParameter, Deprecated} from './errors.js'; +import BaseService from './base.js' +import BaseJsonService from './base-json.js' +import BaseGraphqlService from './base-graphql.js' +import BaseStaticService from './base-static.js' +import BaseSvgScrapingService from './base-svg-scraping.js' +import BaseXmlService from './base-xml.js' +import BaseYamlService from './base-yaml.js' +import deprecatedService from './deprecated-service.js' +import redirector from './redirector.js' +import { + NotFound, + InvalidResponse, + Inaccessible, + InvalidParameter, + Deprecated, +} from './errors.js' export { BaseService, @@ -24,4 +30,4 @@ export { Inaccessible, InvalidParameter, Deprecated, -}; +} diff --git a/core/base-service/json.js b/core/base-service/json.js index 086aaab30e7e3..f7b549e1512eb 100644 --- a/core/base-service/json.js +++ b/core/base-service/json.js @@ -1,7 +1,7 @@ // See available emoji at http://emoji.muan.co/ -import emojic from 'emojic'; -import {InvalidResponse} from './errors.js'; -import trace from './trace.js'; +import emojic from 'emojic' +import { InvalidResponse } from './errors.js' +import trace from './trace.js' function parseJson(buffer) { const logTrace = (...args) => trace.logTrace('fetch', ...args) @@ -21,6 +21,4 @@ function parseJson(buffer) { return json } -export { - parseJson, -}; +export { parseJson } diff --git a/core/base-service/legacy-request-handler.js b/core/base-service/legacy-request-handler.js index 6445a1e8b6974..725b1d66179e1 100644 --- a/core/base-service/legacy-request-handler.js +++ b/core/base-service/legacy-request-handler.js @@ -1,9 +1,9 @@ -import request from 'request'; -import makeBadge from '../../badge-maker/lib/make-badge.js'; -import {setCacheHeaders} from './cache-headers.js'; -import {Inaccessible, InvalidResponse, ShieldsRuntimeError} from './errors.js'; -import {makeSend} from './legacy-result-sender.js'; -import coalesceBadge from './coalesce-badge.js'; +import request from 'request' +import makeBadge from '../../badge-maker/lib/make-badge.js' +import { setCacheHeaders } from './cache-headers.js' +import { Inaccessible, InvalidResponse, ShieldsRuntimeError } from './errors.js' +import { makeSend } from './legacy-result-sender.js' +import coalesceBadge from './coalesce-badge.js' const userAgent = 'Shields.io/2003a' @@ -197,11 +197,7 @@ function handleRequest(cacheHeaderConfig, handlerOptions) { throw err }) } - }; + } } -export { - handleRequest, - promisify, - userAgent, -}; +export { handleRequest, promisify, userAgent } diff --git a/core/base-service/legacy-request-handler.spec.js b/core/base-service/legacy-request-handler.spec.js index c40342dcbc09c..1ea498f72a2f2 100644 --- a/core/base-service/legacy-request-handler.spec.js +++ b/core/base-service/legacy-request-handler.spec.js @@ -1,10 +1,10 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import portfinder from 'portfinder'; -import Camp from '@shields_io/camp'; -import got from '../got-test-client.js'; -import coalesceBadge from './coalesce-badge.js'; -import {handleRequest} from './legacy-request-handler.js'; +import { expect } from 'chai' +import nock from 'nock' +import portfinder from 'portfinder' +import Camp from '@shields_io/camp' +import got from '../got-test-client.js' +import coalesceBadge from './coalesce-badge.js' +import { handleRequest } from './legacy-request-handler.js' async function performTwoRequests(baseUrl, first, second) { expect((await got(`${baseUrl}${first}`)).statusCode).to.equal(200) diff --git a/core/base-service/legacy-result-sender.js b/core/base-service/legacy-result-sender.js index 2aafb7505f016..90ee870e4b9ca 100644 --- a/core/base-service/legacy-result-sender.js +++ b/core/base-service/legacy-result-sender.js @@ -1,4 +1,4 @@ -import stream from 'stream'; +import stream from 'stream' function streamFromString(str) { const newStream = new stream.Readable() @@ -30,6 +30,4 @@ function makeSend(format, askres, end) { } } -export { - makeSend, -}; +export { makeSend } diff --git a/core/base-service/loader-test-fixtures/empty-array.fixture.js b/core/base-service/loader-test-fixtures/empty-array.fixture.js index d6d1738de67ec..9859f0797256b 100644 --- a/core/base-service/loader-test-fixtures/empty-array.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-array.fixture.js @@ -1 +1 @@ -export default []; +export default [] diff --git a/core/base-service/loader-test-fixtures/empty-object.fixture.js b/core/base-service/loader-test-fixtures/empty-object.fixture.js index cb0ff5c3b541f..336ce12bb9106 100644 --- a/core/base-service/loader-test-fixtures/empty-object.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-object.fixture.js @@ -1 +1 @@ -export {}; +export {} diff --git a/core/base-service/loader-test-fixtures/empty-undefined.fixture.js b/core/base-service/loader-test-fixtures/empty-undefined.fixture.js index f237ddf58ed4f..edb72725b9e7c 100644 --- a/core/base-service/loader-test-fixtures/empty-undefined.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-undefined.fixture.js @@ -1 +1 @@ -export default undefined; +export default undefined diff --git a/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js b/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js index 25cc6a46a25c1..40096a3065399 100644 --- a/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-mixed.fixture.js @@ -1,4 +1,4 @@ -import BaseJsonService from '../base-json.js'; +import BaseJsonService from '../base-json.js' class BadBaseService {} class GoodService extends BaseJsonService { @@ -7,4 +7,4 @@ class GoodService extends BaseJsonService { } class BadService extends BadBaseService {} -export default [GoodService, BadService]; +export default [GoodService, BadService] diff --git a/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js b/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js index 5654839e70853..4651b17bfef86 100644 --- a/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-no-base.fixture.js @@ -1,3 +1,3 @@ class BadService {} -export default BadService; +export default BadService diff --git a/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js b/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js index a607f8e49855d..9ca5e17cb45c9 100644 --- a/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js +++ b/core/base-service/loader-test-fixtures/invalid-wrong-base.fixture.js @@ -1,4 +1,4 @@ class BadBaseService {} class BadService extends BadBaseService {} -export default BadService; +export default BadService diff --git a/core/base-service/loader-test-fixtures/valid-array.fixture.js b/core/base-service/loader-test-fixtures/valid-array.fixture.js index 1e1bb2b34931f..c820022a8a9af 100644 --- a/core/base-service/loader-test-fixtures/valid-array.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-array.fixture.js @@ -1,4 +1,4 @@ -import BaseJsonService from '../base-json.js'; +import BaseJsonService from '../base-json.js' class GoodServiceOne extends BaseJsonService { static category = 'build' @@ -9,4 +9,4 @@ class GoodServiceTwo extends BaseJsonService { static route = { base: 'good', pattern: 'two' } } -export default [GoodServiceOne, GoodServiceTwo]; +export default [GoodServiceOne, GoodServiceTwo] diff --git a/core/base-service/loader-test-fixtures/valid-class.fixture.js b/core/base-service/loader-test-fixtures/valid-class.fixture.js index 8541e4bc28b72..0b193a9405df7 100644 --- a/core/base-service/loader-test-fixtures/valid-class.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-class.fixture.js @@ -1,8 +1,8 @@ -import BaseJsonService from '../base-json.js'; +import BaseJsonService from '../base-json.js' class GoodService extends BaseJsonService { static category = 'build' static route = { base: 'it/is', pattern: 'good' } } -export default GoodService; +export default GoodService diff --git a/core/base-service/loader-test-fixtures/valid-object.fixture.js b/core/base-service/loader-test-fixtures/valid-object.fixture.js index 5d11c4d34c7d3..5a312db98f48c 100644 --- a/core/base-service/loader-test-fixtures/valid-object.fixture.js +++ b/core/base-service/loader-test-fixtures/valid-object.fixture.js @@ -1,4 +1,4 @@ -import BaseJsonService from '../base-json.js'; +import BaseJsonService from '../base-json.js' class GoodServiceOne extends BaseJsonService { static category = 'build' @@ -9,4 +9,4 @@ class GoodServiceTwo extends BaseJsonService { static route = { base: 'good', pattern: 'two' } } -export { GoodServiceOne, GoodServiceTwo }; +export { GoodServiceOne, GoodServiceTwo } diff --git a/core/base-service/loader.js b/core/base-service/loader.js index 5b953d4483807..cf499eca1560f 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -1,12 +1,17 @@ -import path from 'path'; -import {fileURLToPath} from 'url'; -import glob from 'glob'; -import countBy from 'lodash.countby'; -import categories from '../../services/categories.js'; -import BaseService from './base.js'; -import {assertValidServiceDefinitionExport} from './service-definitions.js'; +import path from 'path' +import { fileURLToPath } from 'url' +import glob from 'glob' +import countBy from 'lodash.countby' +import categories from '../../services/categories.js' +import BaseService from './base.js' +import { assertValidServiceDefinitionExport } from './service-definitions.js' -const serviceDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'services') +const serviceDir = path.join( + path.dirname(fileURLToPath(import.meta.url)), + '..', + '..', + 'services' +) class InvalidService extends Error { constructor(message) { @@ -22,28 +27,30 @@ async function loadServiceClasses(servicePaths) { const serviceClasses = [] for await (const servicePath of servicePaths) { - const currentServiceClasses = Object.values(await import(`file://${servicePath}`)) - .flatMap(element => typeof element === 'object' ? Object.values(element) : element) - + const currentServiceClasses = Object.values( + await import(`file://${servicePath}`) + ).flatMap(element => + typeof element === 'object' ? Object.values(element) : element + ) + if (currentServiceClasses.length === 0) { throw new InvalidService( `Expected ${servicePath} to export a service or a collection of services` ) } - currentServiceClasses - .forEach(serviceClass => { - if (serviceClass && serviceClass.prototype instanceof BaseService) { - // Decorate each service class with the directory that contains it. - serviceClass.serviceFamily = servicePath - .replace(serviceDir, '') - .split(path.sep)[1] - serviceClass.validateDefinition() - return serviceClasses.push(serviceClass) - } - throw new InvalidService( - `Expected ${servicePath} to export a service or a collection of services; one of them was ${serviceClass}` - ) - }) + currentServiceClasses.forEach(serviceClass => { + if (serviceClass && serviceClass.prototype instanceof BaseService) { + // Decorate each service class with the directory that contains it. + serviceClass.serviceFamily = servicePath + .replace(serviceDir, '') + .split(path.sep)[1] + serviceClass.validateDefinition() + return serviceClasses.push(serviceClass) + } + throw new InvalidService( + `Expected ${servicePath} to export a service or a collection of services; one of them was ${serviceClass}` + ) + }) } return serviceClasses @@ -85,9 +92,11 @@ async function collectDefinitions() { } async function loadTesters() { - return Promise.all(glob - .sync(path.join(serviceDir, '**', '*.tester.js')) - .map(async path => await import(`file://${path}`))) + return Promise.all( + glob + .sync(path.join(serviceDir, '**', '*.tester.js')) + .map(async path => await import(`file://${path}`)) + ) } export { @@ -96,4 +105,4 @@ export { checkNames, collectDefinitions, loadTesters, -}; +} diff --git a/core/base-service/loader.spec.js b/core/base-service/loader.spec.js index 2b7094850b20c..e26c28fc1e0ec 100644 --- a/core/base-service/loader.spec.js +++ b/core/base-service/loader.spec.js @@ -1,12 +1,15 @@ -import path from 'path'; -import {fileURLToPath} from 'url'; -import chai from 'chai'; +import path from 'path' +import { fileURLToPath } from 'url' +import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import {loadServiceClasses, InvalidService} from './loader.js'; +import { loadServiceClasses, InvalidService } from './loader.js' chai.use(chaiAsPromised) const { expect } = chai -const fixturesDir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'loader-test-fixtures') +const fixturesDir = path.join( + path.dirname(fileURLToPath(import.meta.url)), + 'loader-test-fixtures' +) describe('loadServiceClasses function', function () { it('throws if module exports empty', async function () { @@ -36,7 +39,9 @@ describe('loadServiceClasses function', function () { loadServiceClasses([path.join(fixturesDir, 'invalid-no-base.fixture.js')]) ).to.be.rejectedWith(InvalidService) await expect( - loadServiceClasses([path.join(fixturesDir, 'invalid-wrong-base.fixture.js')]) + loadServiceClasses([ + path.join(fixturesDir, 'invalid-wrong-base.fixture.js'), + ]) ).to.be.rejectedWith(InvalidService) await expect( loadServiceClasses([path.join(fixturesDir, 'invalid-mixed.fixture.js')]) diff --git a/core/base-service/metric-helper.js b/core/base-service/metric-helper.js index c11ebca2a6d3c..646aa721b5a28 100644 --- a/core/base-service/metric-helper.js +++ b/core/base-service/metric-helper.js @@ -1,4 +1,4 @@ -import {performance} from 'perf_hooks'; +import { performance } from 'perf_hooks' class MetricHelper { constructor({ metricInstance }, { category, serviceFamily, name }) { @@ -57,4 +57,4 @@ const MetricNames = Object.freeze({ SERVICE_RESPONSE_SIZE: Symbol('service-response-size'), }) -export { MetricHelper, MetricNames }; +export { MetricHelper, MetricNames } diff --git a/core/base-service/redirector.js b/core/base-service/redirector.js index ea8dd2a6fdea0..094e3af07f485 100644 --- a/core/base-service/redirector.js +++ b/core/base-service/redirector.js @@ -1,13 +1,16 @@ -import camelcase from 'camelcase'; -import emojic from 'emojic'; -import Joi from 'joi'; -import queryString from 'query-string'; -import BaseService from './base.js'; -import {serverHasBeenUpSinceResourceCached, setCacheHeadersForStaticResource} from './cache-headers.js'; -import {isValidCategory} from './categories.js'; -import {MetricHelper} from './metric-helper.js'; -import {isValidRoute, prepareRoute, namedParamsForMatch} from './route.js'; -import trace from './trace.js'; +import camelcase from 'camelcase' +import emojic from 'emojic' +import Joi from 'joi' +import queryString from 'query-string' +import BaseService from './base.js' +import { + serverHasBeenUpSinceResourceCached, + setCacheHeadersForStaticResource, +} from './cache-headers.js' +import { isValidCategory } from './categories.js' +import { MetricHelper } from './metric-helper.js' +import { isValidRoute, prepareRoute, namedParamsForMatch } from './route.js' +import trace from './trace.js' const attrSchema = Joi.object({ name: Joi.string().min(3), @@ -116,5 +119,5 @@ export default function redirector(attrs) { metricHandle.noteResponseSent() }) } - }; -}; + } +} diff --git a/core/base-service/redirector.spec.js b/core/base-service/redirector.spec.js index 422ce2001a664..4b1912d2305e4 100644 --- a/core/base-service/redirector.spec.js +++ b/core/base-service/redirector.spec.js @@ -1,8 +1,8 @@ -import Camp from '@shields_io/camp'; -import portfinder from 'portfinder'; -import {expect} from 'chai'; -import got from '../got-test-client.js'; -import redirector from './redirector.js'; +import Camp from '@shields_io/camp' +import portfinder from 'portfinder' +import { expect } from 'chai' +import got from '../got-test-client.js' +import redirector from './redirector.js' describe('Redirector', function () { const route = { diff --git a/core/base-service/route.js b/core/base-service/route.js index 1c7e8fbea8449..24a7801ed1479 100644 --- a/core/base-service/route.js +++ b/core/base-service/route.js @@ -1,6 +1,6 @@ -import escapeStringRegexp from 'escape-string-regexp'; -import Joi from 'joi'; -import {pathToRegexp} from 'path-to-regexp'; +import escapeStringRegexp from 'escape-string-regexp' +import Joi from 'joi' +import { pathToRegexp } from 'path-to-regexp' function makeFullUrl(base, partialUrl) { return `/${[base, partialUrl].filter(Boolean).join('/')}` @@ -79,4 +79,4 @@ export { prepareRoute, namedParamsForMatch, getQueryParamNames, -}; +} diff --git a/core/base-service/route.spec.js b/core/base-service/route.spec.js index 54e1db62da550..42326d8745d8b 100644 --- a/core/base-service/route.spec.js +++ b/core/base-service/route.spec.js @@ -1,7 +1,11 @@ -import {expect} from 'chai'; -import Joi from 'joi'; -import {test, given, forCases} from 'sazerac'; -import {prepareRoute, namedParamsForMatch, getQueryParamNames} from './route.js'; +import { expect } from 'chai' +import Joi from 'joi' +import { test, given, forCases } from 'sazerac' +import { + prepareRoute, + namedParamsForMatch, + getQueryParamNames, +} from './route.js' describe('Route helpers', function () { context('A `pattern` with a named param is declared', function () { diff --git a/core/base-service/service-definitions.js b/core/base-service/service-definitions.js index af22df646b785..1d66f4e91446c 100644 --- a/core/base-service/service-definitions.js +++ b/core/base-service/service-definitions.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' // This should be kept in sync with the schema in // `frontend/lib/service-definitions/index.ts`. @@ -75,4 +75,4 @@ export { assertValidServiceDefinition, serviceDefinitionExport, assertValidServiceDefinitionExport, -}; +} diff --git a/core/base-service/to-array.js b/core/base-service/to-array.js index cfbaeb3d38079..f2131490cf6a6 100644 --- a/core/base-service/to-array.js +++ b/core/base-service/to-array.js @@ -6,4 +6,4 @@ export default function toArray(val) { } else { return [val] } -}; +} diff --git a/core/base-service/trace.js b/core/base-service/trace.js index 5f7527929d55c..7eda5881c52c8 100644 --- a/core/base-service/trace.js +++ b/core/base-service/trace.js @@ -1,5 +1,5 @@ -import chalk from 'chalk'; -import config from 'config'; +import chalk from 'chalk' +import config from 'config' const objectConfig = config.util.toObject() // Config is loaded globally but it would be better to inject it. To do that, @@ -38,4 +38,4 @@ function logTrace(stage, symbol, label, content, { deep = false } = {}) { export default { logTrace, -}; +} diff --git a/core/base-service/validate.js b/core/base-service/validate.js index fc5afb021d654..23990b15dd58e 100644 --- a/core/base-service/validate.js +++ b/core/base-service/validate.js @@ -1,6 +1,6 @@ -import emojic from 'emojic'; -import Joi from 'joi'; -import trace from './trace.js'; +import emojic from 'emojic' +import Joi from 'joi' +import trace from './trace.js' function validate( { @@ -48,4 +48,4 @@ function validate( } } -export default validate; +export default validate diff --git a/core/base-service/validate.spec.js b/core/base-service/validate.spec.js index c340620beb5c2..78f6c46f5ceeb 100644 --- a/core/base-service/validate.spec.js +++ b/core/base-service/validate.spec.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import {expect} from 'chai'; -import sinon from 'sinon'; -import trace from './trace.js'; -import {InvalidParameter} from './errors.js'; -import validate from './validate.js'; +import Joi from 'joi' +import { expect } from 'chai' +import sinon from 'sinon' +import trace from './trace.js' +import { InvalidParameter } from './errors.js' +import validate from './validate.js' describe('validate', function () { const schema = Joi.object({ diff --git a/core/got-test-client.js b/core/got-test-client.js index 32b24cc4243aa..d8800f46173c1 100644 --- a/core/got-test-client.js +++ b/core/got-test-client.js @@ -1,4 +1,4 @@ -import got from 'got'; +import got from 'got' // https://github.com/nock/nock/issues/1523 -export default got.extend({ retry: 0 }); +export default got.extend({ retry: 0 }) diff --git a/core/legacy/regular-update.js b/core/legacy/regular-update.js index 314333a38d8ce..d60d89112f7e4 100644 --- a/core/legacy/regular-update.js +++ b/core/legacy/regular-update.js @@ -1,5 +1,5 @@ -import requestModule from 'request'; -import {Inaccessible, InvalidResponse} from '../base-service/errors.js'; +import requestModule from 'request' +import { Inaccessible, InvalidResponse } from '../base-service/errors.js' // Map from URL to { timestamp: last fetch time, data: data }. let regularUpdateCache = Object.create(null) @@ -94,7 +94,4 @@ function clearRegularUpdateCache() { regularUpdateCache = Object.create(null) } -export { - regularUpdate, - clearRegularUpdateCache, -}; +export { regularUpdate, clearRegularUpdateCache } diff --git a/core/register-chai-plugins.spec.js b/core/register-chai-plugins.spec.js index 77d3df348cb60..7b38803d7b8d0 100644 --- a/core/register-chai-plugins.spec.js +++ b/core/register-chai-plugins.spec.js @@ -1,5 +1,5 @@ -import {use} from 'chai'; -import chaiString from'chai-string' -import sinonChai from'sinon-chai' +import { use } from 'chai' +import chaiString from 'chai-string' +import sinonChai from 'sinon-chai' use(chaiString) use(sinonChai) diff --git a/core/server/in-process-server-test-helpers.js b/core/server/in-process-server-test-helpers.js index 455620f0b6e3f..f27bc447c2031 100644 --- a/core/server/in-process-server-test-helpers.js +++ b/core/server/in-process-server-test-helpers.js @@ -1,7 +1,7 @@ -import merge from 'deepmerge'; -import config from 'config'; -import portfinder from 'portfinder'; -import Server from './server.js'; +import merge from 'deepmerge' +import config from 'config' +import portfinder from 'portfinder' +import Server from './server.js' async function createTestServer(customConfig = {}) { const mergedConfig = merge(config.util.toObject(), customConfig) @@ -11,6 +11,4 @@ async function createTestServer(customConfig = {}) { return new Server(mergedConfig) } -export { - createTestServer, -}; +export { createTestServer } diff --git a/core/server/influx-metrics.js b/core/server/influx-metrics.js index 237bdc9e5843b..eae365f9e0cc6 100644 --- a/core/server/influx-metrics.js +++ b/core/server/influx-metrics.js @@ -1,8 +1,8 @@ -import os from 'os'; -import got from 'got'; -import generateInstanceId from './instance-id-generator.js'; -import {promClientJsonToInfluxV2} from './metrics/format-converters.js'; -import log from './log.js'; +import os from 'os' +import got from 'got' +import generateInstanceId from './instance-id-generator.js' +import { promClientJsonToInfluxV2 } from './metrics/format-converters.js' +import log from './log.js' export default class InfluxMetrics { constructor(metricInstance, config) { @@ -78,4 +78,4 @@ export default class InfluxMetrics { this._intervalId = undefined } } -}; +} diff --git a/core/server/influx-metrics.spec.js b/core/server/influx-metrics.spec.js index f4c815b25f378..529edeaaeb132 100644 --- a/core/server/influx-metrics.spec.js +++ b/core/server/influx-metrics.spec.js @@ -1,10 +1,10 @@ -import os from 'os'; -import nock from 'nock'; -import sinon from 'sinon'; -import {expect} from 'chai'; -import log from './log.js'; -import InfluxMetrics from './influx-metrics.js'; -import '../register-chai-plugins.spec.js'; +import os from 'os' +import nock from 'nock' +import sinon from 'sinon' +import { expect } from 'chai' +import log from './log.js' +import InfluxMetrics from './influx-metrics.js' +import '../register-chai-plugins.spec.js' describe('Influx metrics', function () { const metricInstance = { metrics() { diff --git a/core/server/instance-id-generator.js b/core/server/instance-id-generator.js index ba5ecdee1f322..63ad06d09a387 100644 --- a/core/server/instance-id-generator.js +++ b/core/server/instance-id-generator.js @@ -3,4 +3,4 @@ function generateInstanceId() { return Math.random().toString(36).substr(2, 9) } -export default generateInstanceId; +export default generateInstanceId diff --git a/core/server/log.js b/core/server/log.js index a675fc1e4b053..c89aae419a606 100644 --- a/core/server/log.js +++ b/core/server/log.js @@ -1,4 +1,4 @@ -import Sentry from '@sentry/node'; +import Sentry from '@sentry/node' const listeners = [] @@ -26,16 +26,16 @@ const log = (...msg) => { const d = date() listeners.forEach(f => f(d, ...msg)) console.log(d, ...msg) -}; +} const error = err => { const d = date() listeners.forEach(f => f(d, err)) Sentry.captureException(err) console.error(d, err) -}; +} -const addListener = func => listeners.push(func) +const addListener = func => listeners.push(func) const removeListener = func => { const index = listeners.indexOf(func) @@ -43,11 +43,11 @@ const removeListener = func => { return } listeners.splice(index, 1) -}; +} export default { log, error, addListener, removeListener, -}; +} diff --git a/core/server/metrics/format-converters.js b/core/server/metrics/format-converters.js index ba92199d1ca64..53a60b0f54630 100644 --- a/core/server/metrics/format-converters.js +++ b/core/server/metrics/format-converters.js @@ -1,4 +1,4 @@ -import groupBy from 'lodash.groupby'; +import groupBy from 'lodash.groupby' function promClientJsonToInfluxV2(metrics, extraLabels = {}) { return metrics @@ -23,4 +23,4 @@ function promClientJsonToInfluxV2(metrics, extraLabels = {}) { .join('\n') } -export { promClientJsonToInfluxV2 }; +export { promClientJsonToInfluxV2 } diff --git a/core/server/metrics/format-converters.spec.js b/core/server/metrics/format-converters.spec.js index f60a641cbbb64..3ea4a51028cdc 100644 --- a/core/server/metrics/format-converters.spec.js +++ b/core/server/metrics/format-converters.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import prometheus from 'prom-client'; -import {promClientJsonToInfluxV2} from './format-converters.js'; +import { expect } from 'chai' +import prometheus from 'prom-client' +import { promClientJsonToInfluxV2 } from './format-converters.js' describe('Metric format converters', function () { describe('prom-client JSON to InfluxDB line protocol (version 2)', function () { diff --git a/core/server/prometheus-metrics.js b/core/server/prometheus-metrics.js index aa2af9d01d99f..072a497c1bafb 100644 --- a/core/server/prometheus-metrics.js +++ b/core/server/prometheus-metrics.js @@ -1,5 +1,5 @@ -import decamelize from 'decamelize'; -import prometheus from 'prom-client'; +import decamelize from 'decamelize' +import prometheus from 'prom-client' export default class PrometheusMetrics { constructor({ register } = {}) { @@ -82,4 +82,4 @@ export default class PrometheusMetrics { service ) } -}; +} diff --git a/core/server/prometheus-metrics.spec.js b/core/server/prometheus-metrics.spec.js index 47c7e062d9795..31fa40afb0bad 100644 --- a/core/server/prometheus-metrics.spec.js +++ b/core/server/prometheus-metrics.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import Camp from '@shields_io/camp'; -import portfinder from 'portfinder'; -import got from '../got-test-client.js'; -import Metrics from './prometheus-metrics.js'; +import { expect } from 'chai' +import Camp from '@shields_io/camp' +import portfinder from 'portfinder' +import got from '../got-test-client.js' +import Metrics from './prometheus-metrics.js' describe('Prometheus metrics route', function () { let port, baseUrl, camp, metrics diff --git a/core/server/secret-is-valid.js b/core/server/secret-is-valid.js index a1e9a232e4e50..c8b87ffda123f 100644 --- a/core/server/secret-is-valid.js +++ b/core/server/secret-is-valid.js @@ -15,4 +15,4 @@ function makeSecretIsValid(shieldsSecret) { } } -export { makeSecretIsValid }; +export { makeSecretIsValid } diff --git a/core/server/server.js b/core/server/server.js index 952ee3484ae44..b19278b049963 100644 --- a/core/server/server.js +++ b/core/server/server.js @@ -2,24 +2,24 @@ * @module */ -import path from 'path'; -import url, {fileURLToPath} from 'url'; -import cloudflareMiddleware from 'cloudflare-middleware'; -import bytes from 'bytes'; -import Camp from '@shields_io/camp'; -import originalJoi from 'joi'; -import makeBadge from '../../badge-maker/lib/make-badge.js'; -import GithubConstellation from '../../services/github/github-constellation.js'; -import {setRoutes} from '../../services/suggest.js'; -import {loadServiceClasses} from '../base-service/loader.js'; -import {makeSend} from '../base-service/legacy-result-sender.js'; -import {handleRequest} from '../base-service/legacy-request-handler.js'; -import {clearRegularUpdateCache} from '../legacy/regular-update.js'; -import {rasterRedirectUrl} from '../badge-urls/make-badge-url.js'; -import {nonNegativeInteger} from '../../services/validators.js'; -import log from './log.js'; -import PrometheusMetrics from './prometheus-metrics.js'; -import InfluxMetrics from './influx-metrics.js'; +import path from 'path' +import url, { fileURLToPath } from 'url' +import cloudflareMiddleware from 'cloudflare-middleware' +import bytes from 'bytes' +import Camp from '@shields_io/camp' +import originalJoi from 'joi' +import makeBadge from '../../badge-maker/lib/make-badge.js' +import GithubConstellation from '../../services/github/github-constellation.js' +import { setRoutes } from '../../services/suggest.js' +import { loadServiceClasses } from '../base-service/loader.js' +import { makeSend } from '../base-service/legacy-result-sender.js' +import { handleRequest } from '../base-service/legacy-request-handler.js' +import { clearRegularUpdateCache } from '../legacy/regular-update.js' +import { rasterRedirectUrl } from '../badge-urls/make-badge-url.js' +import { nonNegativeInteger } from '../../services/validators.js' +import log from './log.js' +import PrometheusMetrics from './prometheus-metrics.js' +import InfluxMetrics from './influx-metrics.js' const { URL } = url const Joi = originalJoi @@ -142,7 +142,12 @@ const publicConfigSchema = Joi.object({ requestTimeoutSeconds: nonNegativeInteger, requestTimeoutMaxAgeSeconds: nonNegativeInteger, documentRoot: Joi.string().default( - path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'public') + path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + '..', + '..', + 'public' + ) ), requireCloudflare: Joi.boolean().required(), }).required() @@ -521,4 +526,4 @@ class Server { } } -export default Server; +export default Server diff --git a/core/server/server.spec.js b/core/server/server.spec.js index 07364231e50c0..dc43db3f5607d 100644 --- a/core/server/server.spec.js +++ b/core/server/server.spec.js @@ -1,13 +1,13 @@ -import path from 'path'; -import {fileURLToPath} from 'url' -import {expect} from 'chai'; -import isSvg from 'is-svg'; -import config from 'config'; -import nock from 'nock'; -import sinon from 'sinon'; -import got from '../got-test-client.js'; -import Server from './server.js'; -import {createTestServer} from './in-process-server-test-helpers.js'; +import path from 'path' +import { fileURLToPath } from 'url' +import { expect } from 'chai' +import isSvg from 'is-svg' +import config from 'config' +import nock from 'nock' +import sinon from 'sinon' +import got from '../got-test-client.js' +import Server from './server.js' +import { createTestServer } from './in-process-server-test-helpers.js' describe('The server', function () { describe('running', function () { @@ -17,7 +17,10 @@ describe('The server', function () { this.timeout(10000) server = await createTestServer({ public: { - documentRoot: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'test-public'), + documentRoot: path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + 'test-public' + ), }, }) baseUrl = server.baseUrl diff --git a/core/service-test-runner/cli.js b/core/service-test-runner/cli.js index 6f6725c0ff4d4..afb3c4dc51058 100644 --- a/core/service-test-runner/cli.js +++ b/core/service-test-runner/cli.js @@ -54,13 +54,13 @@ // Relying on npm scripts is safer. Using "pre" makes it impossible to run // the second step without the first. -import minimist from 'minimist'; -import envFlag from 'node-env-flag'; -import readAllStdinSync from 'read-all-stdin-sync'; -import {createTestServer} from '../server/in-process-server-test-helpers.js'; -import Runner from './runner.js'; +import minimist from 'minimist' +import envFlag from 'node-env-flag' +import readAllStdinSync from 'read-all-stdin-sync' +import { createTestServer } from '../server/in-process-server-test-helpers.js' +import Runner from './runner.js' -import('../unhandled-rejection.spec.js'); +import('../unhandled-rejection.spec.js') const retry = {} retry.count = parseInt(process.env.RETRY_COUNT) || 0 diff --git a/core/service-test-runner/create-service-tester.js b/core/service-test-runner/create-service-tester.js index a6ce13bae14d3..17246b6693374 100644 --- a/core/service-test-runner/create-service-tester.js +++ b/core/service-test-runner/create-service-tester.js @@ -2,9 +2,9 @@ * @module */ -import caller from 'caller'; -import BaseService from '../base-service/base.js'; -import ServiceTester from './service-tester.js'; +import caller from 'caller' +import BaseService from '../base-service/base.js' +import ServiceTester from './service-tester.js' /** * Automatically create a ServiceTester. @@ -29,4 +29,4 @@ async function createServiceTester() { return ServiceTester.forServiceClass(ServiceClass) } -export default createServiceTester; +export default createServiceTester diff --git a/core/service-test-runner/icedfrisby-shields.js b/core/service-test-runner/icedfrisby-shields.js index b7c3e9698915f..947b7f2eb08ba 100644 --- a/core/service-test-runner/icedfrisby-shields.js +++ b/core/service-test-runner/icedfrisby-shields.js @@ -2,8 +2,8 @@ * @module */ -import Joi from 'joi'; -import {expect} from 'chai'; +import Joi from 'joi' +import { expect } from 'chai' /** * Factory which wraps an "icedfrisby-nock" with some additional functionality: @@ -15,7 +15,7 @@ import {expect} from 'chai'; * @returns {Function} wrapped class */ const factory = superclass => - (class IcedFrisbyNock extends superclass { + class IcedFrisbyNock extends superclass { constructor(message) { super(message) this.intercepted = false @@ -82,6 +82,6 @@ const factory = superclass => ) } } - }) + } -export default factory; +export default factory diff --git a/core/service-test-runner/infer-pull-request.js b/core/service-test-runner/infer-pull-request.js index 51e7a9702d5d6..91a46cadb857d 100644 --- a/core/service-test-runner/infer-pull-request.js +++ b/core/service-test-runner/infer-pull-request.js @@ -2,7 +2,7 @@ * @module */ -import {URL, format as urlFormat} from 'url'; +import { URL, format as urlFormat } from 'url' function formatSlug(owner, repo, pullRequest) { return `${owner}/${repo}#${pullRequest}` @@ -97,8 +97,4 @@ function inferPullRequest(env = process.env) { * @property {string} slug owner/repo/#pullRequest */ -export { - parseGithubPullRequestUrl, - parseGithubRepoSlug, - inferPullRequest, -}; +export { parseGithubPullRequestUrl, parseGithubRepoSlug, inferPullRequest } diff --git a/core/service-test-runner/infer-pull-request.spec.js b/core/service-test-runner/infer-pull-request.spec.js index 05b768ca0330a..c2050d533e406 100644 --- a/core/service-test-runner/infer-pull-request.spec.js +++ b/core/service-test-runner/infer-pull-request.spec.js @@ -1,5 +1,8 @@ -import {test, given, forCases} from 'sazerac'; -import {parseGithubPullRequestUrl, inferPullRequest} from './infer-pull-request.js'; +import { test, given, forCases } from 'sazerac' +import { + parseGithubPullRequestUrl, + inferPullRequest, +} from './infer-pull-request.js' describe('Pull request inference', function () { test(parseGithubPullRequestUrl, () => { diff --git a/core/service-test-runner/pull-request-services-cli.js b/core/service-test-runner/pull-request-services-cli.js index a87e577aaf087..34d8d20993c78 100644 --- a/core/service-test-runner/pull-request-services-cli.js +++ b/core/service-test-runner/pull-request-services-cli.js @@ -13,9 +13,9 @@ // // TRAVIS=1 TRAVIS_REPO_SLUG=badges/shields TRAVIS_PULL_REQUEST=1108 npm run test:services:pr:prepare -import got from 'got'; -import {inferPullRequest} from './infer-pull-request.js'; -import servicesForTitle from './services-for-title.js'; +import got from 'got' +import { inferPullRequest } from './infer-pull-request.js' +import servicesForTitle from './services-for-title.js' async function getTitle(owner, repo, pullRequest) { const { @@ -51,7 +51,7 @@ async function main() { } } -(async () => { +;(async () => { try { await main() } catch (e) { diff --git a/core/service-test-runner/runner.js b/core/service-test-runner/runner.js index f2afc1460e7a3..4b6cf47f89863 100644 --- a/core/service-test-runner/runner.js +++ b/core/service-test-runner/runner.js @@ -2,7 +2,7 @@ * @module */ -import {loadTesters} from '../base-service/loader.js'; +import { loadTesters } from '../base-service/loader.js' /** * Load a collection of ServiceTester objects and register them with Mocha. @@ -24,7 +24,9 @@ class Runner { * Prepare the runner by loading up all the ServiceTester objects. */ async prepare() { - this.testers = (await loadTesters()).flatMap(testerModule => Object.values(testerModule)) + this.testers = (await loadTesters()).flatMap(testerModule => + Object.values(testerModule) + ) this.testers.forEach(tester => { tester.beforeEach = () => { this.beforeEach() @@ -71,4 +73,4 @@ class Runner { testers.forEach(tester => tester.toss({ baseUrl, skipIntercepted, retry })) } } -export default Runner; +export default Runner diff --git a/core/service-test-runner/service-tester.js b/core/service-test-runner/service-tester.js index 73f20301e6faf..3cc94c5d55f3b 100644 --- a/core/service-test-runner/service-tester.js +++ b/core/service-test-runner/service-tester.js @@ -2,10 +2,10 @@ * @module */ -import emojic from 'emojic'; +import emojic from 'emojic' import icedfrisbyNockModule from 'icedfrisby-nock' import icedfrisbyModule from 'icedfrisby' -import trace from '../base-service/trace.js'; +import trace from '../base-service/trace.js' import icedfrisbyShieldsModule from './icedfrisby-shields.js' const frisby = icedfrisbyShieldsModule(icedfrisbyNockModule(icedfrisbyModule)) @@ -139,4 +139,4 @@ class ServiceTester { } } -export default ServiceTester; +export default ServiceTester diff --git a/core/service-test-runner/services-for-title.js b/core/service-test-runner/services-for-title.js index 0c55c3fcbf1db..862198fcea013 100644 --- a/core/service-test-runner/services-for-title.js +++ b/core/service-test-runner/services-for-title.js @@ -2,7 +2,7 @@ * @module */ -import difference from 'lodash.difference'; +import difference from 'lodash.difference' /** * Given a pull request title like @@ -30,4 +30,4 @@ function servicesForTitle(title) { return difference(services, ignored) } -export default servicesForTitle; +export default servicesForTitle diff --git a/core/service-test-runner/services-for-title.spec.js b/core/service-test-runner/services-for-title.spec.js index 876c7bf74e61a..f89f23d8f5af2 100644 --- a/core/service-test-runner/services-for-title.spec.js +++ b/core/service-test-runner/services-for-title.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import servicesForTitle from './services-for-title.js'; +import { test, given } from 'sazerac' +import servicesForTitle from './services-for-title.js' describe('Services from PR title', function () { test(servicesForTitle, () => { diff --git a/core/token-pooling/redis-token-persistence.integration.js b/core/token-pooling/redis-token-persistence.integration.js index 174b6ce497794..ca1d65cd9b4a4 100644 --- a/core/token-pooling/redis-token-persistence.integration.js +++ b/core/token-pooling/redis-token-persistence.integration.js @@ -1,7 +1,7 @@ -import RedisServer from 'redis-server'; -import Redis from 'ioredis'; -import {expect} from 'chai'; -import RedisTokenPersistence from './redis-token-persistence.js'; +import RedisServer from 'redis-server' +import Redis from 'ioredis' +import { expect } from 'chai' +import RedisTokenPersistence from './redis-token-persistence.js' describe('Redis token persistence', function () { let server diff --git a/core/token-pooling/redis-token-persistence.js b/core/token-pooling/redis-token-persistence.js index 755b093433c2c..dd0b6fb306702 100644 --- a/core/token-pooling/redis-token-persistence.js +++ b/core/token-pooling/redis-token-persistence.js @@ -1,6 +1,6 @@ -import {URL} from 'url'; -import Redis from 'ioredis'; -import log from '../server/log.js'; +import { URL } from 'url' +import Redis from 'ioredis' +import log from '../server/log.js' export default class RedisTokenPersistence { constructor({ url, key }) { @@ -54,4 +54,4 @@ export default class RedisTokenPersistence { log.error(e) } } -}; +} diff --git a/core/token-pooling/token-pool.js b/core/token-pooling/token-pool.js index 28010f8f51e7c..7dcf64ad5abdf 100644 --- a/core/token-pooling/token-pool.js +++ b/core/token-pooling/token-pool.js @@ -2,8 +2,8 @@ * @module */ -import crypto from 'crypto'; -import PriorityQueue from 'priorityqueuejs'; +import crypto from 'crypto' +import PriorityQueue from 'priorityqueuejs' /** * Compute a one-way hash of the input string. @@ -353,8 +353,4 @@ class TokenPool { } } -export { - sanitizeToken, - Token, - TokenPool, -}; +export { sanitizeToken, Token, TokenPool } diff --git a/core/token-pooling/token-pool.spec.js b/core/token-pooling/token-pool.spec.js index 6709967ec320b..fdfa937d200a1 100644 --- a/core/token-pooling/token-pool.spec.js +++ b/core/token-pooling/token-pool.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import sinon from 'sinon'; -import times from 'lodash.times'; -import {Token, TokenPool} from './token-pool.js'; +import { expect } from 'chai' +import sinon from 'sinon' +import times from 'lodash.times' +import { Token, TokenPool } from './token-pool.js' function expectPoolToBeExhausted(pool) { expect(() => { diff --git a/dangerfile.js b/dangerfile.js index 45758affc1ed8..405a3faab8880 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -8,8 +8,8 @@ // To test changes locally: // DANGER_GITHUB_API_TOKEN=your-github-api-token npm run danger -- pr https://github.com/badges/shields/pull/2665 -import {danger, fail, message, warn} from 'danger'; -import noTestShortcuts from 'danger-plugin-no-test-shortcuts'; +import { danger, fail, message, warn } from 'danger' +import noTestShortcuts from 'danger-plugin-no-test-shortcuts' const { fileMatch } = danger.git const documentation = fileMatch( diff --git a/doc/TUTORIAL.md b/doc/TUTORIAL.md index 1b891e74db5c2..2657b14c59c6a 100644 --- a/doc/TUTORIAL.md +++ b/doc/TUTORIAL.md @@ -227,21 +227,21 @@ Description of the code: 8. We now jump to the bottom of the example code to the function all badges must implement: `async handle()`. This is the function the server will invoke to handle an incoming request. Because our URL pattern captures a variable called `gem`, our function signature is `async handle({ gem })`. We usually separate the process of generating a badge into 2 stages or concerns: fetch and render. The `fetch()` function is responsible for calling an API endpoint to get data. The `render()` function formats the data for display. In a case where there is a lot of calculation or intermediate steps, this pattern may be thought of as fetch, transform, render and it might be necessary to define some helper functions to assist with the 'transform' step. 9. Working our way upward, the `async fetch()` method is responsible for calling an API endpoint to get data. Extending `BaseJsonService` gives us the helper function `_requestJson()`. Note here that we pass the schema we defined in step 4 as an argument. `_requestJson()` will deal with validating the response against the schema and throwing an error if necessary. - - `_requestJson()` automatically adds an Accept header, checks the status code, parses the response as JSON, and returns the parsed response. - - `_requestJson()` uses [request](https://github.com/request/request) to perform the HTTP request. Options can be passed to request, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `request` docs for [supported options](https://github.com/request/request#requestoptions-callback). - - Error messages corresponding to each status code can be returned by passing a dictionary of status codes -> messages in `errorMessages`. - - A more complex call to `_requestJson()` might look like this: - ```js - return this._requestJson({ - schema: mySchema, - url, - options: { qs: { branch: 'master' } }, - errorMessages: { - 401: 'private application not supported', - 404: 'application not found', - }, - }) - ``` + - `_requestJson()` automatically adds an Accept header, checks the status code, parses the response as JSON, and returns the parsed response. + - `_requestJson()` uses [request](https://github.com/request/request) to perform the HTTP request. Options can be passed to request, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `request` docs for [supported options](https://github.com/request/request#requestoptions-callback). + - Error messages corresponding to each status code can be returned by passing a dictionary of status codes -> messages in `errorMessages`. + - A more complex call to `_requestJson()` might look like this: + ```js + return this._requestJson({ + schema: mySchema, + url, + options: { qs: { branch: 'master' } }, + errorMessages: { + 401: 'private application not supported', + 404: 'application not found', + }, + }) + ``` 10. Upward still, the `static render()` method is responsible for formatting the data for display. `render()` is a pure function so we can make it a `static` method. By convention we declare functions which don't reference `this` as `static`. We could explicitly return an object here, as we did in the previous example. In this case, we will hand the version string off to `renderVersionBadge()` which will format it consistently and set an appropriate color. Because `renderVersionBadge()` doesn't return a `label` key, the default label we defined in `defaultBadgeData()` will be used when we generate the badge. diff --git a/doc/deprecating-badges.md b/doc/deprecating-badges.md index 1278fde64448a..8f8b72749099b 100644 --- a/doc/deprecating-badges.md +++ b/doc/deprecating-badges.md @@ -14,7 +14,7 @@ Locate the source file(s) for the service, which can be found in `*.service.js` Replace the existing service class implementation with the `DeprecatedService` class from `./core/base-service/deprecated-service.js` using the respective `category`, `route`, and `label` values for that service. For example: ```js -import {deprecatedService} from '../index.js' +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'size', @@ -34,7 +34,7 @@ Locate the test file(s) for the service, which can be found in `*.tester.js` fil With `DeprecatedService` classes we cannot use `createServiceTester()` so you will need to create the `ServiceTester` class directly. For example: ```js -import { ServiceTester } from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'imagelayers', @@ -58,7 +58,7 @@ Make sure to have a live (non-mocked) test for each badge the service provides t Here is an example of what the final result would look like for a test file: ```js -import { ServiceTester } from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'imagelayers', diff --git a/entrypoint.spec.js b/entrypoint.spec.js index 7378ef059c682..4325c0365ab81 100644 --- a/entrypoint.spec.js +++ b/entrypoint.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import isSvg from 'is-svg'; -import got from './core/got-test-client.js'; +import { expect } from 'chai' +import isSvg from 'is-svg' +import got from './core/got-test-client.js' let serverModule before(async function () { diff --git a/gatsby-config.js b/gatsby-config.js index ea9abec5f6309..9b1c32e04048b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,5 +1,5 @@ -import path from 'path'; -import {fileURLToPath} from 'url' +import path from 'path' +import { fileURLToPath } from 'url' export const siteMetadata = { title: 'Shields.io: Quality metadata badges for open source projects', @@ -11,7 +11,11 @@ export const plugins = [ { resolve: 'gatsby-plugin-page-creator', options: { - path: path.join(path.dirname(fileURLToPath(import.meta.url)), 'frontend', 'pages'), + path: path.join( + path.dirname(fileURLToPath(import.meta.url)), + 'frontend', + 'pages' + ), }, }, 'gatsby-plugin-react-helmet', diff --git a/gatsby-node.js b/gatsby-node.js index e92f662ccd862..4a4d8db571eda 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -4,9 +4,9 @@ * See: https://www.gatsbyjs.org/docs/node-apis/ */ -import fs from 'fs'; -import yaml from 'js-yaml'; -import envFlag from 'node-env-flag'; +import fs from 'fs' +import yaml from 'js-yaml' +import envFlag from 'node-env-flag' const includeDevPages = envFlag(process.env.INCLUDE_DEV_PAGES, true) @@ -44,4 +44,4 @@ async function createPages({ actions: { createPage } }) { }) } -export { createPages }; +export { createPages } diff --git a/lib/load-logos.js b/lib/load-logos.js index 5827fbbf8d941..f48f32d0d9398 100644 --- a/lib/load-logos.js +++ b/lib/load-logos.js @@ -1,12 +1,16 @@ -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {svg2base64} from './svg-helpers.js'; +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' +import { svg2base64 } from './svg-helpers.js' function loadLogos() { // Cache svg logos from disk in base64 string const logos = {} - const logoDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'logo') + const logoDir = path.join( + path.dirname(fileURLToPath(import.meta.url)), + '..', + 'logo' + ) const logoFiles = fs.readdirSync(logoDir) logoFiles.forEach(filename => { if (filename[0] === '.') { @@ -29,4 +33,4 @@ function loadLogos() { return logos } -export default loadLogos; +export default loadLogos diff --git a/lib/load-simple-icons.js b/lib/load-simple-icons.js index 20a31c65c1bad..a17b7ce8a2426 100644 --- a/lib/load-simple-icons.js +++ b/lib/load-simple-icons.js @@ -1,5 +1,5 @@ -import originalSimpleIcons from 'simple-icons'; -import {svg2base64} from './svg-helpers.js'; +import originalSimpleIcons from 'simple-icons' +import { svg2base64 } from './svg-helpers.js' function loadSimpleIcons() { const simpleIcons = {} @@ -38,4 +38,4 @@ function loadSimpleIcons() { return simpleIcons } -export default loadSimpleIcons; +export default loadSimpleIcons diff --git a/lib/load-simple-icons.spec.js b/lib/load-simple-icons.spec.js index 8f98d5602e56b..da64c20d34a80 100644 --- a/lib/load-simple-icons.spec.js +++ b/lib/load-simple-icons.spec.js @@ -1,5 +1,5 @@ -import {expect} from 'chai'; -import loadSimpleIcons from './load-simple-icons.js'; +import { expect } from 'chai' +import loadSimpleIcons from './load-simple-icons.js' describe('loadSimpleIcons', function () { let simpleIcons diff --git a/lib/logos.js b/lib/logos.js index b2e3b1fe1e743..a64f716c3b449 100644 --- a/lib/logos.js +++ b/lib/logos.js @@ -1,7 +1,11 @@ -import Joi from 'joi'; -import {toSvgColor, brightness, normalizeColor} from '../badge-maker/lib/color.js'; -import coalesce from '../core/base-service/coalesce.js'; -import {svg2base64} from './svg-helpers.js'; +import Joi from 'joi' +import { + toSvgColor, + brightness, + normalizeColor, +} from '../badge-maker/lib/color.js' +import coalesce from '../core/base-service/coalesce.js' +import { svg2base64 } from './svg-helpers.js' import loadLogos from './load-logos.js' import loadSimpleIcons from './load-simple-icons.js' const logos = loadLogos() @@ -63,7 +67,7 @@ function getShieldsIcon({ name, color }) { const { svg, base64, isMonochrome } = logos[name] const svgColor = toSvgColor(color) if (svgColor && isMonochrome) { - return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`)); + return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`)) } else { return base64 } @@ -135,4 +139,4 @@ export { getShieldsIcon, getSimpleIcon, makeLogo, -}; +} diff --git a/lib/logos.spec.js b/lib/logos.spec.js index 12283fbe4b6f2..0d6eaae40067c 100644 --- a/lib/logos.spec.js +++ b/lib/logos.spec.js @@ -1,6 +1,12 @@ -import {expect} from 'chai'; -import {test, given, forCases} from 'sazerac'; -import {prependPrefix, isDataUrl, prepareNamedLogo, getSimpleIcon, makeLogo} from './logos.js'; +import { expect } from 'chai' +import { test, given, forCases } from 'sazerac' +import { + prependPrefix, + isDataUrl, + prepareNamedLogo, + getSimpleIcon, + makeLogo, +} from './logos.js' describe('Logo helpers', function () { test(prependPrefix, () => { diff --git a/lib/svg-helpers.js b/lib/svg-helpers.js index 032ee5053fe08..040df8a503f8e 100644 --- a/lib/svg-helpers.js +++ b/lib/svg-helpers.js @@ -2,4 +2,4 @@ function svg2base64(svg) { return `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}` } -export { svg2base64 }; +export { svg2base64 } diff --git a/lib/svg-helpers.spec.js b/lib/svg-helpers.spec.js index e32c1f6436b8d..6434f661f89dd 100644 --- a/lib/svg-helpers.spec.js +++ b/lib/svg-helpers.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {svg2base64} from './svg-helpers.js'; +import { test, given } from 'sazerac' +import { svg2base64 } from './svg-helpers.js' describe('SVG helpers', function () { test(svg2base64, () => { diff --git a/scripts/badge-cli.js b/scripts/badge-cli.js index 326bd87876230..bf8e943828199 100644 --- a/scripts/badge-cli.js +++ b/scripts/badge-cli.js @@ -1,9 +1,9 @@ -import {fileURLToPath, URL} from 'url'; -import config from 'config'; -import got from 'got'; -import emojic from 'emojic'; -import Server from '../core/server/server.js'; -import trace from '../core/base-service/trace.js'; +import { fileURLToPath, URL } from 'url' +import config from 'config' +import got from 'got' +import emojic from 'emojic' +import Server from '../core/server/server.js' +import trace from '../core/base-service/trace.js' function normalizeBadgeUrl(url) { // Provide a base URL in order to accept fragments. @@ -35,7 +35,7 @@ async function main() { await traceBadge(normalized) } -(async () => { +;(async () => { try { await main() } catch (e) { diff --git a/scripts/benchmark-performance.js b/scripts/benchmark-performance.js index 9b0c87411c578..addbdedb81dce 100644 --- a/scripts/benchmark-performance.js +++ b/scripts/benchmark-performance.js @@ -1,7 +1,7 @@ -import config from 'config'; -import got from 'got'; -import minimist from 'minimist'; -import Server from '../core/server/server.js'; +import config from 'config' +import got from 'got' +import minimist from 'minimist' +import Server from '../core/server/server.js' async function main() { const server = new Server(config.util.toObject()) @@ -14,7 +14,7 @@ async function main() { await server.stop() } -(async () => { +;(async () => { try { await main() } catch (e) { diff --git a/scripts/capture-timings.js b/scripts/capture-timings.js index 4cc46c2b988ce..4b60fa89259b6 100644 --- a/scripts/capture-timings.js +++ b/scripts/capture-timings.js @@ -1,5 +1,5 @@ -import readline from 'readline'; -import minimist from 'minimist'; +import readline from 'readline' +import minimist from 'minimist' async function captureTimings(warmupIterations) { const rl = readline.createInterface({ @@ -49,7 +49,7 @@ async function main() { logResults({ times, iterations, warmupIterations }) } -(async () => { +;(async () => { try { await main() } catch (e) { diff --git a/scripts/export-service-definitions-cli.js b/scripts/export-service-definitions-cli.js index 44ea80f602de4..bfe244ce21289 100644 --- a/scripts/export-service-definitions-cli.js +++ b/scripts/export-service-definitions-cli.js @@ -1,5 +1,5 @@ -import yaml from 'js-yaml'; -import {collectDefinitions} from '../core/base-service/loader.js'; +import yaml from 'js-yaml' +import { collectDefinitions } from '../core/base-service/loader.js' const definitions = await collectDefinitions() diff --git a/scripts/redis-connectivity-test.js b/scripts/redis-connectivity-test.js index c5726c31f9cc5..5e61fd5cdf5d7 100644 --- a/scripts/redis-connectivity-test.js +++ b/scripts/redis-connectivity-test.js @@ -1,5 +1,5 @@ -import config from 'config'; -import GithubConstellation from '../services/github/github-constellation.js'; +import config from 'config' +import GithubConstellation from '../services/github/github-constellation.js' const objectConfig = config.util.toObject() console.log(objectConfig) @@ -14,7 +14,7 @@ async function main() { await persistence.stop() } -(async () => { +;(async () => { try { await main() } catch (e) { diff --git a/server.js b/server.js index 1754f8e93d35e..661620b286f60 100644 --- a/server.js +++ b/server.js @@ -1,14 +1,14 @@ /* eslint-disable import/order */ -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url' +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' // Set up Sentry reporting as early in the process as possible. -import configModule from 'config'; -import Sentry from '@sentry/node'; +import configModule from 'config' +import Sentry from '@sentry/node' -import Server from './core/server/server.js'; +import Server from './core/server/server.js' const config = configModule.util.toObject() const disabledIntegrations = ['Console', 'Http'] Sentry.init({ @@ -45,7 +45,11 @@ if (fs.existsSync('.env')) { process.exit(1) } -const legacySecretsPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'private', 'secret.json') +const legacySecretsPath = path.join( + path.dirname(fileURLToPath(import.meta.url)), + 'private', + 'secret.json' +) if (fs.existsSync(legacySecretsPath)) { console.error( `Legacy secrets file found at ${legacySecretsPath}. It should be deleted and secrets replaced with environment variables or config/local.yml` diff --git a/services/amo/amo-base.js b/services/amo/amo-base.js index ec90e1dd1b1e0..d23b35458665d 100644 --- a/services/amo/amo-base.js +++ b/services/amo/amo-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const keywords = ['amo', 'firefox'] @@ -26,4 +26,4 @@ class BaseAmoService extends BaseJsonService { } } -export { BaseAmoService, keywords }; +export { BaseAmoService, keywords } diff --git a/services/amo/amo-downloads.service.js b/services/amo/amo-downloads.service.js index 18c952dc95f7c..89e50dbbdbdd3 100644 --- a/services/amo/amo-downloads.service.js +++ b/services/amo/amo-downloads.service.js @@ -1,7 +1,7 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {redirector} from '../index.js'; -import {BaseAmoService, keywords} from './amo-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { redirector } from '../index.js' +import { BaseAmoService, keywords } from './amo-base.js' const documentation = `

@@ -52,7 +52,4 @@ const AmoLegacyRedirect = redirector({ dateAdded: new Date('2019-02-23'), }) -export { - AmoWeeklyDownloads, - AmoLegacyRedirect, -}; +export { AmoWeeklyDownloads, AmoLegacyRedirect } diff --git a/services/amo/amo-downloads.tester.js b/services/amo/amo-downloads.tester.js index f7147d4579da4..b181673ec5373 100644 --- a/services/amo/amo-downloads.tester.js +++ b/services/amo/amo-downloads.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetricOverTimePeriod} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetricOverTimePeriod } from '../test-validators.js' export const t = new ServiceTester({ id: 'AmoDownloads', title: 'AmoDownloads', diff --git a/services/amo/amo-rating.service.js b/services/amo/amo-rating.service.js index 03612d2f5e9d9..1f26f9127cf0d 100644 --- a/services/amo/amo-rating.service.js +++ b/services/amo/amo-rating.service.js @@ -1,6 +1,6 @@ -import {starRating} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseAmoService, keywords} from './amo-base.js'; +import { starRating } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BaseAmoService, keywords } from './amo-base.js' export default class AmoRating extends BaseAmoService { static category = 'rating' @@ -36,4 +36,4 @@ export default class AmoRating extends BaseAmoService { const data = await this.fetch({ addonId }) return this.constructor.render({ format, rating: data.ratings.average }) } -}; +} diff --git a/services/amo/amo-rating.tester.js b/services/amo/amo-rating.tester.js index 8a38d67fdb90c..9843273741585 100644 --- a/services/amo/amo-rating.tester.js +++ b/services/amo/amo-rating.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isStarRating} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isStarRating } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Rating') diff --git a/services/amo/amo-users.service.js b/services/amo/amo-users.service.js index a1364812c8c90..0d42ee8731b35 100644 --- a/services/amo/amo-users.service.js +++ b/services/amo/amo-users.service.js @@ -1,5 +1,5 @@ -import {metric} from '../text-formatters.js'; -import {BaseAmoService, keywords} from './amo-base.js'; +import { metric } from '../text-formatters.js' +import { BaseAmoService, keywords } from './amo-base.js' export default class AmoUsers extends BaseAmoService { static category = 'downloads' @@ -27,4 +27,4 @@ export default class AmoUsers extends BaseAmoService { const data = await this.fetch({ addonId }) return this.constructor.render({ users: data.average_daily_users }) } -}; +} diff --git a/services/amo/amo-users.tester.js b/services/amo/amo-users.tester.js index 70d95207a538e..5355be2ce1c25 100644 --- a/services/amo/amo-users.tester.js +++ b/services/amo/amo-users.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Users') diff --git a/services/amo/amo-version.service.js b/services/amo/amo-version.service.js index 7c8f6fdfca6dc..96394bba7fc44 100644 --- a/services/amo/amo-version.service.js +++ b/services/amo/amo-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import {BaseAmoService, keywords} from './amo-base.js'; +import { renderVersionBadge } from '../version.js' +import { BaseAmoService, keywords } from './amo-base.js' export default class AmoVersion extends BaseAmoService { static category = 'version' @@ -18,4 +18,4 @@ export default class AmoVersion extends BaseAmoService { const data = await this.fetch({ addonId }) return renderVersionBadge({ version: data.current_version.version }) } -}; +} diff --git a/services/amo/amo-version.tester.js b/services/amo/amo-version.tester.js index 215a3d6ffea89..e900a589a6484 100644 --- a/services/amo/amo-version.tester.js +++ b/services/amo/amo-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Version').get('/IndieGala-Helper.json').expectBadge({ diff --git a/services/ansible/ansible-quality.service.js b/services/ansible/ansible-quality.service.js index c9449aaa96fc2..6af7ae16ca588 100644 --- a/services/ansible/ansible-quality.service.js +++ b/services/ansible/ansible-quality.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {floorCount} from '../color-formatters.js'; -import {BaseJsonService, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { floorCount } from '../color-formatters.js' +import { BaseJsonService, InvalidResponse } from '../index.js' const ansibleContentSchema = Joi.object({ quality_score: Joi.number().allow(null).required(), @@ -16,9 +16,7 @@ class AnsibleGalaxyContent extends BaseJsonService { } } -export default class AnsibleGalaxyContentQualityScore extends ( - AnsibleGalaxyContent -) { +export default class AnsibleGalaxyContentQualityScore extends AnsibleGalaxyContent { static category = 'analysis' static route = { base: 'ansible/quality', pattern: ':projectId' } @@ -52,4 +50,4 @@ export default class AnsibleGalaxyContentQualityScore extends ( return this.constructor.render({ qualityScore }) } -}; +} diff --git a/services/ansible/ansible-quality.tester.js b/services/ansible/ansible-quality.tester.js index d7606a8a5881a..4ac15bff0c845 100644 --- a/services/ansible/ansible-quality.tester.js +++ b/services/ansible/ansible-quality.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('quality score (valid)') diff --git a/services/ansible/ansible-role.service.js b/services/ansible/ansible-role.service.js index 2553f6f0f03e9..aa1cdcb7731c9 100644 --- a/services/ansible/ansible-role.service.js +++ b/services/ansible/ansible-role.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {downloadCount} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { downloadCount } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const ansibleRoleSchema = Joi.object({ download_count: nonNegativeInteger, @@ -78,7 +78,4 @@ class AnsibleGalaxyRoleName extends AnsibleGalaxyRole { } } -export { - AnsibleGalaxyRoleDownloads, - AnsibleGalaxyRoleName, -}; +export { AnsibleGalaxyRoleDownloads, AnsibleGalaxyRoleName } diff --git a/services/ansible/ansible-role.tester.js b/services/ansible/ansible-role.tester.js index 4ab60f330efd2..8679789fa0a83 100644 --- a/services/ansible/ansible-role.tester.js +++ b/services/ansible/ansible-role.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {ServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'AnsibleRole', title: 'AnsibleRole', diff --git a/services/apm/apm.service.js b/services/apm/apm.service.js index 5ac3ab23cce29..681bd0d46504b 100644 --- a/services/apm/apm.service.js +++ b/services/apm/apm.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import {renderLicenseBadge} from '../licenses.js'; -import {renderVersionBadge} from '../version.js'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { renderLicenseBadge } from '../licenses.js' +import { renderVersionBadge } from '../version.js' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, InvalidResponse } from '../index.js' const keywords = ['atom'] @@ -114,8 +114,4 @@ class APMLicense extends BaseAPMService { } } -export { - APMDownloads, - APMVersion, - APMLicense, -}; +export { APMDownloads, APMVersion, APMLicense } diff --git a/services/apm/apm.tester.js b/services/apm/apm.tester.js index 2ce60c8b30eec..ed6f7c861e54a 100644 --- a/services/apm/apm.tester.js +++ b/services/apm/apm.tester.js @@ -1,6 +1,6 @@ -import {ServiceTester} from '../tester.js'; -import {invalidJSON} from '../response-fixtures.js'; -import {isMetric, isVPlusTripleDottedVersion} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { invalidJSON } from '../response-fixtures.js' +import { isMetric, isVPlusTripleDottedVersion } from '../test-validators.js' export const t = new ServiceTester({ id: 'apm', diff --git a/services/appveyor/appveyor-base.js b/services/appveyor/appveyor-base.js index b5d7e8b6a579c..923b718466cbf 100644 --- a/services/appveyor/appveyor-base.js +++ b/services/appveyor/appveyor-base.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {isBuildStatus} from '../build-status.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { isBuildStatus } from '../build-status.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ build: Joi.object({ @@ -39,4 +39,4 @@ export default class AppVeyorBase extends BaseJsonService { pattern: ':user/:repo/:branch*', } } -}; +} diff --git a/services/appveyor/appveyor-build-redirect.service.js b/services/appveyor/appveyor-build-redirect.service.js index 0d2760a7907a5..61e43b31b2ccb 100644 --- a/services/appveyor/appveyor-build-redirect.service.js +++ b/services/appveyor/appveyor-build-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -11,4 +11,4 @@ export default [ `/appveyor/build/${user}/${repo}${branch ? `/${branch}` : ''}`, dateAdded: new Date('2019-12-10'), }), -]; +] diff --git a/services/appveyor/appveyor-build-redirect.tester.js b/services/appveyor/appveyor-build-redirect.tester.js index 474822da9fca5..40ad8049d48c8 100644 --- a/services/appveyor/appveyor-build-redirect.tester.js +++ b/services/appveyor/appveyor-build-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'AppveyorBuildRedirect', diff --git a/services/appveyor/appveyor-build.service.js b/services/appveyor/appveyor-build.service.js index 3a1c9603f3fdd..29cb395835394 100644 --- a/services/appveyor/appveyor-build.service.js +++ b/services/appveyor/appveyor-build.service.js @@ -1,5 +1,5 @@ -import {renderBuildStatusBadge} from '../build-status.js'; -import AppVeyorBase from './appveyor-base.js'; +import { renderBuildStatusBadge } from '../build-status.js' +import AppVeyorBase from './appveyor-base.js' export default class AppVeyorBuild extends AppVeyorBase { static route = this.buildRoute('appveyor/build') @@ -31,4 +31,4 @@ export default class AppVeyorBuild extends AppVeyorBase { } return this.constructor.render({ status: data.build.status }) } -}; +} diff --git a/services/appveyor/appveyor-build.tester.js b/services/appveyor/appveyor-build.tester.js index 6b491f96f1765..b1141067e49b0 100644 --- a/services/appveyor/appveyor-build.tester.js +++ b/services/appveyor/appveyor-build.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('CI status') diff --git a/services/appveyor/appveyor-job-build.service.js b/services/appveyor/appveyor-job-build.service.js index a890331dd9af1..fc856aa7f25a2 100644 --- a/services/appveyor/appveyor-job-build.service.js +++ b/services/appveyor/appveyor-job-build.service.js @@ -1,6 +1,6 @@ -import {renderBuildStatusBadge} from '../build-status.js'; -import {NotFound} from '../index.js'; -import AppVeyorBase from './appveyor-base.js'; +import { renderBuildStatusBadge } from '../build-status.js' +import { NotFound } from '../index.js' +import AppVeyorBase from './appveyor-base.js' export default class AppVeyorJobBuild extends AppVeyorBase { static route = { @@ -59,4 +59,4 @@ export default class AppVeyorJobBuild extends AppVeyorBase { const { status } = this.transform({ data, jobName: job }) return renderBuildStatusBadge({ status }) } -}; +} diff --git a/services/appveyor/appveyor-job-build.spec.js b/services/appveyor/appveyor-job-build.spec.js index 4cfb58d597382..4e83a26fd427d 100644 --- a/services/appveyor/appveyor-job-build.spec.js +++ b/services/appveyor/appveyor-job-build.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {NotFound} from '../index.js'; -import AppveyorJobBuild from './appveyor-job-build.service.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { NotFound } from '../index.js' +import AppveyorJobBuild from './appveyor-job-build.service.js' describe('AppveyorJobBuild', function () { test(AppveyorJobBuild.prototype.transform, () => { diff --git a/services/appveyor/appveyor-job-build.tester.js b/services/appveyor/appveyor-job-build.tester.js index 5bc2b52ec19ed..a31306e30ec00 100644 --- a/services/appveyor/appveyor-job-build.tester.js +++ b/services/appveyor/appveyor-job-build.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Job CI status') diff --git a/services/appveyor/appveyor-tests.service.js b/services/appveyor/appveyor-tests.service.js index c0fdbf288bca7..465130445eb49 100644 --- a/services/appveyor/appveyor-tests.service.js +++ b/services/appveyor/appveyor-tests.service.js @@ -1,5 +1,8 @@ -import {testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; -import AppVeyorBase from './appveyor-base.js'; +import { + testResultQueryParamSchema, + renderTestResultBadge, +} from '../test-results.js' +import AppVeyorBase from './appveyor-base.js' const documentation = `

@@ -158,4 +161,4 @@ export default class AppVeyorTests extends AppVeyorBase { isCompact, }) } -}; +} diff --git a/services/appveyor/appveyor-tests.tester.js b/services/appveyor/appveyor-tests.tester.js index eaee7f907544c..102f532d29958 100644 --- a/services/appveyor/appveyor-tests.tester.js +++ b/services/appveyor/appveyor-tests.tester.js @@ -1,6 +1,6 @@ -import queryString from 'querystring'; -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import queryString from 'querystring' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isAppveyorTestTotals = Joi.string().regex( diff --git a/services/archlinux/archlinux.service.js b/services/archlinux/archlinux.service.js index 26d715c4c2978..c3ee192b13fdc 100644 --- a/services/archlinux/archlinux.service.js +++ b/services/archlinux/archlinux.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ pkgver: Joi.string().required(), @@ -38,4 +38,4 @@ export default class ArchLinux extends BaseJsonService { }) return renderVersionBadge({ version: data.pkgver }) } -}; +} diff --git a/services/archlinux/archlinux.tester.js b/services/archlinux/archlinux.tester.js index 15a0099afaafe..d92b65464b2cd 100644 --- a/services/archlinux/archlinux.tester.js +++ b/services/archlinux/archlinux.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Arch Linux package (valid)') diff --git a/services/aur/aur.service.js b/services/aur/aur.service.js index c2b276f7bf598..901e8e0bf9915 100644 --- a/services/aur/aur.service.js +++ b/services/aur/aur.service.js @@ -1,8 +1,11 @@ -import Joi from 'joi'; -import {floorCount as floorCountColor, age as ageColor} from '../color-formatters.js'; -import {addv, metric, formatDate} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { + floorCount as floorCountColor, + age as ageColor, +} from '../color-formatters.js' +import { addv, metric, formatDate } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound, InvalidResponse } from '../index.js' const aurSchema = Joi.object({ resultcount: nonNegativeInteger, @@ -193,10 +196,4 @@ class AurLastModified extends BaseAurService { } } -export { - AurLicense, - AurVersion, - AurVotes, - AurMaintainer, - AurLastModified, -}; +export { AurLicense, AurVersion, AurVotes, AurMaintainer, AurLastModified } diff --git a/services/aur/aur.spec.js b/services/aur/aur.spec.js index 1a79b69ec02fb..0bdc44bec721b 100644 --- a/services/aur/aur.spec.js +++ b/services/aur/aur.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {AurVersion} from './aur.service.js'; +import { test, given } from 'sazerac' +import { AurVersion } from './aur.service.js' describe('AurVersion', function () { test(AurVersion.render, () => { diff --git a/services/aur/aur.tester.js b/services/aur/aur.tester.js index 73332274bff26..c6026d4f351af 100644 --- a/services/aur/aur.tester.js +++ b/services/aur/aur.tester.js @@ -1,5 +1,9 @@ -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionNClausesWithOptionalSuffix, isMetric, isFormattedDate} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { + isVPlusDottedVersionNClausesWithOptionalSuffix, + isMetric, + isFormattedDate, +} from '../test-validators.js' export const t = new ServiceTester({ id: 'aur', diff --git a/services/azure-devops/azure-devops-base.js b/services/azure-devops/azure-devops-base.js index 3d6dcc516b205..184530bde7c5b 100644 --- a/services/azure-devops/azure-devops-base.js +++ b/services/azure-devops/azure-devops-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService, NotFound } from '../index.js' const latestBuildSchema = Joi.object({ count: Joi.number().required(), @@ -65,4 +65,4 @@ export default class AzureDevOpsBase extends BaseJsonService { return json.value[0].id } -}; +} diff --git a/services/azure-devops/azure-devops-build.service.js b/services/azure-devops/azure-devops-build.service.js index 91042238f747f..8485fa49fe502 100644 --- a/services/azure-devops/azure-devops-build.service.js +++ b/services/azure-devops/azure-devops-build.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService, NotFound} from '../index.js'; -import {keywords, fetch} from './azure-devops-helpers.js'; +import Joi from 'joi' +import { renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService, NotFound } from '../index.js' +import { keywords, fetch } from './azure-devops-helpers.js' const queryParamSchema = Joi.object({ stage: Joi.string(), @@ -121,4 +121,4 @@ export default class AzureDevOpsBuild extends BaseSvgScrapingService { } return renderBuildStatusBadge({ status }) } -}; +} diff --git a/services/azure-devops/azure-devops-build.tester.js b/services/azure-devops/azure-devops-build.tester.js index 819b2e632a706..73027411170a8 100644 --- a/services/azure-devops/azure-devops-build.tester.js +++ b/services/azure-devops/azure-devops-build.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project diff --git a/services/azure-devops/azure-devops-coverage.service.js b/services/azure-devops/azure-devops-coverage.service.js index 92f89e8733861..4234b36f48d6a 100644 --- a/services/azure-devops/azure-devops-coverage.service.js +++ b/services/azure-devops/azure-devops-coverage.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import AzureDevOpsBase from './azure-devops-base.js'; -import {keywords} from './azure-devops-helpers.js'; +import Joi from 'joi' +import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js' +import AzureDevOpsBase from './azure-devops-base.js' +import { keywords } from './azure-devops-helpers.js' const documentation = `

@@ -126,4 +126,4 @@ export default class AzureDevOpsCoverage extends AzureDevOpsBase { const coverage = covered ? (covered / total) * 100 : 0 return this.constructor.render({ coverage }) } -}; +} diff --git a/services/azure-devops/azure-devops-coverage.tester.js b/services/azure-devops/azure-devops-coverage.tester.js index d1c181cb756b7..2177d9077c8bf 100644 --- a/services/azure-devops/azure-devops-coverage.tester.js +++ b/services/azure-devops/azure-devops-coverage.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const org = 'swellaby' diff --git a/services/azure-devops/azure-devops-helpers.js b/services/azure-devops/azure-devops-helpers.js index 9004354a7d76a..67b457352a303 100644 --- a/services/azure-devops/azure-devops-helpers.js +++ b/services/azure-devops/azure-devops-helpers.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' const keywords = ['vso', 'vsts', 'azure-devops'] @@ -26,4 +26,4 @@ async function fetch(serviceInstance, { url, qs = {}, errorMessages }) { return { status } } -export { keywords, fetch }; +export { keywords, fetch } diff --git a/services/azure-devops/azure-devops-release.service.js b/services/azure-devops/azure-devops-release.service.js index 914df9e521355..96393ad4b0d94 100644 --- a/services/azure-devops/azure-devops-release.service.js +++ b/services/azure-devops/azure-devops-release.service.js @@ -1,6 +1,6 @@ -import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '../index.js'; -import {keywords, fetch} from './azure-devops-helpers.js'; +import { renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService } from '../index.js' +import { keywords, fetch } from './azure-devops-helpers.js' const documentation = `

@@ -57,4 +57,4 @@ export default class AzureDevOpsRelease extends BaseSvgScrapingService { }) return renderBuildStatusBadge(props) } -}; +} diff --git a/services/azure-devops/azure-devops-release.tester.js b/services/azure-devops/azure-devops-release.tester.js index bc577047d6c9c..7ffa1d94e3275 100644 --- a/services/azure-devops/azure-devops-release.tester.js +++ b/services/azure-devops/azure-devops-release.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project diff --git a/services/azure-devops/azure-devops-tests.service.js b/services/azure-devops/azure-devops-tests.service.js index c6ce4474ffc40..a2939b95aebfc 100644 --- a/services/azure-devops/azure-devops-tests.service.js +++ b/services/azure-devops/azure-devops-tests.service.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; -import AzureDevOpsBase from './azure-devops-base.js'; +import Joi from 'joi' +import { + testResultQueryParamSchema, + renderTestResultBadge, +} from '../test-results.js' +import AzureDevOpsBase from './azure-devops-base.js' const commonAttrs = { keywords: ['vso', 'vsts', 'azure-devops'], @@ -228,4 +231,4 @@ export default class AzureDevOpsTests extends AzureDevOpsBase { isCompact, }) } -}; +} diff --git a/services/azure-devops/azure-devops-tests.tester.js b/services/azure-devops/azure-devops-tests.tester.js index 5b36fc968fc1e..d708183ac8fa5 100644 --- a/services/azure-devops/azure-devops-tests.tester.js +++ b/services/azure-devops/azure-devops-tests.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const org = 'azuredevops-powershell' diff --git a/services/azure-devops/vso-redirect.service.js b/services/azure-devops/vso-redirect.service.js index 389b091be735c..e67c703dd8eac 100644 --- a/services/azure-devops/vso-redirect.service.js +++ b/services/azure-devops/vso-redirect.service.js @@ -1,27 +1,27 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export const VsoBuildRedirector = redirector({ - category: 'build', - route: { - base: 'vso/build', - pattern: ':organization/:projectId/:definitionId/:branch*', - }, - transformPath: ({ organization, projectId, definitionId, branch }) => { - let path = `/azure-devops/build/${organization}/${projectId}/${definitionId}` - if (branch) { - path += `/${branch}` - } - return path - }, - dateAdded: new Date('2019-02-08'), - }) + category: 'build', + route: { + base: 'vso/build', + pattern: ':organization/:projectId/:definitionId/:branch*', + }, + transformPath: ({ organization, projectId, definitionId, branch }) => { + let path = `/azure-devops/build/${organization}/${projectId}/${definitionId}` + if (branch) { + path += `/${branch}` + } + return path + }, + dateAdded: new Date('2019-02-08'), +}) export const VsoReleaseRedirector = redirector({ - category: 'build', - route: { - base: 'vso/release', - pattern: ':organization/:projectId/:definitionId/:environmentId', - }, - transformPath: ({ organization, projectId, definitionId, environmentId }) => - `/azure-devops/release/${organization}/${projectId}/${definitionId}/${environmentId}`, - dateAdded: new Date('2019-02-08'), - }) + category: 'build', + route: { + base: 'vso/release', + pattern: ':organization/:projectId/:definitionId/:environmentId', + }, + transformPath: ({ organization, projectId, definitionId, environmentId }) => + `/azure-devops/release/${organization}/${projectId}/${definitionId}/${environmentId}`, + dateAdded: new Date('2019-02-08'), +}) diff --git a/services/azure-devops/vso-redirect.tester.js b/services/azure-devops/vso-redirect.tester.js index a42a75b861ed7..d36f81ca2779e 100644 --- a/services/azure-devops/vso-redirect.tester.js +++ b/services/azure-devops/vso-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'vso', diff --git a/services/beerpay/beerpay.service.js b/services/beerpay/beerpay.service.js index 1e99d39416fed..1f9bc1545056f 100644 --- a/services/beerpay/beerpay.service.js +++ b/services/beerpay/beerpay.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ total_amount: Joi.number().min(0).required(), @@ -38,4 +38,4 @@ export default class Beerpay extends BaseJsonService { }) return this.constructor.render({ totalAmount }) } -}; +} diff --git a/services/beerpay/beerpay.tester.js b/services/beerpay/beerpay.tester.js index 1010f26a20552..cc85ddc375395 100644 --- a/services/beerpay/beerpay.tester.js +++ b/services/beerpay/beerpay.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const amountOfMoney = withRegex(/^\$[0-9]+(\.[0-9]+)?/) diff --git a/services/bintray/bintray.service.js b/services/bintray/bintray.service.js index 7780e4df8f1a6..f181fb2c25354 100644 --- a/services/bintray/bintray.service.js +++ b/services/bintray/bintray.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default [ deprecatedService({ @@ -19,4 +19,4 @@ export default [ label: 'bintray', dateAdded: new Date('2021-04-24'), }), -]; +] diff --git a/services/bintray/bintray.tester.js b/services/bintray/bintray.tester.js index c93a2f8cefcea..cc55f5bdba1ca 100644 --- a/services/bintray/bintray.tester.js +++ b/services/bintray/bintray.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'bintray', diff --git a/services/bit/bit-components.service.js b/services/bit/bit-components.service.js index 954fe0ecb1ff0..e2236639034b7 100644 --- a/services/bit/bit-components.service.js +++ b/services/bit/bit-components.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {downloadCount} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { downloadCount } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const collectionSchema = Joi.object({ payload: Joi.object({ @@ -47,4 +47,4 @@ export default class BitComponents extends BaseJsonService { const json = await this.fetch({ owner, collection }) return this.constructor.render({ count: json.payload.totalComponents }) } -}; +} diff --git a/services/bit/bit-components.tester.js b/services/bit/bit-components.tester.js index 64363242b2851..2f6dee749d2f7 100644 --- a/services/bit/bit-components.tester.js +++ b/services/bit/bit-components.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() t.create('collection (valid)').get('/ramda/ramda.json').expectBadge({ diff --git a/services/bitbucket/bitbucket-issues.service.js b/services/bitbucket/bitbucket-issues.service.js index c87a2caffc816..9bcf5a5b92fbd 100644 --- a/services/bitbucket/bitbucket-issues.service.js +++ b/services/bitbucket/bitbucket-issues.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const bitbucketIssuesSchema = Joi.object({ size: nonNegativeInteger, diff --git a/services/bitbucket/bitbucket-issues.tester.js b/services/bitbucket/bitbucket-issues.tester.js index f4d9f01824e0b..4bdb300b52e05 100644 --- a/services/bitbucket/bitbucket-issues.tester.js +++ b/services/bitbucket/bitbucket-issues.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isMetricOpenIssues} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric, isMetricOpenIssues } from '../test-validators.js' export const t = new ServiceTester({ id: 'BitbucketIssues', diff --git a/services/bitbucket/bitbucket-pipelines.service.js b/services/bitbucket/bitbucket-pipelines.service.js index 70262e037357e..dc28820bcdb1a 100644 --- a/services/bitbucket/bitbucket-pipelines.service.js +++ b/services/bitbucket/bitbucket-pipelines.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService, redirector} from '../index.js'; +import Joi from 'joi' +import { renderBuildStatusBadge } from '../build-status.js' +import { BaseJsonService, redirector } from '../index.js' const bitbucketPipelinesSchema = Joi.object({ values: Joi.array() @@ -94,7 +94,4 @@ const BitbucketPipelinesRedirector = redirector({ dateAdded: new Date('2020-07-12'), }) -export { - BitbucketPipelines, - BitbucketPipelinesRedirector, -}; +export { BitbucketPipelines, BitbucketPipelinesRedirector } diff --git a/services/bitbucket/bitbucket-pipelines.tester.js b/services/bitbucket/bitbucket-pipelines.tester.js index 56b07053c639c..1fe7293a8a7cb 100644 --- a/services/bitbucket/bitbucket-pipelines.tester.js +++ b/services/bitbucket/bitbucket-pipelines.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {ServiceTester} from '../tester.js'; +import { isBuildStatus } from '../build-status.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'BitbucketPipelines', title: 'Bitbucket Pipelines', diff --git a/services/bitbucket/bitbucket-pull-request.service.js b/services/bitbucket/bitbucket-pull-request.service.js index f069293c573e3..add3ad820f96b 100644 --- a/services/bitbucket/bitbucket-pull-request.service.js +++ b/services/bitbucket/bitbucket-pull-request.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {AuthHelper} from '../../core/base-service/auth-helper.js'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger, optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { AuthHelper } from '../../core/base-service/auth-helper.js' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger, optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ size: nonNegativeInteger, diff --git a/services/bitbucket/bitbucket-pull-request.spec.js b/services/bitbucket/bitbucket-pull-request.spec.js index 5b085b5f97310..565a2c1634777 100644 --- a/services/bitbucket/bitbucket-pull-request.spec.js +++ b/services/bitbucket/bitbucket-pull-request.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import {BitbucketRawPullRequests} from './bitbucket-pull-request.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import { BitbucketRawPullRequests } from './bitbucket-pull-request.service.js' describe('BitbucketPullRequest', function () { cleanUpNockAfterEach() diff --git a/services/bitbucket/bitbucket-pull-request.tester.js b/services/bitbucket/bitbucket-pull-request.tester.js index b5fde795cefd6..c9ab932578836 100644 --- a/services/bitbucket/bitbucket-pull-request.tester.js +++ b/services/bitbucket/bitbucket-pull-request.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isMetricOpenIssues} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric, isMetricOpenIssues } from '../test-validators.js' export const t = new ServiceTester({ id: 'BitbucketPullRequest', diff --git a/services/bithound/bithound.service.js b/services/bithound/bithound.service.js index fe8746cd812c1..1898317b547af 100644 --- a/services/bithound/bithound.service.js +++ b/services/bithound/bithound.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'dependencies', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'bithound', dateAdded: new Date('2018-07-08'), -}); +}) diff --git a/services/bithound/bithound.tester.js b/services/bithound/bithound.tester.js index 41531ff39fc74..03bbf3c049bcd 100644 --- a/services/bithound/bithound.tester.js +++ b/services/bithound/bithound.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'bithound', diff --git a/services/bitrise/bitrise.service.js b/services/bitrise/bitrise.service.js index 568cdb40e64f2..ee76f55972efb 100644 --- a/services/bitrise/bitrise.service.js +++ b/services/bitrise/bitrise.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' // https://devcenter.bitrise.io/api/app-status-badge/ const schema = Joi.object({ @@ -65,4 +65,4 @@ export default class Bitrise extends BaseJsonService { const { status } = await this.fetch({ appId, branch, token }) return this.constructor.render({ status }) } -}; +} diff --git a/services/bitrise/bitrise.tester.js b/services/bitrise/bitrise.tester.js index 5df6deafd619d..26c2b238ad96e 100644 --- a/services/bitrise/bitrise.tester.js +++ b/services/bitrise/bitrise.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('deploy status') diff --git a/services/bountysource/bountysource.service.js b/services/bountysource/bountysource.service.js index f6df4f3d10e5f..1bb4b81aff9f9 100644 --- a/services/bountysource/bountysource.service.js +++ b/services/bountysource/bountysource.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ activity_total: nonNegativeInteger }) @@ -41,4 +41,4 @@ export default class Bountysource extends BaseJsonService { const json = await this.fetch({ team }) return this.constructor.render({ total: json.activity_total }) } -}; +} diff --git a/services/bountysource/bountysource.tester.js b/services/bountysource/bountysource.tester.js index 1eaf2b42df877..cec68a500c333 100644 --- a/services/bountysource/bountysource.tester.js +++ b/services/bountysource/bountysource.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isMetric } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'bountysource', diff --git a/services/bower/bower-base.js b/services/bower/bower-base.js index f144155f8b04d..43a70542895ca 100644 --- a/services/bower/bower-base.js +++ b/services/bower/bower-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object() .keys({ @@ -27,4 +27,4 @@ export default class BaseBowerService extends BaseJsonService { }, }) } -}; +} diff --git a/services/bower/bower-license.service.js b/services/bower/bower-license.service.js index 199a20f40360b..24476a20d60d2 100644 --- a/services/bower/bower-license.service.js +++ b/services/bower/bower-license.service.js @@ -1,5 +1,5 @@ -import {renderLicenseBadge} from '../licenses.js'; -import BaseBowerService from './bower-base.js'; +import { renderLicenseBadge } from '../licenses.js' +import BaseBowerService from './bower-base.js' export default class BowerLicense extends BaseBowerService { static category = 'license' @@ -19,4 +19,4 @@ export default class BowerLicense extends BaseBowerService { const data = await this.fetch({ packageName }) return renderLicenseBadge({ licenses: data.normalized_licenses }) } -}; +} diff --git a/services/bower/bower-license.tester.js b/services/bower/bower-license.tester.js index 10ddaf8b7e178..18ba64b760210 100644 --- a/services/bower/bower-license.tester.js +++ b/services/bower/bower-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('licence') diff --git a/services/bower/bower-version.service.js b/services/bower/bower-version.service.js index ce03d6910a39d..277d704021d88 100644 --- a/services/bower/bower-version.service.js +++ b/services/bower/bower-version.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {InvalidResponse, redirector} from '../index.js'; -import BaseBowerService from './bower-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { InvalidResponse, redirector } from '../index.js' +import BaseBowerService from './bower-base.js' const queryParamSchema = Joi.object({ include_prereleases: Joi.equal(''), @@ -55,4 +55,4 @@ const BowerVersionRedirect = redirector({ dateAdded: new Date('2019-12-15'), }) -export { BowerVersion, BowerVersionRedirect }; +export { BowerVersion, BowerVersionRedirect } diff --git a/services/bower/bower-version.tester.js b/services/bower/bower-version.tester.js index 0648198205da2..acccf3a756fec 100644 --- a/services/bower/bower-version.tester.js +++ b/services/bower/bower-version.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'BowerVersion', title: 'Bower Version', diff --git a/services/bstats/bstats-players.service.js b/services/bstats/bstats-players.service.js index 3ce6bbe8cb5a2..5b8eccd36f741 100644 --- a/services/bstats/bstats-players.service.js +++ b/services/bstats/bstats-players.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.array() .items(Joi.array().items(Joi.number().required(), Joi.number().required())) @@ -52,4 +52,4 @@ export default class BStatsPlayers extends BaseJsonService { const { players } = this.transform({ json }) return this.constructor.render({ players }) } -}; +} diff --git a/services/bstats/bstats-players.tester.js b/services/bstats/bstats-players.tester.js index 6c91419c94ddf..31b84be9fd645 100644 --- a/services/bstats/bstats-players.tester.js +++ b/services/bstats/bstats-players.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Players').get('/1.json').expectBadge({ diff --git a/services/bstats/bstats-servers.service.js b/services/bstats/bstats-servers.service.js index f0738b2577db0..f90f95397acd6 100644 --- a/services/bstats/bstats-servers.service.js +++ b/services/bstats/bstats-servers.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.array() .items(Joi.array().items(Joi.number().required(), Joi.number().required())) @@ -52,4 +52,4 @@ export default class BStatsServers extends BaseJsonService { const { servers } = this.transform({ json }) return this.constructor.render({ servers }) } -}; +} diff --git a/services/bstats/bstats-servers.tester.js b/services/bstats/bstats-servers.tester.js index cf87b30ae9757..c673891b67cc6 100644 --- a/services/bstats/bstats-servers.tester.js +++ b/services/bstats/bstats-servers.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Servers').get('/1.json').expectBadge({ diff --git a/services/bugzilla/bugzilla.service.js b/services/bugzilla/bugzilla.service.js index 6bbb58604c674..aadc849eedd0d 100644 --- a/services/bugzilla/bugzilla.service.js +++ b/services/bugzilla/bugzilla.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' const queryParamSchema = Joi.object({ baseUrl: optionalUrl, @@ -113,4 +113,4 @@ export default class Bugzilla extends BaseJsonService { resolution: data.bugs[0].resolution, }) } -}; +} diff --git a/services/bugzilla/bugzilla.spec.js b/services/bugzilla/bugzilla.spec.js index d172813f881d8..114e29fa429e0 100644 --- a/services/bugzilla/bugzilla.spec.js +++ b/services/bugzilla/bugzilla.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import Bugzilla from './bugzilla.service.js'; +import { test, given } from 'sazerac' +import Bugzilla from './bugzilla.service.js' describe('getDisplayStatus function', function () { it('formats status correctly', async function () { diff --git a/services/bugzilla/bugzilla.tester.js b/services/bugzilla/bugzilla.tester.js index 507fd16c8e01a..f3489bfee520d 100644 --- a/services/bugzilla/bugzilla.tester.js +++ b/services/bugzilla/bugzilla.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const bzBugStatus = Joi.equal( diff --git a/services/build-status.js b/services/build-status.js index 49d9175bdd044..9b33b6c2be907 100644 --- a/services/build-status.js +++ b/services/build-status.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' const greenStatuses = [ 'fixed', @@ -72,4 +72,4 @@ function renderBuildStatusBadge({ label, status }) { } } -export { isBuildStatus, renderBuildStatusBadge }; +export { isBuildStatus, renderBuildStatusBadge } diff --git a/services/build-status.spec.js b/services/build-status.spec.js index 03dc25b2d5c00..07cf9be308657 100644 --- a/services/build-status.spec.js +++ b/services/build-status.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {test, given, forCases} from 'sazerac'; -import {renderBuildStatusBadge} from './build-status.js'; +import { expect } from 'chai' +import { test, given, forCases } from 'sazerac' +import { renderBuildStatusBadge } from './build-status.js' test(renderBuildStatusBadge, () => { given({ label: 'build', status: 'passed' }).expect({ diff --git a/services/buildkite/buildkite.service.js b/services/buildkite/buildkite.service.js index 9a645afe88b5e..c9cfb31648f7c 100644 --- a/services/buildkite/buildkite.service.js +++ b/services/buildkite/buildkite.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseJsonService } from '../index.js' // unknown is a valid 'other' status for Buildkite const schema = Joi.object({ @@ -47,4 +47,4 @@ export default class Buildkite extends BaseJsonService { const json = await this.fetch({ identifier, branch }) return renderBuildStatusBadge({ status: json.status }) } -}; +} diff --git a/services/buildkite/buildkite.tester.js b/services/buildkite/buildkite.tester.js index 02f457bebe3a0..d2819659f97d0 100644 --- a/services/buildkite/buildkite.tester.js +++ b/services/buildkite/buildkite.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('buildkite invalid pipeline') diff --git a/services/bundlephobia/bundlephobia.service.js b/services/bundlephobia/bundlephobia.service.js index c17b53658d937..5609e0880ab72 100644 --- a/services/bundlephobia/bundlephobia.service.js +++ b/services/bundlephobia/bundlephobia.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import prettyBytes from 'pretty-bytes'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import prettyBytes from 'pretty-bytes' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ size: nonNegativeInteger, @@ -95,4 +95,4 @@ export default class Bundlephobia extends BaseJsonService { const size = format === 'min' ? json.size : json.gzip return this.constructor.render({ format, size }) } -}; +} diff --git a/services/bundlephobia/bundlephobia.tester.js b/services/bundlephobia/bundlephobia.tester.js index 95222627a95d1..525bff0e026b3 100644 --- a/services/bundlephobia/bundlephobia.tester.js +++ b/services/bundlephobia/bundlephobia.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const formats = { diff --git a/services/categories.js b/services/categories.js index 86d3b8af63bdf..a17077b32db23 100644 --- a/services/categories.js +++ b/services/categories.js @@ -20,4 +20,4 @@ export default [ { id: 'monitoring', name: 'Monitoring', keywords: ['monitoring'] }, { id: 'activity', name: 'Activity', keywords: ['activity'] }, { id: 'other', name: 'Other', keywords: [] }, -]; +] diff --git a/services/cauditor/cauditor.service.js b/services/cauditor/cauditor.service.js index 0c0fcf36e5785..85b64cab52109 100644 --- a/services/cauditor/cauditor.service.js +++ b/services/cauditor/cauditor.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'other', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'cauditor', dateAdded: new Date('2018-02-15'), -}); +}) diff --git a/services/cauditor/cauditor.tester.js b/services/cauditor/cauditor.tester.js index 75a5768faae38..14c96f7e3e1e6 100644 --- a/services/cauditor/cauditor.tester.js +++ b/services/cauditor/cauditor.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'cauditor', diff --git a/services/cdnjs/cdnjs.service.js b/services/cdnjs/cdnjs.service.js index ae50273584248..d1d9e967f59b2 100644 --- a/services/cdnjs/cdnjs.service.js +++ b/services/cdnjs/cdnjs.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService, NotFound } from '../index.js' const cdnjsSchema = Joi.object({ // optional due to non-standard 'not found' condition @@ -43,4 +43,4 @@ export default class Cdnjs extends BaseJsonService { return this.constructor.render({ version: json.version }) } -}; +} diff --git a/services/cdnjs/cdnjs.tester.js b/services/cdnjs/cdnjs.tester.js index 8c113be24e0d4..a2da7ec37576c 100644 --- a/services/cdnjs/cdnjs.tester.js +++ b/services/cdnjs/cdnjs.tester.js @@ -1,5 +1,5 @@ -import {isVPlusTripleDottedVersion} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusTripleDottedVersion } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('cdnjs (valid)').get('/jquery.json').expectBadge({ diff --git a/services/check-services.spec.js b/services/check-services.spec.js index e99253c6d98af..8ee0365156ac7 100644 --- a/services/check-services.spec.js +++ b/services/check-services.spec.js @@ -1,4 +1,4 @@ -import {checkNames, collectDefinitions} from '../core/base-service/loader.js'; +import { checkNames, collectDefinitions } from '../core/base-service/loader.js' // When these tests fail, they will throw AssertionErrors. Wrapping them in an // `expect().not.to.throw()` makes the error output unreadable. diff --git a/services/chocolatey/chocolatey.service.js b/services/chocolatey/chocolatey.service.js index 734683b2c8e4d..584c6c9f14c50 100644 --- a/services/chocolatey/chocolatey.service.js +++ b/services/chocolatey/chocolatey.service.js @@ -1,4 +1,4 @@ -import {createServiceFamily} from '../nuget/nuget-v2-service-family.js'; +import { createServiceFamily } from '../nuget/nuget-v2-service-family.js' export default createServiceFamily({ defaultLabel: 'chocolatey', @@ -10,4 +10,4 @@ export default createServiceFamily({ exampleVersion: '2.19.2', examplePrereleaseVersion: '2.19.2', exampleDownloadCount: 2.2e6, -}); +}) diff --git a/services/chocolatey/chocolatey.tester.js b/services/chocolatey/chocolatey.tester.js index e185869640943..6c2a3a18decd1 100644 --- a/services/chocolatey/chocolatey.tester.js +++ b/services/chocolatey/chocolatey.tester.js @@ -1,5 +1,9 @@ -import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { + isMetric, + isVPlusDottedVersionNClauses, + isVPlusDottedVersionNClausesWithOptionalSuffix, +} from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'chocolatey', diff --git a/services/chrome-web-store/chrome-web-store-base.js b/services/chrome-web-store/chrome-web-store-base.js index f8893b9dc71b8..77e917c2b71a4 100644 --- a/services/chrome-web-store/chrome-web-store-base.js +++ b/services/chrome-web-store/chrome-web-store-base.js @@ -1,6 +1,6 @@ -import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store/index.js'; -import checkErrorResponse from '../../core/base-service/check-error-response.js'; -import {BaseService, Inaccessible} from '../index.js'; +import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store/index.js' +import checkErrorResponse from '../../core/base-service/check-error-response.js' +import { BaseService, Inaccessible } from '../index.js' export default class BaseChromeWebStoreService extends BaseService { async fetch({ storeId }) { @@ -15,4 +15,4 @@ export default class BaseChromeWebStoreService extends BaseService { return checkErrorResponse({})({ buffer: '', res: e }) } } -}; +} diff --git a/services/chrome-web-store/chrome-web-store-price.service.js b/services/chrome-web-store/chrome-web-store-price.service.js index b0cd9d3904c00..99068389d04b6 100644 --- a/services/chrome-web-store/chrome-web-store-price.service.js +++ b/services/chrome-web-store/chrome-web-store-price.service.js @@ -1,6 +1,6 @@ -import {currencyFromCode} from '../text-formatters.js'; -import {NotFound} from '../index.js'; -import BaseChromeWebStoreService from './chrome-web-store-base.js'; +import { currencyFromCode } from '../text-formatters.js' +import { NotFound } from '../index.js' +import BaseChromeWebStoreService from './chrome-web-store-base.js' export default class ChromeWebStorePrice extends BaseChromeWebStoreService { static category = 'funding' @@ -32,4 +32,4 @@ export default class ChromeWebStorePrice extends BaseChromeWebStoreService { } return this.constructor.render({ priceCurrency, price }) } -}; +} diff --git a/services/chrome-web-store/chrome-web-store-price.tester.js b/services/chrome-web-store/chrome-web-store-price.tester.js index 7eacd88daa68f..8c017faf5774c 100644 --- a/services/chrome-web-store/chrome-web-store-price.tester.js +++ b/services/chrome-web-store/chrome-web-store-price.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Price') diff --git a/services/chrome-web-store/chrome-web-store-rating.service.js b/services/chrome-web-store/chrome-web-store-rating.service.js index 5cd3141db7a76..5c273b5357961 100644 --- a/services/chrome-web-store/chrome-web-store-rating.service.js +++ b/services/chrome-web-store/chrome-web-store-rating.service.js @@ -1,7 +1,7 @@ -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {metric, starRating} from '../text-formatters.js'; -import {NotFound} from '../index.js'; -import BaseChromeWebStoreService from './chrome-web-store-base.js'; +import { floorCount as floorCountColor } from '../color-formatters.js' +import { metric, starRating } from '../text-formatters.js' +import { NotFound } from '../index.js' +import BaseChromeWebStoreService from './chrome-web-store-base.js' class BaseChromeWebStoreRating extends BaseChromeWebStoreService { static category = 'rating' @@ -110,4 +110,4 @@ export { ChromeWebStoreRating, ChromeWebStoreRatingCount, ChromeWebStoreRatingStars, -}; +} diff --git a/services/chrome-web-store/chrome-web-store-rating.tester.js b/services/chrome-web-store/chrome-web-store-rating.tester.js index 6c32e2eb2775d..3d4f20c1d5f32 100644 --- a/services/chrome-web-store/chrome-web-store-rating.tester.js +++ b/services/chrome-web-store/chrome-web-store-rating.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isStarRating} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { isStarRating } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ChromeWebStoreRating', diff --git a/services/chrome-web-store/chrome-web-store-users.service.js b/services/chrome-web-store/chrome-web-store-users.service.js index dd0e8d402ef93..7e8341c9694e2 100644 --- a/services/chrome-web-store/chrome-web-store-users.service.js +++ b/services/chrome-web-store/chrome-web-store-users.service.js @@ -1,7 +1,7 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {redirector, NotFound} from '../index.js'; -import BaseChromeWebStoreService from './chrome-web-store-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { redirector, NotFound } from '../index.js' +import BaseChromeWebStoreService from './chrome-web-store-base.js' class ChromeWebStoreUsers extends BaseChromeWebStoreService { static category = 'downloads' @@ -44,7 +44,4 @@ const ChromeWebStoreDownloads = redirector({ dateAdded: new Date('2019-02-27'), }) -export { - ChromeWebStoreDownloads, - ChromeWebStoreUsers, -}; +export { ChromeWebStoreDownloads, ChromeWebStoreUsers } diff --git a/services/chrome-web-store/chrome-web-store-users.tester.js b/services/chrome-web-store/chrome-web-store-users.tester.js index e27644a4752c8..d00b6c3c13217 100644 --- a/services/chrome-web-store/chrome-web-store-users.tester.js +++ b/services/chrome-web-store/chrome-web-store-users.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isMetric } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ChromeWebStoreUsers', diff --git a/services/chrome-web-store/chrome-web-store-version.service.js b/services/chrome-web-store/chrome-web-store-version.service.js index a7249241347ae..e9e42af9596a0 100644 --- a/services/chrome-web-store/chrome-web-store-version.service.js +++ b/services/chrome-web-store/chrome-web-store-version.service.js @@ -1,6 +1,6 @@ -import {renderVersionBadge} from '../version.js'; -import {NotFound} from '../index.js'; -import BaseChromeWebStoreService from './chrome-web-store-base.js'; +import { renderVersionBadge } from '../version.js' +import { NotFound } from '../index.js' +import BaseChromeWebStoreService from './chrome-web-store-base.js' export default class ChromeWebStoreVersion extends BaseChromeWebStoreService { static category = 'version' @@ -24,4 +24,4 @@ export default class ChromeWebStoreVersion extends BaseChromeWebStoreService { } return renderVersionBadge({ version }) } -}; +} diff --git a/services/chrome-web-store/chrome-web-store-version.tester.js b/services/chrome-web-store/chrome-web-store-version.tester.js index fa688e4f41d78..cccf0b95e14be 100644 --- a/services/chrome-web-store/chrome-web-store-version.tester.js +++ b/services/chrome-web-store/chrome-web-store-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Version').get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json').expectBadge({ diff --git a/services/cii-best-practices/cii-best-practices.service.js b/services/cii-best-practices/cii-best-practices.service.js index 53861f255b48c..4aefbf8af72a5 100644 --- a/services/cii-best-practices/cii-best-practices.service.js +++ b/services/cii-best-practices/cii-best-practices.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {colorScale, coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { colorScale, coveragePercentage } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ badge_level: Joi.string().required(), @@ -128,4 +128,4 @@ export default class CIIBestPracticesService extends BaseJsonService { return this.constructor.renderSummaryBadge({ percentage }) } } -}; +} diff --git a/services/cii-best-practices/cii-best-practices.tester.js b/services/cii-best-practices/cii-best-practices.tester.js index 8de52d01a16b3..ba62ffaa11fa1 100644 --- a/services/cii-best-practices/cii-best-practices.tester.js +++ b/services/cii-best-practices/cii-best-practices.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('level known project') diff --git a/services/circleci/circleci.service.js b/services/circleci/circleci.service.js index 7f92a88164b50..2087af453136a 100644 --- a/services/circleci/circleci.service.js +++ b/services/circleci/circleci.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService, redirector} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService, redirector } from '../index.js' const circleSchema = Joi.object({ message: isBuildStatus }).required() const queryParamSchema = Joi.object({ token: Joi.string() }).required() @@ -96,4 +96,4 @@ const legacyRoutes = [ }), ] -export default {...legacyRoutes, CircleCi}; +export default { ...legacyRoutes, CircleCi } diff --git a/services/circleci/circleci.tester.js b/services/circleci/circleci.tester.js index 014d186361a9a..8cbda6b312e33 100644 --- a/services/circleci/circleci.tester.js +++ b/services/circleci/circleci.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {ServiceTester} from '../tester.js'; +import { isBuildStatus } from '../build-status.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'circleci', diff --git a/services/cirrus/cirrus.service.js b/services/cirrus/cirrus.service.js index dd1696cac16d0..437f2d630ab3c 100644 --- a/services/cirrus/cirrus.service.js +++ b/services/cirrus/cirrus.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ subject: Joi.string().required(), @@ -70,4 +70,4 @@ export default class Cirrus extends BaseJsonService { return this.constructor.render(json) } -}; +} diff --git a/services/cirrus/cirrus.tester.js b/services/cirrus/cirrus.tester.js index d867aab8d7ae8..a3f6e396fb01b 100644 --- a/services/cirrus/cirrus.tester.js +++ b/services/cirrus/cirrus.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('cirrus bad repo') diff --git a/services/clojars/clojars-base.js b/services/clojars/clojars-base.js index c18ce1c4cbd2e..15996eebb3797 100644 --- a/services/clojars/clojars-base.js +++ b/services/clojars/clojars-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const clojarsSchema = Joi.object({ downloads: nonNegativeInteger, @@ -19,4 +19,4 @@ class BaseClojarsService extends BaseJsonService { } } -export { BaseClojarsService }; +export { BaseClojarsService } diff --git a/services/clojars/clojars-downloads.service.js b/services/clojars/clojars-downloads.service.js index 2ecfc5312486d..1a5932354daa7 100644 --- a/services/clojars/clojars-downloads.service.js +++ b/services/clojars/clojars-downloads.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount as downloadsColor} from '../color-formatters.js'; -import {BaseClojarsService} from './clojars-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount as downloadsColor } from '../color-formatters.js' +import { BaseClojarsService } from './clojars-base.js' export default class ClojarsDownloads extends BaseClojarsService { static category = 'downloads' @@ -27,4 +27,4 @@ export default class ClojarsDownloads extends BaseClojarsService { const json = await this.fetch({ clojar }) return this.constructor.render({ downloads: json.downloads }) } -}; +} diff --git a/services/clojars/clojars-downloads.tester.js b/services/clojars/clojars-downloads.tester.js index e2125b596a6a8..afb116f46d3e0 100644 --- a/services/clojars/clojars-downloads.tester.js +++ b/services/clojars/clojars-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('clojars downloads (valid)').get('/prismic.json').expectBadge({ diff --git a/services/clojars/clojars-version.service.js b/services/clojars/clojars-version.service.js index 3cd0d76731ecc..344eddc90110d 100644 --- a/services/clojars/clojars-version.service.js +++ b/services/clojars/clojars-version.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {version as versionColor} from '../color-formatters.js'; -import {redirector} from '../index.js'; -import {BaseClojarsService} from './clojars-base.js'; +import Joi from 'joi' +import { version as versionColor } from '../color-formatters.js' +import { redirector } from '../index.js' +import { BaseClojarsService } from './clojars-base.js' const queryParamSchema = Joi.object({ include_prereleases: Joi.equal(''), @@ -61,4 +61,4 @@ const ClojarsVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -export { ClojarsVersionService, ClojarsVersionRedirector }; +export { ClojarsVersionService, ClojarsVersionRedirector } diff --git a/services/clojars/clojars-version.tester.js b/services/clojars/clojars-version.tester.js index 6cd3b3d3d29d6..5d7e23cd35844 100644 --- a/services/clojars/clojars-version.tester.js +++ b/services/clojars/clojars-version.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ClojarsVersion', title: 'Clojars Version', diff --git a/services/cocoapods/cocoapods-apps.service.js b/services/cocoapods/cocoapods-apps.service.js index 8aeaa4f171f87..b0b65a80bd5db 100644 --- a/services/cocoapods/cocoapods-apps.service.js +++ b/services/cocoapods/cocoapods-apps.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ name: 'CocoapodsApps', @@ -9,4 +9,4 @@ export default deprecatedService({ }, label: 'apps', dateAdded: new Date('2018-01-06'), -}); +}) diff --git a/services/cocoapods/cocoapods-apps.tester.js b/services/cocoapods/cocoapods-apps.tester.js index 0fb4e0edef241..cba658950f401 100644 --- a/services/cocoapods/cocoapods-apps.tester.js +++ b/services/cocoapods/cocoapods-apps.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CocoapodsApps', title: 'CocoapodsApps', diff --git a/services/cocoapods/cocoapods-base.js b/services/cocoapods/cocoapods-base.js index fbbd905e6364a..98bcbf49ded2c 100644 --- a/services/cocoapods/cocoapods-base.js +++ b/services/cocoapods/cocoapods-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: Joi.string().required(), @@ -21,4 +21,4 @@ export default class BaseCocoaPodsService extends BaseJsonService { url: `https://trunk.cocoapods.org/api/v1/pods/${spec}/specs/latest`, }) } -}; +} diff --git a/services/cocoapods/cocoapods-docs.service.js b/services/cocoapods/cocoapods-docs.service.js index d980fc07a2793..a25403ad65efb 100644 --- a/services/cocoapods/cocoapods-docs.service.js +++ b/services/cocoapods/cocoapods-docs.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ cocoadocs: Joi.object({ @@ -41,4 +41,4 @@ export default class CocoapodsDocs extends BaseJsonService { const percentage = data.cocoadocs.doc_percent || 0 return this.constructor.render({ percentage }) } -}; +} diff --git a/services/cocoapods/cocoapods-docs.tester.js b/services/cocoapods/cocoapods-docs.tester.js index 4c7315f5f593b..746505bc21e7f 100644 --- a/services/cocoapods/cocoapods-docs.tester.js +++ b/services/cocoapods/cocoapods-docs.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('doc percent (valid)').get('/AFNetworking.json').expectBadge({ diff --git a/services/cocoapods/cocoapods-downloads.service.js b/services/cocoapods/cocoapods-downloads.service.js index afd7a2b937b2b..e54056deed34e 100644 --- a/services/cocoapods/cocoapods-downloads.service.js +++ b/services/cocoapods/cocoapods-downloads.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ name: 'CocoapodsDownloads', @@ -9,4 +9,4 @@ export default deprecatedService({ }, label: 'downloads', dateAdded: new Date('2018-01-06'), -}); +}) diff --git a/services/cocoapods/cocoapods-downloads.tester.js b/services/cocoapods/cocoapods-downloads.tester.js index b6f81138a7a83..b7dbf18ba8fbf 100644 --- a/services/cocoapods/cocoapods-downloads.tester.js +++ b/services/cocoapods/cocoapods-downloads.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CocoapodsDownloads', diff --git a/services/cocoapods/cocoapods-license.service.js b/services/cocoapods/cocoapods-license.service.js index ec9882c8989f6..95f401b054c8f 100644 --- a/services/cocoapods/cocoapods-license.service.js +++ b/services/cocoapods/cocoapods-license.service.js @@ -1,4 +1,4 @@ -import BaseCocoaPodsService from './cocoapods-base.js'; +import BaseCocoaPodsService from './cocoapods-base.js' export default class CocoapodsLicense extends BaseCocoaPodsService { static category = 'license' @@ -35,4 +35,4 @@ export default class CocoapodsLicense extends BaseCocoaPodsService { typeof data.license === 'object' ? data.license.type : data.license return this.constructor.render({ license }) } -}; +} diff --git a/services/cocoapods/cocoapods-license.tester.js b/services/cocoapods/cocoapods-license.tester.js index c466bf9f8ffae..c4eba4f9ff26e 100644 --- a/services/cocoapods/cocoapods-license.tester.js +++ b/services/cocoapods/cocoapods-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('license (valid)') diff --git a/services/cocoapods/cocoapods-platform.service.js b/services/cocoapods/cocoapods-platform.service.js index 01a17e0f4f803..83cb468d84191 100644 --- a/services/cocoapods/cocoapods-platform.service.js +++ b/services/cocoapods/cocoapods-platform.service.js @@ -1,4 +1,4 @@ -import BaseCocoaPodsService from './cocoapods-base.js'; +import BaseCocoaPodsService from './cocoapods-base.js' export default class CocoapodsPlatform extends BaseCocoaPodsService { static category = 'platform-support' @@ -28,4 +28,4 @@ export default class CocoapodsPlatform extends BaseCocoaPodsService { const { platforms } = await this.fetch({ spec }) return this.constructor.render({ platforms: Object.keys(platforms) }) } -}; +} diff --git a/services/cocoapods/cocoapods-platform.tester.js b/services/cocoapods/cocoapods-platform.tester.js index a67d8cf7588b1..f2d176f97355f 100644 --- a/services/cocoapods/cocoapods-platform.tester.js +++ b/services/cocoapods/cocoapods-platform.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isPlatform = Joi.string().regex( diff --git a/services/cocoapods/cocoapods-version.service.js b/services/cocoapods/cocoapods-version.service.js index 3431526d8e398..bc55f8306361d 100644 --- a/services/cocoapods/cocoapods-version.service.js +++ b/services/cocoapods/cocoapods-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import BaseCocoaPodsService from './cocoapods-base.js'; +import { renderVersionBadge } from '../version.js' +import BaseCocoaPodsService from './cocoapods-base.js' export default class CocoapodsVersion extends BaseCocoaPodsService { static category = 'version' @@ -19,4 +19,4 @@ export default class CocoapodsVersion extends BaseCocoaPodsService { const { version } = await this.fetch({ spec }) return renderVersionBadge({ version }) } -}; +} diff --git a/services/cocoapods/cocoapods-version.tester.js b/services/cocoapods/cocoapods-version.tester.js index a92fadc9d12c5..e4e934abf5693 100644 --- a/services/cocoapods/cocoapods-version.tester.js +++ b/services/cocoapods/cocoapods-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version (valid)').get('/AFNetworking.json').expectBadge({ diff --git a/services/codacy/codacy-coverage.service.js b/services/codacy/codacy-coverage.service.js index 4a1b6ebcf1b7e..04da6a9b74774 100644 --- a/services/codacy/codacy-coverage.service.js +++ b/services/codacy/codacy-coverage.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import {BaseSvgScrapingService, NotFound} from '../index.js'; +import Joi from 'joi' +import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js' +import { BaseSvgScrapingService, NotFound } from '../index.js' const schema = Joi.object({ message: Joi.alternatives() @@ -42,7 +42,7 @@ export default class CodacyCoverage extends BaseSvgScrapingService { static transform({ coverageString }) { return { percentage: parseFloat(coverageString.replace(/%$/, '')), - }; + } } async handle({ projectId, branch }) { @@ -70,4 +70,4 @@ export default class CodacyCoverage extends BaseSvgScrapingService { const { percentage } = this.constructor.transform({ coverageString }) return this.constructor.render({ percentage }) } -}; +} diff --git a/services/codacy/codacy-coverage.tester.js b/services/codacy/codacy-coverage.tester.js index ab777a69119fc..ab0c24fed26a7 100644 --- a/services/codacy/codacy-coverage.tester.js +++ b/services/codacy/codacy-coverage.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Coverage').get('/59d607d0e311408885e418004068ea58.json').expectBadge({ diff --git a/services/codacy/codacy-grade.service.js b/services/codacy/codacy-grade.service.js index 2333108c916d9..4c4d35d76d96a 100644 --- a/services/codacy/codacy-grade.service.js +++ b/services/codacy/codacy-grade.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {BaseSvgScrapingService} from '../index.js'; -import {codacyGrade} from './codacy-helpers.js'; +import Joi from 'joi' +import { BaseSvgScrapingService } from '../index.js' +import { codacyGrade } from './codacy-helpers.js' const schema = Joi.object({ message: codacyGrade }).required() @@ -56,4 +56,4 @@ export default class CodacyGrade extends BaseSvgScrapingService { }) return this.constructor.render({ grade }) } -}; +} diff --git a/services/codacy/codacy-grade.tester.js b/services/codacy/codacy-grade.tester.js index 6c7081600f965..be97c7eae00c5 100644 --- a/services/codacy/codacy-grade.tester.js +++ b/services/codacy/codacy-grade.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {codacyGrade} from './codacy-helpers.js'; +import { createServiceTester } from '../tester.js' +import { codacyGrade } from './codacy-helpers.js' export const t = await createServiceTester() t.create('Code quality') diff --git a/services/codacy/codacy-helpers.js b/services/codacy/codacy-helpers.js index 60218268ccd06..8408c492ad7e0 100644 --- a/services/codacy/codacy-helpers.js +++ b/services/codacy/codacy-helpers.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; +import Joi from 'joi' const codacyGrade = Joi.equal('A', 'B', 'C', 'D', 'E', 'F') -export { codacyGrade }; +export { codacyGrade } diff --git a/services/codeclimate/codeclimate-analysis-redirector.service.js b/services/codeclimate/codeclimate-analysis-redirector.service.js index 02810a1479971..d2b68b56defce 100644 --- a/services/codeclimate/codeclimate-analysis-redirector.service.js +++ b/services/codeclimate/codeclimate-analysis-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ // http://github.com/badges/shields/issues/1387 @@ -14,4 +14,4 @@ export default [ `/codeclimate/maintainability/${user}/${repo}`, dateAdded: new Date('2019-04-16'), }), -]; +] diff --git a/services/codeclimate/codeclimate-analysis-redirector.tester.js b/services/codeclimate/codeclimate-analysis-redirector.tester.js index f142d787263d6..38531168c81bc 100644 --- a/services/codeclimate/codeclimate-analysis-redirector.tester.js +++ b/services/codeclimate/codeclimate-analysis-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CodeclimateCoverageRedirector', diff --git a/services/codeclimate/codeclimate-analysis.service.js b/services/codeclimate/codeclimate-analysis.service.js index 9e09aaa2defd7..811ceb6db1f97 100644 --- a/services/codeclimate/codeclimate-analysis.service.js +++ b/services/codeclimate/codeclimate-analysis.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {colorScale, letterScore} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; -import {keywords, isLetterGrade, fetchRepo} from './codeclimate-common.js'; +import Joi from 'joi' +import { colorScale, letterScore } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' +import { keywords, isLetterGrade, fetchRepo } from './codeclimate-common.js' const schema = Joi.object({ data: Joi.object({ @@ -164,4 +164,4 @@ export default class CodeclimateAnalysis extends BaseJsonService { ...props, }) } -}; +} diff --git a/services/codeclimate/codeclimate-analysis.tester.js b/services/codeclimate/codeclimate-analysis.tester.js index cf0951be5b866..9bab1043d1310 100644 --- a/services/codeclimate/codeclimate-analysis.tester.js +++ b/services/codeclimate/codeclimate-analysis.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Examples for this service can be found through the explore page: diff --git a/services/codeclimate/codeclimate-common.js b/services/codeclimate/codeclimate-common.js index b0fc076a65ac3..b987317b0bf1d 100644 --- a/services/codeclimate/codeclimate-common.js +++ b/services/codeclimate/codeclimate-common.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {NotFound} from '../index.js'; +import Joi from 'joi' +import { NotFound } from '../index.js' const keywords = ['codeclimate'] @@ -42,8 +42,4 @@ async function fetchRepo(serviceInstance, { user, repo }) { return repoInfo } -export { - keywords, - isLetterGrade, - fetchRepo, -}; +export { keywords, isLetterGrade, fetchRepo } diff --git a/services/codeclimate/codeclimate-coverage-redirector.service.js b/services/codeclimate/codeclimate-coverage-redirector.service.js index a9686473b0acc..49997961887ad 100644 --- a/services/codeclimate/codeclimate-coverage-redirector.service.js +++ b/services/codeclimate/codeclimate-coverage-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ // http://github.com/badges/shields/issues/1387 @@ -34,4 +34,4 @@ export default [ transformPath: ({ user, repo }) => `/codeclimate/coverage/${user}/${repo}`, dateAdded: new Date('2019-04-15'), }), -]; +] diff --git a/services/codeclimate/codeclimate-coverage-redirector.tester.js b/services/codeclimate/codeclimate-coverage-redirector.tester.js index 1287af63667e0..cc0ead2a188ee 100644 --- a/services/codeclimate/codeclimate-coverage-redirector.tester.js +++ b/services/codeclimate/codeclimate-coverage-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CodeclimateCoverageRedirector', diff --git a/services/codeclimate/codeclimate-coverage.service.js b/services/codeclimate/codeclimate-coverage.service.js index 9dea3febc6bd6..9b7f81eb8a416 100644 --- a/services/codeclimate/codeclimate-coverage.service.js +++ b/services/codeclimate/codeclimate-coverage.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {coveragePercentage, letterScore} from '../color-formatters.js'; -import {BaseJsonService, NotFound} from '../index.js'; -import {keywords, isLetterGrade, fetchRepo} from './codeclimate-common.js'; +import Joi from 'joi' +import { coveragePercentage, letterScore } from '../color-formatters.js' +import { BaseJsonService, NotFound } from '../index.js' +import { keywords, isLetterGrade, fetchRepo } from './codeclimate-common.js' const schema = Joi.object({ data: Joi.object({ @@ -83,4 +83,4 @@ export default class CodeclimateCoverage extends BaseJsonService { percentage, }) } -}; +} diff --git a/services/codeclimate/codeclimate-coverage.tester.js b/services/codeclimate/codeclimate-coverage.tester.js index e6727e70d292e..66ca3045126e1 100644 --- a/services/codeclimate/codeclimate-coverage.tester.js +++ b/services/codeclimate/codeclimate-coverage.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Examples for this service can be found through the explore page: diff --git a/services/codecov/codecov-redirect.service.js b/services/codecov/codecov-redirect.service.js index 35c0509cc0c84..2707d2e180253 100644 --- a/services/codecov/codecov-redirect.service.js +++ b/services/codecov/codecov-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' const vcsSNameShortFormMap = { bb: 'bitbucket', @@ -21,4 +21,4 @@ export default [ transformQueryParams: ({ token }) => ({ token }), dateAdded: new Date('2019-03-04'), }), -]; +] diff --git a/services/codecov/codecov-redirect.tester.js b/services/codecov/codecov-redirect.tester.js index e0a8581136483..4e23c04550b7f 100644 --- a/services/codecov/codecov-redirect.tester.js +++ b/services/codecov/codecov-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CodecovTokenRedirect', diff --git a/services/codecov/codecov.service.js b/services/codecov/codecov.service.js index 4f5852a3e63b2..6bb90813dd6cf 100644 --- a/services/codecov/codecov.service.js +++ b/services/codecov/codecov.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import {BaseSvgScrapingService} from '../index.js'; -import {parseJson} from '../../core/base-service/json.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import { BaseSvgScrapingService } from '../index.js' +import { parseJson } from '../../core/base-service/json.js' // https://docs.codecov.io/reference#totals // A new repository that's been added but never had any coverage reports @@ -175,4 +175,4 @@ export default class Codecov extends BaseSvgScrapingService { const { coverage } = this.transform({ data }) return this.constructor.render({ coverage }) } -}; +} diff --git a/services/codecov/codecov.spec.js b/services/codecov/codecov.spec.js index 9007307366373..d0f599a3fa0f6 100644 --- a/services/codecov/codecov.spec.js +++ b/services/codecov/codecov.spec.js @@ -1,5 +1,5 @@ -import {test, forCases, given} from 'sazerac'; -import Codecov from './codecov.service.js'; +import { test, forCases, given } from 'sazerac' +import Codecov from './codecov.service.js' describe('Codecov', function () { test(Codecov.prototype.legacyTransform, () => { diff --git a/services/codecov/codecov.tester.js b/services/codecov/codecov.tester.js index c83ed61bb74ea..4eeea1c609c43 100644 --- a/services/codecov/codecov.tester.js +++ b/services/codecov/codecov.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets coverage status') diff --git a/services/codefactor/codefactor-grade.service.js b/services/codefactor/codefactor-grade.service.js index b9cf1da86a084..748a87950b671 100644 --- a/services/codefactor/codefactor-grade.service.js +++ b/services/codefactor/codefactor-grade.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {BaseSvgScrapingService} from '../index.js'; -import {isValidGrade, gradeColor} from './codefactor-helpers.js'; +import Joi from 'joi' +import { BaseSvgScrapingService } from '../index.js' +import { isValidGrade, gradeColor } from './codefactor-helpers.js' const schema = Joi.object({ message: isValidGrade, @@ -45,4 +45,4 @@ export default class CodeFactorGrade extends BaseSvgScrapingService { }) return this.constructor.render({ grade: message }) } -}; +} diff --git a/services/codefactor/codefactor-grade.spec.js b/services/codefactor/codefactor-grade.spec.js index b6afefe516000..a4ba4d95e8928 100644 --- a/services/codefactor/codefactor-grade.spec.js +++ b/services/codefactor/codefactor-grade.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import CodeFactorGrade from './codefactor-grade.service.js'; +import { test, given } from 'sazerac' +import CodeFactorGrade from './codefactor-grade.service.js' describe('CodeFactorGrade', function () { test(CodeFactorGrade.render, () => { diff --git a/services/codefactor/codefactor-grade.tester.js b/services/codefactor/codefactor-grade.tester.js index ebec37cf2c169..56be9a4fd3849 100644 --- a/services/codefactor/codefactor-grade.tester.js +++ b/services/codefactor/codefactor-grade.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isValidGrade} from './codefactor-helpers.js'; +import { createServiceTester } from '../tester.js' +import { isValidGrade } from './codefactor-helpers.js' export const t = await createServiceTester() t.create('Grade').get('/github/google/guava.json').expectBadge({ diff --git a/services/codefactor/codefactor-helpers.js b/services/codefactor/codefactor-helpers.js index 4059217a31777..d110eabdfb591 100644 --- a/services/codefactor/codefactor-helpers.js +++ b/services/codefactor/codefactor-helpers.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' // https://support.codefactor.io/i14-glossary // https://github.com/badges/shields/issues/4269 @@ -29,4 +29,4 @@ function gradeColor(grade) { return color } -export { isValidGrade, gradeColor }; +export { isValidGrade, gradeColor } diff --git a/services/codeship/codeship.service.js b/services/codeship/codeship.service.js index 9096b6cb6bdf2..d9a8bde1d6637 100644 --- a/services/codeship/codeship.service.js +++ b/services/codeship/codeship.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService } from '../index.js' const schema = Joi.object({ message: Joi.alternatives() @@ -62,11 +62,11 @@ export default class Codeship extends BaseSvgScrapingService { url, options: { qs: { branch } }, valueMatcher: /(?:[.\s\S]*)\/><\/g> 2) { @@ -18,7 +18,4 @@ function renderContributorBadge({ label, contributorCount }) { } } -export { - contributorColor, - renderContributorBadge, -}; +export { contributorColor, renderContributorBadge } diff --git a/services/contributor-count.spec.js b/services/contributor-count.spec.js index 61a8a69a26314..ba4e0fe6cbfb8 100644 --- a/services/contributor-count.spec.js +++ b/services/contributor-count.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {renderContributorBadge} from './contributor-count.js'; +import { test, given } from 'sazerac' +import { renderContributorBadge } from './contributor-count.js' describe('Contributor count helpers', function () { test(renderContributorBadge, () => { diff --git a/services/cookbook/cookbook.service.js b/services/cookbook/cookbook.service.js index 10627606e83ff..4b6604d531524 100644 --- a/services/cookbook/cookbook.service.js +++ b/services/cookbook/cookbook.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: Joi.string().required() }).required() @@ -27,4 +27,4 @@ export default class Cookbook extends BaseJsonService { const { version } = await this.fetch({ cookbook }) return renderVersionBadge({ version }) } -}; +} diff --git a/services/cookbook/cookbook.tester.js b/services/cookbook/cookbook.tester.js index 987a7e4bd0e22..2cecfad4678b8 100644 --- a/services/cookbook/cookbook.tester.js +++ b/services/cookbook/cookbook.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version').get('/chef-sugar.json').expectBadge({ diff --git a/services/coveralls/coveralls-redirector.service.js b/services/coveralls/coveralls-redirector.service.js index 5001f8631fd30..1fd09fef647f9 100644 --- a/services/coveralls/coveralls-redirector.service.js +++ b/services/coveralls/coveralls-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -12,4 +12,4 @@ export default [ `/coveralls/github/${user}/${repo}${branch ? `/${branch}` : ''}`, dateAdded: new Date('2021-02-23'), }), -]; +] diff --git a/services/coveralls/coveralls-redirector.tester.js b/services/coveralls/coveralls-redirector.tester.js index 22948a59213f4..de826f7cd7aef 100644 --- a/services/coveralls/coveralls-redirector.tester.js +++ b/services/coveralls/coveralls-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CoverallsGitHubRedirect', diff --git a/services/coveralls/coveralls.service.js b/services/coveralls/coveralls.service.js index 80591d6704d5a..46b0d556a72a9 100644 --- a/services/coveralls/coveralls.service.js +++ b/services/coveralls/coveralls.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ covered_percent: Joi.number().min(0).max(100).required(), @@ -73,4 +73,4 @@ export default class Coveralls extends BaseJsonService { const json = await this.fetch({ vcsType, user, repo, branch }) return this.constructor.render({ coverage: json.covered_percent }) } -}; +} diff --git a/services/coveralls/coveralls.tester.js b/services/coveralls/coveralls.tester.js index e5845db45e32b..415dfa6857136 100644 --- a/services/coveralls/coveralls.tester.js +++ b/services/coveralls/coveralls.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('github coverage') diff --git a/services/coverity/coverity-on-demand.service.js b/services/coverity/coverity-on-demand.service.js index 18127151579fb..3b2705ecc7255 100644 --- a/services/coverity/coverity-on-demand.service.js +++ b/services/coverity/coverity-on-demand.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ route: { @@ -8,4 +8,4 @@ export default deprecatedService({ label: 'coverity', category: 'analysis', dateAdded: new Date('2018-12-18'), -}); +}) diff --git a/services/coverity/coverity-on-demand.tester.js b/services/coverity/coverity-on-demand.tester.js index 6e4ada15ce870..cdc0f561b88c3 100644 --- a/services/coverity/coverity-on-demand.tester.js +++ b/services/coverity/coverity-on-demand.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'CoverityOnDemand', diff --git a/services/coverity/coverity-scan.service.js b/services/coverity/coverity-scan.service.js index 8df4dbb28f748..a28e7d4f1da36 100644 --- a/services/coverity/coverity-scan.service.js +++ b/services/coverity/coverity-scan.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const messageRegex = /passed|passed .* new defects|pending|failed/ const schema = Joi.object({ @@ -64,4 +64,4 @@ export default class CoverityScan extends BaseJsonService { }) return this.constructor.render({ message: json.message }) } -}; +} diff --git a/services/coverity/coverity-scan.tester.js b/services/coverity/coverity-scan.tester.js index 0492338e2facf..83aa2b092eda3 100644 --- a/services/coverity/coverity-scan.tester.js +++ b/services/coverity/coverity-scan.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('known project id') diff --git a/services/cpan/cpan-license.service.js b/services/cpan/cpan-license.service.js index ba3d4afe080ca..53ea4f4a5f3bb 100644 --- a/services/cpan/cpan-license.service.js +++ b/services/cpan/cpan-license.service.js @@ -1,4 +1,4 @@ -import BaseCpanService from './cpan.js'; +import BaseCpanService from './cpan.js' export default class CpanLicense extends BaseCpanService { static category = 'license' @@ -25,4 +25,4 @@ export default class CpanLicense extends BaseCpanService { const data = await this.fetch({ packageName }) return this.constructor.render({ license: data.license[0] }) } -}; +} diff --git a/services/cpan/cpan-license.tester.js b/services/cpan/cpan-license.tester.js index 0986d81c23107..8cfba3c5e1960 100644 --- a/services/cpan/cpan-license.tester.js +++ b/services/cpan/cpan-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('license (valid)').get('/Config-Augeas.json').expectBadge({ diff --git a/services/cpan/cpan-version.service.js b/services/cpan/cpan-version.service.js index 56c350c438583..92cba8d084720 100644 --- a/services/cpan/cpan-version.service.js +++ b/services/cpan/cpan-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import BaseCpanService from './cpan.js'; +import { renderVersionBadge } from '../version.js' +import BaseCpanService from './cpan.js' export default class CpanVersion extends BaseCpanService { static category = 'version' @@ -18,4 +18,4 @@ export default class CpanVersion extends BaseCpanService { const { version } = await this.fetch({ packageName }) return renderVersionBadge({ version }) } -}; +} diff --git a/services/cpan/cpan-version.tester.js b/services/cpan/cpan-version.tester.js index 1d1f4b7fd5d63..402601004d6f1 100644 --- a/services/cpan/cpan-version.tester.js +++ b/services/cpan/cpan-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version (valid)').get('/Config-Augeas.json').expectBadge({ diff --git a/services/cpan/cpan.js b/services/cpan/cpan.js index 6a93799421d08..96d0c4c941332 100644 --- a/services/cpan/cpan.js +++ b/services/cpan/cpan.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: Joi.alternatives(Joi.string().required(), Joi.number().required()), @@ -13,4 +13,4 @@ export default class BaseCpanService extends BaseJsonService { const url = `https://fastapi.metacpan.org/v1/release/${packageName}` return this._requestJson({ schema, url }) } -}; +} diff --git a/services/cran/cran.service.js b/services/cran/cran.service.js index 7bf651afe11c8..bb25656e21809 100644 --- a/services/cran/cran.service.js +++ b/services/cran/cran.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ License: Joi.string().required(), @@ -64,4 +64,4 @@ class CranVersion extends BaseCranService { } } -export { CranLicense, CranVersion }; +export { CranLicense, CranVersion } diff --git a/services/cran/cran.tester.js b/services/cran/cran.tester.js index 01c4ebb5f0948..1581c8a7ddc70 100644 --- a/services/cran/cran.tester.js +++ b/services/cran/cran.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isVPlusTripleDottedVersion} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isVPlusTripleDottedVersion } from '../test-validators.js' export const t = new ServiceTester({ id: 'cran', diff --git a/services/crates/crates-base.js b/services/crates/crates-base.js index a408f49aff056..e87fe5cea875f 100644 --- a/services/crates/crates-base.js +++ b/services/crates/crates-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const keywords = ['Rust'] @@ -49,4 +49,4 @@ class BaseCratesService extends BaseJsonService { } } -export { BaseCratesService, keywords }; +export { BaseCratesService, keywords } diff --git a/services/crates/crates-downloads.service.js b/services/crates/crates-downloads.service.js index 8dfc32eedc534..ec442f83657a2 100644 --- a/services/crates/crates-downloads.service.js +++ b/services/crates/crates-downloads.service.js @@ -1,7 +1,7 @@ -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {InvalidParameter, NotFound} from '../index.js'; -import {BaseCratesService, keywords} from './crates-base.js'; +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { InvalidParameter, NotFound } from '../index.js' +import { BaseCratesService, keywords } from './crates-base.js' export default class CratesDownloads extends BaseCratesService { static category = 'downloads' @@ -109,4 +109,4 @@ export default class CratesDownloads extends BaseCratesService { return this.constructor.render({ variant, downloads, version }) } -}; +} diff --git a/services/crates/crates-downloads.tester.js b/services/crates/crates-downloads.tester.js index f451b4a5ad1e8..9e2e13ccf47aa 100644 --- a/services/crates/crates-downloads.tester.js +++ b/services/crates/crates-downloads.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = new ServiceTester({ id: 'crates', diff --git a/services/crates/crates-license.service.js b/services/crates/crates-license.service.js index b832db33b32c5..c32ab9517bd8f 100644 --- a/services/crates/crates-license.service.js +++ b/services/crates/crates-license.service.js @@ -1,4 +1,4 @@ -import {BaseCratesService, keywords} from './crates-base.js'; +import { BaseCratesService, keywords } from './crates-base.js' export default class CratesLicense extends BaseCratesService { static category = 'license' @@ -45,4 +45,4 @@ export default class CratesLicense extends BaseCratesService { license: json.version ? json.version.license : json.versions[0].license, }) } -}; +} diff --git a/services/crates/crates-license.tester.js b/services/crates/crates-license.tester.js index 7d8d459a297c7..390295433b0bd 100644 --- a/services/crates/crates-license.tester.js +++ b/services/crates/crates-license.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'crates', diff --git a/services/crates/crates-version.service.js b/services/crates/crates-version.service.js index 6929077e89bf4..be7a6d1c18682 100644 --- a/services/crates/crates-version.service.js +++ b/services/crates/crates-version.service.js @@ -1,6 +1,6 @@ -import {renderVersionBadge} from '../version.js'; -import {InvalidResponse} from '../index.js'; -import {BaseCratesService, keywords} from './crates-base.js'; +import { renderVersionBadge } from '../version.js' +import { InvalidResponse } from '../index.js' +import { BaseCratesService, keywords } from './crates-base.js' export default class CratesVersion extends BaseCratesService { static category = 'version' @@ -27,4 +27,4 @@ export default class CratesVersion extends BaseCratesService { const { version } = this.transform(json) return renderVersionBadge({ version }) } -}; +} diff --git a/services/crates/crates-version.spec.js b/services/crates/crates-version.spec.js index 0ac5bf4a922f8..7ceba9f3ba733 100644 --- a/services/crates/crates-version.spec.js +++ b/services/crates/crates-version.spec.js @@ -1,7 +1,7 @@ -import {test, given} from 'sazerac'; -import {expect} from 'chai'; -import {InvalidResponse} from '../index.js'; -import CratesVersion from './crates-version.service.js'; +import { test, given } from 'sazerac' +import { expect } from 'chai' +import { InvalidResponse } from '../index.js' +import CratesVersion from './crates-version.service.js' describe('CratesVersion', function () { test(CratesVersion.prototype.transform, () => { diff --git a/services/crates/crates-version.tester.js b/services/crates/crates-version.tester.js index fe31ab2401687..3242c1cd5a82e 100644 --- a/services/crates/crates-version.tester.js +++ b/services/crates/crates-version.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version') diff --git a/services/criterion/criterion.service.js b/services/criterion/criterion.service.js index 13d094e0f5f4c..6df7615a94fa9 100644 --- a/services/criterion/criterion.service.js +++ b/services/criterion/criterion.service.js @@ -1,6 +1,11 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; -import {IMPROVED_STATUS, NOT_FOUND_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS} from './constants.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { + IMPROVED_STATUS, + NOT_FOUND_STATUS, + REGRESSED_STATUS, + NO_CHANGE_STATUS, +} from './constants.js' const schema = Joi.string() .allow(IMPROVED_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS) @@ -58,4 +63,4 @@ export default class Criterion extends BaseJsonService { return this.constructor.render({ status }) } -}; +} diff --git a/services/criterion/criterion.tester.js b/services/criterion/criterion.tester.js index f031ab82463de..9e476514d822c 100644 --- a/services/criterion/criterion.tester.js +++ b/services/criterion/criterion.tester.js @@ -1,6 +1,11 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {IMPROVED_STATUS, REGRESSED_STATUS, NO_CHANGE_STATUS, NOT_FOUND_STATUS} from './constants.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { + IMPROVED_STATUS, + REGRESSED_STATUS, + NO_CHANGE_STATUS, + NOT_FOUND_STATUS, +} from './constants.js' export const t = await createServiceTester() const isStatus = Joi.string() diff --git a/services/ctan/ctan.service.js b/services/ctan/ctan.service.js index 5a10e373da886..e6a97345cf26a 100644 --- a/services/ctan/ctan.service.js +++ b/services/ctan/ctan.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderLicenseBadge} from '../licenses.js'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderLicenseBadge } from '../licenses.js' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ license: Joi.array().items(Joi.string()).single(), @@ -71,7 +71,4 @@ class CtanVersion extends BaseCtanService { } } -export { - CtanLicense, - CtanVersion, -}; +export { CtanLicense, CtanVersion } diff --git a/services/ctan/ctan.tester.js b/services/ctan/ctan.tester.js index 15a3cc2b5a8f2..10f4386a2b7c4 100644 --- a/services/ctan/ctan.tester.js +++ b/services/ctan/ctan.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' export const t = new ServiceTester({ id: 'ctan', diff --git a/services/date/date.service.js b/services/date/date.service.js index a6b5ef0c660b1..32fda7de30e4f 100644 --- a/services/date/date.service.js +++ b/services/date/date.service.js @@ -1,5 +1,5 @@ -import {formatRelativeDate} from '../text-formatters.js'; -import {BaseService} from '../index.js'; +import { formatRelativeDate } from '../text-formatters.js' +import { BaseService } from '../index.js' const documentation = `

@@ -36,4 +36,4 @@ export default class Date extends BaseService { relativeDateString: formatRelativeDate(timestamp), }) } -}; +} diff --git a/services/date/date.tester.js b/services/date/date.tester.js index 117ee7166c54b..ec5000da23e66 100644 --- a/services/date/date.tester.js +++ b/services/date/date.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isRelativeFormattedDate} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isRelativeFormattedDate } from '../test-validators.js' export const t = new ServiceTester({ id: 'date', diff --git a/services/david/david.service.js b/services/david/david.service.js index 6cc68524701f3..67e171d93b08e 100644 --- a/services/david/david.service.js +++ b/services/david/david.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ status: Joi.allow( @@ -95,4 +95,4 @@ export default class David extends BaseJsonService { const json = await this.fetch({ kind, user, repo, path }) return this.constructor.render({ status: json.status, kind }) } -}; +} diff --git a/services/david/david.tester.js b/services/david/david.tester.js index dec9e5c49118b..b7e4ac0761c24 100644 --- a/services/david/david.tester.js +++ b/services/david/david.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isDependencyStatus = Joi.string().valid( diff --git a/services/debian/debian.service.js b/services/debian/debian.service.js index cddfbf2ec93f5..404cc75b3d469 100644 --- a/services/debian/debian.service.js +++ b/services/debian/debian.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {latest, renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { latest, renderVersionBadge } from '../version.js' +import { BaseJsonService, NotFound, InvalidResponse } from '../index.js' const schema = Joi.array() .items( @@ -62,4 +62,4 @@ export default class Debian extends BaseJsonService { const versions = Object.keys(packageData[distKeys[0]]) return renderVersionBadge({ version: latest(versions) }) } -}; +} diff --git a/services/debian/debian.tester.js b/services/debian/debian.tester.js index c03f2cd9b747d..d56026c476516 100644 --- a/services/debian/debian.tester.js +++ b/services/debian/debian.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Debian package (default distribution, valid)') diff --git a/services/debug/debug.service.js b/services/debug/debug.service.js index 04b0474ba1de5..93dc625deaf3a 100644 --- a/services/debug/debug.service.js +++ b/services/debug/debug.service.js @@ -1,4 +1,4 @@ -import {BaseService} from '../index.js'; +import { BaseService } from '../index.js' const serverStartTime = new Date(new Date().toGMTString()) let bitFlip = false @@ -39,4 +39,4 @@ export default class Debug extends BaseService { } } } -}; +} diff --git a/services/debug/debug.tester.js b/services/debug/debug.tester.js index c6922666cbf93..f57dcaf34141e 100644 --- a/services/debug/debug.tester.js +++ b/services/debug/debug.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('start time') diff --git a/services/dependabot/dependabot.service.js b/services/dependabot/dependabot.service.js index 00af1095ee393..57d2cf3a31106 100644 --- a/services/dependabot/dependabot.service.js +++ b/services/dependabot/dependabot.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ status: Joi.string().required(), @@ -50,4 +50,4 @@ export default class DependabotSemverCompatibility extends BaseJsonService { message: json.status, } } -}; +} diff --git a/services/dependabot/dependabot.tester.js b/services/dependabot/dependabot.tester.js index b5bdc0dcdec56..9ac85a9e1ee0b 100644 --- a/services/dependabot/dependabot.tester.js +++ b/services/dependabot/dependabot.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('semver stability (valid)').get('/bundler/puma.json').expectBadge({ diff --git a/services/depfu/depfu.service.js b/services/depfu/depfu.service.js index 74b4d547d7de5..b35daf9f904f3 100644 --- a/services/depfu/depfu.service.js +++ b/services/depfu/depfu.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const depfuSchema = Joi.object({ text: Joi.string().required(), @@ -38,4 +38,4 @@ export default class Depfu extends BaseJsonService { const { text, colorscheme } = await this.fetch({ user, repo }) return this.constructor.render({ text, colorscheme }) } -}; +} diff --git a/services/depfu/depfu.tester.js b/services/depfu/depfu.tester.js index 2aa1864b94d06..04aeaf2b02cf9 100644 --- a/services/depfu/depfu.tester.js +++ b/services/depfu/depfu.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' const isDependencyStatus = Joi.string().valid( 'insecure', diff --git a/services/deprecation-helpers.js b/services/deprecation-helpers.js index bf048c9e6d4d5..fb6ecc6b7968b 100644 --- a/services/deprecation-helpers.js +++ b/services/deprecation-helpers.js @@ -1,4 +1,4 @@ -import {Deprecated} from './index.js'; +import { Deprecated } from './index.js' function enforceDeprecation(effectiveDate) { if (Date.now() >= effectiveDate.getTime()) { @@ -6,6 +6,4 @@ function enforceDeprecation(effectiveDate) { } } -export { - enforceDeprecation, -}; +export { enforceDeprecation } diff --git a/services/deprecation-helpers.spec.js b/services/deprecation-helpers.spec.js index 3cef2082d3bcf..34779dad7f9a3 100644 --- a/services/deprecation-helpers.spec.js +++ b/services/deprecation-helpers.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {Deprecated} from '../core/base-service/errors.js'; -import {enforceDeprecation} from './deprecation-helpers.js'; +import { expect } from 'chai' +import { Deprecated } from '../core/base-service/errors.js' +import { enforceDeprecation } from './deprecation-helpers.js' describe('enforceDeprecation', function () { it('throws Deprecated for a date in the past', function () { diff --git a/services/discord/discord.service.js b/services/discord/discord.service.js index bbff2c5ddfa9f..65837b9a35004 100644 --- a/services/discord/discord.service.js +++ b/services/discord/discord.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ presence_count: nonNegativeInteger, @@ -77,4 +77,4 @@ export default class Discord extends BaseJsonService { const data = await this.fetch({ serverId }) return this.constructor.render({ members: data.presence_count }) } -}; +} diff --git a/services/discord/discord.spec.js b/services/discord/discord.spec.js index 7abe355cc7eaa..4dbbeae36b858 100644 --- a/services/discord/discord.spec.js +++ b/services/discord/discord.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import Discord from './discord.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import Discord from './discord.service.js' describe('Discord', function () { cleanUpNockAfterEach() diff --git a/services/discord/discord.tester.js b/services/discord/discord.tester.js index 4f701fa2f7a2b..4e9ca9d6d627a 100644 --- a/services/discord/discord.tester.js +++ b/services/discord/discord.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets status for Reactiflux') diff --git a/services/discourse/discourse-redirect.service.js b/services/discourse/discourse-redirect.service.js index 083c485d4132b..f1285eba110b8 100644 --- a/services/discourse/discourse-redirect.service.js +++ b/services/discourse/discourse-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -13,4 +13,4 @@ export default [ }), dateAdded: new Date('2019-09-15'), }), -]; +] diff --git a/services/discourse/discourse-redirect.tester.js b/services/discourse/discourse-redirect.tester.js index 64cc98e888609..6dce032f5b321 100644 --- a/services/discourse/discourse-redirect.tester.js +++ b/services/discourse/discourse-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'DiscourseRedirect', diff --git a/services/discourse/discourse.service.js b/services/discourse/discourse.service.js index b43e5c0a8f9de..e6c1322c38300 100644 --- a/services/discourse/discourse.service.js +++ b/services/discourse/discourse.service.js @@ -1,8 +1,8 @@ -import camelcase from 'camelcase'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger, optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import camelcase from 'camelcase' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger, optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ topic_count: nonNegativeInteger, @@ -103,4 +103,4 @@ const metricIntegrations = [ { metricName: 'likes', property: 'like_count' }, ].map(DiscourseMetricIntegrationFactory) -export default [...metricIntegrations, DiscourseStatus]; +export default [...metricIntegrations, DiscourseStatus] diff --git a/services/discourse/discourse.tester.js b/services/discourse/discourse.tester.js index 281add0ad884f..dc779eb291a45 100644 --- a/services/discourse/discourse.tester.js +++ b/services/discourse/discourse.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'discourse', diff --git a/services/dockbit/dockbit.service.js b/services/dockbit/dockbit.service.js index 89eac1cd5d971..c9ecc64ddcc0e 100644 --- a/services/dockbit/dockbit.service.js +++ b/services/dockbit/dockbit.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'build', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'dockbit', dateAdded: new Date('2017-12-31'), -}); +}) diff --git a/services/dockbit/dockbit.tester.js b/services/dockbit/dockbit.tester.js index e6a1b307c1f6f..76029da3c424c 100644 --- a/services/dockbit/dockbit.tester.js +++ b/services/dockbit/dockbit.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'dockbit', diff --git a/services/docker/docker-automated.service.js b/services/docker/docker-automated.service.js index 5badd6c996f79..ba28af2990520 100644 --- a/services/docker/docker-automated.service.js +++ b/services/docker/docker-automated.service.js @@ -1,6 +1,10 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; -import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { + dockerBlue, + buildDockerUrl, + getDockerHubUser, +} from './docker-helpers.js' const automatedBuildSchema = Joi.object({ is_automated: Joi.boolean().required(), @@ -44,4 +48,4 @@ export default class DockerAutomatedBuild extends BaseJsonService { const data = await this.fetch({ user, repo }) return this.constructor.render({ isAutomated: data.is_automated }) } -}; +} diff --git a/services/docker/docker-automated.tester.js b/services/docker/docker-automated.tester.js index b85272b37be21..f52ae96d0db69 100644 --- a/services/docker/docker-automated.tester.js +++ b/services/docker/docker-automated.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {dockerBlue} from './docker-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { dockerBlue } from './docker-helpers.js' export const t = await createServiceTester() const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-build.service.js b/services/docker/docker-build.service.js index cbb8be1c7faf7..7c4d0985f35f5 100644 --- a/services/docker/docker-build.service.js +++ b/services/docker/docker-build.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'build', diff --git a/services/docker/docker-build.tester.js b/services/docker/docker-build.tester.js index 7a685c485b342..9d5876845948d 100644 --- a/services/docker/docker-build.tester.js +++ b/services/docker/docker-build.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'dockerbuild', diff --git a/services/docker/docker-cloud-automated.service.js b/services/docker/docker-cloud-automated.service.js index deafeb2cfeaa3..a4692a643583b 100644 --- a/services/docker/docker-cloud-automated.service.js +++ b/services/docker/docker-cloud-automated.service.js @@ -1,6 +1,6 @@ -import {BaseJsonService} from '../index.js'; -import {dockerBlue, buildDockerUrl} from './docker-helpers.js'; -import {fetchBuild} from './docker-cloud-common-fetch.js'; +import { BaseJsonService } from '../index.js' +import { dockerBlue, buildDockerUrl } from './docker-helpers.js' +import { fetchBuild } from './docker-cloud-common-fetch.js' export default class DockerCloudAutomatedBuild extends BaseJsonService { static category = 'build' @@ -32,4 +32,4 @@ export default class DockerCloudAutomatedBuild extends BaseJsonService { buildSettings: data.objects[0].build_settings, }) } -}; +} diff --git a/services/docker/docker-cloud-automated.tester.js b/services/docker/docker-cloud-automated.tester.js index da9fae0b0baae..936451900d448 100644 --- a/services/docker/docker-cloud-automated.tester.js +++ b/services/docker/docker-cloud-automated.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {dockerBlue} from './docker-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { dockerBlue } from './docker-helpers.js' export const t = await createServiceTester() const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual') diff --git a/services/docker/docker-cloud-build.service.js b/services/docker/docker-cloud-build.service.js index 6840cc5223333..8fd3aa8b45f3e 100644 --- a/services/docker/docker-cloud-build.service.js +++ b/services/docker/docker-cloud-build.service.js @@ -1,6 +1,6 @@ -import {BaseJsonService} from '../index.js'; -import {dockerBlue, buildDockerUrl} from './docker-helpers.js'; -import {fetchBuild} from './docker-cloud-common-fetch.js'; +import { BaseJsonService } from '../index.js' +import { dockerBlue, buildDockerUrl } from './docker-helpers.js' +import { fetchBuild } from './docker-cloud-common-fetch.js' export default class DockerCloudBuild extends BaseJsonService { static category = 'build' @@ -33,4 +33,4 @@ export default class DockerCloudBuild extends BaseJsonService { const data = await fetchBuild(this, { user, repo }) return this.constructor.render({ state: data.objects[0].state }) } -}; +} diff --git a/services/docker/docker-cloud-build.tester.js b/services/docker/docker-cloud-build.tester.js index e7147a9dbbc47..9335af250124d 100644 --- a/services/docker/docker-cloud-build.tester.js +++ b/services/docker/docker-cloud-build.tester.js @@ -1,6 +1,6 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' -import {dockerBlue} from './docker-helpers.js'; +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' +import { dockerBlue } from './docker-helpers.js' export const t = await createServiceTester() t.create('docker cloud build status (valid, user)') diff --git a/services/docker/docker-cloud-common-fetch.js b/services/docker/docker-cloud-common-fetch.js index 29ee356fd8ac6..51a5317348a6a 100644 --- a/services/docker/docker-cloud-common-fetch.js +++ b/services/docker/docker-cloud-common-fetch.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' const cloudBuildSchema = Joi.object({ objects: Joi.array() @@ -20,6 +20,4 @@ async function fetchBuild(serviceInstance, { user, repo }) { }) } -export { - fetchBuild, -}; +export { fetchBuild } diff --git a/services/docker/docker-fixtures.js b/services/docker/docker-fixtures.js index 3f79f5fac7b07..26218ca350c12 100644 --- a/services/docker/docker-fixtures.js +++ b/services/docker/docker-fixtures.js @@ -3040,4 +3040,4 @@ export { versionDataNoTagSemVerSort, versionDataWithTag, versionDataWithVaryingArchitectures, -}; +} diff --git a/services/docker/docker-helpers.js b/services/docker/docker-helpers.js index 59b56d97d4424..0b9b1d6879494 100644 --- a/services/docker/docker-helpers.js +++ b/services/docker/docker-helpers.js @@ -1,5 +1,6 @@ // see https://github.com/badges/shields/pull/1690 -import {NotFound} from '../index.js'; const dockerBlue = '066da5' +import { NotFound } from '../index.js' +const dockerBlue = '066da5' function buildDockerUrl(badgeName, includeTagRoute) { if (includeTagRoute) { @@ -59,4 +60,4 @@ export { getDockerHubUser, getMultiPageData, getDigestSemVerMatches, -}; +} diff --git a/services/docker/docker-pulls.service.js b/services/docker/docker-pulls.service.js index 12815e5425115..9d741f8f96158 100644 --- a/services/docker/docker-pulls.service.js +++ b/services/docker/docker-pulls.service.js @@ -1,8 +1,12 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; -import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' +import { + dockerBlue, + buildDockerUrl, + getDockerHubUser, +} from './docker-helpers.js' const pullsSchema = Joi.object({ pull_count: nonNegativeInteger, @@ -45,4 +49,4 @@ export default class DockerPulls extends BaseJsonService { const data = await this.fetch({ user, repo }) return this.constructor.render({ count: data.pull_count }) } -}; +} diff --git a/services/docker/docker-pulls.tester.js b/services/docker/docker-pulls.tester.js index 3d670073325fe..2482edea4acd7 100644 --- a/services/docker/docker-pulls.tester.js +++ b/services/docker/docker-pulls.tester.js @@ -1,6 +1,6 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' -import {dockerBlue} from './docker-helpers.js'; +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' +import { dockerBlue } from './docker-helpers.js' export const t = await createServiceTester() t.create('docker pulls (valid, library)') diff --git a/services/docker/docker-size.service.js b/services/docker/docker-size.service.js index 9907986fa0d24..16c7ea49467ce 100644 --- a/services/docker/docker-size.service.js +++ b/services/docker/docker-size.service.js @@ -1,9 +1,13 @@ -import Joi from 'joi'; -import prettyBytes from 'pretty-bytes'; -import {nonNegativeInteger} from '../validators.js'; -import {latest} from '../version.js'; -import {BaseJsonService, NotFound} from '../index.js'; -import {buildDockerUrl, getDockerHubUser, getMultiPageData} from './docker-helpers.js'; +import Joi from 'joi' +import prettyBytes from 'pretty-bytes' +import { nonNegativeInteger } from '../validators.js' +import { latest } from '../version.js' +import { BaseJsonService, NotFound } from '../index.js' +import { + buildDockerUrl, + getDockerHubUser, + getMultiPageData, +} from './docker-helpers.js' const buildSchema = Joi.object({ name: Joi.string().required(), @@ -110,4 +114,4 @@ export default class DockerSize extends BaseJsonService { const { size } = await this.transform({ tag, sort, data }) return this.constructor.render({ size }) } -}; +} diff --git a/services/docker/docker-size.spec.js b/services/docker/docker-size.spec.js index 44b881965eee0..946e0d161b668 100644 --- a/services/docker/docker-size.spec.js +++ b/services/docker/docker-size.spec.js @@ -1,6 +1,6 @@ -import {test, given} from 'sazerac'; -import DockerSize from './docker-size.service.js'; -import {sizeDataNoTagSemVerSort} from './docker-fixtures.js'; +import { test, given } from 'sazerac' +import DockerSize from './docker-size.service.js' +import { sizeDataNoTagSemVerSort } from './docker-fixtures.js' describe('DockerSize', function () { test(DockerSize.prototype.transform, () => { diff --git a/services/docker/docker-size.tester.js b/services/docker/docker-size.tester.js index 231781dc714ab..c476a773f32c8 100644 --- a/services/docker/docker-size.tester.js +++ b/services/docker/docker-size.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('docker image size (valid, library)') diff --git a/services/docker/docker-stars.service.js b/services/docker/docker-stars.service.js index 401cb2b3bf072..92cc8eb81e85b 100644 --- a/services/docker/docker-stars.service.js +++ b/services/docker/docker-stars.service.js @@ -1,7 +1,11 @@ -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseService} from '../index.js'; -import {dockerBlue, buildDockerUrl, getDockerHubUser} from './docker-helpers.js'; +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseService } from '../index.js' +import { + dockerBlue, + buildDockerUrl, + getDockerHubUser, +} from './docker-helpers.js' export default class DockerStars extends BaseService { static category = 'rating' @@ -41,4 +45,4 @@ export default class DockerStars extends BaseService { const stars = await this.fetch({ user, repo }) return this.constructor.render({ stars }) } -}; +} diff --git a/services/docker/docker-stars.tester.js b/services/docker/docker-stars.tester.js index 6390e71e4ca77..ebd715c3372e3 100644 --- a/services/docker/docker-stars.tester.js +++ b/services/docker/docker-stars.tester.js @@ -1,6 +1,6 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' -import {dockerBlue} from './docker-helpers.js'; +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' +import { dockerBlue } from './docker-helpers.js' export const t = await createServiceTester() t.create('docker stars (valid, library)') diff --git a/services/docker/docker-version.service.js b/services/docker/docker-version.service.js index 2f2b69b8f1e57..00bb00e985698 100644 --- a/services/docker/docker-version.service.js +++ b/services/docker/docker-version.service.js @@ -1,8 +1,13 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {latest, renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; -import {buildDockerUrl, getDockerHubUser, getMultiPageData, getDigestSemVerMatches} from './docker-helpers.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { latest, renderVersionBadge } from '../version.js' +import { BaseJsonService, NotFound, InvalidResponse } from '../index.js' +import { + buildDockerUrl, + getDockerHubUser, + getMultiPageData, + getDigestSemVerMatches, +} from './docker-helpers.js' const buildSchema = Joi.object({ count: nonNegativeInteger.required(), @@ -153,4 +158,4 @@ export default class DockerVersion extends BaseJsonService { }) return this.constructor.render({ version }) } -}; +} diff --git a/services/docker/docker-version.spec.js b/services/docker/docker-version.spec.js index a3e89da2ad2fd..bd1681c27b0da 100644 --- a/services/docker/docker-version.spec.js +++ b/services/docker/docker-version.spec.js @@ -1,8 +1,14 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {InvalidResponse} from '../index.js'; -import DockerVersion from './docker-version.service.js'; -import {versionDataNoTagDateSort, versionPagedDataNoTagDateSort, versionDataNoTagSemVerSort, versionDataWithTag, versionDataWithVaryingArchitectures} from './docker-fixtures.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { InvalidResponse } from '../index.js' +import DockerVersion from './docker-version.service.js' +import { + versionDataNoTagDateSort, + versionPagedDataNoTagDateSort, + versionDataNoTagSemVerSort, + versionDataWithTag, + versionDataWithVaryingArchitectures, +} from './docker-fixtures.js' describe('DockerVersion', function () { test(DockerVersion.prototype.transform, () => { diff --git a/services/docker/docker-version.tester.js b/services/docker/docker-version.tester.js index f31467b0d8753..097ccc0c5349b 100644 --- a/services/docker/docker-version.tester.js +++ b/services/docker/docker-version.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('docker version (valid, library)').get('/_/alpine.json').expectBadge({ diff --git a/services/docsrs/docsrs.service.js b/services/docsrs/docsrs.service.js index be8362e402b6c..ca88f67e49259 100644 --- a/services/docsrs/docsrs.service.js +++ b/services/docsrs/docsrs.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.array() .items( @@ -57,4 +57,4 @@ export default class DocsRs extends BaseJsonService { ).pop() return this.constructor.render({ version, buildStatus }) } -}; +} diff --git a/services/docsrs/docsrs.tester.js b/services/docsrs/docsrs.tester.js index 0fce39fdba917..0bd6157bdc6ff 100644 --- a/services/docsrs/docsrs.tester.js +++ b/services/docsrs/docsrs.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Passing docs') diff --git a/services/dotnetstatus/dotnetstatus.service.js b/services/dotnetstatus/dotnetstatus.service.js index 87a5f3c12f9f7..7e243fd9c07ab 100644 --- a/services/dotnetstatus/dotnetstatus.service.js +++ b/services/dotnetstatus/dotnetstatus.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'dependencies', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'dotnet status', dateAdded: new Date('2018-04-01'), -}); +}) diff --git a/services/dotnetstatus/dotnetstatus.tester.js b/services/dotnetstatus/dotnetstatus.tester.js index a290f8cc10012..f15285b3bb461 100644 --- a/services/dotnetstatus/dotnetstatus.tester.js +++ b/services/dotnetstatus/dotnetstatus.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'dotnetstatus', diff --git a/services/drone/drone-build.service.js b/services/drone/drone-build.service.js index 678f71aa8e58d..5b5986efb6dc3 100644 --- a/services/drone/drone-build.service.js +++ b/services/drone/drone-build.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ status: Joi.alternatives() @@ -82,4 +82,4 @@ export default class DroneBuild extends BaseJsonService { ) return renderBuildStatusBadge({ status: json.status }) } -}; +} diff --git a/services/drone/drone-build.spec.js b/services/drone/drone-build.spec.js index d5d59c8890579..0cb15273618a2 100644 --- a/services/drone/drone-build.spec.js +++ b/services/drone/drone-build.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import DroneBuild from './drone-build.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import DroneBuild from './drone-build.service.js' describe('DroneBuild', function () { cleanUpNockAfterEach() diff --git a/services/drone/drone-build.tester.js b/services/drone/drone-build.tester.js index f8ce864215471..abd50e8feeb97 100644 --- a/services/drone/drone-build.tester.js +++ b/services/drone/drone-build.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isDroneBuildStatus = Joi.alternatives().try( diff --git a/services/dub/dub-download.service.js b/services/dub/dub-download.service.js index b6da730864b2d..e82bf59d6eae6 100644 --- a/services/dub/dub-download.service.js +++ b/services/dub/dub-download.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ downloads: Joi.object({ @@ -101,4 +101,4 @@ export default class DubDownloads extends BaseJsonService { const downloadCount = transform(json) return this.constructor.render({ interval, downloadCount, version }) } -}; +} diff --git a/services/dub/dub-download.tester.js b/services/dub/dub-download.tester.js index f7f13b2a54582..4733e5343a2b9 100644 --- a/services/dub/dub-download.tester.js +++ b/services/dub/dub-download.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isDownloadsColor = Joi.equal( diff --git a/services/dub/dub-license.service.js b/services/dub/dub-license.service.js index 47e34c1e845f2..52608f43d3e26 100644 --- a/services/dub/dub-license.service.js +++ b/services/dub/dub-license.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderLicenseBadge} from '../licenses.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderLicenseBadge } from '../licenses.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ info: Joi.object({ license: Joi.string().required() }).required(), @@ -30,4 +30,4 @@ export default class DubLicense extends BaseJsonService { const data = await this.fetch({ packageName }) return renderLicenseBadge({ licenses: [data.info.license] }) } -}; +} diff --git a/services/dub/dub-license.tester.js b/services/dub/dub-license.tester.js index 77f7578f37d1e..0da04e2a2411f 100644 --- a/services/dub/dub-license.tester.js +++ b/services/dub/dub-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('license (valid)') diff --git a/services/dub/dub-version.service.js b/services/dub/dub-version.service.js index 2c1d80eb62b50..19c2c1626f0dc 100644 --- a/services/dub/dub-version.service.js +++ b/services/dub/dub-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.string().required() @@ -28,4 +28,4 @@ export default class DubVersion extends BaseJsonService { const version = await this.fetch({ packageName }) return renderVersionBadge({ version }) } -}; +} diff --git a/services/dub/dub-version.tester.js b/services/dub/dub-version.tester.js index 7032d5acc1624..88015d7660e5a 100644 --- a/services/dub/dub-version.tester.js +++ b/services/dub/dub-version.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isVPlusDottedVersionNClausesWithOptionalSuffix } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version (valid)') diff --git a/services/dynamic-common.js b/services/dynamic-common.js index d8e97163614fc..7cacafa411233 100644 --- a/services/dynamic-common.js +++ b/services/dynamic-common.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import toArray from '../core/base-service/to-array.js'; -import validate from '../core/base-service/validate.js'; -import {InvalidResponse} from './index.js'; +import Joi from 'joi' +import toArray from '../core/base-service/to-array.js' +import validate from '../core/base-service/validate.js' +import { InvalidResponse } from './index.js' const errorMessages = { 404: 'resource not found', @@ -51,4 +51,4 @@ export { individualValueSchema, transformAndValidate, renderDynamicBadge, -}; +} diff --git a/services/dynamic/dynamic-helpers.js b/services/dynamic/dynamic-helpers.js index 8dd5b134cacf6..cb3b6c6ebe3d8 100644 --- a/services/dynamic/dynamic-helpers.js +++ b/services/dynamic/dynamic-helpers.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' const queryParamSchema = Joi.object({ url: optionalUrl.required(), @@ -18,6 +18,4 @@ function createRoute(which) { } } -export { - createRoute, -}; +export { createRoute } diff --git a/services/dynamic/dynamic-json.service.js b/services/dynamic/dynamic-json.service.js index 631b7cb1821f0..5e01de94d1cde 100644 --- a/services/dynamic/dynamic-json.service.js +++ b/services/dynamic/dynamic-json.service.js @@ -1,7 +1,7 @@ -import {MetricNames} from '../../core/base-service/metric-helper.js'; -import {BaseJsonService} from '../index.js'; -import {createRoute} from './dynamic-helpers.js'; -import jsonPath from './json-path.js'; +import { MetricNames } from '../../core/base-service/metric-helper.js' +import { BaseJsonService } from '../index.js' +import { createRoute } from './dynamic-helpers.js' +import jsonPath from './json-path.js' export default class DynamicJson extends jsonPath(BaseJsonService) { static enabledMetrics = [MetricNames.SERVICE_RESPONSE_SIZE] @@ -14,4 +14,4 @@ export default class DynamicJson extends jsonPath(BaseJsonService) { errorMessages, }) } -}; +} diff --git a/services/dynamic/dynamic-json.tester.js b/services/dynamic/dynamic-json.tester.js index 93a4a9e94a67c..38bb48ee74794 100644 --- a/services/dynamic/dynamic-json.tester.js +++ b/services/dynamic/dynamic-json.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {expect} from 'chai'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { expect } from 'chai' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('No URL specified') diff --git a/services/dynamic/dynamic-xml.service.js b/services/dynamic/dynamic-xml.service.js index 1990e0d594b44..2278f7260a305 100644 --- a/services/dynamic/dynamic-xml.service.js +++ b/services/dynamic/dynamic-xml.service.js @@ -1,9 +1,9 @@ -import {DOMParser} from 'xmldom'; -import xpath from 'xpath'; -import {MetricNames} from '../../core/base-service/metric-helper.js'; -import {renderDynamicBadge, errorMessages} from '../dynamic-common.js'; -import {BaseService, InvalidResponse, InvalidParameter} from '../index.js'; -import {createRoute} from './dynamic-helpers.js'; +import { DOMParser } from 'xmldom' +import xpath from 'xpath' +import { MetricNames } from '../../core/base-service/metric-helper.js' +import { renderDynamicBadge, errorMessages } from '../dynamic-common.js' +import { BaseService, InvalidResponse, InvalidParameter } from '../index.js' +import { createRoute } from './dynamic-helpers.js' // This service extends BaseService because it uses a different XML parser // than BaseXmlService which can be used with xpath. @@ -76,4 +76,4 @@ export default class DynamicXml extends BaseService { return renderDynamicBadge({ value, prefix, suffix }) } -}; +} diff --git a/services/dynamic/dynamic-xml.spec.js b/services/dynamic/dynamic-xml.spec.js index 67d76e6993f9c..ca233d2c0abeb 100644 --- a/services/dynamic/dynamic-xml.spec.js +++ b/services/dynamic/dynamic-xml.spec.js @@ -1,9 +1,9 @@ -import {expect} from 'chai'; -import sinon from 'sinon'; -import xpath from 'xpath'; -import {test, given} from 'sazerac'; -import {InvalidResponse} from '../index.js'; -import DynamicXml from './dynamic-xml.service.js'; +import { expect } from 'chai' +import sinon from 'sinon' +import xpath from 'xpath' +import { test, given } from 'sazerac' +import { InvalidResponse } from '../index.js' +import DynamicXml from './dynamic-xml.service.js' const exampleXml = ` diff --git a/services/dynamic/dynamic-xml.tester.js b/services/dynamic/dynamic-xml.tester.js index 3e774d4697b19..a35d303c3ec41 100644 --- a/services/dynamic/dynamic-xml.tester.js +++ b/services/dynamic/dynamic-xml.tester.js @@ -1,6 +1,6 @@ -import queryString from 'query-string'; -import {createServiceTester} from '../tester.js' -import {exampleXml} from './dynamic-response-fixtures.js'; +import queryString from 'query-string' +import { createServiceTester } from '../tester.js' +import { exampleXml } from './dynamic-response-fixtures.js' export const t = await createServiceTester() const exampleUrl = 'https://example.test/example.xml' diff --git a/services/dynamic/dynamic-yaml.service.js b/services/dynamic/dynamic-yaml.service.js index 493064f5d5ab7..1c606f90334ea 100644 --- a/services/dynamic/dynamic-yaml.service.js +++ b/services/dynamic/dynamic-yaml.service.js @@ -1,7 +1,7 @@ -import {MetricNames} from '../../core/base-service/metric-helper.js'; -import {BaseYamlService} from '../index.js'; -import {createRoute} from './dynamic-helpers.js'; -import jsonPath from './json-path.js'; +import { MetricNames } from '../../core/base-service/metric-helper.js' +import { BaseYamlService } from '../index.js' +import { createRoute } from './dynamic-helpers.js' +import jsonPath from './json-path.js' export default class DynamicYaml extends jsonPath(BaseYamlService) { static enabledMetrics = [MetricNames.SERVICE_RESPONSE_SIZE] @@ -14,4 +14,4 @@ export default class DynamicYaml extends jsonPath(BaseYamlService) { errorMessages, }) } -}; +} diff --git a/services/dynamic/dynamic-yaml.tester.js b/services/dynamic/dynamic-yaml.tester.js index 24299a9273a60..e3d5cce1fcae3 100644 --- a/services/dynamic/dynamic-yaml.tester.js +++ b/services/dynamic/dynamic-yaml.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('No URL specified') diff --git a/services/dynamic/json-path.js b/services/dynamic/json-path.js index 6c0c5dd541b99..ed242c944aaf4 100644 --- a/services/dynamic/json-path.js +++ b/services/dynamic/json-path.js @@ -2,10 +2,10 @@ * @module */ -import Joi from 'joi'; -import jp from 'jsonpath'; -import {renderDynamicBadge, errorMessages} from '../dynamic-common.js'; -import {InvalidParameter, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import jp from 'jsonpath' +import { renderDynamicBadge, errorMessages } from '../dynamic-common.js' +import { InvalidParameter, InvalidResponse } from '../index.js' /** * Dynamic service class factory which wraps {@link module:core/base-service/base~BaseService} with support of {@link https://jsonpath.com/|JSONPath}. @@ -14,7 +14,7 @@ import {InvalidParameter, InvalidResponse} from '../index.js'; * @returns {Function} wrapped class */ export default superclass => - (class extends superclass { + class extends superclass { static category = 'dynamic' static defaultBadgeData = { label: 'custom badge' } @@ -75,4 +75,4 @@ export default superclass => return renderDynamicBadge({ value: values, prefix, suffix }) } - }); + } diff --git a/services/dynamic/json-path.spec.js b/services/dynamic/json-path.spec.js index 825ccaa20d29d..7e309dba653f6 100644 --- a/services/dynamic/json-path.spec.js +++ b/services/dynamic/json-path.spec.js @@ -1,6 +1,6 @@ -import chai from 'chai'; +import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import jsonPath from './json-path.js'; +import jsonPath from './json-path.js' const { expect } = chai chai.use(chaiAsPromised) diff --git a/services/eclipse-marketplace/eclipse-marketplace-base.js b/services/eclipse-marketplace/eclipse-marketplace-base.js index 2ed8615434620..a4276731b9582 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-base.js +++ b/services/eclipse-marketplace/eclipse-marketplace-base.js @@ -1,4 +1,4 @@ -import {BaseXmlService} from '../index.js'; +import { BaseXmlService } from '../index.js' export default class EclipseMarketplaceBase extends BaseXmlService { static buildRoute(base) { @@ -15,4 +15,4 @@ export default class EclipseMarketplaceBase extends BaseXmlService { errorMessages: { 404: 'solution not found' }, }) } -}; +} diff --git a/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js b/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js index 54ddc0f511df8..c7cbaf118379c 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import EclipseMarketplaceBase from './eclipse-marketplace-base.js' const monthlyResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -70,4 +70,4 @@ function DownloadsForInterval(interval) { } } -export default ['month', 'total'].map(DownloadsForInterval); +export default ['month', 'total'].map(DownloadsForInterval) diff --git a/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js b/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js index 7ebcf5da9799d..a73862ee73271 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-downloads.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' export const t = new ServiceTester({ id: 'EclipseMarketplaceDownloads', diff --git a/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js b/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js index 87311a13dbe47..1f004bad2262f 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-favorites.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import EclipseMarketplaceBase from './eclipse-marketplace-base.js' const favoritesResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -10,9 +10,7 @@ const favoritesResponseSchema = Joi.object({ }), }).required() -export default class EclipseMarketplaceFavorites extends ( - EclipseMarketplaceBase -) { +export default class EclipseMarketplaceFavorites extends EclipseMarketplaceBase { static category = 'other' static route = this.buildRoute('eclipse-marketplace/favorites') static examples = [ @@ -40,4 +38,4 @@ export default class EclipseMarketplaceFavorites extends ( const favorited = marketplace.node.favorited return this.constructor.render({ favorited }) } -}; +} diff --git a/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js b/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js index bc96d9387fbdf..74ceb06d6ab78 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-favorites.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('favorites count').get('/notepad4e.json').expectBadge({ diff --git a/services/eclipse-marketplace/eclipse-marketplace-license.service.js b/services/eclipse-marketplace/eclipse-marketplace-license.service.js index 6d061d1051606..b25b0ac223c18 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-license.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-license.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; +import Joi from 'joi' +import EclipseMarketplaceBase from './eclipse-marketplace-base.js' const licenseResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -9,9 +9,7 @@ const licenseResponseSchema = Joi.object({ }), }).required() -export default class EclipseMarketplaceLicense extends ( - EclipseMarketplaceBase -) { +export default class EclipseMarketplaceLicense extends EclipseMarketplaceBase { static category = 'license' static route = this.buildRoute('eclipse-marketplace/l') static examples = [ @@ -44,4 +42,4 @@ export default class EclipseMarketplaceLicense extends ( const license = marketplace.node.license return this.constructor.render({ license }) } -}; +} diff --git a/services/eclipse-marketplace/eclipse-marketplace-license.tester.js b/services/eclipse-marketplace/eclipse-marketplace-license.tester.js index 0fe3c29f5f337..471651696b295 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-license.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('license').get('/notepad4e.json').expectBadge({ diff --git a/services/eclipse-marketplace/eclipse-marketplace-update.service.js b/services/eclipse-marketplace/eclipse-marketplace-update.service.js index a605852009713..a13b7d0d03ddc 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-update.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-update.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {formatDate} from '../text-formatters.js'; -import {age as ageColor} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; +import Joi from 'joi' +import { formatDate } from '../text-formatters.js' +import { age as ageColor } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import EclipseMarketplaceBase from './eclipse-marketplace-base.js' const updateResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -40,4 +40,4 @@ export default class EclipseMarketplaceUpdate extends EclipseMarketplaceBase { const date = 1000 * parseInt(marketplace.node.changed) return this.constructor.render({ date }) } -}; +} diff --git a/services/eclipse-marketplace/eclipse-marketplace-update.tester.js b/services/eclipse-marketplace/eclipse-marketplace-update.tester.js index 7001997f2ebfe..fd0d6e756bd51 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-update.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-update.tester.js @@ -1,5 +1,5 @@ -import {isFormattedDate} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFormattedDate } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('last update date').get('/notepad4e.json').expectBadge({ diff --git a/services/eclipse-marketplace/eclipse-marketplace-version.service.js b/services/eclipse-marketplace/eclipse-marketplace-version.service.js index 846e1757425ed..0e367fa12595d 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-version.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import EclipseMarketplaceBase from './eclipse-marketplace-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import EclipseMarketplaceBase from './eclipse-marketplace-base.js' const versionResponseSchema = Joi.object({ marketplace: Joi.object({ @@ -10,9 +10,7 @@ const versionResponseSchema = Joi.object({ }), }).required() -export default class EclipseMarketplaceVersion extends ( - EclipseMarketplaceBase -) { +export default class EclipseMarketplaceVersion extends EclipseMarketplaceBase { static category = 'version' static route = this.buildRoute('eclipse-marketplace/v') static examples = [ @@ -37,4 +35,4 @@ export default class EclipseMarketplaceVersion extends ( const version = marketplace.node.version return this.constructor.render({ version }) } -}; +} diff --git a/services/eclipse-marketplace/eclipse-marketplace-version.tester.js b/services/eclipse-marketplace/eclipse-marketplace-version.tester.js index 20f171e420dfe..c47a95c8eea68 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-version.tester.js +++ b/services/eclipse-marketplace/eclipse-marketplace-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('marketplace version').get('/notepad4e.json').expectBadge({ diff --git a/services/ecologi/ecologi-carbon.service.js b/services/ecologi/ecologi-carbon.service.js index 103ebf5bcf7e3..4aac425d1e608 100644 --- a/services/ecologi/ecologi-carbon.service.js +++ b/services/ecologi/ecologi-carbon.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const apiSchema = Joi.object({ total: Joi.number().positive().required(), @@ -41,4 +41,4 @@ export default class EcologiCarbonOffset extends BaseJsonService { return this.constructor.render({ count: total }) } -}; +} diff --git a/services/ecologi/ecologi-carbon.tester.js b/services/ecologi/ecologi-carbon.tester.js index 893cc8aaa69b9..17394e5e293b7 100644 --- a/services/ecologi/ecologi-carbon.tester.js +++ b/services/ecologi/ecologi-carbon.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {withRegex} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { withRegex } from '../test-validators.js' export const t = await createServiceTester() t.create('request for existing username') diff --git a/services/ecologi/ecologi-trees.service.js b/services/ecologi/ecologi-trees.service.js index b0aff6d38d781..46d41b2f00f19 100644 --- a/services/ecologi/ecologi-trees.service.js +++ b/services/ecologi/ecologi-trees.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const apiSchema = Joi.object({ total: nonNegativeInteger, @@ -41,4 +41,4 @@ export default class EcologiTrees extends BaseJsonService { return this.constructor.render({ count: total }) } -}; +} diff --git a/services/ecologi/ecologi-trees.tester.js b/services/ecologi/ecologi-trees.tester.js index 44a4d42e02376..01d776263a396 100644 --- a/services/ecologi/ecologi-trees.tester.js +++ b/services/ecologi/ecologi-trees.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() t.create('request for existing username').get('/ecologi.json').expectBadge({ diff --git a/services/elm-package/elm-package.service.js b/services/elm-package/elm-package.service.js index f2d3a32115942..dd606d090c0ff 100644 --- a/services/elm-package/elm-package.service.js +++ b/services/elm-package/elm-package.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {semver} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { semver } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: semver }).required() @@ -33,4 +33,4 @@ export default class ElmPackage extends BaseJsonService { }) return this.constructor.render({ version }) } -}; +} diff --git a/services/elm-package/elm-package.tester.js b/services/elm-package/elm-package.tester.js index afe06737a25ee..b1c07737a607c 100644 --- a/services/elm-package/elm-package.tester.js +++ b/services/elm-package/elm-package.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the package version of elm/core') diff --git a/services/endpoint-common.js b/services/endpoint-common.js index f193e9e146d1e..1f3cf8d00cff6 100644 --- a/services/endpoint-common.js +++ b/services/endpoint-common.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import validate from '../core/base-service/validate.js'; -import {InvalidResponse} from './index.js'; +import Joi from 'joi' +import validate from '../core/base-service/validate.js' +import { InvalidResponse } from './index.js' const optionalStringWhenNamedLogoPresent = Joi.alternatives().conditional( 'namedLogo', @@ -72,7 +72,4 @@ async function fetchEndpointData( }) } -export { - validateEndpointData, - fetchEndpointData, -}; +export { validateEndpointData, fetchEndpointData } diff --git a/services/endpoint/endpoint-redirect.service.js b/services/endpoint/endpoint-redirect.service.js index 31790ebdd5897..c8db8c7de1f32 100644 --- a/services/endpoint/endpoint-redirect.service.js +++ b/services/endpoint/endpoint-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default redirector({ category: 'other', @@ -8,4 +8,4 @@ export default redirector({ }, transformPath: () => '/endpoint', dateAdded: new Date('2019-02-19'), -}); +}) diff --git a/services/endpoint/endpoint-redirect.tester.js b/services/endpoint/endpoint-redirect.tester.js index ed332eabacc11..e0c6de4a5865e 100644 --- a/services/endpoint/endpoint-redirect.tester.js +++ b/services/endpoint/endpoint-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'EndpointRedirect', diff --git a/services/endpoint/endpoint.service.js b/services/endpoint/endpoint.service.js index 46d22cdf388f4..8a64ccc74ca88 100644 --- a/services/endpoint/endpoint.service.js +++ b/services/endpoint/endpoint.service.js @@ -1,9 +1,9 @@ -import {URL} from 'url'; -import Joi from 'joi'; -import {errorMessages} from '../dynamic-common.js'; -import {optionalUrl} from '../validators.js'; -import {fetchEndpointData} from '../endpoint-common.js'; -import {BaseJsonService, InvalidParameter} from '../index.js'; +import { URL } from 'url' +import Joi from 'joi' +import { errorMessages } from '../dynamic-common.js' +import { optionalUrl } from '../validators.js' +import { fetchEndpointData } from '../endpoint-common.js' +import { BaseJsonService, InvalidParameter } from '../index.js' const blockedDomains = ['github.com', 'shields.io'] @@ -77,4 +77,4 @@ export default class Endpoint extends BaseJsonService { return this.constructor.render(validated) } -}; +} diff --git a/services/endpoint/endpoint.tester.js b/services/endpoint/endpoint.tester.js index d20280b8d377d..3be249e02cea0 100644 --- a/services/endpoint/endpoint.tester.js +++ b/services/endpoint/endpoint.tester.js @@ -1,7 +1,7 @@ -import zlib from 'zlib'; -import {expect} from 'chai'; -import {getShieldsIcon} from '../../lib/logos.js'; -import {createServiceTester} from '../tester.js' +import zlib from 'zlib' +import { expect } from 'chai' +import { getShieldsIcon } from '../../lib/logos.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Valid schema') diff --git a/services/f-droid/f-droid.service.js b/services/f-droid/f-droid.service.js index e3fb53c50e9cc..3ce765eb202c2 100644 --- a/services/f-droid/f-droid.service.js +++ b/services/f-droid/f-droid.service.js @@ -1,8 +1,11 @@ -import Joi from 'joi'; -import {optionalNonNegativeInteger, nonNegativeInteger} from '../validators.js'; -import {addv} from '../text-formatters.js'; -import {version as versionColor} from '../color-formatters.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { + optionalNonNegativeInteger, + nonNegativeInteger, +} from '../validators.js' +import { addv } from '../text-formatters.js' +import { version as versionColor } from '../color-formatters.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object({ packageName: Joi.string().required(), @@ -77,4 +80,4 @@ export default class FDroid extends BaseJsonService { const { version } = this.transform({ json, suggested }) return this.constructor.render({ version }) } -}; +} diff --git a/services/f-droid/f-droid.tester.js b/services/f-droid/f-droid.tester.js index e7897b682b4d2..ea63f06ee635d 100644 --- a/services/f-droid/f-droid.tester.js +++ b/services/f-droid/f-droid.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' export const t = new ServiceTester({ id: 'f-droid', diff --git a/services/fedora/fedora.service.js b/services/fedora/fedora.service.js index 0a5cb92f4f9fe..d869bcd6efef1 100644 --- a/services/fedora/fedora.service.js +++ b/services/fedora/fedora.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: Joi.string().required(), @@ -36,4 +36,4 @@ export default class Fedora extends BaseJsonService { }) return renderVersionBadge({ version: data.version }) } -}; +} diff --git a/services/fedora/fedora.tester.js b/services/fedora/fedora.tester.js index 5dfa3d7b0844f..51f0d38c5165b 100644 --- a/services/fedora/fedora.tester.js +++ b/services/fedora/fedora.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClausesWithOptionalSuffixAndEpoch } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Fedora package (default branch, valid)') diff --git a/services/feedz/feedz.service.js b/services/feedz/feedz.service.js index 9c6cd825485cf..54d237de38116 100644 --- a/services/feedz/feedz.service.js +++ b/services/feedz/feedz.service.js @@ -1,6 +1,11 @@ -import Joi from 'joi'; -import {BaseJsonService, NotFound} from '../index.js'; -import {renderVersionBadge, searchServiceUrl, stripBuildMetadata, selectVersion} from '../nuget/nuget-helpers.js'; +import Joi from 'joi' +import { BaseJsonService, NotFound } from '../index.js' +import { + renderVersionBadge, + searchServiceUrl, + stripBuildMetadata, + selectVersion, +} from '../nuget/nuget-helpers.js' const schema = Joi.object({ items: Joi.array() @@ -98,6 +103,4 @@ class FeedzVersionService extends BaseJsonService { } } -export { - FeedzVersionService, -}; +export { FeedzVersionService } diff --git a/services/feedz/feedz.service.spec.js b/services/feedz/feedz.service.spec.js index d3baf56910a21..c6f1444c39f8c 100644 --- a/services/feedz/feedz.service.spec.js +++ b/services/feedz/feedz.service.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {FeedzVersionService} from './feedz.service.js'; +import { test, given } from 'sazerac' +import { FeedzVersionService } from './feedz.service.js' function json(versions) { return { diff --git a/services/feedz/feedz.tester.js b/services/feedz/feedz.tester.js index ddad129d3cce8..99133e1025352 100644 --- a/services/feedz/feedz.tester.js +++ b/services/feedz/feedz.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'feedz', diff --git a/services/flathub/flathub.service.js b/services/flathub/flathub.service.js index c83b61c866b28..1b46191ebb9f8 100644 --- a/services/flathub/flathub.service.js +++ b/services/flathub/flathub.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ currentReleaseVersion: Joi.string().required(), @@ -28,4 +28,4 @@ export default class Flathub extends BaseJsonService { }) return renderVersionBadge({ version: data.currentReleaseVersion }) } -}; +} diff --git a/services/flathub/flathub.tester.js b/services/flathub/flathub.tester.js index 9da5c2ac2bbb0..727497013dea6 100644 --- a/services/flathub/flathub.tester.js +++ b/services/flathub/flathub.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClauses} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClauses } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Flathub (valid)').get('/org.mozilla.firefox.json').expectBadge({ diff --git a/services/gem/gem-downloads.service.js b/services/gem/gem-downloads.service.js index d9c47df78fce0..fc72bb3519d6b 100644 --- a/services/gem/gem-downloads.service.js +++ b/services/gem/gem-downloads.service.js @@ -1,10 +1,10 @@ -import semver from 'semver'; -import Joi from 'joi'; -import {downloadCount} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {latest as latestVersion} from '../version.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, InvalidParameter, InvalidResponse} from '../index.js'; +import semver from 'semver' +import Joi from 'joi' +import { downloadCount } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { latest as latestVersion } from '../version.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, InvalidParameter, InvalidResponse } from '../index.js' const keywords = ['ruby'] @@ -156,4 +156,4 @@ export default class GemDownloads extends BaseJsonService { } return this.constructor.render({ variant, version, downloads }) } -}; +} diff --git a/services/gem/gem-downloads.tester.js b/services/gem/gem-downloads.tester.js index dc7439f72f62a..cd709bb4bfe1c 100644 --- a/services/gem/gem-downloads.tester.js +++ b/services/gem/gem-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('total downloads (valid)').get('/dt/rails.json').expectBadge({ diff --git a/services/gem/gem-owner.service.js b/services/gem/gem-owner.service.js index 2ff80c6e2ed19..5ed9d0df7dd40 100644 --- a/services/gem/gem-owner.service.js +++ b/services/gem/gem-owner.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const ownerSchema = Joi.array().required() @@ -37,4 +37,4 @@ export default class GemOwner extends BaseJsonService { const json = await this.fetch({ user }) return this.constructor.render({ count: json.length }) } -}; +} diff --git a/services/gem/gem-owner.tester.js b/services/gem/gem-owner.tester.js index d7a3f4da213fe..9156752cb3553 100644 --- a/services/gem/gem-owner.tester.js +++ b/services/gem/gem-owner.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('users (valid)') diff --git a/services/gem/gem-rank.service.js b/services/gem/gem-rank.service.js index 51c76e2121bfd..de46d4933649d 100644 --- a/services/gem/gem-rank.service.js +++ b/services/gem/gem-rank.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {floorCount} from '../color-formatters.js'; -import {ordinalNumber} from '../text-formatters.js'; -import {BaseJsonService, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { floorCount } from '../color-formatters.js' +import { ordinalNumber } from '../text-formatters.js' +import { BaseJsonService, InvalidResponse } from '../index.js' const keywords = ['ruby'] @@ -82,4 +82,4 @@ export default class GemRank extends BaseJsonService { } return this.constructor.render({ period, rank }) } -}; +} diff --git a/services/gem/gem-rank.tester.js b/services/gem/gem-rank.tester.js index 3d6afcf84fdd4..73626c7b9c926 100644 --- a/services/gem/gem-rank.tester.js +++ b/services/gem/gem-rank.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isOrdinalNumber = Joi.string().regex(/^[1-9][0-9]+(ᵗʰ|ˢᵗ|ⁿᵈ|ʳᵈ)$/) diff --git a/services/gem/gem-version.service.js b/services/gem/gem-version.service.js index 9dea28e1922d8..d122c625c6a46 100644 --- a/services/gem/gem-version.service.js +++ b/services/gem/gem-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge, latest} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge, latest } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ // In most cases `version` will be a SemVer but the registry doesn't @@ -72,4 +72,4 @@ export default class GemVersion extends BaseJsonService { return this.constructor.render({ version }) } } -}; +} diff --git a/services/gem/gem-version.tester.js b/services/gem/gem-version.tester.js index 609d07c076d70..0043e2ff9be92 100644 --- a/services/gem/gem-version.tester.js +++ b/services/gem/gem-version.tester.js @@ -1,5 +1,8 @@ -import {isVPlusDottedVersionAtLeastOne, withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { + isVPlusDottedVersionAtLeastOne, + withRegex, +} from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version (valid)').get('/formatador.json').expectBadge({ diff --git a/services/gemnasium/gemnasium.service.js b/services/gemnasium/gemnasium.service.js index d533d55a32408..ddcaeba5fedb0 100644 --- a/services/gemnasium/gemnasium.service.js +++ b/services/gemnasium/gemnasium.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'dependencies', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'gemnasium', dateAdded: new Date('2018-05-15'), -}); +}) diff --git a/services/gemnasium/gemnasium.tester.js b/services/gemnasium/gemnasium.tester.js index d2cf75d06ef37..9e5431424fcf8 100644 --- a/services/gemnasium/gemnasium.tester.js +++ b/services/gemnasium/gemnasium.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'gemnasium', diff --git a/services/gerrit/gerrit.service.js b/services/gerrit/gerrit.service.js index 74ffeb8687171..04ebca37578d2 100644 --- a/services/gerrit/gerrit.service.js +++ b/services/gerrit/gerrit.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' const queryParamSchema = Joi.object({ baseUrl: optionalUrl.required(), @@ -77,4 +77,4 @@ export default class Gerrit extends BaseJsonService { status: data.status, }) } -}; +} diff --git a/services/gerrit/gerrit.tester.js b/services/gerrit/gerrit.tester.js index ed79cb9643129..2b80baf7cc5de 100644 --- a/services/gerrit/gerrit.tester.js +++ b/services/gerrit/gerrit.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Change open since December 2010, hopefully won't get merged or abandoned anytime soon. diff --git a/services/github/auth/acceptor.js b/services/github/auth/acceptor.js index 5ac3f771ac6e4..80347be581ca2 100644 --- a/services/github/auth/acceptor.js +++ b/services/github/auth/acceptor.js @@ -1,7 +1,7 @@ -import queryString from 'query-string'; -import request from 'request'; -import {userAgent} from '../../../core/base-service/legacy-request-handler.js'; -import log from '../../../core/server/log.js'; +import queryString from 'query-string' +import request from 'request' +import { userAgent } from '../../../core/base-service/legacy-request-handler.js' +import log from '../../../core/server/log.js' function setRoutes({ server, authHelper, onTokenAccepted }) { const baseUrl = process.env.GATSBY_BASE_URL || 'https://img.shields.io' @@ -81,4 +81,4 @@ function setRoutes({ server, authHelper, onTokenAccepted }) { }) } -export { setRoutes }; +export { setRoutes } diff --git a/services/github/auth/acceptor.spec.js b/services/github/auth/acceptor.spec.js index 429ba49852923..2d6cab6e24d83 100644 --- a/services/github/auth/acceptor.spec.js +++ b/services/github/auth/acceptor.spec.js @@ -1,13 +1,13 @@ -import {expect} from 'chai'; -import Camp from '@shields_io/camp'; -import FormData from 'form-data'; -import sinon from 'sinon'; -import portfinder from 'portfinder'; -import queryString from 'query-string'; -import nock from 'nock'; -import got from '../../../core/got-test-client.js'; -import GithubConstellation from '../github-constellation.js'; -import {setRoutes} from './acceptor.js'; +import { expect } from 'chai' +import Camp from '@shields_io/camp' +import FormData from 'form-data' +import sinon from 'sinon' +import portfinder from 'portfinder' +import queryString from 'query-string' +import nock from 'nock' +import got from '../../../core/got-test-client.js' +import GithubConstellation from '../github-constellation.js' +import { setRoutes } from './acceptor.js' const fakeClientId = 'githubdabomb' diff --git a/services/github/auth/admin.js b/services/github/auth/admin.js index db09ecd2b003a..9ffea4d056415 100644 --- a/services/github/auth/admin.js +++ b/services/github/auth/admin.js @@ -1,4 +1,4 @@ -import {makeSecretIsValid} from '../../../core/server/secret-is-valid.js'; +import { makeSecretIsValid } from '../../../core/server/secret-is-valid.js' function setRoutes({ shieldsSecret }, { apiProvider, server }) { const secretIsValid = makeSecretIsValid(shieldsSecret) @@ -29,4 +29,4 @@ function setRoutes({ shieldsSecret }, { apiProvider, server }) { }) } -export { setRoutes }; +export { setRoutes } diff --git a/services/github/auth/admin.spec.js b/services/github/auth/admin.spec.js index 3de0eb737d5be..fb751498e0270 100644 --- a/services/github/auth/admin.spec.js +++ b/services/github/auth/admin.spec.js @@ -1,9 +1,9 @@ -import {expect} from 'chai'; -import Camp from '@shields_io/camp'; -import portfinder from 'portfinder'; -import got from '../../../core/got-test-client.js'; -import GithubApiProvider from '../github-api-provider.js'; -import {setRoutes} from './admin.js'; +import { expect } from 'chai' +import Camp from '@shields_io/camp' +import portfinder from 'portfinder' +import got from '../../../core/got-test-client.js' +import GithubApiProvider from '../github-api-provider.js' +import { setRoutes } from './admin.js' describe('GitHub admin route', function () { const shieldsSecret = '7'.repeat(40) diff --git a/services/github/github-all-contributors.service.js b/services/github/github-all-contributors.service.js index 5025b13f301f2..ed54e6f2ea548 100644 --- a/services/github/github-all-contributors.service.js +++ b/services/github/github-all-contributors.service.js @@ -1,16 +1,14 @@ -import Joi from 'joi'; -import {renderContributorBadge} from '../contributor-count.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchJsonFromRepo} from './github-common-fetch.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { renderContributorBadge } from '../contributor-count.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchJsonFromRepo } from './github-common-fetch.js' +import { documentation } from './github-helpers.js' const schema = Joi.object({ contributors: Joi.array().required(), }).required() -export default class GithubAllContributorsService extends ( - ConditionalGithubAuthV3Service -) { +export default class GithubAllContributorsService extends ConditionalGithubAuthV3Service { static category = 'activity' static route = { base: 'github/all-contributors', @@ -48,4 +46,4 @@ export default class GithubAllContributorsService extends ( const contributorCount = contributors.length return this.constructor.render({ contributorCount }) } -}; +} diff --git a/services/github/github-all-contributors.tester.js b/services/github/github-all-contributors.tester.js index dd4ade81d2ec2..f2656b3cc6b4e 100644 --- a/services/github/github-all-contributors.tester.js +++ b/services/github/github-all-contributors.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() t.create('all-contributors repo') diff --git a/services/github/github-api-provider.integration.js b/services/github/github-api-provider.integration.js index 3bc838f9c44f5..26f9a0ac17715 100644 --- a/services/github/github-api-provider.integration.js +++ b/services/github/github-api-provider.integration.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import config from 'config'; -import request from 'request'; -import GithubApiProvider from './github-api-provider.js'; +import { expect } from 'chai' +import config from 'config' +import request from 'request' +import GithubApiProvider from './github-api-provider.js' describe('Github API provider', function () { const baseUrl = process.env.GITHUB_URL || 'https://api.github.com' diff --git a/services/github/github-api-provider.js b/services/github/github-api-provider.js index 47b1cfdd401a7..eefbe1b966892 100644 --- a/services/github/github-api-provider.js +++ b/services/github/github-api-provider.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import log from '../../core/server/log.js'; -import {TokenPool} from '../../core/token-pooling/token-pool.js'; -import {userAgent} from '../../core/base-service/legacy-request-handler.js'; -import {nonNegativeInteger} from '../validators.js'; +import Joi from 'joi' +import log from '../../core/server/log.js' +import { TokenPool } from '../../core/token-pooling/token-pool.js' +import { userAgent } from '../../core/base-service/legacy-request-handler.js' +import { nonNegativeInteger } from '../validators.js' const headerSchema = Joi.object({ 'x-ratelimit-limit': nonNegativeInteger, @@ -212,4 +212,4 @@ class GithubApiProvider { } } -export default GithubApiProvider; +export default GithubApiProvider diff --git a/services/github/github-api-provider.spec.js b/services/github/github-api-provider.spec.js index 8ea7fa162ed42..dbb59d68e0552 100644 --- a/services/github/github-api-provider.spec.js +++ b/services/github/github-api-provider.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import sinon from 'sinon'; -import GithubApiProvider from './github-api-provider.js'; +import { expect } from 'chai' +import sinon from 'sinon' +import GithubApiProvider from './github-api-provider.js' describe('Github API provider', function () { const baseUrl = 'https://github-api.example.com' diff --git a/services/github/github-auth-service.js b/services/github/github-auth-service.js index b60f88fb1ab73..826ab3990d5ab 100644 --- a/services/github/github-auth-service.js +++ b/services/github/github-auth-service.js @@ -1,6 +1,6 @@ -import gql from 'graphql-tag'; -import {mergeQueries} from '../../core/base-service/graphql.js'; -import {BaseGraphqlService, BaseJsonService} from '../index.js'; +import gql from 'graphql-tag' +import { mergeQueries } from '../../core/base-service/graphql.js' +import { BaseGraphqlService, BaseJsonService } from '../index.js' function createRequestFetcher(context, config) { const { sendAndCacheRequestWithCallbacks, githubApiProvider } = context @@ -91,4 +91,4 @@ export { GithubAuthV3Service, ConditionalGithubAuthV3Service, GithubAuthV4Service, -}; +} diff --git a/services/github/github-checks-status.service.js b/services/github/github-checks-status.service.js index cc34472948b79..35097f7b5a042 100644 --- a/services/github/github-checks-status.service.js +++ b/services/github/github-checks-status.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ state: isBuildStatus, @@ -67,4 +67,4 @@ export default class GithubChecksStatus extends GithubAuthV3Service { return renderBuildStatusBadge({ status: state }) } -}; +} diff --git a/services/github/github-checks-status.tester.js b/services/github/github-checks-status.tester.js index 85ea8ad8be4b5..80cfe34bdd3ac 100644 --- a/services/github/github-checks-status.tester.js +++ b/services/github/github-checks-status.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isBuildStatus} from '../build-status.js'; +import { createServiceTester } from '../tester.js' +import { isBuildStatus } from '../build-status.js' export const t = await createServiceTester() t.create('branch checks (branch)') diff --git a/services/github/github-code-size.service.js b/services/github/github-code-size.service.js index da0f582a17888..c5b394fbcea1d 100644 --- a/services/github/github-code-size.service.js +++ b/services/github/github-code-size.service.js @@ -1,6 +1,6 @@ -import prettyBytes from 'pretty-bytes'; -import {BaseGithubLanguage} from './github-languages-base.js'; -import {documentation} from './github-helpers.js'; +import prettyBytes from 'pretty-bytes' +import { BaseGithubLanguage } from './github-languages-base.js' +import { documentation } from './github-helpers.js' export default class GithubCodeSize extends BaseGithubLanguage { static category = 'size' @@ -34,4 +34,4 @@ export default class GithubCodeSize extends BaseGithubLanguage { const data = await this.fetch({ user, repo }) return this.constructor.render({ size: this.getTotalSize(data) }) } -}; +} diff --git a/services/github/github-code-size.tester.js b/services/github/github-code-size.tester.js index 588eb80e9fc5f..39ec144e802f5 100644 --- a/services/github/github-code-size.tester.js +++ b/services/github/github-code-size.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('code size in bytes for all languages') diff --git a/services/github/github-commit-activity.service.js b/services/github/github-commit-activity.service.js index 0ca6729eab7b1..ee7ad583ac849 100644 --- a/services/github/github-commit-activity.service.js +++ b/services/github/github-commit-activity.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {errorMessagesFor, documentation} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { errorMessagesFor, documentation } from './github-helpers.js' const schema = Joi.array() .items( @@ -89,4 +89,4 @@ export default class GithubCommitActivity extends GithubAuthV3Service { const commitCount = this.constructor.transform({ interval, weekData }) return this.constructor.render({ interval, commitCount }) } -}; +} diff --git a/services/github/github-commit-activity.tester.js b/services/github/github-commit-activity.tester.js index 38725875e9998..bd18f2d68821e 100644 --- a/services/github/github-commit-activity.tester.js +++ b/services/github/github-commit-activity.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { + isMetricOverTimePeriod, + isZeroOverTimePeriod, +} from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isCommitActivity = Joi.alternatives().try( diff --git a/services/github/github-commit-status.service.js b/services/github/github-commit-status.service.js index 9776142bed367..46aae3410a8d4 100644 --- a/services/github/github-commit-status.service.js +++ b/services/github/github-commit-status.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {NotFound, InvalidParameter} from '../index.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { NotFound, InvalidParameter } from '../index.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ // https://stackoverflow.com/a/23969867/893113 @@ -71,4 +71,4 @@ export default class GithubCommitStatus extends GithubAuthV3Service { const isInBranch = status === 'identical' || status === 'behind' return this.constructor.render({ isInBranch, branch }) } -}; +} diff --git a/services/github/github-commit-status.tester.js b/services/github/github-commit-status.tester.js index df4ad36137f6b..5e6f9f9fdc19d 100644 --- a/services/github/github-commit-status.tester.js +++ b/services/github/github-commit-status.tester.js @@ -1,5 +1,5 @@ -import {invalidJSONString} from '../response-fixtures.js'; -import {createServiceTester} from '../tester.js' +import { invalidJSONString } from '../response-fixtures.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('commit status - commit in branch') diff --git a/services/github/github-commits-since.service.js b/services/github/github-commits-since.service.js index 1a64e7588c2a5..7fd0cc924b513 100644 --- a/services/github/github-commits-since.service.js +++ b/services/github/github-commits-since.service.js @@ -1,9 +1,12 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {fetchLatestRelease, queryParamSchema} from './github-common-release.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { + fetchLatestRelease, + queryParamSchema, +} from './github-common-release.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ ahead_by: nonNegativeInteger }).required() @@ -153,4 +156,4 @@ export default class GithubCommitsSince extends GithubAuthV3Service { return this.constructor.render({ version, commitCount }) } -}; +} diff --git a/services/github/github-commits-since.tester.js b/services/github/github-commits-since.tester.js index b74ff7a64cc7e..13e06e6471545 100644 --- a/services/github/github-commits-since.tester.js +++ b/services/github/github-commits-since.tester.js @@ -1,5 +1,5 @@ -import {withRegex, isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex, isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isCommitsSince = withRegex(/^(commits since){1}[\s\S]+$/) diff --git a/services/github/github-common-fetch.js b/services/github/github-common-fetch.js index 6c753bc6c21f1..1cf6c72fd1f94 100644 --- a/services/github/github-common-fetch.js +++ b/services/github/github-common-fetch.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {InvalidResponse} from '../index.js'; -import {errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { InvalidResponse } from '../index.js' +import { errorMessagesFor } from './github-helpers.js' const issueSchema = Joi.object({ head: Joi.object({ @@ -75,8 +75,4 @@ async function fetchJsonFromRepo( } } -export { - fetchIssue, - fetchRepoContent, - fetchJsonFromRepo, -}; +export { fetchIssue, fetchRepoContent, fetchJsonFromRepo } diff --git a/services/github/github-common-release.js b/services/github/github-common-release.js index ef9069a1c1b1d..81e4f97d92534 100644 --- a/services/github/github-common-release.js +++ b/services/github/github-common-release.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {latest} from '../version.js'; -import {NotFound} from '../index.js'; -import {errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { latest } from '../version.js' +import { NotFound } from '../index.js' +import { errorMessagesFor } from './github-helpers.js' const releaseInfoSchema = Joi.object({ assets: Joi.array() @@ -94,8 +94,5 @@ async function fetchLatestRelease( return latestRelease } -export { - fetchLatestRelease, - queryParamSchema, -}; +export { fetchLatestRelease, queryParamSchema } export const _getLatestRelease = getLatestRelease // currently only used for tests diff --git a/services/github/github-common-release.spec.js b/services/github/github-common-release.spec.js index e151821f2d548..ed927180ac3f9 100644 --- a/services/github/github-common-release.spec.js +++ b/services/github/github-common-release.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {_getLatestRelease} from './github-common-release.js'; +import { test, given } from 'sazerac' +import { _getLatestRelease } from './github-common-release.js' describe('GithubRelease', function () { test(_getLatestRelease, () => { diff --git a/services/github/github-constellation.js b/services/github/github-constellation.js index 6a5f0d1d0c393..e74114e7a46f9 100644 --- a/services/github/github-constellation.js +++ b/services/github/github-constellation.js @@ -1,9 +1,9 @@ -import {AuthHelper} from '../../core/base-service/auth-helper.js'; -import RedisTokenPersistence from '../../core/token-pooling/redis-token-persistence.js'; -import log from '../../core/server/log.js'; -import GithubApiProvider from './github-api-provider.js'; -import {setRoutes as setAdminRoutes} from './auth/admin.js'; -import {setRoutes as setAcceptorRoutes} from './auth/acceptor.js'; +import { AuthHelper } from '../../core/base-service/auth-helper.js' +import RedisTokenPersistence from '../../core/token-pooling/redis-token-persistence.js' +import log from '../../core/server/log.js' +import GithubApiProvider from './github-api-provider.js' +import { setRoutes as setAdminRoutes } from './auth/admin.js' +import { setRoutes as setAcceptorRoutes } from './auth/acceptor.js' // Convenience class with all the stuff related to the Github API and its // authorization tokens, to simplify server initialization. @@ -128,4 +128,4 @@ class GithubConstellation { } } -export default GithubConstellation; +export default GithubConstellation diff --git a/services/github/github-contributors.service.js b/services/github/github-contributors.service.js index ed34747a0dd30..6ad4c713e0a4e 100644 --- a/services/github/github-contributors.service.js +++ b/services/github/github-contributors.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import parseLinkHeader from 'parse-link-header'; -import {renderContributorBadge} from '../contributor-count.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import parseLinkHeader from 'parse-link-header' +import { renderContributorBadge } from '../contributor-count.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' // All we do is check its length. const schema = Joi.array().items(Joi.object()) @@ -54,4 +54,4 @@ export default class GithubContributors extends GithubAuthV3Service { return this.constructor.render({ contributorCount }) } -}; +} diff --git a/services/github/github-contributors.tester.js b/services/github/github-contributors.tester.js index 469832ac7ab77..4495d3b473e5b 100644 --- a/services/github/github-contributors.tester.js +++ b/services/github/github-contributors.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() t.create('Contributors').get('/contributors/badges/shields.json').expectBadge({ diff --git a/services/github/github-deployments.service.js b/services/github/github-deployments.service.js index a339216d4b9c5..eed495401cfbb 100644 --- a/services/github/github-deployments.service.js +++ b/services/github/github-deployments.service.js @@ -1,8 +1,8 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {NotFound} from '../index.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { NotFound } from '../index.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { documentation, transformErrors } from './github-helpers.js' const greenStates = ['SUCCESS'] const redStates = ['ERROR', 'FAILURE'] @@ -127,4 +127,4 @@ export default class GithubDeployments extends GithubAuthV4Service { const { state } = this.transform({ data: json.data }) return this.constructor.render({ state }) } -}; +} diff --git a/services/github/github-deployments.spec.js b/services/github/github-deployments.spec.js index ddac38fc0534b..d3221706c5740 100644 --- a/services/github/github-deployments.spec.js +++ b/services/github/github-deployments.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import GithubDeployments from './github-deployments.service.js'; +import { test, given } from 'sazerac' +import GithubDeployments from './github-deployments.service.js' describe('GithubDeployments', function () { test(GithubDeployments.render, () => { diff --git a/services/github/github-deployments.tester.js b/services/github/github-deployments.tester.js index b9cf5d6ff3944..325ae34faad9b 100644 --- a/services/github/github-deployments.tester.js +++ b/services/github/github-deployments.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const validMessages = [ diff --git a/services/github/github-directory-file-count.service.js b/services/github/github-directory-file-count.service.js index 4d7b4fe351594..24aabaa34e870 100644 --- a/services/github/github-directory-file-count.service.js +++ b/services/github/github-directory-file-count.service.js @@ -1,9 +1,12 @@ -import path from 'path'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {InvalidParameter} from '../index.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {documentation as commonDocumentation, errorMessagesFor} from './github-helpers.js'; +import path from 'path' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { InvalidParameter } from '../index.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { + documentation as commonDocumentation, + errorMessagesFor, +} from './github-helpers.js' const documentation = `${commonDocumentation}

@@ -40,9 +43,7 @@ const queryParamSchema = Joi.object({ extension: Joi.string(), }) -export default class GithubDirectoryFileCount extends ( - ConditionalGithubAuthV3Service -) { +export default class GithubDirectoryFileCount extends ConditionalGithubAuthV3Service { static category = 'size' static route = { @@ -153,4 +154,4 @@ export default class GithubDirectoryFileCount extends ( const { count } = this.constructor.transform(content, { type, extension }) return this.constructor.render({ count }) } -}; +} diff --git a/services/github/github-directory-file-count.spec.js b/services/github/github-directory-file-count.spec.js index fadf9f4a5640b..056a9622a0a8a 100644 --- a/services/github/github-directory-file-count.spec.js +++ b/services/github/github-directory-file-count.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {InvalidParameter} from '../index.js'; -import GithubDirectoryFileCount from './github-directory-file-count.service.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { InvalidParameter } from '../index.js' +import GithubDirectoryFileCount from './github-directory-file-count.service.js' describe('GithubDirectoryFileCount', function () { const contents = [ diff --git a/services/github/github-directory-file-count.tester.js b/services/github/github-directory-file-count.tester.js index 8248648bd372d..b4ac6c6f2c6c4 100644 --- a/services/github/github-directory-file-count.tester.js +++ b/services/github/github-directory-file-count.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('directory file count').get('/badges/shields.json').expectBadge({ diff --git a/services/github/github-discussions-total.service.js b/services/github/github-discussions-total.service.js index cc89cefc51342..425563c220a90 100644 --- a/services/github/github-discussions-total.service.js +++ b/services/github/github-discussions-total.service.js @@ -1,8 +1,8 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { transformErrors } from './github-helpers.js' const schema = Joi.object({ data: Joi.object({ @@ -69,4 +69,4 @@ export default class GithubTotalDiscussions extends GithubAuthV4Service { } = json return this.constructor.render({ discussions: `${totalCount} total` }) } -}; +} diff --git a/services/github/github-discussions-total.tester.js b/services/github/github-discussions-total.tester.js index e73c64f3c3f35..7a347876685ce 100644 --- a/services/github/github-discussions-total.tester.js +++ b/services/github/github-discussions-total.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('GitHub Total Discussions (repo not found)') diff --git a/services/github/github-downloads.service.js b/services/github/github-downloads.service.js index 7c60a77279aeb..d544a91e743d8 100644 --- a/services/github/github-downloads.service.js +++ b/services/github/github-downloads.service.js @@ -1,11 +1,11 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {NotFound} from '../index.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {fetchLatestRelease} from './github-common-release.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { NotFound } from '../index.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { fetchLatestRelease } from './github-common-release.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const queryParamSchema = Joi.object({ sort: Joi.string().valid('date', 'semver').default('date'), @@ -263,4 +263,4 @@ export default class GithubDownloads extends GithubAuthV3Service { return this.constructor.render({ tag, assetName, downloadCount }) } -}; +} diff --git a/services/github/github-downloads.tester.js b/services/github/github-downloads.tester.js index 22f2873785f8a..e002516906684 100644 --- a/services/github/github-downloads.tester.js +++ b/services/github/github-downloads.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const mockLatestRelease = release => nock => diff --git a/services/github/github-followers.service.js b/services/github/github-followers.service.js index effcdb1e3beca..71b3d01b05c9f 100644 --- a/services/github/github-followers.service.js +++ b/services/github/github-followers.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ followers: nonNegativeInteger, @@ -41,4 +41,4 @@ export default class GithubFollowers extends GithubAuthV3Service { }) return this.constructor.render({ followers }) } -}; +} diff --git a/services/github/github-followers.tester.js b/services/github/github-followers.tester.js index ce5c9856d1ca4..4e1babb264c26 100644 --- a/services/github/github-followers.tester.js +++ b/services/github/github-followers.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Followers').get('/webcaetano.json').expectBadge({ diff --git a/services/github/github-forks.service.js b/services/github/github-forks.service.js index 5a78e2633c644..0c60e03c67ba7 100644 --- a/services/github/github-forks.service.js +++ b/services/github/github-forks.service.js @@ -1,9 +1,9 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { documentation, transformErrors } from './github-helpers.js' const schema = Joi.object({ data: Joi.object({ @@ -72,4 +72,4 @@ export default class GithubForks extends GithubAuthV4Service { forkCount: json.data.repository.forkCount, }) } -}; +} diff --git a/services/github/github-forks.tester.js b/services/github/github-forks.tester.js index 3f61e5d9bae24..31ad83fbbf8c7 100644 --- a/services/github/github-forks.tester.js +++ b/services/github/github-forks.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Forks') diff --git a/services/github/github-go-mod.service.js b/services/github/github-go-mod.service.js index 1e006c46d09ab..9feded9bae79d 100644 --- a/services/github/github-go-mod.service.js +++ b/services/github/github-go-mod.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {InvalidResponse} from '../index.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchRepoContent} from './github-common-fetch.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { InvalidResponse } from '../index.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchRepoContent } from './github-common-fetch.js' +import { documentation } from './github-helpers.js' const queryParamSchema = Joi.object({ filename: Joi.string(), @@ -13,9 +13,7 @@ const goVersionRegExp = /^go (.+)$/m const keywords = ['golang'] -export default class GithubGoModGoVersion extends ( - ConditionalGithubAuthV3Service -) { +export default class GithubGoModGoVersion extends ConditionalGithubAuthV3Service { static category = 'version' static route = { base: 'github/go-mod/go-version', @@ -93,4 +91,4 @@ export default class GithubGoModGoVersion extends ( const { go } = this.constructor.transform(content) return this.constructor.render({ version: go, branch }) } -}; +} diff --git a/services/github/github-go-mod.tester.js b/services/github/github-go-mod.tester.js index b055aad8d5b2d..d42378079cc10 100644 --- a/services/github/github-go-mod.tester.js +++ b/services/github/github-go-mod.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Go version').get('/gohugoio/hugo.json').expectBadge({ diff --git a/services/github/github-hacktoberfest.service.js b/services/github/github-hacktoberfest.service.js index d4ff657997351..bf8782c17a5bf 100644 --- a/services/github/github-hacktoberfest.service.js +++ b/services/github/github-hacktoberfest.service.js @@ -1,10 +1,13 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import moment from 'moment'; -import {metric, maybePluralize} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation as githubDocumentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import moment from 'moment' +import { metric, maybePluralize } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { + documentation as githubDocumentation, + transformErrors, +} from './github-helpers.js' const documentation = `

@@ -53,9 +56,7 @@ const queryParamSchema = Joi.object({ suggestion_label: Joi.string(), }).required() -export default class GithubHacktoberfestCombinedStatus extends ( - GithubAuthV4Service -) { +export default class GithubHacktoberfestCombinedStatus extends GithubAuthV4Service { static category = 'issue-tracking' static route = { base: 'github/hacktoberfest', @@ -232,4 +233,4 @@ export default class GithubHacktoberfestCombinedStatus extends ( year, }) } -}; +} diff --git a/services/github/github-hacktoberfest.spec.js b/services/github/github-hacktoberfest.spec.js index 7d86cc0ff9705..c872f7ab64bf7 100644 --- a/services/github/github-hacktoberfest.spec.js +++ b/services/github/github-hacktoberfest.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import GitHubHacktoberfest from './github-hacktoberfest.service.js'; +import { test, given } from 'sazerac' +import GitHubHacktoberfest from './github-hacktoberfest.service.js' describe('GitHubHacktoberfest', function () { test(GitHubHacktoberfest.render, () => { diff --git a/services/github/github-hacktoberfest.tester.js b/services/github/github-hacktoberfest.tester.js index 99c861f7d0e75..5fb0212a9f710 100644 --- a/services/github/github-hacktoberfest.tester.js +++ b/services/github/github-hacktoberfest.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isHacktoberfestNoIssuesStatus = Joi.string().regex( diff --git a/services/github/github-helpers.js b/services/github/github-helpers.js index 261157752ffa2..9bbeda52c6961 100644 --- a/services/github/github-helpers.js +++ b/services/github/github-helpers.js @@ -1,5 +1,5 @@ -import {colorScale} from '../color-formatters.js'; -import {InvalidResponse, NotFound} from '../index.js'; +import { colorScale } from '../color-formatters.js' +import { InvalidResponse, NotFound } from '../index.js' const documentation = `

@@ -37,4 +37,4 @@ export { commentsColor, errorMessagesFor, transformErrors, -}; +} diff --git a/services/github/github-issue-detail-redirect.service.js b/services/github/github-issue-detail-redirect.service.js index b95d3da95dc33..8bf174f7b67d9 100644 --- a/services/github/github-issue-detail-redirect.service.js +++ b/services/github/github-issue-detail-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' const variantMap = { s: 'state', @@ -17,4 +17,4 @@ export default [ `/github/${issueKind}/detail/${variantMap[variant]}/${user}/${repo}/${number}`, dateAdded: new Date('2019-04-04'), }), -]; +] diff --git a/services/github/github-issue-detail-redirect.tester.js b/services/github/github-issue-detail-redirect.tester.js index aa25d1c3ed3b5..1be7ba22c6b96 100644 --- a/services/github/github-issue-detail-redirect.tester.js +++ b/services/github/github-issue-detail-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'GithubIssueDetailRedirect', diff --git a/services/github/github-issue-detail.service.js b/services/github/github-issue-detail.service.js index 5d2c7fa0d0f33..48359527c6793 100644 --- a/services/github/github-issue-detail.service.js +++ b/services/github/github-issue-detail.service.js @@ -1,10 +1,15 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {formatDate, metric} from '../text-formatters.js'; -import {age} from '../color-formatters.js'; -import {InvalidResponse} from '../index.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor, stateColor, commentsColor} from './github-helpers.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { formatDate, metric } from '../text-formatters.js' +import { age } from '../color-formatters.js' +import { InvalidResponse } from '../index.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { + documentation, + errorMessagesFor, + stateColor, + commentsColor, +} from './github-helpers.js' const commonSchemaFields = { number: nonNegativeInteger, @@ -210,4 +215,4 @@ export default class GithubIssueDetail extends GithubAuthV3Service { const { value, isPR } = this.transform({ json, property, issueKind }) return this.constructor.render({ property, value, isPR, number }) } -}; +} diff --git a/services/github/github-issue-detail.spec.js b/services/github/github-issue-detail.spec.js index 649cc17ad7e28..e639bbd4cca42 100644 --- a/services/github/github-issue-detail.spec.js +++ b/services/github/github-issue-detail.spec.js @@ -1,10 +1,10 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {age} from '../color-formatters.js'; -import {formatDate, metric} from '../text-formatters.js'; -import {InvalidResponse} from '../index.js'; -import GithubIssueDetail from './github-issue-detail.service.js'; -import {stateColor, commentsColor} from './github-helpers.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { age } from '../color-formatters.js' +import { formatDate, metric } from '../text-formatters.js' +import { InvalidResponse } from '../index.js' +import GithubIssueDetail from './github-issue-detail.service.js' +import { stateColor, commentsColor } from './github-helpers.js' describe('GithubIssueDetail', function () { test(GithubIssueDetail.render, () => { diff --git a/services/github/github-issue-detail.tester.js b/services/github/github-issue-detail.tester.js index d023b254a2e72..bb0103e48ca48 100644 --- a/services/github/github-issue-detail.tester.js +++ b/services/github/github-issue-detail.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isFormattedDate} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isFormattedDate } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('github issue state') diff --git a/services/github/github-issues-search.service.js b/services/github/github-issues-search.service.js index e27308232db2c..68e1b2a5eb766 100644 --- a/services/github/github-issues-search.service.js +++ b/services/github/github-issues-search.service.js @@ -1,9 +1,9 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { documentation, transformErrors } from './github-helpers.js' const issueCountSchema = Joi.object({ data: Joi.object({ @@ -104,7 +104,4 @@ class GithubRepoIssuesSearch extends BaseGithubIssuesSearch { } } -export { - GithubIssuesSearch, - GithubRepoIssuesSearch, -}; +export { GithubIssuesSearch, GithubRepoIssuesSearch } diff --git a/services/github/github-issues-search.tester.js b/services/github/github-issues-search.tester.js index f787d8abb717e..57bd0c11a778b 100644 --- a/services/github/github-issues-search.tester.js +++ b/services/github/github-issues-search.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isMetric } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'GithubIssuesSearch', title: 'Github Issues Search', diff --git a/services/github/github-issues.service.js b/services/github/github-issues.service.js index af603094a20aa..d9bfe3d2adecc 100644 --- a/services/github/github-issues.service.js +++ b/services/github/github-issues.service.js @@ -1,9 +1,9 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { documentation, transformErrors } from './github-helpers.js' const issueCountSchema = Joi.object({ data: Joi.object({ @@ -399,4 +399,4 @@ export default class GithubIssues extends GithubAuthV4Service { label, }) } -}; +} diff --git a/services/github/github-issues.tester.js b/services/github/github-issues.tester.js index 193c4127c08ea..f84a99f432ac5 100644 --- a/services/github/github-issues.tester.js +++ b/services/github/github-issues.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isMetric, isMetricOpenIssues} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isMetric, isMetricOpenIssues } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('GitHub closed pull requests') diff --git a/services/github/github-labels.service.js b/services/github/github-labels.service.js index 3217ca881d3fe..70176517bf507 100644 --- a/services/github/github-labels.service.js +++ b/services/github/github-labels.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ color: Joi.string().hex().required(), @@ -43,4 +43,4 @@ export default class GithubLabels extends GithubAuthV3Service { const { color } = await this.fetch({ user, repo, name }) return this.constructor.render({ name, color }) } -}; +} diff --git a/services/github/github-labels.tester.js b/services/github/github-labels.tester.js index 1a1d6b6246fbd..d493e03ffd850 100644 --- a/services/github/github-labels.tester.js +++ b/services/github/github-labels.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('labels').get('/badges/shields/bug.json').expectBadge({ diff --git a/services/github/github-language-count.service.js b/services/github/github-language-count.service.js index 012dce66d8c41..b730372221517 100644 --- a/services/github/github-language-count.service.js +++ b/services/github/github-language-count.service.js @@ -1,5 +1,5 @@ -import {BaseGithubLanguage} from './github-languages-base.js'; -import {documentation} from './github-helpers.js'; +import { BaseGithubLanguage } from './github-languages-base.js' +import { documentation } from './github-helpers.js' export default class GithubLanguageCount extends BaseGithubLanguage { static category = 'analysis' @@ -29,4 +29,4 @@ export default class GithubLanguageCount extends BaseGithubLanguage { const data = await this.fetch({ user, repo }) return this.constructor.render({ count: Object.keys(data).length }) } -}; +} diff --git a/services/github/github-language-count.tester.js b/services/github/github-language-count.tester.js index 2440aa1937506..b7464402995f4 100644 --- a/services/github/github-language-count.tester.js +++ b/services/github/github-language-count.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('language count').get('/badges/shields.json').expectBadge({ diff --git a/services/github/github-languages-base.js b/services/github/github-languages-base.js index 64ed4d03d6a1f..92427519feb91 100644 --- a/services/github/github-languages-base.js +++ b/services/github/github-languages-base.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { errorMessagesFor } from './github-helpers.js' /* We're expecting a response like { "Python": 39624, "Shell": 104 } @@ -23,4 +23,4 @@ class BaseGithubLanguage extends GithubAuthV3Service { } } -export { BaseGithubLanguage }; +export { BaseGithubLanguage } diff --git a/services/github/github-last-commit.service.js b/services/github/github-last-commit.service.js index e12c9245e02a6..b452fbe96b6d4 100644 --- a/services/github/github-last-commit.service.js +++ b/services/github/github-last-commit.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {formatDate} from '../text-formatters.js'; -import {age as ageColor} from '../color-formatters.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { formatDate } from '../text-formatters.js' +import { age as ageColor } from '../color-formatters.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const commonExampleAttrs = { keywords: ['latest'], documentation, @@ -69,4 +69,4 @@ export default class GithubLastCommit extends GithubAuthV3Service { const body = await this.fetch({ user, repo, branch }) return this.constructor.render({ commitDate: body[0].commit.author.date }) } -}; +} diff --git a/services/github/github-last-commit.tester.js b/services/github/github-last-commit.tester.js index cadeff74c25e6..23eed9fb37bb6 100644 --- a/services/github/github-last-commit.tester.js +++ b/services/github/github-last-commit.tester.js @@ -1,5 +1,5 @@ -import {isFormattedDate} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFormattedDate } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('last commit (recent)') diff --git a/services/github/github-lerna-json.service.js b/services/github/github-lerna-json.service.js index b114bbd396cff..f306563a5912f 100644 --- a/services/github/github-lerna-json.service.js +++ b/services/github/github-lerna-json.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {semver} from '../validators.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchJsonFromRepo} from './github-common-fetch.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { semver } from '../validators.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchJsonFromRepo } from './github-common-fetch.js' +import { documentation } from './github-helpers.js' const versionSchema = Joi.object({ version: Joi.alternatives().try(semver, Joi.equal('independent').required()), @@ -56,4 +56,4 @@ export default class GithubLernaJson extends ConditionalGithubAuthV3Service { }) return this.constructor.render({ version, branch }) } -}; +} diff --git a/services/github/github-lerna-json.tester.js b/services/github/github-lerna-json.tester.js index 7e6478db8974b..c86f97bcdb826 100644 --- a/services/github/github-lerna-json.tester.js +++ b/services/github/github-lerna-json.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Lerna version').get('/facebook/jest.json').expectBadge({ diff --git a/services/github/github-license.service.js b/services/github/github-license.service.js index ed038b3b4fc8e..360153f29e61f 100644 --- a/services/github/github-license.service.js +++ b/services/github/github-license.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderLicenseBadge} from '../licenses.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { renderLicenseBadge } from '../licenses.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ // Some repos do not have a license, in which case GitHub returns `{ license: null }`. @@ -46,4 +46,4 @@ export default class GithubLicense extends GithubAuthV3Service { const license = licenseObject ? licenseObject.spdx_id : undefined return this.constructor.render({ license }) } -}; +} diff --git a/services/github/github-license.spec.js b/services/github/github-license.spec.js index a80bb68b8504c..87167fc26d516 100644 --- a/services/github/github-license.spec.js +++ b/services/github/github-license.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import GithubLicense from './github-license.service.js'; +import { test, given } from 'sazerac' +import GithubLicense from './github-license.service.js' test(GithubLicense.render, () => { given({ license: undefined }).expect({ message: 'not specified' }) diff --git a/services/github/github-license.tester.js b/services/github/github-license.tester.js index 40508f9c3928f..0cef52f4c75b8 100644 --- a/services/github/github-license.tester.js +++ b/services/github/github-license.tester.js @@ -1,5 +1,5 @@ -import {licenseToColor} from '../licenses.js'; -import {createServiceTester} from '../tester.js' +import { licenseToColor } from '../licenses.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const publicDomainLicenseColor = licenseToColor('CC0-1.0') diff --git a/services/github/github-manifest.service.js b/services/github/github-manifest.service.js index b233746db3fd7..5919507398597 100644 --- a/services/github/github-manifest.service.js +++ b/services/github/github-manifest.service.js @@ -1,9 +1,13 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {individualValueSchema, transformAndValidate, renderDynamicBadge} from '../dynamic-common.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchJsonFromRepo} from './github-common-fetch.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { + individualValueSchema, + transformAndValidate, + renderDynamicBadge, +} from '../dynamic-common.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchJsonFromRepo } from './github-common-fetch.js' +import { documentation } from './github-helpers.js' const schema = Joi.object({ version: individualValueSchema, @@ -198,7 +202,4 @@ class DynamicGithubManifest extends ConditionalGithubAuthV3Service { } } -export { - GithubManifestVersion, - DynamicGithubManifest, -}; +export { GithubManifestVersion, DynamicGithubManifest } diff --git a/services/github/github-manifest.tester.js b/services/github/github-manifest.tester.js index 4dec6dd2c8edd..a1e9849f9779e 100644 --- a/services/github/github-manifest.tester.js +++ b/services/github/github-manifest.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' export const t = new ServiceTester({ id: 'GithubManifest', diff --git a/services/github/github-milestone-detail.service.js b/services/github/github-milestone-detail.service.js index 3bebf1882a0fc..ac3b071c5dd6c 100644 --- a/services/github/github-milestone-detail.service.js +++ b/services/github/github-milestone-detail.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ open_issues: nonNegativeInteger, @@ -93,4 +93,4 @@ export default class GithubMilestoneDetail extends GithubAuthV3Service { const milestone = await this.fetch({ user, repo, number }) return this.constructor.render({ user, repo, variant, number, milestone }) } -}; +} diff --git a/services/github/github-milestone-detail.tester.js b/services/github/github-milestone-detail.tester.js index 24581d66a23e8..4305a6074b19d 100644 --- a/services/github/github-milestone-detail.tester.js +++ b/services/github/github-milestone-detail.tester.js @@ -1,5 +1,9 @@ -import {isMetric, isMetricOverMetric, isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { + isMetric, + isMetricOverMetric, + isIntegerPercentage, +} from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Milestone Open Issues') diff --git a/services/github/github-milestone.service.js b/services/github/github-milestone.service.js index 744a05be2d7c7..62b623aed7fd4 100644 --- a/services/github/github-milestone.service.js +++ b/services/github/github-milestone.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.array() .items( @@ -78,4 +78,4 @@ export default class GithubMilestone extends GithubAuthV3Service { const milestones = await this.fetch({ user, repo, variant }) return this.constructor.render({ user, repo, variant, milestones }) } -}; +} diff --git a/services/github/github-milestone.tester.js b/services/github/github-milestone.tester.js index a91bb820bf142..dd9b92234ad72 100644 --- a/services/github/github-milestone.tester.js +++ b/services/github/github-milestone.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('All Milestones') diff --git a/services/github/github-package-json.service.js b/services/github/github-package-json.service.js index 881384d300d45..dc2663069f22f 100644 --- a/services/github/github-package-json.service.js +++ b/services/github/github-package-json.service.js @@ -1,11 +1,14 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {transformAndValidate, renderDynamicBadge} from '../dynamic-common.js'; -import {isPackageJsonWithDependencies, getDependencyVersion} from '../package-json-helpers.js'; -import {semver} from '../validators.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchJsonFromRepo} from './github-common-fetch.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { transformAndValidate, renderDynamicBadge } from '../dynamic-common.js' +import { + isPackageJsonWithDependencies, + getDependencyVersion, +} from '../package-json-helpers.js' +import { semver } from '../validators.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchJsonFromRepo } from './github-common-fetch.js' +import { documentation } from './github-helpers.js' const keywords = ['npm', 'node'] @@ -243,4 +246,4 @@ export default [ GithubPackageJsonVersion, GithubPackageJsonDependencyVersion, DynamicGithubPackageJson, -]; +] diff --git a/services/github/github-package-json.tester.js b/services/github/github-package-json.tester.js index 0bfdb806decee..eb16fb42b0147 100644 --- a/services/github/github-package-json.tester.js +++ b/services/github/github-package-json.tester.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isSemver} from '../test-validators.js'; -import {semverRange} from '../validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { isSemver } from '../test-validators.js' +import { semverRange } from '../validators.js' export const t = new ServiceTester({ id: 'GithubPackageJson', diff --git a/services/github/github-pipenv.service.js b/services/github/github-pipenv.service.js index 8d5b1230e20b6..758903747a49d 100644 --- a/services/github/github-pipenv.service.js +++ b/services/github/github-pipenv.service.js @@ -1,10 +1,10 @@ -import {renderVersionBadge} from '../version.js'; -import {isLockfile, getDependencyVersion} from '../pipenv-helpers.js'; -import {addv} from '../text-formatters.js'; -import {NotFound} from '../index.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchJsonFromRepo} from './github-common-fetch.js'; -import {documentation as githubDocumentation} from './github-helpers.js'; +import { renderVersionBadge } from '../version.js' +import { isLockfile, getDependencyVersion } from '../pipenv-helpers.js' +import { addv } from '../text-formatters.js' +import { NotFound } from '../index.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchJsonFromRepo } from './github-common-fetch.js' +import { documentation as githubDocumentation } from './github-helpers.js' const keywords = ['pipfile'] @@ -175,4 +175,4 @@ class GithubPipenvLockedDependencyVersion extends ConditionalGithubAuthV3Service export default [ GithubPipenvLockedPythonVersion, GithubPipenvLockedDependencyVersion, -]; +] diff --git a/services/github/github-pipenv.tester.js b/services/github/github-pipenv.tester.js index 584f101179ce9..c3fa864748eb3 100644 --- a/services/github/github-pipenv.tester.js +++ b/services/github/github-pipenv.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionAtLeastOne, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { + isVPlusDottedVersionAtLeastOne, + isVPlusDottedVersionNClausesWithOptionalSuffix, +} from '../test-validators.js' // e.g. v19.3b0 const isBlackVersion = Joi.string().regex(/^v\d+(\.\d+)*(.*)?$/) diff --git a/services/github/github-pull-request-check-state.service.js b/services/github/github-pull-request-check-state.service.js index 36c73b6b68f4e..969c75d91be9d 100644 --- a/services/github/github-pull-request-check-state.service.js +++ b/services/github/github-pull-request-check-state.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import countBy from 'lodash.countby'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {fetchIssue} from './github-common-fetch.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import countBy from 'lodash.countby' +import { GithubAuthV3Service } from './github-auth-service.js' +import { fetchIssue } from './github-common-fetch.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ state: Joi.equal('failure', 'pending', 'success').required(), @@ -98,4 +98,4 @@ export default class GithubPullRequestCheckState extends GithubAuthV3Service { return this.constructor.render({ variant, state, stateCounts }) } -}; +} diff --git a/services/github/github-pull-request-check-state.tester.js b/services/github/github-pull-request-check-state.tester.js index 4ba9dc033dc1d..9095f266f95a1 100644 --- a/services/github/github-pull-request-check-state.tester.js +++ b/services/github/github-pull-request-check-state.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('github pull request check state') diff --git a/services/github/github-r-package.service.js b/services/github/github-r-package.service.js index b6896024c1e19..837abf6151c94 100644 --- a/services/github/github-r-package.service.js +++ b/services/github/github-r-package.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {InvalidResponse} from '../index.js'; -import {ConditionalGithubAuthV3Service} from './github-auth-service.js'; -import {fetchRepoContent} from './github-common-fetch.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { InvalidResponse } from '../index.js' +import { ConditionalGithubAuthV3Service } from './github-auth-service.js' +import { fetchRepoContent } from './github-common-fetch.js' +import { documentation } from './github-helpers.js' const queryParamSchema = Joi.object({ filename: Joi.string(), @@ -11,9 +11,7 @@ const queryParamSchema = Joi.object({ const versionRegExp = /^Version:[\s]*(.+)$/m -export default class GithubRPackageVersion extends ( - ConditionalGithubAuthV3Service -) { +export default class GithubRPackageVersion extends ConditionalGithubAuthV3Service { static category = 'version' static route = { @@ -88,4 +86,4 @@ export default class GithubRPackageVersion extends ( const { version } = this.constructor.transform(content, filename) return this.constructor.render({ version, branch }) } -}; +} diff --git a/services/github/github-r-package.spec.js b/services/github/github-r-package.spec.js index 23fd48e57c0d0..cc6516685e441 100644 --- a/services/github/github-r-package.spec.js +++ b/services/github/github-r-package.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {InvalidResponse} from '../index.js'; -import GithubRPackageVersion from './github-r-package.service.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { InvalidResponse } from '../index.js' +import GithubRPackageVersion from './github-r-package.service.js' describe('GithubRPackageVersion', function () { const content = versionLine => diff --git a/services/github/github-r-package.tester.js b/services/github/github-r-package.tester.js index b8ef328f07d2c..18247e1918a2d 100644 --- a/services/github/github-r-package.tester.js +++ b/services/github/github-r-package.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('R package version').get('/mixOmicsTeam/mixOmics.json').expectBadge({ diff --git a/services/github/github-release-date.service.js b/services/github/github-release-date.service.js index 2eddcb77dce29..098bb7c11cc84 100644 --- a/services/github/github-release-date.service.js +++ b/services/github/github-release-date.service.js @@ -1,9 +1,9 @@ -import moment from 'moment'; -import Joi from 'joi'; -import {age} from '../color-formatters.js'; -import {formatDate} from '../text-formatters.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import moment from 'moment' +import Joi from 'joi' +import { age } from '../color-formatters.js' +import { formatDate } from '../text-formatters.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.alternatives( Joi.object({ @@ -77,4 +77,4 @@ export default class GithubReleaseDate extends GithubAuthV3Service { } return this.constructor.render({ date: body.created_at }) } -}; +} diff --git a/services/github/github-release-date.tester.js b/services/github/github-release-date.tester.js index 2c9443e6991d2..3cf255fb731ee 100644 --- a/services/github/github-release-date.tester.js +++ b/services/github/github-release-date.tester.js @@ -1,5 +1,5 @@ -import {isFormattedDate} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFormattedDate } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Release Date. e.g release date|today') diff --git a/services/github/github-release.service.js b/services/github/github-release.service.js index a2a83afc69b98..94343ad530a7d 100644 --- a/services/github/github-release.service.js +++ b/services/github/github-release.service.js @@ -1,9 +1,12 @@ -import {addv} from '../text-formatters.js'; -import {version as versionColor} from '../color-formatters.js'; -import {redirector} from '../index.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {fetchLatestRelease, queryParamSchema} from './github-common-release.js'; -import {documentation} from './github-helpers.js'; +import { addv } from '../text-formatters.js' +import { version as versionColor } from '../color-formatters.js' +import { redirector } from '../index.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { + fetchLatestRelease, + queryParamSchema, +} from './github-common-release.js' +import { documentation } from './github-helpers.js' class GithubRelease extends GithubAuthV3Service { static category = 'version' @@ -117,7 +120,4 @@ const redirects = { }), } -export { - GithubRelease, - redirects, -}; +export { GithubRelease, redirects } diff --git a/services/github/github-release.tester.js b/services/github/github-release.tester.js index ae255d17f17e1..629eafeecb50f 100644 --- a/services/github/github-release.tester.js +++ b/services/github/github-release.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isSemver} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { isSemver } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'GithubRelease', diff --git a/services/github/github-repo-size.service.js b/services/github/github-repo-size.service.js index d4455699de286..774ddad426399 100644 --- a/services/github/github-repo-size.service.js +++ b/services/github/github-repo-size.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import prettyBytes from 'pretty-bytes'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import prettyBytes from 'pretty-bytes' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ size: nonNegativeInteger, @@ -45,4 +45,4 @@ export default class GithubRepoSize extends GithubAuthV3Service { const { size } = await this.fetch({ user, repo }) return this.constructor.render({ size }) } -}; +} diff --git a/services/github/github-repo-size.tester.js b/services/github/github-repo-size.tester.js index 5be24a5b8072e..c39f5c700f4a2 100644 --- a/services/github/github-repo-size.tester.js +++ b/services/github/github-repo-size.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('repository size').get('/badges/shields.json').expectBadge({ diff --git a/services/github/github-search.service.js b/services/github/github-search.service.js index c927a4efbcebb..361d1b9eb737a 100644 --- a/services/github/github-search.service.js +++ b/services/github/github-search.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {errorMessagesFor, documentation} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { errorMessagesFor, documentation } from './github-helpers.js' const schema = Joi.object({ total_count: nonNegativeInteger }).required() @@ -53,4 +53,4 @@ export default class GithubSearch extends GithubAuthV3Service { }) return this.constructor.render({ query, totalCount }) } -}; +} diff --git a/services/github/github-search.tester.js b/services/github/github-search.tester.js index 115d2885a5333..cb3fa80564a1c 100644 --- a/services/github/github-search.tester.js +++ b/services/github/github-search.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('hit counter') diff --git a/services/github/github-size.service.js b/services/github/github-size.service.js index ca31c7bafc4b8..b932faf17e21a 100644 --- a/services/github/github-size.service.js +++ b/services/github/github-size.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import prettyBytes from 'pretty-bytes'; -import {nonNegativeInteger} from '../validators.js'; -import {NotFound} from '../index.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import prettyBytes from 'pretty-bytes' +import { nonNegativeInteger } from '../validators.js' +import { NotFound } from '../index.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.alternatives( Joi.object({ @@ -56,4 +56,4 @@ export default class GithubSize extends GithubAuthV3Service { } return this.constructor.render({ size: body.size }) } -}; +} diff --git a/services/github/github-size.tester.js b/services/github/github-size.tester.js index 2625aac379d37..db61aa9ac9211 100644 --- a/services/github/github-size.tester.js +++ b/services/github/github-size.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('File size') diff --git a/services/github/github-sponsors.service.js b/services/github/github-sponsors.service.js index 2992e63f9a6fb..825104094c7aa 100644 --- a/services/github/github-sponsors.service.js +++ b/services/github/github-sponsors.service.js @@ -1,10 +1,10 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {NotFound} from '../index.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { NotFound } from '../index.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { documentation, transformErrors } from './github-helpers.js' const schema = Joi.object({ data: Joi.object({ @@ -79,4 +79,4 @@ export default class GithubSponsors extends GithubAuthV4Service { count, }) } -}; +} diff --git a/services/github/github-sponsors.tester.js b/services/github/github-sponsors.tester.js index d97dcccd09e2c..dc5247cc4e1d5 100644 --- a/services/github/github-sponsors.tester.js +++ b/services/github/github-sponsors.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isMetric } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'GithubSponsors', diff --git a/services/github/github-stars.service.js b/services/github/github-stars.service.js index 28c1d99943829..c790da3f23815 100644 --- a/services/github/github-stars.service.js +++ b/services/github/github-stars.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ stargazers_count: nonNegativeInteger, @@ -60,4 +60,4 @@ export default class GithubStars extends GithubAuthV3Service { }) return this.constructor.render({ user, repo, stars }) } -}; +} diff --git a/services/github/github-stars.tester.js b/services/github/github-stars.tester.js index bb957208e78f3..6155dd553baeb 100644 --- a/services/github/github-stars.tester.js +++ b/services/github/github-stars.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Stars') diff --git a/services/github/github-tag.service.js b/services/github/github-tag.service.js index 6bccae7e15cc3..d97201d518853 100644 --- a/services/github/github-tag.service.js +++ b/services/github/github-tag.service.js @@ -1,12 +1,12 @@ -import gql from 'graphql-tag'; -import Joi from 'joi'; -import {addv} from '../text-formatters.js'; -import {version as versionColor} from '../color-formatters.js'; -import {latest} from '../version.js'; -import {NotFound, redirector} from '../index.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {queryParamSchema} from './github-common-release.js'; -import {documentation, transformErrors} from './github-helpers.js'; +import gql from 'graphql-tag' +import Joi from 'joi' +import { addv } from '../text-formatters.js' +import { version as versionColor } from '../color-formatters.js' +import { latest } from '../version.js' +import { NotFound, redirector } from '../index.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { queryParamSchema } from './github-common-release.js' +import { documentation, transformErrors } from './github-helpers.js' const schema = Joi.object({ data: Joi.object({ @@ -161,7 +161,4 @@ const redirects = { }), } -export { - GithubTag, - redirects, -}; +export { GithubTag, redirects } diff --git a/services/github/github-tag.spec.js b/services/github/github-tag.spec.js index c396eb4a8ec04..c0fbd51e1b14e 100644 --- a/services/github/github-tag.spec.js +++ b/services/github/github-tag.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {GithubTag} from './github-tag.service.js'; +import { test, given } from 'sazerac' +import { GithubTag } from './github-tag.service.js' describe('GithubTag', function () { test(GithubTag.getLatestTag, () => { diff --git a/services/github/github-tag.tester.js b/services/github/github-tag.tester.js index c98e32e00b019..1a804c288621d 100644 --- a/services/github/github-tag.tester.js +++ b/services/github/github-tag.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isSemver} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { isSemver } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'GithubTag', diff --git a/services/github/github-top-language.service.js b/services/github/github-top-language.service.js index 56e9008ff08c0..21aac82113531 100644 --- a/services/github/github-top-language.service.js +++ b/services/github/github-top-language.service.js @@ -1,5 +1,5 @@ -import {BaseGithubLanguage} from './github-languages-base.js'; -import {documentation} from './github-helpers.js'; +import { BaseGithubLanguage } from './github-languages-base.js' +import { documentation } from './github-helpers.js' export default class GithubTopLanguage extends BaseGithubLanguage { static category = 'analysis' @@ -49,4 +49,4 @@ export default class GithubTopLanguage extends BaseGithubLanguage { totalSize: this.getTotalSize(data), }) } -}; +} diff --git a/services/github/github-top-language.tester.js b/services/github/github-top-language.tester.js index ee20fbd97bfa4..5bfea8d71299a 100644 --- a/services/github/github-top-language.tester.js +++ b/services/github/github-top-language.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('top language') diff --git a/services/github/github-total-star.service.js b/services/github/github-total-star.service.js index d025727bb3c7b..70461fe72c64f 100644 --- a/services/github/github-total-star.service.js +++ b/services/github/github-total-star.service.js @@ -1,9 +1,12 @@ -import Joi from 'joi'; -import gql from 'graphql-tag'; -import {nonNegativeInteger} from '../validators.js'; -import {metric} from '../text-formatters.js'; -import {GithubAuthV4Service} from './github-auth-service.js'; -import {documentation as commonDocumentation, transformErrors} from './github-helpers.js'; +import Joi from 'joi' +import gql from 'graphql-tag' +import { nonNegativeInteger } from '../validators.js' +import { metric } from '../text-formatters.js' +import { GithubAuthV4Service } from './github-auth-service.js' +import { + documentation as commonDocumentation, + transformErrors, +} from './github-helpers.js' const MAX_REPO_LIMIT = 200 @@ -238,4 +241,4 @@ export default class GithubTotalStarService extends GithubAuthV4Service { const totalStars = await this.getTotalStars({ user }, queryParams) return this.constructor.render({ totalStars, user }) } -}; +} diff --git a/services/github/github-total-star.tester.js b/services/github/github-total-star.tester.js index 1724c28bcc50a..e67516275fe2f 100644 --- a/services/github/github-total-star.tester.js +++ b/services/github/github-total-star.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Stars (User)') diff --git a/services/github/github-watchers.service.js b/services/github/github-watchers.service.js index 091e5236efa12..088757ff93a50 100644 --- a/services/github/github-watchers.service.js +++ b/services/github/github-watchers.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {GithubAuthV3Service} from './github-auth-service.js'; -import {documentation, errorMessagesFor} from './github-helpers.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { GithubAuthV3Service } from './github-auth-service.js' +import { documentation, errorMessagesFor } from './github-helpers.js' const schema = Joi.object({ subscribers_count: nonNegativeInteger, @@ -59,4 +59,4 @@ export default class GithubWatchers extends GithubAuthV3Service { }) return this.constructor.render({ user, repo, watchers }) } -}; +} diff --git a/services/github/github-watchers.tester.js b/services/github/github-watchers.tester.js index 5a8de82291172..606b9e53c8a37 100644 --- a/services/github/github-watchers.tester.js +++ b/services/github/github-watchers.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Watchers') diff --git a/services/github/github-workflow-status.service.js b/services/github/github-workflow-status.service.js index 122228371a3a7..f5467d7b2aac8 100644 --- a/services/github/github-workflow-status.service.js +++ b/services/github/github-workflow-status.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '../index.js'; -import {documentation} from './github-helpers.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService } from '../index.js' +import { documentation } from './github-helpers.js' const schema = Joi.object({ message: Joi.alternatives() @@ -97,4 +97,4 @@ export default class GithubWorkflowStatus extends BaseSvgScrapingService { const { status } = await this.fetch({ user, repo, workflow, branch, event }) return renderBuildStatusBadge({ status }) } -}; +} diff --git a/services/github/github-workflow-status.tester.js b/services/github/github-workflow-status.tester.js index 8594851a979fa..573a16e7b18f1 100644 --- a/services/github/github-workflow-status.tester.js +++ b/services/github/github-workflow-status.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isWorkflowStatus = Joi.alternatives() diff --git a/services/gitlab/gitlab-coverage.service.js b/services/gitlab/gitlab-coverage.service.js index 6035f9a285e64..f7b4c045d8b9b 100644 --- a/services/gitlab/gitlab-coverage.service.js +++ b/services/gitlab/gitlab-coverage.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import {optionalUrl} from '../validators.js'; -import {BaseSvgScrapingService, NotFound} from '../index.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import { optionalUrl } from '../validators.js' +import { BaseSvgScrapingService, NotFound } from '../index.js' const schema = Joi.object({ message: Joi.string() @@ -136,4 +136,4 @@ export default class GitlabCoverage extends BaseSvgScrapingService { coverage: this.constructor.transform({ coverage }), }) } -}; +} diff --git a/services/gitlab/gitlab-coverage.tester.js b/services/gitlab/gitlab-coverage.tester.js index 22d2b6d6e9145..576c5a8972807 100644 --- a/services/gitlab/gitlab-coverage.tester.js +++ b/services/gitlab/gitlab-coverage.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Coverage (branch)') diff --git a/services/gitlab/gitlab-pipeline-status.service.js b/services/gitlab/gitlab-pipeline-status.service.js index 379246124500e..70494b1a6c21c 100644 --- a/services/gitlab/gitlab-pipeline-status.service.js +++ b/services/gitlab/gitlab-pipeline-status.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {optionalUrl} from '../validators.js'; -import {BaseSvgScrapingService, NotFound, redirector} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { optionalUrl } from '../validators.js' +import { BaseSvgScrapingService, NotFound, redirector } from '../index.js' const badgeSchema = Joi.object({ message: Joi.alternatives() @@ -97,7 +97,4 @@ const GitlabPipelineStatusRedirector = redirector({ dateAdded: new Date('2020-07-12'), }) -export { - GitlabPipelineStatus, - GitlabPipelineStatusRedirector, -}; +export { GitlabPipelineStatus, GitlabPipelineStatusRedirector } diff --git a/services/gitlab/gitlab-pipeline-status.tester.js b/services/gitlab/gitlab-pipeline-status.tester.js index 293af5becd9b2..db8ee99ed77fd 100644 --- a/services/gitlab/gitlab-pipeline-status.tester.js +++ b/services/gitlab/gitlab-pipeline-status.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {ServiceTester} from '../tester.js'; +import { isBuildStatus } from '../build-status.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'GitlabPipeline', title: 'Gitlab Pipeline', diff --git a/services/gitter/gitter.service.js b/services/gitter/gitter.service.js index bd1ae135c50d9..55e5d119f7ce7 100644 --- a/services/gitter/gitter.service.js +++ b/services/gitter/gitter.service.js @@ -1,4 +1,4 @@ -import {BaseStaticService} from '../index.js'; +import { BaseStaticService } from '../index.js' export default class Gitter extends BaseStaticService { static category = 'chat' @@ -28,4 +28,4 @@ export default class Gitter extends BaseStaticService { handle() { return this.constructor.render() } -}; +} diff --git a/services/gitter/gitter.tester.js b/services/gitter/gitter.tester.js index 16abaebf2765d..53c8a9cdd9138 100644 --- a/services/gitter/gitter.tester.js +++ b/services/gitter/gitter.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('on gitter').get('/nwjs/nw.js.json').expectBadge({ diff --git a/services/gradle-plugin-portal/gradle-plugin-portal.tester.js b/services/gradle-plugin-portal/gradle-plugin-portal.tester.js index 8614b81f66461..978103d0189d3 100644 --- a/services/gradle-plugin-portal/gradle-plugin-portal.tester.js +++ b/services/gradle-plugin-portal/gradle-plugin-portal.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gradle plugin portal') diff --git a/services/gratipay/gratipay.service.js b/services/gratipay/gratipay.service.js index b93af93369bc3..8ea38b6e9555e 100644 --- a/services/gratipay/gratipay.service.js +++ b/services/gratipay/gratipay.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' const commonAttrs = { category: 'funding', @@ -21,4 +21,4 @@ export default [ }, ...commonAttrs, }), -]; +] diff --git a/services/gratipay/gratipay.tester.js b/services/gratipay/gratipay.tester.js index a41a387c1d694..f7684a05de39f 100644 --- a/services/gratipay/gratipay.tester.js +++ b/services/gratipay/gratipay.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'gratipay', diff --git a/services/hackage/hackage-deps.service.js b/services/hackage/hackage-deps.service.js index e9648802d14c0..f3cbd1deb996b 100644 --- a/services/hackage/hackage-deps.service.js +++ b/services/hackage/hackage-deps.service.js @@ -1,4 +1,4 @@ -import {BaseService} from '../index.js'; +import { BaseService } from '../index.js' export default class HackageDeps extends BaseService { static category = 'dependencies' @@ -41,4 +41,4 @@ export default class HackageDeps extends BaseService { const isOutdated = buffer.includes(outdatedStr) return this.constructor.render({ isOutdated }) } -}; +} diff --git a/services/hackage/hackage-deps.tester.js b/services/hackage/hackage-deps.tester.js index b40c95fe46356..6133b776e6099 100644 --- a/services/hackage/hackage-deps.tester.js +++ b/services/hackage/hackage-deps.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('hackage deps (valid)') diff --git a/services/hackage/hackage-version.service.js b/services/hackage/hackage-version.service.js index 6d0d50ffa26a0..e1333a14e6510 100644 --- a/services/hackage/hackage-version.service.js +++ b/services/hackage/hackage-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import {BaseService, InvalidResponse} from '../index.js'; +import { renderVersionBadge } from '../version.js' +import { BaseService, InvalidResponse } from '../index.js' export default class HackageVersion extends BaseService { static category = 'version' @@ -28,7 +28,7 @@ export default class HackageVersion extends BaseService { static transform(data) { const lines = data.split('\n') const versionLines = lines.filter(e => /^version:/i.test(e) === true) - return versionLines[0].split(/:/)[1].trim(); + return versionLines[0].split(/:/)[1].trim() } async handle({ packageName }) { @@ -40,4 +40,4 @@ export default class HackageVersion extends BaseService { throw new InvalidResponse({ prettyMessage: 'invalid response data' }) } } -}; +} diff --git a/services/hackage/hackage-version.tester.js b/services/hackage/hackage-version.tester.js index c97554e4dc0cb..f4074ec9c1a99 100644 --- a/services/hackage/hackage-version.tester.js +++ b/services/hackage/hackage-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('hackage version (valid)').get('/lens.json').expectBadge({ diff --git a/services/hexpm/hexpm.service.js b/services/hexpm/hexpm.service.js index d3de6048a6f05..fe03981abe80e 100644 --- a/services/hexpm/hexpm.service.js +++ b/services/hexpm/hexpm.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric, addv, maybePluralize} from '../text-formatters.js'; -import {downloadCount, version as versionColor} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric, addv, maybePluralize } from '../text-formatters.js' +import { downloadCount, version as versionColor } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const hexSchema = Joi.object({ downloads: Joi.object({ @@ -147,4 +147,4 @@ function DownloadsForInterval(interval) { const downloadsServices = ['day', 'week', 'all'].map(DownloadsForInterval) -export default [...downloadsServices, HexPmLicense, HexPmVersion]; +export default [...downloadsServices, HexPmLicense, HexPmVersion] diff --git a/services/hexpm/hexpm.tester.js b/services/hexpm/hexpm.tester.js index b37cf8f51b3bc..d7f1d661b77f2 100644 --- a/services/hexpm/hexpm.tester.js +++ b/services/hexpm/hexpm.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' const isHexpmVersion = Joi.string().regex(/^v\d+.\d+.?\d?$/) diff --git a/services/homebrew/homebrew-cask.service.js b/services/homebrew/homebrew-cask.service.js index 75d50563c1eb3..bb08a435b4ed1 100644 --- a/services/homebrew/homebrew-cask.service.js +++ b/services/homebrew/homebrew-cask.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: Joi.string().required(), @@ -31,4 +31,4 @@ export default class HomebrewCask extends BaseJsonService { const data = await this.fetch({ cask }) return renderVersionBadge({ version: data.version }) } -}; +} diff --git a/services/homebrew/homebrew-cask.tester.js b/services/homebrew/homebrew-cask.tester.js index cf1a61996ccd3..7535c3a8e5cc1 100644 --- a/services/homebrew/homebrew-cask.tester.js +++ b/services/homebrew/homebrew-cask.tester.js @@ -1,5 +1,5 @@ -import {isVPlusTripleDottedVersion} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusTripleDottedVersion } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('homebrew cask (valid)').get('/iterm2.json').expectBadge({ diff --git a/services/homebrew/homebrew-downloads.service.js b/services/homebrew/homebrew-downloads.service.js index 430c2e4de8539..b4e39cbee8a20 100644 --- a/services/homebrew/homebrew-downloads.service.js +++ b/services/homebrew/homebrew-downloads.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {downloadCount} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; -import {nonNegativeInteger} from '../validators.js'; +import Joi from 'joi' +import { downloadCount } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' +import { nonNegativeInteger } from '../validators.js' function getSchema({ formula }) { return Joi.object({ @@ -72,4 +72,4 @@ export default class HomebrewDownloads extends BaseJsonService { downloads: data.analytics.install[periodMap[interval].api_field][formula], }) } -}; +} diff --git a/services/homebrew/homebrew-downloads.tester.js b/services/homebrew/homebrew-downloads.tester.js index 2ef9c280d0b22..972df583f38c9 100644 --- a/services/homebrew/homebrew-downloads.tester.js +++ b/services/homebrew/homebrew-downloads.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetricOverTimePeriod} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetricOverTimePeriod } from '../test-validators.js' export const t = await createServiceTester() t.create('daily downloads (valid)') diff --git a/services/homebrew/homebrew-version.service.js b/services/homebrew/homebrew-version.service.js index 1241f876f7d81..f32e77e518d76 100644 --- a/services/homebrew/homebrew-version.service.js +++ b/services/homebrew/homebrew-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ versions: Joi.object({ @@ -34,4 +34,4 @@ export default class HomebrewVersion extends BaseJsonService { const data = await this.fetch({ formula }) return renderVersionBadge({ version: data.versions.stable }) } -}; +} diff --git a/services/homebrew/homebrew-version.tester.js b/services/homebrew/homebrew-version.tester.js index 2b12d613fde1e..1e69f15cfb6b9 100644 --- a/services/homebrew/homebrew-version.tester.js +++ b/services/homebrew/homebrew-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusTripleDottedVersion} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusTripleDottedVersion } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('homebrew (valid)').get('/cake.json').expectBadge({ diff --git a/services/hsts/hsts.service.js b/services/hsts/hsts.service.js index 79967c68a6e5f..c768815d5639e 100644 --- a/services/hsts/hsts.service.js +++ b/services/hsts/hsts.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const label = 'hsts preloaded' const schema = Joi.object({ status: Joi.string().required(), @@ -64,4 +64,4 @@ export default class HSTS extends BaseJsonService { const { status } = await this.fetch({ domain }) return this.constructor.render({ status }) } -}; +} diff --git a/services/hsts/hsts.tester.js b/services/hsts/hsts.tester.js index cce34f120a7c1..0f55a07b79359 100644 --- a/services/hsts/hsts.tester.js +++ b/services/hsts/hsts.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const label = 'hsts preloaded' diff --git a/services/imagelayers/imagelayers.service.js b/services/imagelayers/imagelayers.service.js index cf58467a44647..1ae1d3f1e3032 100644 --- a/services/imagelayers/imagelayers.service.js +++ b/services/imagelayers/imagelayers.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'size', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'imagelayers', dateAdded: new Date('2018-11-18'), -}); +}) diff --git a/services/imagelayers/imagelayers.tester.js b/services/imagelayers/imagelayers.tester.js index 34fd66b7d4eb7..7e4b7808172f0 100644 --- a/services/imagelayers/imagelayers.tester.js +++ b/services/imagelayers/imagelayers.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'imagelayers', diff --git a/services/index.js b/services/index.js index 941f68457d777..1ba849b1b8f42 100644 --- a/services/index.js +++ b/services/index.js @@ -1 +1 @@ -export * from '../core/base-service/index.js'; +export * from '../core/base-service/index.js' diff --git a/services/issuestats/issuestats.service.js b/services/issuestats/issuestats.service.js index 2035ae7b417b3..1ab375a8c5c62 100644 --- a/services/issuestats/issuestats.service.js +++ b/services/issuestats/issuestats.service.js @@ -1,8 +1,8 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'issue-tracking', route: { base: 'issuestats', pattern: ':various+' }, label: 'issue stats', dateAdded: new Date('2018-09-01'), -}); +}) diff --git a/services/issuestats/issuestats.tester.js b/services/issuestats/issuestats.tester.js index 362200550b68d..3f4853bdad4f3 100644 --- a/services/issuestats/issuestats.tester.js +++ b/services/issuestats/issuestats.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'issuestats', title: 'Issue Stats' }) diff --git a/services/itunes/itunes.service.js b/services/itunes/itunes.service.js index adb272b33c520..bcb367bc8abd0 100644 --- a/services/itunes/itunes.service.js +++ b/services/itunes/itunes.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object({ resultCount: nonNegativeInteger, @@ -47,4 +47,4 @@ export default class Itunes extends BaseJsonService { return renderVersionBadge({ version: data.results[0].version }) } -}; +} diff --git a/services/itunes/itunes.tester.js b/services/itunes/itunes.tester.js index d759bb385539f..2499ed3f9702d 100644 --- a/services/itunes/itunes.tester.js +++ b/services/itunes/itunes.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('iTunes version (valid)').get('/324684580.json').expectBadge({ diff --git a/services/jenkins/jenkins-base.js b/services/jenkins/jenkins-base.js index 8af64f294c5ed..f7243d0b377d7 100644 --- a/services/jenkins/jenkins-base.js +++ b/services/jenkins/jenkins-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '../index.js'; +import { BaseJsonService } from '../index.js' export default class JenkinsBase extends BaseJsonService { static auth = { @@ -26,4 +26,4 @@ export default class JenkinsBase extends BaseJsonService { }) ) } -}; +} diff --git a/services/jenkins/jenkins-build-redirect.service.js b/services/jenkins/jenkins-build-redirect.service.js index 2a556521393ec..b7666291c7152 100644 --- a/services/jenkins/jenkins-build-redirect.service.js +++ b/services/jenkins/jenkins-build-redirect.service.js @@ -1,5 +1,5 @@ -import {redirector} from '../index.js'; -import {buildRedirectUrl} from './jenkins-common.js'; +import { redirector } from '../index.js' +import { buildRedirectUrl } from './jenkins-common.js' const commonProps = { category: 'build', @@ -34,4 +34,4 @@ export default [ dateAdded: new Date('2019-11-29'), ...commonProps, }), -]; +] diff --git a/services/jenkins/jenkins-build-redirect.tester.js b/services/jenkins/jenkins-build-redirect.tester.js index 3ab7f2d8e4c3c..3e5e76aa0cf2d 100644 --- a/services/jenkins/jenkins-build-redirect.tester.js +++ b/services/jenkins/jenkins-build-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JenkinsBuildRedirect', diff --git a/services/jenkins/jenkins-build.service.js b/services/jenkins/jenkins-build.service.js index 4f535ffd9f01f..667d42bb376c6 100644 --- a/services/jenkins/jenkins-build.service.js +++ b/services/jenkins/jenkins-build.service.js @@ -1,7 +1,11 @@ -import Joi from 'joi'; -import {renderBuildStatusBadge} from '../build-status.js'; -import JenkinsBase from './jenkins-base.js'; -import {buildTreeParamQueryString, buildUrl, queryParamSchema} from './jenkins-common.js'; +import Joi from 'joi' +import { renderBuildStatusBadge } from '../build-status.js' +import JenkinsBase from './jenkins-base.js' +import { + buildTreeParamQueryString, + buildUrl, + queryParamSchema, +} from './jenkins-common.js' // https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/BallColor.java#L56 const colorStatusMap = { @@ -74,4 +78,4 @@ export default class JenkinsBuild extends JenkinsBase { const { status } = this.transform({ json }) return this.constructor.render({ status }) } -}; +} diff --git a/services/jenkins/jenkins-build.spec.js b/services/jenkins/jenkins-build.spec.js index 67024e4329e6d..a821f272709f3 100644 --- a/services/jenkins/jenkins-build.spec.js +++ b/services/jenkins/jenkins-build.spec.js @@ -1,9 +1,9 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {test, forCases, given} from 'sazerac'; -import {renderBuildStatusBadge} from '../build-status.js'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import JenkinsBuild from './jenkins-build.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { test, forCases, given } from 'sazerac' +import { renderBuildStatusBadge } from '../build-status.js' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import JenkinsBuild from './jenkins-build.service.js' describe('JenkinsBuild', function () { test(JenkinsBuild.prototype.transform, () => { diff --git a/services/jenkins/jenkins-build.tester.js b/services/jenkins/jenkins-build.tester.js index 001a2c3a4e4ef..7ebfb5df861f5 100644 --- a/services/jenkins/jenkins-build.tester.js +++ b/services/jenkins/jenkins-build.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isJenkinsBuildStatus = Joi.alternatives( diff --git a/services/jenkins/jenkins-common.js b/services/jenkins/jenkins-common.js index 7de91605dcce2..c9c6b771be6d8 100644 --- a/services/jenkins/jenkins-common.js +++ b/services/jenkins/jenkins-common.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' const queryParamSchema = Joi.object({ disableStrictSSL: Joi.equal(''), @@ -19,9 +19,5 @@ const buildUrl = ({ jobUrl, lastCompletedBuild = true, plugin }) => { return `${jobUrl}/${lastCompletedBuildElement}${pluginElement}api/json` } -export { - queryParamSchema, - buildUrl, - buildRedirectUrl, -}; +export { queryParamSchema, buildUrl, buildRedirectUrl } export const buildTreeParamQueryString = tree => ({ tree }) diff --git a/services/jenkins/jenkins-common.spec.js b/services/jenkins/jenkins-common.spec.js index ad86acab3de51..ae1e2e998359f 100644 --- a/services/jenkins/jenkins-common.spec.js +++ b/services/jenkins/jenkins-common.spec.js @@ -1,5 +1,5 @@ -import {expect} from 'chai'; -import {buildRedirectUrl, buildUrl} from './jenkins-common.js'; +import { expect } from 'chai' +import { buildRedirectUrl, buildUrl } from './jenkins-common.js' describe('jenkins-common', function () { describe('buildUrl', function () { diff --git a/services/jenkins/jenkins-coverage-redirector.service.js b/services/jenkins/jenkins-coverage-redirector.service.js index b40ac65f5540e..05b828f870a40 100644 --- a/services/jenkins/jenkins-coverage-redirector.service.js +++ b/services/jenkins/jenkins-coverage-redirector.service.js @@ -1,5 +1,5 @@ -import {redirector} from '../index.js'; -import {buildRedirectUrl} from './jenkins-common.js'; +import { redirector } from '../index.js' +import { buildRedirectUrl } from './jenkins-common.js' const commonProps = { category: 'coverage', @@ -30,4 +30,4 @@ export default [ dateAdded: new Date('2019-11-29'), ...commonProps, }), -]; +] diff --git a/services/jenkins/jenkins-coverage-redirector.tester.js b/services/jenkins/jenkins-coverage-redirector.tester.js index f5a1d58219d7d..d6475017c59e9 100644 --- a/services/jenkins/jenkins-coverage-redirector.tester.js +++ b/services/jenkins/jenkins-coverage-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JenkinsCoverageRedirector', diff --git a/services/jenkins/jenkins-coverage.service.js b/services/jenkins/jenkins-coverage.service.js index 04838491a3d86..1d918b4216e25 100644 --- a/services/jenkins/jenkins-coverage.service.js +++ b/services/jenkins/jenkins-coverage.service.js @@ -1,7 +1,11 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import JenkinsBase from './jenkins-base.js'; -import {buildTreeParamQueryString, buildUrl, queryParamSchema} from './jenkins-common.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import JenkinsBase from './jenkins-base.js' +import { + buildTreeParamQueryString, + buildUrl, + queryParamSchema, +} from './jenkins-common.js' const formatMap = { jacoco: { @@ -123,4 +127,4 @@ export default class JenkinsCoverage extends JenkinsBase { const { coverage } = transform(json) return this.constructor.render({ coverage }) } -}; +} diff --git a/services/jenkins/jenkins-coverage.tester.js b/services/jenkins/jenkins-coverage.tester.js index 56c021ec676a0..fae3f9b4d95d3 100644 --- a/services/jenkins/jenkins-coverage.tester.js +++ b/services/jenkins/jenkins-coverage.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // The below page includes links to various publicly accessible Jenkins instances diff --git a/services/jenkins/jenkins-plugin-installs.service.js b/services/jenkins/jenkins-plugin-installs.service.js index bc9dc98378633..ef24d19e7221c 100644 --- a/services/jenkins/jenkins-plugin-installs.service.js +++ b/services/jenkins/jenkins-plugin-installs.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' const schemaInstallations = Joi.object() .keys({ @@ -113,4 +113,4 @@ export default class JenkinsPluginInstalls extends BaseJsonService { return this.constructor.render({ label, installs }) } -}; +} diff --git a/services/jenkins/jenkins-plugin-installs.tester.js b/services/jenkins/jenkins-plugin-installs.tester.js index 0f43bb8e78084..5c0f0687b8010 100644 --- a/services/jenkins/jenkins-plugin-installs.tester.js +++ b/services/jenkins/jenkins-plugin-installs.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // total installs diff --git a/services/jenkins/jenkins-plugin-version.service.js b/services/jenkins/jenkins-plugin-version.service.js index 89e4dd47e10be..98486776bf8a9 100644 --- a/services/jenkins/jenkins-plugin-version.service.js +++ b/services/jenkins/jenkins-plugin-version.service.js @@ -1,7 +1,7 @@ -import {promisify} from 'util'; -import {regularUpdate} from '../../core/legacy/regular-update.js'; -import {renderVersionBadge} from '../version.js'; -import {BaseService, NotFound} from '../index.js'; +import { promisify } from 'util' +import { regularUpdate } from '../../core/legacy/regular-update.js' +import { renderVersionBadge } from '../version.js' +import { BaseService, NotFound } from '../index.js' export default class JenkinsPluginVersion extends BaseService { static category = 'version' @@ -51,4 +51,4 @@ export default class JenkinsPluginVersion extends BaseService { } return this.constructor.render({ version }) } -}; +} diff --git a/services/jenkins/jenkins-plugin-version.tester.js b/services/jenkins/jenkins-plugin-version.tester.js index e700417b89e80..f9c4d2dfc9460 100644 --- a/services/jenkins/jenkins-plugin-version.tester.js +++ b/services/jenkins/jenkins-plugin-version.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'jenkins-plugin', diff --git a/services/jenkins/jenkins-tests-redirector.service.js b/services/jenkins/jenkins-tests-redirector.service.js index 9368513db9246..051b21a81f4ed 100644 --- a/services/jenkins/jenkins-tests-redirector.service.js +++ b/services/jenkins/jenkins-tests-redirector.service.js @@ -1,5 +1,5 @@ -import {redirector} from '../index.js'; -import {buildRedirectUrl} from './jenkins-common.js'; +import { redirector } from '../index.js' +import { buildRedirectUrl } from './jenkins-common.js' const commonProps = { category: 'build', @@ -26,4 +26,4 @@ export default [ dateAdded: new Date('2019-11-29'), ...commonProps, }), -]; +] diff --git a/services/jenkins/jenkins-tests-redirector.tester.js b/services/jenkins/jenkins-tests-redirector.tester.js index 7939df6d9330e..837c9f4b1394d 100644 --- a/services/jenkins/jenkins-tests-redirector.tester.js +++ b/services/jenkins/jenkins-tests-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JenkinsTestsRedirector', diff --git a/services/jenkins/jenkins-tests.service.js b/services/jenkins/jenkins-tests.service.js index 5a1e64a0cfb42..4c9a74767a594 100644 --- a/services/jenkins/jenkins-tests.service.js +++ b/services/jenkins/jenkins-tests.service.js @@ -1,9 +1,17 @@ -import Joi from 'joi'; -import {documentation, testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; -import {optionalNonNegativeInteger} from '../validators.js'; -import {InvalidResponse} from '../index.js'; -import JenkinsBase from './jenkins-base.js'; -import {buildTreeParamQueryString, buildUrl, queryParamSchema} from './jenkins-common.js'; +import Joi from 'joi' +import { + documentation, + testResultQueryParamSchema, + renderTestResultBadge, +} from '../test-results.js' +import { optionalNonNegativeInteger } from '../validators.js' +import { InvalidResponse } from '../index.js' +import JenkinsBase from './jenkins-base.js' +import { + buildTreeParamQueryString, + buildUrl, + queryParamSchema, +} from './jenkins-common.js' // In the API response, the `actions` array can be empty, and when it is not empty it will contain a // mix of objects. Some will be empty objects, and several will not have the test count properties. @@ -125,4 +133,4 @@ export default class JenkinsTests extends JenkinsBase { skippedLabel, }) } -}; +} diff --git a/services/jenkins/jenkins-tests.tester.js b/services/jenkins/jenkins-tests.tester.js index d576ef2f5f995..a9269c9bd6747 100644 --- a/services/jenkins/jenkins-tests.tester.js +++ b/services/jenkins/jenkins-tests.tester.js @@ -1,5 +1,10 @@ -import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { + isDefaultTestTotals, + isDefaultCompactTestTotals, + isCustomTestTotals, + isCustomCompactTestTotals, +} from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // The below page includes links to various publicly accessible Jenkins instances diff --git a/services/jetbrains/jetbrains-base.js b/services/jetbrains/jetbrains-base.js index af6ed9ab1776c..140a94b2a7559 100644 --- a/services/jetbrains/jetbrains-base.js +++ b/services/jetbrains/jetbrains-base.js @@ -1,5 +1,5 @@ -import {BaseXmlService, NotFound} from '../index.js'; -import {parseJson} from '../../core/base-service/json.js'; +import { BaseXmlService, NotFound } from '../index.js' +import { parseJson } from '../../core/base-service/json.js' /* JetBrains is a bit awkward. Sometimes we want to call an XML API @@ -10,7 +10,7 @@ inherit from BaseJsonService directly. */ export default class JetbrainsBase extends BaseXmlService { static _isLegacyPluginId(pluginId) { - return !pluginId.match(/^([0-9])+/); + return !pluginId.match(/^([0-9])+/) } static _cleanPluginId(pluginId) { @@ -67,4 +67,4 @@ export default class JetbrainsBase extends BaseXmlService { const json = this._parseJson(buffer) return this.constructor._validateJson(json, schema) } -}; +} diff --git a/services/jetbrains/jetbrains-downloads.service.js b/services/jetbrains/jetbrains-downloads.service.js index 73fe262373e10..ab379c5eb7e4d 100644 --- a/services/jetbrains/jetbrains-downloads.service.js +++ b/services/jetbrains/jetbrains-downloads.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import JetbrainsBase from './jetbrains-base.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import JetbrainsBase from './jetbrains-base.js' const intelliJschema = Joi.object({ 'plugin-repository': Joi.object({ @@ -71,4 +71,4 @@ export default class JetbrainsDownloads extends JetbrainsBase { return this.constructor.render({ downloads }) } -}; +} diff --git a/services/jetbrains/jetbrains-downloads.tester.js b/services/jetbrains/jetbrains-downloads.tester.js index 86b49cfa2891c..06c30636474e2 100644 --- a/services/jetbrains/jetbrains-downloads.tester.js +++ b/services/jetbrains/jetbrains-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('downloads (number as a plugin id)') diff --git a/services/jetbrains/jetbrains-rating.service.js b/services/jetbrains/jetbrains-rating.service.js index e604dd3da2d8a..55ae8696273dd 100644 --- a/services/jetbrains/jetbrains-rating.service.js +++ b/services/jetbrains/jetbrains-rating.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {starRating} from '../text-formatters.js'; -import {colorScale} from '../color-formatters.js'; -import JetbrainsBase from './jetbrains-base.js'; +import Joi from 'joi' +import { starRating } from '../text-formatters.js' +import { colorScale } from '../color-formatters.js' +import JetbrainsBase from './jetbrains-base.js' const pluginRatingColor = colorScale([2, 3, 4]) @@ -94,4 +94,4 @@ export default class JetbrainsRating extends JetbrainsBase { return this.constructor.render({ rating, format }) } -}; +} diff --git a/services/jetbrains/jetbrains-rating.tester.js b/services/jetbrains/jetbrains-rating.tester.js index 8913cc2988f28..b80d03c5ad824 100644 --- a/services/jetbrains/jetbrains-rating.tester.js +++ b/services/jetbrains/jetbrains-rating.tester.js @@ -1,5 +1,5 @@ -import {withRegex, isStarRating} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex, isStarRating } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isRating = withRegex(/^(([0-4](.?([0-9]))?)|5)\/5$/) diff --git a/services/jetbrains/jetbrains-version.service.js b/services/jetbrains/jetbrains-version.service.js index b03285b748a10..2b7d8dd3b2b07 100644 --- a/services/jetbrains/jetbrains-version.service.js +++ b/services/jetbrains/jetbrains-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import JetbrainsBase from './jetbrains-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import JetbrainsBase from './jetbrains-base.js' const intelliJschema = Joi.object({ 'plugin-repository': Joi.object({ @@ -74,4 +74,4 @@ export default class JetbrainsVersion extends JetbrainsBase { return this.constructor.render({ version }) } -}; +} diff --git a/services/jetbrains/jetbrains-version.tester.js b/services/jetbrains/jetbrains-version.tester.js index ad3741af64ca0..5a4d477e62cd6 100644 --- a/services/jetbrains/jetbrains-version.tester.js +++ b/services/jetbrains/jetbrains-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClauses} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClauses } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version (user friendly plugin id)') diff --git a/services/jira/jira-common.js b/services/jira/jira-common.js index 2ded05438deab..546435a14f4b2 100644 --- a/services/jira/jira-common.js +++ b/services/jira/jira-common.js @@ -4,4 +4,4 @@ const authConfig = { serviceKey: 'jira', } -export { authConfig }; +export { authConfig } diff --git a/services/jira/jira-issue-redirect.service.js b/services/jira/jira-issue-redirect.service.js index e6d42b3fda771..8f7f2b9f587ff 100644 --- a/services/jira/jira-issue-redirect.service.js +++ b/services/jira/jira-issue-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -13,4 +13,4 @@ export default [ }), dateAdded: new Date('2019-09-14'), }), -]; +] diff --git a/services/jira/jira-issue-redirect.tester.js b/services/jira/jira-issue-redirect.tester.js index 983fbdab9043e..b414839c47ac3 100644 --- a/services/jira/jira-issue-redirect.tester.js +++ b/services/jira/jira-issue-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JiraIssueRedirect', diff --git a/services/jira/jira-issue.service.js b/services/jira/jira-issue.service.js index da78639fccb52..35fafa60a3a9b 100644 --- a/services/jira/jira-issue.service.js +++ b/services/jira/jira-issue.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; -import {authConfig} from './jira-common.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' +import { authConfig } from './jira-common.js' const queryParamSchema = Joi.object({ baseUrl: optionalUrl.required(), @@ -91,4 +91,4 @@ export default class JiraIssue extends BaseJsonService { statusColor, }) } -}; +} diff --git a/services/jira/jira-issue.spec.js b/services/jira/jira-issue.spec.js index 3d2eefd33f390..10ff23efd3762 100644 --- a/services/jira/jira-issue.spec.js +++ b/services/jira/jira-issue.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import JiraIssue from './jira-issue.service.js'; -import {user, pass, host, config} from './jira-test-helpers.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import JiraIssue from './jira-issue.service.js' +import { user, pass, host, config } from './jira-test-helpers.js' describe('JiraIssue', function () { cleanUpNockAfterEach() diff --git a/services/jira/jira-issue.tester.js b/services/jira/jira-issue.tester.js index 551e05c2f8f03..faab0a4ebbcfc 100644 --- a/services/jira/jira-issue.tester.js +++ b/services/jira/jira-issue.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('unknown issue') diff --git a/services/jira/jira-sprint-redirect.service.js b/services/jira/jira-sprint-redirect.service.js index 32ff4da3e20c9..54dec2a42f509 100644 --- a/services/jira/jira-sprint-redirect.service.js +++ b/services/jira/jira-sprint-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -13,4 +13,4 @@ export default [ }), dateAdded: new Date('2019-09-14'), }), -]; +] diff --git a/services/jira/jira-sprint-redirect.tester.js b/services/jira/jira-sprint-redirect.tester.js index 7610665e4d682..86c417106a0e6 100644 --- a/services/jira/jira-sprint-redirect.tester.js +++ b/services/jira/jira-sprint-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JiraSprintRedirect', diff --git a/services/jira/jira-sprint.service.js b/services/jira/jira-sprint.service.js index 9582e0c79eea3..875a85e92cff8 100644 --- a/services/jira/jira-sprint.service.js +++ b/services/jira/jira-sprint.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService} from '../index.js'; -import {authConfig} from './jira-common.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseJsonService } from '../index.js' +import { authConfig } from './jira-common.js' const queryParamSchema = Joi.object({ baseUrl: optionalUrl.required(), @@ -109,4 +109,4 @@ export default class JiraSprint extends BaseJsonService { return this.constructor.render({ numTotalIssues, numCompletedIssues }) } -}; +} diff --git a/services/jira/jira-sprint.spec.js b/services/jira/jira-sprint.spec.js index fb93c2a73f25e..8bcead5bb2e27 100644 --- a/services/jira/jira-sprint.spec.js +++ b/services/jira/jira-sprint.spec.js @@ -1,8 +1,15 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import JiraSprint from './jira-sprint.service.js'; -import {user, pass, host, config, sprintId, sprintQueryString} from './jira-test-helpers.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import JiraSprint from './jira-sprint.service.js' +import { + user, + pass, + host, + config, + sprintId, + sprintQueryString, +} from './jira-test-helpers.js' describe('JiraSprint', function () { cleanUpNockAfterEach() diff --git a/services/jira/jira-sprint.tester.js b/services/jira/jira-sprint.tester.js index 4b873e4b0d046..997b3aaf55c2f 100644 --- a/services/jira/jira-sprint.tester.js +++ b/services/jira/jira-sprint.tester.js @@ -1,6 +1,6 @@ -import {createServiceTester} from '../tester.js' -import {isIntegerPercentage} from '../test-validators.js'; -import {sprintId, sprintQueryString} from './jira-test-helpers.js'; +import { createServiceTester } from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { sprintId, sprintQueryString } from './jira-test-helpers.js' export const t = await createServiceTester() t.create('unknown sprint') diff --git a/services/jira/jira-test-helpers.js b/services/jira/jira-test-helpers.js index fc9ca408434c7..e188179146bc5 100644 --- a/services/jira/jira-test-helpers.js +++ b/services/jira/jira-test-helpers.js @@ -19,11 +19,4 @@ const config = { private: { jira_user: user, jira_pass: pass }, } -export { - sprintId, - sprintQueryString, - user, - pass, - host, - config, -}; +export { sprintId, sprintQueryString, user, pass, host, config } diff --git a/services/jitpack/jitpack-downloads.service.js b/services/jitpack/jitpack-downloads.service.js index fd78726eace48..b50ca6b519ad6 100644 --- a/services/jitpack/jitpack-downloads.service.js +++ b/services/jitpack/jitpack-downloads.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ route: { @@ -8,4 +8,4 @@ export default deprecatedService({ label: 'jitpack', category: 'downloads', dateAdded: new Date('2020-04-05'), -}); +}) diff --git a/services/jitpack/jitpack-downloads.tester.js b/services/jitpack/jitpack-downloads.tester.js index 01efff3fabaef..3e7fb42db05ed 100644 --- a/services/jitpack/jitpack-downloads.tester.js +++ b/services/jitpack/jitpack-downloads.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JitPackDownloads', diff --git a/services/jitpack/jitpack-version-redirector.service.js b/services/jitpack/jitpack-version-redirector.service.js index ad5ec714c9ac5..bda5c01485ae0 100644 --- a/services/jitpack/jitpack-version-redirector.service.js +++ b/services/jitpack/jitpack-version-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -11,4 +11,4 @@ export default [ `/jitpack/v/github/${groupId}/${artifactId}`, dateAdded: new Date('2019-03-31'), }), -]; +] diff --git a/services/jitpack/jitpack-version-redirector.tester.js b/services/jitpack/jitpack-version-redirector.tester.js index bcab419915165..deb2b820cfe4b 100644 --- a/services/jitpack/jitpack-version-redirector.tester.js +++ b/services/jitpack/jitpack-version-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'JitpackVersionRedirect', diff --git a/services/jitpack/jitpack-version.service.js b/services/jitpack/jitpack-version.service.js index d463e8028cf05..e739e06ce8a4d 100644 --- a/services/jitpack/jitpack-version.service.js +++ b/services/jitpack/jitpack-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ version: Joi.string().required(), @@ -44,4 +44,4 @@ export default class JitPackVersion extends BaseJsonService { const { version } = await this.fetch({ vcs, user, repo }) return renderVersionBadge({ version }) } -}; +} diff --git a/services/jitpack/jitpack-version.tester.js b/services/jitpack/jitpack-version.tester.js index 8ce17264baee6..5d7322f8e3dfc 100644 --- a/services/jitpack/jitpack-version.tester.js +++ b/services/jitpack/jitpack-version.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Github allows versions with chars, etc. diff --git a/services/jsdelivr/jsdelivr-base.js b/services/jsdelivr/jsdelivr-base.js index 04a2145e3343d..be2b3495fe368 100644 --- a/services/jsdelivr/jsdelivr-base.js +++ b/services/jsdelivr/jsdelivr-base.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {downloadCount} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { downloadCount } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ total: Joi.number().required(), @@ -29,4 +29,4 @@ class BaseJsDelivrService extends BaseJsonService { } } -export { schema, periodMap, BaseJsDelivrService }; +export { schema, periodMap, BaseJsDelivrService } diff --git a/services/jsdelivr/jsdelivr-hits-github.service.js b/services/jsdelivr/jsdelivr-hits-github.service.js index 7fe707b7d55db..8d760b899266f 100644 --- a/services/jsdelivr/jsdelivr-hits-github.service.js +++ b/services/jsdelivr/jsdelivr-hits-github.service.js @@ -1,4 +1,4 @@ -import {schema, periodMap, BaseJsDelivrService} from './jsdelivr-base.js'; +import { schema, periodMap, BaseJsDelivrService } from './jsdelivr-base.js' export default class JsDelivrHitsGitHub extends BaseJsDelivrService { static route = { @@ -29,4 +29,4 @@ export default class JsDelivrHitsGitHub extends BaseJsDelivrService { const { total } = await this.fetch({ period, user, repo }) return this.constructor.render({ period, hits: total }) } -}; +} diff --git a/services/jsdelivr/jsdelivr-hits-github.tester.js b/services/jsdelivr/jsdelivr-hits-github.tester.js index a81d8a66b4142..48231e1fd8436 100644 --- a/services/jsdelivr/jsdelivr-hits-github.tester.js +++ b/services/jsdelivr/jsdelivr-hits-github.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { + isMetricOverTimePeriod, + isZeroOverTimePeriod, +} from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isDownloadsOverTimePeriod = Joi.alternatives().try( diff --git a/services/jsdelivr/jsdelivr-hits-npm.service.js b/services/jsdelivr/jsdelivr-hits-npm.service.js index f82acca68eda4..79db7f7f557d7 100644 --- a/services/jsdelivr/jsdelivr-hits-npm.service.js +++ b/services/jsdelivr/jsdelivr-hits-npm.service.js @@ -1,4 +1,4 @@ -import {schema, periodMap, BaseJsDelivrService} from './jsdelivr-base.js'; +import { schema, periodMap, BaseJsDelivrService } from './jsdelivr-base.js' export default class JsDelivrHitsNPM extends BaseJsDelivrService { static route = { @@ -42,4 +42,4 @@ export default class JsDelivrHitsNPM extends BaseJsDelivrService { }) return this.constructor.render({ period, hits: total }) } -}; +} diff --git a/services/jsdelivr/jsdelivr-hits-npm.tester.js b/services/jsdelivr/jsdelivr-hits-npm.tester.js index 92bfb94a2df9a..2c41ed9fe828b 100644 --- a/services/jsdelivr/jsdelivr-hits-npm.tester.js +++ b/services/jsdelivr/jsdelivr-hits-npm.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {isMetricOverTimePeriod, isZeroOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { + isMetricOverTimePeriod, + isZeroOverTimePeriod, +} from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isDownloadsOverTimePeriod = Joi.alternatives().try( diff --git a/services/keybase/keybase-btc.service.js b/services/keybase/keybase-btc.service.js index 69d4e38095eeb..1ef7d547ff6c3 100644 --- a/services/keybase/keybase-btc.service.js +++ b/services/keybase/keybase-btc.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import KeybaseProfile from './keybase-profile.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import KeybaseProfile from './keybase-profile.js' const bitcoinAddressSchema = Joi.object({ status: Joi.object({ @@ -81,4 +81,4 @@ export default class KeybaseBTC extends KeybaseProfile { return this.constructor.render({ address: bitcoinAddresses[0].address }) } -}; +} diff --git a/services/keybase/keybase-btc.tester.js b/services/keybase/keybase-btc.tester.js index 9ba36a0ba2fe8..01e4531ad8d68 100644 --- a/services/keybase/keybase-btc.tester.js +++ b/services/keybase/keybase-btc.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('existing bitcoin address') diff --git a/services/keybase/keybase-pgp.service.js b/services/keybase/keybase-pgp.service.js index 6dd087cc63920..117a6f2582f66 100644 --- a/services/keybase/keybase-pgp.service.js +++ b/services/keybase/keybase-pgp.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import KeybaseProfile from './keybase-profile.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import KeybaseProfile from './keybase-profile.js' const keyFingerprintSchema = Joi.object({ status: Joi.object({ @@ -74,4 +74,4 @@ export default class KeybasePGP extends KeybaseProfile { return this.constructor.render({ fingerprint: primaryKey.key_fingerprint }) } -}; +} diff --git a/services/keybase/keybase-pgp.tester.js b/services/keybase/keybase-pgp.tester.js index d51bec66b7d53..4a964597d2fa2 100644 --- a/services/keybase/keybase-pgp.tester.js +++ b/services/keybase/keybase-pgp.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('existing key fingerprint') diff --git a/services/keybase/keybase-profile.js b/services/keybase/keybase-profile.js index 45fa744c897df..1949c524578af 100644 --- a/services/keybase/keybase-profile.js +++ b/services/keybase/keybase-profile.js @@ -1,4 +1,4 @@ -import {BaseJsonService, NotFound} from '../index.js'; +import { BaseJsonService, NotFound } from '../index.js' export default class KeybaseProfile extends BaseJsonService { static get apiVersion() { @@ -30,4 +30,4 @@ export default class KeybaseProfile extends BaseJsonService { return { user: data.them[0] } } -}; +} diff --git a/services/keybase/keybase-xlm.service.js b/services/keybase/keybase-xlm.service.js index fe1645ff2889f..652f0a0b3af9a 100644 --- a/services/keybase/keybase-xlm.service.js +++ b/services/keybase/keybase-xlm.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import KeybaseProfile from './keybase-profile.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import KeybaseProfile from './keybase-profile.js' const stellarAddressSchema = Joi.object({ status: Joi.object({ @@ -79,4 +79,4 @@ export default class KeybaseXLM extends KeybaseProfile { return this.constructor.render({ address: accountId }) } -}; +} diff --git a/services/keybase/keybase-xlm.tester.js b/services/keybase/keybase-xlm.tester.js index 6ca00d3837657..ce8b78637cd65 100644 --- a/services/keybase/keybase-xlm.tester.js +++ b/services/keybase/keybase-xlm.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('existing stellar address') diff --git a/services/keybase/keybase-zec.service.js b/services/keybase/keybase-zec.service.js index 79f066f5e63a6..0e367a9dfcae2 100644 --- a/services/keybase/keybase-zec.service.js +++ b/services/keybase/keybase-zec.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import KeybaseProfile from './keybase-profile.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import KeybaseProfile from './keybase-profile.js' const zcachAddressSchema = Joi.object({ status: Joi.object({ @@ -81,4 +81,4 @@ export default class KeybaseZEC extends KeybaseProfile { return this.constructor.render({ address: zcashAddresses[0].address }) } -}; +} diff --git a/services/keybase/keybase-zec.tester.js b/services/keybase/keybase-zec.tester.js index 198ebc2c0d348..f38a394116a0a 100644 --- a/services/keybase/keybase-zec.tester.js +++ b/services/keybase/keybase-zec.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('existing zcash address') diff --git a/services/leanpub/leanpub-book-summary.service.js b/services/leanpub/leanpub-book-summary.service.js index 44cb3a36b0716..8328862ad3265 100644 --- a/services/leanpub/leanpub-book-summary.service.js +++ b/services/leanpub/leanpub-book-summary.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ route: { @@ -8,4 +8,4 @@ export default deprecatedService({ category: 'funding', label: 'leanpub', dateAdded: new Date('2019-12-30'), -}); +}) diff --git a/services/leanpub/leanpub-book-summary.tester.js b/services/leanpub/leanpub-book-summary.tester.js index e3ab0e65ce803..feef7ffd306d9 100644 --- a/services/leanpub/leanpub-book-summary.tester.js +++ b/services/leanpub/leanpub-book-summary.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'LeanPub', diff --git a/services/lgtm/lgtm-alerts.service.js b/services/lgtm/lgtm-alerts.service.js index 87e32a3aeeaa6..814dce1d6352e 100644 --- a/services/lgtm/lgtm-alerts.service.js +++ b/services/lgtm/lgtm-alerts.service.js @@ -1,5 +1,5 @@ -import {metric} from '../text-formatters.js'; -import LgtmBaseService from './lgtm-base.js'; +import { metric } from '../text-formatters.js' +import LgtmBaseService from './lgtm-base.js' export default class LgtmAlerts extends LgtmBaseService { static route = { @@ -42,4 +42,4 @@ export default class LgtmAlerts extends LgtmBaseService { const { alerts } = await this.fetch({ host, user, repo }) return this.constructor.render({ alerts }) } -}; +} diff --git a/services/lgtm/lgtm-alerts.tester.js b/services/lgtm/lgtm-alerts.tester.js index 5358a8e95b01e..ed747c5a3d419 100644 --- a/services/lgtm/lgtm-alerts.tester.js +++ b/services/lgtm/lgtm-alerts.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {data} from './lgtm-test-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { data } from './lgtm-test-helpers.js' export const t = await createServiceTester() t.create('alerts: total alerts for a project') diff --git a/services/lgtm/lgtm-base.js b/services/lgtm/lgtm-base.js index a32e47f6cb6e7..ed1e12091092d 100644 --- a/services/lgtm/lgtm-base.js +++ b/services/lgtm/lgtm-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ alerts: Joi.number().required(), @@ -39,4 +39,4 @@ export default class LgtmBaseService extends BaseJsonService { }, }) } -}; +} diff --git a/services/lgtm/lgtm-grade.service.js b/services/lgtm/lgtm-grade.service.js index 97e90f5cdaa56..3f196949b428f 100644 --- a/services/lgtm/lgtm-grade.service.js +++ b/services/lgtm/lgtm-grade.service.js @@ -1,4 +1,4 @@ -import LgtmBaseService from './lgtm-base.js'; +import LgtmBaseService from './lgtm-base.js' export default class LgtmGrade extends LgtmBaseService { static route = { @@ -85,4 +85,4 @@ export default class LgtmGrade extends LgtmBaseService { const data = await this.fetch({ host, user, repo }) return this.constructor.render({ language, data }) } -}; +} diff --git a/services/lgtm/lgtm-grade.tester.js b/services/lgtm/lgtm-grade.tester.js index 167cb0a022932..8e8c3ba3f8b59 100644 --- a/services/lgtm/lgtm-grade.tester.js +++ b/services/lgtm/lgtm-grade.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {data} from './lgtm-test-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { data } from './lgtm-test-helpers.js' export const t = await createServiceTester() t.create('grade: missing project') diff --git a/services/lgtm/lgtm-redirector.service.js b/services/lgtm/lgtm-redirector.service.js index a94679fbe016d..bc6bd04806fce 100644 --- a/services/lgtm/lgtm-redirector.service.js +++ b/services/lgtm/lgtm-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' const commonAttrs = { category: 'analysis', @@ -23,4 +23,4 @@ export default [ `/lgtm/grade/${language}/github/${user}/${repo}`, ...commonAttrs, }), -]; +] diff --git a/services/lgtm/lgtm-redirector.tester.js b/services/lgtm/lgtm-redirector.tester.js index 5dcb4c4b6a197..d6d56631813b0 100644 --- a/services/lgtm/lgtm-redirector.tester.js +++ b/services/lgtm/lgtm-redirector.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'LgtmRedirect', diff --git a/services/lgtm/lgtm-test-helpers.js b/services/lgtm/lgtm-test-helpers.js index 22bc59d1228e5..e169d4c6ddd34 100644 --- a/services/lgtm/lgtm-test-helpers.js +++ b/services/lgtm/lgtm-test-helpers.js @@ -11,6 +11,4 @@ const data = { ], } -export { - data, -}; +export { data } diff --git a/services/liberapay/liberapay-base.js b/services/liberapay/liberapay-base.js index ed1fd232465d2..a044844150ccd 100644 --- a/services/liberapay/liberapay-base.js +++ b/services/liberapay/liberapay-base.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {colorScale} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { colorScale } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ npatrons: nonNegativeInteger, @@ -62,8 +62,4 @@ class LiberapayBase extends BaseJsonService { } } -export { - renderCurrencyBadge, - LiberapayBase, - isCurrencyOverTime, -}; +export { renderCurrencyBadge, LiberapayBase, isCurrencyOverTime } diff --git a/services/liberapay/liberapay-gives.service.js b/services/liberapay/liberapay-gives.service.js index 42992ef5f2ffe..127a3a34e8509 100644 --- a/services/liberapay/liberapay-gives.service.js +++ b/services/liberapay/liberapay-gives.service.js @@ -1,5 +1,5 @@ -import {InvalidResponse} from '../index.js'; -import {renderCurrencyBadge, LiberapayBase} from './liberapay-base.js'; +import { InvalidResponse } from '../index.js' +import { renderCurrencyBadge, LiberapayBase } from './liberapay-base.js' export default class LiberapayGives extends LiberapayBase { static route = this.buildRoute('gives') @@ -28,4 +28,4 @@ export default class LiberapayGives extends LiberapayBase { throw new InvalidResponse({ prettyMessage: 'no public giving stats' }) } } -}; +} diff --git a/services/liberapay/liberapay-gives.tester.js b/services/liberapay/liberapay-gives.tester.js index 22c158d6ab4fd..daf77a689f0c3 100644 --- a/services/liberapay/liberapay-gives.tester.js +++ b/services/liberapay/liberapay-gives.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isCurrencyOverTime} from './liberapay-base.js'; +import { createServiceTester } from '../tester.js' +import { isCurrencyOverTime } from './liberapay-base.js' export const t = await createServiceTester() t.create('Giving (valid)').get('/Changaco.json').expectBadge({ diff --git a/services/liberapay/liberapay-goal.service.js b/services/liberapay/liberapay-goal.service.js index c1053e60f4d93..4c7ae71e42767 100644 --- a/services/liberapay/liberapay-goal.service.js +++ b/services/liberapay/liberapay-goal.service.js @@ -1,6 +1,6 @@ -import {colorScale} from '../color-formatters.js'; -import {InvalidResponse} from '../index.js'; -import {LiberapayBase} from './liberapay-base.js'; +import { colorScale } from '../color-formatters.js' +import { InvalidResponse } from '../index.js' +import { LiberapayBase } from './liberapay-base.js' export default class LiberapayGoal extends LiberapayBase { static route = this.buildRoute('goal') @@ -40,4 +40,4 @@ export default class LiberapayGoal extends LiberapayBase { const { percentAchieved } = this.transform({ goal, receiving }) return this.constructor.render({ percentAchieved }) } -}; +} diff --git a/services/liberapay/liberapay-goal.spec.js b/services/liberapay/liberapay-goal.spec.js index 096e9d4137a29..ace4d40c45576 100644 --- a/services/liberapay/liberapay-goal.spec.js +++ b/services/liberapay/liberapay-goal.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {InvalidResponse} from '../index.js'; -import LiberapayGoal from './liberapay-goal.service.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { InvalidResponse } from '../index.js' +import LiberapayGoal from './liberapay-goal.service.js' describe('LiberapayGoal', function () { test(LiberapayGoal.prototype.transform, () => { diff --git a/services/liberapay/liberapay-goal.tester.js b/services/liberapay/liberapay-goal.tester.js index 522a57db0c072..518a84b004107 100644 --- a/services/liberapay/liberapay-goal.tester.js +++ b/services/liberapay/liberapay-goal.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Goal Progress (valid)').get('/Liberapay.json').expectBadge({ diff --git a/services/liberapay/liberapay-patrons.service.js b/services/liberapay/liberapay-patrons.service.js index e0f46649774b2..dbcf4d8639637 100644 --- a/services/liberapay/liberapay-patrons.service.js +++ b/services/liberapay/liberapay-patrons.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {colorScale} from '../color-formatters.js'; -import {LiberapayBase} from './liberapay-base.js'; +import { metric } from '../text-formatters.js' +import { colorScale } from '../color-formatters.js' +import { LiberapayBase } from './liberapay-base.js' export default class LiberapayPatrons extends LiberapayBase { static route = this.buildRoute('patrons') @@ -25,4 +25,4 @@ export default class LiberapayPatrons extends LiberapayBase { const data = await this.fetch({ entity }) return this.constructor.render({ patrons: data.npatrons }) } -}; +} diff --git a/services/liberapay/liberapay-patrons.tester.js b/services/liberapay/liberapay-patrons.tester.js index 8ec17eaeed8db..8c7f780c41cf5 100644 --- a/services/liberapay/liberapay-patrons.tester.js +++ b/services/liberapay/liberapay-patrons.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Patrons (valid)').get('/Liberapay.json').expectBadge({ diff --git a/services/liberapay/liberapay-receives.service.js b/services/liberapay/liberapay-receives.service.js index 1007da63ce9ec..7d828f90bd684 100644 --- a/services/liberapay/liberapay-receives.service.js +++ b/services/liberapay/liberapay-receives.service.js @@ -1,5 +1,5 @@ -import {InvalidResponse} from '../index.js'; -import {renderCurrencyBadge, LiberapayBase} from './liberapay-base.js'; +import { InvalidResponse } from '../index.js' +import { renderCurrencyBadge, LiberapayBase } from './liberapay-base.js' export default class LiberapayReceives extends LiberapayBase { static route = this.buildRoute('receives') @@ -28,4 +28,4 @@ export default class LiberapayReceives extends LiberapayBase { throw new InvalidResponse({ prettyMessage: 'no public receiving stats' }) } } -}; +} diff --git a/services/liberapay/liberapay-receives.tester.js b/services/liberapay/liberapay-receives.tester.js index 60909abc7c79a..17988abc7c7a6 100644 --- a/services/liberapay/liberapay-receives.tester.js +++ b/services/liberapay/liberapay-receives.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isCurrencyOverTime} from './liberapay-base.js'; +import { createServiceTester } from '../tester.js' +import { isCurrencyOverTime } from './liberapay-base.js' export const t = await createServiceTester() t.create('Receiving (valid)').get('/Changaco.json').expectBadge({ diff --git a/services/librariesio/librariesio-common.js b/services/librariesio/librariesio-common.js index e24914233e970..974060a688809 100644 --- a/services/librariesio/librariesio-common.js +++ b/services/librariesio/librariesio-common.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {nonNegativeInteger, anyInteger} from '../validators.js'; +import Joi from 'joi' +import { nonNegativeInteger, anyInteger } from '../validators.js' // API doc: https://libraries.io/api#project const projectSchema = Joi.object({ @@ -19,6 +19,4 @@ async function fetchProject(serviceInstance, { platform, scope, packageName }) { }) } -export { - fetchProject, -}; +export { fetchProject } diff --git a/services/librariesio/librariesio-dependencies-helpers.js b/services/librariesio/librariesio-dependencies-helpers.js index 5ea483f9e269a..7aaaf71536a37 100644 --- a/services/librariesio/librariesio-dependencies-helpers.js +++ b/services/librariesio/librariesio-dependencies-helpers.js @@ -26,4 +26,4 @@ function renderDependenciesBadge({ deprecatedCount, outdatedCount }) { } } -export { transform, renderDependenciesBadge }; +export { transform, renderDependenciesBadge } diff --git a/services/librariesio/librariesio-dependencies-helpers.spec.js b/services/librariesio/librariesio-dependencies-helpers.spec.js index 2badbbf90d5b4..bdc1c3d17a15e 100644 --- a/services/librariesio/librariesio-dependencies-helpers.spec.js +++ b/services/librariesio/librariesio-dependencies-helpers.spec.js @@ -1,5 +1,5 @@ -import {test, given, forCases} from 'sazerac'; -import {renderDependenciesBadge} from './librariesio-dependencies-helpers.js'; +import { test, given, forCases } from 'sazerac' +import { renderDependenciesBadge } from './librariesio-dependencies-helpers.js' describe('Libraries.io dependency helpers', function () { test(renderDependenciesBadge, () => { diff --git a/services/librariesio/librariesio-dependencies.service.js b/services/librariesio/librariesio-dependencies.service.js index 3aed6a5ea8981..05df0e6ae6420 100644 --- a/services/librariesio/librariesio-dependencies.service.js +++ b/services/librariesio/librariesio-dependencies.service.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; -import {transform, renderDependenciesBadge} from './librariesio-dependencies-helpers.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { + transform, + renderDependenciesBadge, +} from './librariesio-dependencies-helpers.js' const schema = Joi.object({ dependencies: Joi.array() @@ -129,4 +132,4 @@ class LibrariesIoRepoDependencies extends BaseJsonService { } } -export default [LibrariesIoProjectDependencies, LibrariesIoRepoDependencies]; +export default [LibrariesIoProjectDependencies, LibrariesIoRepoDependencies] diff --git a/services/librariesio/librariesio-dependencies.tester.js b/services/librariesio/librariesio-dependencies.tester.js index 0fa02a7a0f7a0..6aeb2feda475a 100644 --- a/services/librariesio/librariesio-dependencies.tester.js +++ b/services/librariesio/librariesio-dependencies.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isDependencyState} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isDependencyState } from '../test-validators.js' export const t = new ServiceTester({ id: 'LibrariesIoDependencies', title: 'LibrariesIoDependencies', diff --git a/services/librariesio/librariesio-dependent-repos.service.js b/services/librariesio/librariesio-dependent-repos.service.js index ef5e819835847..0f8217c11bc73 100644 --- a/services/librariesio/librariesio-dependent-repos.service.js +++ b/services/librariesio/librariesio-dependent-repos.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; -import {fetchProject} from './librariesio-common.js'; +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' +import { fetchProject } from './librariesio-common.js' // https://libraries.io/api#project-dependent-repositories export default class LibrariesIoDependentRepos extends BaseJsonService { @@ -55,4 +55,4 @@ export default class LibrariesIoDependentRepos extends BaseJsonService { ) return this.constructor.render({ dependentReposCount }) } -}; +} diff --git a/services/librariesio/librariesio-dependent-repos.tester.js b/services/librariesio/librariesio-dependent-repos.tester.js index 789b38c4230bf..2c7df20c70801 100644 --- a/services/librariesio/librariesio-dependent-repos.tester.js +++ b/services/librariesio/librariesio-dependent-repos.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('dependent repo count') diff --git a/services/librariesio/librariesio-dependents.service.js b/services/librariesio/librariesio-dependents.service.js index 6442486d4185a..ceaf4f5b27817 100644 --- a/services/librariesio/librariesio-dependents.service.js +++ b/services/librariesio/librariesio-dependents.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; -import {fetchProject} from './librariesio-common.js'; +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' +import { fetchProject } from './librariesio-common.js' // https://libraries.io/api#project-dependents export default class LibrariesIoDependents extends BaseJsonService { @@ -52,4 +52,4 @@ export default class LibrariesIoDependents extends BaseJsonService { }) return this.constructor.render({ dependentCount }) } -}; +} diff --git a/services/librariesio/librariesio-dependents.tester.js b/services/librariesio/librariesio-dependents.tester.js index f401b23a752c9..8ca0b4393bd31 100644 --- a/services/librariesio/librariesio-dependents.tester.js +++ b/services/librariesio/librariesio-dependents.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('dependent count').timeout(10000).get('/npm/got.json').expectBadge({ diff --git a/services/librariesio/librariesio-sourcerank.service.js b/services/librariesio/librariesio-sourcerank.service.js index 451c244f0de41..351a668eeff7f 100644 --- a/services/librariesio/librariesio-sourcerank.service.js +++ b/services/librariesio/librariesio-sourcerank.service.js @@ -1,6 +1,6 @@ -import {colorScale} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; -import {fetchProject} from './librariesio-common.js'; +import { colorScale } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' +import { fetchProject } from './librariesio-common.js' const sourceRankColor = colorScale([10, 15, 20, 25, 30]) @@ -53,4 +53,4 @@ export default class LibrariesIoSourcerank extends BaseJsonService { }) return this.constructor.render({ rank }) } -}; +} diff --git a/services/librariesio/librariesio-sourcerank.tester.js b/services/librariesio/librariesio-sourcerank.tester.js index 988fe629a2a7f..7135302de37c1 100644 --- a/services/librariesio/librariesio-sourcerank.tester.js +++ b/services/librariesio/librariesio-sourcerank.tester.js @@ -1,5 +1,5 @@ -import {anyInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { anyInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('sourcerank').timeout(10000).get('/npm/got.json').expectBadge({ diff --git a/services/libscore/libscore.service.js b/services/libscore/libscore.service.js index 7b73f8ef3c5a1..234d53e38f8db 100644 --- a/services/libscore/libscore.service.js +++ b/services/libscore/libscore.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'rating', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'libscore', dateAdded: new Date('2018-09-22'), -}); +}) diff --git a/services/libscore/libscore.tester.js b/services/libscore/libscore.tester.js index 31d5d0592b6eb..bf5ec44d0ce07 100644 --- a/services/libscore/libscore.tester.js +++ b/services/libscore/libscore.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'libscore', title: 'libscore' }) diff --git a/services/licenses.js b/services/licenses.js index df87246b7c92d..9def600c8f591 100644 --- a/services/licenses.js +++ b/services/licenses.js @@ -1,4 +1,4 @@ -import toArray from '../core/base-service/to-array.js'; +import toArray from '../core/base-service/to-array.js' const licenseTypes = { // permissive licenses - not public domain and not copyleft @@ -128,4 +128,4 @@ function renderLicenseBadge({ license, licenses }) { } } -export { licenseToColor, renderLicenseBadge }; +export { licenseToColor, renderLicenseBadge } diff --git a/services/licenses.spec.js b/services/licenses.spec.js index c7044e83937b0..20554dadc7305 100644 --- a/services/licenses.spec.js +++ b/services/licenses.spec.js @@ -1,5 +1,5 @@ -import {test, given, forCases} from 'sazerac'; -import {licenseToColor, renderLicenseBadge} from './licenses.js'; +import { test, given, forCases } from 'sazerac' +import { licenseToColor, renderLicenseBadge } from './licenses.js' describe('license helpers', function () { test(licenseToColor, () => { diff --git a/services/localizely/localizely.service.js b/services/localizely/localizely.service.js index 833ced776b78d..1e8ac60608329 100644 --- a/services/localizely/localizely.service.js +++ b/services/localizely/localizely.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {BaseJsonService, InvalidResponse} from '../index.js'; -import {coveragePercentage} from '../color-formatters.js'; +import Joi from 'joi' +import { BaseJsonService, InvalidResponse } from '../index.js' +import { coveragePercentage } from '../color-formatters.js' const keywords = [ 'l10n', @@ -141,4 +141,4 @@ export default class Localizely extends BaseJsonService { return this.constructor.render({ langName, reviewedProgress }) } -}; +} diff --git a/services/localizely/localizely.tester.js b/services/localizely/localizely.tester.js index f79f8a4d9311f..9f996e287de16 100644 --- a/services/localizely/localizely.tester.js +++ b/services/localizely/localizely.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isIntegerPercentage} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' export const t = await createServiceTester() t.create('Overall progress') diff --git a/services/luarocks/luarocks-version-helpers.js b/services/luarocks/luarocks-version-helpers.js index 88d1ede996c7b..3523f38a5b597 100644 --- a/services/luarocks/luarocks-version-helpers.js +++ b/services/luarocks/luarocks-version-helpers.js @@ -24,7 +24,7 @@ * https://github.com/luarocks/luarocks/blob/405ee29ba8444d97646f62e72effeaff2bfe3f79/src/luarocks/search.lua#L182 * https://github.com/luarocks/luarocks/blob/405ee29ba8444d97646f62e72effeaff2bfe3f79/src/luarocks/core/vers.lua#L83 */ -import {omitv} from '../text-formatters.js'; +import { omitv } from '../text-formatters.js' // Compare two arrays containing split and transformed to // positive/negative numbers parts of version strings, @@ -84,8 +84,4 @@ function latestVersion(versions) { .pop() } -export { - parseVersion, - compareVersionLists, - latestVersion, -}; +export { parseVersion, compareVersionLists, latestVersion } diff --git a/services/luarocks/luarocks-version-helpers.spec.js b/services/luarocks/luarocks-version-helpers.spec.js index 06f721ac1832f..fce50d9acf0ff 100644 --- a/services/luarocks/luarocks-version-helpers.spec.js +++ b/services/luarocks/luarocks-version-helpers.spec.js @@ -1,5 +1,9 @@ -import {test, given, forCases} from 'sazerac'; -import {parseVersion, compareVersionLists, latestVersion} from './luarocks-version-helpers.js'; +import { test, given, forCases } from 'sazerac' +import { + parseVersion, + compareVersionLists, + latestVersion, +} from './luarocks-version-helpers.js' describe('LuaRocks-specific helpers', function () { test(compareVersionLists, () => { diff --git a/services/luarocks/luarocks.service.js b/services/luarocks/luarocks.service.js index 7bc6cef6083b7..2ffb68616afad 100644 --- a/services/luarocks/luarocks.service.js +++ b/services/luarocks/luarocks.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {addv} from '../text-formatters.js'; -import {BaseJsonService, NotFound} from '../index.js'; -import {latestVersion} from './luarocks-version-helpers.js'; +import Joi from 'joi' +import { addv } from '../text-formatters.js' +import { BaseJsonService, NotFound } from '../index.js' +import { latestVersion } from './luarocks-version-helpers.js' const schema = Joi.object({ repository: Joi.object() @@ -86,4 +86,4 @@ export default class Luarocks extends BaseJsonService { } return this.constructor.render({ version }) } -}; +} diff --git a/services/luarocks/luarocks.spec.js b/services/luarocks/luarocks.spec.js index a2e11fcf70715..811ab73ccf72a 100644 --- a/services/luarocks/luarocks.spec.js +++ b/services/luarocks/luarocks.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import Luarocks from './luarocks.service.js'; +import { test, given } from 'sazerac' +import Luarocks from './luarocks.service.js' test(Luarocks.render, () => { given({ version: 'dev-1' }).expect({ message: 'dev-1', color: 'yellow' }) diff --git a/services/luarocks/luarocks.tester.js b/services/luarocks/luarocks.tester.js index e5ffcd690ff17..e82ddcf8eed4f 100644 --- a/services/luarocks/luarocks.tester.js +++ b/services/luarocks/luarocks.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isLuaVersion = Joi.string() diff --git a/services/magnumci/magnumci.service.js b/services/magnumci/magnumci.service.js index fffa239e6a0cc..8830135f3a5f7 100644 --- a/services/magnumci/magnumci.service.js +++ b/services/magnumci/magnumci.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'build', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'magnum ci', dateAdded: new Date('2018-07-08'), -}); +}) diff --git a/services/magnumci/magnumci.tester.js b/services/magnumci/magnumci.tester.js index fef5c1a8d71ee..c42c7f3297d98 100644 --- a/services/magnumci/magnumci.tester.js +++ b/services/magnumci/magnumci.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'magnumci', title: 'Magnum CI' }) diff --git a/services/maintenance/maintenance.service.js b/services/maintenance/maintenance.service.js index ed2cfc4b7f4a3..c38bc236318ff 100644 --- a/services/maintenance/maintenance.service.js +++ b/services/maintenance/maintenance.service.js @@ -1,4 +1,4 @@ -import {BaseService} from '../index.js'; +import { BaseService } from '../index.js' export default class Maintenance extends BaseService { static category = 'other' @@ -72,4 +72,4 @@ export default class Maintenance extends BaseService { message: maintained, }) } -}; +} diff --git a/services/maintenance/maintenance.spec.js b/services/maintenance/maintenance.spec.js index 72f2b76a3619f..cb98567746fd1 100644 --- a/services/maintenance/maintenance.spec.js +++ b/services/maintenance/maintenance.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import Maintenance from './maintenance.service.js'; +import { test, given } from 'sazerac' +import Maintenance from './maintenance.service.js' describe('Maintenance', function () { test(Maintenance.prototype.transform, () => { diff --git a/services/maintenance/maintenance.tester.js b/services/maintenance/maintenance.tester.js index 2e68f673566f0..1fd3dee957477 100644 --- a/services/maintenance/maintenance.tester.js +++ b/services/maintenance/maintenance.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const currentYear = new Date().getUTCFullYear() diff --git a/services/mastodon/mastodon-follow.service.js b/services/mastodon/mastodon-follow.service.js index 9047617d110d6..cea9e509948e7 100644 --- a/services/mastodon/mastodon-follow.service.js +++ b/services/mastodon/mastodon-follow.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {optionalUrl, nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { optionalUrl, nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object({ username: Joi.string().required(), @@ -76,4 +76,4 @@ export default class MastodonFollow extends BaseJsonService { domain, }) } -}; +} diff --git a/services/mastodon/mastodon-follow.tester.js b/services/mastodon/mastodon-follow.tester.js index 51995393683e0..1b792bad8c962 100644 --- a/services/mastodon/mastodon-follow.tester.js +++ b/services/mastodon/mastodon-follow.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Followers - default domain') diff --git a/services/matrix/matrix.service.js b/services/matrix/matrix.service.js index 46442844949b1..d0cdf311e488a 100644 --- a/services/matrix/matrix.service.js +++ b/services/matrix/matrix.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService, InvalidParameter} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService, InvalidParameter } from '../index.js' const queryParamSchema = Joi.object({ server_fqdn: Joi.string().hostname(), @@ -194,4 +194,4 @@ export default class Matrix extends BaseJsonService { const members = await this.fetch({ roomAlias, serverFQDN }) return this.constructor.render({ members }) } -}; +} diff --git a/services/matrix/matrix.tester.js b/services/matrix/matrix.tester.js index 86f796c1eb439..d87857497a2fc 100644 --- a/services/matrix/matrix.tester.js +++ b/services/matrix/matrix.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('get room state as guest') diff --git a/services/maven-central/maven-central.service.js b/services/maven-central/maven-central.service.js index 2cb47457c6dd2..ac5a6b5fcc4e7 100644 --- a/services/maven-central/maven-central.service.js +++ b/services/maven-central/maven-central.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseXmlService, NotFound} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseXmlService, NotFound } from '../index.js' const schema = Joi.object({ metadata: Joi.object({ @@ -77,4 +77,4 @@ export default class MavenCentral extends BaseXmlService { } return renderVersionBadge({ version }) } -}; +} diff --git a/services/maven-central/maven-central.tester.js b/services/maven-central/maven-central.tester.js index 76f8f27299d15..6cb9965d98065 100644 --- a/services/maven-central/maven-central.tester.js +++ b/services/maven-central/maven-central.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClausesWithOptionalSuffix } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('latest version') diff --git a/services/maven-metadata/maven-metadata-redirect.service.js b/services/maven-metadata/maven-metadata-redirect.service.js index bf088ea879861..a7cffcca7c577 100644 --- a/services/maven-metadata/maven-metadata-redirect.service.js +++ b/services/maven-metadata/maven-metadata-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default redirector({ category: 'version', @@ -11,4 +11,4 @@ export default redirector({ metadataUrl: `${protocol}://${hostAndPath}`, }), dateAdded: new Date('2019-09-16'), -}); +}) diff --git a/services/maven-metadata/maven-metadata-redirect.tester.js b/services/maven-metadata/maven-metadata-redirect.tester.js index 6da5ffefb6777..ddd053e8bd129 100644 --- a/services/maven-metadata/maven-metadata-redirect.tester.js +++ b/services/maven-metadata/maven-metadata-redirect.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('maven metadata (badge extension)') diff --git a/services/maven-metadata/maven-metadata.service.js b/services/maven-metadata/maven-metadata.service.js index 5d7a56fb929dc..3f924ecbb807f 100644 --- a/services/maven-metadata/maven-metadata.service.js +++ b/services/maven-metadata/maven-metadata.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {renderVersionBadge} from '../version.js'; -import {BaseXmlService} from '../index.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { renderVersionBadge } from '../version.js' +import { BaseXmlService } from '../index.js' const queryParamSchema = Joi.object({ metadataUrl: optionalUrl.required(), @@ -56,4 +56,4 @@ export default class MavenMetadata extends BaseXmlService { version: data.metadata.versioning.versions.version.slice(-1)[0], }) } -}; +} diff --git a/services/maven-metadata/maven-metadata.tester.js b/services/maven-metadata/maven-metadata.tester.js index 37f1be7753608..50382b9f82504 100644 --- a/services/maven-metadata/maven-metadata.tester.js +++ b/services/maven-metadata/maven-metadata.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' export const t = await createServiceTester() t.create('valid maven-metadata.xml uri') diff --git a/services/microbadger/microbadger-base.js b/services/microbadger/microbadger-base.js index afffbc18f1b2f..0996b1e4e94ae 100644 --- a/services/microbadger/microbadger-base.js +++ b/services/microbadger/microbadger-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object({ LayerCount: nonNegativeInteger, @@ -48,4 +48,4 @@ export default class BaseMicrobadgerService extends BaseJsonService { } return image } -}; +} diff --git a/services/microbadger/microbadger-layers.service.js b/services/microbadger/microbadger-layers.service.js index a46b5e7f4f182..67b75b9ae8344 100644 --- a/services/microbadger/microbadger-layers.service.js +++ b/services/microbadger/microbadger-layers.service.js @@ -1,4 +1,4 @@ -import BaseMicrobadgerService from './microbadger-base.js'; +import BaseMicrobadgerService from './microbadger-base.js' export default class MicrobadgerLayers extends BaseMicrobadgerService { static route = { @@ -37,4 +37,4 @@ export default class MicrobadgerLayers extends BaseMicrobadgerService { const image = this.constructor.getImage(data, tag) return this.constructor.render({ layers: image.LayerCount }) } -}; +} diff --git a/services/microbadger/microbadger-layers.tester.js b/services/microbadger/microbadger-layers.tester.js index ace6a63f89ae8..73b31933d61b8 100644 --- a/services/microbadger/microbadger-layers.tester.js +++ b/services/microbadger/microbadger-layers.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('layers without a specified tag') diff --git a/services/microbadger/microbadger-size.service.js b/services/microbadger/microbadger-size.service.js index 2b784d0e1ec18..3443f36465d45 100644 --- a/services/microbadger/microbadger-size.service.js +++ b/services/microbadger/microbadger-size.service.js @@ -1,6 +1,6 @@ -import prettyBytes from 'pretty-bytes'; -import {NotFound} from '../index.js'; -import BaseMicrobadgerService from './microbadger-base.js'; +import prettyBytes from 'pretty-bytes' +import { NotFound } from '../index.js' +import BaseMicrobadgerService from './microbadger-base.js' const documentation = `

@@ -69,4 +69,4 @@ export default class MicrobadgerSize extends BaseMicrobadgerService { } return this.constructor.render({ size: image.DownloadSize }) } -}; +} diff --git a/services/microbadger/microbadger-size.tester.js b/services/microbadger/microbadger-size.tester.js index d6066b26a8bc9..b7f11cb0e7ce8 100644 --- a/services/microbadger/microbadger-size.tester.js +++ b/services/microbadger/microbadger-size.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('image size without a specified tag') diff --git a/services/mozilla-observatory/mozilla-observatory.service.js b/services/mozilla-observatory/mozilla-observatory.service.js index 688fa22ed8093..8f436056c2d0d 100644 --- a/services/mozilla-observatory/mozilla-observatory.service.js +++ b/services/mozilla-observatory/mozilla-observatory.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ state: Joi.string() @@ -112,4 +112,4 @@ export default class MozillaObservatory extends BaseJsonService { const { state, grade, score } = await this.fetch({ host, publish }) return this.constructor.render({ format, state, grade, score }) } -}; +} diff --git a/services/mozilla-observatory/mozilla-observatory.tester.js b/services/mozilla-observatory/mozilla-observatory.tester.js index 6996cc42f1ee4..b3f73f658d512 100644 --- a/services/mozilla-observatory/mozilla-observatory.tester.js +++ b/services/mozilla-observatory/mozilla-observatory.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isMessage = Joi.alternatives() diff --git a/services/myget/myget.service.js b/services/myget/myget.service.js index 4d29b76f9b6a5..8b654e6ffc31f 100644 --- a/services/myget/myget.service.js +++ b/services/myget/myget.service.js @@ -1,4 +1,4 @@ -import {createServiceFamily} from '../nuget/nuget-v3-service-family.js'; +import { createServiceFamily } from '../nuget/nuget-v3-service-family.js' const { NugetVersionService: Version, NugetDownloadService: Downloads } = createServiceFamily({ @@ -55,7 +55,4 @@ class MyGetDownloadService extends Downloads { ] } -export { - MyGetVersionService, - MyGetDownloadService, -}; +export { MyGetVersionService, MyGetDownloadService } diff --git a/services/myget/myget.tester.js b/services/myget/myget.tester.js index ac8f57d1b566a..7b3e9ec5a6e08 100644 --- a/services/myget/myget.tester.js +++ b/services/myget/myget.tester.js @@ -1,7 +1,15 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -import {queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero} from '../nuget-fixtures.js'; -import {invalidJSON} from '../response-fixtures.js'; +import { ServiceTester } from '../tester.js' +import { + isMetric, + isVPlusDottedVersionNClausesWithOptionalSuffix, +} from '../test-validators.js' +import { + queryIndex, + nuGetV3VersionJsonWithDash, + nuGetV3VersionJsonFirstCharZero, + nuGetV3VersionJsonFirstCharNotZero, +} from '../nuget-fixtures.js' +import { invalidJSON } from '../response-fixtures.js' export const t = new ServiceTester({ id: 'myget', diff --git a/services/netlify/netlify.service.js b/services/netlify/netlify.service.js index f2ab3da6080e1..3feefa4165161 100644 --- a/services/netlify/netlify.service.js +++ b/services/netlify/netlify.service.js @@ -1,5 +1,5 @@ -import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '../index.js'; +import { renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService } from '../index.js' const pendingStatus = 'building' const notBuiltStatus = 'not built' @@ -62,4 +62,4 @@ export default class Netlify extends BaseSvgScrapingService { const { message: status } = await this.fetch({ projectId, branch }) return this.constructor.render({ status }) } -}; +} diff --git a/services/netlify/netlify.spec.js b/services/netlify/netlify.spec.js index 9fa88bb3625de..c614e5ee62e1b 100644 --- a/services/netlify/netlify.spec.js +++ b/services/netlify/netlify.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import Netlify from './netlify.service.js'; +import { test, given } from 'sazerac' +import Netlify from './netlify.service.js' const building = { message: 'building', label: undefined, color: 'yellow' } const notBuilt = { message: 'not built', label: undefined, color: undefined } diff --git a/services/netlify/netlify.tester.js b/services/netlify/netlify.tester.js index ef99bface87ff..8d9d8a03eab98 100644 --- a/services/netlify/netlify.tester.js +++ b/services/netlify/netlify.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('netlify (valid, no branch)') diff --git a/services/nexus/nexus-redirect.service.js b/services/nexus/nexus-redirect.service.js index ac06886554022..12878567219c8 100644 --- a/services/nexus/nexus-redirect.service.js +++ b/services/nexus/nexus-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -16,4 +16,4 @@ export default [ }), dateAdded: new Date('2019-07-26'), }), -]; +] diff --git a/services/nexus/nexus-redirect.tester.js b/services/nexus/nexus-redirect.tester.js index bfd1c6815b075..294b0f67143ad 100644 --- a/services/nexus/nexus-redirect.tester.js +++ b/services/nexus/nexus-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'NexusRedirect', diff --git a/services/nexus/nexus-version.js b/services/nexus/nexus-version.js index dc621af6592c6..0adb7bf42527f 100644 --- a/services/nexus/nexus-version.js +++ b/services/nexus/nexus-version.js @@ -3,6 +3,4 @@ function isSnapshotVersion(version) { return version && version.match(pattern) } -export { - isSnapshotVersion, -}; +export { isSnapshotVersion } diff --git a/services/nexus/nexus.service.js b/services/nexus/nexus.service.js index 60c084027668e..67451ef0c929e 100644 --- a/services/nexus/nexus.service.js +++ b/services/nexus/nexus.service.js @@ -1,9 +1,12 @@ -import Joi from 'joi'; -import {version as versionColor} from '../color-formatters.js'; -import {addv} from '../text-formatters.js'; -import {optionalUrl, optionalDottedVersionNClausesWithOptionalSuffix} from '../validators.js'; -import {BaseJsonService, InvalidResponse, NotFound} from '../index.js'; -import {isSnapshotVersion} from './nexus-version.js'; +import Joi from 'joi' +import { version as versionColor } from '../color-formatters.js' +import { addv } from '../text-formatters.js' +import { + optionalUrl, + optionalDottedVersionNClausesWithOptionalSuffix, +} from '../validators.js' +import { BaseJsonService, InvalidResponse, NotFound } from '../index.js' +import { isSnapshotVersion } from './nexus-version.js' const nexus2SearchApiSchema = Joi.object({ data: Joi.array() @@ -332,4 +335,4 @@ export default class Nexus extends BaseJsonService { const { version } = this.transform({ repo, json, actualNexusVersion }) return this.constructor.render({ version }) } -}; +} diff --git a/services/nexus/nexus.spec.js b/services/nexus/nexus.spec.js index 63d3b3266e22e..43104b8307da8 100644 --- a/services/nexus/nexus.spec.js +++ b/services/nexus/nexus.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import {InvalidResponse, NotFound} from '../index.js'; -import Nexus from './nexus.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import { InvalidResponse, NotFound } from '../index.js' +import Nexus from './nexus.service.js' describe('Nexus', function () { context('transform2()', function () { diff --git a/services/nexus/nexus.tester.js b/services/nexus/nexus.tester.js index ba74f2bd12154..f3c7d5c31ec26 100644 --- a/services/nexus/nexus.tester.js +++ b/services/nexus/nexus.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionNClausesWithOptionalSuffix as isVersion} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionNClausesWithOptionalSuffix as isVersion } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Nexus 2 - search release version valid artifact') diff --git a/services/node/node-base.js b/services/node/node-base.js index 90932c84fff4d..61f049595eec9 100644 --- a/services/node/node-base.js +++ b/services/node/node-base.js @@ -1,4 +1,4 @@ -import NPMBase from '../npm/npm-base.js'; +import NPMBase from '../npm/npm-base.js' const keywords = ['npm'] @@ -117,4 +117,4 @@ export default class NodeVersionBase extends NPMBase { return this.constructor.render({ tag, nodeVersionRange }) } -}; +} diff --git a/services/node/node-current.service.js b/services/node/node-current.service.js index 32ab3a42c0f71..4494641fc1f75 100644 --- a/services/node/node-current.service.js +++ b/services/node/node-current.service.js @@ -1,5 +1,5 @@ -import NodeVersionBase from './node-base.js'; -import {versionColorForRangeCurrent} from './node-version-color.js'; +import NodeVersionBase from './node-base.js' +import { versionColorForRangeCurrent } from './node-version-color.js' export default class NodeCurrentVersion extends NodeVersionBase { static route = this.buildRoute('node/v', { withTag: true }) @@ -13,4 +13,4 @@ export default class NodeCurrentVersion extends NodeVersionBase { static colorResolver = versionColorForRangeCurrent static documentation = `This badge indicates whether the package supports the latest release of node` -}; +} diff --git a/services/node/node-current.spec.js b/services/node/node-current.spec.js index 1981232f5566b..11cff97eefaa8 100644 --- a/services/node/node-current.spec.js +++ b/services/node/node-current.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import NodeVersion from './node-current.service.js'; +import { test, given } from 'sazerac' +import NodeVersion from './node-current.service.js' describe('node static renderStaticPreview', function () { it('should have parity with render()', async function () { diff --git a/services/node/node-current.tester.js b/services/node/node-current.tester.js index cd99c47df366c..7d50fa272df0a 100644 --- a/services/node/node-current.tester.js +++ b/services/node/node-current.tester.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import semverModule from 'semver'; -import {createServiceTester} from '../tester.js' -import {mockPackageData, mockCurrentSha} from './testUtils/test-utils.js'; -const {Range} = semverModule; +import { expect } from 'chai' +import semverModule from 'semver' +import { createServiceTester } from '../tester.js' +import { mockPackageData, mockCurrentSha } from './testUtils/test-utils.js' +const { Range } = semverModule export const t = await createServiceTester() function expectSemverRange(message) { diff --git a/services/node/node-lts.service.js b/services/node/node-lts.service.js index 929550d83e7cd..934e2ff71912d 100644 --- a/services/node/node-lts.service.js +++ b/services/node/node-lts.service.js @@ -1,5 +1,5 @@ -import NodeVersionBase from './node-base.js'; -import {versionColorForRangeLts} from './node-version-color.js'; +import NodeVersionBase from './node-base.js' +import { versionColorForRangeLts } from './node-version-color.js' export default class NodeLtsVersion extends NodeVersionBase { static route = this.buildRoute('node/v-lts', { withTag: true }) @@ -13,4 +13,4 @@ export default class NodeLtsVersion extends NodeVersionBase { static colorResolver = versionColorForRangeLts static documentation = `This badge indicates whether the package supports all LTS node versions` -}; +} diff --git a/services/node/node-lts.spec.js b/services/node/node-lts.spec.js index 782b9300e9608..cc3711731065d 100644 --- a/services/node/node-lts.spec.js +++ b/services/node/node-lts.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import NodeVersion from './node-lts.service.js'; +import { test, given } from 'sazerac' +import NodeVersion from './node-lts.service.js' describe('node-lts renderStaticPreview', function () { it('should have parity with render()', async function () { diff --git a/services/node/node-lts.tester.js b/services/node/node-lts.tester.js index 2be1b3359e35e..016604c21df79 100644 --- a/services/node/node-lts.tester.js +++ b/services/node/node-lts.tester.js @@ -1,8 +1,12 @@ -import {expect} from 'chai'; -import semverModule from 'semver'; -import {createServiceTester} from '../tester.js' -import {mockPackageData, mockReleaseSchedule, mockVersionsSha} from './testUtils/test-utils.js'; -const {Range} = semverModule; +import { expect } from 'chai' +import semverModule from 'semver' +import { createServiceTester } from '../tester.js' +import { + mockPackageData, + mockReleaseSchedule, + mockVersionsSha, +} from './testUtils/test-utils.js' +const { Range } = semverModule export const t = await createServiceTester() function expectSemverRange(message) { diff --git a/services/node/node-version-color.js b/services/node/node-version-color.js index 25dd6207c13bf..44e36984a25ec 100644 --- a/services/node/node-version-color.js +++ b/services/node/node-version-color.js @@ -1,7 +1,7 @@ -import {promisify} from 'util'; -import moment from 'moment'; -import semver from 'semver'; -import {regularUpdate} from '../../core/legacy/regular-update.js'; +import { promisify } from 'util' +import moment from 'moment' +import semver from 'semver' +import { regularUpdate } from '../../core/legacy/regular-update.js' const dateFormat = 'YYYY-MM-DD' @@ -82,7 +82,4 @@ async function versionColorForRangeCurrent(range) { } } -export { - versionColorForRangeCurrent, - versionColorForRangeLts, -}; +export { versionColorForRangeCurrent, versionColorForRangeLts } diff --git a/services/node/testUtils/test-utils.js b/services/node/testUtils/test-utils.js index 430a89914ae5e..2a7535ce04cf4 100644 --- a/services/node/testUtils/test-utils.js +++ b/services/node/testUtils/test-utils.js @@ -1,17 +1,23 @@ -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url' -import moment from 'moment'; +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' +import moment from 'moment' const dateFormat = 'YYYY-MM-DD' const templates = { packageJsonVersionsTemplate: fs.readFileSync( - path.join(path.dirname(fileURLToPath(import.meta.url)), `packageJsonVersionsTemplate.json`), + path.join( + path.dirname(fileURLToPath(import.meta.url)), + `packageJsonVersionsTemplate.json` + ), 'utf-8' ), packageJsonTemplate: fs.readFileSync( - path.join(path.dirname(fileURLToPath(import.meta.url)), `packageJsonTemplate.json`), + path.join( + path.dirname(fileURLToPath(import.meta.url)), + `packageJsonTemplate.json` + ), 'utf-8' ), } @@ -144,9 +150,4 @@ const mockReleaseSchedule = () => nock => { .reply(200, schedule) } -export { - mockPackageData, - mockCurrentSha, - mockVersionsSha, - mockReleaseSchedule, -}; +export { mockPackageData, mockCurrentSha, mockVersionsSha, mockReleaseSchedule } diff --git a/services/nodeping/nodeping-status.service.js b/services/nodeping/nodeping-status.service.js index 5461f6fd573fa..32d145b995fed 100644 --- a/services/nodeping/nodeping-status.service.js +++ b/services/nodeping/nodeping-status.service.js @@ -1,6 +1,10 @@ -import Joi from 'joi'; -import {queryParamSchema, exampleQueryParams, renderWebsiteStatus} from '../website-status.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { + queryParamSchema, + exampleQueryParams, + renderWebsiteStatus, +} from '../website-status.js' +import { BaseJsonService } from '../index.js' const schema = Joi.array() .items(Joi.object().keys({ su: Joi.boolean() })) @@ -63,4 +67,4 @@ export default class NodePingStatus extends BaseJsonService { downColor, }) } -}; +} diff --git a/services/nodeping/nodeping-status.tester.js b/services/nodeping/nodeping-status.tester.js index 16a73d72256d6..6361cb99ce305 100644 --- a/services/nodeping/nodeping-status.tester.js +++ b/services/nodeping/nodeping-status.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('NodePing status') diff --git a/services/nodeping/nodeping-uptime.service.js b/services/nodeping/nodeping-uptime.service.js index 92b4240af56ac..827ac7b6a826d 100644 --- a/services/nodeping/nodeping-uptime.service.js +++ b/services/nodeping/nodeping-uptime.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {colorScale} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { colorScale } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const colorFormatter = colorScale([99, 99.5, 100]) @@ -74,4 +74,4 @@ export default class NodePingUptime extends BaseJsonService { const { uptime } = await this.fetch({ checkUuid }) return this.constructor.render({ uptime }) } -}; +} diff --git a/services/nodeping/nodeping-uptime.tester.js b/services/nodeping/nodeping-uptime.tester.js index 2dbc6b055c0bf..5e09a52eca4ac 100644 --- a/services/nodeping/nodeping-uptime.tester.js +++ b/services/nodeping/nodeping-uptime.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isPercentage} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isPercentage } from '../test-validators.js' export const t = await createServiceTester() t.create('NodePing uptime') diff --git a/services/npm/npm-base.js b/services/npm/npm-base.js index a2656cadbadca..7f8ed6cbc2ca3 100644 --- a/services/npm/npm-base.js +++ b/services/npm/npm-base.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {isDependencyMap} from '../package-json-helpers.js'; -import {BaseJsonService, InvalidResponse, NotFound} from '../index.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { isDependencyMap } from '../package-json-helpers.js' +import { BaseJsonService, InvalidResponse, NotFound } from '../index.js' const deprecatedLicenseObjectSchema = Joi.object({ type: Joi.string().required(), @@ -32,7 +32,7 @@ const packageDataSchema = Joi.object({ export const queryParamSchema = Joi.object({ registry_uri: optionalUrl, -}).required(); +}).required() // Abstract class for NPM badges which display data about the latest version // of a package. @@ -140,4 +140,4 @@ export default class NpmBase extends BaseJsonService { return this.constructor._validate(packageData, packageDataSchema) } -}; +} diff --git a/services/npm/npm-base.spec.js b/services/npm/npm-base.spec.js index f69040f7d19a5..1d68e226d027c 100644 --- a/services/npm/npm-base.spec.js +++ b/services/npm/npm-base.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' // use NPM Version as an example implementation of NpmBase for this test -import NpmVersion from './npm-version.service.js'; +import NpmVersion from './npm-version.service.js' describe('npm', function () { describe('auth', function () { diff --git a/services/npm/npm-collaborators.service.js b/services/npm/npm-collaborators.service.js index 9c430a5fad972..3c277b58c6f0f 100644 --- a/services/npm/npm-collaborators.service.js +++ b/services/npm/npm-collaborators.service.js @@ -1,5 +1,5 @@ -import {renderContributorBadge} from '../contributor-count.js'; -import NpmBase from './npm-base.js'; +import { renderContributorBadge } from '../contributor-count.js' +import NpmBase from './npm-base.js' const keywords = ['node'] @@ -47,4 +47,4 @@ export default class NpmCollaborators extends NpmBase { const collaborators = maintainers.length return this.constructor.render({ collaborators }) } -}; +} diff --git a/services/npm/npm-collaborators.tester.js b/services/npm/npm-collaborators.tester.js index 9f40bdfaa09c7..90488d5e85366 100644 --- a/services/npm/npm-collaborators.tester.js +++ b/services/npm/npm-collaborators.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the contributor count') diff --git a/services/npm/npm-dependency-version.service.js b/services/npm/npm-dependency-version.service.js index 77b38a63c335b..916a5d7e0a0a9 100644 --- a/services/npm/npm-dependency-version.service.js +++ b/services/npm/npm-dependency-version.service.js @@ -1,5 +1,5 @@ -import {getDependencyVersion} from '../package-json-helpers.js'; -import NpmBase from './npm-base.js'; +import { getDependencyVersion } from '../package-json-helpers.js' +import NpmBase from './npm-base.js' const { queryParamSchema } = NpmBase const keywords = ['node'] @@ -140,4 +140,4 @@ export default class NpmDependencyVersion extends NpmBase { range, }) } -}; +} diff --git a/services/npm/npm-dependency-version.tester.js b/services/npm/npm-dependency-version.tester.js index 191f54c4de059..864c4d6b15e7f 100644 --- a/services/npm/npm-dependency-version.tester.js +++ b/services/npm/npm-dependency-version.tester.js @@ -1,5 +1,5 @@ -import {semverRange} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { semverRange } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the peer dependency version') diff --git a/services/npm/npm-downloads.service.js b/services/npm/npm-downloads.service.js index fd03ce813bf88..ca01fae33f147 100644 --- a/services/npm/npm-downloads.service.js +++ b/services/npm/npm-downloads.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' // https://github.com/npm/registry/blob/master/docs/download-counts.md#output const pointResponseSchema = Joi.object({ @@ -86,4 +86,4 @@ export default class NpmDownloads extends BaseJsonService { return this.constructor.render({ interval, downloadCount }) } -}; +} diff --git a/services/npm/npm-downloads.spec.js b/services/npm/npm-downloads.spec.js index 33e67646fd5e8..edb9854226272 100644 --- a/services/npm/npm-downloads.spec.js +++ b/services/npm/npm-downloads.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import NpmDownloads from './npm-downloads.service.js'; +import { test, given } from 'sazerac' +import NpmDownloads from './npm-downloads.service.js' describe('NpmDownloads', function () { test(NpmDownloads._intervalMap.dt.transform, () => { diff --git a/services/npm/npm-downloads.tester.js b/services/npm/npm-downloads.tester.js index 8e8389c964092..4ff67bad94be1 100644 --- a/services/npm/npm-downloads.tester.js +++ b/services/npm/npm-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetricOverTimePeriod, isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetricOverTimePeriod, isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('weekly downloads of left-pad').get('/dw/left-pad.json').expectBadge({ diff --git a/services/npm/npm-license.service.js b/services/npm/npm-license.service.js index a4030cf55dd2f..ed354e28b8e03 100644 --- a/services/npm/npm-license.service.js +++ b/services/npm/npm-license.service.js @@ -1,6 +1,6 @@ -import {renderLicenseBadge} from '../licenses.js'; -import toArray from '../../core/base-service/to-array.js'; -import NpmBase from './npm-base.js'; +import { renderLicenseBadge } from '../licenses.js' +import toArray from '../../core/base-service/to-array.js' +import NpmBase from './npm-base.js' export default class NpmLicense extends NpmBase { static category = 'license' @@ -44,4 +44,4 @@ export default class NpmLicense extends NpmBase { ) return this.constructor.render({ licenses }) } -}; +} diff --git a/services/npm/npm-license.tester.js b/services/npm/npm-license.tester.js index e600d933f0edd..a06aef4774ae1 100644 --- a/services/npm/npm-license.tester.js +++ b/services/npm/npm-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the license of express') diff --git a/services/npm/npm-type-definitions.service.js b/services/npm/npm-type-definitions.service.js index 1d62485b147ab..9120b24593cae 100644 --- a/services/npm/npm-type-definitions.service.js +++ b/services/npm/npm-type-definitions.service.js @@ -1,4 +1,4 @@ -import NpmBase from './npm-base.js'; +import NpmBase from './npm-base.js' // For this badge to correctly detect type definitions, either the relevant // dependencies must be declared, or the `types` key must be set in @@ -70,4 +70,4 @@ export default class NpmTypeDefinitions extends NpmBase { const props = this.constructor.transform(json) return this.constructor.render(props) } -}; +} diff --git a/services/npm/npm-type-definitions.spec.js b/services/npm/npm-type-definitions.spec.js index c5e0f1459dc70..69c4f3d45af9f 100644 --- a/services/npm/npm-type-definitions.spec.js +++ b/services/npm/npm-type-definitions.spec.js @@ -1,5 +1,5 @@ -import {test, given, forCases} from 'sazerac'; -import NpmTypeDefinitions from './npm-type-definitions.service.js'; +import { test, given, forCases } from 'sazerac' +import NpmTypeDefinitions from './npm-type-definitions.service.js' describe('NPM type definitions badge', function () { test(NpmTypeDefinitions.transform, () => { diff --git a/services/npm/npm-type-definitions.tester.js b/services/npm/npm-type-definitions.tester.js index ba32c98563a24..60cadb61fac11 100644 --- a/services/npm/npm-type-definitions.tester.js +++ b/services/npm/npm-type-definitions.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isTypeDefinition = Joi.string().regex( diff --git a/services/npm/npm-version.service.js b/services/npm/npm-version.service.js index c6f6f21909e13..95abd88a6c825 100644 --- a/services/npm/npm-version.service.js +++ b/services/npm/npm-version.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {NotFound} from '../index.js'; -import NpmBase from './npm-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { NotFound } from '../index.js' +import NpmBase from './npm-base.js' const keywords = ['node'] @@ -92,4 +92,4 @@ export default class NpmVersion extends NpmBase { version: packageData[tag || 'latest'], }) } -}; +} diff --git a/services/npm/npm-version.tester.js b/services/npm/npm-version.tester.js index 0f2bda1582763..a7f3d06a2e5ef 100644 --- a/services/npm/npm-version.tester.js +++ b/services/npm/npm-version.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the package version of left-pad') diff --git a/services/nsp/nsp.service.js b/services/nsp/nsp.service.js index d9189cee000fa..63671c181ac0e 100644 --- a/services/nsp/nsp.service.js +++ b/services/nsp/nsp.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ route: { @@ -8,4 +8,4 @@ export default deprecatedService({ label: 'nsp', category: 'other', dateAdded: new Date('2018-12-13'), -}); +}) diff --git a/services/nsp/nsp.tester.js b/services/nsp/nsp.tester.js index 1c42eee5e60f0..c7c8a198ab554 100644 --- a/services/nsp/nsp.tester.js +++ b/services/nsp/nsp.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'nsp', diff --git a/services/nuget-fixtures.js b/services/nuget-fixtures.js index 0b34d0e9e65f0..919cdd3b0bcf4 100644 --- a/services/nuget-fixtures.js +++ b/services/nuget-fixtures.js @@ -54,4 +54,4 @@ export { nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero, nuGetV3VersionJsonBuildMetadataWithDash, -}; +} diff --git a/services/nuget/nuget-helpers.js b/services/nuget/nuget-helpers.js index 753da5353c971..d39fbe4348869 100644 --- a/services/nuget/nuget-helpers.js +++ b/services/nuget/nuget-helpers.js @@ -1,8 +1,8 @@ -import {promisify} from 'util'; -import semver from 'semver'; -import {metric, addv} from '../text-formatters.js'; -import {downloadCount as downloadCountColor} from '../color-formatters.js'; -import {regularUpdate} from '../../core/legacy/regular-update.js'; +import { promisify } from 'util' +import semver from 'semver' +import { metric, addv } from '../text-formatters.js' +import { downloadCount as downloadCountColor } from '../color-formatters.js' +import { regularUpdate } from '../../core/legacy/regular-update.js' function renderVersionBadge({ version, feed }) { let color @@ -108,4 +108,4 @@ export { searchServiceUrl, stripBuildMetadata, selectVersion, -}; +} diff --git a/services/nuget/nuget-helpers.spec.js b/services/nuget/nuget-helpers.spec.js index bd96935a6a18d..a5e316490d461 100644 --- a/services/nuget/nuget-helpers.spec.js +++ b/services/nuget/nuget-helpers.spec.js @@ -1,5 +1,10 @@ -import {test, given} from 'sazerac'; -import {renderVersionBadge, odataToObject, stripBuildMetadata, selectVersion} from './nuget-helpers.js'; +import { test, given } from 'sazerac' +import { + renderVersionBadge, + odataToObject, + stripBuildMetadata, + selectVersion, +} from './nuget-helpers.js' describe('NuGet helpers', function () { test(renderVersionBadge, () => { diff --git a/services/nuget/nuget-v2-service-family.js b/services/nuget/nuget-v2-service-family.js index 6a2abf558476f..b950a1ed2b6ea 100644 --- a/services/nuget/nuget-v2-service-family.js +++ b/services/nuget/nuget-v2-service-family.js @@ -1,7 +1,16 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, BaseXmlService, NotFound, redirector} from '../index.js'; -import {renderVersionBadge, renderDownloadBadge, odataToObject} from './nuget-helpers.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { + BaseJsonService, + BaseXmlService, + NotFound, + redirector, +} from '../index.js' +import { + renderVersionBadge, + renderDownloadBadge, + odataToObject, +} from './nuget-helpers.js' function createFilter({ packageName, includePrereleases }) { const releaseTypeFilter = includePrereleases @@ -218,8 +227,4 @@ function createServiceFamily({ return { NugetVersionService, NugetVersionRedirector, NugetDownloadService } } -export { - createFilter, - fetch, - createServiceFamily, -}; +export { createFilter, fetch, createServiceFamily } diff --git a/services/nuget/nuget-v3-service-family.js b/services/nuget/nuget-v3-service-family.js index 8569f8b681f43..3a06cd297e84d 100644 --- a/services/nuget/nuget-v3-service-family.js +++ b/services/nuget/nuget-v3-service-family.js @@ -1,7 +1,13 @@ -import Joi from 'joi'; -import RouteBuilder from '../route-builder.js'; -import {BaseJsonService, NotFound} from '../index.js'; -import {renderVersionBadge, renderDownloadBadge, searchServiceUrl, stripBuildMetadata, selectVersion} from './nuget-helpers.js'; +import Joi from 'joi' +import RouteBuilder from '../route-builder.js' +import { BaseJsonService, NotFound } from '../index.js' +import { + renderVersionBadge, + renderDownloadBadge, + searchServiceUrl, + stripBuildMetadata, + selectVersion, +} from './nuget-helpers.js' /* * Build the Shields service URL object for the given service configuration. Return @@ -205,6 +211,4 @@ function createServiceFamily({ } } -export { - createServiceFamily, -}; +export { createServiceFamily } diff --git a/services/nuget/nuget-v3-service-family.spec.js b/services/nuget/nuget-v3-service-family.spec.js index 41e616a5ca3a7..a6e49f6b6cb46 100644 --- a/services/nuget/nuget-v3-service-family.spec.js +++ b/services/nuget/nuget-v3-service-family.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {createServiceFamily} from './nuget-v3-service-family.js'; +import { test, given } from 'sazerac' +import { createServiceFamily } from './nuget-v3-service-family.js' const { NugetVersionService, NugetDownloadService } = createServiceFamily({ defaultLabel: 'nuget', diff --git a/services/nuget/nuget.service.js b/services/nuget/nuget.service.js index a0da143a69233..a05bbc3079075 100644 --- a/services/nuget/nuget.service.js +++ b/services/nuget/nuget.service.js @@ -1,4 +1,4 @@ -import {createServiceFamily} from './nuget-v3-service-family.js'; +import { createServiceFamily } from './nuget-v3-service-family.js' const { NugetVersionService: Version, NugetDownloadService: Downloads } = createServiceFamily({ @@ -37,4 +37,4 @@ class NugetDownloadService extends Downloads { ] } -export { NugetVersionService, NugetDownloadService }; +export { NugetVersionService, NugetDownloadService } diff --git a/services/nuget/nuget.tester.js b/services/nuget/nuget.tester.js index 1ab349eecfe5f..65878d6a11edd 100644 --- a/services/nuget/nuget.tester.js +++ b/services/nuget/nuget.tester.js @@ -1,7 +1,17 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -import {queryIndex, nuGetV3VersionJsonWithDash, nuGetV3VersionJsonFirstCharZero, nuGetV3VersionJsonFirstCharNotZero, nuGetV3VersionJsonBuildMetadataWithDash} from '../nuget-fixtures.js'; -import {invalidJSON} from '../response-fixtures.js'; +import { ServiceTester } from '../tester.js' +import { + isMetric, + isVPlusDottedVersionNClauses, + isVPlusDottedVersionNClausesWithOptionalSuffix, +} from '../test-validators.js' +import { + queryIndex, + nuGetV3VersionJsonWithDash, + nuGetV3VersionJsonFirstCharZero, + nuGetV3VersionJsonFirstCharNotZero, + nuGetV3VersionJsonBuildMetadataWithDash, +} from '../nuget-fixtures.js' +import { invalidJSON } from '../response-fixtures.js' export const t = new ServiceTester({ id: 'nuget', title: 'NuGet' }) diff --git a/services/nycrc/nycrc.service.js b/services/nycrc/nycrc.service.js index b08d6a8dfd377..1e4405e1b64e8 100644 --- a/services/nycrc/nycrc.service.js +++ b/services/nycrc/nycrc.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import {ConditionalGithubAuthV3Service} from '../github/github-auth-service.js'; -import {fetchJsonFromRepo} from '../github/github-common-fetch.js'; -import {InvalidParameter, InvalidResponse, NotFound} from '../index.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import { ConditionalGithubAuthV3Service } from '../github/github-auth-service.js' +import { fetchJsonFromRepo } from '../github/github-common-fetch.js' +import { InvalidParameter, InvalidResponse, NotFound } from '../index.js' const nycrcSchema = Joi.object({ branches: Joi.number().min(0).max(100), @@ -127,4 +127,4 @@ export default class Nycrc extends ConditionalGithubAuthV3Service { } return this.constructor.render({ coverage }) } -}; +} diff --git a/services/nycrc/nycrc.tester.js b/services/nycrc/nycrc.tester.js index 11e05513934de..66894780a8df9 100644 --- a/services/nycrc/nycrc.tester.js +++ b/services/nycrc/nycrc.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('valid .nycrc') diff --git a/services/offset-earth/offset-earth-carbon-redirect.service.js b/services/offset-earth/offset-earth-carbon-redirect.service.js index 26f284e81cfde..ccbabfab208fc 100644 --- a/services/offset-earth/offset-earth-carbon-redirect.service.js +++ b/services/offset-earth/offset-earth-carbon-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ // https://github.com/badges/shields/issues/5433 @@ -12,4 +12,4 @@ export default [ transformPath: ({ username }) => `/ecologi/carbon/${username}`, dateAdded: new Date('2020-08-16'), }), -]; +] diff --git a/services/offset-earth/offset-earth-carbon-redirect.tester.js b/services/offset-earth/offset-earth-carbon-redirect.tester.js index 7dfa632c7ad61..66e171d95215b 100644 --- a/services/offset-earth/offset-earth-carbon-redirect.tester.js +++ b/services/offset-earth/offset-earth-carbon-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'OffsetEarthCarbonRedirect', diff --git a/services/offset-earth/offset-earth-trees-redirect.service.js b/services/offset-earth/offset-earth-trees-redirect.service.js index cd29c30c9dc5f..bdc3b16c64d71 100644 --- a/services/offset-earth/offset-earth-trees-redirect.service.js +++ b/services/offset-earth/offset-earth-trees-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ // https://github.com/badges/shields/issues/5433 @@ -12,4 +12,4 @@ export default [ transformPath: ({ username }) => `/ecologi/trees/${username}`, dateAdded: new Date('2020-08-16'), }), -]; +] diff --git a/services/offset-earth/offset-earth-trees-redirect.tester.js b/services/offset-earth/offset-earth-trees-redirect.tester.js index 6b92b56025d4f..eea1a2098e2a4 100644 --- a/services/offset-earth/offset-earth-trees-redirect.tester.js +++ b/services/offset-earth/offset-earth-trees-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'OffsetEarthTreesRedirect', diff --git a/services/open-vsx/open-vsx-base.js b/services/open-vsx/open-vsx-base.js index 1b069ac78889a..d17a1e66a8cf7 100644 --- a/services/open-vsx/open-vsx-base.js +++ b/services/open-vsx/open-vsx-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {optionalNonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { optionalNonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const extensionQuerySchema = Joi.object({ error: Joi.string(), @@ -40,4 +40,4 @@ export default class OpenVSXBase extends BaseJsonService { }, }) } -}; +} diff --git a/services/open-vsx/open-vsx-downloads.service.js b/services/open-vsx/open-vsx-downloads.service.js index 90b65b00a6b0f..b1d86ec4dccad 100644 --- a/services/open-vsx/open-vsx-downloads.service.js +++ b/services/open-vsx/open-vsx-downloads.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import OpenVSXBase from './open-vsx-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import OpenVSXBase from './open-vsx-base.js' export default class OpenVSXDownloads extends OpenVSXBase { static category = 'downloads' @@ -55,4 +55,4 @@ export default class OpenVSXDownloads extends OpenVSXBase { downloads: downloadCount, }) } -}; +} diff --git a/services/open-vsx/open-vsx-downloads.tester.js b/services/open-vsx/open-vsx-downloads.tester.js index 9ef3c2c7df79d..72da704337d0f 100644 --- a/services/open-vsx/open-vsx-downloads.tester.js +++ b/services/open-vsx/open-vsx-downloads.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {withRegex, isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { withRegex, isMetric } from '../test-validators.js' export const t = await createServiceTester() const isVersionLabel = withRegex(/^downloads@(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/open-vsx/open-vsx-rating.service.js b/services/open-vsx/open-vsx-rating.service.js index e6e5eab06d159..ae5702c0f10a0 100644 --- a/services/open-vsx/open-vsx-rating.service.js +++ b/services/open-vsx/open-vsx-rating.service.js @@ -1,6 +1,6 @@ -import {starRating} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import OpenVSXBase from './open-vsx-base.js'; +import { starRating } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import OpenVSXBase from './open-vsx-base.js' export default class OpenVSXRating extends OpenVSXBase { static category = 'rating' @@ -75,4 +75,4 @@ export default class OpenVSXRating extends OpenVSXBase { ratingCount: reviewCount, }) } -}; +} diff --git a/services/open-vsx/open-vsx-rating.spec.js b/services/open-vsx/open-vsx-rating.spec.js index 2ca8131ff7455..8dc1ec0c286aa 100644 --- a/services/open-vsx/open-vsx-rating.spec.js +++ b/services/open-vsx/open-vsx-rating.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import OpenVSXRating from './open-vsx-rating.service.js'; +import { test, given } from 'sazerac' +import OpenVSXRating from './open-vsx-rating.service.js' describe('OpenVSXRating', function () { test(OpenVSXRating.render, () => { diff --git a/services/open-vsx/open-vsx-rating.tester.js b/services/open-vsx/open-vsx-rating.tester.js index d37f6d20412b6..a007432b78bb4 100644 --- a/services/open-vsx/open-vsx-rating.tester.js +++ b/services/open-vsx/open-vsx-rating.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {withRegex, isStarRating} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { withRegex, isStarRating } from '../test-validators.js' export const t = await createServiceTester() const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/open-vsx/open-vsx-release-date.service.js b/services/open-vsx/open-vsx-release-date.service.js index b75a6ee27579c..c201306c8eb6a 100644 --- a/services/open-vsx/open-vsx-release-date.service.js +++ b/services/open-vsx/open-vsx-release-date.service.js @@ -1,6 +1,6 @@ -import {age} from '../color-formatters.js'; -import {formatDate} from '../text-formatters.js'; -import OpenVSXBase from './open-vsx-base.js'; +import { age } from '../color-formatters.js' +import { formatDate } from '../text-formatters.js' +import OpenVSXBase from './open-vsx-base.js' export default class OpenVSXReleaseDate extends OpenVSXBase { static category = 'activity' @@ -39,4 +39,4 @@ export default class OpenVSXReleaseDate extends OpenVSXBase { releaseDate: timestamp, }) } -}; +} diff --git a/services/open-vsx/open-vsx-release-date.tester.js b/services/open-vsx/open-vsx-release-date.tester.js index 05bb2281aadb2..2f3649d3ad60e 100644 --- a/services/open-vsx/open-vsx-release-date.tester.js +++ b/services/open-vsx/open-vsx-release-date.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isFormattedDate} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isFormattedDate } from '../test-validators.js' export const t = await createServiceTester() t.create('release date invalid extension') diff --git a/services/open-vsx/open-vsx-version.service.js b/services/open-vsx/open-vsx-version.service.js index 8c32f8b63ab9a..45f342a94c4e0 100644 --- a/services/open-vsx/open-vsx-version.service.js +++ b/services/open-vsx/open-vsx-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import OpenVSXBase from './open-vsx-base.js'; +import { renderVersionBadge } from '../version.js' +import OpenVSXBase from './open-vsx-base.js' export default class OpenVSXVersion extends OpenVSXBase { static category = 'version' @@ -26,4 +26,4 @@ export default class OpenVSXVersion extends OpenVSXBase { const { version } = await this.fetch({ namespace, extension }) return this.constructor.render({ version }) } -}; +} diff --git a/services/open-vsx/open-vsx-version.tester.js b/services/open-vsx/open-vsx-version.tester.js index 64539f67808cb..ee3bc1a18a161 100644 --- a/services/open-vsx/open-vsx-version.tester.js +++ b/services/open-vsx/open-vsx-version.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {withRegex} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { withRegex } from '../test-validators.js' export const t = await createServiceTester() const isVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/opencollective/opencollective-all.service.js b/services/opencollective/opencollective-all.service.js index 2221a4349ae6c..dac3229f97791 100644 --- a/services/opencollective/opencollective-all.service.js +++ b/services/opencollective/opencollective-all.service.js @@ -1,4 +1,4 @@ -import OpencollectiveBase from './opencollective-base.js'; +import OpencollectiveBase from './opencollective-base.js' export default class OpencollectiveAll extends OpencollectiveBase { static route = this.buildRoute('all') @@ -20,4 +20,4 @@ export default class OpencollectiveAll extends OpencollectiveBase { const { backersCount } = await this.fetchCollectiveInfo(collective) return this.constructor.render(backersCount) } -}; +} diff --git a/services/opencollective/opencollective-all.tester.js b/services/opencollective/opencollective-all.tester.js index fdaab6d9a5a43..d827313c509ad 100644 --- a/services/opencollective/opencollective-all.tester.js +++ b/services/opencollective/opencollective-all.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('renders correctly') diff --git a/services/opencollective/opencollective-backers.service.js b/services/opencollective/opencollective-backers.service.js index 991c7d477982e..3f2b7da4d7541 100644 --- a/services/opencollective/opencollective-backers.service.js +++ b/services/opencollective/opencollective-backers.service.js @@ -1,4 +1,4 @@ -import OpencollectiveBase from './opencollective-base.js'; +import OpencollectiveBase from './opencollective-base.js' export default class OpencollectiveBackers extends OpencollectiveBase { static route = this.buildRoute('backers') @@ -23,4 +23,4 @@ export default class OpencollectiveBackers extends OpencollectiveBase { ) return this.constructor.render(backersCount) } -}; +} diff --git a/services/opencollective/opencollective-backers.tester.js b/services/opencollective/opencollective-backers.tester.js index 4b40d276a74ec..7163f9a5da4ce 100644 --- a/services/opencollective/opencollective-backers.tester.js +++ b/services/opencollective/opencollective-backers.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('renders correctly') diff --git a/services/opencollective/opencollective-base.js b/services/opencollective/opencollective-base.js index f6f8e96177d0c..ec92f434e2808 100644 --- a/services/opencollective/opencollective-base.js +++ b/services/opencollective/opencollective-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' // https://developer.opencollective.com/#/api/collectives?id=get-info const collectiveDetailsSchema = Joi.object().keys({ @@ -79,4 +79,4 @@ export default class OpencollectiveBase extends BaseJsonService { result.tier = members.map(member => member.tier)[0] return result } -}; +} diff --git a/services/opencollective/opencollective-by-tier.service.js b/services/opencollective/opencollective-by-tier.service.js index b2a140b1cd278..98acc383f509d 100644 --- a/services/opencollective/opencollective-by-tier.service.js +++ b/services/opencollective/opencollective-by-tier.service.js @@ -1,4 +1,4 @@ -import OpencollectiveBase from './opencollective-base.js'; +import OpencollectiveBase from './opencollective-base.js' const documentation = `

How to get the tierId

According to open collectives documentation, you can find the tierId by looking at the URL after clicking on a Tier Card on the collective page. (e.g. tierId for https://opencollective.com/shields/order/2988 is 2988)

` @@ -29,4 +29,4 @@ export default class OpencollectiveByTier extends OpencollectiveBase { } else result.tier = 'new tier' return this.constructor.render(result.backersCount, result.tier) } -}; +} diff --git a/services/opencollective/opencollective-by-tier.tester.js b/services/opencollective/opencollective-by-tier.tester.js index 9907fa5c4d30c..c2179fef409a2 100644 --- a/services/opencollective/opencollective-by-tier.tester.js +++ b/services/opencollective/opencollective-by-tier.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('renders correctly') diff --git a/services/opencollective/opencollective-sponsors.service.js b/services/opencollective/opencollective-sponsors.service.js index 905400b2e2132..0f41df6f03657 100644 --- a/services/opencollective/opencollective-sponsors.service.js +++ b/services/opencollective/opencollective-sponsors.service.js @@ -1,4 +1,4 @@ -import OpencollectiveBase from './opencollective-base.js'; +import OpencollectiveBase from './opencollective-base.js' export default class OpencollectiveSponsors extends OpencollectiveBase { static route = this.buildRoute('sponsors') @@ -23,4 +23,4 @@ export default class OpencollectiveSponsors extends OpencollectiveBase { ) return this.constructor.render(backersCount) } -}; +} diff --git a/services/opencollective/opencollective-sponsors.tester.js b/services/opencollective/opencollective-sponsors.tester.js index 9119e5578eac7..300af584c42ce 100644 --- a/services/opencollective/opencollective-sponsors.tester.js +++ b/services/opencollective/opencollective-sponsors.tester.js @@ -1,5 +1,5 @@ -import {nonNegativeInteger} from '../validators.js'; -import {createServiceTester} from '../tester.js' +import { nonNegativeInteger } from '../validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('renders correctly') diff --git a/services/opm/opm-version.service.js b/services/opm/opm-version.service.js index 71231728355f0..41260c85a3d12 100644 --- a/services/opm/opm-version.service.js +++ b/services/opm/opm-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import {BaseService, NotFound, InvalidResponse} from '../index.js'; +import { renderVersionBadge } from '../version.js' +import { BaseService, NotFound, InvalidResponse } from '../index.js' export default class OpmVersion extends BaseService { static category = 'version' @@ -56,4 +56,4 @@ export default class OpmVersion extends BaseService { return renderVersionBadge({ version }) } -}; +} diff --git a/services/opm/opm-version.tester.js b/services/opm/opm-version.tester.js index 33c3dc1be1c7f..c0e187cf3491a 100644 --- a/services/opm/opm-version.tester.js +++ b/services/opm/opm-version.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isValidVersion = Joi.string() diff --git a/services/ore/ore-base.js b/services/ore/ore-base.js index bf19ea22c3887..670d92af48e51 100644 --- a/services/ore/ore-base.js +++ b/services/ore/ore-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService, InvalidResponse } from '../index.js' const sessionSchema = Joi.object({ session: Joi.string().required(), @@ -83,4 +83,4 @@ class BaseOreService extends BaseJsonService { BaseOreService.sessionToken = null -export { keywords, documentation, BaseOreService }; +export { keywords, documentation, BaseOreService } diff --git a/services/ore/ore-category.service.js b/services/ore/ore-category.service.js index 107364cbb4933..ab0e067ce0a6e 100644 --- a/services/ore/ore-category.service.js +++ b/services/ore/ore-category.service.js @@ -1,4 +1,4 @@ -import {BaseOreService, documentation, keywords} from './ore-base.js'; +import { BaseOreService, documentation, keywords } from './ore-base.js' export default class OreCategory extends BaseOreService { static category = 'other' @@ -41,4 +41,4 @@ export default class OreCategory extends BaseOreService { const { category } = this.transform({ data }) return this.constructor.render({ category }) } -}; +} diff --git a/services/ore/ore-category.spec.js b/services/ore/ore-category.spec.js index e54e6ec2f5135..793d38ea346f7 100644 --- a/services/ore/ore-category.spec.js +++ b/services/ore/ore-category.spec.js @@ -1,5 +1,5 @@ -import {test, forCases, given} from 'sazerac'; -import OreCategory from './ore-category.service.js'; +import { test, forCases, given } from 'sazerac' +import OreCategory from './ore-category.service.js' describe('OreCategory', function () { test(OreCategory.prototype.transform, () => { diff --git a/services/ore/ore-category.tester.js b/services/ore/ore-category.tester.js index fa4b810814066..efb62c1324b73 100644 --- a/services/ore/ore-category.tester.js +++ b/services/ore/ore-category.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Taken from https://ore.spongepowered.org/api#/Projects/showProject diff --git a/services/ore/ore-downloads.service.js b/services/ore/ore-downloads.service.js index 324bcd0f88551..dd44194804d32 100644 --- a/services/ore/ore-downloads.service.js +++ b/services/ore/ore-downloads.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {BaseOreService, documentation, keywords} from './ore-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { BaseOreService, documentation, keywords } from './ore-base.js' export default class OreDownloads extends BaseOreService { static category = 'downloads' @@ -39,4 +39,4 @@ export default class OreDownloads extends BaseOreService { } = await this.fetch({ pluginId }) return this.constructor.render({ downloads }) } -}; +} diff --git a/services/ore/ore-downloads.tester.js b/services/ore/ore-downloads.tester.js index 0b89105f51b8e..dd2ba54bcfe95 100644 --- a/services/ore/ore-downloads.tester.js +++ b/services/ore/ore-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ diff --git a/services/ore/ore-license.service.js b/services/ore/ore-license.service.js index f8ee6a0482d2f..362c226aa95d8 100644 --- a/services/ore/ore-license.service.js +++ b/services/ore/ore-license.service.js @@ -1,5 +1,5 @@ -import {renderLicenseBadge} from '../licenses.js'; -import {BaseOreService, documentation, keywords} from './ore-base.js'; +import { renderLicenseBadge } from '../licenses.js' +import { BaseOreService, documentation, keywords } from './ore-base.js' export default class OreLicense extends BaseOreService { static category = 'license' @@ -45,4 +45,4 @@ export default class OreLicense extends BaseOreService { const { license } = this.transform({ data }) return this.constructor.render({ license }) } -}; +} diff --git a/services/ore/ore-license.spec.js b/services/ore/ore-license.spec.js index 7bfd00d6a7a31..5e5e922068d75 100644 --- a/services/ore/ore-license.spec.js +++ b/services/ore/ore-license.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import OreLicense from './ore-license.service.js'; +import { test, given } from 'sazerac' +import OreLicense from './ore-license.service.js' describe('OreLicense', function () { test(OreLicense.prototype.transform, () => { diff --git a/services/ore/ore-license.tester.js b/services/ore/ore-license.tester.js index c7a45c06af074..dd2c441d594bf 100644 --- a/services/ore/ore-license.tester.js +++ b/services/ore/ore-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ diff --git a/services/ore/ore-sponge-versions.service.js b/services/ore/ore-sponge-versions.service.js index bcbd897ac739d..e7689bdc1842b 100644 --- a/services/ore/ore-sponge-versions.service.js +++ b/services/ore/ore-sponge-versions.service.js @@ -1,4 +1,4 @@ -import {BaseOreService, documentation, keywords} from './ore-base.js'; +import { BaseOreService, documentation, keywords } from './ore-base.js' export default class OreSpongeVersions extends BaseOreService { static category = 'platform-support' @@ -48,4 +48,4 @@ export default class OreSpongeVersions extends BaseOreService { const { versions } = this.transform({ data }) return this.constructor.render({ versions }) } -}; +} diff --git a/services/ore/ore-sponge-versions.spec.js b/services/ore/ore-sponge-versions.spec.js index 6f78b900e1d0d..b6c7accd798ce 100644 --- a/services/ore/ore-sponge-versions.spec.js +++ b/services/ore/ore-sponge-versions.spec.js @@ -1,5 +1,5 @@ -import {test, forCases, given} from 'sazerac'; -import OreSpongeVersions from './ore-sponge-versions.service.js'; +import { test, forCases, given } from 'sazerac' +import OreSpongeVersions from './ore-sponge-versions.service.js' const PROMOTED_VERSIONS = [ { diff --git a/services/ore/ore-sponge-versions.tester.js b/services/ore/ore-sponge-versions.tester.js index d8664f1359911..0d1d6e0570e91 100644 --- a/services/ore/ore-sponge-versions.tester.js +++ b/services/ore/ore-sponge-versions.tester.js @@ -1,5 +1,5 @@ -import joiModule from 'joi'; -import {createServiceTester} from '../tester.js' +import joiModule from 'joi' +import { createServiceTester } from '../tester.js' const Joi = joiModule.extend(joi => ({ base: joi.array(), coerce: (value, helpers) => ({ diff --git a/services/ore/ore-stars.service.js b/services/ore/ore-stars.service.js index 2d36af4fa03d1..bdc226423b409 100644 --- a/services/ore/ore-stars.service.js +++ b/services/ore/ore-stars.service.js @@ -1,5 +1,5 @@ -import {metric} from '../text-formatters.js'; -import {BaseOreService, documentation, keywords} from './ore-base.js'; +import { metric } from '../text-formatters.js' +import { BaseOreService, documentation, keywords } from './ore-base.js' export default class OreStars extends BaseOreService { static category = 'rating' @@ -37,4 +37,4 @@ export default class OreStars extends BaseOreService { const { stars } = stats return this.constructor.render({ stars }) } -}; +} diff --git a/services/ore/ore-stars.tester.js b/services/ore/ore-stars.tester.js index 85b0234f367c1..c80e67d43d57b 100644 --- a/services/ore/ore-stars.tester.js +++ b/services/ore/ore-stars.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ diff --git a/services/ore/ore-version.service.js b/services/ore/ore-version.service.js index cd16351110a17..cb7fa47cc4d2f 100644 --- a/services/ore/ore-version.service.js +++ b/services/ore/ore-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import {BaseOreService, documentation, keywords} from './ore-base.js'; +import { renderVersionBadge } from '../version.js' +import { BaseOreService, documentation, keywords } from './ore-base.js' export default class OreVersion extends BaseOreService { static category = 'version' @@ -47,4 +47,4 @@ export default class OreVersion extends BaseOreService { const { version } = this.transform({ data }) return this.constructor.render({ version }) } -}; +} diff --git a/services/ore/ore-version.spec.js b/services/ore/ore-version.spec.js index 6740cc6e4a761..0d50f35acecd5 100644 --- a/services/ore/ore-version.spec.js +++ b/services/ore/ore-version.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import OreVersion from './ore-version.service.js'; +import { test, given } from 'sazerac' +import OreVersion from './ore-version.service.js' describe('OreVersion', function () { test(OreVersion.prototype.transform, () => { diff --git a/services/ore/ore-version.tester.js b/services/ore/ore-version.tester.js index 57c1155536a29..5f3b3ba491021 100644 --- a/services/ore/ore-version.tester.js +++ b/services/ore/ore-version.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({ diff --git a/services/osslifecycle/osslifecycle.service.js b/services/osslifecycle/osslifecycle.service.js index acefdf0810767..114e0e09d75df 100644 --- a/services/osslifecycle/osslifecycle.service.js +++ b/services/osslifecycle/osslifecycle.service.js @@ -1,4 +1,4 @@ -import {BaseService, InvalidResponse} from '../index.js'; +import { BaseService, InvalidResponse } from '../index.js' const documentation = `

@@ -94,4 +94,4 @@ export default class OssTracker extends BaseService { }) } } -}; +} diff --git a/services/osslifecycle/osslifecycle.tester.js b/services/osslifecycle/osslifecycle.tester.js index a2a1248056aa9..9003d2e778d73 100644 --- a/services/osslifecycle/osslifecycle.tester.js +++ b/services/osslifecycle/osslifecycle.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'osslifecycle', diff --git a/services/package-json-helpers.js b/services/package-json-helpers.js index 1d17bb8cba0e2..242243ad07dd3 100644 --- a/services/package-json-helpers.js +++ b/services/package-json-helpers.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {InvalidParameter} from './index.js'; +import Joi from 'joi' +import { InvalidParameter } from './index.js' const isDependencyMap = Joi.object() .pattern( @@ -43,8 +43,4 @@ function getDependencyVersion({ return { range } } -export { - isDependencyMap, - isPackageJsonWithDependencies, - getDependencyVersion, -}; +export { isDependencyMap, isPackageJsonWithDependencies, getDependencyVersion } diff --git a/services/package-json-helpers.spec.js b/services/package-json-helpers.spec.js index 2e46c419ad19a..4cdd60741b4a4 100644 --- a/services/package-json-helpers.spec.js +++ b/services/package-json-helpers.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {getDependencyVersion} from './package-json-helpers.js'; +import { test, given } from 'sazerac' +import { getDependencyVersion } from './package-json-helpers.js' describe('Contributor count helpers', function () { test(getDependencyVersion, () => { diff --git a/services/packagecontrol/packagecontrol.service.js b/services/packagecontrol/packagecontrol.service.js index c0c3752f46123..8189054d8b7fa 100644 --- a/services/packagecontrol/packagecontrol.service.js +++ b/services/packagecontrol/packagecontrol.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const keywords = ['sublime', 'sublimetext', 'packagecontrol'] @@ -114,4 +114,4 @@ function DownloadsForInterval(interval) { } } -export default ['day', 'week', 'month', 'total'].map(DownloadsForInterval); +export default ['day', 'week', 'month', 'total'].map(DownloadsForInterval) diff --git a/services/packagecontrol/packagecontrol.tester.js b/services/packagecontrol/packagecontrol.tester.js index 3ff353fdbfaae..db61cf1251414 100644 --- a/services/packagecontrol/packagecontrol.tester.js +++ b/services/packagecontrol/packagecontrol.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' export const t = new ServiceTester({ id: 'packagecontrol', diff --git a/services/packagist/packagist-base.js b/services/packagist/packagist-base.js index 53fafe00577ce..083de17bdf102 100644 --- a/services/packagist/packagist-base.js +++ b/services/packagist/packagist-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const packageSchema = Joi.object() .pattern( @@ -105,4 +105,4 @@ export { BasePackagistService, customServerDocumentationFragment, cacheDocumentationFragment, -}; +} diff --git a/services/packagist/packagist-downloads.service.js b/services/packagist/packagist-downloads.service.js index ba1a1b49144f3..5d8f133b026ec 100644 --- a/services/packagist/packagist-downloads.service.js +++ b/services/packagist/packagist-downloads.service.js @@ -1,8 +1,13 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {optionalUrl} from '../validators.js'; -import {keywords, BasePackagistService, customServerDocumentationFragment, cacheDocumentationFragment} from './packagist-base.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { optionalUrl } from '../validators.js' +import { + keywords, + BasePackagistService, + customServerDocumentationFragment, + cacheDocumentationFragment, +} from './packagist-base.js' const periodMap = { dm: { @@ -96,4 +101,4 @@ export default class PackagistDownloads extends BasePackagistService { interval, }) } -}; +} diff --git a/services/packagist/packagist-downloads.tester.js b/services/packagist/packagist-downloads.tester.js index c9daf2a44fe02..ee76c04e3f3cb 100644 --- a/services/packagist/packagist-downloads.tester.js +++ b/services/packagist/packagist-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('daily downloads (valid, no package version specified)') diff --git a/services/packagist/packagist-license.service.js b/services/packagist/packagist-license.service.js index 65f55817323dd..241d9a291908e 100644 --- a/services/packagist/packagist-license.service.js +++ b/services/packagist/packagist-license.service.js @@ -1,8 +1,12 @@ -import Joi from 'joi'; -import {renderLicenseBadge} from '../licenses.js'; -import {optionalUrl} from '../validators.js'; -import {NotFound} from '../index.js'; -import {keywords, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; +import Joi from 'joi' +import { renderLicenseBadge } from '../licenses.js' +import { optionalUrl } from '../validators.js' +import { NotFound } from '../index.js' +import { + keywords, + BasePackagistService, + customServerDocumentationFragment, +} from './packagist-base.js' const packageSchema = Joi.object() .pattern( @@ -66,4 +70,4 @@ export default class PackagistLicense extends BasePackagistService { const { license } = this.transform({ json, user, repo }) return renderLicenseBadge({ license }) } -}; +} diff --git a/services/packagist/packagist-license.spec.js b/services/packagist/packagist-license.spec.js index fce371877dca9..8c3aaf1d79ea2 100644 --- a/services/packagist/packagist-license.spec.js +++ b/services/packagist/packagist-license.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {NotFound} from '../index.js'; -import PackagistLicense from './packagist-license.service.js'; +import { expect } from 'chai' +import { NotFound } from '../index.js' +import PackagistLicense from './packagist-license.service.js' describe('PackagistLicense', function () { it('should throw NotFound when default branch is missing', function () { diff --git a/services/packagist/packagist-license.tester.js b/services/packagist/packagist-license.tester.js index 6d5093c8c0f00..a9f3ef370bcb2 100644 --- a/services/packagist/packagist-license.tester.js +++ b/services/packagist/packagist-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('license (valid)') diff --git a/services/packagist/packagist-php-version.service.js b/services/packagist/packagist-php-version.service.js index b2db629d8fda2..72acd7ad98fce 100644 --- a/services/packagist/packagist-php-version.service.js +++ b/services/packagist/packagist-php-version.service.js @@ -1,7 +1,11 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {NotFound} from '../index.js'; -import {allVersionsSchema, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { NotFound } from '../index.js' +import { + allVersionsSchema, + BasePackagistService, + customServerDocumentationFragment, +} from './packagist-base.js' const queryParamSchema = Joi.object({ server: optionalUrl, @@ -94,4 +98,4 @@ export default class PackagistPhpVersion extends BasePackagistService { }) return this.constructor.render({ php: phpVersion }) } -}; +} diff --git a/services/packagist/packagist-php-version.spec.js b/services/packagist/packagist-php-version.spec.js index 18a2dd6411c2e..1eee30010e1aa 100644 --- a/services/packagist/packagist-php-version.spec.js +++ b/services/packagist/packagist-php-version.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {NotFound} from '../index.js'; -import PackagistPhpVersion from './packagist-php-version.service.js'; +import { expect } from 'chai' +import { NotFound } from '../index.js' +import PackagistPhpVersion from './packagist-php-version.service.js' describe('PackagistPhpVersion', function () { const json = { diff --git a/services/packagist/packagist-php-version.tester.js b/services/packagist/packagist-php-version.tester.js index cd2142bc6347c..c1c6015c3920a 100644 --- a/services/packagist/packagist-php-version.tester.js +++ b/services/packagist/packagist-php-version.tester.js @@ -1,5 +1,5 @@ -import {isComposerVersion} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isComposerVersion } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the package version of symfony') diff --git a/services/packagist/packagist-stars.service.js b/services/packagist/packagist-stars.service.js index fff65931ec37d..2b3820ffbcddc 100644 --- a/services/packagist/packagist-stars.service.js +++ b/services/packagist/packagist-stars.service.js @@ -1,7 +1,12 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger, optionalUrl} from '../validators.js'; -import {keywords, BasePackagistService, customServerDocumentationFragment, cacheDocumentationFragment} from './packagist-base.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger, optionalUrl } from '../validators.js' +import { + keywords, + BasePackagistService, + customServerDocumentationFragment, + cacheDocumentationFragment, +} from './packagist-base.js' const schema = Joi.object({ package: Joi.object({ @@ -71,4 +76,4 @@ export default class PackagistStars extends BasePackagistService { stars: favers, }) } -}; +} diff --git a/services/packagist/packagist-stars.tester.js b/services/packagist/packagist-stars.tester.js index f994def8dfdf6..00b1e0cca071b 100644 --- a/services/packagist/packagist-stars.tester.js +++ b/services/packagist/packagist-stars.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Stars (valid package)').get('/guzzlehttp/guzzle.json').expectBadge({ diff --git a/services/packagist/packagist-version.service.js b/services/packagist/packagist-version.service.js index 387b5a971c0c8..b20c699206696 100644 --- a/services/packagist/packagist-version.service.js +++ b/services/packagist/packagist-version.service.js @@ -1,9 +1,14 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {compare, isStable, latest} from '../php-version.js'; -import {optionalUrl} from '../validators.js'; -import {NotFound, redirector} from '../index.js'; -import {allVersionsSchema, keywords, BasePackagistService, customServerDocumentationFragment} from './packagist-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { compare, isStable, latest } from '../php-version.js' +import { optionalUrl } from '../validators.js' +import { NotFound, redirector } from '../index.js' +import { + allVersionsSchema, + keywords, + BasePackagistService, + customServerDocumentationFragment, +} from './packagist-base.js' const packageSchema = Joi.object() .pattern( @@ -141,4 +146,4 @@ const PackagistVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -export { PackagistVersion, PackagistVersionRedirector }; +export { PackagistVersion, PackagistVersionRedirector } diff --git a/services/packagist/packagist-version.tester.js b/services/packagist/packagist-version.tester.js index 500b35c20acd2..ba2c2797448f2 100644 --- a/services/packagist/packagist-version.tester.js +++ b/services/packagist/packagist-version.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { isVPlusDottedVersionNClausesWithOptionalSuffix } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'packagist', title: 'Packagist Version', diff --git a/services/php-eye/php-eye-hhvm.service.js b/services/php-eye/php-eye-hhvm.service.js index bdb2a744df966..1cb7888a4172a 100644 --- a/services/php-eye/php-eye-hhvm.service.js +++ b/services/php-eye/php-eye-hhvm.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default [ deprecatedService({ @@ -10,4 +10,4 @@ export default [ }, dateAdded: new Date('2018-04-20'), }), -]; +] diff --git a/services/php-eye/php-eye-hhvm.tester.js b/services/php-eye/php-eye-hhvm.tester.js index b97e2b6557353..c1c7408a945b0 100644 --- a/services/php-eye/php-eye-hhvm.tester.js +++ b/services/php-eye/php-eye-hhvm.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'hhvm', diff --git a/services/php-eye/php-eye-php-version.service.js b/services/php-eye/php-eye-php-version.service.js index 4235c930456e7..42e15f8c864a3 100644 --- a/services/php-eye/php-eye-php-version.service.js +++ b/services/php-eye/php-eye-php-version.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default [ deprecatedService({ @@ -10,4 +10,4 @@ export default [ }, dateAdded: new Date('2018-04-20'), }), -]; +] diff --git a/services/php-eye/php-eye-php-version.tester.js b/services/php-eye/php-eye-php-version.tester.js index 4ff362b17acd5..7806d60f67e0c 100644 --- a/services/php-eye/php-eye-php-version.tester.js +++ b/services/php-eye/php-eye-php-version.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'php-eye', diff --git a/services/php-version.js b/services/php-version.js index 53b0e5cfa2bf9..091bca3c8b243 100644 --- a/services/php-version.js +++ b/services/php-version.js @@ -3,11 +3,11 @@ * using the algorithm followed by Composer (see * https://getcomposer.org/doc/04-schema.md#version). */ -import {promisify} from 'util'; -import request from 'request'; -import {regularUpdate} from '../core/legacy/regular-update.js'; -import {listCompare} from './version.js'; -import {omitv} from './text-formatters.js'; +import { promisify } from 'util' +import request from 'request' +import { regularUpdate } from '../core/legacy/regular-update.js' +import { listCompare } from './version.js' +import { omitv } from './text-formatters.js' // Return a negative value if v1 < v2, // zero if v1 = v2, a positive value otherwise. @@ -235,7 +235,7 @@ async function getPhpReleases(githubApiProvider) { ), request: (url, options, cb) => githubApiProvider.request(request, url, {}, cb), - }); + }) } export { @@ -245,4 +245,4 @@ export { minorVersion, versionReduction, getPhpReleases, -}; +} diff --git a/services/php-version.spec.js b/services/php-version.spec.js index 81eaa4763a96f..2ccd237dd3b25 100644 --- a/services/php-version.spec.js +++ b/services/php-version.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {compare, minorVersion, versionReduction} from './php-version.js'; +import { test, given } from 'sazerac' +import { compare, minorVersion, versionReduction } from './php-version.js' const phpReleases = [ '5.0', diff --git a/services/pingpong/pingpong-status.service.js b/services/pingpong/pingpong-status.service.js index 8c47ead1a2122..7297f52a2e551 100644 --- a/services/pingpong/pingpong-status.service.js +++ b/services/pingpong/pingpong-status.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService, InvalidParameter, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService, InvalidParameter, InvalidResponse } from '../index.js' const schema = Joi.object({ status: Joi.string().required(), @@ -65,4 +65,4 @@ export default class PingPongStatus extends BaseJsonService { const { status } = await this.fetch({ apiKey }) return this.constructor.render({ status }) } -}; +} diff --git a/services/pingpong/pingpong-status.tester.js b/services/pingpong/pingpong-status.tester.js index 49eb2ae17cfb0..021e6c1897854 100644 --- a/services/pingpong/pingpong-status.tester.js +++ b/services/pingpong/pingpong-status.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isCorrectStatus = Joi.string().valid( diff --git a/services/pingpong/pingpong-uptime.service.js b/services/pingpong/pingpong-uptime.service.js index 3dea3e0f43363..eb58d7e456b43 100644 --- a/services/pingpong/pingpong-uptime.service.js +++ b/services/pingpong/pingpong-uptime.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService, InvalidParameter} from '../index.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import { BaseJsonService, InvalidParameter } from '../index.js' const schema = Joi.object({ uptime: Joi.number().min(0).max(100).required(), @@ -56,4 +56,4 @@ export default class PingPongUptime extends BaseJsonService { const { uptime } = await this.fetch({ apiKey }) return this.constructor.render({ uptime }) } -}; +} diff --git a/services/pingpong/pingpong-uptime.tester.js b/services/pingpong/pingpong-uptime.tester.js index 02abb346f7c71..0128983289ca4 100644 --- a/services/pingpong/pingpong-uptime.tester.js +++ b/services/pingpong/pingpong-uptime.tester.js @@ -1,5 +1,5 @@ -import {isPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('PingPong: Uptime (valid)') diff --git a/services/pipenv-helpers.js b/services/pipenv-helpers.js index 2992617a89bb4..f5663f6b363e8 100644 --- a/services/pipenv-helpers.js +++ b/services/pipenv-helpers.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {InvalidParameter} from './index.js'; +import Joi from 'joi' +import { InvalidParameter } from './index.js' const isDependency = Joi.alternatives( Joi.object({ @@ -50,7 +50,4 @@ function getDependencyVersion({ } } -export { - isLockfile, - getDependencyVersion, -}; +export { isLockfile, getDependencyVersion } diff --git a/services/pkgreview/package-rating.service.js b/services/pkgreview/package-rating.service.js index 6297d67ad0dd4..25dbe0cba4bd5 100644 --- a/services/pkgreview/package-rating.service.js +++ b/services/pkgreview/package-rating.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {starRating, metric} from '../text-formatters.js'; -import {colorScale} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { starRating, metric } from '../text-formatters.js' +import { colorScale } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const pkgReviewColor = colorScale([2, 3, 4]) @@ -80,4 +80,4 @@ export default class PkgreviewRating extends BaseJsonService { rating: rating * 5, }) } -}; +} diff --git a/services/pkgreview/package-rating.tester.js b/services/pkgreview/package-rating.tester.js index dd00a4bf4c0b9..ad4b483e56d7c 100644 --- a/services/pkgreview/package-rating.tester.js +++ b/services/pkgreview/package-rating.tester.js @@ -1,5 +1,5 @@ -import {withRegex, isStarRating} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex, isStarRating } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isRatingWithReviews = withRegex( diff --git a/services/poeditor/poeditor.service.js b/services/poeditor/poeditor.service.js index 1671050b549f3..806d9bfcfca28 100644 --- a/services/poeditor/poeditor.service.js +++ b/services/poeditor/poeditor.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {coveragePercentage} from '../color-formatters.js'; -import {BaseJsonService, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { coveragePercentage } from '../color-formatters.js' +import { BaseJsonService, InvalidResponse } from '../index.js' const documentation = `

@@ -99,4 +99,4 @@ export default class POEditor extends BaseJsonService { language: languages.find(lang => lang.code === languageCode), }) } -}; +} diff --git a/services/poeditor/poeditor.tester.js b/services/poeditor/poeditor.tester.js index 688f9a5cb7d66..691f4d816fa4c 100644 --- a/services/poeditor/poeditor.tester.js +++ b/services/poeditor/poeditor.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets POEditor progress online') diff --git a/services/powershellgallery/powershellgallery.service.js b/services/powershellgallery/powershellgallery.service.js index 9d07486bad1ae..c5e66108deb60 100644 --- a/services/powershellgallery/powershellgallery.service.js +++ b/services/powershellgallery/powershellgallery.service.js @@ -1,5 +1,5 @@ -import {fetch, createServiceFamily} from '../nuget/nuget-v2-service-family.js'; -import {BaseXmlService} from '../index.js'; +import { fetch, createServiceFamily } from '../nuget/nuget-v2-service-family.js' +import { BaseXmlService } from '../index.js' const WINDOWS_TAG_NAME = 'windows' const MACOS_TAG_NAME = 'macos' @@ -97,4 +97,4 @@ export { PowershellGalleryVersionRedirector, PowershellGalleryDownloads, PowershellGalleryPlatformSupport, -}; +} diff --git a/services/powershellgallery/powershellgallery.tester.js b/services/powershellgallery/powershellgallery.tester.js index 0ef0845fb7494..14380ca4870de 100644 --- a/services/powershellgallery/powershellgallery.tester.js +++ b/services/powershellgallery/powershellgallery.tester.js @@ -1,6 +1,10 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { + isMetric, + isVPlusDottedVersionNClauses, + isVPlusDottedVersionNClausesWithOptionalSuffix, +} from '../test-validators.js' const isPlatform = Joi.string().regex( /^(windows|linux|macos)( \| (windows|linux|macos))*$/ ) diff --git a/services/pub/pub.service.js b/services/pub/pub.service.js index cda5e01bfb896..19822dc4d5cbd 100644 --- a/services/pub/pub.service.js +++ b/services/pub/pub.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {latest, renderVersionBadge} from '../version.js'; -import {BaseJsonService, redirector} from '../index.js'; +import Joi from 'joi' +import { latest, renderVersionBadge } from '../version.js' +import { BaseJsonService, redirector } from '../index.js' const schema = Joi.object({ versions: Joi.array().items(Joi.string()).required(), @@ -66,4 +66,4 @@ const PubVersionRedirector = redirector({ dateAdded: new Date('2019-12-15'), }) -export { PubVersion, PubVersionRedirector }; +export { PubVersion, PubVersionRedirector } diff --git a/services/pub/pub.tester.js b/services/pub/pub.tester.js index d3b853fc85126..63ff3b6fee3aa 100644 --- a/services/pub/pub.tester.js +++ b/services/pub/pub.tester.js @@ -1,5 +1,5 @@ -import {isVPlusTripleDottedVersion} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isVPlusTripleDottedVersion } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'PubVersion', title: 'Pub Version', diff --git a/services/puppetforge/puppetforge-base.js b/services/puppetforge/puppetforge-base.js index 4446670a888a0..8adb266bec92a 100644 --- a/services/puppetforge/puppetforge-base.js +++ b/services/puppetforge/puppetforge-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger, semver} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger, semver } from '../validators.js' +import { BaseJsonService } from '../index.js' const usersSchema = Joi.object({ module_count: nonNegativeInteger, @@ -42,7 +42,4 @@ class BasePuppetForgeModulesService extends BaseJsonService { } } -export { - BasePuppetForgeModulesService, - BasePuppetForgeUsersService, -}; +export { BasePuppetForgeModulesService, BasePuppetForgeUsersService } diff --git a/services/puppetforge/puppetforge-module-downloads.service.js b/services/puppetforge/puppetforge-module-downloads.service.js index 3133e19278502..61a9795ff70ca 100644 --- a/services/puppetforge/puppetforge-module-downloads.service.js +++ b/services/puppetforge/puppetforge-module-downloads.service.js @@ -1,10 +1,8 @@ -import {downloadCount} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {BasePuppetForgeModulesService} from './puppetforge-base.js'; +import { downloadCount } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { BasePuppetForgeModulesService } from './puppetforge-base.js' -export default class PuppetforgeModuleDownloads extends ( - BasePuppetForgeModulesService -) { +export default class PuppetforgeModuleDownloads extends BasePuppetForgeModulesService { static category = 'downloads' static route = { @@ -36,4 +34,4 @@ export default class PuppetforgeModuleDownloads extends ( const data = await this.fetch({ user, moduleName }) return this.constructor.render({ downloads: data.downloads }) } -}; +} diff --git a/services/puppetforge/puppetforge-module-downloads.tester.js b/services/puppetforge/puppetforge-module-downloads.tester.js index ea52b3c71eaae..ad5e9f10b07e5 100644 --- a/services/puppetforge/puppetforge-module-downloads.tester.js +++ b/services/puppetforge/puppetforge-module-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('module downloads').get('/camptocamp/openssl.json').expectBadge({ diff --git a/services/puppetforge/puppetforge-module-endorsement.service.js b/services/puppetforge/puppetforge-module-endorsement.service.js index 425cd02157a6e..2ebc258cb7a1d 100644 --- a/services/puppetforge/puppetforge-module-endorsement.service.js +++ b/services/puppetforge/puppetforge-module-endorsement.service.js @@ -1,9 +1,7 @@ -import {NotFound} from '../index.js'; -import {BasePuppetForgeModulesService} from './puppetforge-base.js'; +import { NotFound } from '../index.js' +import { BasePuppetForgeModulesService } from './puppetforge-base.js' -export default class PuppetforgeModuleEndorsement extends ( - BasePuppetForgeModulesService -) { +export default class PuppetforgeModuleEndorsement extends BasePuppetForgeModulesService { static category = 'rating' static route = { @@ -43,4 +41,4 @@ export default class PuppetforgeModuleEndorsement extends ( } return this.constructor.render({ endorsement }) } -}; +} diff --git a/services/puppetforge/puppetforge-module-endorsement.tester.js b/services/puppetforge/puppetforge-module-endorsement.tester.js index 04aa3593c76f1..2f03a591fbbfd 100644 --- a/services/puppetforge/puppetforge-module-endorsement.tester.js +++ b/services/puppetforge/puppetforge-module-endorsement.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('module endorsement') diff --git a/services/puppetforge/puppetforge-module-feedback.service.js b/services/puppetforge/puppetforge-module-feedback.service.js index a1420f18aa149..041d8b3e87dd0 100644 --- a/services/puppetforge/puppetforge-module-feedback.service.js +++ b/services/puppetforge/puppetforge-module-feedback.service.js @@ -1,10 +1,8 @@ -import {coveragePercentage as coveragePercentageColor} from '../color-formatters.js'; -import {NotFound} from '../index.js'; -import {BasePuppetForgeModulesService} from './puppetforge-base.js'; +import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js' +import { NotFound } from '../index.js' +import { BasePuppetForgeModulesService } from './puppetforge-base.js' -export default class PuppetforgeModuleFeedback extends ( - BasePuppetForgeModulesService -) { +export default class PuppetforgeModuleFeedback extends BasePuppetForgeModulesService { static category = 'rating' static route = { @@ -39,4 +37,4 @@ export default class PuppetforgeModuleFeedback extends ( } return this.constructor.render({ score: data.feedback_score }) } -}; +} diff --git a/services/puppetforge/puppetforge-module-feedback.tester.js b/services/puppetforge/puppetforge-module-feedback.tester.js index be75019d37782..24128bd7e1d97 100644 --- a/services/puppetforge/puppetforge-module-feedback.tester.js +++ b/services/puppetforge/puppetforge-module-feedback.tester.js @@ -1,5 +1,5 @@ -import {isPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('module feedback').get('/camptocamp/openssl.json').expectBadge({ diff --git a/services/puppetforge/puppetforge-module-pdk-version.service.js b/services/puppetforge/puppetforge-module-pdk-version.service.js index e9ac7cb12049b..69c8654214319 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.service.js +++ b/services/puppetforge/puppetforge-module-pdk-version.service.js @@ -1,10 +1,8 @@ -import {renderVersionBadge} from '../version.js'; -import {NotFound} from '../index.js'; -import {BasePuppetForgeModulesService} from './puppetforge-base.js'; +import { renderVersionBadge } from '../version.js' +import { NotFound } from '../index.js' +import { BasePuppetForgeModulesService } from './puppetforge-base.js' -export default class PuppetforgeModulePdkVersion extends ( - BasePuppetForgeModulesService -) { +export default class PuppetforgeModulePdkVersion extends BasePuppetForgeModulesService { static category = 'platform-support' static route = { @@ -35,4 +33,4 @@ export default class PuppetforgeModulePdkVersion extends ( throw new NotFound({ prettyMessage: 'none' }) } } -}; +} diff --git a/services/puppetforge/puppetforge-module-pdk-version.tester.js b/services/puppetforge/puppetforge-module-pdk-version.tester.js index f8697b61e30f7..cbcd15d9b5c5e 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.tester.js +++ b/services/puppetforge/puppetforge-module-pdk-version.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('PDK version').get('/tragiccode/azure_key_vault.json').expectBadge({ diff --git a/services/puppetforge/puppetforge-module-version.service.js b/services/puppetforge/puppetforge-module-version.service.js index bda35c2cc89b9..b3cb980f7e594 100644 --- a/services/puppetforge/puppetforge-module-version.service.js +++ b/services/puppetforge/puppetforge-module-version.service.js @@ -1,9 +1,7 @@ -import {renderVersionBadge} from '../version.js'; -import {BasePuppetForgeModulesService} from './puppetforge-base.js'; +import { renderVersionBadge } from '../version.js' +import { BasePuppetForgeModulesService } from './puppetforge-base.js' -export default class PuppetforgeModuleVersion extends ( - BasePuppetForgeModulesService -) { +export default class PuppetforgeModuleVersion extends BasePuppetForgeModulesService { static category = 'version' static route = { @@ -28,4 +26,4 @@ export default class PuppetforgeModuleVersion extends ( const data = await this.fetch({ user, moduleName }) return renderVersionBadge({ version: data.current_release.version }) } -}; +} diff --git a/services/puppetforge/puppetforge-module-version.tester.js b/services/puppetforge/puppetforge-module-version.tester.js index d3b483f9366d1..79117a314e308 100644 --- a/services/puppetforge/puppetforge-module-version.tester.js +++ b/services/puppetforge/puppetforge-module-version.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('module version').get('/camptocamp/openssl.json').expectBadge({ diff --git a/services/puppetforge/puppetforge-user-module-count.service.js b/services/puppetforge/puppetforge-user-module-count.service.js index d0da8557d3892..1666b110197db 100644 --- a/services/puppetforge/puppetforge-user-module-count.service.js +++ b/services/puppetforge/puppetforge-user-module-count.service.js @@ -1,10 +1,8 @@ -import {metric} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BasePuppetForgeUsersService} from './puppetforge-base.js'; +import { metric } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BasePuppetForgeUsersService } from './puppetforge-base.js' -export default class PuppetForgeModuleCountService extends ( - BasePuppetForgeUsersService -) { +export default class PuppetForgeModuleCountService extends BasePuppetForgeUsersService { static category = 'other' static route = { @@ -35,4 +33,4 @@ export default class PuppetForgeModuleCountService extends ( const data = await this.fetch({ user }) return this.constructor.render({ modules: data.module_count }) } -}; +} diff --git a/services/puppetforge/puppetforge-user-module-count.tester.js b/services/puppetforge/puppetforge-user-module-count.tester.js index dde1b482f8b10..2d999d1078416 100644 --- a/services/puppetforge/puppetforge-user-module-count.tester.js +++ b/services/puppetforge/puppetforge-user-module-count.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('modules by user').get('/camptocamp.json').expectBadge({ diff --git a/services/puppetforge/puppetforge-user-release-count.service.js b/services/puppetforge/puppetforge-user-release-count.service.js index 918f01b5f812c..d13703dc395f8 100644 --- a/services/puppetforge/puppetforge-user-release-count.service.js +++ b/services/puppetforge/puppetforge-user-release-count.service.js @@ -1,10 +1,8 @@ -import {metric} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BasePuppetForgeUsersService} from './puppetforge-base.js'; +import { metric } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BasePuppetForgeUsersService } from './puppetforge-base.js' -export default class PuppetForgeReleaseCountService extends ( - BasePuppetForgeUsersService -) { +export default class PuppetForgeReleaseCountService extends BasePuppetForgeUsersService { static category = 'other' static route = { @@ -35,4 +33,4 @@ export default class PuppetForgeReleaseCountService extends ( const data = await this.fetch({ user }) return this.constructor.render({ releases: data.release_count }) } -}; +} diff --git a/services/puppetforge/puppetforge-user-release-count.tester.js b/services/puppetforge/puppetforge-user-release-count.tester.js index d6d6c40edfbaa..f8a8d60028c05 100644 --- a/services/puppetforge/puppetforge-user-release-count.tester.js +++ b/services/puppetforge/puppetforge-user-release-count.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('releases by user').get('/camptocamp.json').expectBadge({ diff --git a/services/pypi/pypi-base.js b/services/pypi/pypi-base.js index bb5d81b87c9f2..e19d6e23a510c 100644 --- a/services/pypi/pypi-base.js +++ b/services/pypi/pypi-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ info: Joi.object({ @@ -37,4 +37,4 @@ export default class PypiBase extends BaseJsonService { errorMessages: { 404: 'package or version not found' }, }) } -}; +} diff --git a/services/pypi/pypi-django-versions.service.js b/services/pypi/pypi-django-versions.service.js index 5a742b8ee6cb8..ffe0fbf1bf37f 100644 --- a/services/pypi/pypi-django-versions.service.js +++ b/services/pypi/pypi-django-versions.service.js @@ -1,5 +1,5 @@ -import PypiBase from './pypi-base.js'; -import {sortDjangoVersions, parseClassifiers} from './pypi-helpers.js'; +import PypiBase from './pypi-base.js' +import { sortDjangoVersions, parseClassifiers } from './pypi-helpers.js' export default class PypiDjangoVersions extends PypiBase { static category = 'platform-support' @@ -42,4 +42,4 @@ export default class PypiDjangoVersions extends PypiBase { return this.constructor.render({ versions }) } -}; +} diff --git a/services/pypi/pypi-django-versions.tester.js b/services/pypi/pypi-django-versions.tester.js index e57e87c71e999..83fdca15ec086 100644 --- a/services/pypi/pypi-django-versions.tester.js +++ b/services/pypi/pypi-django-versions.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isPipeSeparatedDjangoVersions = Joi.string().regex( diff --git a/services/pypi/pypi-downloads.service.js b/services/pypi/pypi-downloads.service.js index 147ac8144c573..21cc1133dd96a 100644 --- a/services/pypi/pypi-downloads.service.js +++ b/services/pypi/pypi-downloads.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {downloadCount} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { downloadCount } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const keywords = ['python'] @@ -75,4 +75,4 @@ export default class PypiDownloads extends BaseJsonService { downloads: json.data[periodMap[period].api_field], }) } -}; +} diff --git a/services/pypi/pypi-downloads.tester.js b/services/pypi/pypi-downloads.tester.js index d119ed41fe8bb..5e4b57fe987c2 100644 --- a/services/pypi/pypi-downloads.tester.js +++ b/services/pypi/pypi-downloads.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetricOverTimePeriod} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetricOverTimePeriod } from '../test-validators.js' export const t = await createServiceTester() t.create('daily downloads (valid)') diff --git a/services/pypi/pypi-format.service.js b/services/pypi/pypi-format.service.js index 127538fecf931..cef3285e48433 100644 --- a/services/pypi/pypi-format.service.js +++ b/services/pypi/pypi-format.service.js @@ -1,5 +1,5 @@ -import PypiBase from './pypi-base.js'; -import {getPackageFormats} from './pypi-helpers.js'; +import PypiBase from './pypi-base.js' +import { getPackageFormats } from './pypi-helpers.js' export default class PypiFormat extends PypiBase { static category = 'other' @@ -42,4 +42,4 @@ export default class PypiFormat extends PypiBase { const { hasWheel, hasEgg } = getPackageFormats(packageData) return this.constructor.render({ hasWheel, hasEgg }) } -}; +} diff --git a/services/pypi/pypi-format.tester.js b/services/pypi/pypi-format.tester.js index ccded77bcb274..af025c67305b8 100644 --- a/services/pypi/pypi-format.tester.js +++ b/services/pypi/pypi-format.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('format (wheel, package version in request)') diff --git a/services/pypi/pypi-helpers.js b/services/pypi/pypi-helpers.js index 1921bb7655a8a..3d3fa9f9f55a6 100644 --- a/services/pypi/pypi-helpers.js +++ b/services/pypi/pypi-helpers.js @@ -109,4 +109,4 @@ export { sortDjangoVersions, getLicenses, getPackageFormats, -}; +} diff --git a/services/pypi/pypi-implementation.service.js b/services/pypi/pypi-implementation.service.js index 27d8b5e1dad4a..b5a050fecdd37 100644 --- a/services/pypi/pypi-implementation.service.js +++ b/services/pypi/pypi-implementation.service.js @@ -1,5 +1,5 @@ -import PypiBase from './pypi-base.js'; -import {parseClassifiers} from './pypi-helpers.js'; +import PypiBase from './pypi-base.js' +import { parseClassifiers } from './pypi-helpers.js' export default class PypiImplementation extends PypiBase { static category = 'platform-support' @@ -39,4 +39,4 @@ export default class PypiImplementation extends PypiBase { return this.constructor.render({ implementations }) } -}; +} diff --git a/services/pypi/pypi-implementation.tester.js b/services/pypi/pypi-implementation.tester.js index f15de78ce3ac5..4de094f51205c 100644 --- a/services/pypi/pypi-implementation.tester.js +++ b/services/pypi/pypi-implementation.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('implementation (valid, package version in request)') diff --git a/services/pypi/pypi-license.service.js b/services/pypi/pypi-license.service.js index 234e200d30947..c2d2a3228cf0a 100644 --- a/services/pypi/pypi-license.service.js +++ b/services/pypi/pypi-license.service.js @@ -1,6 +1,6 @@ -import {renderLicenseBadge} from '../licenses.js'; -import PypiBase from './pypi-base.js'; -import {getLicenses} from './pypi-helpers.js'; +import { renderLicenseBadge } from '../licenses.js' +import PypiBase from './pypi-base.js' +import { getLicenses } from './pypi-helpers.js' export default class PypiLicense extends PypiBase { static category = 'license' @@ -26,4 +26,4 @@ export default class PypiLicense extends PypiBase { const licenses = getLicenses(packageData) return this.constructor.render({ licenses }) } -}; +} diff --git a/services/pypi/pypi-license.tester.js b/services/pypi/pypi-license.tester.js index 96c6748739e3e..74cce2a414425 100644 --- a/services/pypi/pypi-license.tester.js +++ b/services/pypi/pypi-license.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('license (valid, package version in request)') diff --git a/services/pypi/pypi-python-versions.service.js b/services/pypi/pypi-python-versions.service.js index b845f34d4ec02..569fc7aa993ec 100644 --- a/services/pypi/pypi-python-versions.service.js +++ b/services/pypi/pypi-python-versions.service.js @@ -1,6 +1,6 @@ -import semver from 'semver'; -import PypiBase from './pypi-base.js'; -import {parseClassifiers} from './pypi-helpers.js'; +import semver from 'semver' +import PypiBase from './pypi-base.js' +import { parseClassifiers } from './pypi-helpers.js' export default class PypiPythonVersions extends PypiBase { static category = 'platform-support' @@ -63,4 +63,4 @@ export default class PypiPythonVersions extends PypiBase { return this.constructor.render({ versions }) } -}; +} diff --git a/services/pypi/pypi-python-versions.spec.js b/services/pypi/pypi-python-versions.spec.js index 3b7595bf60717..8a8c483882e9e 100644 --- a/services/pypi/pypi-python-versions.spec.js +++ b/services/pypi/pypi-python-versions.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import PypiPythonVersions from './pypi-python-versions.service.js'; +import { test, given } from 'sazerac' +import PypiPythonVersions from './pypi-python-versions.service.js' describe('PyPI Python Version', function () { test(PypiPythonVersions.render, function () { diff --git a/services/pypi/pypi-python-versions.tester.js b/services/pypi/pypi-python-versions.tester.js index fef7586e021ce..36146ddf92a97 100644 --- a/services/pypi/pypi-python-versions.tester.js +++ b/services/pypi/pypi-python-versions.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isPipeSeparatedPythonVersions = Joi.string().regex( diff --git a/services/pypi/pypi-status.service.js b/services/pypi/pypi-status.service.js index e4f68afbda472..77bff049aace1 100644 --- a/services/pypi/pypi-status.service.js +++ b/services/pypi/pypi-status.service.js @@ -1,5 +1,5 @@ -import PypiBase from './pypi-base.js'; -import {parseClassifiers} from './pypi-helpers.js'; +import PypiBase from './pypi-base.js' +import { parseClassifiers } from './pypi-helpers.js' export default class PypiStatus extends PypiBase { static category = 'other' @@ -60,4 +60,4 @@ export default class PypiStatus extends PypiBase { return this.constructor.render({ status }) } -}; +} diff --git a/services/pypi/pypi-status.tester.js b/services/pypi/pypi-status.tester.js index f24621976461c..764254fe0eba6 100644 --- a/services/pypi/pypi-status.tester.js +++ b/services/pypi/pypi-status.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('status (valid, stable, package version in request)') diff --git a/services/pypi/pypi-version.service.js b/services/pypi/pypi-version.service.js index 86a34d66f8fce..9a421bd01c444 100644 --- a/services/pypi/pypi-version.service.js +++ b/services/pypi/pypi-version.service.js @@ -1,5 +1,5 @@ -import {renderVersionBadge} from '../version.js'; -import PypiBase from './pypi-base.js'; +import { renderVersionBadge } from '../version.js' +import PypiBase from './pypi-base.js' export default class PypiVersion extends PypiBase { static category = 'version' @@ -28,4 +28,4 @@ export default class PypiVersion extends PypiBase { } = await this.fetch({ egg }) return this.constructor.render({ version }) } -}; +} diff --git a/services/pypi/pypi-version.tester.js b/services/pypi/pypi-version.tester.js index de7ff70af4d95..ed083d92c6504 100644 --- a/services/pypi/pypi-version.tester.js +++ b/services/pypi/pypi-version.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {isSemver} from '../test-validators.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { isSemver } from '../test-validators.js' export const t = await createServiceTester() const isPsycopg2Version = Joi.string().regex(/^v([0-9][.]?)+$/) diff --git a/services/pypi/pypi-wheel.service.js b/services/pypi/pypi-wheel.service.js index 9525b17b97323..a81e2e4d42bd5 100644 --- a/services/pypi/pypi-wheel.service.js +++ b/services/pypi/pypi-wheel.service.js @@ -1,5 +1,5 @@ -import PypiBase from './pypi-base.js'; -import {getPackageFormats} from './pypi-helpers.js'; +import PypiBase from './pypi-base.js' +import { getPackageFormats } from './pypi-helpers.js' export default class PypiWheel extends PypiBase { static category = 'platform-support' @@ -37,4 +37,4 @@ export default class PypiWheel extends PypiBase { const { hasWheel } = getPackageFormats(packageData) return this.constructor.render({ hasWheel }) } -}; +} diff --git a/services/pypi/pypi-wheel.tester.js b/services/pypi/pypi-wheel.tester.js index 0cd52775e71ba..a70afaf4d4bf5 100644 --- a/services/pypi/pypi-wheel.tester.js +++ b/services/pypi/pypi-wheel.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('wheel (has wheel, package version in request)') diff --git a/services/readthedocs/readthedocs.service.js b/services/readthedocs/readthedocs.service.js index a441fd9c3f245..7522e69c3fc5f 100644 --- a/services/readthedocs/readthedocs.service.js +++ b/services/readthedocs/readthedocs.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService, NotFound} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService, NotFound } from '../index.js' const keywords = ['documentation'] @@ -58,4 +58,4 @@ export default class ReadTheDocs extends BaseSvgScrapingService { } return this.constructor.render({ status }) } -}; +} diff --git a/services/readthedocs/readthedocs.tester.js b/services/readthedocs/readthedocs.tester.js index 762e843fff868..5bf83194da2d7 100644 --- a/services/readthedocs/readthedocs.tester.js +++ b/services/readthedocs/readthedocs.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('build status') diff --git a/services/reddit/subreddit-subscribers.service.js b/services/reddit/subreddit-subscribers.service.js index 3537662d85296..2d0ce5c53d7d3 100644 --- a/services/reddit/subreddit-subscribers.service.js +++ b/services/reddit/subreddit-subscribers.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {optionalNonNegativeInteger} from '../validators.js'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { optionalNonNegativeInteger } from '../validators.js' +import { metric } from '../text-formatters.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object({ data: Joi.object({ @@ -71,4 +71,4 @@ export default class RedditSubredditSubscribers extends BaseJsonService { subscribers, }) } -}; +} diff --git a/services/reddit/subreddit-subscribers.tester.js b/services/reddit/subreddit-subscribers.tester.js index 839e030e0db9d..1038718d523c8 100644 --- a/services/reddit/subreddit-subscribers.tester.js +++ b/services/reddit/subreddit-subscribers.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('subreddit-subscribers (valid subreddit)') diff --git a/services/reddit/user-karma.service.js b/services/reddit/user-karma.service.js index 014c9807029e4..c5595f21e16e4 100644 --- a/services/reddit/user-karma.service.js +++ b/services/reddit/user-karma.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {metric} from '../text-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { metric } from '../text-formatters.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ data: Joi.object({ @@ -83,4 +83,4 @@ export default class RedditUserKarma extends BaseJsonService { user, }) } -}; +} diff --git a/services/reddit/user-karma.tester.js b/services/reddit/user-karma.tester.js index ff39e32b5b773..9023023dbb630 100644 --- a/services/reddit/user-karma.tester.js +++ b/services/reddit/user-karma.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('user-karma (valid - link)') diff --git a/services/redmine/redmine.service.js b/services/redmine/redmine.service.js index 7dc06bc5b13d7..288a36ffe4719 100644 --- a/services/redmine/redmine.service.js +++ b/services/redmine/redmine.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {starRating} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseXmlService} from '../index.js'; +import Joi from 'joi' +import { starRating } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BaseXmlService } from '../index.js' const schema = Joi.object({ 'redmine-plugin': Joi.object({ @@ -76,4 +76,4 @@ class RedminePluginStars extends BaseRedminePluginRating { } } -export { RedminePluginRating, RedminePluginStars }; +export { RedminePluginRating, RedminePluginStars } diff --git a/services/redmine/redmine.tester.js b/services/redmine/redmine.tester.js index 79a8242ce640e..c69e6e6eceac0 100644 --- a/services/redmine/redmine.tester.js +++ b/services/redmine/redmine.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isStarRating} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { isStarRating } from '../test-validators.js' export const t = new ServiceTester({ id: 'redmine', diff --git a/services/repology/repology-repositories.service.js b/services/repology/repology-repositories.service.js index a49453065f767..98b5e3ff55dc6 100644 --- a/services/repology/repology-repositories.service.js +++ b/services/repology/repology-repositories.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseSvgScrapingService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseSvgScrapingService } from '../index.js' const schema = Joi.object({ message: nonNegativeInteger, @@ -42,4 +42,4 @@ export default class RepologyRepositories extends BaseSvgScrapingService { return this.constructor.render({ repositoryCount }) } -}; +} diff --git a/services/repology/repology-repositories.tester.js b/services/repology/repology-repositories.tester.js index 1ceaff00b53b4..8250bec843d54 100644 --- a/services/repology/repology-repositories.tester.js +++ b/services/repology/repology-repositories.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {nonNegativeInteger} from '../validators.js'; +import { createServiceTester } from '../tester.js' +import { nonNegativeInteger } from '../validators.js' export const t = await createServiceTester() t.create('Existing project').get('/starship.json').expectBadge({ diff --git a/services/requires/requires.service.js b/services/requires/requires.service.js index 90836be2aad67..03f822231647d 100644 --- a/services/requires/requires.service.js +++ b/services/requires/requires.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const statusSchema = Joi.object({ status: Joi.string().required(), @@ -62,4 +62,4 @@ export default class RequiresIo extends BaseJsonService { const { status } = await this.fetch({ service, user, repo, branch }) return this.constructor.render({ status }) } -}; +} diff --git a/services/requires/requires.tester.js b/services/requires/requires.tester.js index a319423ca111f..b5dc253ba7087 100644 --- a/services/requires/requires.tester.js +++ b/services/requires/requires.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isRequireStatus = Joi.string().regex( diff --git a/services/resharper/resharper.service.js b/services/resharper/resharper.service.js index 9dca4de372459..ef05a293379ac 100644 --- a/services/resharper/resharper.service.js +++ b/services/resharper/resharper.service.js @@ -1,4 +1,4 @@ -import {createServiceFamily} from '../nuget/nuget-v2-service-family.js'; +import { createServiceFamily } from '../nuget/nuget-v2-service-family.js' export default createServiceFamily({ name: 'ResharperPlugin', @@ -11,4 +11,4 @@ export default createServiceFamily({ exampleVersion: '2017.2.0', examplePrereleaseVersion: '2017.3.0-pre0001', exampleDownloadCount: 9e4, -}); +}) diff --git a/services/resharper/resharper.tester.js b/services/resharper/resharper.tester.js index 31bb81c7e49db..d4332f8961cd0 100644 --- a/services/resharper/resharper.tester.js +++ b/services/resharper/resharper.tester.js @@ -1,5 +1,9 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isVPlusDottedVersionNClauses, isVPlusDottedVersionNClausesWithOptionalSuffix} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { + isMetric, + isVPlusDottedVersionNClauses, + isVPlusDottedVersionNClausesWithOptionalSuffix, +} from '../test-validators.js' export const t = new ServiceTester({ id: 'resharper', diff --git a/services/response-fixtures.js b/services/response-fixtures.js index 575a9fea98dfe..90557126f56ad 100644 --- a/services/response-fixtures.js +++ b/services/response-fixtures.js @@ -1,7 +1,7 @@ export const invalidJSONString = '{{{{{invalid json}}' export const invalidJSON = () => [ - 200, - invalidJSONString, - { 'Content-Type': 'application/json' }, - ] + 200, + invalidJSONString, + { 'Content-Type': 'application/json' }, +] diff --git a/services/reuse/reuse-compliance-helper.js b/services/reuse/reuse-compliance-helper.js index 67cd00b65c7c8..7503696bb373c 100644 --- a/services/reuse/reuse-compliance-helper.js +++ b/services/reuse/reuse-compliance-helper.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' const COLOR_MAP = { checking: 'brightgreen', @@ -11,7 +11,4 @@ const isReuseCompliance = Joi.string() .valid('compliant', 'non-compliant', 'checking', 'unregistered') .required() -export { - isReuseCompliance, - COLOR_MAP, -}; +export { isReuseCompliance, COLOR_MAP } diff --git a/services/reuse/reuse-compliance.service.js b/services/reuse/reuse-compliance.service.js index 25d99a92275f1..93933f5f9008d 100644 --- a/services/reuse/reuse-compliance.service.js +++ b/services/reuse/reuse-compliance.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; -import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { isReuseCompliance, COLOR_MAP } from './reuse-compliance-helper.js' const responseSchema = Joi.object({ status: isReuseCompliance, @@ -51,4 +51,4 @@ export default class Reuse extends BaseJsonService { const { status } = await this.fetch({ remote }) return this.constructor.render({ status }) } -}; +} diff --git a/services/reuse/reuse-compliance.tester.js b/services/reuse/reuse-compliance.tester.js index bf059a8f55040..de7202f6dbf76 100644 --- a/services/reuse/reuse-compliance.tester.js +++ b/services/reuse/reuse-compliance.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isReuseCompliance, COLOR_MAP} from './reuse-compliance-helper.js'; +import { createServiceTester } from '../tester.js' +import { isReuseCompliance, COLOR_MAP } from './reuse-compliance-helper.js' export const t = await createServiceTester() t.create('valid repo -- live') diff --git a/services/route-builder.js b/services/route-builder.js index aea4839305c51..a1c894c945a1c 100644 --- a/services/route-builder.js +++ b/services/route-builder.js @@ -1,4 +1,4 @@ -import toArray from '../core/base-service/to-array.js'; +import toArray from '../core/base-service/to-array.js' /* * Factory class for building a BaseService `route` object. This class is useful @@ -31,4 +31,4 @@ export default class RouteBuilder { const { base, format, capture } = this return { base, format, capture } } -}; +} diff --git a/services/scoop/scoop-version.service.js b/services/scoop/scoop-version.service.js index d565c3f2b7431..566a259bf7b8c 100644 --- a/services/scoop/scoop-version.service.js +++ b/services/scoop/scoop-version.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {NotFound} from '../index.js'; -import {ConditionalGithubAuthV3Service} from '../github/github-auth-service.js'; -import {fetchJsonFromRepo} from '../github/github-common-fetch.js'; -import {renderVersionBadge} from '../version.js'; +import Joi from 'joi' +import { NotFound } from '../index.js' +import { ConditionalGithubAuthV3Service } from '../github/github-auth-service.js' +import { fetchJsonFromRepo } from '../github/github-common-fetch.js' +import { renderVersionBadge } from '../version.js' const gitHubRepoRegExp = /https:\/\/github.com\/(?.*?)\/(?.*?)(\/|$)/ @@ -85,4 +85,4 @@ export default class ScoopVersion extends ConditionalGithubAuthV3Service { throw error } } -}; +} diff --git a/services/scoop/scoop-version.tester.js b/services/scoop/scoop-version.tester.js index 57e13d41c973c..6e3950e8a58ef 100644 --- a/services/scoop/scoop-version.tester.js +++ b/services/scoop/scoop-version.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionNClauses} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isVPlusDottedVersionNClauses } from '../test-validators.js' export const t = new ServiceTester({ id: 'scoop', diff --git a/services/scrutinizer/scrutinizer-base.js b/services/scrutinizer/scrutinizer-base.js index babeb83caadba..918a9b6dec49d 100644 --- a/services/scrutinizer/scrutinizer-base.js +++ b/services/scrutinizer/scrutinizer-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService, NotFound, InvalidResponse} from '../index.js'; +import { BaseJsonService, NotFound, InvalidResponse } from '../index.js' export default class ScrutinizerBase extends BaseJsonService { // https://scrutinizer-ci.com/docs/api/#repository-details @@ -42,4 +42,4 @@ export default class ScrutinizerBase extends BaseJsonService { return { value: metricValues[metric] } } -}; +} diff --git a/services/scrutinizer/scrutinizer-build.service.js b/services/scrutinizer/scrutinizer-build.service.js index b03c1ec5c571c..44c1f54e44b9e 100644 --- a/services/scrutinizer/scrutinizer-build.service.js +++ b/services/scrutinizer/scrutinizer-build.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import ScrutinizerBase from './scrutinizer-base.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import ScrutinizerBase from './scrutinizer-base.js' const schema = Joi.object({ default_branch: Joi.string().required(), @@ -109,4 +109,4 @@ export default [ ScrutinizerBuild, ScrutinizerGitLabBuild, ScrutinizerPlainGitBuild, -]; +] diff --git a/services/scrutinizer/scrutinizer-build.tester.js b/services/scrutinizer/scrutinizer-build.tester.js index 4955ecbb18180..37185bf16ba52 100644 --- a/services/scrutinizer/scrutinizer-build.tester.js +++ b/services/scrutinizer/scrutinizer-build.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ScrutinizerBuild', title: 'ScrutinizerBuild', diff --git a/services/scrutinizer/scrutinizer-coverage.service.js b/services/scrutinizer/scrutinizer-coverage.service.js index 0679ebeee4717..cedd137e74203 100644 --- a/services/scrutinizer/scrutinizer-coverage.service.js +++ b/services/scrutinizer/scrutinizer-coverage.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {colorScale} from '../color-formatters.js'; -import {NotFound} from '../index.js'; -import ScrutinizerBase from './scrutinizer-base.js'; +import Joi from 'joi' +import { colorScale } from '../color-formatters.js' +import { NotFound } from '../index.js' +import ScrutinizerBase from './scrutinizer-base.js' const schema = Joi.object({ default_branch: Joi.string().required(), @@ -141,4 +141,4 @@ export { ScrutinizerCoverage, ScrutinizerCoverageGitLab, ScrutinizerCoveragePlainGit, -}; +} diff --git a/services/scrutinizer/scrutinizer-coverage.spec.js b/services/scrutinizer/scrutinizer-coverage.spec.js index 34821fe47940e..2928f54f5f690 100644 --- a/services/scrutinizer/scrutinizer-coverage.spec.js +++ b/services/scrutinizer/scrutinizer-coverage.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import {test, given} from 'sazerac'; -import {InvalidResponse, NotFound} from '../index.js'; -import {ScrutinizerCoverage} from './scrutinizer-coverage.service.js'; +import { expect } from 'chai' +import { test, given } from 'sazerac' +import { InvalidResponse, NotFound } from '../index.js' +import { ScrutinizerCoverage } from './scrutinizer-coverage.service.js' describe('ScrutinizerCoverage', function () { test(ScrutinizerCoverage.render, () => { diff --git a/services/scrutinizer/scrutinizer-coverage.tester.js b/services/scrutinizer/scrutinizer-coverage.tester.js index 0f9c953d29340..e23e7f59a3fbb 100644 --- a/services/scrutinizer/scrutinizer-coverage.tester.js +++ b/services/scrutinizer/scrutinizer-coverage.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isIntegerPercentage } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ScrutinizerCoverage', title: 'ScrutinizerCoverage', diff --git a/services/scrutinizer/scrutinizer-quality.service.js b/services/scrutinizer/scrutinizer-quality.service.js index b057fd51d3d4c..93939a554da62 100644 --- a/services/scrutinizer/scrutinizer-quality.service.js +++ b/services/scrutinizer/scrutinizer-quality.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {colorScale} from '../color-formatters.js'; -import ScrutinizerBase from './scrutinizer-base.js'; +import Joi from 'joi' +import { colorScale } from '../color-formatters.js' +import ScrutinizerBase from './scrutinizer-base.js' const schema = Joi.object({ default_branch: Joi.string().required(), @@ -129,4 +129,4 @@ export default [ ScrutinizerQuality, ScrutinizerQualityGitLab, ScrutinizerQualityPlainGit, -]; +] diff --git a/services/scrutinizer/scrutinizer-quality.tester.js b/services/scrutinizer/scrutinizer-quality.tester.js index 6865efae884fb..9009a9d1823a7 100644 --- a/services/scrutinizer/scrutinizer-quality.tester.js +++ b/services/scrutinizer/scrutinizer-quality.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ScrutinizerQuality', title: 'ScrutinizerQuality', diff --git a/services/scrutinizer/scrutinizer-redirect.service.js b/services/scrutinizer/scrutinizer-redirect.service.js index 5a6581cbaac6d..95a97967c0d54 100644 --- a/services/scrutinizer/scrutinizer-redirect.service.js +++ b/services/scrutinizer/scrutinizer-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' const commonAttrs = { category: 'analysis', @@ -37,4 +37,4 @@ export default [ `/scrutinizer/quality/gp/${slug}${branch ? `/${branch}` : ''}`, ...commonAttrs, }), -]; +] diff --git a/services/scrutinizer/scrutinizer-redirect.tester.js b/services/scrutinizer/scrutinizer-redirect.tester.js index ad70f3614d70f..b1d8abc51083b 100644 --- a/services/scrutinizer/scrutinizer-redirect.tester.js +++ b/services/scrutinizer/scrutinizer-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'ScrutinizerQualityRedirect', diff --git a/services/security-headers/security-headers.service.js b/services/security-headers/security-headers.service.js index b7723c10763b0..0b935a871eb45 100644 --- a/services/security-headers/security-headers.service.js +++ b/services/security-headers/security-headers.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseService, NotFound} from '../index.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseService, NotFound } from '../index.js' const queryParamSchema = Joi.object({ url: optionalUrl.required(), @@ -91,4 +91,4 @@ export default class SecurityHeaders extends BaseService { return this.constructor.render({ grade }) } -}; +} diff --git a/services/security-headers/security-headers.tester.js b/services/security-headers/security-headers.tester.js index b51c27114d161..3be2b605117c7 100644 --- a/services/security-headers/security-headers.tester.js +++ b/services/security-headers/security-headers.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('grade of https://shields.io') diff --git a/services/shippable/shippable.service.js b/services/shippable/shippable.service.js index 3a35e2025b8e5..426c773e18416 100644 --- a/services/shippable/shippable.service.js +++ b/services/shippable/shippable.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService, NotFound, redirector} from '../index.js'; +import Joi from 'joi' +import { renderBuildStatusBadge } from '../build-status.js' +import { BaseJsonService, NotFound, redirector } from '../index.js' // source: https://github.com/badges/shields/pull/1362#discussion_r161693830 const statusCodes = { @@ -77,4 +77,4 @@ const ShippableRedirect = redirector({ dateAdded: new Date('2020-07-18'), }) -export { Shippable, ShippableRedirect }; +export { Shippable, ShippableRedirect } diff --git a/services/shippable/shippable.tester.js b/services/shippable/shippable.tester.js index 4c911d386c1d4..789a357b7d1e4 100644 --- a/services/shippable/shippable.tester.js +++ b/services/shippable/shippable.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {ServiceTester} from '../tester.js'; +import { isBuildStatus } from '../build-status.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'Shippable', title: 'Shippable', diff --git a/services/snap-ci/snap-ci.service.js b/services/snap-ci/snap-ci.service.js index dbb29fad744c4..bf23bad848ac7 100644 --- a/services/snap-ci/snap-ci.service.js +++ b/services/snap-ci/snap-ci.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' const commonAttrs = { category: 'build', @@ -21,4 +21,4 @@ export default [ }, ...commonAttrs, }), -]; +] diff --git a/services/snap-ci/snap-ci.tester.js b/services/snap-ci/snap-ci.tester.js index 295ee2c9a8b79..3d8eb809aebec 100644 --- a/services/snap-ci/snap-ci.tester.js +++ b/services/snap-ci/snap-ci.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'snap-ci', title: 'Snap CI' }) diff --git a/services/snyk/snyk-test-helpers.js b/services/snyk/snyk-test-helpers.js index 6c523864abc64..9f37e02ecdbe1 100644 --- a/services/snyk/snyk-test-helpers.js +++ b/services/snyk/snyk-test-helpers.js @@ -3,7 +3,4 @@ const zeroVulnerabilitiesSvg = const twoVulnerabilitiesSvg = 'vulnerabilitiesvulnerabilities22' -export { - zeroVulnerabilitiesSvg, - twoVulnerabilitiesSvg, -}; +export { zeroVulnerabilitiesSvg, twoVulnerabilitiesSvg } diff --git a/services/snyk/snyk-vulnerability-base.js b/services/snyk/snyk-vulnerability-base.js index ff983a21042cd..1316490a71445 100644 --- a/services/snyk/snyk-vulnerability-base.js +++ b/services/snyk/snyk-vulnerability-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseSvgScrapingService} from '../index.js'; +import Joi from 'joi' +import { BaseSvgScrapingService } from '../index.js' const schema = Joi.object({ message: Joi.alternatives() @@ -37,4 +37,4 @@ export default class SnykVulnerabilityBase extends BaseSvgScrapingService { return { vulnerabilities } } -}; +} diff --git a/services/snyk/snyk-vulnerability-github.service.js b/services/snyk/snyk-vulnerability-github.service.js index cb1171c6e1fd1..fd187e7fbebce 100644 --- a/services/snyk/snyk-vulnerability-github.service.js +++ b/services/snyk/snyk-vulnerability-github.service.js @@ -1,4 +1,4 @@ -import SynkVulnerabilityBase from './snyk-vulnerability-base.js'; +import SynkVulnerabilityBase from './snyk-vulnerability-base.js' export default class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { static route = { @@ -46,4 +46,4 @@ export default class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { }) return this.constructor.render({ vulnerabilities }) } -}; +} diff --git a/services/snyk/snyk-vulnerability-github.tester.js b/services/snyk/snyk-vulnerability-github.tester.js index d9de80703a25d..0601ef2710620 100644 --- a/services/snyk/snyk-vulnerability-github.tester.js +++ b/services/snyk/snyk-vulnerability-github.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { + twoVulnerabilitiesSvg, + zeroVulnerabilitiesSvg, +} from './snyk-test-helpers.js' export const t = await createServiceTester() t.create('valid repo').get('/snyk/snyk.json').timeout(20000).expectBadge({ diff --git a/services/snyk/snyk-vulnerability-npm.service.js b/services/snyk/snyk-vulnerability-npm.service.js index 463545e3cfff0..4e5f99db3e18f 100644 --- a/services/snyk/snyk-vulnerability-npm.service.js +++ b/services/snyk/snyk-vulnerability-npm.service.js @@ -1,5 +1,5 @@ -import {NotFound} from '../index.js'; -import SynkVulnerabilityBase from './snyk-vulnerability-base.js'; +import { NotFound } from '../index.js' +import SynkVulnerabilityBase from './snyk-vulnerability-base.js' export default class SnykVulnerabilityNpm extends SynkVulnerabilityBase { static route = { @@ -57,4 +57,4 @@ export default class SnykVulnerabilityNpm extends SynkVulnerabilityBase { }) } } -}; +} diff --git a/services/snyk/snyk-vulnerability-npm.tester.js b/services/snyk/snyk-vulnerability-npm.tester.js index 2ecc84f37754b..5df48e99502e1 100644 --- a/services/snyk/snyk-vulnerability-npm.tester.js +++ b/services/snyk/snyk-vulnerability-npm.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {twoVulnerabilitiesSvg, zeroVulnerabilitiesSvg} from './snyk-test-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { + twoVulnerabilitiesSvg, + zeroVulnerabilitiesSvg, +} from './snyk-test-helpers.js' export const t = await createServiceTester() t.create('valid package latest version') diff --git a/services/sonar/sonar-base.js b/services/sonar/sonar-base.js index aed5d2f5ea2c0..4e13f25e24d4f 100644 --- a/services/sonar/sonar-base.js +++ b/services/sonar/sonar-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {BaseJsonService, NotFound} from '../index.js'; -import {isLegacyVersion} from './sonar-helpers.js'; +import Joi from 'joi' +import { BaseJsonService, NotFound } from '../index.js' +import { isLegacyVersion } from './sonar-helpers.js' // It is possible to see HTTP 404 response codes and HTTP 200 responses // with empty arrays of metric values, with both the legacy (pre v5.3) and modern APIs. @@ -114,4 +114,4 @@ export default class SonarBase extends BaseJsonService { return metrics } -}; +} diff --git a/services/sonar/sonar-coverage.service.js b/services/sonar/sonar-coverage.service.js index afaa09db3d410..ca71ab8264bc5 100644 --- a/services/sonar/sonar-coverage.service.js +++ b/services/sonar/sonar-coverage.service.js @@ -1,6 +1,6 @@ -import {coveragePercentage} from '../color-formatters.js'; -import SonarBase from './sonar-base.js'; -import {documentation, keywords, queryParamSchema} from './sonar-helpers.js'; +import { coveragePercentage } from '../color-formatters.js' +import SonarBase from './sonar-base.js' +import { documentation, keywords, queryParamSchema } from './sonar-helpers.js' export default class SonarCoverage extends SonarBase { static category = 'coverage' @@ -49,4 +49,4 @@ export default class SonarCoverage extends SonarBase { }) return this.constructor.render({ coverage }) } -}; +} diff --git a/services/sonar/sonar-coverage.tester.js b/services/sonar/sonar-coverage.tester.js index b6cbd32954742..6a03fa2171d4d 100644 --- a/services/sonar/sonar-coverage.tester.js +++ b/services/sonar/sonar-coverage.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isIntegerPercentage} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked diff --git a/services/sonar/sonar-documented-api-density.service.js b/services/sonar/sonar-documented-api-density.service.js index 3909b649f2a02..9c605f94beb5a 100644 --- a/services/sonar/sonar-documented-api-density.service.js +++ b/services/sonar/sonar-documented-api-density.service.js @@ -1,5 +1,11 @@ -import SonarBase from './sonar-base.js'; -import {queryParamSchema, getLabel, positiveMetricColorScale, keywords, documentation} from './sonar-helpers.js'; +import SonarBase from './sonar-base.js' +import { + queryParamSchema, + getLabel, + positiveMetricColorScale, + keywords, + documentation, +} from './sonar-helpers.js' const metric = 'public_documented_api_density' @@ -47,4 +53,4 @@ export default class SonarDocumentedApiDensity extends SonarBase { const metrics = this.transform({ json, sonarVersion }) return this.constructor.render({ density: metrics[metric] }) } -}; +} diff --git a/services/sonar/sonar-documented-api-density.spec.js b/services/sonar/sonar-documented-api-density.spec.js index 5ac2d5de021a8..a5ca4fe55267b 100644 --- a/services/sonar/sonar-documented-api-density.spec.js +++ b/services/sonar/sonar-documented-api-density.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import SonarDocumentedApiDensity from './sonar-documented-api-density.service.js'; +import { test, given } from 'sazerac' +import SonarDocumentedApiDensity from './sonar-documented-api-density.service.js' describe('SonarDocumentedApiDensity', function () { test(SonarDocumentedApiDensity.render, () => { diff --git a/services/sonar/sonar-documented-api-density.tester.js b/services/sonar/sonar-documented-api-density.tester.js index f8d41073518e3..d1fad44e3b8c1 100644 --- a/services/sonar/sonar-documented-api-density.tester.js +++ b/services/sonar/sonar-documented-api-density.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked diff --git a/services/sonar/sonar-fortify-rating.service.js b/services/sonar/sonar-fortify-rating.service.js index 90ce35f53e2c4..2e375c18f0345 100644 --- a/services/sonar/sonar-fortify-rating.service.js +++ b/services/sonar/sonar-fortify-rating.service.js @@ -1,5 +1,5 @@ -import SonarBase from './sonar-base.js'; -import {queryParamSchema, keywords, documentation} from './sonar-helpers.js'; +import SonarBase from './sonar-base.js' +import { queryParamSchema, keywords, documentation } from './sonar-helpers.js' const colorMap = { 0: 'red', @@ -63,4 +63,4 @@ export default class SonarFortifyRating extends SonarBase { rating: metrics['fortify-security-rating'], }) } -}; +} diff --git a/services/sonar/sonar-fortify-rating.spec.js b/services/sonar/sonar-fortify-rating.spec.js index 95aeb688da751..ba5869b0dc88e 100644 --- a/services/sonar/sonar-fortify-rating.spec.js +++ b/services/sonar/sonar-fortify-rating.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import SonarFortifyRating from './sonar-fortify-rating.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import SonarFortifyRating from './sonar-fortify-rating.service.js' const token = 'abc123def456' const config = { diff --git a/services/sonar/sonar-fortify-rating.tester.js b/services/sonar/sonar-fortify-rating.tester.js index 51b3c1aa0df66..c6efb951777e9 100644 --- a/services/sonar/sonar-fortify-rating.tester.js +++ b/services/sonar/sonar-fortify-rating.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked diff --git a/services/sonar/sonar-generic.service.js b/services/sonar/sonar-generic.service.js index 4b8f32f4b4af5..adc6bcd6af36c 100644 --- a/services/sonar/sonar-generic.service.js +++ b/services/sonar/sonar-generic.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import SonarBase from './sonar-base.js'; -import {queryParamSchema, getLabel} from './sonar-helpers.js'; +import { metric } from '../text-formatters.js' +import SonarBase from './sonar-base.js' +import { queryParamSchema, getLabel } from './sonar-helpers.js' // This service is intended to be a temporary solution to avoid breaking // any existing users/badges that were utilizing the "other" Sonar metrics @@ -137,4 +137,4 @@ export default class SonarGeneric extends SonarBase { metricValue: metrics[metricName], }) } -}; +} diff --git a/services/sonar/sonar-generic.tester.js b/services/sonar/sonar-generic.tester.js index c962c4f156366..2c17598222760 100644 --- a/services/sonar/sonar-generic.tester.js +++ b/services/sonar/sonar-generic.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Security Rating') diff --git a/services/sonar/sonar-helpers.js b/services/sonar/sonar-helpers.js index 81ed116589531..c5e49b2728952 100644 --- a/services/sonar/sonar-helpers.js +++ b/services/sonar/sonar-helpers.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {colorScale} from '../color-formatters.js'; -import {optionalUrl} from '../validators.js'; +import Joi from 'joi' +import { colorScale } from '../color-formatters.js' +import { optionalUrl } from '../validators.js' const ratingPercentageScaleSteps = [10, 20, 50, 100] const ratingScaleColors = [ @@ -26,7 +26,7 @@ function isLegacyVersion({ sonarVersion }) { } function getLabel({ metric }) { - return metric ? metric.replace(/_/g, ' ') : undefined; + return metric ? metric.replace(/_/g, ' ') : undefined } const sonarVersionSchema = Joi.alternatives( Joi.string() @@ -67,4 +67,4 @@ export { positiveMetricColorScale, keywords, documentation, -}; +} diff --git a/services/sonar/sonar-quality-gate.service.js b/services/sonar/sonar-quality-gate.service.js index d1f8eb7c64c09..d2b8a31f0fb96 100644 --- a/services/sonar/sonar-quality-gate.service.js +++ b/services/sonar/sonar-quality-gate.service.js @@ -1,5 +1,5 @@ -import SonarBase from './sonar-base.js'; -import {documentation, keywords, queryParamSchema} from './sonar-helpers.js'; +import SonarBase from './sonar-base.js' +import { documentation, keywords, queryParamSchema } from './sonar-helpers.js' export default class SonarQualityGate extends SonarBase { static category = 'analysis' @@ -55,4 +55,4 @@ export default class SonarQualityGate extends SonarBase { }) return this.constructor.render({ qualityState }) } -}; +} diff --git a/services/sonar/sonar-quality-gate.spec.js b/services/sonar/sonar-quality-gate.spec.js index bfaac00a635fb..aa694ae066ba4 100644 --- a/services/sonar/sonar-quality-gate.spec.js +++ b/services/sonar/sonar-quality-gate.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import SonarQualityGate from './sonar-quality-gate.service.js'; +import { test, given } from 'sazerac' +import SonarQualityGate from './sonar-quality-gate.service.js' describe('SonarQualityGate', function () { test(SonarQualityGate.render, () => { diff --git a/services/sonar/sonar-quality-gate.tester.js b/services/sonar/sonar-quality-gate.tester.js index 72697bf693fd6..39975ad07f270 100644 --- a/services/sonar/sonar-quality-gate.tester.js +++ b/services/sonar/sonar-quality-gate.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isQualityGateStatus = Joi.allow('passed', 'failed') diff --git a/services/sonar/sonar-redirector.service.js b/services/sonar/sonar-redirector.service.js index 2530afeb8c22d..f5289608c68a6 100644 --- a/services/sonar/sonar-redirector.service.js +++ b/services/sonar/sonar-redirector.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -30,4 +30,4 @@ export default [ }), dateAdded: new Date('2019-07-05'), }), -]; +] diff --git a/services/sonar/sonar-redirector.tester.js b/services/sonar/sonar-redirector.tester.js index 4f939b6563cab..286d92be7a2df 100644 --- a/services/sonar/sonar-redirector.tester.js +++ b/services/sonar/sonar-redirector.tester.js @@ -1,5 +1,5 @@ -import queryString from 'querystring'; -import {ServiceTester} from '../tester.js'; +import queryString from 'querystring' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'SonarRedirect', diff --git a/services/sonar/sonar-tech-debt.service.js b/services/sonar/sonar-tech-debt.service.js index 9655eb9716c18..b8c1de4cd25ed 100644 --- a/services/sonar/sonar-tech-debt.service.js +++ b/services/sonar/sonar-tech-debt.service.js @@ -1,5 +1,11 @@ -import SonarBase from './sonar-base.js'; -import {negativeMetricColorScale, getLabel, documentation, keywords, queryParamSchema} from './sonar-helpers.js'; +import SonarBase from './sonar-base.js' +import { + negativeMetricColorScale, + getLabel, + documentation, + keywords, + queryParamSchema, +} from './sonar-helpers.js' export default class SonarTechDebt extends SonarBase { static category = 'analysis' @@ -51,4 +57,4 @@ export default class SonarTechDebt extends SonarBase { const { sqale_debt_ratio: debt } = this.transform({ json, sonarVersion }) return this.constructor.render({ debt, metric }) } -}; +} diff --git a/services/sonar/sonar-tech-debt.spec.js b/services/sonar/sonar-tech-debt.spec.js index f56c22053a257..b6ef2009205bd 100644 --- a/services/sonar/sonar-tech-debt.spec.js +++ b/services/sonar/sonar-tech-debt.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import SonarTechDebt from './sonar-tech-debt.service.js'; +import { test, given } from 'sazerac' +import SonarTechDebt from './sonar-tech-debt.service.js' describe('SonarTechDebt', function () { test(SonarTechDebt.render, () => { diff --git a/services/sonar/sonar-tech-debt.tester.js b/services/sonar/sonar-tech-debt.tester.js index aed40ea1093e1..f9137fe570a87 100644 --- a/services/sonar/sonar-tech-debt.tester.js +++ b/services/sonar/sonar-tech-debt.tester.js @@ -1,5 +1,5 @@ -import {isPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // The service tests targeting the legacy SonarQube API are mocked diff --git a/services/sonar/sonar-tests.service.js b/services/sonar/sonar-tests.service.js index 1932c18b9bd9b..ec10994ba3f7e 100644 --- a/services/sonar/sonar-tests.service.js +++ b/services/sonar/sonar-tests.service.js @@ -1,7 +1,16 @@ -import {testResultQueryParamSchema, renderTestResultBadge, documentation as testResultsDocumentation} from '../test-results.js'; -import {metric as metricCount} from '../text-formatters.js'; -import SonarBase from './sonar-base.js'; -import {documentation, keywords, queryParamSchema, getLabel} from './sonar-helpers.js'; +import { + testResultQueryParamSchema, + renderTestResultBadge, + documentation as testResultsDocumentation, +} from '../test-results.js' +import { metric as metricCount } from '../text-formatters.js' +import SonarBase from './sonar-base.js' +import { + documentation, + keywords, + queryParamSchema, + getLabel, +} from './sonar-helpers.js' class SonarTestsSummary extends SonarBase { static category = 'build' @@ -230,4 +239,4 @@ class SonarTests extends SonarBase { } } -export {SonarTestsSummary, SonarTests}; +export { SonarTestsSummary, SonarTests } diff --git a/services/sonar/sonar-tests.spec.js b/services/sonar/sonar-tests.spec.js index 54abce8b1ecb3..81909602e18d3 100644 --- a/services/sonar/sonar-tests.spec.js +++ b/services/sonar/sonar-tests.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {SonarTests} from './sonar-tests.service.js' +import { test, given } from 'sazerac' +import { SonarTests } from './sonar-tests.service.js' describe('SonarTests', function () { test(SonarTests.render, () => { diff --git a/services/sonar/sonar-tests.tester.js b/services/sonar/sonar-tests.tester.js index aaede3bfc98b2..86f26d68a576f 100644 --- a/services/sonar/sonar-tests.tester.js +++ b/services/sonar/sonar-tests.tester.js @@ -1,6 +1,13 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals, isIntegerPercentage, isMetric} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { + isDefaultTestTotals, + isDefaultCompactTestTotals, + isCustomTestTotals, + isCustomCompactTestTotals, + isIntegerPercentage, + isMetric, +} from '../test-validators.js' export const t = new ServiceTester({ id: 'SonarTests', title: 'SonarTests', diff --git a/services/sonar/sonar-violations.service.js b/services/sonar/sonar-violations.service.js index 52263ea87d2e0..e82364bb9e184 100644 --- a/services/sonar/sonar-violations.service.js +++ b/services/sonar/sonar-violations.service.js @@ -1,7 +1,12 @@ -import {colorScale} from '../color-formatters.js'; -import {metric} from '../text-formatters.js'; -import SonarBase from './sonar-base.js'; -import {getLabel, documentation, keywords, queryParamWithFormatSchema} from './sonar-helpers.js'; +import { colorScale } from '../color-formatters.js' +import { metric } from '../text-formatters.js' +import SonarBase from './sonar-base.js' +import { + getLabel, + documentation, + keywords, + queryParamWithFormatSchema, +} from './sonar-helpers.js' const violationsColorScale = colorScale( [1, 2, 3, 5], @@ -162,4 +167,4 @@ export default class SonarViolations extends SonarBase { }) return this.constructor.render({ violations, metricName: metric, format }) } -}; +} diff --git a/services/sonar/sonar-violations.spec.js b/services/sonar/sonar-violations.spec.js index 9f8e4b90cc13d..08aa8279125a9 100644 --- a/services/sonar/sonar-violations.spec.js +++ b/services/sonar/sonar-violations.spec.js @@ -1,6 +1,6 @@ -import {test, given} from 'sazerac'; -import {metric} from '../text-formatters.js'; -import SonarViolations from './sonar-violations.service.js'; +import { test, given } from 'sazerac' +import { metric } from '../text-formatters.js' +import SonarViolations from './sonar-violations.service.js' describe('SonarViolations', function () { test(SonarViolations.render, () => { diff --git a/services/sonar/sonar-violations.tester.js b/services/sonar/sonar-violations.tester.js index 460a913984fa2..b757df1712bec 100644 --- a/services/sonar/sonar-violations.tester.js +++ b/services/sonar/sonar-violations.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isMetric, withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isMetric, withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isViolationsLongFormMetric = Joi.alternatives( Joi.allow(0), diff --git a/services/sourceforge/sourceforge-open-tickets.service.js b/services/sourceforge/sourceforge-open-tickets.service.js index 9266f32879446..7cf956105b830 100644 --- a/services/sourceforge/sourceforge-open-tickets.service.js +++ b/services/sourceforge/sourceforge-open-tickets.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ count: nonNegativeInteger.required(), @@ -53,4 +53,4 @@ export default class SourceforgeOpenTickets extends BaseJsonService { const { count } = await this.fetch({ type, project }) return this.constructor.render({ count }) } -}; +} diff --git a/services/sourceforge/sourceforge-open-tickets.tester.js b/services/sourceforge/sourceforge-open-tickets.tester.js index 67a83b9c4fdf5..4fa123e87b353 100644 --- a/services/sourceforge/sourceforge-open-tickets.tester.js +++ b/services/sourceforge/sourceforge-open-tickets.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('bugs') diff --git a/services/sourceforge/sourceforge.service.js b/services/sourceforge/sourceforge.service.js index 7fed8dcd01635..fb3ed63e604d6 100644 --- a/services/sourceforge/sourceforge.service.js +++ b/services/sourceforge/sourceforge.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import moment from 'moment'; -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import moment from 'moment' +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ total: nonNegativeInteger, @@ -103,4 +103,4 @@ export default class Sourceforge extends BaseJsonService { const json = await this.fetch({ interval, project, folder }) return this.constructor.render({ interval, downloads: json.total }) } -}; +} diff --git a/services/sourceforge/sourceforge.tester.js b/services/sourceforge/sourceforge.tester.js index ffbc408c800dd..e74de6f6fbf4d 100644 --- a/services/sourceforge/sourceforge.tester.js +++ b/services/sourceforge/sourceforge.tester.js @@ -1,5 +1,5 @@ -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('total downloads').get('/dt/sevenzip.json').expectBadge({ diff --git a/services/sourcegraph/sourcegraph.service.js b/services/sourcegraph/sourcegraph.service.js index 1a35bdd4022d2..054685d1b284b 100644 --- a/services/sourcegraph/sourcegraph.service.js +++ b/services/sourcegraph/sourcegraph.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const projectsCountRegex = /^\s[0-9]*(\.[0-9]k)?\sprojects$/ const schema = Joi.object({ @@ -41,4 +41,4 @@ export default class Sourcegraph extends BaseJsonService { }) return this.constructor.render({ projectsCount: json.value.trim() }) } -}; +} diff --git a/services/sourcegraph/sourcegraph.tester.js b/services/sourcegraph/sourcegraph.tester.js index aab80ff36f1a3..4d1428674354e 100644 --- a/services/sourcegraph/sourcegraph.tester.js +++ b/services/sourcegraph/sourcegraph.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Matches API responses such as "0 projects", "1 projects", "182 projects", "14.0k projects". diff --git a/services/spack/spack.service.js b/services/spack/spack.service.js index 50b7a8a9bd83f..54eb60bb7c67d 100644 --- a/services/spack/spack.service.js +++ b/services/spack/spack.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '..//version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '..//version.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ latest_version: Joi.string().required(), }).required() @@ -43,4 +43,4 @@ export default class SpackVersion extends BaseJsonService { const pkg = await this.fetch({ packageName }) return this.constructor.render({ version: pkg.latest_version }) } -}; +} diff --git a/services/spack/spack.tester.js b/services/spack/spack.tester.js index 2ad6d5b82d747..6a9fe7d38ef14 100644 --- a/services/spack/spack.tester.js +++ b/services/spack/spack.tester.js @@ -1,5 +1,5 @@ -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('version (valid)').get('/adios2.json').expectBadge({ diff --git a/services/spiget/spiget-base.js b/services/spiget/spiget-base.js index 83f1d81afff36..0dfb19af624db 100644 --- a/services/spiget/spiget-base.js +++ b/services/spiget/spiget-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const resourceSchema = Joi.object({ downloads: Joi.number().required(), @@ -34,4 +34,4 @@ class BaseSpigetService extends BaseJsonService { } } -export { keywords, documentation, BaseSpigetService }; +export { keywords, documentation, BaseSpigetService } diff --git a/services/spiget/spiget-download-size.service.js b/services/spiget/spiget-download-size.service.js index b46281e51fbea..21966b8d291a7 100644 --- a/services/spiget/spiget-download-size.service.js +++ b/services/spiget/spiget-download-size.service.js @@ -1,4 +1,4 @@ -import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; +import { BaseSpigetService, documentation, keywords } from './spiget-base.js' export default class SpigetDownloadSize extends BaseSpigetService { static category = 'size' @@ -45,4 +45,4 @@ export default class SpigetDownloadSize extends BaseSpigetService { type: file.type, }) } -}; +} diff --git a/services/spiget/spiget-download-size.tester.js b/services/spiget/spiget-download-size.tester.js index d444eadf37139..d1a1b20e1e93c 100644 --- a/services/spiget/spiget-download-size.tester.js +++ b/services/spiget/spiget-download-size.tester.js @@ -1,5 +1,5 @@ -import {isFileSize} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFileSize } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('EssentialsX (id 9089)') diff --git a/services/spiget/spiget-downloads.service.js b/services/spiget/spiget-downloads.service.js index ee863607c0d83..8a3a78a19c372 100644 --- a/services/spiget/spiget-downloads.service.js +++ b/services/spiget/spiget-downloads.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { BaseSpigetService, documentation, keywords } from './spiget-base.js' export default class SpigetDownloads extends BaseSpigetService { static category = 'downloads' @@ -37,4 +37,4 @@ export default class SpigetDownloads extends BaseSpigetService { const { downloads } = await this.fetch({ resourceId }) return this.constructor.render({ downloads }) } -}; +} diff --git a/services/spiget/spiget-downloads.tester.js b/services/spiget/spiget-downloads.tester.js index 1c1e6cd11b4a3..7b372012b7644 100644 --- a/services/spiget/spiget-downloads.tester.js +++ b/services/spiget/spiget-downloads.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('EssentialsX (id 9089)').get('/9089.json').expectBadge({ diff --git a/services/spiget/spiget-latest-version.service.js b/services/spiget/spiget-latest-version.service.js index 668e38cac870a..321c03a7aab6b 100644 --- a/services/spiget/spiget-latest-version.service.js +++ b/services/spiget/spiget-latest-version.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseSpigetService, documentation, keywords } from './spiget-base.js' const versionSchema = Joi.object({ downloads: Joi.number().required(), @@ -40,4 +40,4 @@ export default class SpigetLatestVersion extends BaseSpigetService { }) return renderVersionBadge({ version: name }) } -}; +} diff --git a/services/spiget/spiget-latest-version.tester.js b/services/spiget/spiget-latest-version.tester.js index 31fc1464a21a1..bcc8f68fc9f38 100644 --- a/services/spiget/spiget-latest-version.tester.js +++ b/services/spiget/spiget-latest-version.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Note that Spigot versions can be anything (including just a string), so we'll make sure it's not returning 'not found' diff --git a/services/spiget/spiget-rating.service.js b/services/spiget/spiget-rating.service.js index 8cfce768b7671..4d1a41b7c65c5 100644 --- a/services/spiget/spiget-rating.service.js +++ b/services/spiget/spiget-rating.service.js @@ -1,6 +1,6 @@ -import {starRating, metric} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; +import { starRating, metric } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import { BaseSpigetService, documentation, keywords } from './spiget-base.js' export default class SpigetRatings extends BaseSpigetService { static category = 'rating' @@ -59,4 +59,4 @@ export default class SpigetRatings extends BaseSpigetService { average: rating.average.toFixed(2), }) } -}; +} diff --git a/services/spiget/spiget-rating.tester.js b/services/spiget/spiget-rating.tester.js index 81e0ce1336881..7d44add2e58d2 100644 --- a/services/spiget/spiget-rating.tester.js +++ b/services/spiget/spiget-rating.tester.js @@ -1,5 +1,5 @@ -import {isStarRating, withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isStarRating, withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Stars - EssentialsX (id 9089)').get('/stars/9089.json').expectBadge({ diff --git a/services/spiget/spiget-tested-versions.service.js b/services/spiget/spiget-tested-versions.service.js index 9c2c630c7fc2c..725bf68f34079 100644 --- a/services/spiget/spiget-tested-versions.service.js +++ b/services/spiget/spiget-tested-versions.service.js @@ -1,4 +1,4 @@ -import {BaseSpigetService, documentation, keywords} from './spiget-base.js'; +import { BaseSpigetService, documentation, keywords } from './spiget-base.js' export default class SpigetTestedVersions extends BaseSpigetService { static category = 'platform-support' @@ -48,4 +48,4 @@ export default class SpigetTestedVersions extends BaseSpigetService { const { versions } = this.transform({ testedVersions }) return this.constructor.render({ versions }) } -}; +} diff --git a/services/spiget/spiget-tested-versions.tester.js b/services/spiget/spiget-tested-versions.tester.js index 2d3ed5e10879b..723164f118912 100644 --- a/services/spiget/spiget-tested-versions.tester.js +++ b/services/spiget/spiget-tested-versions.tester.js @@ -1,5 +1,5 @@ -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const multipleVersions = withRegex(/^([+]?\d*\.\d+)(-)([+]?\d*\.\d+)$/) diff --git a/services/stackexchange/stackexchange-helpers.js b/services/stackexchange/stackexchange-helpers.js index f2ac9fad70f19..e86c4064d0160 100644 --- a/services/stackexchange/stackexchange-helpers.js +++ b/services/stackexchange/stackexchange-helpers.js @@ -1,5 +1,5 @@ -import {metric} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; +import { metric } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' export default function renderQuestionsBadge({ suffix, @@ -13,4 +13,4 @@ export default function renderQuestionsBadge({ message: `${metric(numValue)}${suffix}`, color: floorCountColor(numValue, 1000, 10000, 20000), } -}; +} diff --git a/services/stackexchange/stackexchange-monthlyquestions.service.js b/services/stackexchange/stackexchange-monthlyquestions.service.js index fa56898021b19..ff0143c63ddbc 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.service.js +++ b/services/stackexchange/stackexchange-monthlyquestions.service.js @@ -1,8 +1,8 @@ -import moment from 'moment'; -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; -import renderQuestionsBadge from './stackexchange-helpers.js'; +import moment from 'moment' +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' +import renderQuestionsBadge from './stackexchange-helpers.js' const tagSchema = Joi.object({ total: nonNegativeInteger, @@ -74,4 +74,4 @@ export default class StackExchangeMonthlyQuestions extends BaseJsonService { numValue, }) } -}; +} diff --git a/services/stackexchange/stackexchange-monthlyquestions.tester.js b/services/stackexchange/stackexchange-monthlyquestions.tester.js index 8fbc906c3852c..4341b282fd2c8 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.tester.js +++ b/services/stackexchange/stackexchange-monthlyquestions.tester.js @@ -1,5 +1,5 @@ -import {isMetricOverTimePeriod} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetricOverTimePeriod } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Monthly Questions for StackOverflow Momentjs') diff --git a/services/stackexchange/stackexchange-reputation.service.js b/services/stackexchange/stackexchange-reputation.service.js index 13ffe894d5264..ea8b7b36bbac2 100644 --- a/services/stackexchange/stackexchange-reputation.service.js +++ b/services/stackexchange/stackexchange-reputation.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const reputationSchema = Joi.object({ items: Joi.array() @@ -67,4 +67,4 @@ export default class StackExchangeReputation extends BaseJsonService { numValue, }) } -}; +} diff --git a/services/stackexchange/stackexchange-reputation.tester.js b/services/stackexchange/stackexchange-reputation.tester.js index f2f8d6a03d8e9..12c043f10c7f1 100644 --- a/services/stackexchange/stackexchange-reputation.tester.js +++ b/services/stackexchange/stackexchange-reputation.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Invalid parameters') diff --git a/services/stackexchange/stackexchange-taginfo.service.js b/services/stackexchange/stackexchange-taginfo.service.js index 67787171c41a6..af3d5d2557e46 100644 --- a/services/stackexchange/stackexchange-taginfo.service.js +++ b/services/stackexchange/stackexchange-taginfo.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; -import renderQuestionsBadge from './stackexchange-helpers.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import renderQuestionsBadge from './stackexchange-helpers.js' const tagSchema = Joi.object({ items: Joi.array() @@ -62,4 +62,4 @@ export default class StackExchangeQuestions extends BaseJsonService { numValue, }) } -}; +} diff --git a/services/stackexchange/stackexchange-taginfo.tester.js b/services/stackexchange/stackexchange-taginfo.tester.js index 3680582dff1de..9c615fb693a49 100644 --- a/services/stackexchange/stackexchange-taginfo.tester.js +++ b/services/stackexchange/stackexchange-taginfo.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isMetric } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('JavaScript Questions') diff --git a/services/static-badge/query-string-static.service.js b/services/static-badge/query-string-static.service.js index 5445539613880..1555e55bcf777 100644 --- a/services/static-badge/query-string-static.service.js +++ b/services/static-badge/query-string-static.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseStaticService} from '../index.js'; +import Joi from 'joi' +import { BaseStaticService } from '../index.js' const queryParamSchema = Joi.object({ message: Joi.string().required(), @@ -19,4 +19,4 @@ export default class QueryStringStaticBadge extends BaseStaticService { handle(namedParams, queryParams) { return { message: queryParams.message } } -}; +} diff --git a/services/static-badge/query-string-static.tester.js b/services/static-badge/query-string-static.tester.js index 5d5f007dab6ba..b6609c250521b 100644 --- a/services/static-badge/query-string-static.tester.js +++ b/services/static-badge/query-string-static.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Missing message') diff --git a/services/static-badge/static-badge.service.js b/services/static-badge/static-badge.service.js index 12e4280e99b0f..0bcbe488e3b5f 100644 --- a/services/static-badge/static-badge.service.js +++ b/services/static-badge/static-badge.service.js @@ -1,5 +1,5 @@ -import {escapeFormat} from '../../core/badge-urls/path-helpers.js'; -import {BaseStaticService} from '../index.js'; +import { escapeFormat } from '../../core/badge-urls/path-helpers.js' +import { BaseStaticService } from '../index.js' export default class StaticBadge extends BaseStaticService { static category = 'static' @@ -13,4 +13,4 @@ export default class StaticBadge extends BaseStaticService { handle({ label, message, color }) { return { label: escapeFormat(label), message: escapeFormat(message), color } } -}; +} diff --git a/services/static-badge/static-badge.tester.js b/services/static-badge/static-badge.tester.js index f1b122c7d8746..dc0b0218c0348 100644 --- a/services/static-badge/static-badge.tester.js +++ b/services/static-badge/static-badge.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Shields colorscheme color') diff --git a/services/steam/steam-base.js b/services/steam/steam-base.js index a3b7afd55d48c..9ea5cae989cdc 100644 --- a/services/steam/steam-base.js +++ b/services/steam/steam-base.js @@ -2,7 +2,7 @@ * @module */ -import {BaseJsonService} from '../index.js'; +import { BaseJsonService } from '../index.js' /** * The steam api is based like /{interface}/{method}/v{version}/ @@ -53,4 +53,4 @@ class BaseSteamAPI extends BaseJsonService { } } -export default BaseSteamAPI; +export default BaseSteamAPI diff --git a/services/steam/steam-workshop.service.js b/services/steam/steam-workshop.service.js index 68cf48606af72..23207eb80d9cf 100644 --- a/services/steam/steam-workshop.service.js +++ b/services/steam/steam-workshop.service.js @@ -1,9 +1,9 @@ -import Joi from 'joi'; -import prettyBytes from 'pretty-bytes'; -import {metric, formatDate} from '../text-formatters.js'; -import {age as ageColor, downloadCount} from '../color-formatters.js'; -import {NotFound} from '../index.js'; -import BaseSteamAPI from './steam-base.js'; +import Joi from 'joi' +import prettyBytes from 'pretty-bytes' +import { metric, formatDate } from '../text-formatters.js' +import { age as ageColor, downloadCount } from '../color-formatters.js' +import { NotFound } from '../index.js' +import BaseSteamAPI from './steam-base.js' const documentation = `

@@ -409,4 +409,4 @@ export { SteamFileFavorites, SteamFileDownloads, SteamFileViews, -}; +} diff --git a/services/steam/steam-workshop.tester.js b/services/steam/steam-workshop.tester.js index 66962f29a103f..05b424ac9d658 100644 --- a/services/steam/steam-workshop.tester.js +++ b/services/steam/steam-workshop.tester.js @@ -1,7 +1,10 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isFileSize, isFormattedDate} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric, isFileSize, isFormattedDate } from '../test-validators.js' -export const t = new ServiceTester({ id: 'steam', title: 'Steam Workshop Tests' }) +export const t = new ServiceTester({ + id: 'steam', + title: 'Steam Workshop Tests', +}) t.create('Collection Files') .get('/collection-files/180077636.json') diff --git a/services/suggest.integration.js b/services/suggest.integration.js index 94a74a3a90943..68efaafcaae4f 100644 --- a/services/suggest.integration.js +++ b/services/suggest.integration.js @@ -1,10 +1,10 @@ -import {expect} from 'chai'; -import Camp from '@shields_io/camp'; -import portfinder from 'portfinder'; -import config from 'config'; -import got from '../core/got-test-client.js'; -import {setRoutes} from './suggest.js'; -import GithubApiProvider from './github/github-api-provider.js'; +import { expect } from 'chai' +import Camp from '@shields_io/camp' +import portfinder from 'portfinder' +import config from 'config' +import got from '../core/got-test-client.js' +import { setRoutes } from './suggest.js' +import GithubApiProvider from './github/github-api-provider.js' describe('Badge suggestions for', function () { const githubApiBaseUrl = process.env.GITHUB_URL || 'https://api.github.com' diff --git a/services/suggest.js b/services/suggest.js index fbcc1b5495b14..ce23724f9a5d3 100644 --- a/services/suggest.js +++ b/services/suggest.js @@ -4,8 +4,8 @@ // // This endpoint is called from frontend/components/suggestion-and-search.js. -import {URL} from 'url'; -import request from 'request'; +import { URL } from 'url' +import request from 'request' function twitterPage(url) { if (url.protocol === null) { @@ -198,8 +198,4 @@ function setRoutes(allowedOrigin, githubApiProvider, server) { }) } -export { - findSuggestions, - githubLicense, - setRoutes, -}; +export { findSuggestions, githubLicense, setRoutes } diff --git a/services/suggest.spec.js b/services/suggest.spec.js index 03ceb01e3cbd4..3e2a9c8f495c1 100644 --- a/services/suggest.spec.js +++ b/services/suggest.spec.js @@ -1,10 +1,10 @@ -import Camp from '@shields_io/camp'; -import {expect} from 'chai'; -import nock from 'nock'; -import portfinder from 'portfinder'; -import got from '../core/got-test-client.js'; -import {setRoutes, githubLicense} from './suggest.js'; -import GithubApiProvider from './github/github-api-provider.js'; +import Camp from '@shields_io/camp' +import { expect } from 'chai' +import nock from 'nock' +import portfinder from 'portfinder' +import got from '../core/got-test-client.js' +import { setRoutes, githubLicense } from './suggest.js' +import GithubApiProvider from './github/github-api-provider.js' describe('Badge suggestions', function () { const githubApiBaseUrl = 'https://api.github.test' diff --git a/services/swagger/swagger-redirect.service.js b/services/swagger/swagger-redirect.service.js index 150d41d0ff7e6..091acf5c08c6f 100644 --- a/services/swagger/swagger-redirect.service.js +++ b/services/swagger/swagger-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -15,4 +15,4 @@ export default [ }, dateAdded: new Date('2019-11-03'), }), -]; +] diff --git a/services/swagger/swagger-redirect.tester.js b/services/swagger/swagger-redirect.tester.js index 51bb1019a4f39..c4658882236c1 100644 --- a/services/swagger/swagger-redirect.tester.js +++ b/services/swagger/swagger-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'SwaggerUrlRedirect', diff --git a/services/swagger/swagger.service.js b/services/swagger/swagger.service.js index 13e6516d4038e..be4127345553b 100644 --- a/services/swagger/swagger.service.js +++ b/services/swagger/swagger.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object() .keys({ @@ -83,4 +83,4 @@ export default class SwaggerValidatorService extends BaseJsonService { const { status } = this.transform({ json, specUrl }) return this.constructor.render({ status }) } -}; +} diff --git a/services/swagger/swagger.tester.js b/services/swagger/swagger.tester.js index 659cdb03e0069..6c154b6354223 100644 --- a/services/swagger/swagger.tester.js +++ b/services/swagger/swagger.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' const getURL = '/3.0.json?specUrl=https://example.com/example.json' const getURLBase = '/3.0.json?specUrl=' diff --git a/services/symfony/sensiolabs-redirect.service.js b/services/symfony/sensiolabs-redirect.service.js index df889ca1fd6d7..5196e02b8d4a7 100644 --- a/services/symfony/sensiolabs-redirect.service.js +++ b/services/symfony/sensiolabs-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ // The SymfonyInsight service was previously branded as SensioLabs, and @@ -12,4 +12,4 @@ export default [ transformPath: ({ projectUuid }) => `/symfony/i/grade/${projectUuid}`, dateAdded: new Date('2019-02-08'), }), -]; +] diff --git a/services/symfony/sensiolabs-redirect.tester.js b/services/symfony/sensiolabs-redirect.tester.js index be8366fb6de2d..fd10afb597236 100644 --- a/services/symfony/sensiolabs-redirect.tester.js +++ b/services/symfony/sensiolabs-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'sensiolabs', diff --git a/services/symfony/symfony-insight-base.js b/services/symfony/symfony-insight-base.js index 19276a155c0a5..8cace75a89741 100644 --- a/services/symfony/symfony-insight-base.js +++ b/services/symfony/symfony-insight-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseXmlService, NotFound} from '../index.js'; +import Joi from 'joi' +import { BaseXmlService, NotFound } from '../index.js' const violationSchema = Joi.object({ severity: Joi.equal('info', 'minor', 'major', 'critical').required(), @@ -124,8 +124,4 @@ class SymfonyInsightBase extends BaseXmlService { } } -export { - SymfonyInsightBase, - keywords, - gradeColors, -}; +export { SymfonyInsightBase, keywords, gradeColors } diff --git a/services/symfony/symfony-insight-base.spec.js b/services/symfony/symfony-insight-base.spec.js index 36bbe44317c12..91af55d63539b 100644 --- a/services/symfony/symfony-insight-base.spec.js +++ b/services/symfony/symfony-insight-base.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {NotFound} from '../index.js'; -import {SymfonyInsightBase} from './symfony-insight-base.js'; +import { expect } from 'chai' +import { NotFound } from '../index.js' +import { SymfonyInsightBase } from './symfony-insight-base.js' describe('SymfonyInsightBase', function () { context('transform()', function () { diff --git a/services/symfony/symfony-insight-grade.service.js b/services/symfony/symfony-insight-grade.service.js index e0f9d2d58e2d7..4e220915373a3 100644 --- a/services/symfony/symfony-insight-grade.service.js +++ b/services/symfony/symfony-insight-grade.service.js @@ -1,4 +1,8 @@ -import {SymfonyInsightBase, keywords, gradeColors} from './symfony-insight-base.js'; +import { + SymfonyInsightBase, + keywords, + gradeColors, +} from './symfony-insight-base.js' export default class SymfonyInsightGrade extends SymfonyInsightBase { static route = { @@ -44,4 +48,4 @@ export default class SymfonyInsightGrade extends SymfonyInsightBase { return this.constructor.render({ grade, status }) } -}; +} diff --git a/services/symfony/symfony-insight-grade.tester.js b/services/symfony/symfony-insight-grade.tester.js index 491194f57073e..85d4be697c0bc 100644 --- a/services/symfony/symfony-insight-grade.tester.js +++ b/services/symfony/symfony-insight-grade.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { sampleProjectUuid, noSymfonyToken } from './symfony-test-helpers.js' export const t = await createServiceTester() t.create('valid project grade') diff --git a/services/symfony/symfony-insight-stars.service.js b/services/symfony/symfony-insight-stars.service.js index db35fb965e3ad..1665c255b8d6d 100644 --- a/services/symfony/symfony-insight-stars.service.js +++ b/services/symfony/symfony-insight-stars.service.js @@ -1,5 +1,9 @@ -import {starRating} from '../text-formatters.js'; -import {SymfonyInsightBase, keywords, gradeColors} from './symfony-insight-base.js'; +import { starRating } from '../text-formatters.js' +import { + SymfonyInsightBase, + keywords, + gradeColors, +} from './symfony-insight-base.js' const gradeStars = { none: 0, @@ -51,4 +55,4 @@ export default class SymfonyInsightStars extends SymfonyInsightBase { const { grade, status } = this.transform({ data }) return this.constructor.render({ grade, status }) } -}; +} diff --git a/services/symfony/symfony-insight-stars.tester.js b/services/symfony/symfony-insight-stars.tester.js index c5068a4bab1af..0370fb01f2055 100644 --- a/services/symfony/symfony-insight-stars.tester.js +++ b/services/symfony/symfony-insight-stars.tester.js @@ -1,6 +1,6 @@ -import {createServiceTester} from '../tester.js' -import {withRegex} from '../test-validators.js'; -import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; +import { createServiceTester } from '../tester.js' +import { withRegex } from '../test-validators.js' +import { sampleProjectUuid, noSymfonyToken } from './symfony-test-helpers.js' export const t = await createServiceTester() t.create('valid project stars') diff --git a/services/symfony/symfony-insight-violations.service.js b/services/symfony/symfony-insight-violations.service.js index 47c86bfa08af8..b620286b254c4 100644 --- a/services/symfony/symfony-insight-violations.service.js +++ b/services/symfony/symfony-insight-violations.service.js @@ -1,4 +1,4 @@ -import {SymfonyInsightBase, keywords} from './symfony-insight-base.js'; +import { SymfonyInsightBase, keywords } from './symfony-insight-base.js' export default class SymfonyInsightViolations extends SymfonyInsightBase { static route = { @@ -76,4 +76,4 @@ export default class SymfonyInsightViolations extends SymfonyInsightBase { const lastAnalysis = this.transform({ data }) return this.constructor.render(lastAnalysis) } -}; +} diff --git a/services/symfony/symfony-insight-violations.tester.js b/services/symfony/symfony-insight-violations.tester.js index 4d858fe62fad3..f35a9bbc63762 100644 --- a/services/symfony/symfony-insight-violations.tester.js +++ b/services/symfony/symfony-insight-violations.tester.js @@ -1,6 +1,6 @@ -import {createServiceTester} from '../tester.js' -import {withRegex} from '../test-validators.js'; -import {sampleProjectUuid, noSymfonyToken} from './symfony-test-helpers.js'; +import { createServiceTester } from '../tester.js' +import { withRegex } from '../test-validators.js' +import { sampleProjectUuid, noSymfonyToken } from './symfony-test-helpers.js' export const t = await createServiceTester() t.create('valid project violations') diff --git a/services/symfony/symfony-insight.spec.js b/services/symfony/symfony-insight.spec.js index 40c55105ff76a..ea9855d96878b 100644 --- a/services/symfony/symfony-insight.spec.js +++ b/services/symfony/symfony-insight.spec.js @@ -1,10 +1,27 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import SymfonyInsightGrade from './symfony-insight-grade.service.js'; -import SymfonyInsightStars from './symfony-insight-stars.service.js'; -import SymfonyInsightViolations from './symfony-insight-violations.service.js'; -import {sampleProjectUuid as projectUuid, runningMockResponse, platinumMockResponse, goldMockResponse, silverMockResponse, bronzeMockResponse, noMedalMockResponse, noGradeMockResponse, criticalViolation, majorViolation, minorViolation, infoViolation, multipleViolations, user, token, config} from './symfony-test-helpers.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import SymfonyInsightGrade from './symfony-insight-grade.service.js' +import SymfonyInsightStars from './symfony-insight-stars.service.js' +import SymfonyInsightViolations from './symfony-insight-violations.service.js' +import { + sampleProjectUuid as projectUuid, + runningMockResponse, + platinumMockResponse, + goldMockResponse, + silverMockResponse, + bronzeMockResponse, + noMedalMockResponse, + noGradeMockResponse, + criticalViolation, + majorViolation, + minorViolation, + infoViolation, + multipleViolations, + user, + token, + config, +} from './symfony-test-helpers.js' // These tests are organized in a fairly unusual way because the service uses // XML, so it's difficult to decouple the parsing from the transform + render. diff --git a/services/symfony/symfony-test-helpers.js b/services/symfony/symfony-test-helpers.js index 870ade4533d6e..3b8e3f7f64bbb 100644 --- a/services/symfony/symfony-test-helpers.js +++ b/services/symfony/symfony-test-helpers.js @@ -1,5 +1,5 @@ -import {noToken} from '../test-helpers.js'; -import {SymfonyInsightBase} from './symfony-insight-base.js'; +import { noToken } from '../test-helpers.js' +import { SymfonyInsightBase } from './symfony-insight-base.js' const sampleProjectUuid = '825be328-29f8-44f7-a750-f82818ae9111' @@ -106,4 +106,4 @@ export { token, config, noSymfonyToken, -}; +} diff --git a/services/teamcity/teamcity-base.js b/services/teamcity/teamcity-base.js index d1769d58663c2..1e811a7aef5c6 100644 --- a/services/teamcity/teamcity-base.js +++ b/services/teamcity/teamcity-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '../index.js'; +import { BaseJsonService } from '../index.js' export default class TeamCityBase extends BaseJsonService { static auth = { @@ -23,4 +23,4 @@ export default class TeamCityBase extends BaseJsonService { }) ) } -}; +} diff --git a/services/teamcity/teamcity-build-redirect.service.js b/services/teamcity/teamcity-build-redirect.service.js index 865a973a89868..bb63122228c5c 100644 --- a/services/teamcity/teamcity-build-redirect.service.js +++ b/services/teamcity/teamcity-build-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' const commonAttrs = { dateAdded: new Date('2019-09-15'), @@ -32,4 +32,4 @@ export default [ server: `${protocol}://${hostAndPath}`, }), }), -]; +] diff --git a/services/teamcity/teamcity-build-redirect.tester.js b/services/teamcity/teamcity-build-redirect.tester.js index 117df1ab95900..c3f20425bbf24 100644 --- a/services/teamcity/teamcity-build-redirect.tester.js +++ b/services/teamcity/teamcity-build-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'TeamCityBuildRedirect', diff --git a/services/teamcity/teamcity-build.service.js b/services/teamcity/teamcity-build.service.js index dd401d18a6eb9..bf90c10979a8f 100644 --- a/services/teamcity/teamcity-build.service.js +++ b/services/teamcity/teamcity-build.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import TeamCityBase from './teamcity-base.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import TeamCityBase from './teamcity-base.js' const buildStatusSchema = Joi.object({ status: Joi.equal('SUCCESS', 'FAILURE', 'ERROR').required(), @@ -94,4 +94,4 @@ export default class TeamCityBuild extends TeamCityBase { useVerbose, }) } -}; +} diff --git a/services/teamcity/teamcity-build.spec.js b/services/teamcity/teamcity-build.spec.js index 693779c6ad30e..f81599a62e3b7 100644 --- a/services/teamcity/teamcity-build.spec.js +++ b/services/teamcity/teamcity-build.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import TeamCityBuild from './teamcity-build.service.js'; -import {user, pass, host, config} from './teamcity-test-helpers.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import TeamCityBuild from './teamcity-build.service.js' +import { user, pass, host, config } from './teamcity-test-helpers.js' describe('TeamCityBuild', function () { cleanUpNockAfterEach() diff --git a/services/teamcity/teamcity-build.tester.js b/services/teamcity/teamcity-build.tester.js index 10009fae49c78..3fcbb217e8b1e 100644 --- a/services/teamcity/teamcity-build.tester.js +++ b/services/teamcity/teamcity-build.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {withRegex} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { withRegex } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const buildStatusValues = Joi.equal('passing', 'failure', 'error').required() diff --git a/services/teamcity/teamcity-coverage-redirect.service.js b/services/teamcity/teamcity-coverage-redirect.service.js index 400b436697164..5c989dea9e647 100644 --- a/services/teamcity/teamcity-coverage-redirect.service.js +++ b/services/teamcity/teamcity-coverage-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -13,4 +13,4 @@ export default [ }), dateAdded: new Date('2019-09-15'), }), -]; +] diff --git a/services/teamcity/teamcity-coverage-redirect.tester.js b/services/teamcity/teamcity-coverage-redirect.tester.js index 7853711679f76..aeb6ce0068c27 100644 --- a/services/teamcity/teamcity-coverage-redirect.tester.js +++ b/services/teamcity/teamcity-coverage-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'TeamCityCoverageRedirect', diff --git a/services/teamcity/teamcity-coverage.service.js b/services/teamcity/teamcity-coverage.service.js index 8909d4dcbde47..8737da79e91c5 100644 --- a/services/teamcity/teamcity-coverage.service.js +++ b/services/teamcity/teamcity-coverage.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {coveragePercentage} from '../color-formatters.js'; -import {optionalUrl} from '../validators.js'; -import {InvalidResponse} from '../index.js'; -import TeamCityBase from './teamcity-base.js'; +import Joi from 'joi' +import { coveragePercentage } from '../color-formatters.js' +import { optionalUrl } from '../validators.js' +import { InvalidResponse } from '../index.js' +import TeamCityBase from './teamcity-base.js' const buildStatisticsSchema = Joi.object({ property: Joi.array() @@ -87,4 +87,4 @@ export default class TeamCityCoverage extends TeamCityBase { const { coverage } = this.transform({ data }) return this.constructor.render({ coverage }) } -}; +} diff --git a/services/teamcity/teamcity-coverage.spec.js b/services/teamcity/teamcity-coverage.spec.js index 49bc77b9aef3b..f0fc578371af8 100644 --- a/services/teamcity/teamcity-coverage.spec.js +++ b/services/teamcity/teamcity-coverage.spec.js @@ -1,8 +1,8 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import TeamCityCoverage from './teamcity-coverage.service.js'; -import {user, pass, host, config} from './teamcity-test-helpers.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import TeamCityCoverage from './teamcity-coverage.service.js' +import { user, pass, host, config } from './teamcity-test-helpers.js' describe('TeamCityCoverage', function () { cleanUpNockAfterEach() diff --git a/services/teamcity/teamcity-coverage.tester.js b/services/teamcity/teamcity-coverage.tester.js index 7867c19d994d8..7a0c0387baab7 100644 --- a/services/teamcity/teamcity-coverage.tester.js +++ b/services/teamcity/teamcity-coverage.tester.js @@ -1,5 +1,5 @@ -import {isIntegerPercentage} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('invalid buildId') diff --git a/services/teamcity/teamcity-test-helpers.js b/services/teamcity/teamcity-test-helpers.js index 5ee1e61c3add0..655a16cbd94fb 100644 --- a/services/teamcity/teamcity-test-helpers.js +++ b/services/teamcity/teamcity-test-helpers.js @@ -15,9 +15,4 @@ const config = { }, } -export { - user, - pass, - host, - config, -}; +export { user, pass, host, config } diff --git a/services/test-helpers.js b/services/test-helpers.js index b1687e245990d..0896cf57d5935 100644 --- a/services/test-helpers.js +++ b/services/test-helpers.js @@ -1,7 +1,7 @@ -import nock from 'nock'; -import request from 'request'; -import config from 'config'; -import {promisify} from '../core/base-service/legacy-request-handler.js'; +import nock from 'nock' +import request from 'request' +import config from 'config' +import { promisify } from '../core/base-service/legacy-request-handler.js' const runnerConfig = config.util.toObject() function cleanUpNockAfterEach() { @@ -35,9 +35,4 @@ const sendAndCacheRequest = promisify(request) const defaultContext = { sendAndCacheRequest } -export { - cleanUpNockAfterEach, - noToken, - sendAndCacheRequest, - defaultContext, -}; +export { cleanUpNockAfterEach, noToken, sendAndCacheRequest, defaultContext } diff --git a/services/test-results.js b/services/test-results.js index 9b605509674cf..84f6831762087 100644 --- a/services/test-results.js +++ b/services/test-results.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' const testResultQueryParamSchema = Joi.object({ compact_message: Joi.equal(''), @@ -109,4 +109,4 @@ export { renderTestResultMessage, renderTestResultBadge, documentation, -}; +} diff --git a/services/test-results.spec.js b/services/test-results.spec.js index e9df50bda1e0c..d9c337676092c 100644 --- a/services/test-results.spec.js +++ b/services/test-results.spec.js @@ -1,5 +1,8 @@ -import {test, given} from 'sazerac'; -import {renderTestResultMessage, renderTestResultBadge} from './test-results.js'; +import { test, given } from 'sazerac' +import { + renderTestResultMessage, + renderTestResultBadge, +} from './test-results.js' describe('Test result helpers', function () { function renderBothStyles(props) { diff --git a/services/test-validators.js b/services/test-validators.js index c10236eef0bfb..25abd819fc48a 100644 --- a/services/test-validators.js +++ b/services/test-validators.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {semver as isSemver} from './validators.js'; +import Joi from 'joi' +import { semver as isSemver } from './validators.js' /* Note: @@ -167,4 +167,4 @@ export { isCustomCompactTestTotals, makeTestTotalsValidator, makeCompactTestTotalsValidator, -}; +} diff --git a/services/tester.js b/services/tester.js index 5ed9f88fe0433..1eead4670f29d 100644 --- a/services/tester.js +++ b/services/tester.js @@ -1,7 +1,4 @@ -import createServiceTester from '../core/service-test-runner/create-service-tester.js'; -import ServiceTester from '../core/service-test-runner/service-tester.js'; +import createServiceTester from '../core/service-test-runner/create-service-tester.js' +import ServiceTester from '../core/service-test-runner/service-tester.js' -export { - createServiceTester, - ServiceTester, -}; +export { createServiceTester, ServiceTester } diff --git a/services/testspace/testspace-base.js b/services/testspace/testspace-base.js index 16e038f54ebb1..1bb0d209a7353 100644 --- a/services/testspace/testspace-base.js +++ b/services/testspace/testspace-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' // https://help.testspace.com/docs/reference/web-api#list-results // case_counts|array|The contained cases [passed, failed, na, errored]|counters of result @@ -56,4 +56,4 @@ export default class TestspaceBase extends BaseJsonService { return { passed, failed, skipped, errored, total } } -}; +} diff --git a/services/testspace/testspace-base.spec.js b/services/testspace/testspace-base.spec.js index 9ffb803096f20..ff55a819653ce 100644 --- a/services/testspace/testspace-base.spec.js +++ b/services/testspace/testspace-base.spec.js @@ -1,6 +1,6 @@ -import {expect} from 'chai'; -import {NotFound} from '../index.js'; -import TestspaceBase from './testspace-base.js'; +import { expect } from 'chai' +import { NotFound } from '../index.js' +import TestspaceBase from './testspace-base.js' describe('TestspaceBase', function () { it('throws NotFound when response is missing space results', function () { diff --git a/services/testspace/testspace-test-count.service.js b/services/testspace/testspace-test-count.service.js index da4afc14d28f7..0a217254357b8 100644 --- a/services/testspace/testspace-test-count.service.js +++ b/services/testspace/testspace-test-count.service.js @@ -1,5 +1,5 @@ -import {metric as metricCount} from '../text-formatters.js'; -import TestspaceBase from './testspace-base.js'; +import { metric as metricCount } from '../text-formatters.js' +import TestspaceBase from './testspace-base.js' export default class TestspaceTestCount extends TestspaceBase { static route = { @@ -59,4 +59,4 @@ export default class TestspaceTestCount extends TestspaceBase { const { value } = this.transform({ json, metric }) return this.constructor.render({ value, metric }) } -}; +} diff --git a/services/testspace/testspace-test-count.spec.js b/services/testspace/testspace-test-count.spec.js index a1524f91bc7da..cb6b59b06e0fc 100644 --- a/services/testspace/testspace-test-count.spec.js +++ b/services/testspace/testspace-test-count.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import TestspaceTestCount from './testspace-test-count.service.js'; +import { test, given } from 'sazerac' +import TestspaceTestCount from './testspace-test-count.service.js' describe('TestspaceTestCount', function () { test(TestspaceTestCount.render, () => { diff --git a/services/testspace/testspace-test-count.tester.js b/services/testspace/testspace-test-count.tester.js index 32d47a1ecd36d..2ca45d6486096 100644 --- a/services/testspace/testspace-test-count.tester.js +++ b/services/testspace/testspace-test-count.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() const isMetricAllowZero = Joi.alternatives( isMetric, diff --git a/services/testspace/testspace-test-pass-ratio.service.js b/services/testspace/testspace-test-pass-ratio.service.js index a57b73af104f0..ea78e7eaec6c9 100644 --- a/services/testspace/testspace-test-pass-ratio.service.js +++ b/services/testspace/testspace-test-pass-ratio.service.js @@ -1,4 +1,4 @@ -import TestspaceBase from './testspace-base.js'; +import TestspaceBase from './testspace-base.js' export default class TestspacePassRatio extends TestspaceBase { static route = { @@ -40,4 +40,4 @@ export default class TestspacePassRatio extends TestspaceBase { const { passed, total } = this.transform(json) return this.constructor.render({ passed, total }) } -}; +} diff --git a/services/testspace/testspace-test-pass-ratio.spec.js b/services/testspace/testspace-test-pass-ratio.spec.js index 87c918edd61c3..1aed0d418955e 100644 --- a/services/testspace/testspace-test-pass-ratio.spec.js +++ b/services/testspace/testspace-test-pass-ratio.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import TestspacePassRatio from './testspace-test-pass-ratio.service.js'; +import { test, given } from 'sazerac' +import TestspacePassRatio from './testspace-test-pass-ratio.service.js' describe('TestspacePassRatio', function () { test(TestspacePassRatio.render, () => { diff --git a/services/testspace/testspace-test-pass-ratio.tester.js b/services/testspace/testspace-test-pass-ratio.tester.js index e1ca861205313..4d0de2d72abb0 100644 --- a/services/testspace/testspace-test-pass-ratio.tester.js +++ b/services/testspace/testspace-test-pass-ratio.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isIntegerPercentage} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isIntegerPercentage } from '../test-validators.js' export const t = await createServiceTester() t.create('Non-existent or unauthorized org') diff --git a/services/testspace/testspace-test-summary.service.js b/services/testspace/testspace-test-summary.service.js index 8e04fbf1d189d..f5176012a815b 100644 --- a/services/testspace/testspace-test-summary.service.js +++ b/services/testspace/testspace-test-summary.service.js @@ -1,5 +1,9 @@ -import {documentation, testResultQueryParamSchema, renderTestResultBadge} from '../test-results.js'; -import TestspaceBase from './testspace-base.js'; +import { + documentation, + testResultQueryParamSchema, + renderTestResultBadge, +} from '../test-results.js' +import TestspaceBase from './testspace-base.js' export default class TestspaceTests extends TestspaceBase { static route = { @@ -94,4 +98,4 @@ export default class TestspaceTests extends TestspaceBase { skippedLabel, }) } -}; +} diff --git a/services/testspace/testspace-test-summary.tester.js b/services/testspace/testspace-test-summary.tester.js index 760eefcd36775..2a4bc4ccf02a5 100644 --- a/services/testspace/testspace-test-summary.tester.js +++ b/services/testspace/testspace-test-summary.tester.js @@ -1,5 +1,10 @@ -import {createServiceTester} from '../tester.js' -import {isDefaultTestTotals, isDefaultCompactTestTotals, isCustomTestTotals, isCustomCompactTestTotals} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { + isDefaultTestTotals, + isDefaultCompactTestTotals, + isCustomTestTotals, + isCustomCompactTestTotals, +} from '../test-validators.js' export const t = await createServiceTester() t.create('Tests') diff --git a/services/text-formatters.js b/services/text-formatters.js index 8bf9c259950bd..50525fd6debda 100644 --- a/services/text-formatters.js +++ b/services/text-formatters.js @@ -2,7 +2,7 @@ * Commonly-used functions for formatting text in badge labels. Includes * ordinal numbers, currency codes, star ratings, versions, etc. */ -import moment from 'moment'; +import moment from 'moment' moment().format() function starRating(rating, max = 5) { @@ -132,4 +132,4 @@ export { maybePluralize, formatDate, formatRelativeDate, -}; +} diff --git a/services/text-formatters.spec.js b/services/text-formatters.spec.js index af2e5a2c3281d..efcfae4c15b96 100644 --- a/services/text-formatters.spec.js +++ b/services/text-formatters.spec.js @@ -1,6 +1,16 @@ -import {test, given} from 'sazerac'; -import sinon from 'sinon'; -import {starRating, currencyFromCode, ordinalNumber, metric, omitv, addv, maybePluralize, formatDate, formatRelativeDate} from './text-formatters.js'; +import { test, given } from 'sazerac' +import sinon from 'sinon' +import { + starRating, + currencyFromCode, + ordinalNumber, + metric, + omitv, + addv, + maybePluralize, + formatDate, + formatRelativeDate, +} from './text-formatters.js' describe('Text formatters', function () { test(starRating, () => { diff --git a/services/tokei/tokei.service.js b/services/tokei/tokei.service.js index 0b207358ebaad..dd01918b8d404 100644 --- a/services/tokei/tokei.service.js +++ b/services/tokei/tokei.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ lines: nonNegativeInteger, @@ -75,4 +75,4 @@ export default class Tokei extends BaseJsonService { const { lines } = await this.fetch({ provider, user, repo }) return this.constructor.render({ lines }) } -}; +} diff --git a/services/tokei/tokei.tester.js b/services/tokei/tokei.tester.js index 27a71c92c7fb6..9671c7b58848b 100644 --- a/services/tokei/tokei.tester.js +++ b/services/tokei/tokei.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = new ServiceTester({ id: 'tokei', title: 'Tokei LOC Tests' }) diff --git a/services/travis/travis-build.service.js b/services/travis/travis-build.service.js index 4acb847d62b62..2c52799588a4c 100644 --- a/services/travis/travis-build.service.js +++ b/services/travis/travis-build.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseSvgScrapingService} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseSvgScrapingService } from '../index.js' const schema = Joi.object({ message: Joi.alternatives() @@ -84,4 +84,4 @@ export default class TravisBuild extends BaseSvgScrapingService { return this.constructor.render({ status }) } -}; +} diff --git a/services/travis/travis-build.tester.js b/services/travis/travis-build.tester.js index ca4b9c9aadcbb..f6bd4df392f79 100644 --- a/services/travis/travis-build.tester.js +++ b/services/travis/travis-build.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Travis (.org) CI diff --git a/services/travis/travis-php-version-redirect.service.js b/services/travis/travis-php-version-redirect.service.js index 3f292fbd9f3e0..a61b4467fcff9 100644 --- a/services/travis/travis-php-version-redirect.service.js +++ b/services/travis/travis-php-version-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' const ciRedirect = redirector({ category: 'platform-support', @@ -23,4 +23,4 @@ const branchRedirect = redirector({ dateAdded: new Date('2020-07-12'), }) -export { ciRedirect, branchRedirect }; +export { ciRedirect, branchRedirect } diff --git a/services/travis/travis-php-version-redirect.tester.js b/services/travis/travis-php-version-redirect.tester.js index 997c84862ffe3..4326a1175d3dc 100644 --- a/services/travis/travis-php-version-redirect.tester.js +++ b/services/travis/travis-php-version-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'TravisPhpVersionRedirect', diff --git a/services/travis/travis-php-version.service.js b/services/travis/travis-php-version.service.js index e03fc9b578b0d..f8a29a39cd76d 100644 --- a/services/travis/travis-php-version.service.js +++ b/services/travis/travis-php-version.service.js @@ -1,6 +1,10 @@ -import Joi from 'joi'; -import {minorVersion, versionReduction, getPhpReleases} from '../php-version.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { + minorVersion, + versionReduction, + getPhpReleases, +} from '../php-version.js' +import { BaseJsonService } from '../index.js' const optionalNumberOrString = Joi.alternatives(Joi.string(), Joi.number()) const schema = Joi.object({ @@ -93,4 +97,4 @@ export default class TravisPhpVersion extends BaseJsonService { const { reduction, hasHhvm } = await this.transform(travisConfig) return this.constructor.render({ reduction, hasHhvm }) } -}; +} diff --git a/services/travis/travis-php-version.tester.js b/services/travis/travis-php-version.tester.js index 7819f3f5d47f5..16a23bd0c5183 100644 --- a/services/travis/travis-php-version.tester.js +++ b/services/travis/travis-php-version.tester.js @@ -1,5 +1,5 @@ -import {isPhpVersionReduction} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isPhpVersionReduction } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('gets the package version of symfony 5.1') diff --git a/services/treeware/treeware-trees.service.js b/services/treeware/treeware-trees.service.js index f5487f54c50a9..1fcbc10125cfb 100644 --- a/services/treeware/treeware-trees.service.js +++ b/services/treeware/treeware-trees.service.js @@ -1,8 +1,8 @@ -import crypto from 'crypto'; -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import {BaseJsonService} from '../index.js'; +import crypto from 'crypto' +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import { BaseJsonService } from '../index.js' const apiSchema = Joi.object({ total: Joi.number().required(), @@ -52,4 +52,4 @@ export default class TreewareTrees extends BaseJsonService { return this.constructor.render({ count: total }) } -}; +} diff --git a/services/treeware/treeware-trees.tester.js b/services/treeware/treeware-trees.tester.js index 5b61e45ee8d3e..07ada0cf8de39 100644 --- a/services/treeware/treeware-trees.tester.js +++ b/services/treeware/treeware-trees.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() t.create('request for existing package') diff --git a/services/twitch/twitch-base.js b/services/twitch/twitch-base.js index b11a03ffb0157..85d4e6b08303f 100644 --- a/services/twitch/twitch-base.js +++ b/services/twitch/twitch-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const tokenSchema = Joi.object({ access_token: Joi.string().required(), @@ -112,4 +112,4 @@ export default class TwitchBase extends BaseJsonService { // one last time return super._requestJson(request) } -}; +} diff --git a/services/twitch/twitch.service.js b/services/twitch/twitch.service.js index bca06c5712ff0..402f7e52cc459 100644 --- a/services/twitch/twitch.service.js +++ b/services/twitch/twitch.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import TwitchBase from './twitch-base.js'; +import Joi from 'joi' +import TwitchBase from './twitch-base.js' const helixSchema = Joi.object({ data: Joi.array().required(), @@ -64,4 +64,4 @@ export default class TwitchStatus extends TwitchBase { const data = await this.fetch({ user }) return this.constructor.render({ user, isLive: data.data.length > 0 }) } -}; +} diff --git a/services/twitch/twitch.spec.js b/services/twitch/twitch.spec.js index 74b8d7705975c..c3ec31522eb66 100644 --- a/services/twitch/twitch.spec.js +++ b/services/twitch/twitch.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import TwitchStatus from './twitch.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import TwitchStatus from './twitch.service.js' describe('TwitchStatus', function () { describe('auth', function () { diff --git a/services/twitch/twitch.tester.js b/services/twitch/twitch.tester.js index e9e2fbcc41695..9f68a1d82caae 100644 --- a/services/twitch/twitch.tester.js +++ b/services/twitch/twitch.tester.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {noToken} from '../test-helpers.js'; -import _noTwitchToken from './twitch.service.js'; -const noTwitchToken = noToken(_noTwitchToken); +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import _noTwitchToken from './twitch.service.js' +const noTwitchToken = noToken(_noTwitchToken) export const t = new ServiceTester({ id: 'twitch', diff --git a/services/twitter/twitter-redirect.service.js b/services/twitter/twitter-redirect.service.js index 29b85ac1e796d..5291115dbdf43 100644 --- a/services/twitter/twitter-redirect.service.js +++ b/services/twitter/twitter-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ redirector({ @@ -14,4 +14,4 @@ export default [ }), dateAdded: new Date('2019-09-17'), }), -]; +] diff --git a/services/twitter/twitter-redirect.tester.js b/services/twitter/twitter-redirect.tester.js index b479d4b808ca0..e777d9a5bee72 100644 --- a/services/twitter/twitter-redirect.tester.js +++ b/services/twitter/twitter-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'TwitterUrlRedirect', diff --git a/services/twitter/twitter.service.js b/services/twitter/twitter.service.js index 013a9f21b1fd1..2da76486a0846 100644 --- a/services/twitter/twitter.service.js +++ b/services/twitter/twitter.service.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {optionalUrl} from '../validators.js'; -import {BaseService, BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { optionalUrl } from '../validators.js' +import { BaseService, BaseJsonService, NotFound } from '../index.js' const queryParamSchema = Joi.object({ url: optionalUrl.required(), @@ -113,4 +113,4 @@ class TwitterFollow extends BaseJsonService { } } -export default [TwitterUrl, TwitterFollow]; +export default [TwitterUrl, TwitterFollow] diff --git a/services/twitter/twitter.tester.js b/services/twitter/twitter.tester.js index 1243440450594..e15b79f08f4dd 100644 --- a/services/twitter/twitter.tester.js +++ b/services/twitter/twitter.tester.js @@ -1,5 +1,5 @@ -import {isMetric} from '../test-validators.js'; -import {ServiceTester} from '../tester.js'; +import { isMetric } from '../test-validators.js' +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'twitter', diff --git a/services/ubuntu/ubuntu.service.js b/services/ubuntu/ubuntu.service.js index 7f85fbeeaf5d4..c584c95503edc 100644 --- a/services/ubuntu/ubuntu.service.js +++ b/services/ubuntu/ubuntu.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { BaseJsonService, NotFound } from '../index.js' const schema = Joi.object({ entries: Joi.array() @@ -68,4 +68,4 @@ export default class Ubuntu extends BaseJsonService { version: data.entries[0].source_package_version, }) } -}; +} diff --git a/services/ubuntu/ubuntu.tester.js b/services/ubuntu/ubuntu.tester.js index 244b7871d0839..c622493075b08 100644 --- a/services/ubuntu/ubuntu.tester.js +++ b/services/ubuntu/ubuntu.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isUbuntuVersion = Joi.string().regex( diff --git a/services/uptimerobot/uptimerobot-base.js b/services/uptimerobot/uptimerobot-base.js index eb972726a5903..2afa607b9fa70 100644 --- a/services/uptimerobot/uptimerobot-base.js +++ b/services/uptimerobot/uptimerobot-base.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService, InvalidParameter, InvalidResponse} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService, InvalidParameter, InvalidResponse } from '../index.js' // https://uptimerobot.com/api // POST getMonitors @@ -83,4 +83,4 @@ export default class UptimeRobotBase extends BaseJsonService { return { monitors } } -}; +} diff --git a/services/uptimerobot/uptimerobot-ratio.service.js b/services/uptimerobot/uptimerobot-ratio.service.js index 64b5bad074e70..fa98e8ed1fd05 100644 --- a/services/uptimerobot/uptimerobot-ratio.service.js +++ b/services/uptimerobot/uptimerobot-ratio.service.js @@ -1,5 +1,5 @@ -import {colorScale} from '../color-formatters.js'; -import UptimeRobotBase from './uptimerobot-base.js'; +import { colorScale } from '../color-formatters.js' +import UptimeRobotBase from './uptimerobot-base.js' const ratioColor = colorScale([10, 30, 50, 70]) @@ -44,4 +44,4 @@ export default class UptimeRobotRatio extends UptimeRobotBase { const ratio = Number.parseFloat(monitors[0].custom_uptime_ratio) return this.constructor.render({ ratio }) } -}; +} diff --git a/services/uptimerobot/uptimerobot-ratio.tester.js b/services/uptimerobot/uptimerobot-ratio.tester.js index 83dc62262fd20..db6b55c9da933 100644 --- a/services/uptimerobot/uptimerobot-ratio.tester.js +++ b/services/uptimerobot/uptimerobot-ratio.tester.js @@ -1,6 +1,6 @@ -import {isPercentage} from '../test-validators.js'; -import {invalidJSON} from '../response-fixtures.js'; -import {createServiceTester} from '../tester.js' +import { isPercentage } from '../test-validators.js' +import { invalidJSON } from '../response-fixtures.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Uptime Robot: Percentage (valid)') diff --git a/services/uptimerobot/uptimerobot-status.service.js b/services/uptimerobot/uptimerobot-status.service.js index 71a34f443f79c..a468175c42b62 100644 --- a/services/uptimerobot/uptimerobot-status.service.js +++ b/services/uptimerobot/uptimerobot-status.service.js @@ -1,4 +1,4 @@ -import UptimeRobotBase from './uptimerobot-base.js'; +import UptimeRobotBase from './uptimerobot-base.js' export default class UptimeRobotStatus extends UptimeRobotBase { static route = { @@ -42,4 +42,4 @@ export default class UptimeRobotStatus extends UptimeRobotBase { const { status } = monitors[0] return this.constructor.render({ status }) } -}; +} diff --git a/services/uptimerobot/uptimerobot-status.tester.js b/services/uptimerobot/uptimerobot-status.tester.js index 94f6d12ade2c2..dca7e92554e3d 100644 --- a/services/uptimerobot/uptimerobot-status.tester.js +++ b/services/uptimerobot/uptimerobot-status.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {invalidJSON} from '../response-fixtures.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { invalidJSON } from '../response-fixtures.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isUptimeStatus = Joi.string().valid( diff --git a/services/vaadin-directory/vaadin-directory-base.js b/services/vaadin-directory/vaadin-directory-base.js index 26a58fe31d1a4..b567df2b3177e 100644 --- a/services/vaadin-directory/vaadin-directory-base.js +++ b/services/vaadin-directory/vaadin-directory-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ ratingCount: nonNegativeInteger, @@ -27,4 +27,4 @@ class BaseVaadinDirectoryService extends BaseJsonService { } } -export { BaseVaadinDirectoryService }; +export { BaseVaadinDirectoryService } diff --git a/services/vaadin-directory/vaadin-directory-rating-count.service.js b/services/vaadin-directory/vaadin-directory-rating-count.service.js index 617c1c42b4495..e8af652c66d28 100644 --- a/services/vaadin-directory/vaadin-directory-rating-count.service.js +++ b/services/vaadin-directory/vaadin-directory-rating-count.service.js @@ -1,10 +1,8 @@ -import {metric} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; +import { metric } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BaseVaadinDirectoryService } from './vaadin-directory-base.js' -export default class VaadinDirectoryRatingCount extends ( - BaseVaadinDirectoryService -) { +export default class VaadinDirectoryRatingCount extends BaseVaadinDirectoryService { static category = 'rating' static route = { @@ -37,4 +35,4 @@ export default class VaadinDirectoryRatingCount extends ( const { ratingCount } = await this.fetch({ packageName }) return this.constructor.render({ ratingCount }) } -}; +} diff --git a/services/vaadin-directory/vaadin-directory-rating-count.tester.js b/services/vaadin-directory/vaadin-directory-rating-count.tester.js index 89728d433e996..8b43ed993cb71 100644 --- a/services/vaadin-directory/vaadin-directory-rating-count.tester.js +++ b/services/vaadin-directory/vaadin-directory-rating-count.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('rating count of component') diff --git a/services/vaadin-directory/vaadin-directory-rating.service.js b/services/vaadin-directory/vaadin-directory-rating.service.js index f2875eaa7f4ce..c07ddf091b099 100644 --- a/services/vaadin-directory/vaadin-directory-rating.service.js +++ b/services/vaadin-directory/vaadin-directory-rating.service.js @@ -1,10 +1,8 @@ -import {starRating} from '../text-formatters.js'; -import {floorCount as floorCountColor} from '../color-formatters.js'; -import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; +import { starRating } from '../text-formatters.js' +import { floorCount as floorCountColor } from '../color-formatters.js' +import { BaseVaadinDirectoryService } from './vaadin-directory-base.js' -export default class VaadinDirectoryRating extends ( - BaseVaadinDirectoryService -) { +export default class VaadinDirectoryRating extends BaseVaadinDirectoryService { static category = 'rating' static route = { @@ -46,4 +44,4 @@ export default class VaadinDirectoryRating extends ( const { averageRating } = await this.fetch({ packageName }) return this.constructor.render({ format, score: averageRating }) } -}; +} diff --git a/services/vaadin-directory/vaadin-directory-rating.tester.js b/services/vaadin-directory/vaadin-directory-rating.tester.js index 8598086732f8c..e4074eb1e6430 100644 --- a/services/vaadin-directory/vaadin-directory-rating.tester.js +++ b/services/vaadin-directory/vaadin-directory-rating.tester.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isStarRating} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { isStarRating } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('stars of component displayed in star icons') diff --git a/services/vaadin-directory/vaadin-directory-release-date.service.js b/services/vaadin-directory/vaadin-directory-release-date.service.js index 8080b49cab4a5..d9069ca4c9897 100644 --- a/services/vaadin-directory/vaadin-directory-release-date.service.js +++ b/services/vaadin-directory/vaadin-directory-release-date.service.js @@ -1,10 +1,8 @@ -import {formatDate} from '../text-formatters.js'; -import {age as ageColor} from '../color-formatters.js'; -import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; +import { formatDate } from '../text-formatters.js' +import { age as ageColor } from '../color-formatters.js' +import { BaseVaadinDirectoryService } from './vaadin-directory-base.js' -export default class VaadinDirectoryReleaseDate extends ( - BaseVaadinDirectoryService -) { +export default class VaadinDirectoryReleaseDate extends BaseVaadinDirectoryService { static category = 'activity' static route = { @@ -36,4 +34,4 @@ export default class VaadinDirectoryReleaseDate extends ( date: data.latestAvailableRelease.publicationDate, }) } -}; +} diff --git a/services/vaadin-directory/vaadin-directory-release-date.tester.js b/services/vaadin-directory/vaadin-directory-release-date.tester.js index 328aee392d4f4..9c1c68dc64318 100644 --- a/services/vaadin-directory/vaadin-directory-release-date.tester.js +++ b/services/vaadin-directory/vaadin-directory-release-date.tester.js @@ -1,5 +1,5 @@ -import {isFormattedDate} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isFormattedDate } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('latest release date of the component (format: yyyy-mm-dd)') diff --git a/services/vaadin-directory/vaadin-directory-status.service.js b/services/vaadin-directory/vaadin-directory-status.service.js index a7c3c5ff42621..0ad9186faad5b 100644 --- a/services/vaadin-directory/vaadin-directory-status.service.js +++ b/services/vaadin-directory/vaadin-directory-status.service.js @@ -1,8 +1,6 @@ -import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; +import { BaseVaadinDirectoryService } from './vaadin-directory-base.js' -export default class VaadinDirectoryStatus extends ( - BaseVaadinDirectoryService -) { +export default class VaadinDirectoryStatus extends BaseVaadinDirectoryService { static category = 'other' static route = { @@ -34,4 +32,4 @@ export default class VaadinDirectoryStatus extends ( const { status } = await this.fetch({ packageName }) return this.constructor.render({ status }) } -}; +} diff --git a/services/vaadin-directory/vaadin-directory-status.tester.js b/services/vaadin-directory/vaadin-directory-status.tester.js index 645bb3ea66c57..7caa48c2165fa 100644 --- a/services/vaadin-directory/vaadin-directory-status.tester.js +++ b/services/vaadin-directory/vaadin-directory-status.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('publish status of the component') diff --git a/services/vaadin-directory/vaadin-directory-version.service.js b/services/vaadin-directory/vaadin-directory-version.service.js index c1897383467a3..53af932836ecc 100644 --- a/services/vaadin-directory/vaadin-directory-version.service.js +++ b/services/vaadin-directory/vaadin-directory-version.service.js @@ -1,9 +1,7 @@ -import {renderVersionBadge} from '../version.js'; -import {BaseVaadinDirectoryService} from './vaadin-directory-base.js'; +import { renderVersionBadge } from '../version.js' +import { BaseVaadinDirectoryService } from './vaadin-directory-base.js' -export default class VaadinDirectoryVersion extends ( - BaseVaadinDirectoryService -) { +export default class VaadinDirectoryVersion extends BaseVaadinDirectoryService { static category = 'version' static route = { @@ -30,4 +28,4 @@ export default class VaadinDirectoryVersion extends ( const lv = data.latestAvailableRelease.name.toLowerCase() return renderVersionBadge({ version: lv }) } -}; +} diff --git a/services/vaadin-directory/vaadin-directory-version.tester.js b/services/vaadin-directory/vaadin-directory-version.tester.js index df18d5a6bb35a..957e6006a5959 100644 --- a/services/vaadin-directory/vaadin-directory-version.tester.js +++ b/services/vaadin-directory/vaadin-directory-version.tester.js @@ -1,5 +1,5 @@ -import {isSemver} from '../test-validators.js'; -import {createServiceTester} from '../tester.js' +import { isSemver } from '../test-validators.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('latest version of the component (can have v prefixed or without)') diff --git a/services/validators.js b/services/validators.js index 424c6d4593f35..42b89cd1d10e2 100644 --- a/services/validators.js +++ b/services/validators.js @@ -1,4 +1,7 @@ -import {semver as joiSemver, semverRange as joiSemverRange} from 'joi-extension-semver'; +import { + semver as joiSemver, + semverRange as joiSemverRange, +} from 'joi-extension-semver' import joi from 'joi' const Joi = joi.extend(joiSemver).extend(joiSemverRange) @@ -6,12 +9,11 @@ const optionalNonNegativeInteger = Joi.number().integer().min(0) export { optionalNonNegativeInteger } export const nonNegativeInteger = optionalNonNegativeInteger.required() -export const anyInteger = Joi.number().integer().required() -export const semver = Joi.semver().valid().required() -export const semverRange = Joi.semverRange().valid().required() -export const optionalDottedVersionNClausesWithOptionalSuffix = Joi.string().regex( - /^\d+(\.\d+)*([-+].*)?$/ -) - // TODO This accepts URLs with query strings and fragments, which for some - // purposes should be rejected. -export const optionalUrl = Joi.string().uri({ scheme: ['http', 'https'] }) +export const anyInteger = Joi.number().integer().required() +export const semver = Joi.semver().valid().required() +export const semverRange = Joi.semverRange().valid().required() +export const optionalDottedVersionNClausesWithOptionalSuffix = + Joi.string().regex(/^\d+(\.\d+)*([-+].*)?$/) +// TODO This accepts URLs with query strings and fragments, which for some +// purposes should be rejected. +export const optionalUrl = Joi.string().uri({ scheme: ['http', 'https'] }) diff --git a/services/version.js b/services/version.js index 96083258577c6..934b4d8de71d5 100644 --- a/services/version.js +++ b/services/version.js @@ -5,9 +5,9 @@ * * For utilities specific to PHP version ranges, see php-version.js. */ -import semver from 'semver'; -import {addv} from './text-formatters.js'; -import {version as versionColor} from './color-formatters.js'; +import semver from 'semver' +import { addv } from './text-formatters.js' +import { version as versionColor } from './color-formatters.js' function listCompare(a, b) { const alen = a.length @@ -160,10 +160,4 @@ function renderVersionBadge({ version, tag, defaultLabel }) { } } -export { - latest, - listCompare, - slice, - rangeStart, - renderVersionBadge, -}; +export { latest, listCompare, slice, rangeStart, renderVersionBadge } diff --git a/services/version.spec.js b/services/version.spec.js index f8d7c57141ea1..92b040cfa3090 100644 --- a/services/version.spec.js +++ b/services/version.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {latest, slice, rangeStart, renderVersionBadge} from './version.js'; +import { test, given } from 'sazerac' +import { latest, slice, rangeStart, renderVersionBadge } from './version.js' const includePre = true describe('Version helpers', function () { diff --git a/services/versioneye/versioneye.service.js b/services/versioneye/versioneye.service.js index 575c7925f9e98..c248e64c43a99 100644 --- a/services/versioneye/versioneye.service.js +++ b/services/versioneye/versioneye.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ category: 'downloads', @@ -8,4 +8,4 @@ export default deprecatedService({ }, label: 'versioneye', dateAdded: new Date('2018-08-20'), -}); +}) diff --git a/services/versioneye/versioneye.tester.js b/services/versioneye/versioneye.tester.js index 3bcfb52c58870..77e17b5dca4e1 100644 --- a/services/versioneye/versioneye.tester.js +++ b/services/versioneye/versioneye.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'versioneye', title: 'VersionEye' }) diff --git a/services/visual-studio-app-center/visual-studio-app-center-base.js b/services/visual-studio-app-center/visual-studio-app-center-base.js index 46132d1f9c67b..e90a6ee2f368b 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-base.js +++ b/services/visual-studio-app-center/visual-studio-app-center-base.js @@ -1,4 +1,4 @@ -import {BaseJsonService} from '../index.js'; +import { BaseJsonService } from '../index.js' const keywords = [ 'visual-studio', @@ -35,4 +35,4 @@ class BaseVisualStudioAppCenterService extends BaseJsonService { } } -export { keywords, documentation, BaseVisualStudioAppCenterService }; +export { keywords, documentation, BaseVisualStudioAppCenterService } diff --git a/services/visual-studio-app-center/visual-studio-app-center-builds.service.js b/services/visual-studio-app-center/visual-studio-app-center-builds.service.js index fcd9ba715d6b9..6b70a31a6f7dd 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-builds.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-builds.service.js @@ -1,15 +1,17 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {NotFound} from '../index.js'; -import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { NotFound } from '../index.js' +import { + BaseVisualStudioAppCenterService, + keywords, + documentation, +} from './visual-studio-app-center-base.js' const schema = Joi.array().items({ result: isBuildStatus.required(), }) -export default class VisualStudioAppCenterBuilds extends ( - BaseVisualStudioAppCenterService -) { +export default class VisualStudioAppCenterBuilds extends BaseVisualStudioAppCenterService { static category = 'build' static route = { @@ -47,4 +49,4 @@ export default class VisualStudioAppCenterBuilds extends ( throw new NotFound({ prettyMessage: 'no builds found' }) return renderBuildStatusBadge({ status: json[0].result }) } -}; +} diff --git a/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js b/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js index f27c84d5ebabc..0a70d24e994d5 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-builds.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Mocked response rather than real data as old builds are deleted after some time. diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js index 9185092b94b5e..9f51181597afa 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.service.js @@ -1,14 +1,16 @@ -import Joi from 'joi'; -import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; +import Joi from 'joi' +import { + BaseVisualStudioAppCenterService, + keywords, + documentation, +} from './visual-studio-app-center-base.js' const schema = Joi.object({ app_os: Joi.string().required(), min_os: Joi.string().required(), }).required() -export default class VisualStudioAppCenterReleasesOSVersion extends ( - BaseVisualStudioAppCenterService -) { +export default class VisualStudioAppCenterReleasesOSVersion extends BaseVisualStudioAppCenterService { static category = 'version' static route = { @@ -51,4 +53,4 @@ export default class VisualStudioAppCenterReleasesOSVersion extends ( }) return this.constructor.render({ appOS, minOS }) } -}; +} diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js index ce30a448e4cb3..826bcf1ad863b 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-osversion.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Note: diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js b/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js index f7c9b064edd00..76dd16ceb6f34 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-size.service.js @@ -1,15 +1,17 @@ -import Joi from 'joi'; -import prettyBytes from 'pretty-bytes'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; +import Joi from 'joi' +import prettyBytes from 'pretty-bytes' +import { nonNegativeInteger } from '../validators.js' +import { + BaseVisualStudioAppCenterService, + keywords, + documentation, +} from './visual-studio-app-center-base.js' const schema = Joi.object({ size: nonNegativeInteger, }).required() -export default class VisualStudioAppCenterReleasesSize extends ( - BaseVisualStudioAppCenterService -) { +export default class VisualStudioAppCenterReleasesSize extends BaseVisualStudioAppCenterService { static category = 'size' static route = { @@ -46,4 +48,4 @@ export default class VisualStudioAppCenterReleasesSize extends ( const { size } = await this.fetch({ owner, app, token, schema }) return this.constructor.render({ size }) } -}; +} diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js index c0f7bd80f4f99..5a1681a79eab0 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-size.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isFileSize} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isFileSize } from '../test-validators.js' export const t = await createServiceTester() t.create('8368844 bytes to 8.37 megabytes') diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js b/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js index 576aab96fc4a2..a4f90d3096a93 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-version.service.js @@ -1,15 +1,17 @@ -import Joi from 'joi'; -import {renderVersionBadge} from '../version.js'; -import {BaseVisualStudioAppCenterService, keywords, documentation} from './visual-studio-app-center-base.js'; +import Joi from 'joi' +import { renderVersionBadge } from '../version.js' +import { + BaseVisualStudioAppCenterService, + keywords, + documentation, +} from './visual-studio-app-center-base.js' const schema = Joi.object({ version: Joi.string().required(), short_version: Joi.string().required(), }).required() -export default class VisualStudioAppCenterReleasesVersion extends ( - BaseVisualStudioAppCenterService -) { +export default class VisualStudioAppCenterReleasesVersion extends BaseVisualStudioAppCenterService { static category = 'version' static route = { @@ -46,4 +48,4 @@ export default class VisualStudioAppCenterReleasesVersion extends ( version: `${shortVersion} (${version})`, }) } -}; +} diff --git a/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js b/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js index 975ad98ce80b7..49f528a0bfbe8 100644 --- a/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js +++ b/services/visual-studio-app-center/visual-studio-app-center-releases-version.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() // Note: diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js index b1756bf642734..8cfd950274f29 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js' const documentation = `

@@ -12,9 +12,7 @@ const documentation = ` // This service exists separately from the other Marketplace downloads badges (in ./visual-studio-marketplace-downloads.js) // due differences in how the Marketplace tracks metrics for Azure DevOps extensions vs. other extension types. // See https://github.com/badges/shields/pull/2748 for more information on the discussion and decision. -export default class VisualStudioMarketplaceAzureDevOpsInstalls extends ( - VisualStudioMarketplaceBase -) { +export default class VisualStudioMarketplaceAzureDevOpsInstalls extends VisualStudioMarketplaceBase { static category = 'downloads' static route = { @@ -60,4 +58,4 @@ export default class VisualStudioMarketplaceAzureDevOpsInstalls extends ( return this.constructor.render({ count: statistics.onpremDownloads }) } } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js index 800c358f9bd18..f4b209c5460c5 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() const mockResponse = { diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-base.js b/services/visual-studio-marketplace/visual-studio-marketplace-base.js index e07dd0d62b9f5..d25e9c11a2fc7 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-base.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import validate from '../../core/base-service/validate.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import validate from '../../core/base-service/validate.js' +import { BaseJsonService, NotFound } from '../index.js' const extensionQuerySchema = Joi.object({ results: Joi.array() @@ -108,4 +108,4 @@ export default class VisualStudioMarketplaceBase extends BaseJsonService { return { statistics: value } } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js index c0848974b7af6..1d90a6275cfa9 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js @@ -1,6 +1,6 @@ -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js' const documentation = `

@@ -11,9 +11,7 @@ const documentation = `

` -export default class VisualStudioMarketplaceDownloads extends ( - VisualStudioMarketplaceBase -) { +export default class VisualStudioMarketplaceDownloads extends VisualStudioMarketplaceBase { static category = 'downloads' static route = { @@ -60,4 +58,4 @@ export default class VisualStudioMarketplaceDownloads extends ( : statistics.install + statistics.updateCount return this.constructor.render({ measure, count }) } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js index 777c8eaa8c38c..d74b78cb87470 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isMetric} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' export const t = await createServiceTester() const mockResponse = { diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js index 9ce7bbce05633..5d7106fa58151 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.service.js @@ -1,10 +1,8 @@ -import {age} from '../color-formatters.js'; -import {formatDate} from '../text-formatters.js'; -import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; +import { age } from '../color-formatters.js' +import { formatDate } from '../text-formatters.js' +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js' -export default class VisualStudioMarketplaceLastUpdated extends ( - VisualStudioMarketplaceBase -) { +export default class VisualStudioMarketplaceLastUpdated extends VisualStudioMarketplaceBase { static category = 'activity' static route = { @@ -45,4 +43,4 @@ export default class VisualStudioMarketplaceLastUpdated extends ( const { lastUpdated } = this.transform({ json }) return this.constructor.render({ lastUpdated }) } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js index 92fc5ac60b6d1..cd7e40745a4ff 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-last-updated.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isFormattedDate} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isFormattedDate } from '../test-validators.js' export const t = await createServiceTester() t.create('date') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js index 117f2d604b6ca..20de188d7fcd0 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js @@ -1,10 +1,8 @@ -import {starRating} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; +import { starRating } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js' -export default class VisualStudioMarketplaceRating extends ( - VisualStudioMarketplaceBase -) { +export default class VisualStudioMarketplaceRating extends VisualStudioMarketplaceBase { static category = 'rating' static route = { @@ -61,4 +59,4 @@ export default class VisualStudioMarketplaceRating extends ( ratingCount: statistics.ratingcount, }) } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js index 2a4a114cffac8..213285adbfda4 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {withRegex, isStarRating} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { withRegex, isStarRating } from '../test-validators.js' export const t = await createServiceTester() const isVscodeRating = withRegex(/[0-5]\.[0-9]{1}\/5?\s*\([0-9]*\)$/) diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js index 9f8d82dbfde93..d604c425c1a84 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.service.js @@ -1,10 +1,8 @@ -import {age} from '../color-formatters.js'; -import {formatDate} from '../text-formatters.js'; -import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; +import { age } from '../color-formatters.js' +import { formatDate } from '../text-formatters.js' +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js' -export default class VisualStudioMarketplaceReleaseDate extends ( - VisualStudioMarketplaceBase -) { +export default class VisualStudioMarketplaceReleaseDate extends VisualStudioMarketplaceBase { static category = 'activity' static route = { @@ -45,4 +43,4 @@ export default class VisualStudioMarketplaceReleaseDate extends ( const { releaseDate } = this.transform({ json }) return this.constructor.render({ releaseDate }) } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js index 155bbe96d56b8..acf9da220bd8f 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-release-date.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {isFormattedDate} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { isFormattedDate } from '../test-validators.js' export const t = await createServiceTester() t.create('date') diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js index d7877a89f9d3f..e0e8e2458b31e 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js @@ -1,9 +1,7 @@ -import {renderVersionBadge} from '../version.js'; -import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js'; +import { renderVersionBadge } from '../version.js' +import VisualStudioMarketplaceBase from './visual-studio-marketplace-base.js' -export default class VisualStudioMarketplaceVersion extends ( - VisualStudioMarketplaceBase -) { +export default class VisualStudioMarketplaceVersion extends VisualStudioMarketplaceBase { static category = 'version' static route = { @@ -41,4 +39,4 @@ export default class VisualStudioMarketplaceVersion extends ( return this.constructor.render({ version }) } -}; +} diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js index d9a7234278559..1b44b3e0e0e26 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.tester.js @@ -1,5 +1,5 @@ -import {createServiceTester} from '../tester.js' -import {withRegex} from '../test-validators.js'; +import { createServiceTester } from '../tester.js' +import { withRegex } from '../test-validators.js' export const t = await createServiceTester() const isMarketplaceVersion = withRegex(/^v(\d+\.\d+\.\d+)(\.\d+)?$/) diff --git a/services/w3c/w3c-validation-helper.js b/services/w3c/w3c-validation-helper.js index 1c15c08fbc6cf..fef29ef373811 100644 --- a/services/w3c/w3c-validation-helper.js +++ b/services/w3c/w3c-validation-helper.js @@ -145,10 +145,4 @@ const documentation = `

` -export { - documentation, - presetRegex, - getColor, - getMessage, - getSchema, -}; +export { documentation, presetRegex, getColor, getMessage, getSchema } diff --git a/services/w3c/w3c-validation-helper.spec.js b/services/w3c/w3c-validation-helper.spec.js index 6622d5e008633..3c024c2bbc89b 100644 --- a/services/w3c/w3c-validation-helper.spec.js +++ b/services/w3c/w3c-validation-helper.spec.js @@ -1,6 +1,11 @@ -import {expect} from 'chai'; -import {test, given, forCases} from 'sazerac'; -import {presetRegex, getMessage, getColor, getSchema} from './w3c-validation-helper.js'; +import { expect } from 'chai' +import { test, given, forCases } from 'sazerac' +import { + presetRegex, + getMessage, + getColor, + getSchema, +} from './w3c-validation-helper.js' describe('w3c-validation-helper', function () { describe('presetRegex', function () { diff --git a/services/w3c/w3c-validation.service.js b/services/w3c/w3c-validation.service.js index 2b83604b40368..945fd9a27473c 100644 --- a/services/w3c/w3c-validation.service.js +++ b/services/w3c/w3c-validation.service.js @@ -1,7 +1,13 @@ -import Joi from 'joi'; -import {optionalUrl} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; -import {documentation, presetRegex, getColor, getMessage, getSchema} from './w3c-validation-helper.js'; +import Joi from 'joi' +import { optionalUrl } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' +import { + documentation, + presetRegex, + getColor, + getMessage, + getSchema, +} from './w3c-validation-helper.js' const schema = Joi.object({ url: Joi.string().optional(), @@ -116,4 +122,4 @@ export default class W3cValidation extends BaseJsonService { messageTypes: this.transform(url, messages), }) } -}; +} diff --git a/services/w3c/w3c-validation.tester.js b/services/w3c/w3c-validation.tester.js index bc2db6ec9480e..75bbae5787775 100644 --- a/services/w3c/w3c-validation.tester.js +++ b/services/w3c/w3c-validation.tester.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' +import Joi from 'joi' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() const isErrorOnly = Joi.string().regex(/^[0-9]+ errors?$/) diff --git a/services/waffle/waffle-label-redirect.service.js b/services/waffle/waffle-label-redirect.service.js index f857c77ee1c88..2a31d3417ce14 100644 --- a/services/waffle/waffle-label-redirect.service.js +++ b/services/waffle/waffle-label-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default [ // The WaffleLabel service originally had 'label' as an optional parameter @@ -16,4 +16,4 @@ export default [ transformPath: ({ user, repo }) => `/waffle/label/${user}/${repo}/ready`, dateAdded: new Date('2019-03-05'), }), -]; +] diff --git a/services/waffle/waffle-label-redirect.tester.js b/services/waffle/waffle-label-redirect.tester.js index 150f144b91671..3d6625615be8a 100644 --- a/services/waffle/waffle-label-redirect.tester.js +++ b/services/waffle/waffle-label-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'WaffleLabelRedirect', diff --git a/services/waffle/waffle-label.service.js b/services/waffle/waffle-label.service.js index cb665ff3db25f..d5ea4832bbc86 100644 --- a/services/waffle/waffle-label.service.js +++ b/services/waffle/waffle-label.service.js @@ -1,4 +1,4 @@ -import {deprecatedService} from '../index.js'; +import { deprecatedService } from '../index.js' export default deprecatedService({ route: { @@ -8,4 +8,4 @@ export default deprecatedService({ label: 'waffle', category: 'issue-tracking', dateAdded: new Date('2019-05-21'), -}); +}) diff --git a/services/waffle/waffle-label.tester.js b/services/waffle/waffle-label.tester.js index 60f734b903ff5..05e9e1bd1d9ed 100644 --- a/services/waffle/waffle-label.tester.js +++ b/services/waffle/waffle-label.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'Waffle', diff --git a/services/website-status.js b/services/website-status.js index 098ad1ee270cd..c0fdb252b07b1 100644 --- a/services/website-status.js +++ b/services/website-status.js @@ -1,4 +1,4 @@ -import Joi from 'joi'; +import Joi from 'joi' const queryParamSchema = Joi.object({ up_message: Joi.string(), @@ -28,8 +28,4 @@ function renderWebsiteStatus({ } } -export { - queryParamSchema, - exampleQueryParams, - renderWebsiteStatus, -}; +export { queryParamSchema, exampleQueryParams, renderWebsiteStatus } diff --git a/services/website-status.spec.js b/services/website-status.spec.js index b1473c9f7f54c..5e73cd774292f 100644 --- a/services/website-status.spec.js +++ b/services/website-status.spec.js @@ -1,5 +1,5 @@ -import {test, given} from 'sazerac'; -import {renderWebsiteStatus} from './website-status.js'; +import { test, given } from 'sazerac' +import { renderWebsiteStatus } from './website-status.js' describe('Website status helpers', function () { const customOptions = { diff --git a/services/website/website-redirect.service.js b/services/website/website-redirect.service.js index 3b0f21e338841..a7a6b18a64472 100644 --- a/services/website/website-redirect.service.js +++ b/services/website/website-redirect.service.js @@ -1,10 +1,12 @@ -import {escapeFormat} from '../../core/badge-urls/path-helpers.js'; -import {redirector} from '../index.js'; +import { escapeFormat } from '../../core/badge-urls/path-helpers.js' +import { redirector } from '../index.js' function escapeFormatSlashes(t) { - return escapeFormat(t) - // Double slash - .replace(/\/\//g, '/'); + return ( + escapeFormat(t) + // Double slash + .replace(/\/\//g, '/') + ) } /* @@ -100,4 +102,4 @@ export default [ }), dateAdded: new Date('2019-09-17'), }), -]; +] diff --git a/services/website/website-redirect.tester.js b/services/website/website-redirect.tester.js index 5b5c53ed55b44..0aeba6b5bc629 100644 --- a/services/website/website-redirect.tester.js +++ b/services/website/website-redirect.tester.js @@ -1,4 +1,4 @@ -import {ServiceTester} from '../tester.js'; +import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ id: 'WebsiteRedirect', diff --git a/services/website/website.service.js b/services/website/website.service.js index 7e1c61a1d4e65..5ac7e4536a0c8 100644 --- a/services/website/website.service.js +++ b/services/website/website.service.js @@ -1,9 +1,13 @@ -import Joi from 'joi'; -import emojic from 'emojic'; -import {optionalUrl} from '../validators.js'; -import {queryParamSchema, exampleQueryParams, renderWebsiteStatus} from '../website-status.js'; -import {BaseService} from '../index.js'; -import trace from '../../core/base-service/trace.js'; +import Joi from 'joi' +import emojic from 'emojic' +import { optionalUrl } from '../validators.js' +import { + queryParamSchema, + exampleQueryParams, + renderWebsiteStatus, +} from '../website-status.js' +import { BaseService } from '../index.js' +import trace from '../../core/base-service/trace.js' const documentation = `

@@ -99,4 +103,4 @@ export default class Website extends BaseService { downColor, }) } -}; +} diff --git a/services/website/website.tester.js b/services/website/website.tester.js index d84d9475ee064..95d2caeac1c59 100644 --- a/services/website/website.tester.js +++ b/services/website/website.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('status of http://shields.io') diff --git a/services/wercker/wercker.service.js b/services/wercker/wercker.service.js index d9523e34a1b79..7dcb1faa9f417 100644 --- a/services/wercker/wercker.service.js +++ b/services/wercker/wercker.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {isBuildStatus, renderBuildStatusBadge} from '../build-status.js'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js' +import { BaseJsonService } from '../index.js' const werckerSchema = Joi.array() .items( @@ -124,4 +124,4 @@ export default class Wercker extends BaseJsonService { const { result } = json[0] return this.constructor.render({ result }) } -}; +} diff --git a/services/wercker/wercker.tester.js b/services/wercker/wercker.tester.js index 864a430d7f071..bcbd29368db1b 100644 --- a/services/wercker/wercker.tester.js +++ b/services/wercker/wercker.tester.js @@ -1,5 +1,5 @@ -import {isBuildStatus} from '../build-status.js'; -import {createServiceTester} from '../tester.js' +import { isBuildStatus } from '../build-status.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Build status') diff --git a/services/wheelmap/wheelmap.service.js b/services/wheelmap/wheelmap.service.js index c739a768af6d1..c6abf22d8c6cd 100644 --- a/services/wheelmap/wheelmap.service.js +++ b/services/wheelmap/wheelmap.service.js @@ -1,5 +1,5 @@ -import Joi from 'joi'; -import {BaseJsonService} from '../index.js'; +import Joi from 'joi' +import { BaseJsonService } from '../index.js' const schema = Joi.object({ node: Joi.object({ @@ -64,4 +64,4 @@ export default class Wheelmap extends BaseJsonService { const accessibility = json.node.wheelchair return this.constructor.render({ accessibility }) } -}; +} diff --git a/services/wheelmap/wheelmap.spec.js b/services/wheelmap/wheelmap.spec.js index 20c4eeee36d3f..80287395c033d 100644 --- a/services/wheelmap/wheelmap.spec.js +++ b/services/wheelmap/wheelmap.spec.js @@ -1,7 +1,7 @@ -import {expect} from 'chai'; -import nock from 'nock'; -import {cleanUpNockAfterEach, defaultContext} from '../test-helpers.js'; -import Wheelmap from './wheelmap.service.js'; +import { expect } from 'chai' +import nock from 'nock' +import { cleanUpNockAfterEach, defaultContext } from '../test-helpers.js' +import Wheelmap from './wheelmap.service.js' describe('Wheelmap', function () { cleanUpNockAfterEach() diff --git a/services/wheelmap/wheelmap.tester.js b/services/wheelmap/wheelmap.tester.js index 954361e2764d8..e4d5e6c49b580 100644 --- a/services/wheelmap/wheelmap.tester.js +++ b/services/wheelmap/wheelmap.tester.js @@ -1,8 +1,8 @@ -import {createServiceTester} from '../tester.js' -import {noToken} from '../test-helpers.js'; -import _noWheelmapToken from './wheelmap.service.js'; +import { createServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import _noWheelmapToken from './wheelmap.service.js' export const t = await createServiceTester() -const noWheelmapToken = noToken(_noWheelmapToken); +const noWheelmapToken = noToken(_noWheelmapToken) t.create('node with accessibility') .skipWhen(noWheelmapToken) diff --git a/services/wordpress/wordpress-base.js b/services/wordpress/wordpress-base.js index 2cf4c55c93e46..c11852b4f5e23 100644 --- a/services/wordpress/wordpress-base.js +++ b/services/wordpress/wordpress-base.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {nonNegativeInteger} from '../validators.js'; -import {BaseJsonService, NotFound} from '../index.js'; +import Joi from 'joi' +import { nonNegativeInteger } from '../validators.js' +import { BaseJsonService, NotFound } from '../index.js' const stringOrFalse = Joi.alternatives(Joi.string(), Joi.bool()) @@ -79,4 +79,4 @@ export default class BaseWordpress extends BaseJsonService { } return json } -}; +} diff --git a/services/wordpress/wordpress-downloads.service.js b/services/wordpress/wordpress-downloads.service.js index ca33b07597dcd..83979488b5fa4 100644 --- a/services/wordpress/wordpress-downloads.service.js +++ b/services/wordpress/wordpress-downloads.service.js @@ -1,8 +1,8 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {downloadCount} from '../color-formatters.js'; -import {NotFound} from '../index.js'; -import BaseWordpress from './wordpress-base.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { downloadCount } from '../color-formatters.js' +import { NotFound } from '../index.js' +import BaseWordpress from './wordpress-base.js' const dateSchema = Joi.object() .pattern(Joi.date().iso(), Joi.number().integer()) @@ -156,4 +156,4 @@ function InstallsForExtensionType(extensionType) { const downloadServices = ['plugin', 'theme'].map(DownloadsForExtensionType) const installServices = ['plugin', 'theme'].map(InstallsForExtensionType) const modules = [...downloadServices, ...installServices] -export default modules; +export default modules diff --git a/services/wordpress/wordpress-downloads.tester.js b/services/wordpress/wordpress-downloads.tester.js index 1702c237731ce..05019f0782733 100644 --- a/services/wordpress/wordpress-downloads.tester.js +++ b/services/wordpress/wordpress-downloads.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isMetric, isMetricOverTimePeriod} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' export const t = new ServiceTester({ id: 'wordpress', diff --git a/services/wordpress/wordpress-last-update.service.js b/services/wordpress/wordpress-last-update.service.js index e73e58b5335b1..10b48ef92b7e4 100644 --- a/services/wordpress/wordpress-last-update.service.js +++ b/services/wordpress/wordpress-last-update.service.js @@ -1,8 +1,8 @@ -import moment from 'moment'; -import {InvalidResponse} from '../index.js'; -import {formatDate} from '../text-formatters.js'; -import {age as ageColor} from '../color-formatters.js'; -import BaseWordpress from './wordpress-base.js'; +import moment from 'moment' +import { InvalidResponse } from '../index.js' +import { formatDate } from '../text-formatters.js' +import { age as ageColor } from '../color-formatters.js' +import BaseWordpress from './wordpress-base.js' const extensionData = { plugin: { @@ -74,4 +74,4 @@ function LastUpdateForType(extensionType) { } const lastupdate = ['plugin', 'theme'].map(LastUpdateForType) -export default [...lastupdate]; +export default [...lastupdate] diff --git a/services/wordpress/wordpress-last-update.tester.js b/services/wordpress/wordpress-last-update.tester.js index 2e2c214eac08d..d490b6ee72f03 100644 --- a/services/wordpress/wordpress-last-update.tester.js +++ b/services/wordpress/wordpress-last-update.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isFormattedDate} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isFormattedDate } from '../test-validators.js' export const t = new ServiceTester({ id: 'wordpress', diff --git a/services/wordpress/wordpress-platform-redirect.service.js b/services/wordpress/wordpress-platform-redirect.service.js index 414e88374e568..5f9544e5e1bcf 100644 --- a/services/wordpress/wordpress-platform-redirect.service.js +++ b/services/wordpress/wordpress-platform-redirect.service.js @@ -1,4 +1,4 @@ -import {redirector} from '../index.js'; +import { redirector } from '../index.js' export default redirector({ category: 'platform-support', @@ -8,4 +8,4 @@ export default redirector({ }, transformPath: ({ slug }) => `/wordpress/plugin/tested/${slug}`, dateAdded: new Date('2019-04-17'), -}); +}) diff --git a/services/wordpress/wordpress-platform-redirect.tester.js b/services/wordpress/wordpress-platform-redirect.tester.js index 22cc78000449b..2f0816dea5633 100644 --- a/services/wordpress/wordpress-platform-redirect.tester.js +++ b/services/wordpress/wordpress-platform-redirect.tester.js @@ -1,4 +1,4 @@ -import {createServiceTester} from '../tester.js' +import { createServiceTester } from '../tester.js' export const t = await createServiceTester() t.create('Plugin Tested WP Version (Alias)') diff --git a/services/wordpress/wordpress-platform.service.js b/services/wordpress/wordpress-platform.service.js index e81e2d723f741..5c0d1cbd05aa7 100644 --- a/services/wordpress/wordpress-platform.service.js +++ b/services/wordpress/wordpress-platform.service.js @@ -1,8 +1,8 @@ -import {NotFound} from '../index.js'; -import {addv} from '../text-formatters.js'; -import {version as versionColor} from '../color-formatters.js'; -import BaseWordpress from './wordpress-base.js'; -import {versionColorForWordpressVersion} from './wordpress-version-color.js'; +import { NotFound } from '../index.js' +import { addv } from '../text-formatters.js' +import { version as versionColor } from '../color-formatters.js' +import BaseWordpress from './wordpress-base.js' +import { versionColorForWordpressVersion } from './wordpress-version-color.js' const extensionData = { plugin: { @@ -166,4 +166,4 @@ export default [ ...requiredPhp, ...requiresVersion, WordpressPluginTestedVersion, -]; +] diff --git a/services/wordpress/wordpress-platform.tester.js b/services/wordpress/wordpress-platform.tester.js index b388ccf88e91e..ded6f1b6b094b 100644 --- a/services/wordpress/wordpress-platform.tester.js +++ b/services/wordpress/wordpress-platform.tester.js @@ -1,6 +1,9 @@ -import Joi from 'joi'; -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionAtLeastOne, isComposerVersion} from '../test-validators.js'; +import Joi from 'joi' +import { ServiceTester } from '../tester.js' +import { + isVPlusDottedVersionAtLeastOne, + isComposerVersion, +} from '../test-validators.js' export const t = new ServiceTester({ id: 'WordpressPlatform', diff --git a/services/wordpress/wordpress-rating.service.js b/services/wordpress/wordpress-rating.service.js index 9ee53b6428c3d..6489fde9dae90 100644 --- a/services/wordpress/wordpress-rating.service.js +++ b/services/wordpress/wordpress-rating.service.js @@ -1,6 +1,6 @@ -import {starRating, metric} from '../text-formatters.js'; -import {floorCount} from '../color-formatters.js'; -import BaseWordpress from './wordpress-base.js'; +import { starRating, metric } from '../text-formatters.js' +import { floorCount } from '../color-formatters.js' +import BaseWordpress from './wordpress-base.js' const extensionData = { plugin: { @@ -101,4 +101,4 @@ const ratingsServices = ['plugin', 'theme'].map(RatingForExtensionType) const starsServices = ['plugin', 'theme'].map(StarsForExtensionType) const modules = [...ratingsServices, ...starsServices] -export default modules; +export default modules diff --git a/services/wordpress/wordpress-rating.tester.js b/services/wordpress/wordpress-rating.tester.js index b1007bffb0dc8..1c686890f16cf 100644 --- a/services/wordpress/wordpress-rating.tester.js +++ b/services/wordpress/wordpress-rating.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isStarRating} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isStarRating } from '../test-validators.js' export const t = new ServiceTester({ id: 'wordpress', diff --git a/services/wordpress/wordpress-version-color.js b/services/wordpress/wordpress-version-color.js index afe8a61d03c53..4e15ca3c32653 100644 --- a/services/wordpress/wordpress-version-color.js +++ b/services/wordpress/wordpress-version-color.js @@ -1,6 +1,6 @@ -import {promisify} from 'util'; -import semver from 'semver'; -import {regularUpdate} from '../../core/legacy/regular-update.js'; +import { promisify } from 'util' +import semver from 'semver' +import { regularUpdate } from '../../core/legacy/regular-update.js' // TODO: Incorporate this schema. // const schema = Joi.object() @@ -59,8 +59,4 @@ async function versionColorForWordpressVersion(version) { } } -export { - toSemver, - getOfferedVersions, - versionColorForWordpressVersion, -}; +export { toSemver, getOfferedVersions, versionColorForWordpressVersion } diff --git a/services/wordpress/wordpress-version-color.spec.js b/services/wordpress/wordpress-version-color.spec.js index 5f9a9210e8be0..c428886c55347 100644 --- a/services/wordpress/wordpress-version-color.spec.js +++ b/services/wordpress/wordpress-version-color.spec.js @@ -1,5 +1,8 @@ -import {expect} from 'chai'; -import {toSemver, versionColorForWordpressVersion} from './wordpress-version-color.js'; +import { expect } from 'chai' +import { + toSemver, + versionColorForWordpressVersion, +} from './wordpress-version-color.js' describe('toSemver() function', function () { it('coerces versions', function () { diff --git a/services/wordpress/wordpress-version.service.js b/services/wordpress/wordpress-version.service.js index 4127759b5ba4b..9f5d62741391e 100644 --- a/services/wordpress/wordpress-version.service.js +++ b/services/wordpress/wordpress-version.service.js @@ -1,6 +1,6 @@ -import {addv} from '../text-formatters.js'; -import {version as versionColor} from '../color-formatters.js'; -import BaseWordpress from './wordpress-base.js'; +import { addv } from '../text-formatters.js' +import { version as versionColor } from '../color-formatters.js' +import BaseWordpress from './wordpress-base.js' function VersionForExtensionType(extensionType) { const { capt, exampleSlug } = { @@ -51,4 +51,4 @@ function VersionForExtensionType(extensionType) { } } -export default ['theme', 'plugin'].map(VersionForExtensionType); +export default ['theme', 'plugin'].map(VersionForExtensionType) diff --git a/services/wordpress/wordpress-version.tester.js b/services/wordpress/wordpress-version.tester.js index d999436fe01fd..9abf4a330e7b1 100644 --- a/services/wordpress/wordpress-version.tester.js +++ b/services/wordpress/wordpress-version.tester.js @@ -1,5 +1,5 @@ -import {ServiceTester} from '../tester.js'; -import {isVPlusDottedVersionAtLeastOne} from '../test-validators.js'; +import { ServiceTester } from '../tester.js' +import { isVPlusDottedVersionAtLeastOne } from '../test-validators.js' export const t = new ServiceTester({ id: 'wordpress', diff --git a/services/youtube/youtube-base.js b/services/youtube/youtube-base.js index 1aa69759c2347..94f14ee6018d2 100644 --- a/services/youtube/youtube-base.js +++ b/services/youtube/youtube-base.js @@ -1,7 +1,7 @@ -import Joi from 'joi'; -import {BaseJsonService, NotFound} from '../index.js'; -import {metric} from '../text-formatters.js'; -import {nonNegativeInteger} from '../validators.js'; +import Joi from 'joi' +import { BaseJsonService, NotFound } from '../index.js' +import { metric } from '../text-formatters.js' +import { nonNegativeInteger } from '../validators.js' const documentation = `

By using the YouTube badges provided by Shields.io, you are agreeing to be bound by the YouTube Terms of Service. These can be found here: @@ -90,4 +90,4 @@ class YouTubeChannelBase extends YouTubeBase { static type = 'channel' } -export { documentation, YouTubeVideoBase, YouTubeChannelBase }; +export { documentation, YouTubeVideoBase, YouTubeChannelBase } diff --git a/services/youtube/youtube-channel-views.service.js b/services/youtube/youtube-channel-views.service.js index 599fa05d17f89..d3f854a920a6f 100644 --- a/services/youtube/youtube-channel-views.service.js +++ b/services/youtube/youtube-channel-views.service.js @@ -1,4 +1,4 @@ -import {documentation, YouTubeChannelBase} from './youtube-base.js'; +import { documentation, YouTubeChannelBase } from './youtube-base.js' export default class YouTubeChannelViews extends YouTubeChannelBase { static route = { @@ -26,4 +26,4 @@ export default class YouTubeChannelViews extends YouTubeChannelBase { static render({ statistics, id }) { return super.renderSingleStat({ statistics, statisticName: 'view', id }) } -}; +} diff --git a/services/youtube/youtube-channel-views.tester.js b/services/youtube/youtube-channel-views.tester.js index 0ece891f7d7d1..47501da678108 100644 --- a/services/youtube/youtube-channel-views.tester.js +++ b/services/youtube/youtube-channel-views.tester.js @@ -1,9 +1,9 @@ -import {createServiceTester} from '../tester.js' -import {noToken} from '../test-helpers.js'; -import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-channel-views.service.js'; +import { createServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import { isMetric } from '../test-validators.js' +import _noYouTubeToken from './youtube-channel-views.service.js' export const t = await createServiceTester() -const noYouTubeToken = noToken(_noYouTubeToken); +const noYouTubeToken = noToken(_noYouTubeToken) t.create('channel view count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-comments.service.js b/services/youtube/youtube-comments.service.js index ca8bc8143f569..0f7faf3c7806b 100644 --- a/services/youtube/youtube-comments.service.js +++ b/services/youtube/youtube-comments.service.js @@ -1,4 +1,4 @@ -import {documentation, YouTubeVideoBase} from './youtube-base.js'; +import { documentation, YouTubeVideoBase } from './youtube-base.js' export default class YouTubeComments extends YouTubeVideoBase { static route = { @@ -26,4 +26,4 @@ export default class YouTubeComments extends YouTubeVideoBase { static render({ statistics, id }) { return super.renderSingleStat({ statistics, statisticName: 'comment', id }) } -}; +} diff --git a/services/youtube/youtube-comments.tester.js b/services/youtube/youtube-comments.tester.js index 3727eb145bd2b..dded2be9dfb28 100644 --- a/services/youtube/youtube-comments.tester.js +++ b/services/youtube/youtube-comments.tester.js @@ -1,9 +1,9 @@ -import {createServiceTester} from '../tester.js' -import {noToken} from '../test-helpers.js'; -import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-comments.service.js'; +import { createServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import { isMetric } from '../test-validators.js' +import _noYouTubeToken from './youtube-comments.service.js' export const t = await createServiceTester() -const noYouTubeToken = noToken(_noYouTubeToken); +const noYouTubeToken = noToken(_noYouTubeToken) t.create('video comment count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-likes.service.js b/services/youtube/youtube-likes.service.js index 09d3ab4419654..94e2d7ae66264 100644 --- a/services/youtube/youtube-likes.service.js +++ b/services/youtube/youtube-likes.service.js @@ -1,6 +1,6 @@ -import Joi from 'joi'; -import {metric} from '../text-formatters.js'; -import {documentation, YouTubeVideoBase} from './youtube-base.js'; +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { documentation, YouTubeVideoBase } from './youtube-base.js' const documentationWithDislikes = ` ${documentation} @@ -71,4 +71,4 @@ export default class YouTubeLikes extends YouTubeVideoBase { } return renderedBadge } -}; +} diff --git a/services/youtube/youtube-likes.tester.js b/services/youtube/youtube-likes.tester.js index e830032e71a2d..8f6f8dc8fcac6 100644 --- a/services/youtube/youtube-likes.tester.js +++ b/services/youtube/youtube-likes.tester.js @@ -1,10 +1,10 @@ -import Joi from 'joi'; -import {createServiceTester} from '../tester.js' -import {noToken} from '../test-helpers.js'; -import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-likes.service.js'; +import Joi from 'joi' +import { createServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import { isMetric } from '../test-validators.js' +import _noYouTubeToken from './youtube-likes.service.js' export const t = await createServiceTester() -const noYouTubeToken = noToken(_noYouTubeToken); +const noYouTubeToken = noToken(_noYouTubeToken) t.create('video like count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-subscribers.service.js b/services/youtube/youtube-subscribers.service.js index 47bbb0e2ecf6d..0c0d1b69aaf70 100644 --- a/services/youtube/youtube-subscribers.service.js +++ b/services/youtube/youtube-subscribers.service.js @@ -1,4 +1,4 @@ -import {documentation, YouTubeChannelBase} from './youtube-base.js'; +import { documentation, YouTubeChannelBase } from './youtube-base.js' export default class YouTubeSubscribes extends YouTubeChannelBase { static route = { @@ -30,4 +30,4 @@ export default class YouTubeSubscribes extends YouTubeChannelBase { id, }) } -}; +} diff --git a/services/youtube/youtube-subscribers.tester.js b/services/youtube/youtube-subscribers.tester.js index 48f5608c5a4fb..d1d1c5175996b 100644 --- a/services/youtube/youtube-subscribers.tester.js +++ b/services/youtube/youtube-subscribers.tester.js @@ -1,9 +1,9 @@ -import {createServiceTester} from '../tester.js' -import {noToken} from '../test-helpers.js'; -import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-subscribers.service.js'; +import { createServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import { isMetric } from '../test-validators.js' +import _noYouTubeToken from './youtube-subscribers.service.js' export const t = await createServiceTester() -const noYouTubeToken = noToken(_noYouTubeToken); +const noYouTubeToken = noToken(_noYouTubeToken) t.create('subscriber count') .skipWhen(noYouTubeToken) diff --git a/services/youtube/youtube-views.service.js b/services/youtube/youtube-views.service.js index d645c35fb65ac..32c2d6afa92ec 100644 --- a/services/youtube/youtube-views.service.js +++ b/services/youtube/youtube-views.service.js @@ -1,4 +1,4 @@ -import {documentation, YouTubeVideoBase} from './youtube-base.js'; +import { documentation, YouTubeVideoBase } from './youtube-base.js' export default class YouTubeViews extends YouTubeVideoBase { static route = { @@ -26,4 +26,4 @@ export default class YouTubeViews extends YouTubeVideoBase { static render({ statistics, id }) { return super.renderSingleStat({ statistics, statisticName: 'view', id }) } -}; +} diff --git a/services/youtube/youtube-views.tester.js b/services/youtube/youtube-views.tester.js index cd69757421e66..f825e71fb46f8 100644 --- a/services/youtube/youtube-views.tester.js +++ b/services/youtube/youtube-views.tester.js @@ -1,9 +1,9 @@ -import {createServiceTester} from '../tester.js' -import {noToken} from '../test-helpers.js'; -import {isMetric} from '../test-validators.js'; -import _noYouTubeToken from './youtube-views.service.js'; +import { createServiceTester } from '../tester.js' +import { noToken } from '../test-helpers.js' +import { isMetric } from '../test-validators.js' +import _noYouTubeToken from './youtube-views.service.js' export const t = await createServiceTester() -const noYouTubeToken = noToken(_noYouTubeToken); +const noYouTubeToken = noToken(_noYouTubeToken) t.create('video view count') .skipWhen(noYouTubeToken) From c461cb1771ffe8fe270d99736df82066d01b9073 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 14:09:38 +0100 Subject: [PATCH 22/46] Ignore LGTM alert --- .../loader-test-fixtures/empty-no-export.fixture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/base-service/loader-test-fixtures/empty-no-export.fixture.js b/core/base-service/loader-test-fixtures/empty-no-export.fixture.js index 3d846dd7f22cf..e4e8dbb5a4129 100644 --- a/core/base-service/loader-test-fixtures/empty-no-export.fixture.js +++ b/core/base-service/loader-test-fixtures/empty-no-export.fixture.js @@ -1,2 +1,2 @@ /* eslint-disable */ -class BadService {} +class BadService {} // lgtm [js/unused-local-variable] From 4b23b298f71ff2c499fcb9734edbb2e3b780776e Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 20 Jun 2021 14:23:27 +0100 Subject: [PATCH 23/46] Move call to readAllStdinSync earlier during initialisation --- core/service-test-runner/cli.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/core/service-test-runner/cli.js b/core/service-test-runner/cli.js index afb3c4dc51058..917c1f859b499 100644 --- a/core/service-test-runner/cli.js +++ b/core/service-test-runner/cli.js @@ -65,6 +65,20 @@ import('../unhandled-rejection.spec.js') const retry = {} retry.count = parseInt(process.env.RETRY_COUNT) || 0 retry.backoff = parseInt(process.env.RETRY_BACKOFF) || 0 + +const args = minimist(process.argv.slice(3)) +const stdinOption = args.stdin +const onlyOption = args.only +let onlyServices +if (stdinOption && onlyOption) { + console.error('Do not use --only with --stdin') +} else if (stdinOption) { + const allStdin = readAllStdinSync().trim() + onlyServices = allStdin ? allStdin.split('\n') : [] +} else if (onlyOption) { + onlyServices = onlyOption.split(',') +} + let baseUrl, server if (process.env.TESTED_SERVER_URL) { baseUrl = process.env.TESTED_SERVER_URL @@ -99,21 +113,6 @@ if (!process.env.TESTED_SERVER_URL) { } } -const args = minimist(process.argv.slice(3)) -const stdinOption = args.stdin -const onlyOption = args.only - -let onlyServices - -if (stdinOption && onlyOption) { - console.error('Do not use --only with --stdin') -} else if (stdinOption) { - const allStdin = readAllStdinSync().trim() - onlyServices = allStdin ? allStdin.split('\n') : [] -} else if (onlyOption) { - onlyServices = onlyOption.split(',') -} - if (typeof onlyServices === 'undefined' || onlyServices.includes('*****')) { console.info('Running all service tests.') } else if (onlyServices.length === 0) { From 15fa8cb3692e06c94fbea437100d21e5068790f4 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sun, 27 Jun 2021 16:05:28 +0100 Subject: [PATCH 24/46] Attempt moving Gatsby files to .cjs extension --- gatsby-browser.js => gatsby-browser.cjs | 0 gatsby-config.js => gatsby-config.cjs | 0 gatsby-node.js => gatsby-node.cjs | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename gatsby-browser.js => gatsby-browser.cjs (100%) rename gatsby-config.js => gatsby-config.cjs (100%) rename gatsby-node.js => gatsby-node.cjs (100%) diff --git a/gatsby-browser.js b/gatsby-browser.cjs similarity index 100% rename from gatsby-browser.js rename to gatsby-browser.cjs diff --git a/gatsby-config.js b/gatsby-config.cjs similarity index 100% rename from gatsby-config.js rename to gatsby-config.cjs diff --git a/gatsby-node.js b/gatsby-node.cjs similarity index 100% rename from gatsby-node.js rename to gatsby-node.cjs From 56328cedcda763ae299cb13a7c9141a07d150f08 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Mon, 28 Jun 2021 08:37:12 +0100 Subject: [PATCH 25/46] Revert "Attempt moving Gatsby files to .cjs extension" This reverts commit 15fa8cb3692e06c94fbea437100d21e5068790f4. --- gatsby-browser.cjs => gatsby-browser.js | 0 gatsby-config.cjs => gatsby-config.js | 0 gatsby-node.cjs => gatsby-node.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename gatsby-browser.cjs => gatsby-browser.js (100%) rename gatsby-config.cjs => gatsby-config.js (100%) rename gatsby-node.cjs => gatsby-node.js (100%) diff --git a/gatsby-browser.cjs b/gatsby-browser.js similarity index 100% rename from gatsby-browser.cjs rename to gatsby-browser.js diff --git a/gatsby-config.cjs b/gatsby-config.js similarity index 100% rename from gatsby-config.cjs rename to gatsby-config.js diff --git a/gatsby-node.cjs b/gatsby-node.js similarity index 100% rename from gatsby-node.cjs rename to gatsby-node.js From 779b7177a5dd6b7895f4ec37e6b98b426d7fc1a8 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 12:27:11 +0100 Subject: [PATCH 26/46] Attempt to fix Gatsby build --- .gitignore | 4 +-- .mocharc-frontend.yml | 1 - .../gatsby-browser.js | 2 +- frontend/gatsby-config.js | 33 ++++++++++++++++++ gatsby-node.js => frontend/gatsby-node.js | 16 +++++---- frontend/mocha-ignore-pngs.js | 5 --- frontend/package.json | 32 +++++++++++++++++ gatsby-config.js | 34 ------------------- package.json | 19 +++-------- 9 files changed, 81 insertions(+), 65 deletions(-) rename gatsby-browser.js => frontend/gatsby-browser.js (84%) create mode 100644 frontend/gatsby-config.js rename gatsby-node.js => frontend/gatsby-node.js (77%) delete mode 100644 frontend/mocha-ignore-pngs.js create mode 100644 frontend/package.json delete mode 100644 gatsby-config.js diff --git a/.gitignore b/.gitignore index 4f1faad2b1729..32f8a9016bb8b 100644 --- a/.gitignore +++ b/.gitignore @@ -104,8 +104,8 @@ service-definitions.yml !/config/local*.template.yml # Gatsby -/.cache -/public +.cache +public # Cypress /cypress/videos/ diff --git a/.mocharc-frontend.yml b/.mocharc-frontend.yml index 8a85e65d938f1..0e076ba900ada 100644 --- a/.mocharc-frontend.yml +++ b/.mocharc-frontend.yml @@ -3,4 +3,3 @@ require: - '@babel/polyfill' - '@babel/register' - mocha-yaml-loader - - frontend/mocha-ignore-pngs diff --git a/gatsby-browser.js b/frontend/gatsby-browser.js similarity index 84% rename from gatsby-browser.js rename to frontend/gatsby-browser.js index 2a973fd4f1d19..0e83d9aa210ed 100644 --- a/gatsby-browser.js +++ b/frontend/gatsby-browser.js @@ -1,4 +1,4 @@ -import redirectLegacyRoutes from './frontend/lib/redirect-legacy-routes' +import redirectLegacyRoutes from './lib/redirect-legacy-routes' // Adapted from https://github.com/gatsbyjs/gatsby/issues/8413 function scrollToElementId(id) { diff --git a/frontend/gatsby-config.js b/frontend/gatsby-config.js new file mode 100644 index 0000000000000..e363cb3cbd01f --- /dev/null +++ b/frontend/gatsby-config.js @@ -0,0 +1,33 @@ +'use strict' + +const path = require('path') + +module.exports = { + siteMetadata: { + title: 'Shields.io: Quality metadata badges for open source projects', + description: + 'We serve fast and scalable informational images as badges for GitHub, Travis CI, Jenkins, WordPress and many more services. Use them to track the state of your projects, or for promotional purposes.', + author: '@shields_io', + }, + plugins: [ + { + resolve: 'gatsby-plugin-page-creator', + options: { + path: path.join(__dirname, 'pages'), + }, + }, + 'gatsby-plugin-react-helmet', + 'gatsby-plugin-catch-links', + 'gatsby-plugin-styled-components', + 'gatsby-plugin-remove-trailing-slashes', + 'gatsby-plugin-typescript', + // This currently is not being used. + // { + // resolve: 'gatsby-source-filesystem', + // options: { + // name: 'static', + // path: `${__dirname}/frontend/static`, + // }, + // }, + ], +} diff --git a/gatsby-node.js b/frontend/gatsby-node.js similarity index 77% rename from gatsby-node.js rename to frontend/gatsby-node.js index 4a4d8db571eda..94a7c3186167e 100644 --- a/gatsby-node.js +++ b/frontend/gatsby-node.js @@ -1,12 +1,14 @@ +'use strict' + /* * Implement Gatsby's Node APIs in this file. * * See: https://www.gatsbyjs.org/docs/node-apis/ */ -import fs from 'fs' -import yaml from 'js-yaml' -import envFlag from 'node-env-flag' +const fs = require('fs') +const yaml = require('js-yaml') +const envFlag = require('node-env-flag') const includeDevPages = envFlag(process.env.INCLUDE_DEV_PAGES, true) @@ -22,13 +24,13 @@ async function createPages({ actions: { createPage } }) { createPage({ path: '/dev/styles', component: require.resolve( - './frontend/components/development/style-page.tsx' + './components/development/style-page.tsx' ), }) createPage({ path: '/dev/logos', component: require.resolve( - './frontend/components/development/logo-page.tsx' + './components/development/logo-page.tsx' ), }) } @@ -37,11 +39,11 @@ async function createPages({ actions: { createPage } }) { const { id } = category createPage({ path: `/category/${id}`, - component: require.resolve('./frontend/components/main.tsx'), + component: require.resolve('./components/main.tsx'), // `context` provided here becomes `props.pageContext` on the page. context: { category }, }) }) } -export { createPages } +module.exports = { createPages } diff --git a/frontend/mocha-ignore-pngs.js b/frontend/mocha-ignore-pngs.js deleted file mode 100644 index cefd367d9fb62..0000000000000 --- a/frontend/mocha-ignore-pngs.js +++ /dev/null @@ -1,5 +0,0 @@ -import requireHacker from 'require-hacker' - -// https://diessi.ca/blog/how-to-exclude-css-images-anything-from-unit-tests/ - -requireHacker.hook('png', () => 'module.exports = ""') diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000000000..deaac236c6b02 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,32 @@ +{ + "name": "badge-frontend", + "version": "0.0.0", + "description": "Shields.io frontend", + "private": true, + "homepage": "http://shields.io", + "license": "CC0-1.0", + "repository": { + "type": "git", + "url": "git+https://github.com/badges/shields.git", + "directory": "frontend" + }, + "scripts": { + "test": "echo 'Run tests from parent dir'; false" + }, + "devDependencies": { + "gatsby": "*" + }, + "babel": { + "plugins": [ + [ + "inline-react-svg", + { + "svgo": false + } + ] + ], + "presets": [ + "babel-preset-gatsby" + ] + } +} diff --git a/gatsby-config.js b/gatsby-config.js deleted file mode 100644 index 9b1c32e04048b..0000000000000 --- a/gatsby-config.js +++ /dev/null @@ -1,34 +0,0 @@ -import path from 'path' -import { fileURLToPath } from 'url' - -export const siteMetadata = { - title: 'Shields.io: Quality metadata badges for open source projects', - description: - 'We serve fast and scalable informational images as badges for GitHub, Travis CI, Jenkins, WordPress and many more services. Use them to track the state of your projects, or for promotional purposes.', - author: '@shields_io', -} -export const plugins = [ - { - resolve: 'gatsby-plugin-page-creator', - options: { - path: path.join( - path.dirname(fileURLToPath(import.meta.url)), - 'frontend', - 'pages' - ), - }, - }, - 'gatsby-plugin-react-helmet', - 'gatsby-plugin-catch-links', - 'gatsby-plugin-styled-components', - 'gatsby-plugin-remove-trailing-slashes', - 'gatsby-plugin-typescript', - // This currently is not being used. - // { - // resolve: 'gatsby-source-filesystem', - // options: { - // name: 'static', - // path: `${path.dirname(fileURLToPath(import.meta.url))}/frontend/static`, - // }, - // }, -] diff --git a/package.json b/package.json index b42fa1a50d8f6..2510e788c784f 100644 --- a/package.json +++ b/package.json @@ -99,9 +99,9 @@ "check-types:frontend": "tsc --noEmit --project .", "depcheck": "check-node-version --node \">= 12.0\"", "prebuild": "run-s --silent depcheck", - "features": "node scripts/export-supported-features-cli.js > supported-features.json", - "defs": "node scripts/export-service-definitions-cli.js > service-definitions.yml", - "build": "run-s defs features && gatsby build", + "features": "node scripts/export-supported-features-cli.js > ./frontend/supported-features.json", + "defs": "node scripts/export-service-definitions-cli.js > ./frontend/service-definitions.yml", + "build": "run-s defs features && cd frontend && gatsby build", "heroku-postbuild": "run-s --silent build", "start:server:prod": "node server", "now-start": "npm run start:server:prod", @@ -111,7 +111,7 @@ "profile:server": "cross-env NODE_CONFIG_ENV=development node --prof server 8080", "benchmark:badge": "cross-env NODE_CONFIG_ENV=test node scripts/benchmark-performance.js --iterations 10100 | node scripts/capture-timings.js --warmup-iterations 100", "prestart": "run-s --silent depcheck defs features", - "start": "concurrently --names server,frontend \"npm run start:server\" \"cross-env GATSBY_BASE_URL=http://localhost:8080 gatsby develop --port 3000\"", + "start": "concurrently --names server,frontend \"npm run start:server\" \"cd frontend && cross-env GATSBY_BASE_URL=http://localhost:8080 gatsby develop --port 3000\"", "e2e": "start-server-and-test start http://localhost:3000 test:e2e", "e2e-on-build": "cross-env CYPRESS_baseUrl=http://localhost:8080 start-server-and-test start:server:e2e-on-build http://localhost:8080 test:e2e", "badge": "cross-env NODE_CONFIG_ENV=test TRACE_SERVICES=true node scripts/badge-cli.js", @@ -246,17 +246,6 @@ }, "type": "module", "babel": { - "plugins": [ - [ - "inline-react-svg", - { - "svgo": false - } - ] - ], - "presets": [ - "babel-preset-gatsby" - ], "env": { "test": { "plugins": [ From a6fe22ee901df10f66b10c1b4334803a0e0a985c Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 12:36:52 +0100 Subject: [PATCH 27/46] Exclude Prettier from Gatsby folders --- .prettierignore | 4 ++-- frontend/gatsby-node.js | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.prettierignore b/.prettierignore index 66e7a5e5bf2eb..9f913cee41ec1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,10 +2,10 @@ package.json package-lock.json /__snapshots__ /.next -/.cache +.cache /api-docs /build -/public +public /coverage private/*.json /.nyc_output diff --git a/frontend/gatsby-node.js b/frontend/gatsby-node.js index 94a7c3186167e..1d90adebb709e 100644 --- a/frontend/gatsby-node.js +++ b/frontend/gatsby-node.js @@ -23,15 +23,11 @@ async function createPages({ actions: { createPage } }) { if (includeDevPages) { createPage({ path: '/dev/styles', - component: require.resolve( - './components/development/style-page.tsx' - ), + component: require.resolve('./components/development/style-page.tsx'), }) createPage({ path: '/dev/logos', - component: require.resolve( - './components/development/logo-page.tsx' - ), + component: require.resolve('./components/development/logo-page.tsx'), }) } From 7d1393c99827506d6a9e2810c77d76571e28bcd2 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 12:39:46 +0100 Subject: [PATCH 28/46] Exclude ESLint from Gatsby folders --- .eslintignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 3024b09851685..170a29b892244 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,6 +2,6 @@ /build /coverage /__snapshots__ -/public +public badge-maker/node_modules/ !.github/ From 0b8ac0df145a00ac59e338fc407768d3a8d3f022 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 12:40:08 +0100 Subject: [PATCH 29/46] Remove now redundant nodemonConfig exclusion --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 2510e788c784f..8c04391b86799 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,6 @@ "**/*.tester.js", "**/*.integration.js", "frontend/", - "public/", "build/", "cypress/" ] From 4fc30670c6e4e000d663325372233a6f769e41f4 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 13:30:43 +0100 Subject: [PATCH 30/46] Switch Danger file back to CommonJS --- dangerfile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dangerfile.js b/dangerfile.js index 405a3faab8880..f59f587886e72 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -1,3 +1,5 @@ +'use strict' + // Have you identified a contributing guideline that should be included here? // Please open a pull request! // @@ -8,8 +10,8 @@ // To test changes locally: // DANGER_GITHUB_API_TOKEN=your-github-api-token npm run danger -- pr https://github.com/badges/shields/pull/2665 -import { danger, fail, message, warn } from 'danger' -import noTestShortcuts from 'danger-plugin-no-test-shortcuts' +const { danger, fail, message, warn } = require('danger') +const { default: noTestShortcuts } = require('danger-plugin-no-test-shortcuts') const { fileMatch } = danger.git const documentation = fileMatch( From 43ab8e50b25c9afd0a337acca5c19197289f191c Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 13:35:56 +0100 Subject: [PATCH 31/46] Fix frontend tests --- frontend/lib/service-definitions/index.ts | 2 +- frontend/lib/supported-features.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/lib/service-definitions/index.ts b/frontend/lib/service-definitions/index.ts index e358139614a91..31fe5ed8b4250 100644 --- a/frontend/lib/service-definitions/index.ts +++ b/frontend/lib/service-definitions/index.ts @@ -1,6 +1,6 @@ import groupBy from 'lodash.groupby' // load using js-yaml-loader -import definitions from '../../../service-definitions.yml' +import definitions from '../../service-definitions.yml' export interface Category { id: string diff --git a/frontend/lib/supported-features.ts b/frontend/lib/supported-features.ts index 65ef3d3dc93f8..275b5cd88662a 100644 --- a/frontend/lib/supported-features.ts +++ b/frontend/lib/supported-features.ts @@ -1,4 +1,4 @@ -import supportedFeatures from '../../supported-features.json' +import supportedFeatures from '../supported-features.json' export const shieldsLogos = supportedFeatures.shieldsLogos as string[] export const simpleIcons = supportedFeatures.simpleIcons as string[] From 528044f73b071460e2ea0943e7b58dd9c5d2825c Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 14:00:36 +0100 Subject: [PATCH 32/46] Fix newly added services --- services/maven-central/maven-central.service.js | 1 - services/maven-metadata/maven-metadata.js | 4 +--- services/npms-io/npms-io-score.service.js | 10 ++++------ services/npms-io/npms-io-score.tester.js | 7 +++---- .../weblate/weblate-component-license.service.js | 10 ++++------ .../weblate/weblate-component-license.tester.js | 5 ++--- services/weblate/weblate-entity-count.service.js | 14 ++++++-------- services/weblate/weblate-entity-count.tester.js | 11 ++++------- ...eblate-project-translated-percentage.service.js | 14 +++++--------- ...weblate-project-translated-percentage.tester.js | 8 +++----- .../weblate/weblate-user-statistics.service.js | 14 ++++++-------- services/weblate/weblate-user-statistics.tester.js | 11 ++++------- 12 files changed, 42 insertions(+), 67 deletions(-) diff --git a/services/maven-central/maven-central.service.js b/services/maven-central/maven-central.service.js index 5b448f6cf0379..feccfe07d39a1 100644 --- a/services/maven-central/maven-central.service.js +++ b/services/maven-central/maven-central.service.js @@ -5,7 +5,6 @@ export default redirector({ category: 'version', isDeprecated: false, route: { - base: 'maven-central/v', pattern: ':groupId/:artifactId/:versionPrefix?', }, diff --git a/services/maven-metadata/maven-metadata.js b/services/maven-metadata/maven-metadata.js index f96ba9a5a83ad..b7f9865ea29cb 100644 --- a/services/maven-metadata/maven-metadata.js +++ b/services/maven-metadata/maven-metadata.js @@ -2,9 +2,7 @@ // the file contains common constants for badges uses maven-metadata -module.exports = {} - -module.exports.documentation = ` +export const documentation = `

versionPrefix and versionSuffix allow narrowing down the range of versions the badge will take into account, diff --git a/services/npms-io/npms-io-score.service.js b/services/npms-io/npms-io-score.service.js index 79adf48816e9b..23f54ac95eb51 100644 --- a/services/npms-io/npms-io-score.service.js +++ b/services/npms-io/npms-io-score.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { coveragePercentage } = require('../color-formatters') +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { coveragePercentage } from '../color-formatters.js' // https://api-docs.npms.io/#api-Package-GetPackageInfo const numberSchema = Joi.number().min(0).max(1).required() @@ -19,7 +17,7 @@ const responseSchema = Joi.object({ const keywords = ['node', 'npm score'] -module.exports = class NpmsIOScore extends BaseJsonService { +export default class NpmsIOScore extends BaseJsonService { static category = 'analysis' static route = { diff --git a/services/npms-io/npms-io-score.tester.js b/services/npms-io/npms-io-score.tester.js index 1c1769ed21f59..855efceefad30 100644 --- a/services/npms-io/npms-io-score.tester.js +++ b/services/npms-io/npms-io-score.tester.js @@ -1,7 +1,6 @@ -'use strict' - -const { isPercentage } = require('../test-validators') -const t = (module.exports = require('../tester').createServiceTester()) +import { createServiceTester } from '../tester.js' +import { isPercentage } from '../test-validators.js' +export const t = await createServiceTester() t.create('should show final score').get('/final-score/vue.json').expectBadge({ label: 'score', diff --git a/services/weblate/weblate-component-license.service.js b/services/weblate/weblate-component-license.service.js index 22e1038979d7b..bd1ce1b3fef8a 100644 --- a/services/weblate/weblate-component-license.service.js +++ b/services/weblate/weblate-component-license.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { optionalUrl } = require('../validators') +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { optionalUrl } from '../validators.js' const schema = Joi.object({ license: Joi.string().required(), @@ -15,7 +13,7 @@ const queryParamSchema = Joi.object({ /** * This badge displays the license of a component on a Weblate instance. */ -module.exports = class WeblateComponentLicense extends BaseJsonService { +export default class WeblateComponentLicense extends BaseJsonService { static category = 'license' static route = { base: 'weblate/license', diff --git a/services/weblate/weblate-component-license.tester.js b/services/weblate/weblate-component-license.tester.js index 60ec6c726f032..844aa362c48f2 100644 --- a/services/weblate/weblate-component-license.tester.js +++ b/services/weblate/weblate-component-license.tester.js @@ -1,6 +1,5 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) +import { createServiceTester } from '../tester.js' +export const t = await createServiceTester() t.create('License') .get('/godot-engine/godot.json?server=https://hosted.weblate.org') diff --git a/services/weblate/weblate-entity-count.service.js b/services/weblate/weblate-entity-count.service.js index 3b04ea3f0494b..8080f97d94c6c 100644 --- a/services/weblate/weblate-entity-count.service.js +++ b/services/weblate/weblate-entity-count.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const camelcase = require('camelcase') -const { BaseJsonService } = require('..') -const { nonNegativeInteger, optionalUrl } = require('../validators') -const { metric } = require('../text-formatters') +import Joi from 'joi' +import camelcase from 'camelcase' +import { BaseJsonService } from '../index.js' +import { nonNegativeInteger, optionalUrl } from '../validators.js' +import { metric } from '../text-formatters.js' const schema = Joi.object({ count: nonNegativeInteger, @@ -71,4 +69,4 @@ const entityCounts = [ { entityName: 'users', exampleValue: 33058 }, ].map(WeblateEntityCountFactory) -module.exports = [...entityCounts] +export default [...entityCounts] diff --git a/services/weblate/weblate-entity-count.tester.js b/services/weblate/weblate-entity-count.tester.js index a78a5bfc8def7..4e5d183aff863 100644 --- a/services/weblate/weblate-entity-count.tester.js +++ b/services/weblate/weblate-entity-count.tester.js @@ -1,13 +1,10 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isMetric } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ +import { ServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' +export const t = new ServiceTester({ id: 'WeblateEntity', title: 'Weblate Entity', pathPrefix: '/weblate', -})) +}) t.create('Components') .get('/components.json?server=https://hosted.weblate.org') diff --git a/services/weblate/weblate-project-translated-percentage.service.js b/services/weblate/weblate-project-translated-percentage.service.js index d5bf6bbbfb597..87e073514f4d1 100644 --- a/services/weblate/weblate-project-translated-percentage.service.js +++ b/services/weblate/weblate-project-translated-percentage.service.js @@ -1,9 +1,7 @@ -'use strict' - -const Joi = require('joi') -const { BaseJsonService } = require('..') -const { optionalUrl } = require('../validators') -const { colorScale } = require('../color-formatters') +import Joi from 'joi' +import { BaseJsonService } from '../index.js' +import { optionalUrl } from '../validators.js' +import { colorScale } from '../color-formatters.js' const schema = Joi.object({ translated_percent: Joi.number().required(), @@ -17,9 +15,7 @@ const queryParamSchema = Joi.object({ * This badge displays the percentage of strings translated on a project on a * Weblate instance. */ -module.exports = class WeblateProjectTranslatedPercentage extends ( - BaseJsonService -) { +export default class WeblateProjectTranslatedPercentage extends BaseJsonService { static category = 'other' static route = { base: 'weblate', pattern: ':project', queryParamSchema } diff --git a/services/weblate/weblate-project-translated-percentage.tester.js b/services/weblate/weblate-project-translated-percentage.tester.js index 52a8ba67d167d..20f9368ac333b 100644 --- a/services/weblate/weblate-project-translated-percentage.tester.js +++ b/services/weblate/weblate-project-translated-percentage.tester.js @@ -1,8 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) - -const { isPercentage } = require('../test-validators') +import { createServiceTester } from '../tester.js' +import { isPercentage } from '../test-validators.js' +export const t = await createServiceTester() t.create('License') .get('/godot-engine.json?server=https://hosted.weblate.org') diff --git a/services/weblate/weblate-user-statistics.service.js b/services/weblate/weblate-user-statistics.service.js index e61cdd881494d..467b2df76dcc8 100644 --- a/services/weblate/weblate-user-statistics.service.js +++ b/services/weblate/weblate-user-statistics.service.js @@ -1,10 +1,8 @@ -'use strict' - -const Joi = require('joi') -const camelcase = require('camelcase') -const { BaseJsonService } = require('..') -const { nonNegativeInteger, optionalUrl } = require('../validators') -const { metric } = require('../text-formatters') +import Joi from 'joi' +import camelcase from 'camelcase' +import { BaseJsonService } from '../index.js' +import { nonNegativeInteger, optionalUrl } from '../validators.js' +import { metric } from '../text-formatters.js' const schema = Joi.object({ translated: nonNegativeInteger, @@ -87,4 +85,4 @@ const userStatistics = [ { statisticName: 'languages', property: 'languages', exampleValue: 1 }, ].map(WeblateUserStatisticFactory) -module.exports = [...userStatistics] +export default [...userStatistics] diff --git a/services/weblate/weblate-user-statistics.tester.js b/services/weblate/weblate-user-statistics.tester.js index 42934b072fd71..1e0848fbd723a 100644 --- a/services/weblate/weblate-user-statistics.tester.js +++ b/services/weblate/weblate-user-statistics.tester.js @@ -1,13 +1,10 @@ -'use strict' - -const { ServiceTester } = require('../tester') -const { isMetric } = require('../test-validators') - -const t = (module.exports = new ServiceTester({ +import { ServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' +export const t = new ServiceTester({ id: 'WeblateUserStatistic', title: 'Weblate User Statistic', pathPrefix: '/weblate', -})) +}) t.create('Translations') .get('/user/nijel/translations.json?server=https://hosted.weblate.org') From 3e837bfd3300a29005ed88bb24acd635e3b66b01 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Sat, 3 Jul 2021 14:15:45 +0100 Subject: [PATCH 33/46] Attempt fixing e2e tests --- scripts/export-service-definitions-cli.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/export-service-definitions-cli.js b/scripts/export-service-definitions-cli.js index bfe244ce21289..e019bbcd175cb 100644 --- a/scripts/export-service-definitions-cli.js +++ b/scripts/export-service-definitions-cli.js @@ -1,10 +1,11 @@ import yaml from 'js-yaml' import { collectDefinitions } from '../core/base-service/loader.js' +;(async () => { + const definitions = await collectDefinitions() -const definitions = await collectDefinitions() + // Omit undefined + // https://github.com/nodeca/js-yaml/issues/356#issuecomment-312430599 + const cleaned = JSON.parse(JSON.stringify(definitions)) -// Omit undefined -// https://github.com/nodeca/js-yaml/issues/356#issuecomment-312430599 -const cleaned = JSON.parse(JSON.stringify(definitions)) - -process.stdout.write(yaml.dump(cleaned, { flowLevel: 5 })) + process.stdout.write(yaml.dump(cleaned, { flowLevel: 5 })) +})() From 078db820dca8b2b6e58667c35ee853a9279d73ad Mon Sep 17 00:00:00 2001 From: PyvesB Date: Mon, 5 Jul 2021 21:52:18 +0100 Subject: [PATCH 34/46] Fix URL import --- core/badge-urls/make-badge-url.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/badge-urls/make-badge-url.js b/core/badge-urls/make-badge-url.js index 74ebeab099e6b..f4a99fde616e6 100644 --- a/core/badge-urls/make-badge-url.js +++ b/core/badge-urls/make-badge-url.js @@ -1,4 +1,4 @@ -import { URL } from 'url' +import url from 'url' import queryString from 'query-string' import { compile } from 'path-to-regexp' @@ -145,8 +145,8 @@ function dynamicBadgeUrl({ function rasterRedirectUrl({ rasterUrl }, badgeUrl) { // Ensure we're always using the `rasterUrl` by using just the path from // the request URL. - const { pathname, search } = new URL(badgeUrl, 'https://bogus.test') - const result = new URL(pathname, rasterUrl) + const { pathname, search } = new url.URL(badgeUrl, 'https://bogus.test') + const result = new url.URL(pathname, rasterUrl) result.search = search return result } From d72301df11cc9c11fadeec383bd67ca5f17e1522 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Mon, 5 Jul 2021 22:07:11 +0100 Subject: [PATCH 35/46] Attempt to point Heroku to the right directory --- static.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 static.json diff --git a/static.json b/static.json new file mode 100644 index 0000000000000..e689a1595d8be --- /dev/null +++ b/static.json @@ -0,0 +1,3 @@ +{ + "root": "frontend/" +} From f381fcb4dd5a68ded8522e3dfbcea1f65ede4b29 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Mon, 5 Jul 2021 22:13:39 +0100 Subject: [PATCH 36/46] Revert "Attempt to point Heroku to the right directory" This reverts commit d72301df11cc9c11fadeec383bd67ca5f17e1522. --- static.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 static.json diff --git a/static.json b/static.json deleted file mode 100644 index e689a1595d8be..0000000000000 --- a/static.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "root": "frontend/" -} From f45e48c0523d2e9cee4bab20e925362afd839a70 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Tue, 6 Jul 2021 09:35:53 +0100 Subject: [PATCH 37/46] Move generated Gatsby files one level up for Heroku buildpack --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 15299af2aad0b..7cf323f9e99b7 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "features": "node scripts/export-supported-features-cli.js > ./frontend/supported-features.json", "defs": "node scripts/export-service-definitions-cli.js > ./frontend/service-definitions.yml", "build": "run-s defs features && cd frontend && gatsby build", - "heroku-postbuild": "run-s --silent build", + "heroku-postbuild": "run-s --silent build && mv frontend/public .", "start:server:prod": "node server", "now-start": "npm run start:server:prod", "start:server:e2e-on-build": "node server 8080", From fc9dc78c5531a5491e2c74db5a7128c4e8330fda Mon Sep 17 00:00:00 2001 From: PyvesB Date: Tue, 6 Jul 2021 18:42:30 +0100 Subject: [PATCH 38/46] Error for e2e test highly unhelpful, use advanced debugging technique --- core/base-service/loader.js | 7 +++++++ scripts/export-service-definitions-cli.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/core/base-service/loader.js b/core/base-service/loader.js index cf499eca1560f..8d907f3c0bf6e 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -1,10 +1,17 @@ import path from 'path' +console.error("LOG 7") import { fileURLToPath } from 'url' +console.error("LOG 8") import glob from 'glob' +console.error("LOG 9") import countBy from 'lodash.countby' +console.error("LOG 10") import categories from '../../services/categories.js' +console.error("LOG 11") import BaseService from './base.js' +console.error("LOG 12") import { assertValidServiceDefinitionExport } from './service-definitions.js' +console.error("LOG 13") const serviceDir = path.join( path.dirname(fileURLToPath(import.meta.url)), diff --git a/scripts/export-service-definitions-cli.js b/scripts/export-service-definitions-cli.js index e019bbcd175cb..5e5b22ab372bd 100644 --- a/scripts/export-service-definitions-cli.js +++ b/scripts/export-service-definitions-cli.js @@ -1,11 +1,17 @@ +console.error("LOG 1") import yaml from 'js-yaml' +console.error("LOG 2") import { collectDefinitions } from '../core/base-service/loader.js' +console.error("LOG 3") ;(async () => { + console.error("LOG 4") const definitions = await collectDefinitions() + console.error("LOG 5") // Omit undefined // https://github.com/nodeca/js-yaml/issues/356#issuecomment-312430599 const cleaned = JSON.parse(JSON.stringify(definitions)) + console.error("LOG 6") process.stdout.write(yaml.dump(cleaned, { flowLevel: 5 })) })() From 55217f4482c02d82f08b69c43b6173391898cbcd Mon Sep 17 00:00:00 2001 From: PyvesB Date: Tue, 6 Jul 2021 18:53:18 +0100 Subject: [PATCH 39/46] Revert "Error for e2e test highly unhelpful, use advanced debugging technique" This reverts commit fc9dc78c5531a5491e2c74db5a7128c4e8330fda. --- core/base-service/loader.js | 7 ------- scripts/export-service-definitions-cli.js | 6 ------ 2 files changed, 13 deletions(-) diff --git a/core/base-service/loader.js b/core/base-service/loader.js index 8d907f3c0bf6e..cf499eca1560f 100644 --- a/core/base-service/loader.js +++ b/core/base-service/loader.js @@ -1,17 +1,10 @@ import path from 'path' -console.error("LOG 7") import { fileURLToPath } from 'url' -console.error("LOG 8") import glob from 'glob' -console.error("LOG 9") import countBy from 'lodash.countby' -console.error("LOG 10") import categories from '../../services/categories.js' -console.error("LOG 11") import BaseService from './base.js' -console.error("LOG 12") import { assertValidServiceDefinitionExport } from './service-definitions.js' -console.error("LOG 13") const serviceDir = path.join( path.dirname(fileURLToPath(import.meta.url)), diff --git a/scripts/export-service-definitions-cli.js b/scripts/export-service-definitions-cli.js index 5e5b22ab372bd..e019bbcd175cb 100644 --- a/scripts/export-service-definitions-cli.js +++ b/scripts/export-service-definitions-cli.js @@ -1,17 +1,11 @@ -console.error("LOG 1") import yaml from 'js-yaml' -console.error("LOG 2") import { collectDefinitions } from '../core/base-service/loader.js' -console.error("LOG 3") ;(async () => { - console.error("LOG 4") const definitions = await collectDefinitions() - console.error("LOG 5") // Omit undefined // https://github.com/nodeca/js-yaml/issues/356#issuecomment-312430599 const cleaned = JSON.parse(JSON.stringify(definitions)) - console.error("LOG 6") process.stdout.write(yaml.dump(cleaned, { flowLevel: 5 })) })() From 98c56d0a0b58b00be8cc2a2a75db5a362b3dea67 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Tue, 6 Jul 2021 18:55:51 +0100 Subject: [PATCH 40/46] Update to more recent Cypress image --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ecdeec47a8a4..0c4a2f6f8683b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -236,7 +236,7 @@ jobs: e2e: docker: - - image: cypress/base:14 + - image: cypress/base:14.16.0 steps: - checkout From f82abaf930c92d3634fa0b6e42af44a0949b6862 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Wed, 7 Jul 2021 08:05:06 +0100 Subject: [PATCH 41/46] Move frontend files from within build script --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index da8cef87580f9..63c79904e4ba4 100644 --- a/package.json +++ b/package.json @@ -101,8 +101,8 @@ "prebuild": "run-s --silent depcheck", "features": "node scripts/export-supported-features-cli.js > ./frontend/supported-features.json", "defs": "node scripts/export-service-definitions-cli.js > ./frontend/service-definitions.yml", - "build": "run-s defs features && cd frontend && gatsby build", - "heroku-postbuild": "run-s --silent build && mv frontend/public .", + "build": "run-s defs features && cd frontend && gatsby build && mv public ..", + "heroku-postbuild": "run-s --silent build", "start:server:prod": "node server", "now-start": "npm run start:server:prod", "start:server:e2e-on-build": "node server 8080", From 9c82e01b12b1151a8238c9b4361bd5ffa1ef867e Mon Sep 17 00:00:00 2001 From: PyvesB Date: Wed, 7 Jul 2021 08:13:58 +0100 Subject: [PATCH 42/46] Remove no longer needed try/catch block --- server.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/server.js b/server.js index 661620b286f60..ea2caef701b03 100644 --- a/server.js +++ b/server.js @@ -58,9 +58,4 @@ if (fs.existsSync(legacySecretsPath)) { } export const server = new Server(config) -try { - await server.start() -} catch (e) { - console.error(e) - process.exit(1) -} +await server.start() From 9697ac1a31237498b260691fe2b2bfac55dba7e6 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Thu, 8 Jul 2021 19:19:07 +0100 Subject: [PATCH 43/46] Narrow down Gatsby .gitignore --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 32f8a9016bb8b..771e46a75d298 100644 --- a/.gitignore +++ b/.gitignore @@ -104,8 +104,9 @@ service-definitions.yml !/config/local*.template.yml # Gatsby -.cache -public +/frontend/.cache +/frontend/public +/public # Cypress /cypress/videos/ From b465b835d7fafe5f31c8c5db77baba1ff84548e9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves B Date: Thu, 8 Jul 2021 21:27:15 +0100 Subject: [PATCH 44/46] Document unusual import style Co-authored-by: Paul Melnikow --- core/badge-urls/make-badge-url.js | 1 + 1 file changed, 1 insertion(+) diff --git a/core/badge-urls/make-badge-url.js b/core/badge-urls/make-badge-url.js index f4a99fde616e6..82e3f5fa25124 100644 --- a/core/badge-urls/make-badge-url.js +++ b/core/badge-urls/make-badge-url.js @@ -1,3 +1,4 @@ +// Avoid "Attempted import error: 'URL' is not exported from 'url'" in frontend. import url from 'url' import queryString from 'query-string' import { compile } from 'path-to-regexp' From 813cbc3b542e4b1940f1b7e43539bc251fe98660 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Thu, 8 Jul 2021 21:32:43 +0100 Subject: [PATCH 45/46] Migrate new Wikiapiary badge --- services/wikiapiary/wikiapiary-installs.service.js | 10 ++++------ services/wikiapiary/wikiapiary-installs.tester.js | 7 +++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/services/wikiapiary/wikiapiary-installs.service.js b/services/wikiapiary/wikiapiary-installs.service.js index 3aa11e110da2a..222e16c4c875a 100644 --- a/services/wikiapiary/wikiapiary-installs.service.js +++ b/services/wikiapiary/wikiapiary-installs.service.js @@ -1,8 +1,6 @@ -'use strict' - -const Joi = require('joi') -const { metric } = require('../text-formatters') -const { BaseJsonService, NotFound } = require('..') +import Joi from 'joi' +import { metric } from '../text-formatters.js' +import { BaseJsonService, NotFound } from '../index.js' const documentation = `

@@ -48,7 +46,7 @@ const schema = Joi.object({ * * {@link https://www.mediawiki.org/wiki/Manual:Extensions MediaWiki Extensions Manual} */ -module.exports = class WikiapiaryInstalls extends BaseJsonService { +export default class WikiapiaryInstalls extends BaseJsonService { static category = 'downloads' static route = { base: 'wikiapiary', diff --git a/services/wikiapiary/wikiapiary-installs.tester.js b/services/wikiapiary/wikiapiary-installs.tester.js index fee38c87645f1..878ec756dd163 100644 --- a/services/wikiapiary/wikiapiary-installs.tester.js +++ b/services/wikiapiary/wikiapiary-installs.tester.js @@ -1,7 +1,6 @@ -'use strict' - -const t = (module.exports = require('../tester').createServiceTester()) -const { isMetric } = require('../test-validators') +import { createServiceTester } from '../tester.js' +import { isMetric } from '../test-validators.js' +export const t = await createServiceTester() t.create('Extension') .get('/extension/installs/ParserFunctions.json') From bae618b9a4f2d3f6b982573284b3b38f77ebe658 Mon Sep 17 00:00:00 2001 From: PyvesB Date: Fri, 9 Jul 2021 08:36:36 +0100 Subject: [PATCH 46/46] Remove require-hacker dependency --- package-lock.json | 69 ----------------------------------------------- package.json | 1 - 2 files changed, 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3f90cbf780233..5866174a9326f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -140,7 +140,6 @@ "react-select": "^4.3.1", "read-all-stdin-sync": "^1.0.5", "redis-server": "^1.2.2", - "require-hacker": "^3.0.1", "rimraf": "^3.0.2", "sazerac": "^2.0.0", "sinon": "^11.1.1", @@ -5955,30 +5954,6 @@ "core-js": "^3.0.0" } }, - "node_modules/babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true, - "dependencies": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "node_modules/babel-runtime/node_modules/core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "deprecated": "core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.", - "dev": true, - "hasInstallScript": true - }, - "node_modules/babel-runtime/node_modules/regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true - }, "node_modules/backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", @@ -25432,16 +25407,6 @@ "node": ">=0.10.0" } }, - "node_modules/require-hacker": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/require-hacker/-/require-hacker-3.0.1.tgz", - "integrity": "sha1-CHm+Bn/PBnUwZlvM5MiayBqHBHc=", - "dev": true, - "dependencies": { - "babel-runtime": "^6.6.1", - "colors": "^1.1.2" - } - }, "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -36340,30 +36305,6 @@ "gatsby-legacy-polyfills": "^1.8.0" } }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - }, - "dependencies": { - "core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "dev": true - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true - } - } - }, "backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", @@ -51647,16 +51588,6 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, - "require-hacker": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/require-hacker/-/require-hacker-3.0.1.tgz", - "integrity": "sha1-CHm+Bn/PBnUwZlvM5MiayBqHBHc=", - "dev": true, - "requires": { - "babel-runtime": "^6.6.1", - "colors": "^1.1.2" - } - }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", diff --git a/package.json b/package.json index 63c79904e4ba4..234168c42ab93 100644 --- a/package.json +++ b/package.json @@ -227,7 +227,6 @@ "react-select": "^4.3.1", "read-all-stdin-sync": "^1.0.5", "redis-server": "^1.2.2", - "require-hacker": "^3.0.1", "rimraf": "^3.0.2", "sazerac": "^2.0.0", "sinon": "^11.1.1",