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
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"postcss-preset-env": "^7.0.1",
"postcss-url": "^10.1.3",
"prettier": "^2.5.0",
"prettier-plugin-organize-imports": "^2.3.4",
"speed-measure-webpack-plugin": "^1.5.0",
"stylelint": "^14.1.0",
"stylelint-a11y": "^1.2.1",
Expand Down
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[];
Expand Down
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, '')}`;
Expand Down
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 {
Expand Down
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];
Expand Down
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 = {
Expand Down
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 = {
Expand Down
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 = {
Expand Down
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';

Expand Down
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'>>;
Expand Down
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);
Expand Down
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 = () => {
Expand Down
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;
Expand Down
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;
Expand Down
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;
Expand Down
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;
Expand Down
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() {
Expand Down
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;
Expand Down
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[];
Expand Down
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;

Expand Down
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;
Expand Down
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;
Expand Down
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 = (
Expand Down
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';

Expand Down
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;
Expand Down
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 = {
Expand Down
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;
Expand Down
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',
Expand Down
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 };
Expand Down
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
Expand Down
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;
Expand Down
Loading