Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: OPTIC-1154: biome linting tweaks #6425

Merged
merged 8 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/app/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* global Sentry */

import { createBrowserHistory } from "history";
import React from "react";
import { render } from "react-dom";
import { Router } from "react-router-dom";
import { LEAVE_BLOCKER_KEY, leaveBlockerCallback } from "../components/LeaveBlocker/LeaveBlocker";
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/app/AsyncPage/AsyncPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useCallback, useContext, useEffect, useState } from "react";
import { createContext, useCallback, useContext, useEffect, useState } from "react";
import { useHistory } from "react-router";
import { ErrorWrapper } from "../../components/Error/Error";
import { modal } from "../../components/Modal/Modal";
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/app/RootPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Menubar } from "../components/Menubar/Menubar";
import { ProjectRoutes } from "../routes/ProjectRoutes";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { NavLink } from "react-router-dom";
import { useConfig } from "../../providers/ConfigProvider";
import { useBreadcrumbs, useFindRouteComponent } from "../../providers/RoutesProvider";
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../utils/bem";
import "./Card.scss";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Children, cloneElement, forwardRef, useCallback } from "react";
import { useCopyText } from "../../hooks/useCopyText";
import { Tooltip } from "../Tooltip/Tooltip";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../utils/bem";
import "./DescriptionList.scss";
import { IconInfoOutline } from "../../assets/icons";
Expand Down
2 changes: 0 additions & 2 deletions web/apps/labelstudio/src/components/Divider/Divider.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

export const Divider = ({ height }) => {
return <div style={{ height: height }} />;
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { cloneElement, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { cloneElement, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import ReactDOM from "react-dom";
import { Block, cn } from "../../utils/bem";
import { alignElements } from "../../utils/dom";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {
import {
Children,
cloneElement,
forwardRef,
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/components/Error/Error.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment, useCallback, useMemo, useState } from "react";
import { Fragment, useCallback, useMemo, useState } from "react";
import sanitizeHtml from "sanitize-html";
import { LsSlack } from "../../assets/icons";
import { Block, Elem } from "../../utils/bem";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../../../utils/bem";
import { FormField } from "../../FormField";
import { default as Label } from "../Label/Label";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createElement } from "react";
import { createElement } from "react";
import { cn } from "../../../../utils/bem";
import "./Label.scss";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useCallback, useContext, useEffect, useState } from "react";
import { createContext, useCallback, useContext, useEffect, useState } from "react";
import { Label } from "..";
import { BemWithSpecifiContext } from "../../../../utils/bem";
import { FormField } from "../../FormField";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { cn } from "../../../../utils/bem";
import { FormField } from "../../FormField";
import { default as Label } from "../Label/Label";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../../../utils/bem";
import { FormField } from "../../FormField";
import { default as Label } from "../Label/Label";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, useEffect, useMemo } from "react";
import { forwardRef, useEffect, useMemo } from "react";
import { cn } from "../../../../utils/bem";
import { FormField } from "../../FormField";
import { useValueTracker } from "../../Utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, useEffect, useMemo } from "react";
import { forwardRef, useEffect, useMemo } from "react";
import { cn } from "../../../../utils/bem";
import { FormField } from "../../FormField";
import { useValueTracker } from "../../Utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../utils/bem";
import "./Hamburger.scss";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type FC, memo, useCallback, useState } from "react";
import type { HeidiTipsProps } from "./types";
import { HeidiTip } from "./HeidiTip";
import { dismissTip, getRandomTip, isTipDismissed } from "./utils";
import { dismissTip, getRandomTip } from "./utils";

export const HeidiTips: FC<HeidiTipsProps> = memo(({ collection }) => {
const [tip, setTip] = useState(getRandomTip(collection));
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/components/Menu/MenuItem.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { NavLink } from "react-router-dom";
import { cn } from "../../utils/bem";
import { absoluteURL } from "../../utils/helpers";
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/components/Modal/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createRef } from "react";
import { createRef } from "react";
import { render, unmountComponentAtNode } from "react-dom";
import { ApiProvider } from "../../providers/ApiProvider";
import { ConfigProvider } from "../../providers/ConfigProvider";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../utils/bem";
import { Menu } from "../Menu/Menu";
import "./SidebarMenu.scss";
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/components/Space/Space.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { BemWithSpecifiContext } from "../../utils/bem";
import "./Space.scss";

Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/components/Spinner/Spinner.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { cn } from "../../utils/bem";
import "./Spinner.scss";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type CSSProperties } from "react";
import type { CSSProperties } from "react";
import { cn } from "../../utils/bem";
import "./ToggleItems.scss";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { format } from "date-fns";
import React, { createContext, useCallback, useContext, useEffect, useReducer } from "react";
import { createContext, useCallback, useContext, useEffect, useReducer } from "react";
import { Link } from "react-router-dom";
import { useAPI } from "../../providers/ApiProvider";
import { Block, Elem } from "../../utils/bem";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCallback, useEffect, useMemo, useRef } from "react";
import { Spinner } from "../../../components";
import { cn } from "../../../utils/bem";
import { FF_DEV_3617, isFF } from "../../../utils/feature-flags";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useRef, useState } from "react";
import { useCallback, useRef, useState } from "react";
import { Button } from "../../../components";
import { LeaveBlocker, type LeaveBlockerCallbacks } from "../../../components/LeaveBlocker/LeaveBlocker";
import { modal } from "../../../components/Modal/Modal";
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/pages/ExportPage/ExportPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { useHistory } from "react-router";
import { Button } from "../../components";
import { Form, Input } from "../../components/Form";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { usePage, usePageSize } from "../../../components/Pagination/Pagination"
import { useAPI } from "../../../providers/ApiProvider";
import { Block, Elem } from "../../../utils/bem";
import { isDefined } from "../../../utils/helpers";
import { useUpdateEffect } from "../../../utils/hooks";
import "./PeopleList.scss";
import { CopyableTooltip } from "../../../components/CopyableTooltip/CopyableTooltip";

Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/pages/Organization/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { SidebarMenu } from "../../components/SidebarMenu/SidebarMenu";
import { PeoplePage } from "./PeoplePage/PeoplePage";
import { WebhookPage } from "../WebhookPage/WebhookPage";
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/pages/Projects/ProjectsList.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chr from "chroma-js";
import { format } from "date-fns";
import React, { useMemo } from "react";
import { useMemo } from "react";
import { NavLink } from "react-router-dom";
import { LsBulb, LsCheck, LsEllipsis, LsMinus } from "../../assets/icons";
import { Button, Dropdown, Menu, Pagination, Userpic } from "../../components";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useContext, useEffect, useState } from "react";
import { useAPI } from "../../../providers/ApiProvider";
import { Label, Select } from "../../../components/Form";
import { Select } from "../../../components/Form";
import { ProjectContext } from "../../../providers/ProjectProvider";

export const ModelVersionSelector = ({
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/pages/Settings/DangerZone.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useHistory } from "react-router";
import { Button } from "../../components";
import { Label } from "../../components/Form";
import { confirm } from "../../components/Modal/Modal";
import { Space } from "../../components/Space/Space";
import { Spinner } from "../../components/Spinner/Spinner";
import { useAPI } from "../../providers/ApiProvider";
import { useProject } from "../../providers/ProjectProvider";
Expand Down
6 changes: 3 additions & 3 deletions web/apps/labelstudio/src/pages/Settings/GeneralSettings.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useCallback, useContext } from "react";
import { useCallback, useContext } from "react";
import { Button } from "../../components";
import { Form, Input, Label, Select, TextArea } from "../../components/Form";
import { Form, Input, Select, TextArea } from "../../components/Form";
import { RadioGroup } from "../../components/Form/Elements/RadioGroup/RadioGroup";
import { ProjectContext } from "../../providers/ProjectProvider";
import { Block, cn, Elem } from "../../utils/bem";
import { Block, Elem } from "../../utils/bem";
import { EnterpriseBadge } from "../../components/Badges/Enterprise";
import "./settings.scss";
import { HeidiTips } from "../../components/HeidiTips/HeidiTips";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useContext } from "react";
import { useCallback, useContext } from "react";

import { format, formatDistanceToNow, parseISO } from "date-fns";
import { IconInfoOutline, IconPredictions, LsEllipsis } from "../../../assets/icons";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { useCallback, useContext, useEffect, useState } from "react";
import { Description } from "../../../components/Description/Description";
import { Divider } from "../../../components/Divider/Divider";
import { EmptyState } from "../../../components/EmptyState/EmptyState";
import { Caption } from "../../../components/Caption/Caption";
import { IconPredictions } from "../../../assets/icons";
import { useAPI } from "../../../providers/ApiProvider";
import { ProjectContext } from "../../../providers/ProjectProvider";
import { Spinner } from "../../../components/Spinner/Spinner";
import { PredictionsList } from "./PredictionsList";
import { Block, Elem } from "../../../utils/bem";
import { Label } from "../../../components/Form";
import "./PredictionsSettings.scss";

export const PredictionsSettings = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Columns } from "../../../components/Columns/Columns";
import { Description } from "../../../components/Description/Description";
import { Block, cn } from "../../../utils/bem";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { format } from "date-fns/esm";
import { React } from "react";
import { Button } from "../../../components";
import { DescriptionList } from "../../../components/DescriptionList/DescriptionList";
import { Tooltip } from "../../../components/Tooltip/Tooltip";
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/pages/Settings/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { SidebarMenu } from "../../components/SidebarMenu/SidebarMenu";
import { WebhookPage } from "../WebhookPage/WebhookPage";
import { DangerZone } from "./DangerZone";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import React from "react";

import { Button } from "../../components";
import { Elem } from "../../components/Menu/MenuContext";
import { modal } from "../../components/Modal/Modal";
import { useModalControls } from "../../components/Modal/ModalPopup";
import { Space } from "../../components/Space/Space";
import { useAPI } from "../../providers/ApiProvider";
import { Block, cn } from "../../utils/bem";
import { cn } from "../../utils/bem";

export const WebhookDeleteModal = ({ onDelete }) => {
return modal({
Expand Down
5 changes: 1 addition & 4 deletions web/apps/labelstudio/src/pages/WebhookPage/WebhookDetail.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { Button } from "../../components";
import { Form, Input, Label, Toggle } from "../../components/Form";
import { Block, cn, Elem } from "../../utils/bem";
Expand All @@ -8,10 +8,7 @@ import { useAPI } from "../../providers/ApiProvider";
import "./WebhookPage.scss";
import { Space } from "../../components/Space/Space";
import { useProject } from "../../providers/ProjectProvider";
import { modal } from "../../components/Modal/Modal";
import { useModalControls } from "../../components/Modal/ModalPopup";
import { WebhookDeleteModal } from "./WebhookDeleteModal";
import { format } from "date-fns";

const WebhookDetail = ({ webhook, webhooksInfo, fetchWebhooks, onBack, onSelectActive }) => {
// if webhook === null - create mod
Expand Down
8 changes: 3 additions & 5 deletions web/apps/labelstudio/src/pages/WebhookPage/WebhookList.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React, { useCallback } from "react";
import { LsCross, LsPencil, LsPlus } from "../../assets/icons";
import { useCallback } from "react";
import { LsCross, LsPencil } from "../../assets/icons";
import { Button } from "../../components";
import { Form, Input, Label, Toggle } from "../../components/Form";
import { modal } from "../../components/Modal/Modal";
import { Toggle } from "../../components/Form";
import { Block, Elem } from "../../utils/bem";
import "./WebhookPage.scss";
import { format } from "date-fns";
import { useAPI } from "../../providers/ApiProvider";
import { WebhookDeleteModal } from "./WebhookDeleteModal";
import { useProject } from "../../providers/ProjectProvider";

const WebhookList = ({ onSelectActive, onAddWebhook, webhooks, fetchWebhooks }) => {
const api = useAPI();
Expand Down
3 changes: 1 addition & 2 deletions web/apps/labelstudio/src/pages/WebhookPage/WebhookPage.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";

import { useAPI } from "../../providers/ApiProvider";
import "./WebhookPage.scss";

import WebhookList from "./WebhookList";
import WebhookDetail from "./WebhookDetail";
import { useProject } from "../../providers/ProjectProvider";
import { Button, Spinner } from "../../components";
import { Block, Elem } from "../../utils/bem";
import { IconInfo } from "../../assets/icons";
import { useHistory } from "react-router";
Expand Down
1 change: 0 additions & 1 deletion web/apps/labelstudio/src/routes/ProjectRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useRoutesMap } from "../providers/RoutesProvider";
import { resolveRoutes } from "../utils/routeHelpers";
import { RouteWithStaticFallback } from "./RouteWithStaticFallback";
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/utils/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCallback, useEffect, useRef } from "react";
import { useHistory } from "react-router";
import { useFixedLocation } from "../providers/RoutesProvider";

Expand Down
8 changes: 7 additions & 1 deletion web/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@
"correctness": {
"useExhaustiveDependencies": "off",
"noChildrenProp": "off",
"useJsxKeyInIterable": "off"
"useJsxKeyInIterable": "off",
"noUnusedImports": {
"level": "warn"
},
"noUnusedVariables": {
"level": "warn"
}
},
"performance": {
"noAccumulatingSpread": "off",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Tag } from "../Common/Tag/Tag";

const parseBoolean = (value) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { cloneElement, forwardRef, useMemo } from "react";
import { cloneElement, forwardRef, useMemo } from "react";
import { Block, Elem } from "../../../utils/bem";
import { FF_LOPS_E_10, isFF } from "../../../utils/feature-flags";
import { isDefined } from "../../../utils/utils";
Expand Down
1 change: 0 additions & 1 deletion web/libs/datamanager/src/components/Common/ErrorBox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { inject } from "mobx-react";
import React from "react";
import { RiErrorWarningFill } from "react-icons/ri";
import { Button } from "./Button/Button";
import { Dropdown } from "./Dropdown/Dropdown";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useCallback, useContext, useEffect, useState } from "react";
import { createContext, useCallback, useContext, useEffect, useState } from "react";
import { Label } from "..";
import { BemWithSpecifiContext } from "../../../../utils/bem";
import { FormField } from "../../FormField";
Expand Down
2 changes: 1 addition & 1 deletion web/libs/datamanager/src/components/Common/Modal/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createRef } from "react";
import { createRef } from "react";
import { render } from "react-dom";
import { cn } from "../../../utils/bem";
import { Button } from "../Button/Button";
Expand Down
1 change: 0 additions & 1 deletion web/libs/datamanager/src/components/Common/SDKButtons.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSDK } from "../../providers/SDKProvider";
import { Button } from "./Button/Button";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {
import {
Children,
cloneElement,
createContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type ReactChildren } from "react";
import type { ReactChildren } from "react";
import "./SkeletonLoader.scss";
import { Block } from "../../../utils/bem";
import { SkeletonLine } from "./SkeletonLine";
Expand Down
Loading
Loading