Skip to content

Commit e48612f

Browse files
committed
chore: remove all double equals
1 parent bed9283 commit e48612f

File tree

8 files changed

+22
-23
lines changed

8 files changed

+22
-23
lines changed

apps/theme/app/testside/FullBaseTest/FullBaseTest.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ export const FullBaseTest = () => {
104104
let bgDefault = blueColors[99];
105105
let bgSubtle = blueColors[95];
106106

107-
if (theme == 'dark') {
107+
if (theme === 'dark') {
108108
bgDefault = blueColors[9];
109109
bgSubtle = blueColors[13];
110-
} else if (theme == 'contrast') {
110+
} else if (theme === 'contrast') {
111111
bgDefault = blueColors[0];
112112
bgSubtle = blueColors[5];
113113
}

apps/theme/components/ColorPicker/ColorPicker.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export const ColorPicker = ({
5454
className={cl(
5555
classes.status,
5656
'ds-focus',
57-
colorError == 'decorative' && classes.statusYellow,
58-
colorError == 'interaction' && classes.statusOrange,
57+
colorError === 'decorative' && classes.statusYellow,
58+
colorError === 'interaction' && classes.statusOrange,
5959
)}
6060
>
6161
{colorError === 'none' && (
@@ -64,7 +64,7 @@ export const ColorPicker = ({
6464
{colorError === 'decorative' && (
6565
<ExclamationmarkIcon title='Viktig informasjon om fargen' />
6666
)}
67-
{colorError == 'interaction' && (
67+
{colorError === 'interaction' && (
6868
<ExclamationmarkIcon title='Viktig informasjon om fargen' />
6969
)}
7070
</button>
@@ -75,14 +75,14 @@ export const ColorPicker = ({
7575
'Denne fargen har god nok kontrast og kan brukes normalt i systemet.'}
7676
</div>
7777
<div>
78-
{colorError == 'decorative' && (
78+
{colorError === 'decorative' && (
7979
<div>
8080
Vær oppmerksom på at Base Default fargen har mindre enn 3:1
8181
kontrast mot bakgrunnsfargene. Se alle kontrastgrensene inne
8282
på hver farge.
8383
</div>
8484
)}
85-
{colorError == 'interaction' && (
85+
{colorError === 'interaction' && (
8686
<div>
8787
Base Default fargen har ikke god nok kontrast mot hvit eller
8888
svart tekst på tvers av Base fargene.

biome.jsonc

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@
7474
"useSelfClosingElements": "off"
7575
},
7676
"suspicious": {
77-
"noArrayIndexKey": "off",
78-
"noDoubleEquals": "off" // TODO: Enable this rule
77+
"noArrayIndexKey": "off"
7978
},
8079
"performance": {
8180
"noAccumulatingSpread": "off" // TODO: Enable this rule

packages/cli/src/colors/colorUtils.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const hexToCssHsl = (hex: string, valuesOnly = false) => {
2929
let h = 0;
3030
let s = 0;
3131
let l = (max + min) / 2;
32-
if (max == min) {
32+
if (max === min) {
3333
h = s = 0; // achromatic
3434
} else {
3535
const d = max - min;
@@ -68,11 +68,11 @@ export const hexToHSL = (H: string) => {
6868
let r = 0;
6969
let g = 0;
7070
let b = 0;
71-
if (H.length == 4) {
71+
if (H.length === 4) {
7272
r = parseInt('0x' + H[1] + H[1]);
7373
g = parseInt('0x' + H[2] + H[2]);
7474
b = parseInt('0x' + H[3] + H[3]);
75-
} else if (H.length == 7) {
75+
} else if (H.length === 7) {
7676
r = parseInt('0x' + H[1] + H[2]);
7777
g = parseInt('0x' + H[3] + H[4]);
7878
b = parseInt('0x' + H[5] + H[6]);
@@ -88,17 +88,17 @@ export const hexToHSL = (H: string) => {
8888
const cmax = Math.max(r, g, b);
8989
const delta = cmax - cmin;
9090

91-
if (delta == 0) h = 0;
92-
else if (cmax == r) h = ((g - b) / delta) % 6;
93-
else if (cmax == g) h = (b - r) / delta + 2;
91+
if (delta === 0) h = 0;
92+
else if (cmax === r) h = ((g - b) / delta) % 6;
93+
else if (cmax === g) h = (b - r) / delta + 2;
9494
else h = (r - g) / delta + 4;
9595

9696
h = Math.round(h * 60);
9797

9898
if (h < 0) h += 360;
9999

100100
l = (cmax + cmin) / 2;
101-
s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
101+
s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
102102
s = +(s * 100).toFixed(1);
103103
l = +(l * 100).toFixed(1);
104104

@@ -178,9 +178,9 @@ export const HSLToHex = (h: number, s: number, l: number) => {
178178
b = parseInt(Math.round((b + m) * 255).toString(16), 16);
179179

180180
// Prepend 0s, if necessary
181-
if (r.toString().length == 1) r = parseInt('0' + r.toString(), 10);
182-
if (g.toString().length == 1) g = parseInt('0' + g.toString(), 10);
183-
if (b.toString().length == 1) b = parseInt('0' + b.toString(), 10);
181+
if (r.toString().length === 1) r = parseInt('0' + r.toString(), 10);
182+
if (g.toString().length === 1) g = parseInt('0' + g.toString(), 10);
183+
if (b.toString().length === 1) b = parseInt('0' + b.toString(), 10);
184184

185185
return '#' + r + g + b;
186186
};

packages/react/src/components/Tabs/TabContent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type TabContentProps = {
2121
export const TabContent = forwardRef<HTMLDivElement, TabContentProps>(
2222
({ children, value, className, ...rest }, ref) => {
2323
const { value: tabsValue, size } = useContext(TabsContext);
24-
const active = value == tabsValue;
24+
const active = value === tabsValue;
2525

2626
return (
2727
<>

packages/react/src/components/Tabs/useTab.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const useTabItem: UseTab = (props: TabProps) => {
2222
return {
2323
...rest,
2424
id: buttonId,
25-
'aria-selected': tabs.value == value,
25+
'aria-selected': tabs.value === value,
2626
role: 'tab',
2727
size: tabs.size,
2828
onClick: () => {

packages/react/src/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const useToggleGroupItem: UseToggleGroupItem = (
2424
const genValue = useId();
2525
const toggleGroup = useContext(ToggleGroupContext);
2626
const value = props.value ?? genValue;
27-
const active = toggleGroup.value == value;
27+
const active = toggleGroup.value === value;
2828
const buttonId = `togglegroup-item-${useId()}`;
2929

3030
return {

packages/react/src/utilities/RovingFocus/RovingFocusItem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const RovingFocusItem = forwardRef<HTMLElement, RovingFocusItemProps>(
4242
const Component = asChild ? Slot : 'div';
4343

4444
const focusValue =
45-
value ?? (typeof rest.children == 'string' ? rest.children : '');
45+
value ?? (typeof rest.children === 'string' ? rest.children : '');
4646

4747
const { getOrderedItems, getRovingProps, orientation } =
4848
useRovingFocus(focusValue);

0 commit comments

Comments
 (0)