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

ESLint no-default-exports 8 #2170

Merged
Merged
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
16 changes: 8 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,16 @@ module.exports = {
'./packages/desktop-client/src/components/autocomplete/**/*',
'./packages/desktop-client/src/components/budget/**/*',
'./packages/desktop-client/src/components/common/**/*',
// './packages/desktop-client/src/components/filters/**/*',
// './packages/desktop-client/src/components/gocardless/**/*',
// './packages/desktop-client/src/components/manager/**/*',
// './packages/desktop-client/src/components/mobile/**/*',
// './packages/desktop-client/src/components/modals/**/*',
// './packages/desktop-client/src/components/payees/**/*',
// './packages/desktop-client/src/components/reports/**/*',
'./packages/desktop-client/src/components/filters/**/*',
'./packages/desktop-client/src/components/gocardless/**/*',
'./packages/desktop-client/src/components/manager/**/*',
'./packages/desktop-client/src/components/mobile/**/*',
'./packages/desktop-client/src/components/modals/**/*',
'./packages/desktop-client/src/components/payees/**/*',
'./packages/desktop-client/src/components/reports/**/*',
// './packages/desktop-client/src/components/responsive/**/*',
// './packages/desktop-client/src/components/rules/**/*',
// './packages/desktop-client/src/components/schedules/**/*',
'./packages/desktop-client/src/components/schedules/**/*',
// './packages/desktop-client/src/components/select/**/*',
// './packages/desktop-client/src/components/settings/**/*',
// './packages/desktop-client/src/components/sidebar/**/*',
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { View } from './common/View';
import { DevelopmentTopBar } from './DevelopmentTopBar';
import { FatalError } from './FatalError';
import { FinancesApp } from './FinancesApp';
import ManagementApp from './manager/ManagementApp';
import { ManagementApp } from './manager/ManagementApp';
import { MobileWebMessage } from './MobileWebMessage';
import { UpdateNotification } from './UpdateNotification';

Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import { BudgetMonthCountProvider } from './budget/BudgetMonthCountContext';
import { View } from './common/View';
import { GlobalKeys } from './GlobalKeys';
import { ManageRulesPage } from './ManageRulesPage';
import MobileNavTabs from './mobile/MobileNavTabs';
import { MobileNavTabs } from './mobile/MobileNavTabs';
import { Modals } from './Modals';
import { Notifications } from './Notifications';
import { ManagePayeesPage } from './payees/ManagePayeesPage';
import Reports from './reports';
import { Reports } from './reports';
import { NarrowAlternate, WideComponent } from './responsive';
import { ScrollProvider } from './ScrollProvider';
import Settings from './settings';
Expand Down
56 changes: 28 additions & 28 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@ import useCategories from '../hooks/useCategories';
import useSyncServerStatus from '../hooks/useSyncServerStatus';
import { type CommonModalProps } from '../types/modals';

import CategoryGroupMenu from './modals/CategoryGroupMenu';
import CategoryMenu from './modals/CategoryMenu';
import CloseAccount from './modals/CloseAccount';
import ConfirmCategoryDelete from './modals/ConfirmCategoryDelete';
import ConfirmTransactionEdit from './modals/ConfirmTransactionEdit';
import CreateAccount from './modals/CreateAccount';
import CreateEncryptionKey from './modals/CreateEncryptionKey';
import CreateLocalAccount from './modals/CreateLocalAccount';
import EditField from './modals/EditField';
import EditRule from './modals/EditRule';
import FixEncryptionKey from './modals/FixEncryptionKey';
import GoCardlessExternalMsg from './modals/GoCardlessExternalMsg';
import GoCardlessInitialise from './modals/GoCardlessInitialise';
import ImportTransactions from './modals/ImportTransactions';
import LoadBackup from './modals/LoadBackup';
import ManageRulesModal from './modals/ManageRulesModal';
import MergeUnusedPayees from './modals/MergeUnusedPayees';
import Notes from './modals/Notes';
import PlaidExternalMsg from './modals/PlaidExternalMsg';
import ReportBudgetSummary from './modals/ReportBudgetSummary';
import RolloverBudgetSummary from './modals/RolloverBudgetSummary';
import SelectLinkedAccounts from './modals/SelectLinkedAccounts';
import SingleInput from './modals/SingleInput';
import SwitchBudgetType from './modals/SwitchBudgetType';
import DiscoverSchedules from './schedules/DiscoverSchedules';
import ScheduleDetails from './schedules/EditSchedule';
import ScheduleLink from './schedules/LinkSchedule';
import PostsOfflineNotification from './schedules/PostsOfflineNotification';
import { CategoryGroupMenu } from './modals/CategoryGroupMenu';
import { CategoryMenu } from './modals/CategoryMenu';
import { CloseAccount } from './modals/CloseAccount';
import { ConfirmCategoryDelete } from './modals/ConfirmCategoryDelete';
import { ConfirmTransactionEdit } from './modals/ConfirmTransactionEdit';
import { CreateAccount } from './modals/CreateAccount';
import { CreateEncryptionKey } from './modals/CreateEncryptionKey';
import { CreateLocalAccount } from './modals/CreateLocalAccount';
import { EditField } from './modals/EditField';
import { EditRule } from './modals/EditRule';
import { FixEncryptionKey } from './modals/FixEncryptionKey';
import { GoCardlessExternalMsg } from './modals/GoCardlessExternalMsg';
import { GoCardlessInitialise } from './modals/GoCardlessInitialise';
import { ImportTransactions } from './modals/ImportTransactions';
import { LoadBackup } from './modals/LoadBackup';
import { ManageRulesModal } from './modals/ManageRulesModal';
import { MergeUnusedPayees } from './modals/MergeUnusedPayees';
import { Notes } from './modals/Notes';
import { PlaidExternalMsg } from './modals/PlaidExternalMsg';
import { ReportBudgetSummary } from './modals/ReportBudgetSummary';
import { RolloverBudgetSummary } from './modals/RolloverBudgetSummary';
import { SelectLinkedAccounts } from './modals/SelectLinkedAccounts';
import { SingleInput } from './modals/SingleInput';
import { SwitchBudgetType } from './modals/SwitchBudgetType';
import { DiscoverSchedules } from './schedules/DiscoverSchedules';
import { PostsOfflineNotification } from './schedules/PostsOfflineNotification';
import { ScheduleDetails } from './schedules/ScheduleDetails';
import { ScheduleLink } from './schedules/ScheduleLink';

export function Modals() {
const modalStack = useSelector(state => state.modals.modalStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ type CompactFiltersButtonProps = {
onClick: (newValue) => void;
};

function CompactFiltersButton({ onClick }: CompactFiltersButtonProps) {
export function CompactFiltersButton({ onClick }: CompactFiltersButtonProps) {
return (
<Button type="bare" onClick={onClick}>
<Filter width={15} height={15} />
</Button>
);
}

export default CompactFiltersButton;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type FiltersButtonProps = {
onClick: (newValue) => void;
};

function FiltersButton({ onClick }: FiltersButtonProps) {
export function FiltersButton({ onClick }: FiltersButtonProps) {
return (
<Button type="bare" onClick={onClick} title="Filters">
<SettingsSliderAlternate
Expand All @@ -17,5 +17,3 @@ function FiltersButton({ onClick }: FiltersButtonProps) {
</Button>
);
}

export default FiltersButton;
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import Value from '../rules/Value';
import { Tooltip } from '../tooltips';
import GenericInput from '../util/GenericInput';

import CompactFiltersButton from './CompactFiltersButton';
import FiltersButton from './FiltersButton';
import { CompactFiltersButton } from './CompactFiltersButton';
import { FiltersButton } from './FiltersButton';
import { CondOpMenu } from './SavedFilters';

const filterFields = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Modal } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { View } from '../common/View';

export default function GoCardlessLink() {
export function GoCardlessLink() {
window.close();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function RefreshButton({ onRefresh }) {
);
}

export default function BudgetList() {
export function BudgetList() {
const files = useSelector(state => state.budgets.allFiles || []);

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useServerURL, useSetServerURL } from '../ServerContext';

import { Title } from './subscribe/common';

export default function ConfigServer() {
export function ConfigServer() {
useSetThemeColor(theme.mobileConfigServerViewTheme);
const { createBudget, signOut, loggedIn } = useActions();
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ type DeleteFileProps = {
file: File;
};

export default function DeleteFile({
modalProps,
actions,
file,
}: DeleteFileProps) {
export function DeleteFile({ modalProps, actions, file }: DeleteFileProps) {
// If the state is "broken" that means it was created by another
// user. The current user should be able to delete the local file,
// but not the remote one
Expand Down
4 changes: 1 addition & 3 deletions packages/desktop-client/src/components/manager/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ImportProps = {
actions: BoundActions;
};

function Import({ modalProps, actions }: ImportProps) {
export function Import({ modalProps, actions }: ImportProps) {
const [error] = useState(false);

function onSelectType(type: 'ynab4' | 'ynab5' | 'actual') {
Expand Down Expand Up @@ -87,5 +87,3 @@ function Import({ modalProps, actions }: ImportProps) {
</Modal>
);
}

export default Import;
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ImportProps = {
modalProps?: ModalProps;
};

function Import({ modalProps }: ImportProps) {
export function ImportActual({ modalProps }: ImportProps) {
const dispatch = useDispatch();
const [error, setError] = useState<string | null>(null);
const [importing, setImporting] = useState(false);
Expand Down Expand Up @@ -95,5 +95,3 @@ function Import({ modalProps }: ImportProps) {
</Modal>
);
}

export default Import;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ImportProps = {
modalProps?: ModalProps;
};

function Import({ modalProps }: ImportProps) {
export function ImportYNAB4({ modalProps }: ImportProps) {
const dispatch = useDispatch();
const [error, setError] = useState<string | null>(null);
const [importing, setImporting] = useState(false);
Expand Down Expand Up @@ -84,5 +84,3 @@ function Import({ modalProps }: ImportProps) {
</Modal>
);
}

export default Import;
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ImportProps = {
modalProps?: ModalProps;
};

function Import({ modalProps }: ImportProps) {
export function ImportYNAB5({ modalProps }: ImportProps) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: ‏I wonder if there is an eslint rule we could add that would enforce the exported component to use the same name as the file.

const dispatch = useDispatch();
const [error, setError] = useState<string | null>(null);
const [importing, setImporting] = useState(false);
Expand Down Expand Up @@ -91,5 +91,3 @@ function Import({ modalProps }: ImportProps) {
</Modal>
);
}

export default Import;
20 changes: 10 additions & 10 deletions packages/desktop-client/src/components/manager/ManagementApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import { LoggedInUser } from '../LoggedInUser';
import { Notifications } from '../Notifications';
import { useServerVersion } from '../ServerContext';

import BudgetList from './BudgetList';
import ConfigServer from './ConfigServer';
import Modals from './Modals';
import ServerURL from './ServerURL';
import Bootstrap from './subscribe/Bootstrap';
import ChangePassword from './subscribe/ChangePassword';
import Error from './subscribe/Error';
import Login from './subscribe/Login';
import WelcomeScreen from './WelcomeScreen';
import { BudgetList } from './BudgetList';
import { ConfigServer } from './ConfigServer';
import { Modals } from './Modals';
import { ServerURL } from './ServerURL';
import { Bootstrap } from './subscribe/Bootstrap';
import { ChangePassword } from './subscribe/ChangePassword';
import { Error } from './subscribe/Error';
import { Login } from './subscribe/Login';
import { WelcomeScreen } from './WelcomeScreen';

function Version() {
const version = useServerVersion();
Expand All @@ -47,7 +47,7 @@ function Version() {
);
}

export default function ManagementApp({ isLoading }) {
export function ManagementApp({ isLoading }) {
const files = useSelector(state => state.budgets.allFiles);
const userData = useSelector(state => state.user.data);
const managerHasInitialized = useSelector(
Expand Down
18 changes: 9 additions & 9 deletions packages/desktop-client/src/components/manager/Modals.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { useSelector } from 'react-redux';

import { useActions } from '../../hooks/useActions';
import { View } from '../common/View';
import CreateEncryptionKey from '../modals/CreateEncryptionKey';
import FixEncryptionKey from '../modals/FixEncryptionKey';
import LoadBackup from '../modals/LoadBackup';
import { CreateEncryptionKey } from '../modals/CreateEncryptionKey';
import { FixEncryptionKey } from '../modals/FixEncryptionKey';
import { LoadBackup } from '../modals/LoadBackup';

import DeleteFile from './DeleteFile';
import Import from './Import';
import ImportActual from './ImportActual';
import ImportYNAB4 from './ImportYNAB4';
import ImportYNAB5 from './ImportYNAB5';
import { DeleteFile } from './DeleteFile';
import { Import } from './Import';
import { ImportActual } from './ImportActual';
import { ImportYNAB4 } from './ImportYNAB4';
import { ImportYNAB5 } from './ImportYNAB5';

export default function Modals() {
export function Modals() {
const modalStack = useSelector(state => state.modals.modalStack);
const isHidden = useSelector(state => state.modals.isHidden);
const actions = useActions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Text } from '../common/Text';
import { View } from '../common/View';
import { useServerURL } from '../ServerContext';

export default function ServerURL() {
export function ServerURL() {
const url = useServerURL();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
import { View } from '../common/View';

export default function WelcomeScreen() {
export function WelcomeScreen() {
const { createBudget, pushModal } = useActions();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { View } from '../../common/View';
import { useBootstrapped, Title } from './common';
import { ConfirmPasswordForm } from './ConfirmPasswordForm';

export default function Bootstrap() {
export function Bootstrap() {
const dispatch = useDispatch();
const [error, setError] = useState(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { View } from '../../common/View';
import { Title } from './common';
import { ConfirmPasswordForm } from './ConfirmPasswordForm';

export default function ChangePassword() {
export function ChangePassword() {
const navigate = useNavigate();
const [error, setError] = useState(null);
const [msg, setMessage] = useState(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getErrorMessage(reason) {
}
}

export default function Error() {
export function Error() {
const navigate = useNavigate();
const location = useLocation();
const { error } = (location.state || {}) as { error? };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { View } from '../../common/View';

import { useBootstrapped, Title } from './common';

export default function Login() {
export function Login() {
const dispatch = useDispatch();
const [password, setPassword] = useState('');
const [loading, setLoading] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useScroll } from '../ScrollProvider';
const ROW_HEIGHT = 70;
const COLUMN_COUNT = 3;

export default function MobileNavTabs() {
export function MobileNavTabs() {
const { isNarrowWidth } = useResponsive();
const { scrollY } = useScroll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type CategoryGroupMenuProps = {
onClose?: () => void;
};

export default function CategoryGroupMenu({
export function CategoryGroupMenu({
modalProps,
groupId,
onSave,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type CategoryMenuProps = {
onClose?: () => void;
};

export default function CategoryMenu({
export function CategoryMenu({
modalProps,
categoryId,
onSave,
Expand Down
Loading
Loading