Skip to content

Commit

Permalink
#163 sort imports (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonatai committed Jan 7, 2024
1 parent 736d3ed commit f8f935a
Show file tree
Hide file tree
Showing 29 changed files with 54 additions and 46 deletions.
19 changes: 9 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ import { useEffect } from 'react';
import { Route, Routes } from 'react-router-dom';

import * as config from '../environment.json';

import { Document } from './pages/Document/Document';
import buildingFromSource from './pages/GettingStarted/BuildingFromSource.md';
import gswApacheMavenPath from './pages/GettingStarted/GettingStartedWithApacheMaven.md';
import gswGradlePath from './pages/GettingStarted/GettingStartedWithGradle.md';
import gswGroovyGrape from './pages/GettingStarted/GettingStartedWithGroovyGrape.md';
import gswJitpack from './pages/GettingStarted/GettingStartedWithJitpack.md';
import { NeuralNetworksQuickstart } from './pages/GettingStarted/NeuralNetworksQuickstart/NeuralNetworksQuickstart';
import { Home } from './pages/Home/Home';
import { useGetSummary } from './Hooks';
import {
CustomPage,
LoadingSpinner,
Expand All @@ -21,7 +11,16 @@ import {
MarkdownRenderer,
Message,
} from './components';
import { useGetSummary } from './Hooks';
import { Document } from './pages/Document/Document';
import example from './pages/example.json';
import buildingFromSource from './pages/GettingStarted/BuildingFromSource.md';
import gswApacheMavenPath from './pages/GettingStarted/GettingStartedWithApacheMaven.md';
import gswGradlePath from './pages/GettingStarted/GettingStartedWithGradle.md';
import gswGroovyGrape from './pages/GettingStarted/GettingStartedWithGroovyGrape.md';
import gswJitpack from './pages/GettingStarted/GettingStartedWithJitpack.md';
import { NeuralNetworksQuickstart } from './pages/GettingStarted/NeuralNetworksQuickstart/NeuralNetworksQuickstart';
import { Home } from './pages/Home/Home';

export const App = (): JSX.Element => {
const { data: summary, isLoading, isError } = useGetSummary();
Expand Down
3 changes: 2 additions & 1 deletion src/Hooks/useActiveLink.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IActiveLink } from 'spock-react/hooks-types';
import { create } from 'zustand';

import * as config from '../../environment.json';
import { IActiveLink } from 'spock-react/hooks-types';

const getInitialState = () => {
const pageAndAnchor = window.location.pathname.split('#');
Expand Down
6 changes: 3 additions & 3 deletions src/Hooks/useGenerateSearchEntries.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useEffect, useState } from 'react';

import { cleanedSearchData } from '../components/Search/generateSearchEntries';
import { ISpecification } from 'spock-react-types';
import { IGenerateSearchEntries } from 'spock-react/hooks-types';
import {
IMinimizedSummaryEntry,
ISearchEntry,
} from 'spock-react/components/search-types';
import { IGenerateSearchEntries } from 'spock-react/hooks-types';

import { cleanedSearchData } from '../components/Search/generateSearchEntries';

export const useGenerateSearchEntries = (
props: IGenerateSearchEntries
Expand Down
2 changes: 1 addition & 1 deletion src/Hooks/useGetSpec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from 'axios';
import { IGetSpec, ISpec } from 'spock-react/hooks-types';

import { useQuery, UseQueryResult } from '@tanstack/react-query';

import config from '../../environment.json';
import { IGetSpec, ISpec } from 'spock-react/hooks-types';

const getSpec = async (file: string): Promise<ISpec> => {
const data = await axios.get(`${config.specUrl}/${file}.json`);
Expand Down
2 changes: 1 addition & 1 deletion src/Hooks/useGetSummary.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from 'axios';
import { ISummary } from 'spock-react-types';

import { useQuery, UseQueryResult } from '@tanstack/react-query';

import config from '../../environment.json';
import { ISummary } from 'spock-react-types';

const getSummary = async (): Promise<ISummary> => {
const data = await axios.get(config.summaryUrl);
Expand Down
3 changes: 2 additions & 1 deletion src/Hooks/useMarkdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/react-query';
import { IMarkdown } from 'spock-react/hooks-types';

import { useQuery } from '@tanstack/react-query';

const getMarkdown = async (mdFile: string) => {
const data = await fetch(mdFile);
return await data.text();
Expand Down
7 changes: 4 additions & 3 deletions src/components/Feature/Feature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import './styles.css';

import { nanoid } from 'nanoid';
import { Fragment } from 'react';
import { IMinimalFeature } from 'spock-react-types';
import { IWhereTable } from 'spock-react/components/feature-types';
import { IRow } from 'spock-react/shared/responsive-table-types';

import { faHashtag } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import { ResponsiveTable, SyntaxHighlighter } from '../shared';
import { IMinimalFeature } from 'spock-react-types';
import { IWhereTable } from 'spock-react/components/feature-types';
import { IRow } from 'spock-react/shared/responsive-table-types';

/*
className === unique key for spec
Expand Down
4 changes: 2 additions & 2 deletions src/components/MainNav/MainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import './styles.css';

import { nanoid } from 'nanoid';
import { Link } from 'react-router-dom';
import { IMainNav } from 'spock-react/components/main-nav-types';

import { faBook, faHouseChimney } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import { IMainNav } from 'spock-react/components/main-nav-types';
import * as config from '../../../environment.json';
import { useActiveLink } from '../../Hooks';
import GithubLogo from '../../assets/img/github-mark-white.png';
import { useActiveLink } from '../../Hooks';
import { Search } from '../Search';
import { NavLink } from '../shared';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import './styles.css';

import { useState } from 'react';
import { Dialog, DialogBackdrop, Separator, useDialogState } from 'reakit';
import { ISearch, ISearchHit } from 'spock-react/components/search-types';

import { SearchButton } from './SearchButton';
import { SearchFooter } from './SearchFooter';
import { SearchHits } from './SearchHits';
import { SearchInput } from './SearchInput';
import { ISearch, ISearchHit } from 'spock-react/components/search-types';

export const Search = (props: ISearch): JSX.Element => {
const { summary } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchButton/SearchButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './styles.css';

import { DialogDisclosure } from 'reakit';
import { ISearchButton } from 'spock-react/components/search-button-types';

import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { ISearchButton } from 'spock-react/components/search-button-types';

export const SearchButton = (props: ISearchButton): JSX.Element => {
const { dialog } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchHits/SearchHits.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './styles.css';

import { nanoid } from 'nanoid';
import { ISearchHits } from 'spock-react/components/search-hits-types';

import { SearchCard } from './SearchCard';
import { ISearchHits } from 'spock-react/components/search-hits-types';

export const SearchHits = (props: ISearchHits): JSX.Element => {
const { searchHits, summary, setSearchHits, setSearchInput, dialog } =
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchHits/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
declare module 'spock-react/components/search-hits-types' {
import { DialogStateReturn } from 'reakit/ts';
import { ISummary } from 'spock-react-types';
import { ISearchHit } from 'spock-react/components/search-types';
import { DialogStateReturn } from 'reakit/ts';

interface ISearchHits {
searchHits: ISearchHit[] | null;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Search/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import './styles.css';

import { Input } from 'reakit';
import { ISearchInput } from 'spock-react/components/search-input-types';
import { ISearchHit } from 'spock-react/components/search-types';

import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import { ISearchInput } from 'spock-react/components/search-input-types';
import { ISearchHit } from 'spock-react/components/search-types';
import { useGenerateSearchEntries } from '../../../Hooks/useGenerateSearchEntries';
import { getSearchScore } from '../getSearchScore';

Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './styles.css';

import { PropsWithChildren } from 'react';
import { ILayout } from 'spock-react/shared/layout-types';

import { OnPageNav } from './OnPageNav';
import { ILayout } from 'spock-react/shared/layout-types';

export const Layout = (props: PropsWithChildren<ILayout>): JSX.Element => {
const { hasOnPageNav, children, features } = props;
Expand Down
6 changes: 3 additions & 3 deletions src/components/shared/Layout/OnPageNav.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { nanoid } from 'nanoid';

import { NavAnchor } from '..';
import { IOnPageNave } from 'spock-react/shared/layout-types';
import { IMinimalFeature } from 'spock-react-types';
import { IOnPageNave } from 'spock-react/shared/layout-types';

import { NavAnchor } from '../';

export const OnPageNav = (props: IOnPageNave): JSX.Element => {
const { features } = props;
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/LoadingSpinner/LoadingSpinner.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import './styles.css';

import { ILoadingSpinner } from 'spock-react/shared/loading-spinner-types';

import { faSpinner } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { ILoadingSpinner } from 'spock-react/shared/loading-spinner-types';

export const LoadingSpinner = (props: ILoadingSpinner): JSX.Element => {
const { isLoading } = props;
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/MarkdownRenderer/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Markdown from 'react-markdown';

import remarkGfm from 'remark-gfm';
import { IMarkdownRenderer } from 'spock-react/shared/markdown-renderer-types';

import {
Divide,
MdTable,
Expand All @@ -11,7 +12,6 @@ import {
MdTableRow,
SyntaxHighlighter,
} from '../..';
import { IMarkdownRenderer } from 'spock-react/shared/markdown-renderer-types';

export const MarkdownRenderer = (props: IMarkdownRenderer) => {
const { children: content } = props;
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/Message/Message.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import './styles.css';

import { IErrorMessage, TLevel } from 'spock-react/shared/message-types';

import {
faCircleCheck,
faCircleInfo,
faCircleXmark,
faTriangleExclamation,
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { IErrorMessage, TLevel } from 'spock-react/shared/message-types';

export const Message = (props: IErrorMessage): JSX.Element => {
const { headline, level, children } = props;
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/NavLink/NavAnchor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import './styles.css';

import { INavLink } from 'spock-react/shared/nav-link-types';

import { useActiveAnchor } from '../../../Hooks';

export const NavAnchor = (props: INavLink) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/NavLink/NavLink.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './styles.css';

import { Link } from 'react-router-dom';

import { INavLink } from 'spock-react/shared/nav-link-types';

import { useActiveLink } from '../../../Hooks';

export const NavLink = (props: INavLink): JSX.Element => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/PageTemplate/CustomPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PropsWithChildren } from 'react';

import { Layout } from '../';
import { useScrollUp } from '../../../Hooks';
import { Layout } from '..';

export const CustomPage = (props: PropsWithChildren<unknown>): JSX.Element => {
const { children } = props;
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/PageTemplate/MarkdownPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IMarkdownPage } from 'spock-react/shared/page-template-types';
import { Layout, LoadingSpinner, MarkdownRenderer, Message } from '..';

import { Layout, LoadingSpinner, MarkdownRenderer, Message } from '../';
import * as config from '../../../../environment.json';
import { useMarkdown, useScrollUp } from '../../../Hooks';

Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Table/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './ResponsiveTable';
export * from './MarkdownTable';
export * from './ResponsiveTable';
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { BrowserRouter } from 'react-router-dom';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import * as config from '../environment.json';
import { App } from './App';
import { Message } from './components/shared';
import * as config from '../environment.json';

const queryClient = new QueryClient();

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Document/Document.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { nanoid } from 'nanoid';
import { Fragment } from 'react';
import { IDocument } from 'spock-react/pages/document-types';

import * as config from '../../../environment.json';
import { useGetSpec, useScrollUp } from '../../Hooks';
import {
Divide,
Feature,
Expand All @@ -11,7 +11,7 @@ import {
MarkdownRenderer,
Message,
} from '../../components';
import { IDocument } from 'spock-react/pages/document-types';
import { useGetSpec, useScrollUp } from '../../Hooks';

export const Document = (props: IDocument): JSX.Element => {
const { fileName } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CustomPage, CustomTab, SyntaxHighlighter } from '../../../components';
import './styles.css';

import { CustomPage, CustomTab, SyntaxHighlighter } from '../../../components';

export const NeuralNetworksQuickstart = () => {
return (
<CustomPage>
Expand Down
1 change: 1 addition & 0 deletions src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
faWandSparkles,
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import { CustomPage, CustomTab, SyntaxHighlighter } from '../../components';

const groovySnippet = {
Expand Down
2 changes: 1 addition & 1 deletion src/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ const customRender = (
options?: Omit<RenderOptions, 'wrapper'>
) => render(ui, { wrapper: AllTheProviders, ...options });

export { testingStuff as testing, customRender as render };
export { customRender as render, testingStuff as testing };
2 changes: 1 addition & 1 deletion src/tests/example.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import axios from 'axios';
import { ISummary } from 'spock-react-types';
import { describe, expect, test } from 'vitest';

import { renderHook } from '@testing-library/react-hooks';

import { App } from '../App';
import { useGetSummary } from '../Hooks';
import { HookProvider, render } from '../test-utils';
import { ISummary } from 'spock-react-types';

describe('test', () => {
test('component example', () => {
Expand Down

0 comments on commit f8f935a

Please sign in to comment.