From c3305935b987661383089a76bdf173e199d81067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Arenal?= Date: Mon, 25 Nov 2024 13:19:17 +0100 Subject: [PATCH] refactor(types): remove unnecessary types --- packages/x-components/src/tailwind/plugin-options.ts | 4 +--- packages/x-tailwindcss/src/x-tailwind-plugin/components.ts | 2 +- .../src/x-tailwind-plugin/components/attach/index.ts | 2 +- .../src/x-tailwind-plugin/components/badge/index.ts | 2 +- .../src/x-tailwind-plugin/components/button-group/default.ts | 2 +- .../src/x-tailwind-plugin/components/button-group/index.ts | 2 +- .../src/x-tailwind-plugin/components/button/index.ts | 2 +- .../src/x-tailwind-plugin/components/facet-filter/index.ts | 2 +- .../src/x-tailwind-plugin/components/highlight/index.ts | 2 +- .../src/x-tailwind-plugin/components/icon/index.ts | 2 +- .../src/x-tailwind-plugin/components/input-group/index.ts | 2 +- .../src/x-tailwind-plugin/components/input/index.ts | 2 +- .../src/x-tailwind-plugin/components/layout/index.ts | 2 +- .../src/x-tailwind-plugin/components/picture/index.ts | 2 +- .../src/x-tailwind-plugin/components/progress-bar/index.ts | 2 +- .../src/x-tailwind-plugin/components/scroll/index.ts | 2 +- .../src/x-tailwind-plugin/components/sliding-panel/index.ts | 2 +- .../components/suggestion-group/button/index.ts | 2 +- .../x-tailwind-plugin/components/suggestion-group/index.ts | 2 +- .../src/x-tailwind-plugin/components/suggestion/index.ts | 2 +- .../src/x-tailwind-plugin/components/tag/index.ts | 2 +- .../src/x-tailwind-plugin/components/typography/index.ts | 2 +- .../src/x-tailwind-plugin/components/variables/index.ts | 2 +- packages/x-tailwindcss/src/x-tailwind-plugin/plugin.ts | 3 ++- packages/x-tailwindcss/src/x-tailwind-plugin/utilities.ts | 2 +- .../x-tailwindcss/src/x-tailwind-plugin/utils/map-colors.ts | 2 +- 26 files changed, 27 insertions(+), 28 deletions(-) diff --git a/packages/x-components/src/tailwind/plugin-options.ts b/packages/x-components/src/tailwind/plugin-options.ts index 0460bf7b3c..ff8b4c5632 100644 --- a/packages/x-components/src/tailwind/plugin-options.ts +++ b/packages/x-components/src/tailwind/plugin-options.ts @@ -1,3 +1 @@ -import { PluginOptions } from '@empathyco/x-tailwindcss'; - -export default {} as PluginOptions; +export default {}; diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components.ts index f327641cb2..218de9a2d7 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components.ts @@ -52,5 +52,5 @@ export default function components(helpers: TailwindHelpers): CSSRuleObject { ...facetFilter(helpers), ...progressBar(helpers), ...attach(helpers) - }; + } as unknown as CSSRuleObject; } diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/attach/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/attach/index.ts index e57fc9bd9b..4628af7a4d 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/attach/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/attach/index.ts @@ -8,7 +8,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @returns The {@link CssStyleOptions} for the component. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars -export function attach(helpers: TailwindHelpers): CSSRuleObject { +export function attach(helpers: TailwindHelpers) { return { '.x-attach-container': { position: 'relative' diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/badge/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/badge/index.ts index 281c6fa0c3..5027c61650 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/badge/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/badge/index.ts @@ -15,7 +15,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function badge(helpers: TailwindHelpers): CSSRuleObject { +export function badge(helpers: TailwindHelpers) { return { '.x-badge': { ...badgeDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/default.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/default.ts index 034dde0191..5e1d94e57a 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/default.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/default.ts @@ -7,7 +7,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function buttonGroupDefault(helpers: TailwindHelpers): CSSRuleObject { +export function buttonGroupDefault(helpers: TailwindHelpers) { const { theme } = helpers; return { diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/index.ts index 07b5d3aa6e..b1266e27d9 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/button-group/index.ts @@ -10,7 +10,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function buttonGroup(helpers: TailwindHelpers): CSSRuleObject { +export function buttonGroup(helpers: TailwindHelpers) { return { '.x-button-group': { ...buttonGroupDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/button/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/button/index.ts index 4cf5884605..c04c401437 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/button/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/button/index.ts @@ -18,7 +18,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function button(helpers: TailwindHelpers): CSSRuleObject { +export function button(helpers: TailwindHelpers) { return { '.x-button': deepMerge( buttonDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/facet-filter/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/facet-filter/index.ts index 5aa6a433f3..35acc68003 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/facet-filter/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/facet-filter/index.ts @@ -15,7 +15,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function facetFilter(helpers: TailwindHelpers): CSSRuleObject { +export function facetFilter(helpers: TailwindHelpers) { return { '.x-facet-filter': deepMerge( facetFilterDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/highlight/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/highlight/index.ts index 794777bb20..1133fd3425 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/highlight/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/highlight/index.ts @@ -10,7 +10,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @returns The {@link CssStyleOptions} for the component. */ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function highlight(helpers: TailwindHelpers): CSSRuleObject { +export function highlight(helpers: TailwindHelpers) { return { '.x-highlight-text': { ...highlightDefault(helpers) diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/icon/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/icon/index.ts index 4f3b9da12d..b0dddb6422 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/icon/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/icon/index.ts @@ -14,7 +14,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function icon(helpers: TailwindHelpers): CSSRuleObject { +export function icon(helpers: TailwindHelpers) { return { '.x-icon': Object.assign( iconDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/input-group/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/input-group/index.ts index 61640542c8..3278301257 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/input-group/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/input-group/index.ts @@ -14,7 +14,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function inputGroup(helpers: TailwindHelpers): CSSRuleObject { +export function inputGroup(helpers: TailwindHelpers) { return { '.x-input-group': deepMerge( inputGroupDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/input/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/input/index.ts index cfcb5929a0..eb1b6d4947 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/input/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/input/index.ts @@ -13,7 +13,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function input(helpers: TailwindHelpers): CSSRuleObject { +export function input(helpers: TailwindHelpers) { return { '.x-input': deepMerge( inputDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/layout/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/layout/index.ts index 59912d01de..9242f81ae1 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/layout/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/layout/index.ts @@ -14,7 +14,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function layout(helpers: TailwindHelpers): CSSRuleObject { +export function layout(helpers: TailwindHelpers) { return { '.x-layout': rename( { diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/picture/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/picture/index.ts index a4a05abe2d..a777b461b9 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/picture/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/picture/index.ts @@ -11,7 +11,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function picture(helpers: TailwindHelpers): CSSRuleObject { +export function picture(helpers: TailwindHelpers) { return { '.x-picture': { ...pictureDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/progress-bar/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/progress-bar/index.ts index 115869ae07..29191993f5 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/progress-bar/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/progress-bar/index.ts @@ -12,7 +12,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function progressBar(helpers: TailwindHelpers): CSSRuleObject { +export function progressBar(helpers: TailwindHelpers) { return { '.x-progress-bar': deepMerge( progressBarDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/scroll/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/scroll/index.ts index c76a8d9d12..22d963930d 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/scroll/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/scroll/index.ts @@ -7,7 +7,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function scroll(helpers: TailwindHelpers): CSSRuleObject { +export function scroll(helpers: TailwindHelpers) { return { '.x-scroll': { ...scrollDefault(helpers) diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/sliding-panel/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/sliding-panel/index.ts index b1eede3532..408a035018 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/sliding-panel/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/sliding-panel/index.ts @@ -10,7 +10,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function slidingPanel(helpers: TailwindHelpers): CSSRuleObject { +export function slidingPanel(helpers: TailwindHelpers) { return { '.x-sliding-panel': { ...deepMerge(slidingPanelDefault(), slidingPanelFade(helpers)) diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/button/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/button/index.ts index 937763988e..bd8bea1294 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/button/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/button/index.ts @@ -13,7 +13,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function suggestionGroupButton(helpers: TailwindHelpers): CSSRuleObject { +export function suggestionGroupButton(helpers: TailwindHelpers) { return { '.x-suggestion-group-button': { ...suggestionGroupButtonDefault(), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/index.ts index 66b5ebace8..b915233a6d 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion-group/index.ts @@ -13,7 +13,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function suggestionGroup(helpers: TailwindHelpers): CSSRuleObject { +export function suggestionGroup(helpers: TailwindHelpers) { return { '.x-suggestion-group': { ...suggestionGroupDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion/index.ts index 4dc850c6cb..c28ab88cd1 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/suggestion/index.ts @@ -13,7 +13,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function suggestion(helpers: TailwindHelpers): CSSRuleObject { +export function suggestion(helpers: TailwindHelpers) { return { '.x-suggestion': { ...suggestionDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/tag/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/tag/index.ts index 91b879d8b8..91d008aaf6 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/tag/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/tag/index.ts @@ -15,7 +15,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @param helpers - The {@link TailwindHelpers} to generate CSS. * @returns The {@link CssStyleOptions} for the component. */ -export function tag(helpers: TailwindHelpers): CSSRuleObject { +export function tag(helpers: TailwindHelpers) { return { '.x-tag': { ...tagDefault(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/typography/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/typography/index.ts index f0c9abd499..b29892aca8 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/typography/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/typography/index.ts @@ -14,7 +14,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * @returns The {@link CssStyleOptions} for the component. */ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function typography(helpers: TailwindHelpers): CSSRuleObject { +export function typography(helpers: TailwindHelpers) { return { ...text1(helpers), ...text2(helpers), diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/components/variables/index.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/components/variables/index.ts index 338d2d0b3f..4866db73b7 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/components/variables/index.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/components/variables/index.ts @@ -23,7 +23,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; */ // eslint-disable-next-line max-len // eslint-disable-next-line @typescript-eslint/explicit-function-return-type,@typescript-eslint/no-unused-vars -export function variables(helpers: TailwindHelpers): CSSRuleObject { +export function variables(helpers: TailwindHelpers) { return { ':root': { '--ON': 'initial', diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/plugin.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/plugin.ts index f2fa0fd818..ca9ab1ef65 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/plugin.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/plugin.ts @@ -6,6 +6,7 @@ import dynamicComponents from './dynamic-components'; import dynamicUtilities from './dynamic-utilities'; import xTheme from './theme'; import utilities from './utilities'; +import { CSSRuleObject } from 'tailwindcss/types/config'; /** * Defines the x-tailwind plugin as a Tailwind {@link plugin} that can be invoked passing a @@ -39,7 +40,7 @@ export default plugin.withOptions( ); }); /* Add utilities */ - helpers.addUtilities(utilities(helpers), { respectPrefix: false }); + helpers.addUtilities(utilities(helpers) as CSSRuleObject, { respectPrefix: false }); /* Add variant to selected */ helpers.addVariant('selected', '&.selected'); }; diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/utilities.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/utilities.ts index 450fc0bf0f..e1bd99e77b 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/utilities.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/utilities.ts @@ -9,7 +9,7 @@ import { CSSRuleObject } from 'tailwindcss/types/config'; * * @public */ -export default function utilities({ theme }: TailwindHelpers): CSSRuleObject { +export default function utilities({ theme }: TailwindHelpers) { return { // TODO: replace this example styles with actual design styles '.x-border-large': { diff --git a/packages/x-tailwindcss/src/x-tailwind-plugin/utils/map-colors.ts b/packages/x-tailwindcss/src/x-tailwind-plugin/utils/map-colors.ts index 3cb1c868cb..d7b0349d14 100644 --- a/packages/x-tailwindcss/src/x-tailwind-plugin/utils/map-colors.ts +++ b/packages/x-tailwindcss/src/x-tailwind-plugin/utils/map-colors.ts @@ -49,7 +49,7 @@ export function mapColors( mapperFn: (color: ThemeColor, colorName: string) => T, { theme }: TailwindHelpers ) { - const colors: ThemeColors = theme('x.colors'); + const colors: Omit = theme('x.colors'); return reduce( colors, (mappedColors, colorName, color) => {