diff --git a/.eslintrc.js b/.eslintrc.js index f8250bec61..d61dd21569 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,6 +51,7 @@ module.exports = { }, }, ], + '@typescript-eslint/consistent-type-imports': 'error', }, overrides: [ { diff --git a/examples/e-commerce/src/routing.ts b/examples/e-commerce/src/routing.ts index 3ca55085ed..cbf5d2b9d7 100644 --- a/examples/e-commerce/src/routing.ts +++ b/examples/e-commerce/src/routing.ts @@ -1,9 +1,7 @@ /* eslint complexity: off */ -import { - history as historyRouter, - UiState, -} from 'instantsearch.js/es/lib/routers'; +import type { UiState } from 'instantsearch.js/es/lib/routers'; +import { history as historyRouter } from 'instantsearch.js/es/lib/routers'; import { getFallbackHitsPerPageRoutingValue, getFallbackSortByRoutingValue, diff --git a/scripts/jest/matchers/__tests__/toWarnDev-test.ts b/scripts/jest/matchers/__tests__/toWarnDev-test.ts index cd3a032c26..7f8c45bd6d 100644 --- a/scripts/jest/matchers/__tests__/toWarnDev-test.ts +++ b/scripts/jest/matchers/__tests__/toWarnDev-test.ts @@ -1,5 +1,9 @@ /* eslint-disable no-console */ +// export is needed for TS isolatedModules +// eslint-disable-next-line jest/no-export +export {}; + describe('toWarnDev', () => { describe('usage', () => { test('fails with incorrect type of message', () => { diff --git a/src/components/Answers/Answers.tsx b/src/components/Answers/Answers.tsx index 863957ab56..2bcbc71fd1 100644 --- a/src/components/Answers/Answers.tsx +++ b/src/components/Answers/Answers.tsx @@ -3,11 +3,11 @@ import { h } from 'preact'; import cx from 'classnames'; import Template from '../Template/Template'; -import { +import type { AnswersCSSClasses, AnswersTemplates, } from '../../widgets/answers/answers'; -import { ComponentCSSClasses, Hits } from '../../types'; +import type { ComponentCSSClasses, Hits } from '../../types'; export type AnswersComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/Answers/__tests__/Answers-test.tsx b/src/components/Answers/__tests__/Answers-test.tsx index b201b891b4..7a6e2a4d53 100644 --- a/src/components/Answers/__tests__/Answers-test.tsx +++ b/src/components/Answers/__tests__/Answers-test.tsx @@ -2,7 +2,8 @@ import { h } from 'preact'; import { render } from '@testing-library/preact'; -import Answers, { AnswersProps } from '../Answers'; +import type { AnswersProps } from '../Answers'; +import Answers from '../Answers'; const defaultProps: AnswersProps = { hits: [], diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx index 38a7b6d989..01b2a6be2c 100644 --- a/src/components/Breadcrumb/Breadcrumb.tsx +++ b/src/components/Breadcrumb/Breadcrumb.tsx @@ -3,13 +3,13 @@ import { h } from 'preact'; import cx from 'classnames'; import Template from '../Template/Template'; -import { +import type { BreadcrumbCSSClasses, BreadcrumbTemplates, } from '../../widgets/breadcrumb/breadcrumb'; -import { ComponentCSSClasses } from '../../types'; -import { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; -import { BreadcrumbConnectorParamsItem } from '../../connectors/breadcrumb/connectBreadcrumb'; +import type { ComponentCSSClasses } from '../../types'; +import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; +import type { BreadcrumbConnectorParamsItem } from '../../connectors/breadcrumb/connectBreadcrumb'; export type BreadcrumbComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/Breadcrumb/__tests__/Breadcrumb-test.tsx b/src/components/Breadcrumb/__tests__/Breadcrumb-test.tsx index 8231cef555..85cf7d9f1b 100644 --- a/src/components/Breadcrumb/__tests__/Breadcrumb-test.tsx +++ b/src/components/Breadcrumb/__tests__/Breadcrumb-test.tsx @@ -2,7 +2,8 @@ import { h } from 'preact'; import { render, fireEvent } from '@testing-library/preact'; -import Breadcrumb, { BreadcrumbProps } from '../Breadcrumb'; +import type { BreadcrumbProps } from '../Breadcrumb'; +import Breadcrumb from '../Breadcrumb'; import { prepareTemplateProps } from '../../../lib/utils'; import defaultTemplates from '../../../widgets/breadcrumb/defaultTemplates'; diff --git a/src/components/ClearRefinements/ClearRefinements.tsx b/src/components/ClearRefinements/ClearRefinements.tsx index ef32af8844..82c31530f1 100644 --- a/src/components/ClearRefinements/ClearRefinements.tsx +++ b/src/components/ClearRefinements/ClearRefinements.tsx @@ -3,13 +3,13 @@ import { h } from 'preact'; import cx from 'classnames'; import Template from '../Template/Template'; -import { ClearRefinementsRenderState } from '../../connectors/clear-refinements/connectClearRefinements'; -import { +import type { ClearRefinementsRenderState } from '../../connectors/clear-refinements/connectClearRefinements'; +import type { ClearRefinementsCSSClasses, ClearRefinementsTemplates, } from '../../widgets/clear-refinements/clear-refinements'; -import { ComponentCSSClasses } from '../../types'; -import { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; +import type { ComponentCSSClasses } from '../../types'; +import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; export type ClearRefinementsComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/CurrentRefinements/CurrentRefinements.tsx b/src/components/CurrentRefinements/CurrentRefinements.tsx index cd2f0d5aa2..a06586a727 100644 --- a/src/components/CurrentRefinements/CurrentRefinements.tsx +++ b/src/components/CurrentRefinements/CurrentRefinements.tsx @@ -2,12 +2,12 @@ import { h } from 'preact'; import { isSpecialClick, capitalize } from '../../lib/utils'; -import { +import type { CurrentRefinementsConnectorParamsItem, CurrentRefinementsConnectorParamsRefinement, } from '../../connectors/current-refinements/connectCurrentRefinements'; -import { CurrentRefinementsCSSClasses } from '../../widgets/current-refinements/current-refinements'; -import { ComponentCSSClasses } from '../../types'; +import type { CurrentRefinementsCSSClasses } from '../../widgets/current-refinements/current-refinements'; +import type { ComponentCSSClasses } from '../../types'; export type CurrentRefinementsComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/GeoSearchControls/GeoSearchButton.tsx b/src/components/GeoSearchControls/GeoSearchButton.tsx index 695b81a7bd..0667543dc0 100644 --- a/src/components/GeoSearchControls/GeoSearchButton.tsx +++ b/src/components/GeoSearchControls/GeoSearchButton.tsx @@ -1,6 +1,7 @@ /** @jsx h */ -import { h, ComponentChildren } from 'preact'; +import type { ComponentChildren } from 'preact'; +import { h } from 'preact'; type Props = { className: string; diff --git a/src/components/GeoSearchControls/GeoSearchControls.tsx b/src/components/GeoSearchControls/GeoSearchControls.tsx index 3e2add2016..6a40638b50 100644 --- a/src/components/GeoSearchControls/GeoSearchControls.tsx +++ b/src/components/GeoSearchControls/GeoSearchControls.tsx @@ -5,12 +5,12 @@ import cx from 'classnames'; import Template from '../Template/Template'; import GeoSearchButton from './GeoSearchButton'; import GeoSearchToggle from './GeoSearchToggle'; -import { +import type { GeoSearchCSSClasses, GeoSearchTemplates, } from '../../widgets/geo-search/geo-search'; -import { ComponentCSSClasses } from '../../types'; -import { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; +import type { ComponentCSSClasses } from '../../types'; +import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; type Props = { cssClasses: ComponentCSSClasses; diff --git a/src/components/GeoSearchControls/GeoSearchToggle.tsx b/src/components/GeoSearchControls/GeoSearchToggle.tsx index 945914e937..62e98ef506 100644 --- a/src/components/GeoSearchControls/GeoSearchToggle.tsx +++ b/src/components/GeoSearchControls/GeoSearchToggle.tsx @@ -1,6 +1,7 @@ /** @jsx h */ -import { h, ComponentChildren } from 'preact'; +import type { ComponentChildren } from 'preact'; +import { h } from 'preact'; type Props = { classNameLabel: string; diff --git a/src/components/Hits/Hits.tsx b/src/components/Hits/Hits.tsx index 119e796f61..5cbfd2fd15 100644 --- a/src/components/Hits/Hits.tsx +++ b/src/components/Hits/Hits.tsx @@ -3,11 +3,11 @@ import { h } from 'preact'; import cx from 'classnames'; import Template from '../Template/Template'; -import { SearchResults } from 'algoliasearch-helper'; -import { BindEventForHits, SendEventForHits } from '../../lib/utils'; -import { ComponentCSSClasses, Hits as HitsArray } from '../../types'; -import { HitsCSSClasses, HitsTemplates } from '../../widgets/hits/hits'; -import { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; +import type { SearchResults } from 'algoliasearch-helper'; +import type { BindEventForHits, SendEventForHits } from '../../lib/utils'; +import type { ComponentCSSClasses, Hits as HitsArray } from '../../types'; +import type { HitsCSSClasses, HitsTemplates } from '../../widgets/hits/hits'; +import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; export type HitsComponentCSSClasses = ComponentCSSClasses; export type HitsComponentTemplates = Required; diff --git a/src/components/Hits/__tests__/Hits-test.tsx b/src/components/Hits/__tests__/Hits-test.tsx index 5b2f50433b..d12baa1254 100644 --- a/src/components/Hits/__tests__/Hits-test.tsx +++ b/src/components/Hits/__tests__/Hits-test.tsx @@ -5,7 +5,8 @@ import { shallow, mount } from '../../../../test/utils/enzyme'; import { highlight } from '../../../helpers'; import { prepareTemplateProps, TAG_REPLACEMENT } from '../../../lib/utils'; import Template from '../../Template/Template'; -import Hits, { HitsProps } from '../Hits'; +import type { HitsProps } from '../Hits'; +import Hits from '../Hits'; import { createSingleSearchResponse } from '../../../../test/mock/createAPIResponse'; import { SearchParameters, SearchResults } from 'algoliasearch-helper'; import defaultTemplates from '../../../widgets/hits/defaultTemplates'; diff --git a/src/components/InfiniteHits/InfiniteHits.tsx b/src/components/InfiniteHits/InfiniteHits.tsx index d29a1be715..0cf5f6a58f 100644 --- a/src/components/InfiniteHits/InfiniteHits.tsx +++ b/src/components/InfiniteHits/InfiniteHits.tsx @@ -3,13 +3,13 @@ import { h } from 'preact'; import cx from 'classnames'; import Template from '../Template/Template'; -import { SearchResults } from 'algoliasearch-helper'; -import { ComponentCSSClasses, Hits } from '../../types'; -import { +import type { SearchResults } from 'algoliasearch-helper'; +import type { ComponentCSSClasses, Hits } from '../../types'; +import type { InfiniteHitsCSSClasses, InfiniteHitsTemplates, } from '../../widgets/infinite-hits/infinite-hits'; -import { SendEventForHits, BindEventForHits } from '../../lib/utils'; +import type { SendEventForHits, BindEventForHits } from '../../lib/utils'; export type InfiniteHitsComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/InfiniteHits/__tests__/InfiniteHits-test.tsx b/src/components/InfiniteHits/__tests__/InfiniteHits-test.tsx index a3d3e64454..e1eec8aef6 100644 --- a/src/components/InfiniteHits/__tests__/InfiniteHits-test.tsx +++ b/src/components/InfiniteHits/__tests__/InfiniteHits-test.tsx @@ -4,7 +4,7 @@ import { h } from 'preact'; import { render } from '@testing-library/preact'; import { SearchParameters, SearchResults } from 'algoliasearch-helper'; import InfiniteHits from '../InfiniteHits'; -import { Hits, SearchResponse } from '../../../types'; +import type { Hits, SearchResponse } from '../../../types'; import { createSingleSearchResponse } from '../../../../test/mock/createAPIResponse'; function createResults(partialResults: Partial>) { diff --git a/src/components/MenuSelect/MenuSelect.tsx b/src/components/MenuSelect/MenuSelect.tsx index 8712663a6d..d71f24a24c 100644 --- a/src/components/MenuSelect/MenuSelect.tsx +++ b/src/components/MenuSelect/MenuSelect.tsx @@ -4,12 +4,12 @@ import { h } from 'preact'; import cx from 'classnames'; import { find } from '../../lib/utils'; import Template from '../Template/Template'; -import { +import type { MenuSelectCSSClasses, MenuSelectTemplates, } from '../../widgets/menu-select/menu-select'; -import { MenuRenderState } from '../../connectors/menu/connectMenu'; -import { ComponentCSSClasses } from '../../types'; +import type { MenuRenderState } from '../../connectors/menu/connectMenu'; +import type { ComponentCSSClasses } from '../../types'; export type MenuSelectComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/Pagination/Pagination.tsx b/src/components/Pagination/Pagination.tsx index 75ec53ecf6..c66ab675b0 100644 --- a/src/components/Pagination/Pagination.tsx +++ b/src/components/Pagination/Pagination.tsx @@ -5,11 +5,11 @@ import cx from 'classnames'; import PaginationLink from './PaginationLink'; import { isSpecialClick } from '../../lib/utils'; -import { +import type { PaginationCSSClasses, PaginationTemplates, } from '../../widgets/pagination/pagination'; -import { ComponentCSSClasses } from '../../types'; +import type { ComponentCSSClasses } from '../../types'; export type PaginationComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/Pagination/__tests__/Pagination-test.tsx b/src/components/Pagination/__tests__/Pagination-test.tsx index 6cbb4460be..a563776d37 100644 --- a/src/components/Pagination/__tests__/Pagination-test.tsx +++ b/src/components/Pagination/__tests__/Pagination-test.tsx @@ -2,7 +2,8 @@ import { h } from 'preact'; import { mount } from '../../../../test/utils/enzyme'; -import Pagination, { PaginationProps } from '../Pagination'; +import type { PaginationProps } from '../Pagination'; +import Pagination from '../Pagination'; import Paginator from '../../../connectors/pagination/Paginator'; describe('Pagination', () => { diff --git a/src/components/Panel/Panel.tsx b/src/components/Panel/Panel.tsx index 942135642b..dfc0df3e8b 100644 --- a/src/components/Panel/Panel.tsx +++ b/src/components/Panel/Panel.tsx @@ -4,8 +4,11 @@ import { h } from 'preact'; import { useState, useEffect, useRef } from 'preact/hooks'; import cx from 'classnames'; import Template from '../Template/Template'; -import { PanelCSSClasses, PanelTemplates } from '../../widgets/panel/panel'; -import { +import type { + PanelCSSClasses, + PanelTemplates, +} from '../../widgets/panel/panel'; +import type { ComponentCSSClasses, RenderOptions, UnknownWidgetFactory, diff --git a/src/components/Panel/__tests__/Panel-test.tsx b/src/components/Panel/__tests__/Panel-test.tsx index b3673206e3..4d2d5913bf 100644 --- a/src/components/Panel/__tests__/Panel-test.tsx +++ b/src/components/Panel/__tests__/Panel-test.tsx @@ -2,7 +2,8 @@ import { h } from 'preact'; import { render, fireEvent } from '@testing-library/preact'; -import Panel, { PanelProps } from '../Panel'; +import type { PanelProps } from '../Panel'; +import Panel from '../Panel'; import { createRenderOptions } from '../../../../test/mock/createWidget'; const cssClasses = { diff --git a/src/components/PoweredBy/PoweredBy.tsx b/src/components/PoweredBy/PoweredBy.tsx index 0cfef90509..373d75e4af 100644 --- a/src/components/PoweredBy/PoweredBy.tsx +++ b/src/components/PoweredBy/PoweredBy.tsx @@ -1,8 +1,8 @@ /** @jsx h */ import { h } from 'preact'; -import { ComponentCSSClasses } from '../../types'; -import { PoweredByCSSClasses } from '../../widgets/powered-by/powered-by'; +import type { ComponentCSSClasses } from '../../types'; +import type { PoweredByCSSClasses } from '../../widgets/powered-by/powered-by'; export type PoweredByComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/QueryRuleCustomData/QueryRuleCustomData.tsx b/src/components/QueryRuleCustomData/QueryRuleCustomData.tsx index fd8494311e..145d6f10f1 100644 --- a/src/components/QueryRuleCustomData/QueryRuleCustomData.tsx +++ b/src/components/QueryRuleCustomData/QueryRuleCustomData.tsx @@ -1,8 +1,8 @@ /** @jsx h */ import { h } from 'preact'; -import { ComponentCSSClasses } from '../../types'; -import { +import type { ComponentCSSClasses } from '../../types'; +import type { QueryRuleCustomDataCSSClasses, QueryRuleCustomDataTemplates, } from '../../widgets/query-rule-custom-data/query-rule-custom-data'; diff --git a/src/components/RangeInput/RangeInput.tsx b/src/components/RangeInput/RangeInput.tsx index 60a4b04897..99bd8e5a4d 100644 --- a/src/components/RangeInput/RangeInput.tsx +++ b/src/components/RangeInput/RangeInput.tsx @@ -3,12 +3,15 @@ import { h, Component } from 'preact'; import cx from 'classnames'; import Template from '../Template/Template'; -import { +import type { RangeInputCSSClasses, RangeInputTemplates, } from '../../widgets/range-input/range-input'; -import { Range, RangeBoundaries } from '../../connectors/range/connectRange'; -import { ComponentCSSClasses } from '../../types'; +import type { + Range, + RangeBoundaries, +} from '../../connectors/range/connectRange'; +import type { ComponentCSSClasses } from '../../types'; export type RangeInputComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/RangeInput/__tests__/RangeInput-test.tsx b/src/components/RangeInput/__tests__/RangeInput-test.tsx index 226d56b2de..2a0b109ff8 100644 --- a/src/components/RangeInput/__tests__/RangeInput-test.tsx +++ b/src/components/RangeInput/__tests__/RangeInput-test.tsx @@ -3,7 +3,8 @@ import { h } from 'preact'; import { shallow } from '../../../../test/utils/enzyme'; import { render, fireEvent } from '@testing-library/preact'; -import RangeInput, { RangeInputProps } from '../RangeInput'; +import type { RangeInputProps } from '../RangeInput'; +import RangeInput from '../RangeInput'; describe('RangeInput', () => { const defaultProps: RangeInputProps = { diff --git a/src/components/RefinementList/RefinementList.tsx b/src/components/RefinementList/RefinementList.tsx index 5516bc488f..586f3d13b6 100644 --- a/src/components/RefinementList/RefinementList.tsx +++ b/src/components/RefinementList/RefinementList.tsx @@ -1,20 +1,22 @@ /** @jsx h */ +import type { JSX } from 'preact'; import { h, createRef, Component } from 'preact'; import cx from 'classnames'; import { isSpecialClick, isEqual } from '../../lib/utils'; -import { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; +import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps'; import Template from '../Template/Template'; import RefinementListItem from './RefinementListItem'; -import SearchBox, { +import type { SearchBoxComponentCSSClasses, SearchBoxComponentTemplates, } from '../SearchBox/SearchBox'; -import { HierarchicalMenuItem } from '../../connectors/hierarchical-menu/connectHierarchicalMenu'; -import { ComponentCSSClasses, CreateURL, Templates } from '../../types'; -import { RefinementListOwnCSSClasses } from '../../widgets/refinement-list/refinement-list'; -import { RatingMenuComponentCSSClasses } from '../../widgets/rating-menu/rating-menu'; -import { HierarchicalMenuComponentCSSClasses } from '../../widgets/hierarchical-menu/hierarchical-menu'; +import SearchBox from '../SearchBox/SearchBox'; +import type { HierarchicalMenuItem } from '../../connectors/hierarchical-menu/connectHierarchicalMenu'; +import type { ComponentCSSClasses, CreateURL, Templates } from '../../types'; +import type { RefinementListOwnCSSClasses } from '../../widgets/refinement-list/refinement-list'; +import type { RatingMenuComponentCSSClasses } from '../../widgets/rating-menu/rating-menu'; +import type { HierarchicalMenuComponentCSSClasses } from '../../widgets/hierarchical-menu/hierarchical-menu'; // CSS types type RefinementListOptionalClasses = @@ -66,7 +68,7 @@ export type RefinementListProps = { hasExhaustiveItems?: boolean; canToggleShowMore?: boolean; className?: string; - children?: h.JSX.Element; + children?: JSX.Element; // searchable props are optional, but will definitely be present in a searchable context isFromSearch?: boolean; diff --git a/src/components/RefinementList/RefinementListItem.tsx b/src/components/RefinementList/RefinementListItem.tsx index 39ee76912a..9aac0722ec 100644 --- a/src/components/RefinementList/RefinementListItem.tsx +++ b/src/components/RefinementList/RefinementListItem.tsx @@ -1,5 +1,6 @@ /** @jsx h */ +import type { JSX } from 'preact'; import { h } from 'preact'; import Template from '../Template/Template'; @@ -11,7 +12,7 @@ export type RefinementListItemProps = { originalEvent: MouseEvent; }) => void; isRefined: boolean; - subItems?: h.JSX.Element; + subItems?: JSX.Element; templateData: Record; templateKey: string; templateProps?: Record; diff --git a/src/components/RefinementList/__tests__/RefinementList-test.tsx b/src/components/RefinementList/__tests__/RefinementList-test.tsx index 90f0ec386b..83ebf0fbd1 100644 --- a/src/components/RefinementList/__tests__/RefinementList-test.tsx +++ b/src/components/RefinementList/__tests__/RefinementList-test.tsx @@ -2,9 +2,10 @@ import { h } from 'preact'; import { render, fireEvent } from '@testing-library/preact'; -import RefinementList, { RefinementListProps } from '../RefinementList'; +import type { RefinementListProps } from '../RefinementList'; +import RefinementList from '../RefinementList'; import defaultTemplates from '../../../widgets/refinement-list/defaultTemplates'; -import { +import type { RefinementListItemData, RefinementListTemplates, } from '../../../widgets/refinement-list/refinement-list'; diff --git a/src/components/RefinementList/__tests__/RefinementListItem-test.tsx b/src/components/RefinementList/__tests__/RefinementListItem-test.tsx index f82efcde6a..58648e4ecc 100644 --- a/src/components/RefinementList/__tests__/RefinementListItem-test.tsx +++ b/src/components/RefinementList/__tests__/RefinementListItem-test.tsx @@ -2,9 +2,8 @@ import { h } from 'preact'; import { shallow } from '../../../../test/utils/enzyme'; -import RefinementListItem, { - RefinementListItemProps, -} from '../RefinementListItem'; +import type { RefinementListItemProps } from '../RefinementListItem'; +import RefinementListItem from '../RefinementListItem'; describe('RefinementListItem', () => { const props: RefinementListItemProps = { diff --git a/src/components/RelevantSort/RelevantSort.tsx b/src/components/RelevantSort/RelevantSort.tsx index bbd5933a74..6a61108a97 100644 --- a/src/components/RelevantSort/RelevantSort.tsx +++ b/src/components/RelevantSort/RelevantSort.tsx @@ -2,11 +2,11 @@ import { h } from 'preact'; import Template from '../Template/Template'; -import { +import type { RelevantSortCSSClasses, RelevantSortTemplates, } from '../../widgets/relevant-sort/relevant-sort'; -import { ComponentCSSClasses } from '../../types'; +import type { ComponentCSSClasses } from '../../types'; export type RelevantSortComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/RelevantSort/__tests__/RelevantSort-test.tsx b/src/components/RelevantSort/__tests__/RelevantSort-test.tsx index c375571d2a..4bef25f3dd 100644 --- a/src/components/RelevantSort/__tests__/RelevantSort-test.tsx +++ b/src/components/RelevantSort/__tests__/RelevantSort-test.tsx @@ -3,7 +3,8 @@ import { h } from 'preact'; import { render, fireEvent } from '@testing-library/preact'; -import RelevantSort, { RelevantSortComponentTemplates } from '../RelevantSort'; +import type { RelevantSortComponentTemplates } from '../RelevantSort'; +import RelevantSort from '../RelevantSort'; const cssClasses = { root: 'root', diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index c93053b005..d935991da1 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -3,11 +3,11 @@ import { h, createRef, Component } from 'preact'; import { noop } from '../../lib/utils'; import Template from '../Template/Template'; -import { +import type { SearchBoxCSSClasses, SearchBoxTemplates, } from '../../widgets/search-box/search-box'; -import { ComponentCSSClasses } from '../../types'; +import type { ComponentCSSClasses } from '../../types'; export type SearchBoxComponentCSSClasses = ComponentCSSClasses; diff --git a/src/components/Slider/Pit.tsx b/src/components/Slider/Pit.tsx index d341ab8d6d..f715c86b2d 100644 --- a/src/components/Slider/Pit.tsx +++ b/src/components/Slider/Pit.tsx @@ -2,7 +2,7 @@ import { h } from 'preact'; import cx from 'classnames'; -import { PitProps } from './Rheostat'; +import type { PitProps } from './Rheostat'; const Pit = ({ style, children }: PitProps) => { // first, end & middle diff --git a/src/components/Slider/Rheostat.tsx b/src/components/Slider/Rheostat.tsx index 4677572ff3..892737226e 100644 --- a/src/components/Slider/Rheostat.tsx +++ b/src/components/Slider/Rheostat.tsx @@ -6,13 +6,8 @@ /** @jsx h */ -import { - h, - Component, - ComponentChildren, - ComponentType, - createRef, -} from 'preact'; +import type { ComponentChildren, ComponentType, JSX } from 'preact'; +import { h, Component, createRef } from 'preact'; type BoundingBox = { height: number; @@ -73,11 +68,11 @@ function killEvent(ev: Event) { ev.preventDefault(); } -function Button(props: h.JSX.IntrinsicElements['button']) { +function Button(props: JSX.IntrinsicElements['button']) { return