From 98f1971086ef9340cc936a53c07c43a660caf01a Mon Sep 17 00:00:00 2001 From: Thijs Daniels Date: Sat, 29 Jun 2024 20:34:53 +0200 Subject: [PATCH] chore: fixeslint --- .changeset/breezy-wombats-ring.md | 5 + .changeset/dry-fireants-bathe.md | 25 + .changeset/swift-ligers-type.md | 5 + .changeset/tough-geckos-play.md | 5 + apps/infrastructure/constructs/ToolkitSite.ts | 2 +- apps/infrastructure/package.json | 14 +- apps/storybook/components/DebugOverlay.tsx | 3 +- apps/storybook/decorators/WithApp.tsx | 2 +- apps/storybook/package.json | 32 +- .../useDatePicker.stories.tsx | 331 +- .../react-essentials/useDelta.stories.tsx | 1 + .../react-select/useSelect.stories.tsx | 2 +- apps/website/package.json | 22 +- package-lock.json | 43246 ++++++++-------- package.json | 18 +- packages/cdk-amplify-app/package.json | 12 +- packages/cdk-amplify-app/tsconfig.json | 4 +- packages/cdk-bastion-host/package.json | 9 +- packages/cdk-bastion-host/tsconfig.json | 3 +- packages/cdk-cache-invalidator/package.json | 10 +- packages/cdk-cache-invalidator/tsconfig.json | 4 +- packages/cdk-docker-cluster/package.json | 17 +- .../src/constructs/DockerCluster.ts | 4 +- packages/cdk-docker-cluster/tsconfig.json | 4 +- packages/cdk-mailer/package.json | 22 +- packages/cdk-mailer/tsconfig.json | 4 +- packages/cdk-next-app/package.json | 16 +- packages/cdk-next-app/tsconfig.json | 4 +- packages/cdk-rpc-api/package.json | 9 +- packages/cdk-rpc-api/tsconfig.json | 4 +- packages/cdk-site-distribution/package.json | 19 +- packages/cdk-site-distribution/tsconfig.json | 4 +- packages/cdk-static-site/package.json | 16 +- packages/cdk-static-site/tsconfig.json | 4 +- packages/eslint-config/index.js | 16 +- packages/eslint-config/package.json | 8 +- packages/essentials/package.json | 6 - packages/essentials/tsconfig.json | 4 +- .../essentials/utilities/object/mapObject.ts | 6 +- .../utilities/object/mutateObject.ts | 11 +- .../essentials/utilities/object/pick.test.ts | 5 +- .../utilities/object/rekeyObject.ts | 2 +- .../utilities/object/revalueObject.ts | 2 +- packages/essentials/vitest.config.ts | 5 - .../react-date-picker/hooks/useDatePicker.ts | 4 +- packages/react-date-picker/package.json | 14 +- packages/react-date-picker/tsconfig.json | 4 +- .../utilities/getDaysData.ts | 3 +- .../utilities/getFormattingFn.ts | 2 +- .../utilities/getMonthData.ts | 4 +- .../utilities/getWeekdaysData.ts | 9 +- packages/react-dictionary/package.json | 9 +- packages/react-dictionary/vitest.config.ts | 5 - packages/react-essentials/hooks/useSize.ts | 2 +- .../hooks/useSynchronizedRef.ts | 2 +- packages/react-essentials/package.json | 18 +- packages/react-essentials/tsconfig.json | 4 +- packages/react-essentials/vitest.config.ts | 5 - packages/react-forms/hooks/useForm.ts | 12 +- packages/react-forms/package.json | 17 +- packages/react-forms/tsconfig.json | 4 +- packages/react-forms/validators/isNotEmpty.ts | 2 +- .../react-media/components/MediaProvider.tsx | 14 +- packages/react-media/package.json | 17 +- packages/react-media/tsconfig.json | 4 +- packages/react-media/vitest.config.ts | 1 + .../components/NotificationsProvider.tsx | 1 - packages/react-notifications/package.json | 17 +- packages/react-notifications/tsconfig.json | 4 +- packages/react-pagination/package.json | 15 +- packages/react-pagination/tsconfig.json | 4 +- packages/react-pagination/vitest.config.ts | 5 - packages/react-parallax/hooks/useParallax.tsx | 12 +- packages/react-parallax/package.json | 17 +- packages/react-parallax/tsconfig.json | 4 +- packages/react-preferences/package.json | 13 +- packages/react-preferences/tsconfig.json | 4 +- packages/react-select/package.json | 18 +- packages/react-select/tsconfig.json | 4 +- packages/react-select/vitest.config.ts | 5 - .../components/TrackingProvider.tsx | 24 +- packages/react-tracking/hooks/useTracker.ts | 6 +- packages/react-tracking/package.json | 17 +- packages/react-tracking/tsconfig.json | 4 +- packages/tsconfig/cdk.json | 4 +- packages/tsconfig/npm-package.json | 5 +- 86 files changed, 21029 insertions(+), 23257 deletions(-) create mode 100644 .changeset/breezy-wombats-ring.md create mode 100644 .changeset/dry-fireants-bathe.md create mode 100644 .changeset/swift-ligers-type.md create mode 100644 .changeset/tough-geckos-play.md diff --git a/.changeset/breezy-wombats-ring.md b/.changeset/breezy-wombats-ring.md new file mode 100644 index 00000000..90cf768c --- /dev/null +++ b/.changeset/breezy-wombats-ring.md @@ -0,0 +1,5 @@ +--- +"@codedazur/eslint-config": minor +--- + +The typescript-eslint plugin and parser are now used by default. diff --git a/.changeset/dry-fireants-bathe.md b/.changeset/dry-fireants-bathe.md new file mode 100644 index 00000000..a5098bf4 --- /dev/null +++ b/.changeset/dry-fireants-bathe.md @@ -0,0 +1,25 @@ +--- +"@codedazur/cdk-cache-invalidator": patch +"@codedazur/cdk-site-distribution": patch +"@codedazur/react-notifications": patch +"@codedazur/cdk-docker-cluster": patch +"@codedazur/react-date-picker": patch +"@codedazur/react-preferences": patch +"@codedazur/cdk-bastion-host": patch +"@codedazur/react-dictionary": patch +"@codedazur/react-essentials": patch +"@codedazur/react-pagination": patch +"@codedazur/cdk-amplify-app": patch +"@codedazur/cdk-static-site": patch +"@codedazur/react-parallax": patch +"@codedazur/react-tracking": patch +"@codedazur/cdk-next-app": patch +"@codedazur/react-select": patch +"@codedazur/cdk-rpc-api": patch +"@codedazur/react-forms": patch +"@codedazur/react-media": patch +"@codedazur/cdk-mailer": patch +"@codedazur/essentials": patch +--- + +Dependency versions were made explicit. diff --git a/.changeset/swift-ligers-type.md b/.changeset/swift-ligers-type.md new file mode 100644 index 00000000..35a986b5 --- /dev/null +++ b/.changeset/swift-ligers-type.md @@ -0,0 +1,5 @@ +--- +"@codedazur/react-media": patch +--- + +The initial volume is no longer ignored. diff --git a/.changeset/tough-geckos-play.md b/.changeset/tough-geckos-play.md new file mode 100644 index 00000000..2fa3f881 --- /dev/null +++ b/.changeset/tough-geckos-play.md @@ -0,0 +1,5 @@ +--- +"@codedazur/tsconfig": minor +--- + +An NPM packages' dist folder is excluded by default. diff --git a/apps/infrastructure/constructs/ToolkitSite.ts b/apps/infrastructure/constructs/ToolkitSite.ts index dd6ac51b..91f44f47 100644 --- a/apps/infrastructure/constructs/ToolkitSite.ts +++ b/apps/infrastructure/constructs/ToolkitSite.ts @@ -1,4 +1,4 @@ -import { StaticSite, StaticSiteProps } from "@codedazur/cdk-static-site"; +import { StaticSite } from "@codedazur/cdk-static-site"; import { env } from "@codedazur/essentials"; import { Construct } from "constructs"; diff --git a/apps/infrastructure/package.json b/apps/infrastructure/package.json index 5b167693..78b8c92d 100644 --- a/apps/infrastructure/package.json +++ b/apps/infrastructure/package.json @@ -15,17 +15,17 @@ "dependencies": { "@apps/storybook": "*", "@apps/website": "*", - "@codedazur/cdk-static-site": "*", - "@codedazur/essentials": "*", - "aws-cdk-lib": "^2.145.0", + "@codedazur/cdk-static-site": "^1.1.1", + "@codedazur/essentials": "^1.9.0", + "aws-cdk-lib": "^2.147.2", "constructs": "^10.3.0" }, "devDependencies": { - "@codedazur/tsconfig": "*", - "aws-cdk": "^2.145.0", + "@codedazur/tsconfig": "^0.0.6", + "aws-cdk": "^2.147.2", "dotenv": "^16.4.5", - "ts-jest": "^29.1.4", + "ts-jest": "^29.1.5", "ts-node": "^10.9.2", - "typescript": "^5.4.5" + "typescript": "^5.5.2" } } diff --git a/apps/storybook/components/DebugOverlay.tsx b/apps/storybook/components/DebugOverlay.tsx index c8e89b89..4cf21f2f 100644 --- a/apps/storybook/components/DebugOverlay.tsx +++ b/apps/storybook/components/DebugOverlay.tsx @@ -49,12 +49,13 @@ const DebugBox = styled(Positioned).attrs({ `; const functionTag: ScalarTag = { + // eslint-disable-next-line @typescript-eslint/ban-types identify: (value: unknown): value is Function => value instanceof Function, tag: "!fn", resolve: (string) => { return new Function(string); }, - stringify: (item, context) => { + stringify: () => { return "Function"; }, }; diff --git a/apps/storybook/decorators/WithApp.tsx b/apps/storybook/decorators/WithApp.tsx index 7823b792..82de4982 100644 --- a/apps/storybook/decorators/WithApp.tsx +++ b/apps/storybook/decorators/WithApp.tsx @@ -1,4 +1,4 @@ -import { App, Background, Padding } from "@codedazur/react-components"; +import { App } from "@codedazur/react-components"; import { Decorator } from "@storybook/react"; import { storyTheme } from "../themes/storyTheme"; diff --git a/apps/storybook/package.json b/apps/storybook/package.json index 9700045b..a84ad00f 100644 --- a/apps/storybook/package.json +++ b/apps/storybook/package.json @@ -11,42 +11,42 @@ "test": "vitest run --passWithNoTests" }, "dependencies": { - "@codedazur/essentials": "*", - "@codedazur/react-media": "*", + "@codedazur/essentials": "^1.9.0", "@codedazur/react-components": "^25.2.1", - "@codedazur/react-date-picker": "*", - "@codedazur/react-dictionary": "*", - "@codedazur/react-essentials": "*", - "@codedazur/react-forms": "*", - "@codedazur/react-notifications": "*", - "@codedazur/react-pagination": "*", - "@codedazur/react-parallax": "*", - "@codedazur/react-preferences": "*", + "@codedazur/react-date-picker": "^0.0.1", + "@codedazur/react-dictionary": "^0.2.1", + "@codedazur/react-essentials": "^1.4.1", + "@codedazur/react-forms": "^0.1.0", + "@codedazur/react-media": "^1.0.0", + "@codedazur/react-notifications": "^0.1.3", + "@codedazur/react-pagination": "^1.0.1", + "@codedazur/react-parallax": "^0.1.0", + "@codedazur/react-preferences": "^1.0.0", "@faker-js/faker": "^8.4.1", "@storybook/jest": "^0.1.0 || ^0.2.0", "@types/styled-components": "^5.1.34", "color": "^4.2.3", - "react": "^18.3.1", + "date-fns": "^2.30.0", "react-dom": "^18.3.1", + "react": "^18.3.1", "styled-components": "^6.1.11", - "yaml": "^2.4.5", - "date-fns": "^2.30.0" + "yaml": "^2.4.5" }, "devDependencies": { "@babel/preset-env": "^7.24.7", "@babel/preset-react": "^7.24.7", "@babel/preset-typescript": "^7.24.7", - "@codedazur/tsconfig": "*", + "@codedazur/tsconfig": "^0.0.6", "@storybook/addon-actions": "^7.2.0", "@storybook/addon-essentials": "^7.2.0", "@storybook/addon-interactions": "^7.2.0", "@storybook/addon-links": "^7.2.0", - "@storybook/react": "^7.2.0", "@storybook/react-vite": "^7.2.0", "@storybook/react-webpack5": "^7.2.0", + "@storybook/react": "^7.2.0", "@storybook/testing-library": "^0.2.0", "@types/color": "^3.0.6", "storybook": "^7.2.0", - "vite": "4.5.0" + "vite": "5.3.2" } } diff --git a/apps/storybook/stories/react-date-picker/useDatePicker.stories.tsx b/apps/storybook/stories/react-date-picker/useDatePicker.stories.tsx index 59d9028a..8b2b8732 100644 --- a/apps/storybook/stories/react-date-picker/useDatePicker.stories.tsx +++ b/apps/storybook/stories/react-date-picker/useDatePicker.stories.tsx @@ -14,15 +14,13 @@ import { Separate, SizedBox, } from "@codedazur/react-components"; -import { Meta } from "@storybook/react"; -import docs from "./useDatePicker.docs.mdx"; - +import { Meta, StoryObj } from "@storybook/react"; import { Day } from "date-fns"; import { enGB, enUS, es, nl, ru } from "date-fns/locale"; import { FunctionComponent, useMemo, useRef, useState } from "react"; - import { DebugOverlay } from "../../components/DebugOverlay"; import { Weekdays } from "./components/Weekdays"; +import docs from "./useDatePicker.docs.mdx"; import { UseDatePickerProps, @@ -72,45 +70,44 @@ const weekStartsOnMap: Record = { Saturday: 6, }; -const defaultArgTypes = { - subsequentDates: { - control: { type: "select" }, - options: ["clear", "shift", "keep"], - }, - weekStartsOn: { - control: { type: "select" }, - options: Object.keys(weekStartsOnMap), - mapping: weekStartsOnMap, - }, - minDate: { - control: { type: "date" }, - }, - maxDate: { - control: { type: "date" }, - }, - count: { - control: { type: "number" }, - }, - minDuration: { - control: { type: "number" }, - }, - maxDuration: { - control: { type: "number" }, - }, - locale: { - control: { type: "select" }, - options: Object.keys(localeMap), - mapping: localeMap, - }, -}; - -const meta: Meta = { +const meta: Meta = { title: "React/DatePicker/useDatePicker", parameters: { docs: { page: docs, }, }, + argTypes: { + subsequentDates: { + control: { type: "select" }, + options: ["clear", "shift", "keep"], + }, + weekStartsOn: { + control: { type: "select" }, + options: Object.keys(weekStartsOnMap), + mapping: weekStartsOnMap, + }, + minDate: { + control: { type: "date" }, + }, + maxDate: { + control: { type: "date" }, + }, + count: { + control: { type: "number" }, + }, + minDuration: { + control: { type: "number" }, + }, + maxDuration: { + control: { type: "number" }, + }, + locale: { + control: { type: "select" }, + options: Object.keys(localeMap), + mapping: localeMap, + }, + }, args: { count: 2, showExternalDays: true, @@ -123,157 +120,147 @@ const meta: Meta = { export default meta; -export const Default = (args: any) => { - return ; -}; +type Story = StoryObj; -Default.argTypes = defaultArgTypes; +export const Default: Story = {}; -export const WithDurationLimits = (args: any) => { - return ; +export const WithDurationLimits: Story = { + args: { + minDuration: 4, + maxDuration: 7, + }, }; -WithDurationLimits.argTypes = defaultArgTypes; - -export const Localized = (args: any) => { - return ; +export const Localized: Story = { + args: { + locale: es, + }, }; -Localized.argTypes = defaultArgTypes; +export const InPopover: Story = { + render: function InPopover(args) { + const [open, setOpen] = useState(false); + const anchor = useRef(null); -export const InPopover = (args: UseDatePickerProps) => { - const [open, setOpen] = useState(false); - const anchor = useRef(null); - - return ( - <> - - setOpen(false)} - > - - - - - - ); + return ( + <> + + setOpen(false)} + > + + + + + + ); + }, }; -InPopover.argTypes = defaultArgTypes; +export const ForMultipleMonths: Story = { + render: function ForMultipleMonths(args) { + const { cursor, dates, month, getMonth, toNextMonth, toPreviousMonth } = + useDatePicker(args); -export const ForMultipleMonths = (args: Omit) => { - const { cursor, dates, month, getMonth, toNextMonth, toPreviousMonth } = - useDatePicker(args); + const months = useMemo( + () => [getMonth(-1), month, getMonth(1)], + [month, getMonth], + ); - const months = useMemo( - () => [getMonth(-1), month, getMonth(1)], - [month, getMonth], - ); - - return ( - <> - - - - - {months.map((month, index) => ( - - - {month.label} - - - - - ))} - - - - - - - ); -}; -ForMultipleMonths.args = { - showExternalDays: true, + return ( + <> + + + + + {months.map((month, index) => ( + + + {month.label} + + + + + ))} + + + + + + + ); + }, + args: { + showExternalDays: true, + }, }; -ForMultipleMonths.argTypes = defaultArgTypes; -export const WeekendDeals = (args: any) => { - return ( - - cursor === 0 ? ![5, 6].includes(date.getDay()) : false - } - /> - ); +export const WeekendDeals: Story = { + args: { + minDuration: 2, + maxDuration: 3, + isDateDisabled: (date, cursor) => + cursor === 0 ? ![5, 6].includes(date.getDay()) : false, + }, }; -WeekendDeals.argTypes = defaultArgTypes; - -export const ControlledProgression = ( - args: Omit, -) => { - const { cursor, setCursor, dates, month, toPreviousMonth, toNextMonth } = - useDatePicker(args); +export const ControlledProgression: Story = { + render: function ControlledProgression(args) { + const { cursor, setCursor, dates, month, toPreviousMonth, toNextMonth } = + useDatePicker(args); - return ( - <> - - - }> - - - setCursor(0)} - disabled={cursor === 0} - > - - - - - setCursor(1)} - disabled={cursor === 1} - > - - - + return ( + <> + + + }> + + + setCursor(0)} + disabled={cursor === 0} + > + + + + + setCursor(1)} + disabled={cursor === 1} + > + + + + + + setCursor(0)}> + - setCursor(0)}> - - - - - - - - - - - - - - ); -}; -ControlledProgression.argTypes = { - ...defaultArgTypes, - count: { control: { disable: true } }, -}; -ControlledProgression.args = { - autoProgressCursor: false, - subsequentDates: "keep", + + + + + + + + + + + ); + }, + args: { + autoProgressCursor: false, + subsequentDates: "keep", + }, }; diff --git a/apps/storybook/stories/react-essentials/useDelta.stories.tsx b/apps/storybook/stories/react-essentials/useDelta.stories.tsx index 877c47de..48d1cae7 100644 --- a/apps/storybook/stories/react-essentials/useDelta.stories.tsx +++ b/apps/storybook/stories/react-essentials/useDelta.stories.tsx @@ -26,6 +26,7 @@ export const Default: StoryObj = { {[1, 2, 3, 4, 5].map((target) => (