Skip to content

Commit

Permalink
refactor(types): remove unnecessary types
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianArenal committed Nov 25, 2024
1 parent 698474e commit c330593
Show file tree
Hide file tree
Showing 26 changed files with 27 additions and 28 deletions.
4 changes: 1 addition & 3 deletions packages/x-components/src/tailwind/plugin-options.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { PluginOptions } from '@empathyco/x-tailwindcss';

export default {} as PluginOptions;
export default {};
2 changes: 1 addition & 1 deletion packages/x-tailwindcss/src/x-tailwind-plugin/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export default function components(helpers: TailwindHelpers): CSSRuleObject {
...facetFilter(helpers),
...progressBar(helpers),
...attach(helpers)
};
} as unknown as CSSRuleObject;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion packages/x-tailwindcss/src/x-tailwind-plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
};
Expand Down
2 changes: 1 addition & 1 deletion packages/x-tailwindcss/src/x-tailwind-plugin/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function mapColors<T extends CssStyleOptions>(
mapperFn: (color: ThemeColor, colorName: string) => T,
{ theme }: TailwindHelpers
) {
const colors: ThemeColors = theme('x.colors');
const colors: Omit<ThemeColors, 'transparent' | 'current'> = theme('x.colors');
return reduce(
colors,
(mappedColors, colorName, color) => {
Expand Down

0 comments on commit c330593

Please sign in to comment.