Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier: Use prettier-plugin-organize-imports #899

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Sort imports using prettier-plugin-organize-imports
baltpeter committed May 31, 2022
commit 88f876a8d2009b1e9cb8e31a85e30600de364c99
10 changes: 5 additions & 5 deletions src/Components/ActWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { render } from 'preact';
import { RequestGeneratorBuilder } from './RequestGeneratorBuilder';
import type { RequestType, TransportMedium } from '../types/request';
import { createGeneratorStore, RequestGeneratorProvider, useGeneratorStore } from '../store/generator';
import type { Company } from '../types/company';
import type { RequestType, TransportMedium } from '../types/request';
import { ActionButton } from './Generator/ActionButton';
import { StatefulSignatureInput } from './Generator/SignatureInput';
import { RequestTypeChooser } from './Generator/RequestTypeChooser';
import { StatefulDynamicInputContainer } from './Generator/DynamicInputContainer';
import { createGeneratorStore, RequestGeneratorProvider, useGeneratorStore } from '../store/generator';
import { RequestTypeChooser } from './Generator/RequestTypeChooser';
import { StatefulSignatureInput } from './Generator/SignatureInput';
import { RequestGeneratorBuilder } from './RequestGeneratorBuilder';

type ActWidgetProps = {
requestTypes: RequestType[];
10 changes: 5 additions & 5 deletions src/Components/CommentsWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Fragment, JSX } from 'preact';
import { useState, useEffect, useCallback } from 'preact/hooks';
import { IntlProvider, Text, MarkupText } from 'preact-i18n';
import { FlashMessage, flash } from '../Components/FlashMessage';
import { StarWidget } from './StarWidget';
import t from '../Utility/i18n';
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { useCallback, useEffect, useState } from 'preact/hooks';
import { flash, FlashMessage } from '../Components/FlashMessage';
import { rethrow, WarningException } from '../Utility/errors';
import t from '../Utility/i18n';
import { StarWidget } from './StarWidget';

const api_url = 'https://backend.datenanfragen.de/comments';
const target = `${window.LOCALE}/${document.location.pathname.replace(/^\s*\/*\s*|\s*\/*\s*$/gm, '')}`;
4 changes: 2 additions & 2 deletions src/Components/DeprecatedModal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, Component } from 'preact';
import { Component, render } from 'preact';
import { createPortal } from 'preact/compat';
import t from '../Utility/i18n';
import PropTypes from 'prop-types';
import t from '../Utility/i18n';

// TODO: Get rid of this once we've moved everything to the new modal hook.
export default class DeprecatedModal extends Component {
10 changes: 5 additions & 5 deletions src/Components/DonationWidget.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { render, Component } from 'preact';
import { IntlProvider, Text, MarkupText } from 'preact-i18n';
import { Component, render } from 'preact';
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { flash, FlashMessage } from '../Components/FlashMessage';
import { clientPost } from '../Utility/browser';
import { almostUniqueId, renderMoney } from '../Utility/common';
import { CriticalException, rethrow } from '../Utility/errors';
import t from '../Utility/i18n';
import { FlashMessage, flash } from '../Components/FlashMessage';
import { Radio } from './Radio';
import { clientPost } from '../Utility/browser';
import { LoadingIndicator } from './LoadingIndicator';
import { Radio } from './Radio';

const DONATIONS_API = 'https://backend.datenanfragen.de/donation';
const SUGGESTED_AMOUNTS = [5, 10, 15, 25, 50, 75, 100, 150, 200, 250];
2 changes: 1 addition & 1 deletion src/Components/FeatureDisabledWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentChildren } from 'preact';
import { MarkupText, IntlProvider } from 'preact-i18n';
import { IntlProvider, MarkupText } from 'preact-i18n';
import t from '../Utility/i18n';

type FeatureDisabledWidgetProps = {
4 changes: 2 additions & 2 deletions src/Components/FlashMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, ComponentChildren, Fragment, VNode } from 'preact';
import { useState, useEffect, useCallback } from 'preact/hooks';
import { ComponentChildren, Fragment, render, VNode } from 'preact';
import { useCallback, useEffect, useState } from 'preact/hooks';
import t from '../Utility/i18n';

type FlashMessageProps = {
2 changes: 1 addition & 1 deletion src/Components/Footnote.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentChildren } from 'preact';
import { Text, IntlProvider } from 'preact-i18n';
import { IntlProvider, Text } from 'preact-i18n';
import { useEffect, useRef } from 'preact/hooks';

type FootnoteProps = {
2 changes: 1 addition & 1 deletion src/Components/Generator/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { JSX } from 'preact';
import { Text, IntlProvider } from 'preact-i18n';
import { IntlProvider, Text } from 'preact-i18n';
import { useGeneratorStore } from '../../store/generator';
import { MailtoDropdown } from '../MailtoDropdown';

6 changes: 3 additions & 3 deletions src/Components/Generator/CompanySelector.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Company } from '../../types/company';
import type { Except } from 'type-fest';
import t from '../../Utility/i18n';
import { useGeneratorStore } from '../../store/generator';
import { SearchBarProps, SearchBar } from '../SearchBar';
import type { Company } from '../../types/company';
import t from '../../Utility/i18n';
import { SearchBar, SearchBarProps } from '../SearchBar';
import { useNewRequestModal } from './NewRequestButton';

type CompanySelectorProps = { newRequestHook: () => void } & Partial<Except<SearchBarProps, 'anchorize' | 'index'>>;
4 changes: 2 additions & 2 deletions src/Components/Generator/CompanyWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IntlProvider, Text } from 'preact-i18n';
import { useGeneratorStore } from '../../store/generator';
import t from '../../Utility/i18n';
import { Text, IntlProvider } from 'preact-i18n';
import { Accordion } from '../Accordion';
import { useGeneratorStore } from '../../store/generator';

export const CompanyWidget = () => {
const company = useGeneratorStore((state) => state.current_company);
6 changes: 3 additions & 3 deletions src/Components/Generator/CustomRequestInput.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { useGeneratorStore } from '../../store/generator';
import type { CustomTemplateName } from '../../types/request';
import { MarkupText, Text, IntlProvider } from 'preact-i18n';
import t from '../../Utility/i18n';
import { useGeneratorStore } from '../../store/generator';
import { EMTPY_ADDRESS, CUSTOM_TEMPLATE_OPTIONS } from '../../Utility/requests';
import { CUSTOM_TEMPLATE_OPTIONS, EMTPY_ADDRESS } from '../../Utility/requests';
import { InputControl } from './DynamicInput';

export const CustomRequestInput = () => {
4 changes: 2 additions & 2 deletions src/Components/Generator/DynamicInput.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { produce } from 'immer';
import type { JSX } from 'preact';
import { IntlProvider, Text } from 'preact-i18n';
import type { Address, AddressIdData, IdDataElement } from '../../types/request';
import { Text, IntlProvider } from 'preact-i18n';
import t from '../../Utility/i18n';
import { ADDRESS_STRING_PROPERTIES } from '../../Utility/requests';
import { produce } from 'immer';

type DynamicInputProps = {
id: string;
10 changes: 5 additions & 5 deletions src/Components/Generator/DynamicInputContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { ComponentChildren } from 'preact';
import type { IdDataElement } from '../../types/request';
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { useMemo, useState } from 'preact/hooks';
import { DynamicInput } from './DynamicInput';
import { Text, MarkupText, IntlProvider } from 'preact-i18n';
import t from '../../Utility/i18n';
import { adressesEqual, isFieldEmpty, EMTPY_ADDRESS } from '../../Utility/requests';
import { useGeneratorStore } from '../../store/generator';
import type { IdDataElement } from '../../types/request';
import t from '../../Utility/i18n';
import { adressesEqual, EMTPY_ADDRESS, isFieldEmpty } from '../../Utility/requests';
import { DynamicInput } from './DynamicInput';

type DynamicInputContainerProps = {
id: string;
10 changes: 5 additions & 5 deletions src/Components/Generator/NewRequestButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ActionButton } from '../Generator/ActionButton';
import type { JSX } from 'preact';
import { IntlProvider, Text } from 'preact-i18n';
import { useCallback, useState } from 'preact/hooks';
import { SavedCompanies } from '../../DataType/SavedCompanies';
import { useGeneratorStore } from '../../store/generator';
import { clearUrlParameters } from '../../Utility/browser';
import { useCallback, useState } from 'preact/hooks';
import { useModal } from '../Modal';
import t from '../../Utility/i18n';
import type { JSX } from 'preact';
import { Privacy, PRIVACY_ACTIONS } from '../../Utility/Privacy';
import { SavedCompanies } from '../../DataType/SavedCompanies';
import { ActionButton } from '../Generator/ActionButton';
import { useModal } from '../Modal';

type NewRequestButtonProps = {
newRequestHook?: (arg?: unknown) => void;
2 changes: 1 addition & 1 deletion src/Components/Generator/RecipientInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IntlProvider, Text } from 'preact-i18n';
import type { TransportMedium } from '../../types/request';
import t from '../../Utility/i18n';
import { Text, IntlProvider } from 'preact-i18n';

type RecipientInputProps = {
recipientAddress?: string;
2 changes: 1 addition & 1 deletion src/Components/Generator/RequestFlags.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useGeneratorStore } from '../../store/generator';
import { Fragment } from 'preact';
import { Text } from 'preact-i18n';
import { useGeneratorStore } from '../../store/generator';
import t from '../../Utility/i18n';

export function RequestFlags() {
14 changes: 7 additions & 7 deletions src/Components/Generator/RequestForm.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ComponentChildren } from 'preact';
import { DynamicInputContainer } from './DynamicInputContainer';
import { SignatureInput } from './SignatureInput';
import { MarkupText, Text, IntlProvider } from 'preact-i18n';
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { useGeneratorStore } from '../../store/generator';
import t from '../../Utility/i18n';
import { Accordion } from '../Accordion';
import { RequestTypeChooser } from './RequestTypeChooser';
import { CustomRequestInput } from './CustomRequestInput';
import { DynamicInputContainer } from './DynamicInputContainer';
import { RecipientInput } from './RecipientInput';
import { TransportMediumChooser } from './TransportMediumChooser';
import { useGeneratorStore } from '../../store/generator';
import { RequestFlags } from './RequestFlags';
import { CustomRequestInput } from './CustomRequestInput';
import { RequestTypeChooser } from './RequestTypeChooser';
import { SignatureInput } from './SignatureInput';
import { TransportMediumChooser } from './TransportMediumChooser';

type RequestFormProps = {
children: ComponentChildren;
4 changes: 2 additions & 2 deletions src/Components/Generator/RequestTypeChooser.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useGeneratorStore } from '../../store/generator';
import type { RequestType } from '../../types/request';
import t from '../../Utility/i18n';
import { Radio } from '../Radio';
import { REQUEST_TYPES } from '../../Utility/requests';
import { useGeneratorStore } from '../../store/generator';
import { Radio } from '../Radio';

type RequestTypeChooserProps = {
request_types?: RequestType[];
6 changes: 3 additions & 3 deletions src/Components/Generator/SignatureInput.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { JSX } from 'preact';
import { useRef, Ref, useEffect, MutableRef, useState } from 'preact/hooks';
import { Text, IntlProvider } from 'preact-i18n';
import { IntlProvider, Text } from 'preact-i18n';
import { MutableRef, Ref, useEffect, useRef, useState } from 'preact/hooks';
import { useGeneratorStore } from '../../store/generator';
import type { Signature } from '../../types/request';
import { detectBlockedCanvasImageExtraction } from '../../Utility/browser';
import { useGeneratorStore } from '../../store/generator';

type Color = string;

4 changes: 2 additions & 2 deletions src/Components/Generator/TransportMediumChooser.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IntlProvider, Text } from 'preact-i18n';
import type { TransportMedium } from '../../types/request';
import t from '../../Utility/i18n';
import { Text, IntlProvider } from 'preact-i18n';
import { Radio } from '../Radio';
import { TRANSPORT_MEDIA } from '../../Utility/requests';
import { Radio } from '../Radio';

type TransportMediumChooserProps = {
value: TransportMedium;
6 changes: 3 additions & 3 deletions src/Components/I18nWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { JSX } from 'preact';
import { useState, useCallback } from 'preact/hooks';
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { useAppStore, Country } from '../store/app';
import { useModal } from './Modal';
import { useCallback, useState } from 'preact/hooks';
import { Country, useAppStore } from '../store/app';
import t from '../Utility/i18n';
import { useModal } from './Modal';

type I18nWidgetProps = {
minimal: boolean;
10 changes: 5 additions & 5 deletions src/Components/MailtoDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { JSX } from 'preact';
import { useRef, useCallback } from 'preact/hooks';
import { Text, IntlProvider } from 'preact-i18n';
import { useAppStore, Country } from '../store/app';
import { useModal } from './Modal';
import t, { t_r } from '../Utility/i18n';
import { IntlProvider, Text } from 'preact-i18n';
import { useCallback, useRef } from 'preact/hooks';
import { RequestLetter } from '../DataType/RequestLetter';
import { Country, useAppStore } from '../store/app';
import t, { t_r } from '../Utility/i18n';
import { useModal } from './Modal';

type EmailData = { email: string; subject: string; body: string };
type MailtoHandler = (
4 changes: 2 additions & 2 deletions src/Components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment, ComponentChildren, JSX } from 'preact';
import { useState, useCallback, useMemo, useEffect } from 'preact/hooks';
import { ComponentChildren, Fragment, JSX } from 'preact';
import { useCallback, useEffect, useMemo, useState } from 'preact/hooks';
import type { MergeExclusive } from 'type-fest';
import t from '../Utility/i18n';

8 changes: 4 additions & 4 deletions src/Components/RequestGeneratorBuilder.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { ComponentChildren } from 'preact';
import { IntlProvider, MarkupText } from 'preact-i18n';
import { memo } from 'preact/compat';
import t from '../Utility/i18n';
import { Privacy, PRIVACY_ACTIONS } from '../Utility/Privacy';
import { SvaFinder } from './SvaFinder';
import { UserRequests } from '../DataType/UserRequests';
import { useEffect } from 'preact/hooks';
import { UserRequests } from '../DataType/UserRequests';
import { useGeneratorStore, useGeneratorStoreApi } from '../store/generator';
import type { ResponseType } from '../types/request';
import t from '../Utility/i18n';
import { Privacy, PRIVACY_ACTIONS } from '../Utility/Privacy';
import { useModal } from './Modal';
import { SvaFinder } from './SvaFinder';

type RequestGeneratorBuilderProps = {
onInitialized?: () => void;
8 changes: 4 additions & 4 deletions src/Components/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { IntlProvider, MarkupText } from 'preact-i18n';
import { useEffect, useRef } from 'preact/hooks';
import type { MergeExclusive } from 'type-fest';
import type { SearchParams, SearchResponseHit } from 'typesense/lib/Typesense/Documents';
import { Country, useAppStore } from '../store/app';
import type { Company } from '../types/company';
import { useEffect, useRef } from 'preact/hooks';
import { IntlProvider, MarkupText } from 'preact-i18n';
import { useAppStore, Country } from '../store/app';
import { rethrow } from '../Utility/errors';
import t from '../Utility/i18n';
import { Privacy, PRIVACY_ACTIONS } from '../Utility/Privacy';
import { searchClient } from '../Utility/search';
import { rethrow } from '../Utility/errors';
import { FeatureDisabledWidget } from './FeatureDisabledWidget';

export type SearchBarProps = {
8 changes: 4 additions & 4 deletions src/Components/SvaFinder.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { SupervisoryAuthority } from '../types/company';
import { render, Fragment, JSX } from 'preact';
import deepmerge from 'deepmerge';
import { Fragment, JSX, render } from 'preact';
import { useState } from 'preact/hooks';
import { useAppStore } from '../store/app';
import t from '../Utility/i18n';
import type { SupervisoryAuthority } from '../types/company';
import { fetchSvaDataBySlug } from '../Utility/companies';
import deepmerge from 'deepmerge';
import t from '../Utility/i18n';

type SvaFinderProps = {
callback?: (sva?: SupervisoryAuthority) => void;
12 changes: 6 additions & 6 deletions src/Components/Wizard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useState, useEffect } from 'preact/hooks';
import { Text, MarkupText, IntlProvider } from 'preact-i18n';
import { useAppStore } from '../store/app';
import { useFetch } from '../hooks/useFetch';
import { SearchBar } from './SearchBar';
import { IntlProvider, MarkupText, Text } from 'preact-i18n';
import { useEffect, useState } from 'preact/hooks';
import { SavedCompanies } from '../DataType/SavedCompanies';
import { useFetch } from '../hooks/useFetch';
import { useAppStore } from '../store/app';
import { ErrorException, rethrow } from '../Utility/errors';
import t from '../Utility/i18n';
import { rethrow, ErrorException } from '../Utility/errors';
import { Privacy, PRIVACY_ACTIONS } from '../Utility/Privacy';
import { SearchBar } from './SearchBar';

const categories = [
'suggested',
4 changes: 2 additions & 2 deletions src/DataType/RequestLetter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatAddress, Letter, LetterProps, Template } from 'letter-generator';
import type { Address, IdDataElement, Request } from '../types/request';
import t, { t_r } from '../Utility/i18n';
import { Letter, Template, formatAddress, LetterProps } from 'letter-generator';
import type { Address, Request, IdDataElement } from '../types/request';
import { isFieldEmpty } from '../Utility/requests';

type FormattedData = { formatted: string; primary_address: Address | null; name: string };
2 changes: 1 addition & 1 deletion src/DataType/SavedCompanies.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import localforage from 'localforage';
import Cookie from 'js-cookie';
import localforage from 'localforage';
import { rethrow } from '../Utility/errors';

// TODO: This should probably also be a (persisted) zustand store but since the generator and privacy controls also use
10 changes: 5 additions & 5 deletions src/DataType/SavedIdData.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { IdDataElement, Signature } from '../types/request';
import type { SetOptional } from 'type-fest';
import { rethrow, WarningException } from '../Utility/errors';
import { nothing, produce } from 'immer';
import Cookie from 'js-cookie';
import LocalForage from 'localforage';
import { produce, nothing } from 'immer';
import { isAddress, EMTPY_ADDRESS } from '../Utility/requests';
import type { SetOptional } from 'type-fest';
import type { IdDataElement, Signature } from '../types/request';
import { rethrow, WarningException } from '../Utility/errors';
import { EMTPY_ADDRESS, isAddress } from '../Utility/requests';

export class SavedIdData {
localforage_instance: LocalForage;
2 changes: 1 addition & 1 deletion src/Utility/browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { parseBcp47Tag, fallback_countries, isSupportedCountry } from './common';
import type { LiteralUnion } from 'type-fest';
import type { Country } from '../store/app';
import { fallback_countries, isSupportedCountry, parseBcp47Tag } from './common';

export const clearUrlParameters = () => {
window.history.pushState({}, document.title, `${window.BASE_URL}generator`);
Loading