Skip to content

Commit b94718a

Browse files
authored
ci: OPTIC-1873: Update biome to last version (#7290)
Co-authored-by: luarmr <[email protected]>
1 parent 72cd808 commit b94718a

File tree

25 files changed

+90
-81
lines changed

25 files changed

+90
-81
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
hooks:
1616
- id: biome-check
1717
args: [ --config-path, ./web ]
18-
additional_dependencies: [ "@biomejs/biome@1.7.1" ]
18+
additional_dependencies: [ "@biomejs/biome@1.9.4" ]
1919
files: ^web/.*
2020
- repo: local
2121
hooks:

.pre-commit-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
hooks:
1515
- id: biome-check
1616
args: [ --config-path, ./web ]
17-
additional_dependencies: [ "@biomejs/biome@1.7.1" ]
17+
additional_dependencies: [ "@biomejs/biome@1.9.4" ]
1818
files: ^web/.*
1919
- repo: local
2020
hooks:

web/apps/labelstudio/src/components/Modal/ModalPopup.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class Modal extends React.Component {
2424
title: props.title,
2525
body: props.body,
2626
footer: props.footer,
27-
visible: props.animateAppearance ? false : props.visible ?? false,
27+
visible: props.animateAppearance ? false : (props.visible ?? false),
2828
transition: props.visible ? "visible" : null,
2929
};
3030
}

web/biome.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
33
"organizeImports": {
44
"enabled": false
55
},
@@ -25,13 +25,22 @@
2525
"indentWidth": 2,
2626
"lineWidth": 120
2727
},
28+
"css": {
29+
"linter": {
30+
"enabled": false
31+
},
32+
"formatter": {
33+
"enabled": false
34+
}
35+
},
2836
"linter": {
2937
"enabled": true,
3038
"rules": {
3139
"recommended": true,
3240
"a11y": {
3341
"noAutofocus": "off",
34-
"useKeyWithClickEvents": "off"
42+
"useKeyWithClickEvents": "off",
43+
"noLabelWithoutControl": "off"
3544
},
3645
"suspicious": {
3746
"noExplicitAny": "off",

web/libs/core/src/lib/hooks/usePersistentState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const usePersistentState = <T>(key: string, defaultValue: T, options: Opt
2525
const localStorageValue = localStorage.getItem(key);
2626

2727
return typeof localStorageValue === "string"
28-
? decoder?.(localStorageValue, defaultValue) ?? (localStorageValue as T)
28+
? (decoder?.(localStorageValue, defaultValue) ?? (localStorageValue as T))
2929
: defaultValue;
3030
}, []);
3131
const [value, setValue] = useState<T>(initialState);

web/libs/datamanager/src/components/Common/Button/Button.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "./Button.scss";
55

66
export const Button = forwardRef(
77
({ children, type, extra, className, href, size, waiting, icon, tag, look, ...rest }, ref) => {
8-
const finalTag = tag ?? href ? "a" : "button";
8+
const finalTag = (tag ?? href) ? "a" : "button";
99

1010
const mods = {
1111
size,
@@ -51,7 +51,7 @@ export const Button = forwardRef(
5151
{children}
5252
</Elem>
5353
) : (
54-
children ?? null
54+
(children ?? null)
5555
)}
5656
{isDefined(extra) ? <Elem name="extra">{extra}</Elem> : null}
5757
</>

web/libs/datamanager/src/components/Common/Modal/ModalPopup.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Modal extends React.Component {
2020
title: props.title,
2121
body: props.body,
2222
footer: props.footer,
23-
visible: props.animateAppearance ? false : props.visible ?? false,
23+
visible: props.animateAppearance ? false : (props.visible ?? false),
2424
transition: props.visible ? "visible" : null,
2525
};
2626
}

web/libs/datamanager/src/components/Filters/types/List.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const VariantSelect = observer(({ filter, schema, onChange, multiple, val
1010
if (!multiple) {
1111
return Array.isArray(value) ? value[0] : value;
1212
}
13-
return Array.isArray(value) ? value : value ?? [];
13+
return Array.isArray(value) ? value : (value ?? []);
1414
})();
1515

1616
const FilterItem = filter.cellView?.FilterItem;

web/libs/editor/src/common/Modal/ModalPopup.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class Modal extends Component {
1818
title: props.title,
1919
body: props.body,
2020
footer: props.footer,
21-
visible: props.animateAppearance ? false : props.visible ?? false,
21+
visible: props.animateAppearance ? false : (props.visible ?? false),
2222
transition: props.visible ? "visible" : null,
2323
};
2424
}

web/libs/editor/src/components/AnnotationTabs/AnnotationTabs.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const EntityTab = observer(
3030
tag={Userpic}
3131
showUsername
3232
username={prediction ? entity.createdBy : null}
33-
user={infoIsHidden ? {} : entity.user ?? { email: entity.createdBy }}
33+
user={infoIsHidden ? {} : (entity.user ?? { email: entity.createdBy })}
3434
mod={{ prediction }}
3535
>
3636
{prediction && <IconSparks style={{ width: 16, height: 16 }} />}

web/libs/editor/src/components/SidePanels/PanelBase.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ export const PanelBase: FC<PanelBaseProps> = ({
124124
const style = useMemo(() => {
125125
const dynamicStyle = visible
126126
? {
127-
height: detached ? height ?? "100%" : "100%",
128-
width: expanded ? "100%" : width ?? DEFAULT_PANEL_WIDTH,
127+
height: detached ? (height ?? "100%") : "100%",
128+
width: expanded ? "100%" : (width ?? DEFAULT_PANEL_WIDTH),
129129
}
130130
: {
131-
width: detached ? width ?? DEFAULT_PANEL_WIDTH : "100%",
131+
width: detached ? (width ?? DEFAULT_PANEL_WIDTH) : "100%",
132132
height: detached ? PANEL_HEADER_HEIGHT_PADDED : undefined, // header height + 1px margin top and bottom,
133133
};
134134

@@ -152,7 +152,7 @@ export const PanelBase: FC<PanelBaseProps> = ({
152152
detached: locked ? false : detached,
153153
resizing: isDefined(resizing),
154154
hidden: !visible,
155-
alignment: detached ? "left" : alignment ?? "left",
155+
alignment: detached ? "left" : (alignment ?? "left"),
156156
disabled: locked,
157157
};
158158
}, [alignment, visible, detached, resizing, locked]);

web/libs/editor/src/components/SidePanels/SidePanels.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const SidePanelsComponent: FC<SidePanelsProps> = ({ currentEntity, panelsHidden,
192192
const panel = panelData[name];
193193
const parentWidth = rootRef.current?.clientWidth ?? 0;
194194
const height = panel.detached
195-
? visible ?? panel.visible
195+
? (visible ?? panel.visible)
196196
? panel.height
197197
: PANEL_HEADER_HEIGHT_PADDED
198198
: panel.height;

web/libs/editor/src/components/SidePanels/TabPanels/PanelTabsBase.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ export const PanelTabsBase: FC<BaseProps> = ({
8888
const style = useMemo(() => {
8989
const dynamicStyle = visible
9090
? {
91-
height: locked ? DEFAULT_PANEL_HEIGHT : collapsed ? "100%" : height ?? "100%",
92-
width: locked ? "100%" : !collapsed ? width ?? "100%" : PANEL_HEADER_HEIGHT,
91+
height: locked ? DEFAULT_PANEL_HEIGHT : collapsed ? "100%" : (height ?? "100%"),
92+
width: locked ? "100%" : !collapsed ? (width ?? "100%") : PANEL_HEADER_HEIGHT,
9393
}
9494
: {
95-
width: collapsed ? "100%" : width ?? DEFAULT_PANEL_WIDTH,
95+
width: collapsed ? "100%" : (width ?? DEFAULT_PANEL_WIDTH),
9696
height: collapsed ? "100%" : PANEL_HEADER_HEIGHT,
9797
};
9898

@@ -115,7 +115,7 @@ export const PanelTabsBase: FC<BaseProps> = ({
115115
return {
116116
detached: locked ? false : detached,
117117
hidden: !visible,
118-
alignment: detached ? "left" : alignment ?? "left",
118+
alignment: detached ? "left" : (alignment ?? "left"),
119119
disabled: locked,
120120
collapsed,
121121
dragTop: dragTop && attachedKeys && attachedKeys[0] === key,

web/libs/editor/src/components/SidePanels/TabPanels/SideTabsPanels.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const SideTabsPanelsComponent: FC<SidePanelsProps> = ({
215215
(key: string, top: number, left: number, visible?: boolean) => {
216216
const panel = panelData[key];
217217
const parentWidth = rootRef.current?.clientWidth ?? 0;
218-
const visibleHeight = visible ?? panel.visible ? panel.height : PANEL_HEADER_HEIGHT;
218+
const visibleHeight = (visible ?? panel.visible) ? panel.height : PANEL_HEADER_HEIGHT;
219219
const detachedHeight = panel.detached ? visibleHeight : panel.height;
220220
const adjustedHeight =
221221
panel.height === rootRef.current?.clientHeight || !panel.detached ? DEFAULT_PANEL_HEIGHT : detachedHeight;

web/libs/editor/src/core/Hotkey.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export const Hotkey = (namespace = "global", description = "Hotkeys") => {
275275
const hotkey = Hotkey.keymap[name];
276276

277277
if (isDefined(hotkey)) {
278-
const shortcut = isMacOS() ? hotkey.mac ?? hotkey.key : hotkey.key;
278+
const shortcut = isMacOS() ? (hotkey.mac ?? hotkey.key) : hotkey.key;
279279

280280
this.addKey(shortcut, func, hotkey.description, scope);
281281

@@ -294,7 +294,7 @@ export const Hotkey = (namespace = "global", description = "Hotkeys") => {
294294
const hotkey = Hotkey.keymap[name];
295295

296296
if (isDefined(hotkey)) {
297-
const shortcut = isMacOS() ? hotkey.mac ?? hotkey.key : hotkey.key;
297+
const shortcut = isMacOS() ? (hotkey.mac ?? hotkey.key) : hotkey.key;
298298

299299
this.removeKey(shortcut, scope);
300300

@@ -316,7 +316,7 @@ export const Hotkey = (namespace = "global", description = "Hotkeys") => {
316316
const hotkey = Hotkey.keymap[name];
317317

318318
if (isDefined(hotkey)) {
319-
const shortcut = isMacOS() ? hotkey.mac ?? hotkey.key : hotkey.key;
319+
const shortcut = isMacOS() ? (hotkey.mac ?? hotkey.key) : hotkey.key;
320320

321321
this.overwriteKey(shortcut, func, hotkey.description, scope);
322322

@@ -426,7 +426,7 @@ Hotkey.Tooltip = inject("store")(
426426
const enabled = store.settings.enableTooltips && store.settings.enableHotkeys;
427427

428428
if (isDefined(hotkey)) {
429-
const shortcut = isMacOS() ? hotkey.mac ?? hotkey.key : hotkey.key;
429+
const shortcut = isMacOS() ? (hotkey.mac ?? hotkey.key) : hotkey.key;
430430

431431
const description = props.title ?? hotkey.description;
432432
const hotkeys: JSX.Element[] = [];
@@ -482,7 +482,7 @@ Hotkey.Hint = inject("store")(
482482
const enabled = store.settings.enableTooltips && store.settings.enableHotkeys;
483483

484484
if (isDefined(hotkey) && enabled) {
485-
const shortcut = isMacOS() ? hotkey.mac ?? hotkey.key : hotkey.key;
485+
const shortcut = isMacOS() ? (hotkey.mac ?? hotkey.key) : hotkey.key;
486486

487487
return createElement(Hint, {}, [shortcut]);
488488
}

web/libs/editor/src/core/Tree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function tagIntoObject(node: Element, taskData: Record<string, any>, replaces?:
5858
const props = attrsToProps(node, replaces);
5959
const type = node.tagName.toLowerCase();
6060
const indexFlag = props.indexflag ?? "{{idx}}";
61-
const id = isFF(FF_DEV_3391) ? node.getAttribute("name") ?? guidGenerator() : guidGenerator();
61+
const id = isFF(FF_DEV_3391) ? (node.getAttribute("name") ?? guidGenerator()) : guidGenerator();
6262
const data: ConfigNode = {
6363
...props,
6464
id,

web/libs/editor/src/hooks/useLocalStorageState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type StateResult<T> = [T, (value: T) => void];
1414
export const useLocalStorageState = <T>(keyName: string, defaultValue: T, options: Options<T> = {}): StateResult<T> => {
1515
const localStorageState = localStorage.getItem(keyName);
1616
const defaultState = localStorageState
17-
? options.fromString?.(localStorageState) ?? (localStorageState as unknown as T)
17+
? (options.fromString?.(localStorageState) ?? (localStorageState as unknown as T))
1818
: defaultValue;
1919

2020
const [state, setState] = useState<T>(defaultState);

web/libs/editor/src/lib/AudioUltra/Timeline/Timeline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class Timeline {
5353
this.fontSize = options?.fontSize ?? this.fontSize;
5454
this.fontFamily = options?.fontFamily ?? this.fontFamily;
5555
this.height =
56-
options?.height ?? defaults.timelinePlacement ? options?.height ?? defaults.timelineHeight : this.height;
56+
(options?.height ?? defaults.timelinePlacement) ? (options?.height ?? defaults.timelineHeight) : this.height;
5757
this.initHeight = this.height;
5858
this.gridWidth = options?.gridWidth ?? this.gridWidth;
5959
this.fontColor = options?.fontColor ? rgba(options?.fontColor) : this.fontColor;

web/libs/editor/src/lib/AudioUltra/Visual/Visualizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ export class Visualizer extends Events<VisualizerEvents> {
589589
const waveformHeight =
590590
Math.max(
591591
this.originalWaveHeight,
592-
this.waveHeight * (this.splitChannels ? this.audio?.channelCount ?? 1 : 1) + this.timelineHeight,
592+
this.waveHeight * (this.splitChannels ? (this.audio?.channelCount ?? 1) : 1) + this.timelineHeight,
593593
) - this.timelineHeight;
594594

595595
if (this.baseWaveHeight !== waveformHeight) {

web/libs/editor/src/lib/AudioUltra/Waveform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export class Waveform extends Events<WaveformEventTypes> {
214214
params.decoderType = params.decoderType ?? "webaudio";
215215
// Need to restrict ffmpeg to html5 player as it doesn't support webaudio
216216
// because of chunked decoding raw Float32Arrays and no AudioBuffer support
217-
params.playerType = params.decoderType === "ffmpeg" ? "html5" : params.playerType ?? "html5";
217+
params.playerType = params.decoderType === "ffmpeg" ? "html5" : (params.playerType ?? "html5");
218218

219219
this.src = params.src;
220220
this.params = params;

web/libs/editor/src/regions/KeyPointRegion.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const HtxKeyPointView = ({ item, setShapeRef }) => {
196196
includeFill: true,
197197
defaultFillColor: "#000",
198198
defaultStrokeColor: "#fff",
199-
defaultOpacity: item.style ?? item.tag ? 0.6 : 1,
199+
defaultOpacity: (item.style ?? item.tag) ? 0.6 : 1,
200200
// avoid size glitching when user select/unselect region
201201
sameStrokeWidthForSelected: true,
202202
});

web/libs/editor/src/stores/RegionStore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export default types
292292

293293
lookup.forEach((el) => {
294294
const pid = el.item.parentID;
295-
const parent = pid ? lookup.get(pid) ?? lookup.get(pid.replace(/#(.+)/i, "")) : null;
295+
const parent = pid ? (lookup.get(pid) ?? lookup.get(pid.replace(/#(.+)/i, ""))) : null;
296296

297297
if (parent) return parent.children.push(el);
298298

web/libs/editor/src/tags/object/Paragraphs/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ const PlayableAndSyncable = types
221221
if (value.start === undefined) return {};
222222

223223
const start = clamp(value.start ?? 0, 0, self.audioDuration);
224-
const _end = value.duration ? start + value.duration : value.end ?? self.audioDuration;
224+
const _end = value.duration ? start + value.duration : (value.end ?? self.audioDuration);
225225
const end = clamp(_end, start, self.audioDuration);
226226

227227
return { start, end };

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"@babel/preset-react": "^7.14.5",
121121
"@babel/preset-typescript": "^7.13.0",
122122
"@babel/runtime": "^7.26.10",
123-
"@biomejs/biome": "1.7.1",
123+
"@biomejs/biome": "1.9.4",
124124
"@chromatic-com/storybook": "^3",
125125
"@cypress/code-coverage": "^3.12.9",
126126
"@cypress/webpack-preprocessor": "^5.17.0",

0 commit comments

Comments
 (0)