Skip to content

Commit 9f64f6e

Browse files
committed
refact: use @/ to import from src/
1 parent ce78ca4 commit 9f64f6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+164
-220
lines changed

.prettierrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
...require('@code-expert/prettier-config'),
3-
importOrder: ['<THIRD_PARTY_MODULES>', '^prelude/(.*)$', '^(/|.{0,2}/)', '^.$'],
4-
importOrderSeparation: true,
3+
importOrder: ['<THIRD_PARTY_MODULES>', '^@code-expert/prelude$', '^@/', '^(/|.{0,2}/)', '^.$'],
4+
importOrderSeparation: false,
55
importOrderSortSpecifiers: true,
66
};

src/.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const noRestrictedImportsBase = [
2525
},
2626
{
2727
group: ['@fortawesome/**'],
28-
message: "Only import from 'import { Icon } from '/imports/ui/foundation/Icons'",
28+
message: "Only import from 'import { Icon } from '@/ui/foundation/Icons'",
2929
},
3030
];
3131

src/App.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
32
import App from './App';
43

54
export default {

src/App.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { boolean, pipe } from '@code-expert/prelude';
21
import { Result } from 'antd';
32
import React from 'react';
4-
5-
import { GlobalContextProvider } from './ui/GlobalContext';
6-
import Routes from './ui/Routes';
7-
import useNetworkState from './ui/hooks/useNetwork';
8-
import { AppLayout } from './ui/layout';
3+
import { boolean, pipe } from '@code-expert/prelude';
4+
import { GlobalContextProvider } from '@/ui/GlobalContext';
5+
import Routes from '@/ui/Routes';
6+
import useNetworkState from '@/ui/hooks/useNetwork';
7+
import { AppLayout } from '@/ui/layout';
98

109
function App() {
1110
const { online } = useNetworkState();

src/api/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { flow, iots, json, option, pipe, task, taskEither, taskOption } from '@code-expert/prelude';
21
import { invoke } from '@tauri-apps/api';
32
import { getVersion } from '@tauri-apps/api/app';
43
import {
@@ -11,8 +10,8 @@ import {
1110
} from '@tauri-apps/api/fs';
1211
import { dirname } from '@tauri-apps/api/path';
1312
import { Store as TauriStore } from 'tauri-plugin-store-api';
14-
15-
import { Exception, fromError } from '../domain/exception';
13+
import { flow, iots, json, option, pipe, task, taskEither, taskOption } from '@code-expert/prelude';
14+
import { Exception, fromError } from '@/domain/exception';
1615

1716
const store = new TauriStore('settings.json');
1817

src/api/oauth/getAccess.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { iots } from '@code-expert/prelude';
2-
3-
import { ClientId } from '../../domain/ClientId';
4-
import { createAPIRequest } from '../../domain/createAPIRequest';
2+
import { ClientId } from '@/domain/ClientId';
3+
import { createAPIRequest } from '@/domain/createAPIRequest';
54

65
const responseCodec = iots.strict({});
76
export const getAccess = (

src/domain/AuthState.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { pipe, tagged, task, taskEither } from '@code-expert/prelude';
21
import { api } from 'api';
32
import React from 'react';
4-
5-
import { getAccess } from '../api/oauth/getAccess';
6-
import useTimeout from '../ui/hooks/useTimeout';
7-
import { pkceChallenge } from '../utils/crypto';
3+
import { pipe, tagged, task, taskEither } from '@code-expert/prelude';
4+
import { getAccess } from '@/api/oauth/getAccess';
5+
import useTimeout from '@/ui/hooks/useTimeout';
6+
import { pkceChallenge } from '@/utils/crypto';
87
import { ClientId } from './ClientId';
98

109
export type GlobalAuthState = tagged.Tagged<'notAuthorized'> | tagged.Tagged<'authorized'>;

src/domain/AuthToken.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { iots } from '@code-expert/prelude';
2-
3-
import { Base64Url } from '../utils/base64url';
2+
import { Base64Url } from '@/utils/base64url';
43

54
export interface AccessTokenBrand {
65
readonly AccessToken: unique symbol;

src/domain/ClientId.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { iots } from '@code-expert/prelude';
2-
3-
import { Base64Url } from '../utils/base64url';
2+
import { Base64Url } from '@/utils/base64url';
43

54
export interface ClientIdBrand {
65
readonly ClientId: unique symbol;

src/domain/Project.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { iots, tagged } from '@code-expert/prelude';
2-
3-
import { mkEntityIdCodec } from '../utils/identity';
2+
import { mkEntityIdCodec } from '@/utils/identity';
43

54
export const ProjectIdBrand = Symbol('ProjectId');
65
export const ProjectId = mkEntityIdCodec(ProjectIdBrand);

src/domain/ProjectAccess.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { either, pipe, task } from '@code-expert/prelude';
21
import { api } from 'api';
32
import React from 'react';
4-
3+
import { either, pipe, task } from '@code-expert/prelude';
54
import { createToken } from './createAPIRequest';
65

76
const cleanUpEventListener = (

src/domain/createAPIRequest.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { either, flow, iots, pipe, taskEither } from '@code-expert/prelude';
21
import { Body, Response, ResponseType, fetch } from '@tauri-apps/api/http';
32
import { api } from 'api';
4-
3+
import { either, flow, iots, pipe, taskEither } from '@code-expert/prelude';
54
import { ClientId } from './ClientId';
65
import {
76
EntityNotFoundException,

src/domain/exception.tests.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { either, iots, monoid, pipe, string } from '@code-expert/prelude';
21
import { assert, describe, it } from 'vitest';
3-
4-
import { ValidationException } from '../domain/exception';
2+
import { either, iots, monoid, pipe, string } from '@code-expert/prelude';
3+
import { ValidationException } from '@/domain/exception';
54

65
describe('ValidationException', () => {
76
it('should emit validation errors', () => {

src/domain/exception.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable max-classes-per-file */
22
import { FunctionN, adt, array, monoid, pipe, string } from '@code-expert/prelude';
3-
4-
import { isObject } from '../utils/fn';
3+
import { isObject } from '@/utils/fn';
54

65
// -------------------------------------------------------------------------------------------------
76
// Types

src/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { createRoot } from 'react-dom/client';
3-
43
import App from './App';
54
import './global.css';
65
import './reset.css';

src/startup/getClientToken.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { iots, pipe, taskEither } from '@code-expert/prelude';
21
import { api } from 'api';
3-
4-
import { ClientId } from '../domain/ClientId';
5-
import { createAPIRequest } from '../domain/createAPIRequest';
2+
import { iots, pipe, taskEither } from '@code-expert/prelude';
3+
import { ClientId } from '@/domain/ClientId';
4+
import { createAPIRequest } from '@/domain/createAPIRequest';
65

76
export const getClientToken = pipe(
87
api.settingRead('clientId', ClientId),

src/startup/registerApp.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { constVoid, iots, pipe, taskEither } from '@code-expert/prelude';
21
import { invoke } from '@tauri-apps/api';
32
import { getName, getVersion } from '@tauri-apps/api/app';
43
import { api } from 'api';
5-
6-
import { createAPIRequest } from '../domain/createAPIRequest';
4+
import { constVoid, iots, pipe, taskEither } from '@code-expert/prelude';
5+
import { createAPIRequest } from '@/domain/createAPIRequest';
76
import { getClientToken } from './getClientToken';
87

98
const registerApp = async () => {

src/tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"emitDeclarationOnly": false,
77
"noEmit": true,
88
"jsx": "react",
9+
"baseUrl": ".",
910
"paths": {
11+
"@/*": ["./*"],
1012
"api": ["./api/index.ts"],
1113
"@code-expert/prelude": ["../packages/prelude"],
1214
"@code-expert/test-utils": ["../packages/test-utils"],

src/ui/GlobalContext.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { constVoid, either, iots, pipe, tagged, task } from '@code-expert/prelude';
21
import equal from 'fast-deep-equal';
32
import React, { useEffect } from 'react';
4-
5-
import { GlobalAuthState, globalAuthState } from '../domain/AuthState';
6-
import { createSignedAPIRequest } from '../domain/createAPIRequest';
3+
import { constVoid, either, iots, pipe, tagged, task } from '@code-expert/prelude';
4+
import { GlobalAuthState, globalAuthState } from '@/domain/AuthState';
5+
import { createSignedAPIRequest } from '@/domain/createAPIRequest';
76
import Loading from './components/Loading';
87

98
export type Routes =

src/ui/Routes.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { useHotkeys } from 'react-hotkeys-hook';
3-
4-
import { globalAuthState } from '../domain/AuthState';
3+
import { globalAuthState } from '@/domain/AuthState';
54
import { routes, useGlobalContextWithActions } from './GlobalContext';
65
import { Developer } from './pages/Developer';
76
import { Logout } from './pages/Logout';

src/ui/components/ActionButton.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Story } from '@storybook/react';
22
import React from 'react';
3-
43
import { ActionButton, ActionButtonProps } from './ActionButton';
54

65
export default {

src/ui/components/ActionButton.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Button } from 'antd';
22
import { ButtonProps } from 'antd/es/button';
33
import React from 'react';
4-
5-
import { Icon, IconName } from '../foundation/Icons';
6-
import { styled } from '../foundation/Theme';
4+
import { Icon, IconName } from '@/ui/foundation/Icons';
5+
import { styled } from '@/ui/foundation/Theme';
76

87
const StyledButton = styled(Button, ({ tokens }) => ({
98
display: 'block',

src/ui/components/ActionMenu.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Story } from '@storybook/react';
22
import React from 'react';
3-
43
import { ActionMenu, ActionMenuProps } from './ActionMenu';
54

65
export default {

src/ui/components/ActionMenu.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Dropdown } from 'antd';
22
import type { DropdownProps } from 'antd/es/dropdown/dropdown';
33
import React from 'react';
4-
54
import { ActionButton, ActionButtonProps } from './ActionButton';
65

76
export interface ActionMenuProps

src/ui/components/Delayed.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
2-
3-
import useTimeout from '../hooks/useTimeout';
2+
import useTimeout from '@/ui/hooks/useTimeout';
43

54
/**
65
* A Delayed Component which will render the children after waitBeforeShow time

src/ui/components/GuardRemoteData.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { pipe, remoteData } from '@code-expert/prelude';
21
import { Result } from 'antd';
32
import React from 'react';
4-
5-
import { Exception } from '../../domain/exception';
3+
import { pipe, remoteData } from '@code-expert/prelude';
4+
import { Exception } from '@/domain/exception';
65
import Loading from './Loading';
76

87
const renderLoading = () => <Loading delayTime={200} />;

src/ui/components/Loading.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Spin } from 'antd';
22
import React from 'react';
3-
4-
import { styled } from '../foundation/Theme';
3+
import { styled } from '@/ui/foundation/Theme';
54
import { Delayed } from './Delayed';
65

76
const StyledSpinContainer = styled('div', () => ({

src/ui/components/TableSearchFilter.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { pipe, string } from '@code-expert/prelude';
21
import { Button, Input, InputRef } from 'antd';
32
import { ColumnGroupType, ColumnType } from 'antd/es/table';
43
import React from 'react';
5-
6-
import { Icon } from '../foundation/Icons';
4+
import { pipe, string } from '@code-expert/prelude';
5+
import { Icon } from '@/ui/foundation/Icons';
76

87
function getColumnSearchProps<A>(dataIndex: string): ColumnGroupType<A> | ColumnType<A> {
98
let searchInput: InputRef | null;

src/ui/components/TagButton.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Button, ButtonProps } from 'antd';
22
import React from 'react';
3-
4-
import { styled } from '../foundation/Theme';
3+
import { styled } from '@/ui/foundation/Theme';
54

65
const StyledTagButton = styled(Button, () => ({
76
lineHeight: '20px',

src/ui/foundation/Icons/Icon.stories.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/* eslint-disable storybook/default-exports */
22
import { Table, Typography } from 'antd';
33
import React from 'react';
4-
5-
import { getColumnSearchPropsAcc } from '../../components/TableSearchFilter';
4+
import { getColumnSearchPropsAcc } from '@/ui/components/TableSearchFilter';
65
import Icon, { IconName, iconNames } from './Icon';
76

87
export default {

src/ui/foundation/Icons/Icon.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable no-restricted-imports */
2-
import { array, pipe, record, string } from '@code-expert/prelude';
32
import type { IconName as FaIconName, IconDefinition } from '@fortawesome/fontawesome-common-types';
43
import '@fortawesome/fontawesome-svg-core/styles.css';
54
import { faDocker } from '@fortawesome/free-brands-svg-icons/faDocker';
@@ -166,6 +165,7 @@ import { faVideo } from '@fortawesome/free-solid-svg-icons/faVideo';
166165
import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
167166
import React from 'react';
168167
import { FontAwesomeSvgIcon, FontAwesomeSvgIconProps } from 'react-fontawesome-svg-icon';
168+
import { array, pipe, record, string } from '@code-expert/prelude';
169169

170170
const icons_ = {
171171
'align-justify': faAlignJustify,

src/ui/foundation/Layout/Box.stories.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Story } from '@storybook/react';
22
import React from 'react';
3-
4-
import { useTheme } from '../Theme';
3+
import { useTheme } from '@/ui/foundation/Theme';
54
import { Box, BoxProps } from './Box';
65

76
export default {

src/ui/foundation/Layout/Box.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
32
import { StyledSystemProp, useStyledSystem } from './styled-system';
43
import { PolymorphicComponentPropWithRef, PolymorphicRef } from './type-utils';
54

src/ui/foundation/Layout/HStack.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Story } from '@storybook/react';
22
import React from 'react';
3-
43
import * as BoxStories from './Box.stories';
54
import { HStack, StackProps } from './Stack';
65

src/ui/foundation/Layout/Stack.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
2-
3-
import { useTheme } from '../Theme';
2+
import { useTheme } from '@/ui/foundation/Theme';
43
import { BoxProps } from './Box';
54
import {
65
Align,

src/ui/foundation/Layout/VStack.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Story } from '@storybook/react';
22
import React from 'react';
3-
43
import * as BoxStories from './Box.stories';
54
import { StackProps, VStack } from './Stack';
65

src/ui/foundation/Layout/index.stories.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
2-
3-
import { styled, useTheme } from '../Theme';
2+
import { styled, useTheme } from '@/ui/foundation/Theme';
43
import { Box } from './Box';
54
import { HStack, VStack } from './Stack';
65

src/ui/foundation/Layout/styled-system.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
2-
3-
import { DesignTokens, css, useTheme } from '../Theme';
2+
import { DesignTokens, css, useTheme } from '@/ui/foundation/Theme';
43

54
type CSSPercentage = '%';
65

src/ui/foundation/Theme/styled.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
22
import React from 'react';
3-
43
import { GetStyles, css, keyframes, styled } from './styled';
54

65
export default {

src/ui/foundation/Theme/styled.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ import React, {
2323
ReactSVGElement,
2424
SVGAttributes,
2525
} from 'react';
26-
27-
import { CSSInterpolation, Keyframes, useStyleRegisterNoSSR } from '../../../lib/antd';
28-
import { isObject } from '../../../utils/fn';
26+
import { CSSInterpolation, Keyframes, useStyleRegisterNoSSR } from '@/lib/antd';
27+
import { isObject } from '@/utils/fn';
2928
import { Theme, useTheme } from './theme';
3029
import {
3130
CSSWithVariants,

0 commit comments

Comments
 (0)