From 11ea1e395eec70f84b7a0c826eda0717c63b7d35 Mon Sep 17 00:00:00 2001 From: Sampo Silvennoinen Date: Sun, 6 Aug 2023 15:18:19 +0300 Subject: [PATCH] Lint: autofix to new import order --- src/components/Abbreviations/index.tsx | 2 +- src/components/Breadcrumbs/index.js | 2 +- src/components/Crosslinks/Crosslinks.test.tsx | 2 +- src/components/Head/Head.test.js | 2 +- src/components/Layout/Layout.test.js | 2 +- src/components/SearchResults/SearchTeaser/index.tsx | 2 +- src/components/SimilarEntries/SimilarEntries.test.tsx | 2 +- src/components/WordDefinition/index.tsx | 4 ++-- src/components/WordList/index.tsx | 2 +- src/pages/api/search.ts | 2 +- src/pages/index.tsx | 2 +- src/pages/sitemap-creator.xml.js | 2 +- src/pages/word/[word].tsx | 2 +- tests/unit/lib/services/abbreviations.test.ts | 7 +++---- tests/unit/lib/services/dictionary.test.ts | 6 +++--- tests/unit/lib/services/search.test.js | 4 ++-- tests/unit/lib/services/sitemap.test.js | 2 +- tests/unit/pages/404.test.js | 2 +- tests/unit/pages/index.test.js | 4 ++-- tests/unit/pages/letter.test.js | 2 +- tests/unit/pages/search.test.tsx | 2 +- tests/unit/pages/sitemap-creator.xml.test.js | 2 +- tests/unit/pages/sources.test.tsx | 2 +- tests/unit/pages/word.test.tsx | 4 ++-- 24 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/components/Abbreviations/index.tsx b/src/components/Abbreviations/index.tsx index 35e7287..0424832 100644 --- a/src/components/Abbreviations/index.tsx +++ b/src/components/Abbreviations/index.tsx @@ -1,6 +1,6 @@ +import Link from 'next/link' import AbbreviationList from 'components/AbbreviationList' import { CombinedAbbreviations } from 'lib/services/abbreviations' -import Link from 'next/link' import styles from './Abbreviations.module.scss' interface AbbreviationProps{ diff --git a/src/components/Breadcrumbs/index.js b/src/components/Breadcrumbs/index.js index c224985..e8c3234 100644 --- a/src/components/Breadcrumbs/index.js +++ b/src/components/Breadcrumbs/index.js @@ -1,6 +1,6 @@ +import Link from 'next/link' import { getBreadcrumbs } from 'lib/utils/breadcrumbs' import { getSchema } from 'lib/utils/schema' -import Link from 'next/link' import styles from './Breadcrumbs.module.scss' export default function Breadcrumbs({ type, content }) { diff --git a/src/components/Crosslinks/Crosslinks.test.tsx b/src/components/Crosslinks/Crosslinks.test.tsx index 0bf7d31..6774916 100644 --- a/src/components/Crosslinks/Crosslinks.test.tsx +++ b/src/components/Crosslinks/Crosslinks.test.tsx @@ -1,6 +1,6 @@ import renderer from 'react-test-renderer' -import { Crosslink } from 'lib/services/crosslinks' import { DictionarySource } from 'scandinavian-dictionary-crosslinker' +import { Crosslink } from 'lib/services/crosslinks' import Crosslinks from './index' import styles from './Crosslinks.module.scss' diff --git a/src/components/Head/Head.test.js b/src/components/Head/Head.test.js index 4e63aaa..6a8fee6 100644 --- a/src/components/Head/Head.test.js +++ b/src/components/Head/Head.test.js @@ -1,6 +1,6 @@ import ReactDOM from 'react-dom/client' -import Head from 'components/Head' import renderer from 'react-test-renderer' +import Head from 'components/Head' import { getByLetter, getWord } from 'lib/services/dictionary' describe('Head component', () => { diff --git a/src/components/Layout/Layout.test.js b/src/components/Layout/Layout.test.js index d01dcee..a463d1c 100644 --- a/src/components/Layout/Layout.test.js +++ b/src/components/Layout/Layout.test.js @@ -1,6 +1,6 @@ import ReactDOM from 'react-dom/client' -import Layout from 'components/Layout' import renderer from 'react-test-renderer' +import Layout from 'components/Layout' import { getByLetter, getWord, getAlphabet } from 'lib/services/dictionary' describe('Layout component', () => { diff --git a/src/components/SearchResults/SearchTeaser/index.tsx b/src/components/SearchResults/SearchTeaser/index.tsx index 3334c69..8cfd850 100644 --- a/src/components/SearchResults/SearchTeaser/index.tsx +++ b/src/components/SearchResults/SearchTeaser/index.tsx @@ -1,5 +1,5 @@ -import { SearchResult } from 'lib/services/search'; import Link from 'next/link' +import { SearchResult } from 'lib/services/search'; import styles from './SearchTeaser.module.scss' interface SearchTeaserProps { diff --git a/src/components/SimilarEntries/SimilarEntries.test.tsx b/src/components/SimilarEntries/SimilarEntries.test.tsx index c711c25..2bb195d 100644 --- a/src/components/SimilarEntries/SimilarEntries.test.tsx +++ b/src/components/SimilarEntries/SimilarEntries.test.tsx @@ -1,5 +1,5 @@ -import { DictionaryEntry } from 'lib/services/dictionary' import renderer from 'react-test-renderer' +import { DictionaryEntry } from 'lib/services/dictionary' import SimilarEntries from './index' describe('Similar entries component', () => { diff --git a/src/components/WordDefinition/index.tsx b/src/components/WordDefinition/index.tsx index 0bbb659..4546c53 100644 --- a/src/components/WordDefinition/index.tsx +++ b/src/components/WordDefinition/index.tsx @@ -1,9 +1,9 @@ -import { capitalize, getOlderSpelling } from 'lib/utils/strings' import { lettersToRunes } from 'younger-futhark' +import { Crosslink } from 'scandinavian-dictionary-crosslinker' +import { capitalize, getOlderSpelling } from 'lib/utils/strings' import { addAbbreviationsToContent, CombinedAbbreviations } from 'lib/services/abbreviations' import Abbreviations from 'components/Abbreviations' import { DictionaryEntry } from 'lib/services/dictionary' -import { Crosslink } from 'scandinavian-dictionary-crosslinker' import Crosslinks from 'components/Crosslinks' import SimilarEntries from 'components/SimilarEntries' import styles from './WordDefinition.module.scss' diff --git a/src/components/WordList/index.tsx b/src/components/WordList/index.tsx index 74246b4..5d09b93 100644 --- a/src/components/WordList/index.tsx +++ b/src/components/WordList/index.tsx @@ -1,7 +1,7 @@ import { DictionaryEntry } from 'cleasby-vigfusson-dictionary' +import { hasProperty } from 'spyrjari' import WordLink from 'components/WordLink' import { DictionaryEntryDTO } from 'lib/services/dictionary' -import { hasProperty } from 'spyrjari' import styles from './WordList.module.scss' interface WordListProps { diff --git a/src/pages/api/search.ts b/src/pages/api/search.ts index 413e6bc..35b2bbd 100644 --- a/src/pages/api/search.ts +++ b/src/pages/api/search.ts @@ -1,6 +1,6 @@ +import { NextApiRequest, NextApiResponse } from 'next'; import { getAllWords } from 'lib/services/dictionary' import { Criteria, searchDictionary } from 'lib/services/search'; -import { NextApiRequest, NextApiResponse } from 'next'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { if (!req.query.search || !req.query.criteria) { diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5fec453..2af55eb 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,4 +1,5 @@ // Services. +import Link from 'next/link' import { getRandomEntries, getAlphabet, DictionaryEntry, AlphabetLetter, } from 'lib/services/dictionary' @@ -6,7 +7,6 @@ import { // Components. import Layout from 'components/Layout' import ContentArea from 'components/ContentArea' -import Link from 'next/link' import WordList from 'components/WordList' import SampleText from 'components/SampleText' diff --git a/src/pages/sitemap-creator.xml.js b/src/pages/sitemap-creator.xml.js index caeea5c..b809b72 100644 --- a/src/pages/sitemap-creator.xml.js +++ b/src/pages/sitemap-creator.xml.js @@ -1,6 +1,6 @@ // Services. -import { getSitemapContent, formatSitemap } from 'lib/services/sitemap' import { SitemapStream, streamToPromise } from 'sitemap' +import { getSitemapContent, formatSitemap } from 'lib/services/sitemap' export async function getServerSideProps({ res }) { const content = getSitemapContent() diff --git a/src/pages/word/[word].tsx b/src/pages/word/[word].tsx index 96a5a90..2b88893 100644 --- a/src/pages/word/[word].tsx +++ b/src/pages/word/[word].tsx @@ -1,6 +1,7 @@ import { useRouter } from 'next/router' // Services. +import { Crosslink } from 'scandinavian-dictionary-crosslinker' import { getWord, getAlphabet, DictionaryEntry, AlphabetLetter, getSimilarWords, } from 'lib/services/dictionary' @@ -13,7 +14,6 @@ import { redirect404, Redirect404ResponseSchema } from 'lib/utils/redirect-404' import Layout from 'components/Layout' import WordDefinition from 'components/WordDefinition' import Button from 'components/Button' -import { Crosslink } from 'scandinavian-dictionary-crosslinker' import { decodeLetter } from 'lib/utils/slugs' import { getCrossLinks } from 'lib/services/crosslinks' diff --git a/tests/unit/lib/services/abbreviations.test.ts b/tests/unit/lib/services/abbreviations.test.ts index caa307e..1d6baa5 100644 --- a/tests/unit/lib/services/abbreviations.test.ts +++ b/tests/unit/lib/services/abbreviations.test.ts @@ -1,12 +1,11 @@ +// Test utils. +import { isObject, isArray } from 'volva' +import { hasProperty } from 'spyrjari' import { getAbbreviations, addAbbreviationsToContent, } from 'lib/services/abbreviations' -// Test utils. -import { isObject, isArray } from 'volva' -import { hasProperty } from 'spyrjari' - describe('Abbreviations tests', () => { const simpleEntry = { word: 'hval-reiĆ°', diff --git a/tests/unit/lib/services/dictionary.test.ts b/tests/unit/lib/services/dictionary.test.ts index 70a1809..1f1f653 100644 --- a/tests/unit/lib/services/dictionary.test.ts +++ b/tests/unit/lib/services/dictionary.test.ts @@ -1,10 +1,10 @@ import { getDictionary } from 'cleasby-vigfusson-dictionary' -import { - getAllWords, getByLetter, getWord, getAlphabet, getSimilarWords, -} from 'lib/services/dictionary' import { isArray } from 'volva' import { matchesSchema } from 'jafningjar' import { oldNorseSort } from 'old-norse-alphabet-sort' +import { + getAllWords, getByLetter, getWord, getAlphabet, getSimilarWords, +} from 'lib/services/dictionary' describe('Dictionary tests', () => { const dictionary = getAllWords() diff --git a/tests/unit/lib/services/search.test.js b/tests/unit/lib/services/search.test.js index 116d15d..1bd56e4 100644 --- a/tests/unit/lib/services/search.test.js +++ b/tests/unit/lib/services/search.test.js @@ -1,7 +1,7 @@ -import { getAllWords } from 'lib/services/dictionary' -import { searchDictionary } from 'lib/services/search' import { isArray } from 'volva' import { hasProperty } from 'spyrjari' +import { getAllWords } from 'lib/services/dictionary' +import { searchDictionary } from 'lib/services/search' describe('Search tests', () => { const dictionary = getAllWords() diff --git a/tests/unit/lib/services/sitemap.test.js b/tests/unit/lib/services/sitemap.test.js index 01c5498..d91cbf4 100644 --- a/tests/unit/lib/services/sitemap.test.js +++ b/tests/unit/lib/services/sitemap.test.js @@ -1,7 +1,7 @@ -import { getSitemapContent, formatSitemap } from 'lib/services/sitemap' import { SitemapStream, streamToPromise } from 'sitemap' import { hasProperty } from 'spyrjari' import { isArray } from 'volva' +import { getSitemapContent, formatSitemap } from 'lib/services/sitemap' describe('Sitemap tests', () => { process.env.NEXT_PUBLIC_SITE_URL = 'https://cleasbyvigfusson.test' diff --git a/tests/unit/pages/404.test.js b/tests/unit/pages/404.test.js index 8a3ad54..a74917f 100644 --- a/tests/unit/pages/404.test.js +++ b/tests/unit/pages/404.test.js @@ -1,6 +1,6 @@ import ReactDOM from 'react-dom/client' -import Page404, { getStaticProps } from 'pages/404' import renderer from 'react-test-renderer' +import Page404, { getStaticProps } from 'pages/404' import { getAlphabet } from 'lib/services/dictionary' describe('404 page page', () => { diff --git a/tests/unit/pages/index.test.js b/tests/unit/pages/index.test.js index bfa6489..0062103 100644 --- a/tests/unit/pages/index.test.js +++ b/tests/unit/pages/index.test.js @@ -1,8 +1,8 @@ import ReactDOM from 'react-dom/client' -import Index, { getStaticProps } from 'pages/index' import renderer from 'react-test-renderer' -import { getAllWords, getAlphabet } from 'lib/services/dictionary' import { matchesSchema } from 'jafningjar' +import Index, { getStaticProps } from 'pages/index' +import { getAllWords, getAlphabet } from 'lib/services/dictionary' describe('Index page', () => { test('Does not crash', () => { diff --git a/tests/unit/pages/letter.test.js b/tests/unit/pages/letter.test.js index 3d41575..df9cf1b 100644 --- a/tests/unit/pages/letter.test.js +++ b/tests/unit/pages/letter.test.js @@ -1,6 +1,6 @@ import ReactDOM from 'react-dom/client' -import Letter, { getStaticProps, getStaticPaths } from 'pages/letter/[letter]' import renderer from 'react-test-renderer' +import Letter, { getStaticProps, getStaticPaths } from 'pages/letter/[letter]' import { getByLetter, getAlphabet } from 'lib/services/dictionary' describe('Letter page: render', () => { diff --git a/tests/unit/pages/search.test.tsx b/tests/unit/pages/search.test.tsx index 940ea4b..14a9d08 100644 --- a/tests/unit/pages/search.test.tsx +++ b/tests/unit/pages/search.test.tsx @@ -1,6 +1,6 @@ import ReactDOM from 'react-dom/client' -import Search, { getStaticProps } from 'pages/search' import renderer from 'react-test-renderer' +import Search, { getStaticProps } from 'pages/search' import { getAlphabet } from 'lib/services/dictionary' /** diff --git a/tests/unit/pages/sitemap-creator.xml.test.js b/tests/unit/pages/sitemap-creator.xml.test.js index 394b5a1..db6c18e 100644 --- a/tests/unit/pages/sitemap-creator.xml.test.js +++ b/tests/unit/pages/sitemap-creator.xml.test.js @@ -1,7 +1,7 @@ import ReactDOM from 'react-dom/client' -import Sitemap, { getServerSideProps } from 'pages/sitemap-creator.xml' import renderer from 'react-test-renderer' import { createMocks } from 'node-mocks-http' +import Sitemap, { getServerSideProps } from 'pages/sitemap-creator.xml' describe('Sitemap page: render', () => { process.env.NEXT_PUBLIC_SITE_URL = 'https://cleasbyvigfusson.test' diff --git a/tests/unit/pages/sources.test.tsx b/tests/unit/pages/sources.test.tsx index 8478edf..61d40af 100644 --- a/tests/unit/pages/sources.test.tsx +++ b/tests/unit/pages/sources.test.tsx @@ -1,6 +1,6 @@ import ReactDOM from 'react-dom/client' -import Sources, { getStaticProps } from 'pages/source-list' import renderer from 'react-test-renderer' +import Sources, { getStaticProps } from 'pages/source-list' import { getAlphabet } from 'lib/services/dictionary' import { getAllSorces } from 'lib/services/abbreviations' diff --git a/tests/unit/pages/word.test.tsx b/tests/unit/pages/word.test.tsx index 83b1949..7d1ceb2 100644 --- a/tests/unit/pages/word.test.tsx +++ b/tests/unit/pages/word.test.tsx @@ -1,8 +1,8 @@ import ReactDOM from 'react-dom/client' -import Word, { getStaticProps, getStaticPaths } from 'pages/word/[word]' import renderer from 'react-test-renderer' -import { getAlphabet } from 'lib/services/dictionary' import { DictionarySource } from 'scandinavian-dictionary-crosslinker' +import Word, { getStaticProps, getStaticPaths } from 'pages/word/[word]' +import { getAlphabet } from 'lib/services/dictionary' const mockHandler = jest.fn()