From 1c543f1f8293681c404cfa3dcba2af08311b0537 Mon Sep 17 00:00:00 2001 From: Paul Cowan Date: Thu, 29 Aug 2024 15:19:20 +0100 Subject: [PATCH] configure eslint ignores --- apps/frontendsupport/.eslintignore | 4 - apps/frontendsupport/.eslintrc.cjs | 28 --- .../app/components/About/About.tsx | 3 +- .../app/components/CTAButton/CTAButton.tsx | 5 +- .../app/components/Clients/Clients.tsx | 13 +- .../app/components/Clients/loop.ts | 64 ++++--- .../app/components/Contact/Contact.tsx | 1 + .../app/components/Header/Header.tsx | 3 +- .../app/components/Header/Top.css.ts | 2 +- .../app/components/Header/Top.tsx | 7 +- .../LazyBackgroundImage.css.ts | 2 +- .../LazyBackgroundImage.tsx | 16 +- .../LazyLoadedImage/LazyLoadedImage.tsx | 6 +- .../LazyLoadedImage/getImagePropsFromMap.ts | 13 +- .../app/components/Posts/Posts.tsx | 3 +- .../components/RandomImage/RandomImage.css.ts | 2 +- .../components/RandomImage/RandomImage.tsx | 9 +- .../app/components/Scroller/Scroller.tsx | 5 +- .../components/TextNavLink/TextNavLink.tsx | 5 +- apps/frontendsupport/app/entry.server.tsx | 2 +- .../app/pages/Home/Dots/Dots.tsx | 13 +- .../app/pages/Home/Dots/horizontalLoop.ts | 39 ++-- apps/frontendsupport/app/pages/Home/Home.tsx | 21 ++- .../app/pages/Home/Panel/Panel.tsx | 3 +- .../pages/Panels/BreakGlass/BreakGlass.tsx | 7 +- .../app/pages/Panels/Services/Service.tsx | 3 +- .../app/pages/Panels/Services/Services.tsx | 3 +- apps/frontendsupport/app/root.tsx | 34 ++-- apps/frontendsupport/app/routes/_index.tsx | 2 +- .../app/routes/posts.$slug.tsx | 24 ++- .../app/routes/posts._index.tsx | 9 +- .../app/routes/services.consultancy.tsx | 2 +- .../app/routes/services.home.tsx | 2 + .../app/routes/services.mentoring.tsx | 2 +- apps/frontendsupport/app/utils/fs.server.ts | 3 +- .../app/utils/markdown.server.ts | 2 +- apps/frontendsupport/app/utils/path.server.ts | 2 +- apps/frontendsupport/app/utils/post.ts | 12 +- apps/frontendsupport/app/utils/url.server.ts | 2 +- apps/frontendsupport/eslint.config.mjs | 82 ++++---- apps/frontendsupport/package.json | 2 +- apps/frontendsupport/plugin-remix.js | 9 +- apps/frontendsupport/remix.config.js | 2 +- .../replace-workspace-protocol-by-version.mjs | 1 + apps/frontendsupport/server.js | 2 +- apps/frontendsupport/src/plugins/set-env.js | 6 +- apps/threejs-project/.eslintignore | 1 - apps/threejs-project/package.json | 2 +- .../hoc/FormControl/FormControl.test.tsx | 12 +- .../CheckableGroup/CheckableGroup.tsx | 2 +- .../components/molecules/Column/Column.tsx | 1 - .../molecules/Hamburger/Hamburger.tsx | 4 +- packages/devtools/.eslintignore | 1 - packages/devtools/eslint.config.mjs | 2 +- packages/eslint-config/angular.cjs | 3 - packages/eslint-config/index.mjs | 177 ++++++++++-------- packages/eslint-config/node.cjs | 3 - packages/eslint-config/package.json | 3 +- packages/eslint-config/react.mjs | 4 +- .../markdown/src/remark/remark-img-to-jsx.ts | 39 ---- .../FormComponents/FormComponents.test.tsx | 1 - packages/util/src/dom/wait.test.tsx | 2 +- packages/util/src/functions/functions.test.ts | 6 +- pnpm-lock.yaml | 10 +- 64 files changed, 386 insertions(+), 369 deletions(-) delete mode 100644 apps/frontendsupport/.eslintignore delete mode 100644 apps/frontendsupport/.eslintrc.cjs delete mode 100644 apps/threejs-project/.eslintignore delete mode 100644 packages/devtools/.eslintignore delete mode 100644 packages/eslint-config/angular.cjs delete mode 100644 packages/eslint-config/node.cjs delete mode 100644 packages/markdown/src/remark/remark-img-to-jsx.ts diff --git a/apps/frontendsupport/.eslintignore b/apps/frontendsupport/.eslintignore deleted file mode 100644 index 7a1de909d..000000000 --- a/apps/frontendsupport/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -/.cache -/server/index.js -/public/build -*.map \ No newline at end of file diff --git a/apps/frontendsupport/.eslintrc.cjs b/apps/frontendsupport/.eslintrc.cjs deleted file mode 100644 index 03a7b4b44..000000000 --- a/apps/frontendsupport/.eslintrc.cjs +++ /dev/null @@ -1,28 +0,0 @@ -/** @type {import('eslint').Linter.Config} */ -module.exports = { - extends: ['@remix-run/eslint-config', '@remix-run/eslint-config/node', 'plugin:prettier/recommended'], - rules: { - 'react-hooks/rules-of-hooks': [ - 'error', - { - additionalHooks: '(useIsomorphicLayoutEffect)', - }, - ], - 'react-hooks/exhaustive-deps': [ - 'error', - { - additionalHooks: '(useIsomorphicLayoutEffect)', - }, - ], - 'prettier/prettier': [ - 'error', - { - printWidth: 120, - singleQuote: true, - semi: true, - tabWidth: 2, - trailingComma: 'all', - }, - ], - }, -}; diff --git a/apps/frontendsupport/app/components/About/About.tsx b/apps/frontendsupport/app/components/About/About.tsx index c670fb541..5096f4ab4 100644 --- a/apps/frontendsupport/app/components/About/About.tsx +++ b/apps/frontendsupport/app/components/About/About.tsx @@ -1,4 +1,5 @@ -import { Box, Heading, PageBlock, TextLink, Text, Stack, List } from '@cutting/component-library'; +import { Box, Heading, List, PageBlock, Stack, Text, TextLink } from '@cutting/component-library'; + import { LazyLoadedImage } from '../LazyLoadedImage/LazyLoadedImage'; export function About(): JSX.Element { diff --git a/apps/frontendsupport/app/components/CTAButton/CTAButton.tsx b/apps/frontendsupport/app/components/CTAButton/CTAButton.tsx index 886e1df8d..6bc9244a6 100644 --- a/apps/frontendsupport/app/components/CTAButton/CTAButton.tsx +++ b/apps/frontendsupport/app/components/CTAButton/CTAButton.tsx @@ -1,7 +1,8 @@ -import type { MouseEventHandler, ReactNode } from 'react'; import cs from 'classnames'; -import * as styles from './CTAButton.css.js'; +import type { MouseEventHandler, ReactNode } from 'react'; + import { TextNavLink } from '../TextNavLink/TextNavLink.js'; +import * as styles from './CTAButton.css.js'; interface CTAButtonProps { children: ReactNode; diff --git a/apps/frontendsupport/app/components/Clients/Clients.tsx b/apps/frontendsupport/app/components/Clients/Clients.tsx index f16d148d2..7fa9b3eb7 100644 --- a/apps/frontendsupport/app/components/Clients/Clients.tsx +++ b/apps/frontendsupport/app/components/Clients/Clients.tsx @@ -1,13 +1,15 @@ import { Box, Heading } from '@cutting/component-library'; import { useIsomorphicLayoutEffect } from '@cutting/hooks'; -import { horizontalLoop } from './loop'; -import { useRef } from 'react'; +import { waitUntil } from '@cutting/util'; +import cs from 'classnames'; import gsap from 'gsap'; +import { useRef } from 'react'; + import { Panel } from '~/pages/Home/Panel/Panel'; -import cs from 'classnames'; -import * as styles from './Clients.css'; + import { LazyLoadedImage } from '../LazyLoadedImage/LazyLoadedImage'; -import { waitUntil } from '@cutting/util'; +import * as styles from './Clients.css'; +import { horizontalLoop } from './loop'; const clients = [ 'https://res.cloudinary.com/ddospxsc8/image/upload/v1696609565/volvo_qhsx69.png', @@ -25,6 +27,7 @@ interface ClientsProps { export function Clients({ width }: ClientsProps): JSX.Element { const id = useRef(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any const savedCallback = useRef(); const boxRef = useRef(null); diff --git a/apps/frontendsupport/app/components/Clients/loop.ts b/apps/frontendsupport/app/components/Clients/loop.ts index 6dff13c95..7744c5b4e 100644 --- a/apps/frontendsupport/app/components/Clients/loop.ts +++ b/apps/frontendsupport/app/components/Clients/loop.ts @@ -7,31 +7,30 @@ interface LoopConfig { repeat?: number; onChange?(h: HTMLElement, i: number): void; speed?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any snap?: any; } -export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { +export function horizontalLoop(items: HTMLElement[], config: LoopConfig): gsap.core.Timeline { items = gsap.utils.toArray(items); config = config || {}; - let onChange = config.onChange, - lastIndex = 0, - tl = gsap.timeline({ - onUpdate: - onChange && - function () { - let i = tl.closestIndex(); - if (lastIndex !== i) { - lastIndex = i; - onChange?.(items[i]!, i); - } - }, - paused: config.paused, - defaults: { ease: 'none' }, - onReverseComplete: () => { - tl.totalTime(tl.rawTime() + tl.duration() * 100); - }, - }); + const onChange = config.onChange; + let lastIndex = 0; + const tl = gsap.timeline({ + onUpdate() { + const i = tl.closestIndex(); + if (lastIndex !== i) { + lastIndex = i; + onChange?.(items[i]!, i); + } + }, + paused: config.paused, + defaults: { ease: 'none' }, + onReverseComplete: () => { + tl.totalTime(tl.rawTime() + tl.duration() * 100); + }, + }); const length = items.length; @@ -98,6 +97,7 @@ export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { let timeWrap: (t: number) => number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const getClosest = (values: number[], value: any, wrap: any) => { let i = values.length, closest = 1e10, @@ -151,13 +151,16 @@ export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { }; const refresh = (deep: boolean) => { - let progress = tl.progress(); + const progress = tl.progress(); tl.progress(0, true); populateWidths(); - deep && populateTimeline(); + if (deep) { + populateTimeline(); + } tl.progress(progress, true); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any let proxy: any; gsap.set(items, { x: 0 }); @@ -169,11 +172,16 @@ export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { // window.addEventListener('resize', () => refresh(true)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any function toIndex(index: number, vars: any) { vars = vars || {}; - Math.abs(index - curIndex) > length / 2 && (index += index > curIndex ? -length : length); // always go in the shortest direction - let newIndex = gsap.utils.wrap(0, length, index), - time = times[newIndex]; + if (Math.abs(index - curIndex) > length / 2) { + index += index > curIndex ? -length : length; // always go in the shortest direction + } + + const newIndex = gsap.utils.wrap(0, length, index); + let time = times[newIndex]; + if (time! > tl.time() !== index > curIndex && index !== curIndex) { // if we're wrapping the timeline's playhead, make the proper adjustments time! += tl.duration() * (index > curIndex ? 1 : -1); @@ -186,9 +194,10 @@ export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { gsap.killTweensOf(proxy); return vars.duration === 0 ? tl.time(timeWrap(time!)) : tl.tweenTo(time!, vars); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any tl.toIndex = (index: number, vars: any) => toIndex(index, vars); tl.closestIndex = (setCurrent: unknown) => { - let index = getClosest(times, tl.time(), tl.duration()); + const index = getClosest(times, tl.time(), tl.duration()); if (setCurrent) { curIndex = index; indexIsDirty = false; @@ -198,9 +207,10 @@ export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { tl.current = () => (indexIsDirty ? tl.closestIndex(true) : curIndex); + // eslint-disable-next-line @typescript-eslint/no-explicit-any tl.next = (vars: any) => toIndex(tl.current() + 1, vars); - tl.previous = (vars: any) => toIndex(tl.current() - 1, vars); + tl.previous = (vars: unknown) => toIndex(tl.current() - 1, vars); tl.times = times; @@ -212,7 +222,7 @@ export function horizontalLoop(items: HTMLElement[], config: LoopConfig) { tl.refresh = refresh; - onChange && onChange(items[curIndex]!, curIndex); + onChange?.(items[curIndex]!, curIndex); return tl; } diff --git a/apps/frontendsupport/app/components/Contact/Contact.tsx b/apps/frontendsupport/app/components/Contact/Contact.tsx index f0b308a35..2863b328a 100644 --- a/apps/frontendsupport/app/components/Contact/Contact.tsx +++ b/apps/frontendsupport/app/components/Contact/Contact.tsx @@ -1,5 +1,6 @@ import { Box, Heading, Stack } from '@cutting/component-library'; import { ContactForm } from '@cutting/react-hook-form-components'; + import * as styles from './Contact.css'; export function Contact(): JSX.Element { diff --git a/apps/frontendsupport/app/components/Header/Header.tsx b/apps/frontendsupport/app/components/Header/Header.tsx index 4363471f0..dc619720c 100644 --- a/apps/frontendsupport/app/components/Header/Header.tsx +++ b/apps/frontendsupport/app/components/Header/Header.tsx @@ -1,6 +1,7 @@ -import { TopNav } from './Top.js'; import { Box } from '@cutting/component-library'; +import { TopNav } from './Top.js'; + export function Header(): JSX.Element { return ( diff --git a/apps/frontendsupport/app/components/Header/Top.css.ts b/apps/frontendsupport/app/components/Header/Top.css.ts index 60ebb4a7e..5805b3354 100644 --- a/apps/frontendsupport/app/components/Header/Top.css.ts +++ b/apps/frontendsupport/app/components/Header/Top.css.ts @@ -1,5 +1,5 @@ -import { globalStyle, style } from '@vanilla-extract/css'; import { responsiveStyle, vars } from '@cutting/component-library'; +import { globalStyle, style } from '@vanilla-extract/css'; export const logo = style({ whiteSpace: 'nowrap', diff --git a/apps/frontendsupport/app/components/Header/Top.tsx b/apps/frontendsupport/app/components/Header/Top.tsx index 88c6bac6f..d6f69f2d0 100644 --- a/apps/frontendsupport/app/components/Header/Top.tsx +++ b/apps/frontendsupport/app/components/Header/Top.tsx @@ -1,9 +1,10 @@ -import { NavLink } from '@remix-run/react'; import { Box, Nav, NavItem, NavItems, vars } from '@cutting/component-library'; -import { CTAButton } from '../CTAButton/CTAButton.js'; +import { NavLink } from '@remix-run/react'; +import { Image } from '@unpic/react'; import { useCallback, useState } from 'react'; + +import { CTAButton } from '../CTAButton/CTAButton.js'; import { TextNavLink } from '../TextNavLink/TextNavLink.js'; -import { Image } from '@unpic/react'; import * as styles from './Top.css'; export function TopNav(): JSX.Element { diff --git a/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.css.ts b/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.css.ts index 136b4264d..74688b8ea 100644 --- a/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.css.ts +++ b/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.css.ts @@ -1,5 +1,5 @@ import { responsiveStyle } from '@cutting/component-library'; -import { style, createVar } from '@vanilla-extract/css'; +import { createVar, style } from '@vanilla-extract/css'; export const backgroundImage = createVar(); diff --git a/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.tsx b/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.tsx index 47b8d739e..be2a1e156 100644 --- a/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.tsx +++ b/apps/frontendsupport/app/components/LazyBackgroundImage/LazyBackgroundImage.tsx @@ -1,12 +1,13 @@ -import { useRef, useState, useCallback, useMemo } from 'react'; +import { assert } from '@cutting/assert'; import { Box, type BoxProps } from '@cutting/component-library'; import { useIsomorphicLayoutEffect } from '@cutting/hooks'; -import { getImagePropsFromMap } from '../LazyLoadedImage/getImagePropsFromMap.js'; import { blurhashToGradientCssObject } from '@unpic/placeholder'; import { assignInlineVars } from '@vanilla-extract/dynamic'; -import * as styles from './LazyBackgroundImage.css.js'; import cs from 'classnames'; -import { assert } from '@cutting/assert'; +import { useCallback, useMemo, useRef, useState } from 'react'; + +import { getImagePropsFromMap } from '../LazyLoadedImage/getImagePropsFromMap.js'; +import * as styles from './LazyBackgroundImage.css.js'; interface LazyBackgroundImageProps { backgroundImage: string; @@ -46,7 +47,6 @@ export function LazyBackgroundImage({ return () => { if (containerRef.current) { - // eslint-disable-next-line react-hooks/exhaustive-deps observer.unobserve(containerRef.current); } }; @@ -64,14 +64,14 @@ export function LazyBackgroundImage({ ); diff --git a/apps/frontendsupport/app/components/LazyLoadedImage/LazyLoadedImage.tsx b/apps/frontendsupport/app/components/LazyLoadedImage/LazyLoadedImage.tsx index cb8080277..2dcc6d8fe 100644 --- a/apps/frontendsupport/app/components/LazyLoadedImage/LazyLoadedImage.tsx +++ b/apps/frontendsupport/app/components/LazyLoadedImage/LazyLoadedImage.tsx @@ -1,9 +1,10 @@ +import { assert } from '@cutting/assert'; +import { useIsomorphicLayoutEffect } from '@cutting/hooks'; import { blurhashToCssGradientString } from '@unpic/placeholder'; import { Image, type ImageProps } from '@unpic/react'; import { useCallback, useMemo, useState } from 'react'; + import { getImagePropsFromMap } from './getImagePropsFromMap'; -import { useIsomorphicLayoutEffect } from '@cutting/hooks'; -import { assert } from '@cutting/assert'; type Layout = ImageProps['layout']; @@ -49,6 +50,7 @@ export function LazyLoadedImage({ return ( } & { underline?: boolean } & Omit< TextProps, 'className' diff --git a/apps/frontendsupport/app/entry.server.tsx b/apps/frontendsupport/app/entry.server.tsx index 725742e30..1ab164415 100644 --- a/apps/frontendsupport/app/entry.server.tsx +++ b/apps/frontendsupport/app/entry.server.tsx @@ -23,7 +23,7 @@ export default function handleRequest( // free to delete this parameter in your app if you're not using it! // eslint-disable-next-line @typescript-eslint/no-unused-vars loadContext: AppLoadContext, -) { +): Promise { return isbot(request.headers.get('user-agent')) ? handleBotRequest(request, responseStatusCode, responseHeaders, remixContext) : handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext); diff --git a/apps/frontendsupport/app/pages/Home/Dots/Dots.tsx b/apps/frontendsupport/app/pages/Home/Dots/Dots.tsx index 0797c18bd..742807324 100644 --- a/apps/frontendsupport/app/pages/Home/Dots/Dots.tsx +++ b/apps/frontendsupport/app/pages/Home/Dots/Dots.tsx @@ -1,12 +1,13 @@ +import { assert } from '@cutting/assert'; import { Box } from '@cutting/component-library'; -import { Panel } from '../Panel/Panel'; -import { range } from '@cutting/util'; -import { useRef } from 'react'; -import { Dot } from './Dot/Dot'; import { useIsomorphicLayoutEffect } from '@cutting/hooks'; -import { assert } from '@cutting/assert'; +import { range } from '@cutting/util'; import gsap from 'gsap'; import ScrollTrigger from 'gsap/ScrollTrigger'; +import { useRef } from 'react'; + +import { Panel } from '../Panel/Panel'; +import { Dot } from './Dot/Dot'; import { horizontalLoop } from './horizontalLoop'; const numberOfDots = [...range(9)] as const; @@ -64,7 +65,7 @@ export function Dots({ width }: DotsProps): JSX.Element { overflow="hidden" > {numberOfDots.map((_, i) => ( - + ))} diff --git a/apps/frontendsupport/app/pages/Home/Dots/horizontalLoop.ts b/apps/frontendsupport/app/pages/Home/Dots/horizontalLoop.ts index 94245a8c6..4b0167ed1 100644 --- a/apps/frontendsupport/app/pages/Home/Dots/horizontalLoop.ts +++ b/apps/frontendsupport/app/pages/Home/Dots/horizontalLoop.ts @@ -4,18 +4,21 @@ interface Config { repeat?: number; paused?: boolean; speed?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any snap?: any; paddingRight?: number | string; reversed?: number; } -export function horizontalLoop(items: any, config: Config) { +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function horizontalLoop(items: any, config: Config): gsap.core.Timeline { items = gsap.utils.toArray(items); config = config || {}; - let tl = gsap.timeline({ + const tl = gsap.timeline({ repeat: config.repeat, paused: config.paused, defaults: { ease: 'none' }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any onReverseComplete: () => tl.totalTime(tl.rawTime() + tl.duration() * 100) as any, }), length = items.length, @@ -23,37 +26,38 @@ export function horizontalLoop(items: any, config: Config) { times: number[] = [], widths: number[] = [], xPercents: number[] = [], - curIndex = 0, - pixelsPerSecond = (config.speed || 1) * 100, - snap = config.snap === false ? (v: any) => v : gsap.utils.snap(config.snap || 1), // some browsers shift by a pixel to accommodate flex layouts, so for example if width is 20% the first element's width might be 242px, and the next 243px, alternating back and forth. So we snap to 5 percentage points to make things look more natural - totalWidth, - curX, - distanceToStart, - distanceToLoop, - item, - i; + pixelsPerSecond = (config.speed || 1) * 100; + let curIndex = 0; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const snap = config.snap === false ? (v: any) => v : gsap.utils.snap(config.snap || 1); // some browsers shift by a pixel to accommodate flex layouts, so for example if width is 20% the first element's width might be 242px, and the next 243px, alternating back and forth. So we snap to 5 percentage points to make things look more natural + let curX, distanceToStart, distanceToLoop, item, i; + gsap.set(items, { // convert "x" to "xPercent" to make things responsive, and populate the widths/xPercents Arrays to make lookups faster. xPercent: (i, el) => { - let w = (widths[i] = parseFloat(gsap.getProperty(el, 'width', 'px') as string)); + const w = (widths[i] = parseFloat(gsap.getProperty(el, 'width', 'px') as string)); xPercents[i] = snap( + // eslint-disable-next-line @typescript-eslint/no-explicit-any ((((parseFloat(gsap.getProperty(el, 'x', 'px') as string) / w) * 100) as any) + + // eslint-disable-next-line @typescript-eslint/no-explicit-any gsap.getProperty(el, 'xPercent')) as any, ); return xPercents[i]; }, }); gsap.set(items, { x: 0 }); - totalWidth = + const totalWidth = items[length - 1].offsetLeft + (xPercents[length - 1] / 100) * widths[length - 1] - startX + + // eslint-disable-next-line @typescript-eslint/no-explicit-any items[length - 1].offsetWidth * (gsap.getProperty(items[length - 1], 'scaleX') as any) + (parseFloat(config.paddingRight as string) || 0); for (i = 0; i < length; i++) { item = items[i]; curX = (xPercents[i] / 100) * widths[i]; distanceToStart = item.offsetLeft + curX - startX; + // eslint-disable-next-line @typescript-eslint/no-explicit-any distanceToLoop = distanceToStart + widths[i] * (gsap.getProperty(item, 'scaleX') as any); tl.to( item, @@ -75,9 +79,12 @@ export function horizontalLoop(items: any, config: Config) { } function toIndex(index: number, vars: gsap.TweenVars) { vars = vars || {}; - Math.abs(index - curIndex) > length / 2 && (index += index > curIndex ? -length : length); // always go in the shortest direction - let newIndex = gsap.utils.wrap(0, length, index), - time = times[newIndex]; + if (Math.abs(index - curIndex) > length / 2) { + index += index > curIndex ? -length : length; // always go in the shortest direction + } + const newIndex = gsap.utils.wrap(0, length, index); + let time = times[newIndex]; + if (time > tl.time() !== index > curIndex) { // if we're wrapping the timeline's playhead, make the proper adjustments vars.modifiers = { time: gsap.utils.wrap(0, tl.duration()) }; diff --git a/apps/frontendsupport/app/pages/Home/Home.tsx b/apps/frontendsupport/app/pages/Home/Home.tsx index 01890a08e..9b85f5702 100644 --- a/apps/frontendsupport/app/pages/Home/Home.tsx +++ b/apps/frontendsupport/app/pages/Home/Home.tsx @@ -1,19 +1,21 @@ +import './Home.css'; + +import { assert } from '@cutting/assert'; import { Box, C2Testimonial, DSTestimonial, Heading, List, Redhatestimonial, Text } from '@cutting/component-library'; import { useIsomorphicLayoutEffect } from '@cutting/hooks'; -import gsap from 'gsap'; -import { Panel } from './Panel/Panel'; import { useParentSize } from '@cutting/use-get-parent-size'; -import { useRef } from 'react'; -import { BreakGlass } from '../Panels/BreakGlass/BreakGlass'; -import ScrollTrigger from 'gsap/ScrollTrigger'; +import { Image } from '@unpic/react'; +import gsap from 'gsap'; import ScrollToPlugin from 'gsap/ScrollToPlugin'; +import ScrollTrigger from 'gsap/ScrollTrigger'; import SplitText from 'gsap/SplitText'; -import { assert } from '@cutting/assert'; +import { useRef } from 'react'; + +import { About } from '../../components/About/About'; import { Clients } from '../../components/Clients/Clients'; +import { BreakGlass } from '../Panels/BreakGlass/BreakGlass'; import { Services } from '../Panels/Services/Services'; -import { About } from '../../components/About/About'; -import { Image } from '@unpic/react'; -import './Home.css'; +import { Panel } from './Panel/Panel'; export function Home(): JSX.Element { const container = useRef(null); @@ -53,7 +55,6 @@ export function Home(): JSX.Element { wordsClass: 'word', }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars function main() { if (!width || width < 100) { return; diff --git a/apps/frontendsupport/app/pages/Home/Panel/Panel.tsx b/apps/frontendsupport/app/pages/Home/Panel/Panel.tsx index 060b0c41b..8d46beefe 100644 --- a/apps/frontendsupport/app/pages/Home/Panel/Panel.tsx +++ b/apps/frontendsupport/app/pages/Home/Panel/Panel.tsx @@ -1,7 +1,8 @@ import type { BoxProps } from '@cutting/component-library'; import { Box } from '@cutting/component-library'; -import { type ReactNode } from 'react'; import cs from 'classnames'; +import { type ReactNode } from 'react'; + import * as styles from './Panel.css'; type PanelProps = { diff --git a/apps/frontendsupport/app/pages/Panels/BreakGlass/BreakGlass.tsx b/apps/frontendsupport/app/pages/Panels/BreakGlass/BreakGlass.tsx index 69093572d..73d48cc52 100644 --- a/apps/frontendsupport/app/pages/Panels/BreakGlass/BreakGlass.tsx +++ b/apps/frontendsupport/app/pages/Panels/BreakGlass/BreakGlass.tsx @@ -1,8 +1,9 @@ -import type { Ref } from 'react'; -import cs from 'classnames'; -import * as styles from './BreakingGlass.css'; import { Box } from '@cutting/component-library'; import { Image } from '@unpic/react'; +import cs from 'classnames'; +import type { Ref } from 'react'; + +import * as styles from './BreakingGlass.css'; interface BreakGlassProps { container: Ref; diff --git a/apps/frontendsupport/app/pages/Panels/Services/Service.tsx b/apps/frontendsupport/app/pages/Panels/Services/Service.tsx index 02d1d3258..62e3e8ae0 100644 --- a/apps/frontendsupport/app/pages/Panels/Services/Service.tsx +++ b/apps/frontendsupport/app/pages/Panels/Services/Service.tsx @@ -1,7 +1,8 @@ +import type { ListProps } from '@cutting/component-library'; import { Box, Card, Heading, List, Stack, Text } from '@cutting/component-library'; import type { ReactNode } from 'react'; + import { TextNavLink } from '../../../components/TextNavLink/TextNavLink'; -import type { ListProps } from '@cutting/component-library'; type ServiceProps = Pick & { heading: string; diff --git a/apps/frontendsupport/app/pages/Panels/Services/Services.tsx b/apps/frontendsupport/app/pages/Panels/Services/Services.tsx index 1aea2f34d..ee04ffe9c 100644 --- a/apps/frontendsupport/app/pages/Panels/Services/Services.tsx +++ b/apps/frontendsupport/app/pages/Panels/Services/Services.tsx @@ -1,7 +1,8 @@ import { Box, Heading, Stack, Text, Tiles } from '@cutting/component-library'; -import { Service } from './Service'; import { ContactButtons } from '@cutting/react-hook-form-components'; +import { Service } from './Service'; + type Service = { heading: string; link: `/services/${string}`; diff --git a/apps/frontendsupport/app/root.tsx b/apps/frontendsupport/app/root.tsx index 03e8e4270..8d50e9907 100644 --- a/apps/frontendsupport/app/root.tsx +++ b/apps/frontendsupport/app/root.tsx @@ -1,21 +1,29 @@ -import { json } from '@remix-run/node'; -import type { MetaFunction, LinksFunction, HeadersFunction } from '@remix-run/node'; -import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react'; -import rehypeStyles from './rehype.css'; -import katex from 'katex/dist/katex.min.css'; -import { cssBundleHref } from '@remix-run/css-bundle'; import './global.css'; + import { supportTheme } from '@cutting/component-library'; import cuttingStyles from '@cutting/component-library/styles.css'; -import hookFormStyles from '@cutting/react-hook-form-components/styles.css'; import { FormContextProvider } from '@cutting/react-hook-form-components'; -import cssStyles from './styles.css'; -import { Header } from './components/Header/Header.js'; -import * as styles from './root.css'; +import hookFormStyles from '@cutting/react-hook-form-components/styles.css'; +import { cssBundleHref } from '@remix-run/css-bundle'; +import type { HeadersFunction, LinksFunction, MetaFunction, TypedResponse } from '@remix-run/node'; +import { json } from '@remix-run/node'; +import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react'; import cs from 'classnames'; +import katex from 'katex/dist/katex.min.css'; + +import { Header } from './components/Header/Header.js'; import { contactFormProps } from './constants.js'; +import rehypeStyles from './rehype.css'; +import * as styles from './root.css'; +import cssStyles from './styles.css'; -export async function loader() { +export async function loader(): Promise< + TypedResponse<{ + ENV: { + GIT_COMMIT: string | undefined; + }; + }> +> { return json({ ENV: { GIT_COMMIT: process.env.GIT_COMMIT, @@ -53,7 +61,7 @@ export const headers: HeadersFunction = () => { }; }; -export const meta: MetaFunction = ({ location, data }) => { +export const meta: MetaFunction = ({ location, data: _data }) => { return [ { title: 'Frontend Rescue' }, { property: 'og:url', content: location.pathname }, @@ -132,7 +140,7 @@ export const links: LinksFunction = () => [ }, ]; -export default function App() { +export default function App(): JSX.Element { const data = useLoaderData(); return ( diff --git a/apps/frontendsupport/app/routes/_index.tsx b/apps/frontendsupport/app/routes/_index.tsx index 23325de1b..0f0472f99 100644 --- a/apps/frontendsupport/app/routes/_index.tsx +++ b/apps/frontendsupport/app/routes/_index.tsx @@ -1,5 +1,5 @@ import { Home as HomePage } from '../pages/Home/Home.js'; -export default function Home() { +export default function Home(): JSX.Element { return ; } diff --git a/apps/frontendsupport/app/routes/posts.$slug.tsx b/apps/frontendsupport/app/routes/posts.$slug.tsx index 54b5273e6..0782766cf 100644 --- a/apps/frontendsupport/app/routes/posts.$slug.tsx +++ b/apps/frontendsupport/app/routes/posts.$slug.tsx @@ -1,16 +1,17 @@ -import * as mdxBundler from 'mdx-bundler/client/index.js'; -import type { ReactNode } from 'react'; -import { Children, isValidElement, useMemo } from 'react'; -import { json } from '@remix-run/node'; -import type { LoaderFunction } from '@remix-run/node'; -import { useLoaderData } from '@remix-run/react'; -import { getPost } from '../utils/post.js'; import type { ReactNodeNoStrings } from '@cutting/component-library'; import { Box, Heading, List, PageBlock, Text, TextLink } from '@cutting/component-library'; -import type { FrontMatter } from '../types.js'; +import type { LoaderFunction } from '@remix-run/node'; +import { json } from '@remix-run/node'; import type { Location, MetaFunction } from '@remix-run/react'; -import { LazyLoadedImage } from '../components/LazyLoadedImage/LazyLoadedImage.js'; +import { useLoaderData } from '@remix-run/react'; import { Image } from '@unpic/react'; +import * as mdxBundler from 'mdx-bundler/client/index.js'; +import type { ReactNode } from 'react'; +import { Children, isValidElement, useMemo } from 'react'; + +import { LazyLoadedImage } from '../components/LazyLoadedImage/LazyLoadedImage.js'; +import type { FrontMatter } from '../types.js'; +import { getPost } from '../utils/post.js'; type LoaderData = { frontmatter: FrontMatter; @@ -108,6 +109,7 @@ export const loader: LoaderFunction = async ({ params }) => { } }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any export const meta: MetaFunction = ({ location, data: { @@ -136,7 +138,7 @@ export const meta: MetaFunction = ({ ]; }; -export default function PostRoute() { +export default function PostRoute(): JSX.Element { const { code, frontmatter } = useLoaderData(); const Component = useMemo(() => mdxBundler.getMDXComponent(code), [code]); @@ -158,8 +160,10 @@ export default function PostRoute() { h2: Heading2, h3: Heading3, h4: Heading4, + // eslint-disable-next-line @typescript-eslint/no-explicit-any a: TextLink as any, ul: Ul, + // eslint-disable-next-line @typescript-eslint/no-explicit-any img: Img as any, }} attributes={frontmatter} diff --git a/apps/frontendsupport/app/routes/posts._index.tsx b/apps/frontendsupport/app/routes/posts._index.tsx index 593fa7f26..7cf6086ef 100644 --- a/apps/frontendsupport/app/routes/posts._index.tsx +++ b/apps/frontendsupport/app/routes/posts._index.tsx @@ -1,14 +1,15 @@ -import { useLoaderData } from '@remix-run/react'; -import { getPosts } from '../utils/post.js'; +import type { PostData } from '@cutting/markdown'; import { type LoaderFunction } from '@remix-run/node'; +import { useLoaderData } from '@remix-run/react'; + import { Posts } from '../components/Posts/Posts.js'; -import type { PostData } from '@cutting/markdown'; +import { getPosts } from '../utils/post.js'; export const loader: LoaderFunction = async () => { return getPosts(); }; -export default function PostsHome() { +export default function PostsHome(): JSX.Element { const posts = useLoaderData(); return ; diff --git a/apps/frontendsupport/app/routes/services.consultancy.tsx b/apps/frontendsupport/app/routes/services.consultancy.tsx index 681507c6d..3329e5b08 100644 --- a/apps/frontendsupport/app/routes/services.consultancy.tsx +++ b/apps/frontendsupport/app/routes/services.consultancy.tsx @@ -1,4 +1,4 @@ -import { Heading, C2Testimonial, Stack, Text } from '@cutting/component-library'; +import { C2Testimonial, Heading, Stack, Text } from '@cutting/component-library'; import { ContactButtons } from '@cutting/react-hook-form-components'; export default function Consultancy(): JSX.Element { diff --git a/apps/frontendsupport/app/routes/services.home.tsx b/apps/frontendsupport/app/routes/services.home.tsx index e305fbfcb..96b79dd65 100644 --- a/apps/frontendsupport/app/routes/services.home.tsx +++ b/apps/frontendsupport/app/routes/services.home.tsx @@ -1,5 +1,7 @@ import { Box } from '@cutting/component-library'; + import { Services } from '../pages/Panels/Services/Services.js'; + export default function ServicesHome(): JSX.Element { return ( diff --git a/apps/frontendsupport/app/routes/services.mentoring.tsx b/apps/frontendsupport/app/routes/services.mentoring.tsx index 7fa606a85..143c75559 100644 --- a/apps/frontendsupport/app/routes/services.mentoring.tsx +++ b/apps/frontendsupport/app/routes/services.mentoring.tsx @@ -1,4 +1,4 @@ -import { Heading, DSTestimonial, Stack, Text } from '@cutting/component-library'; +import { DSTestimonial, Heading, Stack, Text } from '@cutting/component-library'; import { ContactButtons } from '@cutting/react-hook-form-components'; export default function Mentoring(): JSX.Element { diff --git a/apps/frontendsupport/app/utils/fs.server.ts b/apps/frontendsupport/app/utils/fs.server.ts index 3f77e11a3..376b2a239 100644 --- a/apps/frontendsupport/app/utils/fs.server.ts +++ b/apps/frontendsupport/app/utils/fs.server.ts @@ -1,3 +1,2 @@ -export { readFile, mkdir, writeFile, readdir } from 'fs/promises'; - export { existsSync } from 'fs'; +export { mkdir, readdir, readFile, writeFile } from 'fs/promises'; diff --git a/apps/frontendsupport/app/utils/markdown.server.ts b/apps/frontendsupport/app/utils/markdown.server.ts index fa8e88bdf..23f24a130 100644 --- a/apps/frontendsupport/app/utils/markdown.server.ts +++ b/apps/frontendsupport/app/utils/markdown.server.ts @@ -1 +1 @@ -export { getPosts as getBlogPosts, bundleMarkdown } from '@cutting/markdown'; +export { bundleMarkdown, getPosts as getBlogPosts } from '@cutting/markdown'; diff --git a/apps/frontendsupport/app/utils/path.server.ts b/apps/frontendsupport/app/utils/path.server.ts index c96e69662..44c50f9fe 100644 --- a/apps/frontendsupport/app/utils/path.server.ts +++ b/apps/frontendsupport/app/utils/path.server.ts @@ -1 +1 @@ -export { join, resolve, dirname } from 'path'; +export { dirname, join, resolve } from 'path'; diff --git a/apps/frontendsupport/app/utils/post.ts b/apps/frontendsupport/app/utils/post.ts index 58ac9a1c3..85623d0ec 100644 --- a/apps/frontendsupport/app/utils/post.ts +++ b/apps/frontendsupport/app/utils/post.ts @@ -1,16 +1,20 @@ -import { join, dirname } from './path.server.js'; -import { getBlogPosts, bundleMarkdown } from './markdown.server.js'; +import type { PostData } from '@cutting/markdown'; + +import { bundleMarkdown, getBlogPosts } from './markdown.server.js'; +import { dirname, join } from './path.server.js'; import { fileURLToPath } from './url.server.js'; +type MD = ReturnType; + const __dirname = dirname(fileURLToPath(import.meta.url)); -export async function getPost(slug: string) { +export async function getPost(slug: string): MD { const postsRootPath = join(__dirname, `./blog-posts`); return bundleMarkdown(join(postsRootPath, `${slug}/index.md`)); } -export async function getPosts() { +export async function getPosts(): Promise { const postsRootPath = join(__dirname, `./blog-posts`); return getBlogPosts(postsRootPath); diff --git a/apps/frontendsupport/app/utils/url.server.ts b/apps/frontendsupport/app/utils/url.server.ts index c8c415d91..6759aab47 100644 --- a/apps/frontendsupport/app/utils/url.server.ts +++ b/apps/frontendsupport/app/utils/url.server.ts @@ -1 +1 @@ -export { URL, fileURLToPath } from 'node:url'; +export { fileURLToPath, URL } from 'node:url'; diff --git a/apps/frontendsupport/eslint.config.mjs b/apps/frontendsupport/eslint.config.mjs index 997545281..2a70fc259 100644 --- a/apps/frontendsupport/eslint.config.mjs +++ b/apps/frontendsupport/eslint.config.mjs @@ -1,38 +1,52 @@ -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; +// import path from 'node:path'; +// import { fileURLToPath } from 'node:url'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all -}); +import defaultConfig from '@cutting/eslint-config/eslint'; +// import { FlatCompat } from '@eslint/eslintrc'; +// import js from '@eslint/js'; -export default [{ - ignores: [".cache", "server/index.js", "public/build", "**/*.map"], -}, ...compat.extends( - "@remix-run/eslint-config", - "@remix-run/eslint-config/node", - "plugin:prettier/recommended", -), { - rules: { - "react-hooks/rules-of-hooks": ["error", { - additionalHooks: "(useIsomorphicLayoutEffect)", - }], +// const __filename = fileURLToPath(import.meta.url); +// const __dirname = path.dirname(__filename); +// const compat = new FlatCompat({ +// baseDirectory: __dirname, +// recommendedConfig: js.configs.recommended, +// allConfig: js.configs.all, +// }); - "react-hooks/exhaustive-deps": ["error", { - additionalHooks: "(useIsomorphicLayoutEffect)", - }], +/** @type {import("eslint").Linter.Config} */ +export default [ + { + ignores: [ + '**/.cache/**', + '**/build/**', + '**/public/build/**', + '**/playwright-report/**', + '**/server/**', + '**/node_modules/**', + '**/dist/**', + '**/src/plugins/**', + ], + }, + ...defaultConfig, +]; +// export default [{ +// ignores: [".cache", "server/index.js", "public/build", "**/*.map"], +// }, ...compat.extends( +// "@remix-run/eslint-config", +// "@remix-run/eslint-config/node", +// "plugin:prettier/recommended", +// ), { +// rules: { +// "react-hooks/rules-of-hooks": ["error"], - "prettier/prettier": ["error", { - printWidth: 120, - singleQuote: true, - semi: true, - tabWidth: 2, - trailingComma: "all", - }], - }, -}]; \ No newline at end of file +// "react-hooks/exhaustive-deps": ["error"], + +// "prettier/prettier": ["error", { +// printWidth: 120, +// singleQuote: true, +// semi: true, +// tabWidth: 2, +// trailingComma: "all", +// }], +// }, +// }]; diff --git a/apps/frontendsupport/package.json b/apps/frontendsupport/package.json index 938566a73..a2c494504 100644 --- a/apps/frontendsupport/package.json +++ b/apps/frontendsupport/package.json @@ -9,7 +9,7 @@ "build": "cross-env NODE_ENV=production remix build && pnpm copy-blog-posts", "dev": "pnpm copy-blog-posts && remix dev --manual -c \"arc sandbox -e testing\"", "deploy:web": "./deploy.sh", - "lint": "eslint --fix --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .", + "lint": "eslint --fix .", "start": "cross-env NODE_ENV=production arc sandbox", "typecheck": "tsc" }, diff --git a/apps/frontendsupport/plugin-remix.js b/apps/frontendsupport/plugin-remix.js index a8f517399..2c82400ec 100644 --- a/apps/frontendsupport/plugin-remix.js +++ b/apps/frontendsupport/plugin-remix.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ // This should eventually be a npm package, but for now it lives here. // It's job is to notify the remix dev server of the version of the running // app to trigger HMR / HDR. @@ -30,15 +31,15 @@ export default { } } }, 300); - }, + } }, set: { env() { // Pass matching env variables through to the application in dev mode. const passthruKeys = /^NODE_ENV$|^REMIX_DEV_/; return { - testing: Object.fromEntries(Object.entries(process.env).filter(([key]) => passthruKeys.test(key))), + testing: Object.fromEntries(Object.entries(process.env).filter(([key]) => passthruKeys.test(key))) }; - }, - }, + } + } }; diff --git a/apps/frontendsupport/remix.config.js b/apps/frontendsupport/remix.config.js index d8a7f0ac5..4d91f0207 100644 --- a/apps/frontendsupport/remix.config.js +++ b/apps/frontendsupport/remix.config.js @@ -8,5 +8,5 @@ export default { serverBuildPath: 'server/index.mjs', serverModuleFormat: 'esm', serverDependenciesToBundle: [/^gsap.*/], - tailwind: false, + tailwind: false }; diff --git a/apps/frontendsupport/replace-workspace-protocol-by-version.mjs b/apps/frontendsupport/replace-workspace-protocol-by-version.mjs index cde86d3b1..db24f5d5b 100644 --- a/apps/frontendsupport/replace-workspace-protocol-by-version.mjs +++ b/apps/frontendsupport/replace-workspace-protocol-by-version.mjs @@ -1,6 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import url from 'node:url'; + import { Command } from '@commander-js/extra-typings'; import { findWorkspacePackagesNoCheck } from '@pnpm/find-workspace-packages'; diff --git a/apps/frontendsupport/server.js b/apps/frontendsupport/server.js index 0af7d51a6..36be59e60 100644 --- a/apps/frontendsupport/server.js +++ b/apps/frontendsupport/server.js @@ -8,5 +8,5 @@ installGlobals(); export const handler = createRequestHandler({ build, - mode: build.mode, + mode: build.mode }); diff --git a/apps/frontendsupport/src/plugins/set-env.js b/apps/frontendsupport/src/plugins/set-env.js index 4de344649..711053dfe 100644 --- a/apps/frontendsupport/src/plugins/set-env.js +++ b/apps/frontendsupport/src/plugins/set-env.js @@ -2,8 +2,8 @@ export default { set: { env({ arc, inventory }) { return { - GIT_COMMIT: process.env.GIT_COMMIT, + GIT_COMMIT: process.env.GIT_COMMIT }; - }, - }, + } + } }; diff --git a/apps/threejs-project/.eslintignore b/apps/threejs-project/.eslintignore deleted file mode 100644 index 4be6e160a..000000000 --- a/apps/threejs-project/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist/* \ No newline at end of file diff --git a/apps/threejs-project/package.json b/apps/threejs-project/package.json index 65eece3d8..b8580c6e0 100644 --- a/apps/threejs-project/package.json +++ b/apps/threejs-project/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite --host --port 4400 -l info", "build": "tsc && vite build", - "lint": "eslint './**/*.{ts,tsx,js}' -c ./.eslintrc.json --fix", + "lint": "eslint './**/*.{ts,tsx}' --fix", "preview": "vite preview" }, "dependencies": { diff --git a/packages/component-library/src/components/hoc/FormControl/FormControl.test.tsx b/packages/component-library/src/components/hoc/FormControl/FormControl.test.tsx index dd0d86058..dad5daa0a 100644 --- a/packages/component-library/src/components/hoc/FormControl/FormControl.test.tsx +++ b/packages/component-library/src/components/hoc/FormControl/FormControl.test.tsx @@ -19,21 +19,21 @@ const wrap = (props?: Partial>): RenderResult describe('FormControl', () => { describe('types', () => { it('should type input element', () => { - const input = FormControl(Input); - type I = FormElementFromComponent; + const _input = FormControl(Input); + type I = FormElementFromComponent; expectType>(true); - const textarea = FormControl(TextArea); - type T = FormElementFromComponent; + const _textarea = FormControl(TextArea); + type T = FormElementFromComponent; expectType>(true); const Div = (props: HTMLAttributes) =>
Hello
; - const div = FormControl(Div); + const _div = FormControl(Div); - type D = FormElementFromComponent; + type D = FormElementFromComponent; expectType>(true); }); diff --git a/packages/component-library/src/components/molecules/CheckableGroup/CheckableGroup.tsx b/packages/component-library/src/components/molecules/CheckableGroup/CheckableGroup.tsx index ddf48ce16..296639b35 100644 --- a/packages/component-library/src/components/molecules/CheckableGroup/CheckableGroup.tsx +++ b/packages/component-library/src/components/molecules/CheckableGroup/CheckableGroup.tsx @@ -68,7 +68,7 @@ export function CheckableGroup(Comp: typeof Radio | typeof Checkbox) { setSelectedValues([...selectedValues.filter((o) => o.id !== option.id), option]); - onChange && onChange(e); + onChange?.(e); }, [onChange, selectedValues], ); diff --git a/packages/component-library/src/components/molecules/Column/Column.tsx b/packages/component-library/src/components/molecules/Column/Column.tsx index 35528f6b1..48c914269 100644 --- a/packages/component-library/src/components/molecules/Column/Column.tsx +++ b/packages/component-library/src/components/molecules/Column/Column.tsx @@ -33,7 +33,6 @@ export function Column({ children, width }: ColumnProps): JSX.Element { width={width !== 'content' ? 'full' : undefined} flexShrink={width === 'content' ? 0 : undefined} flexGrow={1} - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion className={cs(styles.column, width !== 'content' ? styles.width[width!] : null)} > [0]; - -export function remarkImgToJsx() { - return (tree: Tree): void => { - visit( - tree, - // only visit p tags that contain an img element - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (node: any) => node.type === 'paragraph' && node.children.some((n: { type: string }) => n.type === 'image'), - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (node: any) => { - const imageNode = node.children.find((n: { type: string }) => n.type === 'image'); - - // only local files - if (fs.existsSync(`${process.cwd()}/public${imageNode.url}`)) { - const dimensions = sizeOf(`${process.cwd()}/public${imageNode.url}`); - - // Convert original node to next/image - (imageNode.type = 'mdxJsxFlowElement'), - (imageNode.name = 'Image'), - (imageNode.attributes = [ - { type: 'mdxJsxAttribute', name: 'alt', value: imageNode.alt }, - { type: 'mdxJsxAttribute', name: 'src', value: imageNode.url }, - { type: 'mdxJsxAttribute', name: 'width', value: dimensions.width }, - { type: 'mdxJsxAttribute', name: 'height', value: dimensions.height }, - ]); - - // Change node type from p to div to avoid nesting error - node.type = 'div'; - node.children = [imageNode]; - } - }, - ); - }; -} diff --git a/packages/react-hook-form-components/src/components/FormComponents/FormComponents.test.tsx b/packages/react-hook-form-components/src/components/FormComponents/FormComponents.test.tsx index 19b8c62f8..581467f19 100644 --- a/packages/react-hook-form-components/src/components/FormComponents/FormComponents.test.tsx +++ b/packages/react-hook-form-components/src/components/FormComponents/FormComponents.test.tsx @@ -27,7 +27,6 @@ function Form(props: any) { const wrap = (props?: FormProps): RenderResult => { return render(
); }; -// eslint-disable-next-line @typescript-eslint/no-explicit-any describe('Form Components', () => { it('should wrap component with label', () => { diff --git a/packages/util/src/dom/wait.test.tsx b/packages/util/src/dom/wait.test.tsx index c88fbe191..a9879d43b 100644 --- a/packages/util/src/dom/wait.test.tsx +++ b/packages/util/src/dom/wait.test.tsx @@ -16,7 +16,7 @@ describe('wait', () => { try { found = await wait('#bar'); - } catch (ex) { + } catch { expect(found).toBeUndefined(); } }); diff --git a/packages/util/src/functions/functions.test.ts b/packages/util/src/functions/functions.test.ts index a20b9018d..2710f75e8 100644 --- a/packages/util/src/functions/functions.test.ts +++ b/packages/util/src/functions/functions.test.ts @@ -11,11 +11,11 @@ describe('functions', () => { it('should recognise functions', () => { expect(isFunction(() => ({}))).toBe(true); - // eslint-disable-next-line @typescript-eslint/no-empty-function + expect(isFunction(function () {})).toBe(true); - // eslint-disable-next-line @typescript-eslint/no-empty-function + expect(isFunction(async () => {})).toBe(true); - // eslint-disable-next-line @typescript-eslint/no-empty-function + expect(isFunction(function* () {})).toBe(true); expect(isFunction(Math.round)).toBe(true); expect(isFunction(new Date())).toBe(false); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 53e81d1c4..0026972bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11349,8 +11349,8 @@ packages: style-to-object@0.4.4: resolution: {integrity: sha512-HYNoHZa2GorYNyqiCaBgsxvcJIn7OHq6inEga+E6Ke3m5JkoqpQbnFssk4jwe+K7AhGa2fcha4wSOf1Kn01dMg==} - style-to-object@1.0.6: - resolution: {integrity: sha512-khxq+Qm3xEyZfKd/y9L3oIWQimxuc4STrQKtQn8aSDRHb8mFgpukgX1hdzfrMEW6JCjyJ8p89x+IUMVnCBI1PA==} + style-to-object@1.0.7: + resolution: {integrity: sha512-uSjr59G5u6fbxUfKbb8GcqMGT3Xs9v5IbPkjb0S16GyOeBLAzSRK0CixBv5YrYvzO6TDLzIS6QCn78tkqWngPw==} stylehacks@5.1.1: resolution: {integrity: sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==} @@ -17040,7 +17040,7 @@ snapshots: abstract-leveldown@6.2.3: dependencies: buffer: 5.7.1 - immediate: 3.3.0 + immediate: 3.2.3 level-concat-iterator: 2.0.1 level-supports: 1.0.1 xtend: 4.0.2 @@ -20540,7 +20540,7 @@ snapshots: mdast-util-mdxjs-esm: 2.0.1 property-information: 6.5.0 space-separated-tokens: 2.0.2 - style-to-object: 1.0.6 + style-to-object: 1.0.7 unist-util-position: 5.0.0 vfile-message: 4.0.2 transitivePeerDependencies: @@ -25504,7 +25504,7 @@ snapshots: dependencies: inline-style-parser: 0.1.1 - style-to-object@1.0.6: + style-to-object@1.0.7: dependencies: inline-style-parser: 0.2.3