diff --git a/biome.json b/biome.json index df511a958c..6b9afe61b7 100644 --- a/biome.json +++ b/biome.json @@ -8,10 +8,12 @@ "rules": { "recommended": true, "correctness": { - "useExhaustiveDependencies": "off" + "useExhaustiveDependencies": "off", + "useJsxKeyInIterable": "off" }, "style": { - "noNonNullAssertion": "off" + "noNonNullAssertion": "off", + "useNodejsImportProtocol": "off" }, "suspicious": { "noExplicitAny": "off", diff --git a/frontend/package.json b/frontend/package.json index e33653ab2f..448e51d3c9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,11 +15,6 @@ }, "dependencies": { "@apollo/client": "^3.7.3", - "@babel/plugin-transform-react-jsx": "^7.12.1", - "@babel/plugin-transform-react-pure-annotations": "^7.12.1", - "@emotion/babel-plugin-jsx-pragmatic": "^0.1.5", - "@emotion/core": "^10.0.35", - "@emotion/react": ">=11.0.0 <12.0.0", "@graphql-codegen/add": "^5.0.2", "@graphql-codegen/cli": "^2.11.3", "@graphql-codegen/fragment-matcher": "^3.3.0", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index fe0695c2bf..32dff47afc 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -11,21 +11,6 @@ importers: '@apollo/client': specifier: ^3.7.3 version: 3.10.4(@types/react@17.0.80)(graphql-ws@5.12.1(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@babel/plugin-transform-react-jsx': - specifier: ^7.12.1 - version: 7.24.6(@babel/core@7.24.6) - '@babel/plugin-transform-react-pure-annotations': - specifier: ^7.12.1 - version: 7.24.6(@babel/core@7.24.6) - '@emotion/babel-plugin-jsx-pragmatic': - specifier: ^0.1.5 - version: 0.1.5(@babel/core@7.24.6) - '@emotion/core': - specifier: ^10.0.35 - version: 10.3.1(react@18.3.1) - '@emotion/react': - specifier: '>=11.0.0 <12.0.0' - version: 11.11.4(@types/react@17.0.80)(react@18.3.1) '@graphql-codegen/add': specifier: ^5.0.2 version: 5.0.2(graphql@16.8.1) @@ -582,12 +567,6 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-react-pure-annotations@7.24.6': - resolution: {integrity: sha512-0HoDQlFJJkXRyV2N+xOpUETbKHcouSwijRQbKWVtxsPoq5bbB30qZag9/pSc5xcWVYjTHlLsBsY+hZDnzQTPNw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-shorthand-properties@7.24.6': resolution: {integrity: sha512-xnEUvHSMr9eOWS5Al2YPfc32ten7CXdH7Zwyyk7IqITg4nX61oHj+GxpNvl+y5JHjfN3KXE2IV55wAWowBYMVw==} engines: {node: '>=6.9.0'} @@ -698,31 +677,12 @@ packages: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} - '@emotion/babel-plugin-jsx-pragmatic@0.1.5': - resolution: {integrity: sha512-y+3AJ0SItMDaAgGPVkQBC/S/BaqaPACkQ6MyCI2CUlrjTxKttTVfD3TMtcs7vLEcLxqzZ1xiG0vzwCXjhopawQ==} - peerDependencies: - '@babel/core': ^7.0.0 - '@emotion/babel-plugin@11.11.0': resolution: {integrity: sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==} - '@emotion/cache@10.0.29': - resolution: {integrity: sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ==} - '@emotion/cache@11.11.0': resolution: {integrity: sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==} - '@emotion/core@10.3.1': - resolution: {integrity: sha512-447aUEjPIm0MnE6QYIaFz9VQOHSXf4Iu6EWOIqq11EAPqinkSZmfymPTmlOE3QjLv846lH4JVZBUOtwGbuQoww==} - peerDependencies: - react: '>=16.3.0' - - '@emotion/css@10.0.27': - resolution: {integrity: sha512-6wZjsvYeBhyZQYNrGoR5yPMYbMBNEnanDrqmsqS1mzDm1cOTu12shvl2j4QHNS36UaTE0USIJawCH9C8oW34Zw==} - - '@emotion/hash@0.8.0': - resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==} - '@emotion/hash@0.9.1': resolution: {integrity: sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ==} @@ -744,24 +704,12 @@ packages: '@types/react': optional: true - '@emotion/serialize@0.11.16': - resolution: {integrity: sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==} - '@emotion/serialize@1.1.4': resolution: {integrity: sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ==} - '@emotion/sheet@0.9.4': - resolution: {integrity: sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA==} - '@emotion/sheet@1.2.2': resolution: {integrity: sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA==} - '@emotion/stylis@0.8.5': - resolution: {integrity: sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==} - - '@emotion/unitless@0.7.5': - resolution: {integrity: sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==} - '@emotion/unitless@0.8.1': resolution: {integrity: sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==} @@ -770,15 +718,9 @@ packages: peerDependencies: react: '>=16.8.0' - '@emotion/utils@0.11.3': - resolution: {integrity: sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw==} - '@emotion/utils@1.2.1': resolution: {integrity: sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==} - '@emotion/weak-memoize@0.2.5': - resolution: {integrity: sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==} - '@emotion/weak-memoize@0.3.1': resolution: {integrity: sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==} @@ -1946,9 +1888,6 @@ packages: peerDependencies: '@babel/core': ^7.8.0 - babel-plugin-emotion@10.2.2: - resolution: {integrity: sha512-SMSkGoqTbTyUTDeuVuPIWifPdUGkTk1Kf9BWRiXIOIcuyMfsdp2EjeiiFvOzX8NOBvEh/ypKYvUh2rkgAJMCLA==} - babel-plugin-istanbul@6.1.1: resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} engines: {node: '>=8'} @@ -1957,16 +1896,10 @@ packages: resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - babel-plugin-macros@2.8.0: - resolution: {integrity: sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==} - babel-plugin-macros@3.1.0: resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} engines: {node: '>=10', npm: '>=6'} - babel-plugin-syntax-jsx@6.18.0: - resolution: {integrity: sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==} - babel-plugin-syntax-trailing-function-commas@7.0.0-beta.0: resolution: {integrity: sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ==} @@ -2221,10 +2154,6 @@ packages: ts-node: '>=10' typescript: '>=4' - cosmiconfig@6.0.0: - resolution: {integrity: sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==} - engines: {node: '>=8'} - cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} @@ -2283,9 +2212,6 @@ packages: engines: {node: '>=4'} hasBin: true - csstype@2.6.21: - resolution: {integrity: sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==} - csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} @@ -5422,12 +5348,6 @@ snapshots: '@babel/plugin-syntax-jsx': 7.24.6(@babel/core@7.24.6) '@babel/types': 7.24.6 - '@babel/plugin-transform-react-pure-annotations@7.24.6(@babel/core@7.24.6)': - dependencies: - '@babel/core': 7.24.6 - '@babel/helper-annotate-as-pure': 7.24.6 - '@babel/helper-plugin-utils': 7.24.6 - '@babel/plugin-transform-shorthand-properties@7.24.6(@babel/core@7.24.6)': dependencies: '@babel/core': 7.24.6 @@ -5543,11 +5463,6 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 - '@emotion/babel-plugin-jsx-pragmatic@0.1.5(@babel/core@7.24.6)': - dependencies: - '@babel/core': 7.24.6 - '@babel/plugin-syntax-jsx': 7.24.6(@babel/core@7.24.6) - '@emotion/babel-plugin@11.11.0': dependencies: '@babel/helper-module-imports': 7.24.6 @@ -5562,13 +5477,6 @@ snapshots: source-map: 0.5.7 stylis: 4.2.0 - '@emotion/cache@10.0.29': - dependencies: - '@emotion/sheet': 0.9.4 - '@emotion/stylis': 0.8.5 - '@emotion/utils': 0.11.3 - '@emotion/weak-memoize': 0.2.5 - '@emotion/cache@11.11.0': dependencies: '@emotion/memoize': 0.8.1 @@ -5577,24 +5485,6 @@ snapshots: '@emotion/weak-memoize': 0.3.1 stylis: 4.2.0 - '@emotion/core@10.3.1(react@18.3.1)': - dependencies: - '@babel/runtime': 7.24.6 - '@emotion/cache': 10.0.29 - '@emotion/css': 10.0.27 - '@emotion/serialize': 0.11.16 - '@emotion/sheet': 0.9.4 - '@emotion/utils': 0.11.3 - react: 18.3.1 - - '@emotion/css@10.0.27': - dependencies: - '@emotion/serialize': 0.11.16 - '@emotion/utils': 0.11.3 - babel-plugin-emotion: 10.2.2 - - '@emotion/hash@0.8.0': {} - '@emotion/hash@0.9.1': {} '@emotion/is-prop-valid@0.8.8': @@ -5602,7 +5492,8 @@ snapshots: '@emotion/memoize': 0.7.4 optional: true - '@emotion/memoize@0.7.4': {} + '@emotion/memoize@0.7.4': + optional: true '@emotion/memoize@0.8.1': {} @@ -5620,14 +5511,6 @@ snapshots: optionalDependencies: '@types/react': 17.0.80 - '@emotion/serialize@0.11.16': - dependencies: - '@emotion/hash': 0.8.0 - '@emotion/memoize': 0.7.4 - '@emotion/unitless': 0.7.5 - '@emotion/utils': 0.11.3 - csstype: 2.6.21 - '@emotion/serialize@1.1.4': dependencies: '@emotion/hash': 0.9.1 @@ -5636,26 +5519,16 @@ snapshots: '@emotion/utils': 1.2.1 csstype: 3.1.3 - '@emotion/sheet@0.9.4': {} - '@emotion/sheet@1.2.2': {} - '@emotion/stylis@0.8.5': {} - - '@emotion/unitless@0.7.5': {} - '@emotion/unitless@0.8.1': {} '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@18.3.1)': dependencies: react: 18.3.1 - '@emotion/utils@0.11.3': {} - '@emotion/utils@1.2.1': {} - '@emotion/weak-memoize@0.2.5': {} - '@emotion/weak-memoize@0.3.1': {} '@eslint/eslintrc@0.4.3': @@ -7396,19 +7269,6 @@ snapshots: transitivePeerDependencies: - supports-color - babel-plugin-emotion@10.2.2: - dependencies: - '@babel/helper-module-imports': 7.24.6 - '@emotion/hash': 0.8.0 - '@emotion/memoize': 0.7.4 - '@emotion/serialize': 0.11.16 - babel-plugin-macros: 2.8.0 - babel-plugin-syntax-jsx: 6.18.0 - convert-source-map: 1.9.0 - escape-string-regexp: 1.0.5 - find-root: 1.1.0 - source-map: 0.5.7 - babel-plugin-istanbul@6.1.1: dependencies: '@babel/helper-plugin-utils': 7.24.6 @@ -7426,20 +7286,12 @@ snapshots: '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.6 - babel-plugin-macros@2.8.0: - dependencies: - '@babel/runtime': 7.24.6 - cosmiconfig: 6.0.0 - resolve: 1.22.8 - babel-plugin-macros@3.1.0: dependencies: '@babel/runtime': 7.24.6 cosmiconfig: 7.1.0 resolve: 1.22.8 - babel-plugin-syntax-jsx@6.18.0: {} - babel-plugin-syntax-trailing-function-commas@7.0.0-beta.0: {} babel-preset-current-node-syntax@1.0.1(@babel/core@7.24.6): @@ -7758,14 +7610,6 @@ snapshots: ts-node: 10.9.2(@types/node@14.18.63)(typescript@4.9.5) typescript: 4.9.5 - cosmiconfig@6.0.0: - dependencies: - '@types/parse-json': 4.0.2 - import-fresh: 3.3.0 - parse-json: 5.2.0 - path-type: 4.0.0 - yaml: 1.10.2 - cosmiconfig@7.1.0: dependencies: '@types/parse-json': 4.0.2 @@ -7841,8 +7685,6 @@ snapshots: cssesc@3.0.0: {} - csstype@2.6.21: {} - csstype@3.1.3: {} damerau-levenshtein@1.0.8: {} diff --git a/frontend/src/apollo/client.ts b/frontend/src/apollo/client.ts index e7d01e61c1..e8fe1ea971 100644 --- a/frontend/src/apollo/client.ts +++ b/frontend/src/apollo/client.ts @@ -1,6 +1,6 @@ -import { ApolloClient, Operation } from "@apollo/client/core"; +import type { ApolloClient, Operation } from "@apollo/client/core"; import merge from "deepmerge"; -import { DefinitionNode } from "graphql"; +import type { DefinitionNode } from "graphql"; import isEqual from "../helpers/lodash-is-equal"; import { createClient } from "./create-client"; diff --git a/frontend/src/components/alert/index.tsx b/frontend/src/components/alert/index.tsx index e6baf02bc1..c1d91d8e38 100644 --- a/frontend/src/components/alert/index.tsx +++ b/frontend/src/components/alert/index.tsx @@ -1,5 +1,5 @@ import clsx from "clsx"; -import React from "react"; +import type React from "react"; type Props = { variant: "alert" | "success" | "info"; diff --git a/frontend/src/components/article/index.tsx b/frontend/src/components/article/index.tsx index 4fdcf15b55..582ed9588f 100644 --- a/frontend/src/components/article/index.tsx +++ b/frontend/src/components/article/index.tsx @@ -1,5 +1,6 @@ import { Heading, Spacer } from "@python-italia/pycon-styleguide"; -import React, { Fragment } from "react"; +import type React from "react"; +import { Fragment } from "react"; type ArticleProps = { title?: string; diff --git a/frontend/src/components/blocks-renderer/index.tsx b/frontend/src/components/blocks-renderer/index.tsx index f2bff9dfe9..de31e1f3b0 100644 --- a/frontend/src/components/blocks-renderer/index.tsx +++ b/frontend/src/components/blocks-renderer/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import { MapBlock } from "~/components/blocks/map"; import { TextSection } from "~/components/blocks/text-section"; -import { Block } from "~/types"; +import type { Block } from "~/types"; import { CheckoutSection } from "../blocks/checkout-section"; import { HomeIntroSection } from "../blocks/home-intro-section"; diff --git a/frontend/src/components/blocks/checkout-section/index.tsx b/frontend/src/components/blocks/checkout-section/index.tsx index f98b848f82..58ca7e9c0d 100644 --- a/frontend/src/components/blocks/checkout-section/index.tsx +++ b/frontend/src/components/blocks/checkout-section/index.tsx @@ -7,7 +7,7 @@ import { import { useCurrentUser } from "~/helpers/use-current-user"; import { useCurrentLanguage } from "~/locale/context"; import { - CheckoutCategory, + type CheckoutCategory, queryCheckoutSection, useCheckoutSectionQuery, } from "~/types"; diff --git a/frontend/src/components/blocks/keynotes-section/index.tsx b/frontend/src/components/blocks/keynotes-section/index.tsx index 24c7f23748..438515defa 100644 --- a/frontend/src/components/blocks/keynotes-section/index.tsx +++ b/frontend/src/components/blocks/keynotes-section/index.tsx @@ -13,7 +13,11 @@ import React from "react"; import { useTranslatedMessage } from "~/helpers/use-translated-message"; import { useCurrentLanguage } from "~/locale/context"; -import { Cta, queryKeynotesSection, useKeynotesSectionQuery } from "~/types"; +import { + type Cta, + queryKeynotesSection, + useKeynotesSectionQuery, +} from "~/types"; import { createHref } from "../../link"; diff --git a/frontend/src/components/blocks/live-streaming-section/index.tsx b/frontend/src/components/blocks/live-streaming-section/index.tsx index 51cf1fb2ee..f4416af604 100644 --- a/frontend/src/components/blocks/live-streaming-section/index.tsx +++ b/frontend/src/components/blocks/live-streaming-section/index.tsx @@ -14,8 +14,8 @@ import { useState } from "react"; import { FormattedMessage } from "react-intl"; import { - DayRoom, - LiveStreamingSectionQuery, + type DayRoom, + type LiveStreamingSectionQuery, queryLiveStreamingSection, useLiveStreamingSectionQuery, } from "~/types"; diff --git a/frontend/src/components/blocks/map.tsx b/frontend/src/components/blocks/map.tsx index 8ea825fb98..7e224e7d17 100644 --- a/frontend/src/components/blocks/map.tsx +++ b/frontend/src/components/blocks/map.tsx @@ -1,4 +1,4 @@ -import { CmsMap } from "~/types"; +import type { CmsMap } from "~/types"; export const MapBlock = ({ link, image, ...props }: CmsMap) => { return ( diff --git a/frontend/src/components/blocks/schedule-preview-section/index.tsx b/frontend/src/components/blocks/schedule-preview-section/index.tsx index 19220eaae2..fc2a514273 100644 --- a/frontend/src/components/blocks/schedule-preview-section/index.tsx +++ b/frontend/src/components/blocks/schedule-preview-section/index.tsx @@ -18,8 +18,8 @@ import { FormattedMessage } from "react-intl"; import { useCurrentLanguage } from "~/locale/context"; import { - Cta, - SchedulePreviewSectionQuery, + type Cta, + type SchedulePreviewSectionQuery, querySchedulePreviewSection, useSchedulePreviewSectionQuery, } from "~/types"; diff --git a/frontend/src/components/blocks/slider-cards-section.tsx b/frontend/src/components/blocks/slider-cards-section.tsx index 1f135371e8..da077fc186 100644 --- a/frontend/src/components/blocks/slider-cards-section.tsx +++ b/frontend/src/components/blocks/slider-cards-section.tsx @@ -12,9 +12,9 @@ import { import { useMoneyFormatter } from "~/helpers/formatters"; import { - PriceCard as PriceCardType, - SimpleTextCard as SimpleTextCardType, - SliderCardsSection as SliderCardsSectionType, + type PriceCard as PriceCardType, + type SimpleTextCard as SimpleTextCardType, + type SliderCardsSection as SliderCardsSectionType, Spacing, } from "~/types"; @@ -117,7 +117,7 @@ const PriceCard = ({ card }: { card: PriceCardType }) => { - {moneyFormatter.format(parseFloat(card.price))} + {moneyFormatter.format(Number.parseFloat(card.price))} diff --git a/frontend/src/components/blocks/special-guest-section.tsx b/frontend/src/components/blocks/special-guest-section.tsx index cbf305b8c5..5025f503ed 100644 --- a/frontend/src/components/blocks/special-guest-section.tsx +++ b/frontend/src/components/blocks/special-guest-section.tsx @@ -16,7 +16,7 @@ import React from "react"; import { FormattedMessage } from "react-intl"; import { useCurrentLanguage } from "~/locale/context"; -import { Cta } from "~/types"; +import type { Cta } from "~/types"; import { createHref } from "../link"; diff --git a/frontend/src/components/blocks/sponsors-section/index.tsx b/frontend/src/components/blocks/sponsors-section/index.tsx index e3d0d18989..d3fcfdc77d 100644 --- a/frontend/src/components/blocks/sponsors-section/index.tsx +++ b/frontend/src/components/blocks/sponsors-section/index.tsx @@ -13,8 +13,8 @@ import React from "react"; import { useCurrentLanguage } from "~/locale/context"; import { - Cta, - SponsorsSectionLayout, + type Cta, + type SponsorsSectionLayout, querySponsorsSection, useSponsorsSectionQuery, } from "~/types"; diff --git a/frontend/src/components/blocks/text-section.tsx b/frontend/src/components/blocks/text-section.tsx index 01009d18fa..3dae0b02f3 100644 --- a/frontend/src/components/blocks/text-section.tsx +++ b/frontend/src/components/blocks/text-section.tsx @@ -9,10 +9,10 @@ import { StyledHTMLText, } from "@python-italia/pycon-styleguide"; -import { BodyTextSize, TextSection as TextSectionType } from "~/types"; +import { BodyTextSize, type TextSection as TextSectionType } from "~/types"; import { Fragment } from "react"; -import { ModalID, useSetCurrentModal } from "../modal/context"; +import { type ModalID, useSetCurrentModal } from "../modal/context"; export const TextSection = ({ title, diff --git a/frontend/src/components/customize-ticket-modal/index.tsx b/frontend/src/components/customize-ticket-modal/index.tsx index aac5a869d2..1572315cf7 100644 --- a/frontend/src/components/customize-ticket-modal/index.tsx +++ b/frontend/src/components/customize-ticket-modal/index.tsx @@ -13,7 +13,7 @@ import { useFormState } from "react-use-form-state"; import { useCurrentLanguage } from "~/locale/context"; import { MyProfileWithTicketsDocument, - MyProfileWithTicketsQuery, + type MyProfileWithTicketsQuery, useUpdateTicketMutation, } from "~/types"; diff --git a/frontend/src/components/edit-profile-page-handler/email-preferences-card.tsx b/frontend/src/components/edit-profile-page-handler/email-preferences-card.tsx index 5f71e6692f..474e083c12 100644 --- a/frontend/src/components/edit-profile-page-handler/email-preferences-card.tsx +++ b/frontend/src/components/edit-profile-page-handler/email-preferences-card.tsx @@ -8,9 +8,9 @@ import { Text, } from "@python-italia/pycon-styleguide"; import { FormattedMessage } from "react-intl"; -import { FormState, Inputs, StateErrors } from "react-use-form-state"; +import type { FormState, Inputs, StateErrors } from "react-use-form-state"; -import { MeUserFields } from "./types"; +import type { MeUserFields } from "./types"; type Props = { formState: FormState>; diff --git a/frontend/src/components/error-boundary/index.tsx b/frontend/src/components/error-boundary/index.tsx index f693159325..33cc49308d 100644 --- a/frontend/src/components/error-boundary/index.tsx +++ b/frontend/src/components/error-boundary/index.tsx @@ -6,7 +6,8 @@ import { Text, } from "@python-italia/pycon-styleguide"; import * as Sentry from "@sentry/nextjs"; -import React, { Component } from "react"; +import type React from "react"; +import { Component } from "react"; type Props = { children: React.ReactNode; diff --git a/frontend/src/components/grant-form/index.tsx b/frontend/src/components/grant-form/index.tsx index e094b2bc19..3781889199 100644 --- a/frontend/src/components/grant-form/index.tsx +++ b/frontend/src/components/grant-form/index.tsx @@ -1,4 +1,4 @@ -import { ApolloError } from "@apollo/client"; +import type { ApolloError } from "@apollo/client"; import { Button, CardPart, @@ -16,7 +16,8 @@ import { Text, Textarea, } from "@python-italia/pycon-styleguide"; -import React, { useCallback, useEffect } from "react"; +import type React from "react"; +import { useCallback, useEffect } from "react"; import { FormattedMessage } from "react-intl"; import { useFormState } from "react-use-form-state"; @@ -27,15 +28,15 @@ import { useCurrentUser } from "~/helpers/use-current-user"; import { useTranslatedMessage } from "~/helpers/use-translated-message"; import { useCurrentLanguage } from "~/locale/context"; import { - AgeGroup, - Grant, - GrantType, - InterestedInVolunteering, - Occupation, - SendGrantInput, - SendGrantMutation, - UpdateGrantInput, - UpdateGrantMutation, + type AgeGroup, + type Grant, + type GrantType, + type InterestedInVolunteering, + type Occupation, + type SendGrantInput, + type SendGrantMutation, + type UpdateGrantInput, + type UpdateGrantMutation, useMyGrantQuery, useSendGrantMutation, } from "~/types"; diff --git a/frontend/src/components/header/index.tsx b/frontend/src/components/header/index.tsx index aac0b3a74b..c28574a389 100644 --- a/frontend/src/components/header/index.tsx +++ b/frontend/src/components/header/index.tsx @@ -1,5 +1,5 @@ import { NavBar } from "@python-italia/pycon-styleguide"; -import { Action } from "@python-italia/pycon-styleguide/dist/navbar/types"; +import type { Action } from "@python-italia/pycon-styleguide/dist/navbar/types"; import React, { useEffect, useState } from "react"; import { useRouter } from "next/router"; diff --git a/frontend/src/components/job-board-layout/index.tsx b/frontend/src/components/job-board-layout/index.tsx index f26ff70636..3df98a2bf3 100644 --- a/frontend/src/components/job-board-layout/index.tsx +++ b/frontend/src/components/job-board-layout/index.tsx @@ -14,7 +14,7 @@ import { FormattedMessage } from "react-intl"; import { JobListingAccordion } from "~/components/job-listing-accordion"; import { compile } from "~/helpers/markdown"; -import { AllJobListingsQueryResult } from "~/types"; +import type { AllJobListingsQueryResult } from "~/types"; import { Article } from "../article"; import { MetaTags } from "../meta-tags"; diff --git a/frontend/src/components/job-listing-accordion/index.tsx b/frontend/src/components/job-listing-accordion/index.tsx index 5bbcfef79b..da4b9ac837 100644 --- a/frontend/src/components/job-listing-accordion/index.tsx +++ b/frontend/src/components/job-listing-accordion/index.tsx @@ -7,14 +7,14 @@ import { Spacer, Text, } from "@python-italia/pycon-styleguide"; -import React from "react"; +import type React from "react"; import { FormattedMessage } from "react-intl"; import Image from "next/image"; import { useRouter } from "next/router"; import { useCurrentLanguage } from "~/locale/context"; -import { JobListing } from "~/types"; +import type { JobListing } from "~/types"; import { createHref } from "../link"; diff --git a/frontend/src/components/link/index.tsx b/frontend/src/components/link/index.tsx index 921bc28a6c..e3cb6cc48a 100644 --- a/frontend/src/components/link/index.tsx +++ b/frontend/src/components/link/index.tsx @@ -1,4 +1,4 @@ -import { ParsedUrlQuery } from "querystring"; +import type { ParsedUrlQuery } from "querystring"; export const createHref = ({ path, diff --git a/frontend/src/components/login-flow-layout/index.tsx b/frontend/src/components/login-flow-layout/index.tsx index f7d29ae917..5842570d6f 100644 --- a/frontend/src/components/login-flow-layout/index.tsx +++ b/frontend/src/components/login-flow-layout/index.tsx @@ -7,7 +7,7 @@ import { SnakeLetter, SnakePencil, } from "@python-italia/pycon-styleguide/illustrations"; -import React from "react"; +import type React from "react"; type Props = { children: React.ReactNode; diff --git a/frontend/src/components/login-page-handler/index.tsx b/frontend/src/components/login-page-handler/index.tsx index 0cd92d0f9a..2a03c15b7e 100644 --- a/frontend/src/components/login-page-handler/index.tsx +++ b/frontend/src/components/login-page-handler/index.tsx @@ -10,7 +10,8 @@ import { Spacer, Text, } from "@python-italia/pycon-styleguide"; -import React, { useEffect, useRef } from "react"; +import type React from "react"; +import { useEffect, useRef } from "react"; import { FormattedMessage } from "react-intl"; import { useFormState } from "react-use-form-state"; @@ -19,7 +20,7 @@ import { useRouter } from "next/router"; import { MetaTags } from "~/components/meta-tags"; import { useTranslatedMessage } from "~/helpers/use-translated-message"; import { useCurrentLanguage } from "~/locale/context"; -import { LoginMutation, useLoginMutation } from "~/types"; +import { type LoginMutation, useLoginMutation } from "~/types"; import { createHref } from "../link"; import { LoginFlowLayout } from "../login-flow-layout"; diff --git a/frontend/src/components/meta-tags/index.tsx b/frontend/src/components/meta-tags/index.tsx index 0859aa2623..15c0b258f0 100644 --- a/frontend/src/components/meta-tags/index.tsx +++ b/frontend/src/components/meta-tags/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import type React from "react"; import Head from "next/head"; import { useRouter } from "next/router"; diff --git a/frontend/src/components/modal-renderer/index.tsx b/frontend/src/components/modal-renderer/index.tsx index 01989708ff..5e10a21eb4 100644 --- a/frontend/src/components/modal-renderer/index.tsx +++ b/frontend/src/components/modal-renderer/index.tsx @@ -1,18 +1,18 @@ import { AddScheduleToCalendarModal } from "../add-schedule-to-calendar-modal"; import { CustomizeTicketModal, - CustomizeTicketModalProps, + type CustomizeTicketModalProps, } from "../customize-ticket-modal"; import { useModal } from "../modal/context"; import { NewsletterModal } from "../newsletter-modal"; import { ReassignTicketModal, - ReassignTicketModalProps, + type ReassignTicketModalProps, } from "../reassign-ticket-modal"; import { SponsorLeadModal } from "../sponsor-lead-modal"; import { TicketQRCodeModal, - TicketQRCodeModalProps, + type TicketQRCodeModalProps, } from "../ticket-qrcode-modal"; export const ModalRenderer = () => { diff --git a/frontend/src/components/modal/context.tsx b/frontend/src/components/modal/context.tsx index b6fb44e86f..06c44ab5d8 100644 --- a/frontend/src/components/modal/context.tsx +++ b/frontend/src/components/modal/context.tsx @@ -1,7 +1,7 @@ import { createContext, useContext } from "react"; -import { CustomizeTicketModalProps } from "../customize-ticket-modal"; -import { ReassignTicketModalProps } from "../reassign-ticket-modal"; -import { TicketQRCodeModalProps } from "../ticket-qrcode-modal"; +import type { CustomizeTicketModalProps } from "../customize-ticket-modal"; +import type { ReassignTicketModalProps } from "../reassign-ticket-modal"; +import type { TicketQRCodeModalProps } from "../ticket-qrcode-modal"; export type ModalProps = { "sponsor-lead": null; diff --git a/frontend/src/components/modal/index.tsx b/frontend/src/components/modal/index.tsx index 22e3daa8bb..dc56538d0f 100644 --- a/frontend/src/components/modal/index.tsx +++ b/frontend/src/components/modal/index.tsx @@ -1,7 +1,8 @@ import { Heading } from "@python-italia/pycon-styleguide"; import { CloseIcon } from "@python-italia/pycon-styleguide/icons"; import clsx from "clsx"; -import React, { useEffect } from "react"; +import type React from "react"; +import { useEffect } from "react"; type ModalProps = { title: string | React.ReactNode; diff --git a/frontend/src/components/my-orders-profile-page-handler/my-orders-table.tsx b/frontend/src/components/my-orders-profile-page-handler/my-orders-table.tsx index e3f85a3202..ff23386803 100644 --- a/frontend/src/components/my-orders-profile-page-handler/my-orders-table.tsx +++ b/frontend/src/components/my-orders-profile-page-handler/my-orders-table.tsx @@ -2,7 +2,7 @@ import { Button, Tag, Text } from "@python-italia/pycon-styleguide"; import { FormattedMessage } from "react-intl"; import { useMoneyFormatter } from "~/helpers/formatters"; -import { MyProfileWithOrdersQuery } from "~/types"; +import type { MyProfileWithOrdersQuery } from "~/types"; import { Table } from "../table"; @@ -20,7 +20,9 @@ export const MyOrdersTable = ({ orders }: Props) => { {data.code} , , - {moneyFormatter.format(parseFloat(data.total))}, + + {moneyFormatter.format(Number.parseFloat(data.total))} + , , diff --git a/frontend/src/components/my-proposals-profile-page-handler/my-proposals-table.tsx b/frontend/src/components/my-proposals-profile-page-handler/my-proposals-table.tsx index 53d6e04f30..11888620fa 100644 --- a/frontend/src/components/my-proposals-profile-page-handler/my-proposals-table.tsx +++ b/frontend/src/components/my-proposals-profile-page-handler/my-proposals-table.tsx @@ -11,7 +11,7 @@ import { parseISO } from "date-fns"; import { FormattedMessage } from "react-intl"; import { useCurrentLanguage } from "~/locale/context"; -import { MyProfileWithSubmissionsQuery } from "~/types"; +import type { MyProfileWithSubmissionsQuery } from "~/types"; import { createHref } from "../link"; import { EventTag } from "../schedule-event-detail/event-tag"; diff --git a/frontend/src/components/my-proposals-profile-page-handler/no-proposals.tsx b/frontend/src/components/my-proposals-profile-page-handler/no-proposals.tsx index ee78ee78a2..29fdd5ac6a 100644 --- a/frontend/src/components/my-proposals-profile-page-handler/no-proposals.tsx +++ b/frontend/src/components/my-proposals-profile-page-handler/no-proposals.tsx @@ -8,7 +8,7 @@ import { import { FormattedMessage } from "react-intl"; import { useCurrentLanguage } from "~/locale/context"; -import { DeadlineStatus, MyProfileWithSubmissionsQuery } from "~/types"; +import { DeadlineStatus, type MyProfileWithSubmissionsQuery } from "~/types"; import { createHref } from "../link"; diff --git a/frontend/src/components/my-tickets-profile-page-handler/ticket-card.tsx b/frontend/src/components/my-tickets-profile-page-handler/ticket-card.tsx index bc5cc86cf3..07ff93a16c 100644 --- a/frontend/src/components/my-tickets-profile-page-handler/ticket-card.tsx +++ b/frontend/src/components/my-tickets-profile-page-handler/ticket-card.tsx @@ -7,14 +7,15 @@ import { Text, } from "@python-italia/pycon-styleguide"; import { GearIcon, TicketsIcon } from "@python-italia/pycon-styleguide/icons"; -import React, { useState } from "react"; +import type React from "react"; +import { useState } from "react"; import { FormattedMessage } from "react-intl"; import QRCode from "react-qr-code"; import { useCurrentLanguage } from "~/locale/context"; import { MyProfileWithTicketsDocument, - MyProfileWithTicketsQuery, + type MyProfileWithTicketsQuery, useUpdateTicketMutation, } from "~/types"; diff --git a/frontend/src/components/page-handler/page-static-props.ts b/frontend/src/components/page-handler/page-static-props.ts index 05d9afae57..99983b144f 100644 --- a/frontend/src/components/page-handler/page-static-props.ts +++ b/frontend/src/components/page-handler/page-static-props.ts @@ -1,11 +1,11 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { blocksDataFetching } from "~/components/blocks-renderer"; import { prefetchSharedQueries } from "~/helpers/prefetch"; import { - PagePreviewQuery, - PageQuery, + type PagePreviewQuery, + type PageQuery, queryPage, queryPagePreview, } from "~/types"; diff --git a/frontend/src/components/participant-info-section/index.tsx b/frontend/src/components/participant-info-section/index.tsx index ed3e2e9848..3086b763b7 100644 --- a/frontend/src/components/participant-info-section/index.tsx +++ b/frontend/src/components/participant-info-section/index.tsx @@ -21,7 +21,7 @@ import { SnakeTail } from "@python-italia/pycon-styleguide/illustrations"; import React from "react"; import { compile } from "~/helpers/markdown"; -import { TalkQueryResult } from "~/types"; +import type { TalkQueryResult } from "~/types"; export const ParticipantInfoSection = ({ fullname, diff --git a/frontend/src/components/product-questionnaire/index.tsx b/frontend/src/components/product-questionnaire/index.tsx index 4bb48c4bba..44d5fe0d00 100644 --- a/frontend/src/components/product-questionnaire/index.tsx +++ b/frontend/src/components/product-questionnaire/index.tsx @@ -4,13 +4,13 @@ import { InputWrapper, Select, } from "@python-italia/pycon-styleguide"; -import React from "react"; +import type React from "react"; import { FormattedMessage } from "react-intl"; import { useTranslatedMessage } from "~/helpers/use-translated-message"; -import { TicketItem } from "~/types"; +import type { TicketItem } from "~/types"; -import { ProductState } from "../tickets-page/types"; +import type { ProductState } from "../tickets-page/types"; type Props = { index: number; diff --git a/frontend/src/components/products-list/hotel-row.tsx b/frontend/src/components/products-list/hotel-row.tsx index eb2b04cab0..12b5fca89a 100644 --- a/frontend/src/components/products-list/hotel-row.tsx +++ b/frontend/src/components/products-list/hotel-row.tsx @@ -14,9 +14,9 @@ import { useState } from "react"; import { FormattedMessage } from "react-intl"; import { useMoneyFormatter } from "~/helpers/formatters"; -import { HotelRoom } from "~/types"; +import type { HotelRoom } from "~/types"; -import { HotelRoomState } from "../tickets-page/types"; +import type { HotelRoomState } from "../tickets-page/types"; import { useCart } from "../tickets-page/use-cart"; type Props = { diff --git a/frontend/src/components/products-list/index.tsx b/frontend/src/components/products-list/index.tsx index 67b37dedf0..66c1a83489 100644 --- a/frontend/src/components/products-list/index.tsx +++ b/frontend/src/components/products-list/index.tsx @@ -4,11 +4,11 @@ import { FormattedMessage } from "react-intl"; import { CheckoutCategory, - CurrentUserQueryResult, - HotelRoom, - TicketItem, + type CurrentUserQueryResult, + type HotelRoom, + type TicketItem, TicketType, - TicketsQuery, + type TicketsQuery, } from "~/types"; import { HotelRow } from "./hotel-row"; diff --git a/frontend/src/components/products-list/membership-row.tsx b/frontend/src/components/products-list/membership-row.tsx index 610648c9f3..4234194850 100644 --- a/frontend/src/components/products-list/membership-row.tsx +++ b/frontend/src/components/products-list/membership-row.tsx @@ -9,7 +9,7 @@ import { FormattedMessage } from "react-intl"; import { useMoneyFormatter } from "~/helpers/formatters"; import { compile } from "~/helpers/markdown"; -import { CurrentUserQueryResult, TicketItem } from "~/types"; +import type { CurrentUserQueryResult, TicketItem } from "~/types"; import { useCart } from "../tickets-page/use-cart"; diff --git a/frontend/src/components/products-list/socialevent-row.tsx b/frontend/src/components/products-list/socialevent-row.tsx index e5d67e8af9..a67cd4da1d 100644 --- a/frontend/src/components/products-list/socialevent-row.tsx +++ b/frontend/src/components/products-list/socialevent-row.tsx @@ -6,12 +6,12 @@ import { TagsCollection, Text, } from "@python-italia/pycon-styleguide"; -import { Icon } from "@python-italia/pycon-styleguide/dist/icons/types"; +import type { Icon } from "@python-italia/pycon-styleguide/dist/icons/types"; import { FormattedMessage } from "react-intl"; import { compile } from "~/helpers/markdown"; import { useCurrentLanguage } from "~/locale/context"; -import { TicketItem } from "~/types"; +import type { TicketItem } from "~/types"; import { useCart } from "../tickets-page/use-cart"; import { AddRemoveRow } from "./ticket-row"; diff --git a/frontend/src/components/products-list/ticket-row.tsx b/frontend/src/components/products-list/ticket-row.tsx index 86d22cf17e..408454afb0 100644 --- a/frontend/src/components/products-list/ticket-row.tsx +++ b/frontend/src/components/products-list/ticket-row.tsx @@ -14,7 +14,7 @@ import { FormattedMessage } from "react-intl"; import { useMoneyFormatter } from "~/helpers/formatters"; import { compile } from "~/helpers/markdown"; import { useCurrentLanguage } from "~/locale/context"; -import { TicketItem } from "~/types"; +import type { TicketItem } from "~/types"; import { useCart } from "../tickets-page/use-cart"; diff --git a/frontend/src/components/profile-page-handler/index.tsx b/frontend/src/components/profile-page-handler/index.tsx index a91e814b22..187976aba6 100644 --- a/frontend/src/components/profile-page-handler/index.tsx +++ b/frontend/src/components/profile-page-handler/index.tsx @@ -9,9 +9,10 @@ import { Page, Section, } from "@python-italia/pycon-styleguide"; -import { Icon } from "@python-italia/pycon-styleguide/dist/icons/types"; -import { Color } from "@python-italia/pycon-styleguide/dist/types"; -import React, { useEffect, useState } from "react"; +import type { Icon } from "@python-italia/pycon-styleguide/dist/icons/types"; +import type { Color } from "@python-italia/pycon-styleguide/dist/types"; +import type React from "react"; +import { useEffect, useState } from "react"; import { FormattedMessage } from "react-intl"; import Router from "next/router"; diff --git a/frontend/src/components/reassign-ticket-modal/index.tsx b/frontend/src/components/reassign-ticket-modal/index.tsx index be8e1b960a..4a796580bb 100644 --- a/frontend/src/components/reassign-ticket-modal/index.tsx +++ b/frontend/src/components/reassign-ticket-modal/index.tsx @@ -16,7 +16,7 @@ import { useTranslatedMessage } from "~/helpers/use-translated-message"; import { useCurrentLanguage } from "~/locale/context"; import { MyProfileWithTicketsDocument, - MyProfileWithTicketsQuery, + type MyProfileWithTicketsQuery, useUpdateTicketMutation, } from "~/types"; import { Alert } from "../alert"; diff --git a/frontend/src/components/schedule-view/index.tsx b/frontend/src/components/schedule-view/index.tsx index 4781ddd57c..b523a6153a 100644 --- a/frontend/src/components/schedule-view/index.tsx +++ b/frontend/src/components/schedule-view/index.tsx @@ -23,7 +23,7 @@ import { useRouter } from "next/router"; import { useCurrentLanguage } from "~/locale/context"; import { getDayUrl } from "~/pages/schedule/[day]"; import { - ScheduleQuery, + type ScheduleQuery, readUserStarredScheduleItemsQueryCache, useStarScheduleItemMutation, useUnstarScheduleItemMutation, @@ -35,7 +35,7 @@ import { useSetCurrentModal } from "../modal/context"; import { useLoginState } from "../profile/hooks"; import { Schedule } from "./schedule"; import { ScheduleList } from "./schedule-list"; -import { Item, Slot } from "./types"; +import type { Item, Slot } from "./types"; export type ViewMode = "grid" | "list"; diff --git a/frontend/src/components/schedule-view/is-training.ts b/frontend/src/components/schedule-view/is-training.ts index 664fba9e2b..2168c8eaae 100644 --- a/frontend/src/components/schedule-view/is-training.ts +++ b/frontend/src/components/schedule-view/is-training.ts @@ -1,4 +1,4 @@ -import { Item } from "./types"; +import type { Item } from "./types"; // TODO: let's be consistent with naming (training vs tutorial) export const isTraining = (item: Item) => { diff --git a/frontend/src/components/schedule-view/use-drag-or-dummy.ts b/frontend/src/components/schedule-view/use-drag-or-dummy.ts index 178debb9db..f55d7ad049 100644 --- a/frontend/src/components/schedule-view/use-drag-or-dummy.ts +++ b/frontend/src/components/schedule-view/use-drag-or-dummy.ts @@ -1,8 +1,8 @@ import { - ConnectDragPreview, - ConnectDragSource, - DragObjectWithType, - DragSourceHookSpec, + type ConnectDragPreview, + type ConnectDragSource, + type DragObjectWithType, + type DragSourceHookSpec, useDrag, } from "react-dnd"; diff --git a/frontend/src/components/schedule-view/use-drop-or-dummy.ts b/frontend/src/components/schedule-view/use-drop-or-dummy.ts index 0ccdfe0af2..5304803892 100644 --- a/frontend/src/components/schedule-view/use-drop-or-dummy.ts +++ b/frontend/src/components/schedule-view/use-drop-or-dummy.ts @@ -1,7 +1,7 @@ import { - ConnectDropTarget, - DragObjectWithType, - DropTargetHookSpec, + type ConnectDropTarget, + type DragObjectWithType, + type DropTargetHookSpec, useDrop, } from "react-dnd"; diff --git a/frontend/src/components/tickets-page/available-products-landing-section.tsx b/frontend/src/components/tickets-page/available-products-landing-section.tsx index bf5aefbe54..fd965d5728 100644 --- a/frontend/src/components/tickets-page/available-products-landing-section.tsx +++ b/frontend/src/components/tickets-page/available-products-landing-section.tsx @@ -12,7 +12,7 @@ import { FormattedMessage } from "react-intl"; import { compile } from "~/helpers/markdown"; import { useCurrentLanguage } from "~/locale/context"; -import { TicketItem, TicketType, TicketsQueryResult } from "~/types"; +import { type TicketItem, TicketType, type TicketsQueryResult } from "~/types"; import { createHref } from "../link"; diff --git a/frontend/src/components/tickets-page/checkout-bar.tsx b/frontend/src/components/tickets-page/checkout-bar.tsx index d6fc7b7370..994566eaca 100644 --- a/frontend/src/components/tickets-page/checkout-bar.tsx +++ b/frontend/src/components/tickets-page/checkout-bar.tsx @@ -2,7 +2,7 @@ import { BottomBar, Button, Heading } from "@python-italia/pycon-styleguide"; import { FormattedMessage } from "react-intl"; import { useMoneyFormatter } from "~/helpers/formatters"; -import { HotelRoom, TicketItem } from "~/types"; +import type { HotelRoom, TicketItem } from "~/types"; import { calculateTotalAmount } from "./review/prices"; import { useCart } from "./use-cart"; diff --git a/frontend/src/components/tickets-page/reducer.ts b/frontend/src/components/tickets-page/reducer.ts index 9f957a2f66..e41ca15297 100644 --- a/frontend/src/components/tickets-page/reducer.ts +++ b/frontend/src/components/tickets-page/reducer.ts @@ -1,6 +1,6 @@ import { differenceInCalendarDays, parseISO } from "date-fns"; -import { +import type { OrderAction, OrderState, UpdateHotelRoomAction, diff --git a/frontend/src/components/tickets-page/review/prices.ts b/frontend/src/components/tickets-page/review/prices.ts index ae33d48619..060bffef62 100644 --- a/frontend/src/components/tickets-page/review/prices.ts +++ b/frontend/src/components/tickets-page/review/prices.ts @@ -1,16 +1,16 @@ -import { TicketItem } from "~/types"; +import type { TicketItem } from "~/types"; -import { HotelRoom, OrderState, Voucher } from "../types"; +import type { HotelRoom, OrderState, Voucher } from "../types"; export const calculateProductPrice = ( product: TicketItem, voucher?: Voucher | null, ): number => { - const basePrice = parseFloat(product.defaultPrice); + const basePrice = Number.parseFloat(product.defaultPrice); if (voucher) { const priceMode = voucher.priceMode; - const value = parseFloat(voucher.value); + const value = Number.parseFloat(voucher.value); switch (priceMode) { case "none": { @@ -57,7 +57,8 @@ export const calculateTotalAmount = ( .reduce( (sum, roomInfo) => sum + - parseFloat(hotelRoomsById[roomInfo.id].price) * roomInfo.numNights, + Number.parseFloat(hotelRoomsById[roomInfo.id].price) * + roomInfo.numNights, 0, ); diff --git a/frontend/src/components/tickets-page/tickets.tsx b/frontend/src/components/tickets-page/tickets.tsx index 02a1d1194f..012c029057 100644 --- a/frontend/src/components/tickets-page/tickets.tsx +++ b/frontend/src/components/tickets-page/tickets.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import { useRouter } from "next/router"; -import { +import type { CheckoutCategory, CurrentUserQueryResult, TicketItem, diff --git a/frontend/src/components/tickets-page/use-cart.ts b/frontend/src/components/tickets-page/use-cart.ts index 364bace848..1e8892e469 100644 --- a/frontend/src/components/tickets-page/use-cart.ts +++ b/frontend/src/components/tickets-page/use-cart.ts @@ -7,7 +7,7 @@ import { } from "react"; import { reducer } from "./reducer"; -import { InvoiceInformationState, OrderState, Voucher } from "./types"; +import type { InvoiceInformationState, OrderState, Voucher } from "./types"; type CartContextType = { state: OrderState; diff --git a/frontend/src/components/tickets-page/utils.ts b/frontend/src/components/tickets-page/utils.ts index 85fe1c0f27..3eeb341361 100644 --- a/frontend/src/components/tickets-page/utils.ts +++ b/frontend/src/components/tickets-page/utils.ts @@ -1,6 +1,6 @@ -import { TicketItem } from "~/types"; +import type { TicketItem } from "~/types"; -import { InvoiceInformationState, OrderState } from "./types"; +import type { InvoiceInformationState, OrderState } from "./types"; export const hasSelectedAtLeastOneProduct = (state: OrderState): boolean => Object.values(state.selectedProducts).length > 0 || diff --git a/frontend/src/components/tickets-page/wrapper.tsx b/frontend/src/components/tickets-page/wrapper.tsx index 7f2a858870..0cef466af5 100644 --- a/frontend/src/components/tickets-page/wrapper.tsx +++ b/frontend/src/components/tickets-page/wrapper.tsx @@ -1,5 +1,6 @@ import { Page, Section } from "@python-italia/pycon-styleguide"; -import React, { useEffect } from "react"; +import type React from "react"; +import { useEffect } from "react"; import { FormattedMessage } from "react-intl"; import { useRouter } from "next/router"; @@ -10,10 +11,10 @@ import { useLoginState } from "~/components/profile/hooks"; import { useCurrentUser } from "~/helpers/use-current-user"; import { useCurrentLanguage } from "~/locale/context"; import { - CurrentUserQueryResult, - TicketItem, + type CurrentUserQueryResult, + type TicketItem, TicketType, - TicketsQueryResult, + type TicketsQueryResult, useTicketsQuery, } from "~/types"; diff --git a/frontend/src/components/voting-card/index.tsx b/frontend/src/components/voting-card/index.tsx index 1139661578..1f4e8c9fae 100644 --- a/frontend/src/components/voting-card/index.tsx +++ b/frontend/src/components/voting-card/index.tsx @@ -13,7 +13,7 @@ import { ArrowIcon } from "@python-italia/pycon-styleguide/icons"; import React, { useCallback } from "react"; import { FormattedMessage } from "react-intl"; -import { SubmissionAccordionFragment, useSendVoteMutation } from "~/types"; +import { type SubmissionAccordionFragment, useSendVoteMutation } from "~/types"; type Props = { submission: SubmissionAccordionFragment; diff --git a/frontend/src/helpers/deadlines.ts b/frontend/src/helpers/deadlines.ts index 7dd04e83f2..d9b485113e 100644 --- a/frontend/src/helpers/deadlines.ts +++ b/frontend/src/helpers/deadlines.ts @@ -1,4 +1,4 @@ -import { Language } from "~/locale/languages"; +import type { Language } from "~/locale/languages"; export const formatDeadlineDate = (datetime: string, language: Language) => { const d = new Date(datetime); diff --git a/frontend/src/helpers/get-color-for-submission.ts b/frontend/src/helpers/get-color-for-submission.ts index d2b78cd344..fc0a25ed80 100644 --- a/frontend/src/helpers/get-color-for-submission.ts +++ b/frontend/src/helpers/get-color-for-submission.ts @@ -1,4 +1,4 @@ -import { Keynote, Submission } from "~/components/schedule-view/types"; +import type { Keynote, Submission } from "~/components/schedule-view/types"; type Item = { id: string; diff --git a/frontend/src/helpers/lodash-is-equal.ts b/frontend/src/helpers/lodash-is-equal.ts index 07cf71e5ff..5a083ccc86 100644 --- a/frontend/src/helpers/lodash-is-equal.ts +++ b/frontend/src/helpers/lodash-is-equal.ts @@ -13,48 +13,48 @@ var LARGE_ARRAY_SIZE = 200; /** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; +var HASH_UNDEFINED = "__lodash_hash_undefined__"; /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; + COMPARE_UNORDERED_FLAG = 2; /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - nullTag = '[object Null]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - undefinedTag = '[object Undefined]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; +var argsTag = "[object Arguments]", + arrayTag = "[object Array]", + asyncTag = "[object AsyncFunction]", + boolTag = "[object Boolean]", + dateTag = "[object Date]", + errorTag = "[object Error]", + funcTag = "[object Function]", + genTag = "[object GeneratorFunction]", + mapTag = "[object Map]", + numberTag = "[object Number]", + nullTag = "[object Null]", + objectTag = "[object Object]", + promiseTag = "[object Promise]", + proxyTag = "[object Proxy]", + regexpTag = "[object RegExp]", + setTag = "[object Set]", + stringTag = "[object String]", + symbolTag = "[object Symbol]", + undefinedTag = "[object Undefined]", + weakMapTag = "[object WeakMap]"; + +var arrayBufferTag = "[object ArrayBuffer]", + dataViewTag = "[object DataView]", + float32Tag = "[object Float32Array]", + float64Tag = "[object Float64Array]", + int8Tag = "[object Int8Array]", + int16Tag = "[object Int16Array]", + int32Tag = "[object Int32Array]", + uint8Tag = "[object Uint8Array]", + uint8ClampedTag = "[object Uint8ClampedArray]", + uint16Tag = "[object Uint16Array]", + uint32Tag = "[object Uint32Array]"; /** * Used to match `RegExp` @@ -70,34 +70,55 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = -typedArrayTags[errorTag] = typedArrayTags[funcTag] = -typedArrayTags[mapTag] = typedArrayTags[numberTag] = -typedArrayTags[objectTag] = typedArrayTags[regexpTag] = -typedArrayTags[setTag] = typedArrayTags[stringTag] = -typedArrayTags[weakMapTag] = false; +typedArrayTags[float32Tag] = + typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = + typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = + typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = + typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = + true; +typedArrayTags[argsTag] = + typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = + typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = + typedArrayTags[dateTag] = + typedArrayTags[errorTag] = + typedArrayTags[funcTag] = + typedArrayTags[mapTag] = + typedArrayTags[numberTag] = + typedArrayTags[objectTag] = + typedArrayTags[regexpTag] = + typedArrayTags[setTag] = + typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = + false; /** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; +var freeGlobal = + typeof global == "object" && global && global.Object === Object && global; /** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; +var freeSelf = + typeof self == "object" && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || globalThis; /** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; +var freeExports = + typeof exports == "object" && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; +var freeModule = + freeExports && + typeof module == "object" && + module && + !module.nodeType && + module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; @@ -106,11 +127,11 @@ var moduleExports = freeModule && freeModule.exports === freeExports; var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ -var nodeUtil = (function() { - try { - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} -}()); +var nodeUtil = (function () { + try { + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e) {} +})(); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; @@ -125,18 +146,18 @@ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; } /** @@ -148,14 +169,14 @@ function arrayFilter(array, predicate) { * @returns {Array} Returns `array`. */ function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; + var index = -1, + length = values.length, + offset = array.length; - while (++index < length) { - array[offset + index] = values[index]; - } - return array; + while (++index < length) { + array[offset + index] = values[index]; + } + return array; } /** @@ -169,15 +190,15 @@ function arrayPush(array, values) { * else `false`. */ function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; + var index = -1, + length = array == null ? 0 : array.length; - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; } /** @@ -190,13 +211,13 @@ function arraySome(array, predicate) { * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); + var index = -1, + result = Array(n); - while (++index < n) { - result[index] = iteratee(index); - } - return result; + while (++index < n) { + result[index] = iteratee(index); + } + return result; } /** @@ -207,9 +228,9 @@ function baseTimes(n, iteratee) { * @returns {Function} Returns the new capped function. */ function baseUnary(func) { - return function(value) { - return func(value); - }; + return function (value) { + return func(value); + }; } /** @@ -221,7 +242,7 @@ function baseUnary(func) { * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { - return cache.has(key); + return cache.has(key); } /** @@ -233,7 +254,7 @@ function cacheHas(cache, key) { * @returns {*} Returns the property value. */ function getValue(object, key) { - return object == null ? undefined : object[key]; + return object == null ? undefined : object[key]; } /** @@ -244,13 +265,13 @@ function getValue(object, key) { * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { - var index = -1, - result = Array(map.size); + var index = -1, + result = Array(map.size); - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; + map.forEach(function (value, key) { + result[++index] = [key, value]; + }); + return result; } /** @@ -262,9 +283,9 @@ function mapToArray(map) { * @returns {Function} Returns the new function. */ function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; + return function (arg) { + return func(transform(arg)); + }; } /** @@ -275,22 +296,22 @@ function overArg(func, transform) { * @returns {Array} Returns the values. */ function setToArray(set) { - var index = -1, - result = Array(set.size); + var index = -1, + result = Array(set.size); - set.forEach(function(value) { - result[++index] = value; - }); - return result; + set.forEach(function (value) { + result[++index] = value; + }); + return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; + funcProto = Function.prototype, + objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; +var coreJsData = root["__core-js_shared__"]; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; @@ -299,10 +320,12 @@ var funcToString = funcProto.toString; var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); +var maskSrcKey = (function () { + var uid = /[^.]+$/.exec( + (coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO) || "", + ); + return uid ? "Symbol(src)_1." + uid : ""; +})(); /** * Used to resolve the @@ -312,42 +335,49 @@ var maskSrcKey = (function() { var nativeObjectToString = objectProto.toString; /** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +var reIsNative = RegExp( + "^" + + funcToString + .call(hasOwnProperty) + .replace(reRegExpChar, "\\$&") + .replace( + /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, + "$1.*?", + ) + + "$", ); /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, - Symbol = root.Symbol, - Uint8Array = root.Uint8Array, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - symToStringTag = Symbol ? Symbol.toStringTag : undefined; + Symbol = root.Symbol, + Uint8Array = root.Uint8Array, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeKeys = overArg(Object.keys, Object); + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ -var DataView = getNative(root, 'DataView'), - Map = getNative(root, 'Map'), - Promise = getNative(root, 'Promise'), - Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); +var DataView = getNative(root, "DataView"), + Map = getNative(root, "Map"), + Promise = getNative(root, "Promise"), + Set = getNative(root, "Set"), + WeakMap = getNative(root, "WeakMap"), + nativeCreate = getNative(Object, "create"); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * Creates a hash object. @@ -357,14 +387,14 @@ var symbolProto = Symbol ? Symbol.prototype : undefined, * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; + var index = -1, + length = entries == null ? 0 : entries.length; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } /** @@ -375,8 +405,8 @@ function Hash(entries) { * @memberOf Hash */ function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; } /** @@ -390,9 +420,9 @@ function hashClear() { * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; } /** @@ -405,12 +435,12 @@ function hashDelete(key) { * @returns {*} Returns the entry value. */ function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** @@ -423,8 +453,10 @@ function hashGet(key) { * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); + var data = this.__data__; + return nativeCreate + ? data[key] !== undefined + : hasOwnProperty.call(data, key); } /** @@ -438,15 +470,15 @@ function hashHas(key) { * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; + return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; +Hash.prototype["delete"] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; @@ -459,14 +491,14 @@ Hash.prototype.set = hashSet; * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; + var index = -1, + length = entries == null ? 0 : entries.length; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } /** @@ -477,8 +509,8 @@ function ListCache(entries) { * @memberOf ListCache */ function listCacheClear() { - this.__data__ = []; - this.size = 0; + this.__data__ = []; + this.size = 0; } /** @@ -491,20 +523,20 @@ function listCacheClear() { * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); + var data = this.__data__, + index = assocIndexOf(data, key); - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; } /** @@ -517,10 +549,10 @@ function listCacheDelete(key) { * @returns {*} Returns the entry value. */ function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); + var data = this.__data__, + index = assocIndexOf(data, key); - return index < 0 ? undefined : data[index][1]; + return index < 0 ? undefined : data[index][1]; } /** @@ -533,7 +565,7 @@ function listCacheGet(key) { * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; + return assocIndexOf(this.__data__, key) > -1; } /** @@ -547,21 +579,21 @@ function listCacheHas(key) { * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); + var data = this.__data__, + index = assocIndexOf(data, key); - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype["delete"] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; @@ -574,14 +606,14 @@ ListCache.prototype.set = listCacheSet; * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; + var index = -1, + length = entries == null ? 0 : entries.length; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } /** @@ -592,12 +624,12 @@ function MapCache(entries) { * @memberOf MapCache */ function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; + this.size = 0; + this.__data__ = { + hash: new Hash(), + map: new (Map || ListCache)(), + string: new Hash(), + }; } /** @@ -610,9 +642,9 @@ function mapCacheClear() { * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; + var result = getMapData(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; } /** @@ -625,7 +657,7 @@ function mapCacheDelete(key) { * @returns {*} Returns the entry value. */ function mapCacheGet(key) { - return getMapData(this, key).get(key); + return getMapData(this, key).get(key); } /** @@ -638,7 +670,7 @@ function mapCacheGet(key) { * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { - return getMapData(this, key).has(key); + return getMapData(this, key).has(key); } /** @@ -652,17 +684,17 @@ function mapCacheHas(key) { * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; + var data = getMapData(this, key), + size = data.size; - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype["delete"] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; @@ -676,13 +708,13 @@ MapCache.prototype.set = mapCacheSet; * @param {Array} [values] The values to cache. */ function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; + var index = -1, + length = values == null ? 0 : values.length; - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values[index]); + } } /** @@ -696,8 +728,8 @@ function SetCache(values) { * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; + this.__data__.set(value, HASH_UNDEFINED); + return this; } /** @@ -710,7 +742,7 @@ function setCacheAdd(value) { * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { - return this.__data__.has(value); + return this.__data__.has(value); } // Add methods to `SetCache`. @@ -725,8 +757,8 @@ SetCache.prototype.has = setCacheHas; * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; + var data = (this.__data__ = new ListCache(entries)); + this.size = data.size; } /** @@ -737,8 +769,8 @@ function Stack(entries) { * @memberOf Stack */ function stackClear() { - this.__data__ = new ListCache; - this.size = 0; + this.__data__ = new ListCache(); + this.size = 0; } /** @@ -751,11 +783,11 @@ function stackClear() { * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); + var data = this.__data__, + result = data["delete"](key); - this.size = data.size; - return result; + this.size = data.size; + return result; } /** @@ -768,7 +800,7 @@ function stackDelete(key) { * @returns {*} Returns the entry value. */ function stackGet(key) { - return this.__data__.get(key); + return this.__data__.get(key); } /** @@ -781,7 +813,7 @@ function stackGet(key) { * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { - return this.__data__.has(key); + return this.__data__.has(key); } /** @@ -795,24 +827,24 @@ function stackHas(key) { * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; -Stack.prototype['delete'] = stackDelete; +Stack.prototype["delete"] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; @@ -826,30 +858,34 @@ Stack.prototype.set = stackSet; * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ( + (inherited || hasOwnProperty.call(value, key)) && + !( + skipIndexes && + // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == "offset" || key == "parent")) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && + (key == "buffer" || key == "byteLength" || key == "byteOffset")) || + // Skip index properties. + isIndex(key, length)) + ) + ) { + result.push(key); + } + } + return result; } /** @@ -861,13 +897,13 @@ function arrayLikeKeys(value, inherited) { * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; } /** @@ -882,8 +918,8 @@ function assocIndexOf(array, key) { * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** @@ -894,12 +930,12 @@ function baseGetAllKeys(object, keysFunc, symbolsFunc) { * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return symToStringTag && symToStringTag in Object(value) + ? getRawTag(value) + : objectToString(value); } /** @@ -910,7 +946,7 @@ function baseGetTag(value) { * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; + return isObjectLike(value) && baseGetTag(value) == argsTag; } /** @@ -928,13 +964,17 @@ function baseIsArguments(value) { * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + if (value === other) { + return true; + } + if ( + value == null || + other == null || + (!isObjectLike(value) && !isObjectLike(other)) + ) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /** @@ -952,48 +992,56 @@ function baseIsEqual(value, other, bitmask, customizer, stack) { * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack()); + return objIsArr || isTypedArray(object) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag( + object, + other, + objTag, + bitmask, + customizer, + equalFunc, + stack, + ); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), + othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack()); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /** @@ -1005,11 +1053,11 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { * else `false`. */ function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } /** @@ -1020,8 +1068,11 @@ function baseIsNative(value) { * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + return ( + isObjectLike(value) && + isLength(value.length) && + !!typedArrayTags[baseGetTag(value)] + ); } /** @@ -1032,16 +1083,16 @@ function baseIsTypedArray(value) { * @returns {Array} Returns the array of property names. */ function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != "constructor") { + result.push(key); + } + } + return result; } /** @@ -1058,64 +1109,71 @@ function baseKeys(object) { * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if ( + !arraySome(other, function (othValue, othIndex) { + if ( + !cacheHas(seen, othIndex) && + (arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack)) + ) { + return seen.push(othIndex); + } + }) + ) { + result = false; + break; + } + } else if ( + !( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + ) + ) { + result = false; + break; + } + } + stack["delete"](array); + stack["delete"](other); + return result; } /** @@ -1136,68 +1194,79 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; + switch (tag) { + case dataViewTag: + if ( + object.byteLength != other.byteLength || + object.byteOffset != other.byteOffset + ) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ( + object.byteLength != other.byteLength || + !equalFunc(new Uint8Array(object), new Uint8Array(other)) + ) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == other + ""; + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays( + convert(object), + convert(other), + bitmask, + customizer, + equalFunc, + stack, + ); + stack["delete"](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; } /** @@ -1214,67 +1283,76 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if ( + !(compared === undefined + ? objValue === othValue || + equalFunc(objValue, othValue, bitmask, customizer, stack) + : compared) + ) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if ( + objCtor != othCtor && + "constructor" in object && + "constructor" in other && + !( + typeof objCtor == "function" && + objCtor instanceof objCtor && + typeof othCtor == "function" && + othCtor instanceof othCtor + ) + ) { + result = false; + } + } + stack["delete"](object); + stack["delete"](other); + return result; } /** @@ -1285,7 +1363,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); + return baseGetAllKeys(object, keys, getSymbols); } /** @@ -1297,10 +1375,10 @@ function getAllKeys(object) { * @returns {*} Returns the map data. */ function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == "string" ? "string" : "hash"] + : data.map; } /** @@ -1312,8 +1390,8 @@ function getMapData(map, key) { * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; } /** @@ -1324,23 +1402,23 @@ function getNative(object, key) { * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; } /** @@ -1350,15 +1428,17 @@ function getRawTag(value) { * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); -}; +var getSymbols = !nativeGetSymbols + ? stubArray + : function (object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function (symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; /** * Gets the `toStringTag` of `value`. @@ -1370,27 +1450,34 @@ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. -if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; +if ( + (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map()) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set()) != setTag) || + (WeakMap && getTag(new WeakMap()) != weakMapTag) +) { + getTag = function (value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ""; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + } + return result; + }; } /** @@ -1402,10 +1489,14 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); + length = length == null ? MAX_SAFE_INTEGER : length; + return ( + !!length && + (typeof value == "number" || reIsUint.test(value)) && + value > -1 && + value % 1 == 0 && + value < length + ); } /** @@ -1416,10 +1507,13 @@ function isIndex(value, length) { * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + var type = typeof value; + return type == "string" || + type == "number" || + type == "symbol" || + type == "boolean" + ? value !== "__proto__" + : value === null; } /** @@ -1430,7 +1524,7 @@ function isKeyable(value) { * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); + return !!maskSrcKey && maskSrcKey in func; } /** @@ -1441,10 +1535,10 @@ function isMasked(func) { * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + var Ctor = value && value.constructor, + proto = (typeof Ctor == "function" && Ctor.prototype) || objectProto; - return value === proto; + return value === proto; } /** @@ -1455,7 +1549,7 @@ function isPrototype(value) { * @returns {string} Returns the converted string. */ function objectToString(value) { - return nativeObjectToString.call(value); + return nativeObjectToString.call(value); } /** @@ -1466,15 +1560,15 @@ function objectToString(value) { * @returns {string} Returns the source code. */ function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return func + ""; + } catch (e) {} + } + return ""; } /** @@ -1510,7 +1604,7 @@ function toSource(func) { * // => true */ function eq(value, other) { - return value === other || (value !== value && other !== other); + return value === other || (value !== value && other !== other); } /** @@ -1531,10 +1625,19 @@ function eq(value, other) { * _.isArguments([1, 2, 3]); * // => false */ -var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); -}; +var isArguments = baseIsArguments( + (function () { + return arguments; + })(), +) + ? baseIsArguments + : function (value) { + return ( + isObjectLike(value) && + hasOwnProperty.call(value, "callee") && + !propertyIsEnumerable.call(value, "callee") + ); + }; /** * Checks if `value` is classified as an `Array` object. @@ -1587,7 +1690,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -1638,7 +1741,7 @@ var isBuffer = nativeIsBuffer || stubFalse; * // => false */ function isEqual(value, other) { - return baseIsEqual(value, other); + return baseIsEqual(value, other); } /** @@ -1659,13 +1762,13 @@ function isEqual(value, other) { * // => false */ function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /** @@ -1695,8 +1798,12 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return ( + typeof value == "number" && + value > -1 && + value % 1 == 0 && + value <= MAX_SAFE_INTEGER + ); } /** @@ -1725,8 +1832,8 @@ function isLength(value) { * // => false */ function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); + var type = typeof value; + return value != null && (type == "object" || type == "function"); } /** @@ -1754,7 +1861,7 @@ function isObject(value) { * // => false */ function isObjectLike(value) { - return value != null && typeof value == 'object'; + return value != null && typeof value == "object"; } /** @@ -1774,7 +1881,9 @@ function isObjectLike(value) { * _.isTypedArray([]); * // => false */ -var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; +var isTypedArray = nodeIsTypedArray + ? baseUnary(nodeIsTypedArray) + : baseIsTypedArray; /** * Creates an array of the own enumerable property names of `object`. @@ -1805,7 +1914,7 @@ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedA * // => ['0', '1'] */ function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** @@ -1827,7 +1936,7 @@ function keys(object) { * // => false */ function stubArray() { - return []; + return []; } /** @@ -1844,7 +1953,7 @@ function stubArray() { * // => [false, false] */ function stubFalse() { - return false; + return false; } export default isEqual; diff --git a/frontend/src/helpers/prefetch.ts b/frontend/src/helpers/prefetch.ts index 0f6c3189da..632c5181e9 100644 --- a/frontend/src/helpers/prefetch.ts +++ b/frontend/src/helpers/prefetch.ts @@ -1,4 +1,4 @@ -import { ApolloClient } from "@apollo/client/core"; +import type { ApolloClient } from "@apollo/client/core"; import { queryFooter, queryHeader } from "~/types"; diff --git a/frontend/src/helpers/use-current-user.tsx b/frontend/src/helpers/use-current-user.tsx index 9932f850d4..bb82a66afd 100644 --- a/frontend/src/helpers/use-current-user.tsx +++ b/frontend/src/helpers/use-current-user.tsx @@ -1,4 +1,4 @@ -import { CurrentUserQueryResult, useCurrentUserQuery } from "~/types"; +import { type CurrentUserQueryResult, useCurrentUserQuery } from "~/types"; type CurrentUser = { loading: boolean; diff --git a/frontend/src/pages/[slug]/index.tsx b/frontend/src/pages/[slug]/index.tsx index 3ae137e8e8..0cc691bb12 100644 --- a/frontend/src/pages/[slug]/index.tsx +++ b/frontend/src/pages/[slug]/index.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { GetStaticPaths } from "next"; +import type { GetStaticPaths } from "next"; import { useRouter } from "next/router"; import { getApolloClient } from "~/apollo/client"; diff --git a/frontend/src/pages/_error.tsx b/frontend/src/pages/_error.tsx index a6ad0ed336..ba0bab4862 100644 --- a/frontend/src/pages/_error.tsx +++ b/frontend/src/pages/_error.tsx @@ -1,7 +1,7 @@ import { Heading, Page, Section } from "@python-italia/pycon-styleguide"; import * as Sentry from "@sentry/nextjs"; -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import NextErrorComponent from "next/error"; import { addApolloState, getApolloClient } from "~/apollo/client"; diff --git a/frontend/src/pages/api/[lang]/social-card.tsx b/frontend/src/pages/api/[lang]/social-card.tsx index e0f1cb82b5..cb886fa9a5 100644 --- a/frontend/src/pages/api/[lang]/social-card.tsx +++ b/frontend/src/pages/api/[lang]/social-card.tsx @@ -4,7 +4,7 @@ import type { NextRequest } from "next/server"; import { createClient } from "~/apollo/create-client"; import { Logo } from "~/components/logo"; -import { Language } from "~/locale/languages"; +import type { Language } from "~/locale/languages"; import { querySocialCard } from "~/types"; export const config = { diff --git a/frontend/src/pages/b/[hashid].tsx b/frontend/src/pages/b/[hashid].tsx index 1b59382435..f014118381 100644 --- a/frontend/src/pages/b/[hashid].tsx +++ b/frontend/src/pages/b/[hashid].tsx @@ -1,4 +1,4 @@ -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { getApolloClient } from "~/apollo/client"; import { queryTicketIdToUserHashid } from "~/types"; diff --git a/frontend/src/pages/grants/edit/index.tsx b/frontend/src/pages/grants/edit/index.tsx index 00e48ade57..5fdda444e9 100644 --- a/frontend/src/pages/grants/edit/index.tsx +++ b/frontend/src/pages/grants/edit/index.tsx @@ -1,13 +1,13 @@ import { Heading, Page, Section } from "@python-italia/pycon-styleguide"; import { FormattedMessage } from "react-intl"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { GrantForm } from "~/components/grant-form"; import { prefetchSharedQueries } from "~/helpers/prefetch"; import { - UpdateGrantInput, + type UpdateGrantInput, queryCurrentUser, queryGrantDeadline, queryMyGrant, diff --git a/frontend/src/pages/grants/index.tsx b/frontend/src/pages/grants/index.tsx index 9282fb5d0f..75c41f02f8 100644 --- a/frontend/src/pages/grants/index.tsx +++ b/frontend/src/pages/grants/index.tsx @@ -2,7 +2,7 @@ import { Page, Text } from "@python-italia/pycon-styleguide"; import React from "react"; import { FormattedMessage } from "react-intl"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { MyGrantOrForm } from "~/components/grant-form"; diff --git a/frontend/src/pages/index.tsx b/frontend/src/pages/index.tsx index 8496583af8..bf552a2f0d 100644 --- a/frontend/src/pages/index.tsx +++ b/frontend/src/pages/index.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { PageHandler } from "~/components/page-handler"; import { getStaticProps as baseGetStaticProps } from "~/components/page-handler/page-static-props"; diff --git a/frontend/src/pages/jobs/[id].tsx b/frontend/src/pages/jobs/[id].tsx index 8be163e43c..7111996040 100644 --- a/frontend/src/pages/jobs/[id].tsx +++ b/frontend/src/pages/jobs/[id].tsx @@ -1,4 +1,4 @@ -import { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/jobs/index.tsx b/frontend/src/pages/jobs/index.tsx index 7ef1c7c80b..9a88be728f 100644 --- a/frontend/src/pages/jobs/index.tsx +++ b/frontend/src/pages/jobs/index.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/keynotes/[slug]/index.tsx b/frontend/src/pages/keynotes/[slug]/index.tsx index 09e2132411..10945f3bde 100644 --- a/frontend/src/pages/keynotes/[slug]/index.tsx +++ b/frontend/src/pages/keynotes/[slug]/index.tsx @@ -2,7 +2,7 @@ import { Page } from "@python-italia/pycon-styleguide"; import React from "react"; import { FormattedMessage } from "react-intl"; -import { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps } from "next"; import { useRouter } from "next/router"; import { addApolloState, getApolloClient } from "~/apollo/client"; diff --git a/frontend/src/pages/keynotes/index.tsx b/frontend/src/pages/keynotes/index.tsx index d412d145f3..85612984f1 100644 --- a/frontend/src/pages/keynotes/index.tsx +++ b/frontend/src/pages/keynotes/index.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/login/index.tsx b/frontend/src/pages/login/index.tsx index aab2a4f3ee..c76e85b3ee 100644 --- a/frontend/src/pages/login/index.tsx +++ b/frontend/src/pages/login/index.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/news/[slug]/index.tsx b/frontend/src/pages/news/[slug]/index.tsx index 2a45897435..4fc076ffed 100755 --- a/frontend/src/pages/news/[slug]/index.tsx +++ b/frontend/src/pages/news/[slug]/index.tsx @@ -10,7 +10,7 @@ import { import { parseISO } from "date-fns"; import { FormattedMessage } from "react-intl"; -import { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps } from "next"; import { useRouter } from "next/router"; import { addApolloState, getApolloClient } from "~/apollo/client"; @@ -19,8 +19,8 @@ import { usePageOrPreview } from "~/components/page-handler/use-page-or-preview" import { prefetchSharedQueries } from "~/helpers/prefetch"; import { useCurrentLanguage } from "~/locale/context"; import { - NewsArticleQuery, - PagePreviewQuery, + type NewsArticleQuery, + type PagePreviewQuery, queryAllNewsArticles, queryNewsArticle, queryPagePreview, diff --git a/frontend/src/pages/orders/[id]/confirmation.tsx b/frontend/src/pages/orders/[id]/confirmation.tsx index 5918f89961..ccff91a25a 100644 --- a/frontend/src/pages/orders/[id]/confirmation.tsx +++ b/frontend/src/pages/orders/[id]/confirmation.tsx @@ -11,7 +11,7 @@ import { import React from "react"; import { FormattedMessage } from "react-intl"; -import { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps } from "next"; import { useRouter } from "next/router"; import { addApolloState, getApolloClient } from "~/apollo/client"; diff --git a/frontend/src/pages/profile/[hashid].tsx b/frontend/src/pages/profile/[hashid].tsx index befd6812e8..827df42d10 100644 --- a/frontend/src/pages/profile/[hashid].tsx +++ b/frontend/src/pages/profile/[hashid].tsx @@ -1,4 +1,4 @@ -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/profile/index.tsx b/frontend/src/pages/profile/index.tsx index 0d1d08e4ec..e5727a8707 100644 --- a/frontend/src/pages/profile/index.tsx +++ b/frontend/src/pages/profile/index.tsx @@ -1,4 +1,4 @@ -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/profile/my-orders.tsx b/frontend/src/pages/profile/my-orders.tsx index b54ac63c05..f53b3a0d84 100644 --- a/frontend/src/pages/profile/my-orders.tsx +++ b/frontend/src/pages/profile/my-orders.tsx @@ -1,4 +1,4 @@ -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/profile/my-proposals.tsx b/frontend/src/pages/profile/my-proposals.tsx index 067c085ac0..14f2ea2381 100644 --- a/frontend/src/pages/profile/my-proposals.tsx +++ b/frontend/src/pages/profile/my-proposals.tsx @@ -1,4 +1,4 @@ -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/profile/sponsor.tsx b/frontend/src/pages/profile/sponsor.tsx index fe296a9e07..5f75576d43 100644 --- a/frontend/src/pages/profile/sponsor.tsx +++ b/frontend/src/pages/profile/sponsor.tsx @@ -1,4 +1,4 @@ -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/reset-password/[token].tsx b/frontend/src/pages/reset-password/[token].tsx index 4ec6e8f9dd..a28198ac42 100644 --- a/frontend/src/pages/reset-password/[token].tsx +++ b/frontend/src/pages/reset-password/[token].tsx @@ -1,4 +1,4 @@ -import { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/reset-password/index.tsx b/frontend/src/pages/reset-password/index.tsx index 90e0826d68..cd89998d76 100644 --- a/frontend/src/pages/reset-password/index.tsx +++ b/frontend/src/pages/reset-password/index.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/reset-password/password-changed.tsx b/frontend/src/pages/reset-password/password-changed.tsx index aeb4530d51..c28bcc52cf 100644 --- a/frontend/src/pages/reset-password/password-changed.tsx +++ b/frontend/src/pages/reset-password/password-changed.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/reset-password/success.tsx b/frontend/src/pages/reset-password/success.tsx index 87e8e33b0c..cf89e9c2e9 100644 --- a/frontend/src/pages/reset-password/success.tsx +++ b/frontend/src/pages/reset-password/success.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/schedule/[day]/index.tsx b/frontend/src/pages/schedule/[day]/index.tsx index 0a2473af27..2309d26bb0 100644 --- a/frontend/src/pages/schedule/[day]/index.tsx +++ b/frontend/src/pages/schedule/[day]/index.tsx @@ -1,9 +1,9 @@ import { stringify } from "querystring"; import { Page } from "@python-italia/pycon-styleguide"; -import React, { useState } from "react"; +import { useState } from "react"; import { FormattedMessage } from "react-intl"; -import { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps } from "next"; import { useRouter } from "next/router"; import { addApolloState, getApolloClient } from "~/apollo/client"; @@ -13,9 +13,9 @@ import { ScheduleView } from "~/components/schedule-view"; import { prefetchSharedQueries } from "~/helpers/prefetch"; import { useCurrentUser } from "~/helpers/use-current-user"; import { useCurrentLanguage } from "~/locale/context"; -import { Language } from "~/locale/languages"; +import type { Language } from "~/locale/languages"; import { - ScheduleQuery, + type ScheduleQuery, querySchedule, queryScheduleDays, useScheduleQuery, diff --git a/frontend/src/pages/signup.tsx b/frontend/src/pages/signup.tsx index 9ba5cb1020..d50b41b19f 100644 --- a/frontend/src/pages/signup.tsx +++ b/frontend/src/pages/signup.tsx @@ -1,4 +1,4 @@ -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { prefetchSharedQueries } from "~/helpers/prefetch"; diff --git a/frontend/src/pages/submission/[id]/index.tsx b/frontend/src/pages/submission/[id]/index.tsx index 606967fb9c..ddce6ebda7 100644 --- a/frontend/src/pages/submission/[id]/index.tsx +++ b/frontend/src/pages/submission/[id]/index.tsx @@ -7,7 +7,7 @@ import { import React from "react"; import { FormattedMessage } from "react-intl"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { useRouter } from "next/router"; import { addApolloState, getApolloClient } from "~/apollo/client"; diff --git a/frontend/src/pages/tickets/business.tsx b/frontend/src/pages/tickets/business.tsx index 5fdbe26d3f..ae63cf3fa4 100644 --- a/frontend/src/pages/tickets/business.tsx +++ b/frontend/src/pages/tickets/business.tsx @@ -2,7 +2,7 @@ import { Heading, Section } from "@python-italia/pycon-styleguide"; import React from "react"; import { FormattedMessage } from "react-intl"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { Tickets } from "~/components/tickets-page/tickets"; diff --git a/frontend/src/pages/tickets/checkout.tsx b/frontend/src/pages/tickets/checkout.tsx index d3e6a3e7aa..3755be4f65 100644 --- a/frontend/src/pages/tickets/checkout.tsx +++ b/frontend/src/pages/tickets/checkout.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { CheckoutPageHandler } from "~/components/checkout-page-handler"; diff --git a/frontend/src/pages/tickets/index.tsx b/frontend/src/pages/tickets/index.tsx index 15ce435c50..3a9b81ef5e 100644 --- a/frontend/src/pages/tickets/index.tsx +++ b/frontend/src/pages/tickets/index.tsx @@ -11,7 +11,7 @@ import { import { SnakeHead } from "@python-italia/pycon-styleguide/illustrations"; import { FormattedMessage } from "react-intl"; -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { createHref } from "~/components/link"; diff --git a/frontend/src/pages/tickets/personal.tsx b/frontend/src/pages/tickets/personal.tsx index 5eed977181..f9392a59e5 100644 --- a/frontend/src/pages/tickets/personal.tsx +++ b/frontend/src/pages/tickets/personal.tsx @@ -2,7 +2,7 @@ import { Heading, Section } from "@python-italia/pycon-styleguide"; import React from "react"; import { FormattedMessage } from "react-intl"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import { addApolloState, getApolloClient } from "~/apollo/client"; import { Tickets } from "~/components/tickets-page/tickets"; diff --git a/frontend/src/pages/voting/index.tsx b/frontend/src/pages/voting/index.tsx index 5fdc0700f9..c8e09b1249 100644 --- a/frontend/src/pages/voting/index.tsx +++ b/frontend/src/pages/voting/index.tsx @@ -16,7 +16,7 @@ import { import React, { useEffect, useState } from "react"; import { FormattedMessage } from "react-intl"; -import { GetStaticProps } from "next"; +import type { GetStaticProps } from "next"; import { useRouter } from "next/router"; import { addApolloState, getApolloClient } from "~/apollo/client"; @@ -131,7 +131,7 @@ export const VotingPage = () => { audienceLevels: getAsArray(router.query.audienceLevels) ?? [], }); - setCurrentPage(parseInt(router.query.page as string) || 1); + setCurrentPage(Number.parseInt(router.query.page as string) || 1); }, [router.isReady]); const { data: votingMetadata } = useVotingMetadataQuery({ diff --git a/frontend/src/test-utils.tsx b/frontend/src/test-utils.tsx index c2ba052bbe..85b5040500 100644 --- a/frontend/src/test-utils.tsx +++ b/frontend/src/test-utils.tsx @@ -1,12 +1,12 @@ import { + type MockedProviderProps, MockedProvider as OriginalMockedProvider, - MockedProviderProps, } from "@apollo/client/testing"; import { - RenderOptions, + type RenderOptions, render as originalRender, } from "@testing-library/react"; -import React, { ReactElement } from "react"; +import React, { type ReactElement } from "react"; import { RawIntlProvider, createIntl, createIntlCache } from "react-intl"; import messages from "~/locale"; diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 8767e3cf2f..4dcdb1cd32 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -30,5 +30,10 @@ "incremental": true }, "exclude": ["node_modules"], - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/helpers/lodash-is-equal.ts"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + "src/helpers/lodash-is-equal.ts" + ] }