feat: forced file naming format (#2270)

This commit is contained in:
Himself65
2023-05-08 17:37:07 -05:00
committed by GitHub
parent 95bc5cac49
commit 4f99ad2db4
132 changed files with 208 additions and 100 deletions
+8
View File
@@ -34,6 +34,7 @@ const config = {
'simple-import-sort', 'simple-import-sort',
'import', 'import',
'unused-imports', 'unused-imports',
'unicorn',
], ],
rules: { rules: {
'no-undef': 'off', 'no-undef': 'off',
@@ -74,6 +75,13 @@ const config = {
], ],
}, },
], ],
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
ignore: ['^\\[[a-zA-Z0-9-_]+\\]\\.tsx$'],
},
],
}, },
overrides: [ overrides: [
{ {
+1 -1
View File
@@ -57,7 +57,7 @@ Thumbs.db
.next .next
out/ out/
storybook-static storybook-static
i18n_generated.ts i18n-generated.ts
/test-results/ /test-results/
/playwright-report/ /playwright-report/
+1 -1
View File
@@ -4,7 +4,7 @@
"list": [ "list": [
{ {
"input": "./packages/i18n/src/resources/en.json", "input": "./packages/i18n/src/resources/en.json",
"output": "./packages/i18n/src/i18n_generated", "output": "./packages/i18n/src/i18n-generated",
"parser": { "parser": {
"type": "i18next", "type": "i18next",
"contextSeparator": "$", "contextSeparator": "$",
+1 -1
View File
@@ -10,7 +10,7 @@ import debugLocal from 'next-debug-local';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { blockSuiteFeatureFlags, buildFlags } from './preset.config.mjs'; import { blockSuiteFeatureFlags, buildFlags } from './preset.config.mjs';
import { getCommitHash, getGitVersion } from './scripts/gitInfo.mjs'; import { getCommitHash, getGitVersion } from './scripts/git-info.mjs';
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin'); const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin');
+1
View File
@@ -67,6 +67,7 @@
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"eslint": "^8.40.0", "eslint": "^8.40.0",
"eslint-config-next": "^13.4.1", "eslint-config-next": "^13.4.1",
"eslint-plugin-unicorn": "^47.0.0",
"next": "^13.4.1", "next": "^13.4.1",
"next-debug-local": "^0.1.5", "next-debug-local": "^0.1.5",
"next-router-mock": "^0.9.3", "next-router-mock": "^0.9.3",
@@ -18,7 +18,7 @@ import {
StyledPinboard, StyledPinboard,
StyledSearchContainer, StyledSearchContainer,
} from '../styles'; } from '../styles';
import { SearchContent } from './SearchContent'; import { SearchContent } from './search-content';
export interface PinboardMenuProps extends PureMenuProps { export interface PinboardMenuProps extends PureMenuProps {
metas: PageMeta[]; metas: PageMeta[];
@@ -1,7 +1,7 @@
import { PlusIcon } from '@blocksuite/icons'; import { PlusIcon } from '@blocksuite/icons';
import { StyledOperationButton } from '../styles'; import { StyledOperationButton } from '../styles';
import type { OperationButtonProps } from './OperationButton'; import type { OperationButtonProps } from './operation-button';
export const AddButton = ({ export const AddButton = ({
onAdd, onAdd,
@@ -14,9 +14,9 @@ import { useMemo, useState } from 'react';
import { workspacePreferredModeAtom } from '../../../../atoms'; import { workspacePreferredModeAtom } from '../../../../atoms';
import type { PinboardNode } from '../../../../hooks/use-pinboard-data'; import type { PinboardNode } from '../../../../hooks/use-pinboard-data';
import { StyledCollapsedButton, StyledPinboard } from '../styles'; import { StyledCollapsedButton, StyledPinboard } from '../styles';
import { AddButton } from './AddButton'; import { AddButton } from './add-button';
import EmptyItem from './EmptyItem'; import EmptyItem from './empty-item';
import { OperationButton } from './OperationButton'; import { OperationButton } from './operation-button';
const getIcon = (type: 'root' | 'edgeless' | 'page') => { const getIcon = (type: 'root' | 'edgeless' | 'page') => {
switch (type) { switch (type) {
@@ -28,7 +28,7 @@ import {
StyledHorizontalDivider, StyledHorizontalDivider,
StyledHorizontalDividerContainer, StyledHorizontalDividerContainer,
} from '../styles'; } from '../styles';
import { LanguageMenu } from './LanguageMenu'; import { LanguageMenu } from './language-menu';
const CommonMenu = () => { const CommonMenu = () => {
const content = ( const content = (
<div <div
@@ -16,12 +16,12 @@ import {
import { useCurrentMode } from '../../../hooks/current/use-current-mode'; import { useCurrentMode } from '../../../hooks/current/use-current-mode';
import type { AffineOfficialWorkspace } from '../../../shared'; import type { AffineOfficialWorkspace } from '../../../shared';
import { EditorOptionMenu } from './header-right-items/EditorOptionMenu'; import EditPage from './header-right-items/edit-page';
import EditPage from './header-right-items/EditPage'; import { EditorOptionMenu } from './header-right-items/editor-option-menu';
import { HeaderShareMenu } from './header-right-items/ShareMenu'; import { HeaderShareMenu } from './header-right-items/share-menu';
import SyncUser from './header-right-items/SyncUser'; import SyncUser from './header-right-items/sync-user';
import TrashButtonGroup from './header-right-items/TrashButtonGroup'; import TrashButtonGroup from './header-right-items/trash-button-group';
import UserAvatar from './header-right-items/UserAvatar'; import UserAvatar from './header-right-items/user-avatar';
import { import {
StyledBrowserWarning, StyledBrowserWarning,
StyledCloseButton, StyledCloseButton,
@@ -8,7 +8,7 @@ import { lazy, Suspense, useState } from 'react';
import { openOnboardingModalAtom } from '../../../atoms'; import { openOnboardingModalAtom } from '../../../atoms';
import { useCurrentMode } from '../../../hooks/current/use-current-mode'; import { useCurrentMode } from '../../../hooks/current/use-current-mode';
import { ShortcutsModal } from '../shortcuts-modal'; import { ShortcutsModal } from '../shortcuts-modal';
import { ContactIcon, HelpIcon, KeyboardIcon } from './Icons'; import { ContactIcon, HelpIcon, KeyboardIcon } from './icons';
import { import {
StyledAnimateWrapper, StyledAnimateWrapper,
StyledIconWrapper, StyledIconWrapper,
@@ -1,3 +1,3 @@
import { Loading } from './PageLoading'; import { Loading } from './page-loading';
export * from './PageLoading'; export * from './page-loading';
export default Loading; export default Loading;
@@ -14,10 +14,10 @@ import {
} from 'react'; } from 'react';
import type { BlockSuiteWorkspace } from '../../../shared'; import type { BlockSuiteWorkspace } from '../../../shared';
import { Footer } from './Footer'; import { Footer } from './footer';
import { PublishedResults } from './PublishedResults'; import { PublishedResults } from './published-results';
import { Results } from './Results'; import { Results } from './results';
import { SearchInput } from './SearchInput'; import { SearchInput } from './search-input';
import { import {
StyledContent, StyledContent,
StyledModalDivider, StyledModalDivider,
@@ -13,7 +13,7 @@ import {
useWindowsKeyboardShortcuts, useWindowsKeyboardShortcuts,
useWinMarkdownShortcuts, useWinMarkdownShortcuts,
} from './config'; } from './config';
import { KeyboardIcon } from './Icons'; import { KeyboardIcon } from './icons';
import { import {
StyledListItem, StyledListItem,
StyledModalHeader, StyledModalHeader,
@@ -1 +1 @@
export * from './WorkspaceSelector'; export * from './workspace-selector';
+1 -1
View File
@@ -36,7 +36,7 @@ import { useSyncRouterWithCurrentPageId } from '../hooks/use-sync-router-with-cu
import { useSyncRouterWithCurrentWorkspaceId } from '../hooks/use-sync-router-with-current-workspace-id'; import { useSyncRouterWithCurrentWorkspaceId } from '../hooks/use-sync-router-with-current-workspace-id';
import { useWorkspaces } from '../hooks/use-workspaces'; import { useWorkspaces } from '../hooks/use-workspaces';
import { WorkspacePlugins } from '../plugins'; import { WorkspacePlugins } from '../plugins';
import { ModalProvider } from '../providers/ModalProvider'; import { ModalProvider } from '../providers/modal-provider';
import { pathGenerator, publicPathGenerator } from '../shared'; import { pathGenerator, publicPathGenerator } from '../shared';
import { import {
MainContainer, MainContainer,
+1 -1
View File
@@ -17,7 +17,7 @@ import { AffineErrorBoundary } from '../components/affine/affine-error-eoundary'
import { ProviderComposer } from '../components/provider-composer'; import { ProviderComposer } from '../components/provider-composer';
import { PageLoading } from '../components/pure/loading'; import { PageLoading } from '../components/pure/loading';
import { MessageCenter } from '../components/pure/message-center'; import { MessageCenter } from '../components/pure/message-center';
import { ThemeProvider } from '../providers/ThemeProvider'; import { ThemeProvider } from '../providers/theme-provider';
import type { NextPageWithLayout } from '../shared'; import type { NextPageWithLayout } from '../shared';
import createEmotionCache from '../utils/create-emotion-cache'; import createEmotionCache from '../utils/create-emotion-cache';
+1 -1
View File
@@ -6,7 +6,7 @@ import { StyledPage, StyledWrapper } from '../../layouts/styles';
import type { NextPageWithLayout } from '../../shared'; import type { NextPageWithLayout } from '../../shared';
const Editor = lazy(() => const Editor = lazy(() =>
import('../../components/__debug__/client/Editor').then(module => ({ import('../../components/__debug__/client/editor').then(module => ({
default: module.default, default: module.default,
})) }))
); );
@@ -10,7 +10,7 @@ const config: SWRConfiguration = {
fetcher, fetcher,
}; };
export const AffineSWRConfigProvider = memo<React.PropsWithChildren>( export const AffineSwrConfigProvider = memo<React.PropsWithChildren>(
function AffineSWRConfigProvider({ children }) { function AffineSWRConfigProvider({ children }) {
return <SWRConfig value={config}>{children}</SWRConfig>; return <SWRConfig value={config}>{children}</SWRConfig>;
} }
@@ -40,7 +40,7 @@ const TmpDisableAffineCloudModal = lazy(() =>
) )
); );
const OnboardingModalAtom = lazy(() => const OnboardingModalAtom = lazy(() =>
import('../components/pure/OnboardingModal').then(module => ({ import('../components/pure/onboarding-modal').then(module => ({
default: module.OnboardingModal, default: module.OnboardingModal,
})) }))
); );
+1
View File
@@ -63,6 +63,7 @@
"eslint-plugin-react": "^7.32.2", "eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unicorn": "^47.0.0",
"eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-unused-imports": "^2.0.0",
"fake-indexeddb": "4.0.1", "fake-indexeddb": "4.0.1",
"got": "^12.6.0", "got": "^12.6.0",
@@ -13,7 +13,7 @@ import type { PropsWithChildren, ReactElement } from 'react';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import { forwardRef, useCallback, useEffect } from 'react'; import { forwardRef, useCallback, useEffect } from 'react';
import { IconButton } from '../../ui/button/IconButton'; import { IconButton } from '../../ui/button/icon-button';
import { import {
floatingMaxWidth, floatingMaxWidth,
haloStyle, haloStyle,
@@ -15,7 +15,7 @@ import {
RedditIcon, RedditIcon,
TelegramIcon, TelegramIcon,
TwitterIcon, TwitterIcon,
} from './Icons'; } from './icons';
import { import {
StyledBigLink, StyledBigLink,
StyledLogo, StyledLogo,
@@ -1,5 +1,5 @@
export * from './CopyLink'; export * from './copy-link';
export * from './DisablePublicSharing'; export * from './disable-public-sharing';
export * from './Export'; export * from './export';
// export * from './MoveTo'; // export * from './MoveTo';
export * from './MoveToTrash'; export * from './move-to-trash';
@@ -12,7 +12,7 @@ import {
menuItemStyle, menuItemStyle,
svgStyle, svgStyle,
} from './index.css'; } from './index.css';
import type { ShareMenuProps } from './ShareMenu'; import type { ShareMenuProps } from './share-menu';
export const Export: FC<ShareMenuProps> = props => { export const Export: FC<ShareMenuProps> = props => {
const contentParserRef = useRef<ContentParser>(); const contentParserRef = useRef<ContentParser>();
@@ -1,2 +1,2 @@
export * from './disable-public-link'; export * from './disable-public-link';
export * from './ShareMenu'; export * from './share-menu';
@@ -7,10 +7,10 @@ import { useRef } from 'react';
import { useCallback, useState } from 'react'; import { useCallback, useState } from 'react';
import { Menu } from '../..'; import { Menu } from '../..';
import { Export } from './Export'; import { Export } from './export';
import { containerStyle, indicatorContainerStyle, tabStyle } from './index.css'; import { containerStyle, indicatorContainerStyle, tabStyle } from './index.css';
import { SharePage } from './SharePage'; import { SharePage } from './share-page';
import { ShareWorkspace } from './ShareWorkspace'; import { ShareWorkspace } from './share-workspace';
import { StyledIndicator, StyledShareButton, TabItem } from './styles'; import { StyledIndicator, StyledShareButton, TabItem } from './styles';
type SharePanel = 'SharePage' | 'Export' | 'ShareWorkspace'; type SharePanel = 'SharePage' | 'Export' | 'ShareWorkspace';
const MenuItems: Record<SharePanel, FC<ShareMenuProps>> = { const MenuItems: Record<SharePanel, FC<ShareMenuProps>> = {
@@ -15,7 +15,7 @@ import {
inputButtonRowStyle, inputButtonRowStyle,
menuItemStyle, menuItemStyle,
} from './index.css'; } from './index.css';
import type { ShareMenuProps } from './ShareMenu'; import type { ShareMenuProps } from './share-menu';
import { import {
StyledButton, StyledButton,
StyledDisableButton, StyledDisableButton,
@@ -4,7 +4,7 @@ import { WorkspaceFlavour } from '@affine/workspace/type';
import type { FC } from 'react'; import type { FC } from 'react';
import { descriptionStyle, menuItemStyle } from './index.css'; import { descriptionStyle, menuItemStyle } from './index.css';
import type { ShareMenuProps } from './ShareMenu'; import type { ShareMenuProps } from './share-menu';
import { StyledButton } from './styles'; import { StyledButton } from './styles';
const ShareLocalWorkspace: FC<ShareMenuProps<LocalWorkspace>> = props => { const ShareLocalWorkspace: FC<ShareMenuProps<LocalWorkspace>> = props => {
@@ -1 +1 @@
export * from './TourModal'; export * from './tour-modal';
@@ -10,7 +10,7 @@ import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-
import clsx from 'clsx'; import clsx from 'clsx';
import type React from 'react'; import type React from 'react';
import { DefaultAvatar } from './DefaultAvatar'; import { DefaultAvatar } from './default-avatar';
import { avatarImageStyle, avatarStyle } from './index.css'; import { avatarImageStyle, avatarStyle } from './index.css';
export type WorkspaceAvatarProps = { export type WorkspaceAvatarProps = {
+2 -2
View File
@@ -1,4 +1,4 @@
export * from './components/ListSkeleton'; export * from './components/list-skeleton';
export * from './styles'; export * from './styles';
export * from './ui/breadcrumbs'; export * from './ui/breadcrumbs';
export * from './ui/button'; export * from './ui/button';
@@ -11,7 +11,7 @@ export * from './ui/menu';
export * from './ui/modal'; export * from './ui/modal';
export * from './ui/mui'; export * from './ui/mui';
export * from './ui/popper'; export * from './ui/popper';
export * from './ui/shared/Container'; export * from './ui/shared/container';
export * from './ui/switch'; export * from './ui/switch';
export * from './ui/table'; export * from './ui/table';
export * from './ui/toast'; export * from './ui/toast';
@@ -8,7 +8,7 @@ import type { StoryFn } from '@storybook/react';
import { useState } from 'react'; import { useState } from 'react';
import { PublicLinkDisableModal } from '../components/share-menu/disable-public-link'; import { PublicLinkDisableModal } from '../components/share-menu/disable-public-link';
import { ShareMenu } from '../components/share-menu/ShareMenu'; import { ShareMenu } from '../components/share-menu/share-menu';
import { StyledDisableButton } from '../components/share-menu/styles'; import { StyledDisableButton } from '../components/share-menu/styles';
import toast from '../ui/toast/toast'; import toast from '../ui/toast/toast';
+1 -1
View File
@@ -1,5 +1,5 @@
export * from './helper'; export * from './helper';
export * from './mui-theme'; export * from './mui-theme';
export * from './MuiThemeProvider'; export * from './mui-theme-provider';
export * from './types'; export * from './types';
export * from './utils'; export * from './utils';
+2 -2
View File
@@ -1,2 +1,2 @@
export * from './localStorageThemeHelper'; export * from './local-storage-theme-helper';
export * from './systemThemeHelper'; export * from './system-theme-helper';
@@ -1,7 +1,7 @@
import { Children, cloneElement, forwardRef } from 'react'; import { Children, cloneElement, forwardRef } from 'react';
import type { ButtonProps } from './interface'; import type { ButtonProps } from './interface';
import { Loading } from './Loading'; import { Loading } from './loading';
import { StyledButton } from './styles'; import { StyledButton } from './styles';
import { getSize } from './utils'; import { getSize } from './utils';
export const Button = forwardRef<HTMLButtonElement, ButtonProps>( export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
+3 -3
View File
@@ -1,3 +1,3 @@
export * from './Button'; export * from './button';
export * from './IconButton'; export * from './icon-button';
export * from './TextButton'; export * from './text-button';
+1 -1
View File
@@ -1 +1 @@
export * from './Confirm'; export * from './confirm';
@@ -1,7 +1,7 @@
import type { SvgIconProps } from '@mui/material/SvgIcon'; import type { SvgIconProps } from '@mui/material/SvgIcon';
import SvgIcon from '@mui/material/SvgIcon'; import SvgIcon from '@mui/material/SvgIcon';
export const EmptySVG = (_props: SvgIconProps) => { export const EmptySvg = (_props: SvgIconProps) => {
return ( return (
<SvgIcon <SvgIcon
width="200" width="200"
@@ -1,6 +1,6 @@
import type { CSSProperties } from 'react'; import type { CSSProperties } from 'react';
import { EmptySVG } from './EmptySVG'; import { EmptySvg } from './empty-svg';
import { StyledEmptyContainer } from './style'; import { StyledEmptyContainer } from './style';
export type EmptyContentProps = { export type EmptyContentProps = {
containerStyle?: CSSProperties; containerStyle?: CSSProperties;
@@ -15,7 +15,7 @@ export const Empty = ({
}: EmptyContentProps) => { }: EmptyContentProps) => {
return ( return (
<StyledEmptyContainer style={containerStyle}> <StyledEmptyContainer style={containerStyle}>
<EmptySVG /> <EmptySvg />
<p style={descriptionStyle}>{description}</p> <p style={descriptionStyle}>{description}</p>
</StyledEmptyContainer> </StyledEmptyContainer>
); );
+1 -1
View File
@@ -1 +1 @@
export * from './Empty'; export * from './empty';
+2 -2
View File
@@ -1,3 +1,3 @@
export * from './Input'; export * from './input';
import { Input } from './Input'; import { Input } from './input';
export default Input; export default Input;
+2 -2
View File
@@ -1,2 +1,2 @@
export * from './Content'; export * from './content';
export * from './Wrapper'; export * from './wrapper';
+3 -3
View File
@@ -1,4 +1,4 @@
export * from './Menu'; export * from './menu';
// export { StyledMenuItem as MenuItem } from './styles'; // export { StyledMenuItem as MenuItem } from './styles';
export * from './MenuItem'; export * from './menu-item';
export * from './PureMenu'; export * from './pure-menu';

Some files were not shown because too many files have changed in this diff Show More