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

[no-Jira] Sort import statements and members #829

Merged
merged 5 commits into from
Dec 5, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 37 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,48 @@ module.exports = {
'@typescript-eslint/camelcase': 'off',
'import/no-duplicates': 'error',
'import/extensions': 'error',
'import/order': ['error', { groups: ['external'] }],
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
alphabetize: { order: 'asc' },
'newlines-between': 'never',
pathGroups: [
{
pattern: '{next,react}',
group: 'external',
position: 'before',
},
{
pattern: '{src,pages,__tests__}/**',
group: 'parent',
position: 'before',
},
],
},
],
'import/newline-after-import': 'error',
'import/no-named-default': 'error',
'import/no-named-as-default-member': 'off',
'import/no-anonymous-default-export': 'error',
'import/no-useless-path-segments': 'error',
'import/dynamic-import-chunkname': 'error',
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
ignoreMemberSort: false,
},
],
eqeqeq: 'error',
'no-console': 'error',
'@typescript-eslint/no-loss-of-precision': 'warn',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/pages/api/MpdxWebHandoff.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createMocks } from 'node-mocks-http';
import { getToken } from 'next-auth/jwt';
import { createMocks } from 'node-mocks-http';
import mpdxWebHandoff from '../../../pages/api/mpdx-web-handoff.page';
import { taskFiltersTabs } from '../../../src/utils/tasks/taskFilterTabs';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/pages/api/handoff.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMocks } from 'node-mocks-http';
import { getToken } from 'next-auth/jwt';
import handoff from '../../../pages/api/handoff.page';
import { createMocks } from 'node-mocks-http';
import { ssrClient } from 'src/lib/client';
import handoff from '../../../pages/api/handoff.page';

jest.mock('next-auth/jwt', () => ({ getToken: jest.fn() }));
jest.mock('src/lib/client', () => ({ ssrClient: jest.fn() }));
Expand Down
4 changes: 2 additions & 2 deletions __tests__/pages/api/stopImpersonating.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMocks } from 'node-mocks-http';
import { getToken } from 'next-auth/jwt';
import stopImpersonating from '../../../pages/api/stop-impersonating.page';
import { createMocks } from 'node-mocks-http';
import { ssrClient } from 'src/lib/client';
import stopImpersonating from '../../../pages/api/stop-impersonating.page';

jest.mock('next-auth/jwt', () => ({ getToken: jest.fn() }));
jest.mock('src/lib/client', () => ({ ssrClient: jest.fn() }));
Expand Down
2 changes: 1 addition & 1 deletion __tests__/util/TestRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ReactElement, ReactNode } from 'react';
import Router, { NextRouter, Router as IRouter } from 'next/router'; // eslint-disable-line import/no-named-as-default
import { RouterContext } from 'next/dist/shared/lib/router-context';
import Router, { Router as IRouter, NextRouter } from 'next/router'; // eslint-disable-line import/no-named-as-default

interface Props {
children: ReactNode;
Expand Down
8 changes: 4 additions & 4 deletions __tests__/util/TestWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MockedResponse, MockedProvider } from '@apollo/client/testing';
import { SnackbarProvider } from 'notistack';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import React, { ReactElement, ReactNode } from 'react';
import { InMemoryCache } from '@apollo/client';
import { MockedProvider, MockedResponse } from '@apollo/client/testing';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { SnackbarProvider } from 'notistack';
import TestRouter from './TestRouter';

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/util/googlePlacesMock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useJsApiLoader } from '@react-google-maps/api';
import { act } from '@testing-library/react-hooks';
import { useEffect, useState } from 'react';

export const place = {
address_components: [
Expand Down
6 changes: 3 additions & 3 deletions __tests__/util/graphqlMocking.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { PropsWithChildren, ReactElement } from 'react';
import { mergeSchemas } from '@graphql-tools/schema';
import {
buildASTSchema,
DocumentNode,
ExecutionResult,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLSchema,
buildASTSchema,
isSchema,
} from 'graphql';
import {
Expand All @@ -14,12 +15,11 @@ import {
ErgonomockOptions,
ergonomock,
} from 'graphql-ergonomock';
import { mergeSchemas } from '@graphql-tools/schema';
import { DefaultMockResolvers } from 'graphql-ergonomock/dist/mock';
import { gql } from 'graphql-tag';
import seedrandom from 'seedrandom';
import { DeepPartial } from 'ts-essentials';
import schema from '../../graphql/schema.graphql';
import { DefaultMockResolvers } from 'graphql-ergonomock/dist/mock';

const seed = 'seed';
const rng = seedrandom(seed);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/util/testingLibraryReactMock.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable import/export */
import React, { ReactElement } from 'react';
import { render, RenderResult, RenderOptions } from '@testing-library/react';
import { RenderOptions, RenderResult, render } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
import i18n from '../../src/lib/i18n';
import translation from '../../public/locales/en/translation.json';
import i18n from '../../src/lib/i18n';

i18n.addResourceBundle('en', 'translation', translation);

Expand Down
5 changes: 3 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const path = require('path');
const bundleAnalyzer = require('@next/bundle-analyzer');
const withPlugins = require('next-compose-plugins');
const withPWA = require('next-pwa');
const withOptimizedImages = require('next-optimized-images');
const withGraphql = require('next-plugin-graphql');
const withPWA = require('next-pwa');
require('dotenv').config();

if (process.env.secrets) {
Expand All @@ -26,7 +27,7 @@ if (prod && !process.env.JWT_SECRET) {

const siteUrl = process.env.SITE_URL ?? 'http://localhost:3000';

const withBundleAnalyzer = require('@next/bundle-analyzer')({
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
});

Expand Down
6 changes: 3 additions & 3 deletions pages/404.page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react';
import Head from 'next/head';
import { Box, Typography, Button } from '@mui/material';
import DisabledByDefaultOutlinedIcon from '@mui/icons-material/DisabledByDefaultOutlined';
import { Box, Button, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import Head from 'next/head';
import { useTranslation } from 'react-i18next';
import DisabledByDefaultOutlinedIcon from '@mui/icons-material/DisabledByDefaultOutlined';
import useGetAppSettings from '../src/hooks/useGetAppSettings';

const BoxWrapper = styled(Box)(({ theme }) => ({
Expand Down
6 changes: 3 additions & 3 deletions pages/500.page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react';
import Head from 'next/head';
import { Box, Typography, Button } from '@mui/material';
import DisabledByDefaultOutlinedIcon from '@mui/icons-material/DisabledByDefaultOutlined';
import { Box, Button, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import Head from 'next/head';
import { useTranslation } from 'react-i18next';
import DisabledByDefaultOutlinedIcon from '@mui/icons-material/DisabledByDefaultOutlined';
import useGetAppSettings from '../src/hooks/useGetAppSettings';

const BoxWrapper = styled(Box)(({ theme }) => ({
Expand Down
44 changes: 22 additions & 22 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import { NextPage } from 'next';
import React, { ReactElement } from 'react';
import Rollbar from 'rollbar';
import { ErrorBoundary, Provider } from '@rollbar/react';
import type { AppProps } from 'next/app';
import { ApolloProvider } from '@apollo/client';
import { Box } from '@mui/material';
import StyledEngineProvider from '@mui/material/StyledEngineProvider';
import { ThemeProvider } from '@mui/material/styles';
import { Box } from '@mui/material';
import { ApolloProvider } from '@apollo/client';
import {
LocalizationProviderProps,
LocalizationProvider as RawLocalizationProvider,
} from '@mui/x-date-pickers/LocalizationProvider';
import { ErrorBoundary, Provider } from '@rollbar/react';
import { AnimatePresence } from 'framer-motion';
import { Session } from 'next-auth';
import { SessionProvider } from 'next-auth/react';
import { NextPage } from 'next';
import Head from 'next/head';
import { I18nextProvider, useTranslation } from 'react-i18next';
import {
LocalizationProvider as RawLocalizationProvider,
LocalizationProviderProps,
} from '@mui/x-date-pickers/LocalizationProvider';
import { SnackbarProvider } from 'notistack';
import theme from '../src/theme';
import client from '../src/lib/client';
import { I18nextProvider, useTranslation } from 'react-i18next';
import Rollbar from 'rollbar';
import DataDog from 'src/components/DataDog/DataDog';
import { AlertBanner } from 'src/components/Shared/alertBanner/AlertBanner';
import { UserPreferenceProvider } from 'src/components/User/Preferences/UserPreferenceProvider';
import { useLocale } from 'src/hooks/useLocale';
import { GlobalStyles } from '../src/components/GlobalStyles/GlobalStyles';
import HelpscoutBeacon from '../src/components/Helpscout/HelpscoutBeacon';
import PrimaryLayout from '../src/components/Layouts/Primary';
import Loading from '../src/components/Loading';
import i18n from '../src/lib/i18n';
import TaskModalProvider from '../src/components/Task/Modal/TaskModalProvider';
import { SnackbarUtilsConfigurator } from '../src/components/Snackbar/Snackbar';
import { GlobalStyles } from '../src/components/GlobalStyles/GlobalStyles';
import { RouterGuard } from '../src/components/RouterGuard/RouterGuard';
import HelpscoutBeacon from '../src/components/Helpscout/HelpscoutBeacon';
import { UserPreferenceProvider } from 'src/components/User/Preferences/UserPreferenceProvider';
import { SnackbarUtilsConfigurator } from '../src/components/Snackbar/Snackbar';
import TaskModalProvider from '../src/components/Task/Modal/TaskModalProvider';
import { AppSettingsProvider } from '../src/components/common/AppSettings/AppSettingsProvider';
import DataDog from 'src/components/DataDog/DataDog';
import { useLocale } from 'src/hooks/useLocale';
import { AlertBanner } from 'src/components/Shared/alertBanner/AlertBanner';
import client from '../src/lib/client';
import i18n from '../src/lib/i18n';
import theme from '../src/theme';
import { AdapterLuxon } from './api/utils/AdapterLuxon';
import type { AppProps } from 'next/app';
import './helpscout.css';
import './print.css';

Expand Down
10 changes: 5 additions & 5 deletions pages/_document.page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { ReactElement } from 'react';
import { ServerStyleSheets } from '@mui/styles';
import { RenderPageResult } from 'next/dist/shared/lib/utils';
import Document, {
Html,
DocumentContext,
DocumentInitialProps,
Head,
Html,
Main,
NextScript,
DocumentContext,
DocumentInitialProps,
} from 'next/document';
import Script from 'next/script';
import { ServerStyleSheets } from '@mui/styles';
import { RenderPageResult } from 'next/dist/shared/lib/utils';
import theme from '../src/theme';

class MyDocument extends Document {
Expand Down
6 changes: 3 additions & 3 deletions pages/accountLists.page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { ReactElement } from 'react';
import Head from 'next/head';
import { GetServerSideProps, GetServerSidePropsResult } from 'next';
import React, { ReactElement } from 'react';
import { getToken } from 'next-auth/jwt';
import Head from 'next/head';
import { useTranslation } from 'react-i18next';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import AccountLists from '../src/components/AccountLists';
import { ssrClient } from '../src/lib/client';
import BaseLayout from '../src/components/Layouts/Primary';
import { ssrClient } from '../src/lib/client';
import {
GetAccountListsDocument,
GetAccountListsQuery,
Expand Down
12 changes: 6 additions & 6 deletions pages/accountLists/[accountListId].page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { ReactElement, useState, useEffect } from 'react';
import Head from 'next/head';
import { GetServerSideProps } from 'next';
import React, { ReactElement, useEffect, useState } from 'react';
import { getToken } from 'next-auth/jwt';
import useGetAppSettings from '../../src/hooks/useGetAppSettings';
import Head from 'next/head';
import { renderDialog } from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/AddMenu';
import { suggestArticles } from 'src/lib/helpScout';
import Dashboard from '../../src/components/Dashboard';
import useGetAppSettings from '../../src/hooks/useGetAppSettings';
import useTaskModal from '../../src/hooks/useTaskModal';
import { ssrClient } from '../../src/lib/client';
import {
GetDashboardDocument,
GetDashboardQuery,
GetDashboardQueryVariables,
} from './GetDashboard.generated';
import { renderDialog } from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/AddMenu';
import useTaskModal from '../../src/hooks/useTaskModal';
import { suggestArticles } from 'src/lib/helpScout';

interface Props {
data: GetDashboardQuery;
Expand Down
4 changes: 2 additions & 2 deletions pages/accountLists/[accountListId]/coaching.page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import Head from 'next/head';
import { useTranslation } from 'react-i18next';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { CoachingList } from 'src/components/Coaching/CoachingList';
import { useAccountListId } from 'src/hooks/useAccountListId';
import Loading from 'src/components/Loading';
import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';

const CoachingPage: React.FC = () => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import Head from 'next/head';
import { useTranslation } from 'react-i18next';
import { useRouter } from 'next/router';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { useTranslation } from 'react-i18next';
import {
AccountListTypeEnum,
CoachingDetail,
} from 'src/components/Coaching/CoachingDetail/CoachingDetail';
import { useAccountListId } from 'src/hooks/useAccountListId';
import Loading from 'src/components/Loading';
import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';

const CoachingPage: React.FC = () => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import React, { useContext } from 'react';
import { render, waitFor } from '@testing-library/react';
import { Box, Button, Typography } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
import { GetUserOptionsQuery } from 'src/components/Contacts/ContactFlow/GetUserOptions.generated';
import TestRouter from '../../../../__tests__/util/TestRouter';
import theme from '../../../../src/theme';
import { useMassSelection } from '../../../../src/hooks/useMassSelection';
import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
import {
ListHeaderCheckBoxState,
TableViewModeEnum,
} from '../../../../src/components/Shared/Header/ListHeader';
import { useMassSelection } from '../../../../src/hooks/useMassSelection';
import theme from '../../../../src/theme';
import { ContactFiltersQuery } from './Contacts.generated';
import {
ContactsContext,
ContactsType,
ContactsContextSavedFilters,
ContactsType,
} from './ContactsContext';
import { GetUserOptionsQuery } from 'src/components/Contacts/ContactFlow/GetUserOptions.generated';
import { ContactsPage } from './ContactsPage';
import { ContactFiltersQuery } from './Contacts.generated';

const accountListId = 'account-list-1';
const push = jest.fn();
Expand Down
Loading