diff --git a/.eslintrc b/.eslintrc index 0ae4a7a4e..b0af2227f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -25,7 +25,6 @@ } }, "rules": { - "@typescript-eslint/camelcase": "off", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-types": [ "error", @@ -37,14 +36,30 @@ "extendDefaults": true } ], + "@typescript-eslint/camelcase": "off", + "@typescript-eslint/consistent-indexed-object-style": "error", + "@typescript-eslint/consistent-type-definitions": ["error", "interface"], "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/naming-convention": "off", "@typescript-eslint/no-duplicate-imports": "error", "@typescript-eslint/no-shadow": "error", "@typescript-eslint/no-use-before-define": "error", - "@typescript-eslint/consistent-indexed-object-style": "error", "arrow-parens": "off", + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": true + } + ], + "import/extensions": [ + "error", + { + "jpg": "always", + "png": "always", + "svg": "always" + } + ], "no-console": ["error", { "allow": ["warn", "error"] }], "no-duplicate-imports": "off", "no-shadow": "off", @@ -68,25 +83,11 @@ } ], "react/state-in-constructor": "off", - "react/static-property-placement": "off", - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": true - } - ], - "import/extensions": [ - "error", - { - "jpg": "always", - "png": "always", - "svg": "always" - } - ] + "react/static-property-placement": "off" }, "overrides": [ { - "files": ["test.{js,ts,tsx}"], + "files": ["test.{ts,tsx}"], "rules": { "@typescript-eslint/no-unsafe-call": "off", "no-undef": "off", @@ -98,25 +99,12 @@ } }, { - "files": ["**/style.{js,ts}"], + "files": ["**/style.ts"], "rules": { "@typescript-eslint/restrict-template-expressions": "off", "indent": "off" } }, - { - "files": ["*.js"], - "rules": { - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/restrict-template-expressions": "off" - } - }, { "files": ["*.tsx"], "rules": { @@ -131,7 +119,7 @@ } }, { - "files": ["stories/**/*.{js,ts,tsx}"], + "files": ["stories/**/*.{ts,tsx}"], "rules": { "no-alert": "off" } diff --git a/src/constants/keyboardKeys/index.ts b/src/constants/keyboardKeys/index.ts index 9402a2aae..f8c04bfd2 100644 --- a/src/constants/keyboardKeys/index.ts +++ b/src/constants/keyboardKeys/index.ts @@ -1,9 +1,9 @@ import throwOnUndefinedProperty from '../../utils/throwOnUndefinedProperty'; -export type KeyType = { +export interface KeyType { key: string; keyCode: number; -}; +} const keyboardKeys = throwOnUndefinedProperty({ escape: { diff --git a/src/constants/mediaQueries/index.ts b/src/constants/mediaQueries/index.ts index 64496f80c..79f2bb9e0 100644 --- a/src/constants/mediaQueries/index.ts +++ b/src/constants/mediaQueries/index.ts @@ -1,14 +1,14 @@ import { throwOnUndefinedProperty } from '../../utils'; import BREAKPOINTS from '../breakpoints'; -type MediaQueriesType = { +interface MediaQueriesType extends Record { xsUp: string; smUp: string; mdUp: string; lgUp: string; xlUp: string; xxlUp: string; -}; +} const mediaQueries = Object.entries(BREAKPOINTS).reduce( (accumulator, [label, px]) => ({ diff --git a/src/constants/themes/types.ts b/src/constants/themes/types.ts index a2f274131..78efc7cea 100644 --- a/src/constants/themes/types.ts +++ b/src/constants/themes/types.ts @@ -26,11 +26,11 @@ export const COLORS_PROP_TYPES = PropTypes.oneOf([ ...Object.values(secondaryTheme.COLORS), ]); -export type ThemeType = { +export interface ThemeType { __type: 'primary' | 'secondary'; BORDER_RADIUS: BorderRadius; BOX_SHADOWS: BoxShadows; COLORS: Colors; FONTS: Fonts; TYPOGRAPHY: Typography; -}; +} diff --git a/src/shared-components/accordion/index.tsx b/src/shared-components/accordion/index.tsx index a13fa0ad3..500452598 100644 --- a/src/shared-components/accordion/index.tsx +++ b/src/shared-components/accordion/index.tsx @@ -4,7 +4,7 @@ import { useTheme } from 'emotion-theming'; import { ThemeType } from '../../constants'; import { ChevronIcon } from '../../icons'; -import Thumbnails from './thumbnails'; +import { Thumbnails } from './thumbnails'; import { AccordionBox, ArrowWrapper, @@ -21,7 +21,7 @@ export type BorderRadiusValues = | '0.5rem' | '2rem'; -type AccordionProps = { +export interface AccordionProps { /** Sets the border-radius of Accordion.Container, AccordionBox, and TitleWrapper */ borderRadius?: BorderRadiusValues; /** node(s) that will render only when expanded */ @@ -40,7 +40,7 @@ type AccordionProps = { rightAlignArrow?: boolean; /** node that will render whether collapsed or expanded */ title: React.ReactNode; -}; +} /** * A list of items that allows each item's content to be expanded and collapsed by clicking its title bar. diff --git a/src/shared-components/accordion/thumbnails/index.tsx b/src/shared-components/accordion/thumbnails/index.tsx index 25565630a..93c619791 100644 --- a/src/shared-components/accordion/thumbnails/index.tsx +++ b/src/shared-components/accordion/thumbnails/index.tsx @@ -8,12 +8,12 @@ import { MultiplesText, } from './style'; -type ThumbnailsProps = { +export interface ThumbnailsProps { /** An array of image src strings that Accordion.Thumbails will use to render */ photoSrcs: Array; -}; +} -const Thumbnails = ({ photoSrcs }: ThumbnailsProps) => { +export const Thumbnails = ({ photoSrcs }: ThumbnailsProps) => { /** * Thumbnail images set with empty alt text because they are decorative. * Accessible Accordion functionality does not depend on these thumbnails. @@ -55,5 +55,3 @@ const Thumbnails = ({ photoSrcs }: ThumbnailsProps) => { return {renderThumbnails()}; }; - -export default Thumbnails; diff --git a/src/shared-components/alert/index.tsx b/src/shared-components/alert/index.tsx index 02c553265..659fde3b3 100644 --- a/src/shared-components/alert/index.tsx +++ b/src/shared-components/alert/index.tsx @@ -24,7 +24,7 @@ const alertIconMapping = { export type AlertType = 'success' | 'error' | 'default' | 'danger'; -type AlertProps = { +export interface AlertProps { avatarSrc?: string; content: React.ReactNode; ctaContent?: React.ReactNode; @@ -33,7 +33,7 @@ type AlertProps = { truncateText?: boolean; type?: AlertType; [key: string]: unknown; -}; +} /** * Alerts should be used to show notifications or messages from (providers, support, or system). diff --git a/src/shared-components/avatar/index.tsx b/src/shared-components/avatar/index.tsx index 04ee7dd0f..15c7d916a 100644 --- a/src/shared-components/avatar/index.tsx +++ b/src/shared-components/avatar/index.tsx @@ -3,11 +3,11 @@ import PropTypes from 'prop-types'; import Style from './style'; -type AvatarProps = { +export interface AvatarProps { alt: string; size?: 'small' | 'medium' | 'large'; src: string; -}; +} export const Avatar = ({ alt, size = 'small', src }: AvatarProps) => ( diff --git a/src/shared-components/banner/index.tsx b/src/shared-components/banner/index.tsx index ce85bc0ca..36308783d 100644 --- a/src/shared-components/banner/index.tsx +++ b/src/shared-components/banner/index.tsx @@ -19,11 +19,11 @@ const bannerIconMapping = { export type BannerType = 'default' | 'success' | 'error' | 'danger'; -type BannerProps = { +export interface BannerProps { content: React.ReactNode; onClick?: () => void; type?: BannerType; -}; +} /** * The `` component provides only the styling and onClick behavior of banners. diff --git a/src/shared-components/button/components/linkButton/index.tsx b/src/shared-components/button/components/linkButton/index.tsx index 44b8f3e5f..31241fa6f 100644 --- a/src/shared-components/button/components/linkButton/index.tsx +++ b/src/shared-components/button/components/linkButton/index.tsx @@ -8,7 +8,7 @@ import { ButtonContents, ButtonText } from '../../style'; import { linkButtonStyles } from './style'; import { COLORS_PROP_TYPES, ThemeColors } from '../../../../constants'; -type LinkProps = { +export interface LinkProps { /** * Specifies the tag or element to be rendered */ @@ -29,7 +29,7 @@ type LinkProps = { */ textColor?: ThemeColors; [key: string]: unknown; -}; +} /** * `LinkButton` will render a 'button-like' link for directing/linking to the path specified. This component can work with React Router's `Link`/`NavLink` by passing in the router component as a prop ---> ` ....`. diff --git a/src/shared-components/button/components/roundButton/index.tsx b/src/shared-components/button/components/roundButton/index.tsx index 8b8a1d576..9979a1748 100644 --- a/src/shared-components/button/components/roundButton/index.tsx +++ b/src/shared-components/button/components/roundButton/index.tsx @@ -18,7 +18,7 @@ import { } from '../../deprecatedPropsHandler'; import { COLORS_PROP_TYPES, ThemeColors } from '../../../../constants'; -type RoundButtonProps = { +export interface RoundButtonProps { buttonColor?: ThemeColors; /** * Determines the button's main style theme @@ -44,7 +44,7 @@ type RoundButtonProps = { */ textColor?: ThemeColors; [key: string]: unknown; -}; +} /** * `` behaves mostly the same as `