Skip to content

Commit 6e904c4

Browse files
committed
fix deep source issues
1 parent 1545d2a commit 6e904c4

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

lib/src/client/switch/switch.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface SwitchProps extends HTMLProps<HTMLElement> {
2424
*/
2525
export const Switch = ({ tag: Tag = "button", size = 24, skipSystem, ...props }: SwitchProps) => {
2626
const [state, setState] = useStore();
27+
/** toggle mode */
2728
const handleModeSwitch = () => {
2829
let index = modes.indexOf(state.m);
2930
if (skipSystem && index === modes.length - 1) index = 0;
@@ -40,6 +41,7 @@ export const Switch = ({ tag: Tag = "button", size = 24, skipSystem, ...props }:
4041
// @ts-expect-error -> we are setting the CSS variable
4142
style={{ "--size": `${size}px` }}
4243
data-testid="switch"
44+
// skipcq: JS-0417 -> tradeoff between size and best practices
4345
onClick={handleModeSwitch}
4446
/>
4547
);

lib/src/hooks/use-mode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface UseModeYeild {
2020
*/
2121
export const useMode = (): UseModeYeild => {
2222
const [{ m: mode, s: systemMode }, setState] = useStore();
23+
/** Set user preference */
2324
const setMode = (m: ColorSchemePreference) => {
2425
setState(prev => ({ ...prev, m }));
2526
};

lib/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ const DEFAULT_STORE_VAL: Store = {
1313
s: DARK as ResolvedScheme,
1414
};
1515

16+
/** local abstaction of RGS to avoid multiple imports */
1617
export const useStore = () => useRGS<Store>("ndm", DEFAULT_STORE_VAL);

scripts/publish.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ try {
1717
}
1818

1919
const { version: VERSION, name } = require("../lib/package.json");
20-
let LATEST_VERSION;
20+
let LATEST_VERSION = "0.0.-1";
2121

2222
try {
2323
LATEST_VERSION = execSync(`npm view ${name} version`).toString() ?? "0.0.-1";
2424
} catch {
25-
LATEST_VERSION = "0.0.-1";
25+
// empty
2626
}
2727

2828
console.log({ VERSION, LATEST_VERSION });

0 commit comments

Comments
 (0)