Skip to content

Commit a519767

Browse files
committed
chore: lint
1 parent 05af3b1 commit a519767

File tree

2 files changed

+42
-41
lines changed

2 files changed

+42
-41
lines changed

src/tasty/injector/injector.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class StyleInjector {
8686
if (rules.length === 0) {
8787
return {
8888
className: '',
89-
dispose: () => { },
89+
dispose: () => {},
9090
};
9191
}
9292

@@ -223,36 +223,36 @@ export class StyleInjector {
223223
const rulesToInsert =
224224
generatedClass && generatedClass !== className
225225
? rules.map((r) => {
226-
if (r.selector.startsWith('.' + generatedClass)) {
227-
const newSelector =
228-
'.' + className + r.selector.slice(generatedClass.length + 1);
229-
// Increase specificity by duplicating the class for class-based selectors
230-
const specificSelector =
231-
newSelector.startsWith('.' + className) &&
226+
if (r.selector.startsWith('.' + generatedClass)) {
227+
const newSelector =
228+
'.' + className + r.selector.slice(generatedClass.length + 1);
229+
// Increase specificity by duplicating the class for class-based selectors
230+
const specificSelector =
231+
newSelector.startsWith('.' + className) &&
232232
/^\.t\d+/.test(newSelector)
233-
? '.' + className + newSelector
234-
: newSelector;
235-
return {
236-
...r,
237-
selector: specificSelector,
238-
} as StyleRule;
239-
}
240-
return r;
241-
})
242-
: rules.map((r) => {
243-
// Increase specificity for class-based selectors by duplicating the class
244-
if (r.selector.startsWith('.') && /^\.t\d+/.test(r.selector)) {
245-
const classMatch = r.selector.match(/^\.t\d+/);
246-
if (classMatch) {
247-
const baseClass = classMatch[0];
233+
? '.' + className + newSelector
234+
: newSelector;
248235
return {
249236
...r,
250-
selector: baseClass + r.selector,
237+
selector: specificSelector,
251238
} as StyleRule;
252239
}
253-
}
254-
return r;
255-
});
240+
return r;
241+
})
242+
: rules.map((r) => {
243+
// Increase specificity for class-based selectors by duplicating the class
244+
if (r.selector.startsWith('.') && /^\.t\d+/.test(r.selector)) {
245+
const classMatch = r.selector.match(/^\.t\d+/);
246+
if (classMatch) {
247+
const baseClass = classMatch[0];
248+
return {
249+
...r,
250+
selector: baseClass + r.selector,
251+
} as StyleRule;
252+
}
253+
}
254+
return r;
255+
});
256256

257257
// Before inserting, auto-register @property for any color custom properties being defined.
258258
// Fast parse: split declarations by ';' and match "--*-color:"
@@ -295,7 +295,7 @@ export class StyleInjector {
295295

296296
return {
297297
className,
298-
dispose: () => { },
298+
dispose: () => {},
299299
};
300300
}
301301

@@ -328,7 +328,7 @@ export class StyleInjector {
328328
const registry = this.sheetManager.getRegistry(root);
329329

330330
if (!rules || rules.length === 0) {
331-
return { dispose: () => { } };
331+
return { dispose: () => {} };
332332
}
333333

334334
// Use a non-tasty identifier to avoid any collisions with .t{number} classes
@@ -546,7 +546,7 @@ export class StyleInjector {
546546
if (Object.keys(steps).length === 0) {
547547
return {
548548
toString: () => '',
549-
dispose: () => { },
549+
dispose: () => {},
550550
};
551551
}
552552

@@ -573,7 +573,7 @@ export class StyleInjector {
573573
if (!info) {
574574
return {
575575
toString: () => '',
576-
dispose: () => { },
576+
dispose: () => {},
577577
};
578578
}
579579

src/tasty/tasty.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ type TastyComponentPropsWithDefaults<
8888
> = keyof DefaultProps extends never
8989
? Props
9090
: {
91-
[key in Extract<keyof Props, keyof DefaultProps>]?: Props[key];
92-
} & {
93-
[key in keyof Omit<Props, keyof DefaultProps>]: Props[key];
94-
};
91+
[key in Extract<keyof Props, keyof DefaultProps>]?: Props[key];
92+
} & {
93+
[key in keyof Omit<Props, keyof DefaultProps>]: Props[key];
94+
};
9595

9696
export function tasty<K extends StyleList, V extends VariantMap>(
9797
options: TastyProps<K, V>,
@@ -322,7 +322,7 @@ function tastyElement<K extends StyleList, V extends VariantMap>(
322322
className: userClassName,
323323
...otherProps
324324
} = allProps as Record<string, unknown> as AllBasePropsWithMods<K> &
325-
WithVariant<V> & { className?: string };
325+
WithVariant<V> & { className?: string };
326326

327327
let propStyles: Styles | null = (
328328
(styleProps
@@ -363,10 +363,10 @@ function tastyElement<K extends StyleList, V extends VariantMap>(
363363
useDefaultStyles
364364
? defaultStyles
365365
: mergeStyles(
366-
defaultStyles,
367-
styles as Styles,
368-
propStyles as Styles,
369-
),
366+
defaultStyles,
367+
styles as Styles,
368+
propStyles as Styles,
369+
),
370370
[styleCacheKey],
371371
);
372372

@@ -456,8 +456,9 @@ function tastyElement<K extends StyleList, V extends VariantMap>(
456456
});
457457
}
458458

459-
_TastyComponent.displayName = `TastyComponent(${(defaultProps as any).qa || originalAs
460-
})`;
459+
_TastyComponent.displayName = `TastyComponent(${
460+
(defaultProps as any).qa || originalAs
461+
})`;
461462

462463
return _TastyComponent;
463464
}

0 commit comments

Comments
 (0)