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

update eslint #315

Merged
merged 3 commits into from
Sep 2, 2024
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
4 changes: 2 additions & 2 deletions .storybook/components/Theme.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Markdown, Subheading } from '@storybook/addon-docs'
import { ReactElement } from 'react'
import {
defaultTheme,
Theme as ThemeType,
defaultTheme,
} from '../../src/framework/theme/theme'
import { SourceJson } from './SourceJson'

Expand All @@ -11,7 +11,7 @@ export function Theme<T extends keyof ThemeType, R extends keyof ThemeType[T]>({
items,
}: {
component: T
items?: Array<R>
items?: R[]
}): ReactElement {
const theme = {
[component]: items
Expand Down
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { StorybookConfig } from '@storybook/react-vite'
import remarkGfm from 'remark-gfm'
import type { StorybookConfig } from '@storybook/react-vite'

const config: StorybookConfig = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Preview } from '@storybook/react'
import { ReactUIProvider, defaultTheme, makeLinkComponent } from '../src'
import { Background } from './types'
import '../styles/index.css'
import { Background } from './types'

const LinkComponent = makeLinkComponent(
({ children, _internal, href, ...props }, ref) => (
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"react-hook-form": "^7.51.2"
},
"devDependencies": {
"@aboutbits/eslint-config": "^2.2.4",
"@aboutbits/eslint-config": "^3.0.0",
"@aboutbits/prettier-config": "^1.6.1",
"@aboutbits/react-pagination": "^3.0.12",
"@aboutbits/ts-config": "^1.1.3",
Expand Down
2 changes: 1 addition & 1 deletion src/components/action/Actions.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
Title,
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import { Theme } from '../../../.storybook/components'
import { Button, ButtonVariant } from '../button'
import { Tone } from '../types'
import { Theme } from '../../../.storybook/components'
import { Actions } from './Actions'

const children = {
Expand Down
10 changes: 5 additions & 5 deletions src/components/alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import IconCheck from '@aboutbits/react-material-icons/dist/IconCheck'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import IconWarning from '@aboutbits/react-material-icons/dist/IconWarning'
import {
Controls,
Markdown,
Expand All @@ -7,20 +10,17 @@ import {
Title,
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import IconWarning from '@aboutbits/react-material-icons/dist/IconWarning'
import IconCheck from '@aboutbits/react-material-icons/dist/IconCheck'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import { Theme } from '../../../.storybook/components'
import { Button, ButtonVariant } from '../button'
import { Size, Tone } from '../types'
import { Theme } from '../../../.storybook/components'
import { Alert } from './Alert'
import { AlertActionsPosition } from './types'
import {
AlertCritical,
AlertInformative,
AlertSuccess,
AlertWarning,
} from './ConvenientAlerts'
import { AlertActionsPosition } from './types'

const icons = {
options: ['None', 'Warning', 'Check', 'Info'],
Expand Down
2 changes: 1 addition & 1 deletion src/components/alert/ConvenientAlerts.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IconCheck from '@aboutbits/react-material-icons/dist/IconCheck'
import IconWarning from '@aboutbits/react-material-icons/dist/IconWarning'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import IconWarning from '@aboutbits/react-material-icons/dist/IconWarning'
import { ReactElement } from 'react'
import { Tone } from '../types'
import { Alert } from './Alert'
Expand Down
2 changes: 1 addition & 1 deletion src/components/breadcrumbs/BreadcrumbLoading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function BreadcrumbLoading({
const { breadcrumbs } = useTheme()

const { className: loadingBarClassName, ...restLoadingBarProps } =
loadingBarProps || {}
loadingBarProps ?? {}

return (
<div className={classNames(breadcrumbs.breadcrumbLoading.base, className)}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/breadcrumbs/Breadcrumbs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import { Theme } from '../../../.storybook/components'
import { Breadcrumbs } from './Breadcrumbs'
import { BreadcrumbLink } from './BreadcrumbLink'
import { BreadcrumbLoading } from './BreadcrumbLoading'
import { Breadcrumbs } from './Breadcrumbs'
import { BreadcrumbsLoading } from './BreadcrumbsLoading'
import { BreadcrumbText } from './BreadcrumbText'
import { BreadcrumbLoading } from './BreadcrumbLoading'

const meta = {
component: Breadcrumbs,
Expand Down
10 changes: 5 additions & 5 deletions src/components/button/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meta, StoryObj } from '@storybook/react'
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import {
Controls,
Description,
Expand All @@ -9,14 +10,13 @@ import {
Subheading,
Title,
} from '@storybook/blocks'
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import { Meta, StoryObj } from '@storybook/react'
import { Theme } from '../../../.storybook/components'
import { Mode, Size } from '../types'
import { CustomTheme } from '../../../.storybook/components/CustomTheme'
import { Background } from '../../../.storybook/types'
import { ButtonVariant } from './types'
import { Mode, Size } from '../types'
import { Button } from './Button'
import { ButtonVariant } from './types'

const icons = {
options: ['None', 'Add', 'Info'],
Expand Down
10 changes: 5 additions & 5 deletions src/components/button/ButtonIcon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import {
Controls,
Description,
Expand All @@ -7,14 +9,12 @@ import {
Subheading,
Title,
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import { Source } from '@storybook/blocks'
import { Meta, StoryObj } from '@storybook/react'
import { Theme } from '../../../.storybook/components'
import { Mode, Size, Tone } from '../types'
import { ButtonVariant } from './types'
import { ButtonIcon } from './ButtonIcon'
import { ButtonVariant } from './types'

const icons = {
options: ['Info', 'Add'],
Expand Down Expand Up @@ -75,7 +75,7 @@ const meta = {
' },\n' +
'}'
}
></Source>
/>
</>
),
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/ButtonIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { forwardRef } from 'react'
import classNames from 'classnames'
import React, { forwardRef } from 'react'
import { useTheme } from '../../framework'
import { Mode, Size, Tone } from '../types'
import { ButtonIconCommonProps, ButtonStyleProps, ButtonVariant } from './types'
Expand Down
8 changes: 4 additions & 4 deletions src/components/button/ButtonIconLink.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import {
Controls,
Description,
Expand All @@ -6,12 +8,10 @@ import {
Title,
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import { Mode, Size, Tone } from '../types'
import { Theme } from '../../../.storybook/components'
import { ButtonVariant } from './types'
import { Mode, Size, Tone } from '../types'
import { ButtonIconLink } from './ButtonIconLink'
import { ButtonVariant } from './types'

const meta = {
component: ButtonIconLink,
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/ButtonIconLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Mode, Size, Tone } from '../types'
import {
ButtonIconCommonProps,
ButtonStyleProps,
LinkCommonProps,
ButtonVariant,
LinkCommonProps,
} from './types'

export type ButtonIconLinkProps = LinkComponentProps &
Expand Down
4 changes: 2 additions & 2 deletions src/components/button/ButtonLink.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
Title,
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import { Mode, Size, Tone } from '../types'
import { Theme } from '../../../.storybook/components'
import { ButtonVariant } from './types'
import { Mode, Size, Tone } from '../types'
import { ButtonLink } from './ButtonLink'
import { ButtonVariant } from './types'

const meta = {
component: ButtonLink,
Expand Down
4 changes: 2 additions & 2 deletions src/components/button/ButtonLink.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import classNames from 'classnames'
import { forwardRef } from 'react'
import { useLinkComponent, LinkComponentProps, useTheme } from '../../framework'
import { LinkComponentProps, useLinkComponent, useTheme } from '../../framework'
import { Mode, Size, Tone } from '../types'
import {
ButtonCommonProps,
ButtonStyleProps,
LinkCommonProps,
ButtonVariant,
LinkCommonProps,
} from './types'

export type ButtonLinkProps = LinkComponentProps &
Expand Down
4 changes: 2 additions & 2 deletions src/components/button/SubmitButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import {
Controls,
Description,
Expand All @@ -8,8 +10,6 @@ import {
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import { useForm } from 'react-hook-form'
import IconAdd from '@aboutbits/react-material-icons/dist/IconAdd'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import { Form } from '../react-hook-form'
import { SubmitButton } from './SubmitButton'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IconError from '@aboutbits/react-material-icons/dist/IconError'
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo'
import IconWarning from '@aboutbits/react-material-icons/dist/IconWarning'
import IconError from '@aboutbits/react-material-icons/dist/IconError'
import {
Controls,
Description,
Expand Down
11 changes: 8 additions & 3 deletions src/components/content/DescriptionItem/DescriptionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ export function DescriptionItem({
title,
className,
contentProps,
...props
hideIfEmpty = false,
content,
}: DescriptionItemProps) {
return (
<>
{((props.hideIfEmpty && props.content) || !props.hideIfEmpty) && (
{((hideIfEmpty &&
content !== null &&
content !== undefined &&
content !== '') ||
!hideIfEmpty) && (
<DescriptionItemContainer className={className}>
<DescriptionItemTitle>{title}</DescriptionItemTitle>
<DescriptionItemContent {...contentProps}>
{props.content}
{content}
</DescriptionItemContent>
</DescriptionItemContainer>
)}
Expand Down
4 changes: 3 additions & 1 deletion src/components/content/WithPlaceholder/WithPlaceholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function WithPlaceholder({
? isNaN(children)
? placeholder
: children
: children || placeholder}
: children === null || children === undefined || children === ''
? placeholder
: children}
</>
)
}
4 changes: 2 additions & 2 deletions src/components/dialog/Dialog/Dialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ComponentMeta, ComponentStory, DecoratorFn } from '@storybook/react'
import { ReactElement, ReactNode, useState } from 'react'
import { Button } from '../../button'
import {
Dialog,
DialogContent,
Expand All @@ -11,15 +10,16 @@ import {
DialogHeader,
DialogHeaderArea,
DialogHeaderCloseAction,
DialogHeaderGroup,
DialogHeaderLeftActionIcon,
DialogHeaderRow,
DialogHeaderGroup,
DialogHeaderTitle,
DialogHeaderWithClose,
DialogPosition,
DialogProps,
DialogSize,
} from '../'
import { Button } from '../../button'
import DialogDocs from './Dialog.docs.mdx'

type TemplateArgs = DialogProps & { content: ReactNode }
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialog/DialogItem/DialogListItemButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IconKeyboardArrowRight from '@aboutbits/react-material-icons/dist/IconKeyboardArrowRight'
import classNames from 'classnames'
import { forwardRef, MouseEventHandler } from 'react'
import { MouseEventHandler, forwardRef } from 'react'
import { useTheme } from '../../../framework'
import { ClassNameProps } from '../../types'

Expand Down
6 changes: 3 additions & 3 deletions src/components/form/InputField.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IconSearch from '@aboutbits/react-material-icons/dist/IconSearch'
import IconBadge from '@aboutbits/react-material-icons/dist/IconBadge'
import IconSearch from '@aboutbits/react-material-icons/dist/IconSearch'
import {
Controls,
Description,
Expand Down Expand Up @@ -115,8 +115,8 @@ export const Disabled: Story = {
export const WithIcons: Story = {
render: (args) => (
<div className="flex flex-row space-x-4">
<InputField {...args} iconStart={IconSearch}></InputField>
<InputField {...args} iconEnd={IconBadge}></InputField>
<InputField {...args} iconStart={IconSearch} />
<InputField {...args} iconEnd={IconBadge} />
</div>
),
}
2 changes: 1 addition & 1 deletion src/components/form/SearchField.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Meta, StoryObj } from '@storybook/react'
import {
Controls,
Description,
Expand All @@ -7,6 +6,7 @@ import {
Subheading,
Title,
} from '@storybook/blocks'
import { Meta, StoryObj } from '@storybook/react'
import {
InternationalizationMessages,
Theme,
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/SelectField.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Title,
} from '@storybook/addon-docs'
import { Meta, StoryObj } from '@storybook/react'
import { SelectField } from './SelectField'
import { Option } from './primitive/Option'
import { SelectField } from './SelectField'
import { Status } from './types'

const children = (
Expand Down
Loading