Skip to content

Commit 9858668

Browse files
committed
[ui] fix linting errors + replace eslint by biome
1 parent 2cdcf06 commit 9858668

File tree

20 files changed

+95
-1287
lines changed

20 files changed

+95
-1287
lines changed

.github/workflows/ui-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ jobs:
3838
yarn --cwd quickwit-ui cypress run
3939
- name: Lint
4040
command: yarn --cwd quickwit-ui lint
41-
- name: Check formatting
42-
command: yarn --cwd quickwit-ui check-formatting
4341
- name: Check type consistency
4442
command: yarn --cwd quickwit-ui type
4543
- name: Unit Test

quickwit/quickwit-ui/biome.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,21 @@
55
"indentStyle": "space",
66
"includes": ["**", "!**/build"]
77
},
8-
"linter": { "enabled": false }
8+
"linter": {
9+
"enabled": true,
10+
"rules": {
11+
"recommended": true,
12+
"style": "off",
13+
"complexity": "off",
14+
"correctness": {
15+
"useExhaustiveDependencies": "warn"
16+
},
17+
"suspicious": {
18+
"useIterableCallbackReturn": "off",
19+
"noExplicitAny": "off",
20+
"noArrayIndexKey": "warn"
21+
}
22+
},
23+
"includes": ["**", "!**/build"]
24+
}
925
}

quickwit/quickwit-ui/package.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@
2323
"@types/react": "17.0.65",
2424
"@types/react-dom": "17.0.18",
2525
"@types/swagger-ui-react": "4.18.2",
26-
"@typescript-eslint/eslint-plugin": "6.8.0",
27-
"@typescript-eslint/parser": "6.8.0",
2826
"babel-jest": "30.2.0",
2927
"babel-preset-react-app": "10.1.0",
3028
"cypress": "13.3.2",
3129
"dayjs": "1.11.7",
32-
"eslint": "8.3.0",
33-
"eslint-config-react-app": "7.0.1",
3430
"jest": "30.2.0",
3531
"jest-environment-jsdom": "30.2.0",
3632
"jest-transform-stub": "2.0.0",
@@ -57,16 +53,9 @@
5753
"start": "vite",
5854
"build": "vite build --outDir build",
5955
"test": "jest",
60-
"lint": "eslint . --ext .ts",
61-
"check-formatting": "biome check",
56+
"lint": "biome check",
6257
"format": "biome check --write",
6358
"type": "tsc",
6459
"e2e-test": "cypress run"
65-
},
66-
"eslintConfig": {
67-
"extends": [
68-
"react-app",
69-
"react-app/jest"
70-
]
7160
}
7261
}

quickwit/quickwit-ui/src/components/ApiUrlFooter.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ const Footer = styled(Box)`
2929

3030
export default function ApiUrlFooter(url: string) {
3131
const urlMaxLength = 80;
32-
const origin =
33-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
34-
// @ts-ignore
35-
process.env.NODE_ENV === "development"
36-
? "http://localhost:7280"
37-
: window.location.origin;
32+
const origin = import.meta.env.PROD
33+
? "http://localhost:7280"
34+
: window.location.origin;
3835
const completeUrl = `${origin}/${url}`;
3936
const isTooLong = completeUrl.length > urlMaxLength;
4037
// TODO show generated aggregation

quickwit/quickwit-ui/src/components/IndexSummary.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@ import { Index } from "../utils/models";
2323
dayjs.extend(utc);
2424

2525
const ItemContainer = styled.div`
26-
padding: 10px;
27-
display: flex;
28-
flex-direction: column;
26+
padding: 10px;
27+
display: flex;
28+
flex-direction: column;
2929
`;
3030
const Row = styled.div`
31-
padding: 5px;
32-
display: flex;
33-
flex-direction: row;
34-
&:nth-of-type(odd){ background: rgba(0,0,0,0.05) }
31+
padding: 5px;
32+
display: flex;
33+
flex-direction: row;
34+
&:nth-of-type(odd) {
35+
background: rgba(0, 0, 0, 0.05);
36+
}
3537
`;
3638
const RowKey = styled.div`
37-
width: 350px;
39+
width: 350px;
3840
`;
3941
const IndexRow: FC<{ title: string; children: ReactNode }> = ({
4042
title,
@@ -49,13 +51,13 @@ const IndexRow: FC<{ title: string; children: ReactNode }> = ({
4951
export function IndexSummary({ index }: { index: Index }) {
5052
const all_splits = index.splits;
5153
const published_splits = all_splits.filter(
52-
(split) => split.split_state == "Published",
54+
(split) => split.split_state === "Published",
5355
);
5456
const num_of_staged_splits = all_splits.filter(
55-
(split) => split.split_state == "Staged",
57+
(split) => split.split_state === "Staged",
5658
).length;
5759
const num_of_marked_for_delete_splits = all_splits.filter(
58-
(split) => split.split_state == "MarkedForDeletion",
60+
(split) => split.split_state === "MarkedForDeletion",
5961
).length;
6062
const total_num_docs = published_splits
6163
.map((split) => split.num_docs)

quickwit/quickwit-ui/src/components/IndexesTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const IndexesTable = ({
3232
indexesMetadata,
3333
}: Readonly<{ indexesMetadata: IndexMetadata[] }>) => {
3434
const navigate = useNavigate();
35-
const handleClick = function (indexId: string) {
35+
const handleClick = (indexId: string) => {
3636
navigate(`/indexes/${indexId}`);
3737
};
3838

quickwit/quickwit-ui/src/components/Loader.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import { Box, keyframes, styled } from "@mui/material";
16-
import logo_url from "../assets/img/logo.svg";
16+
import loadinIcongUrl from "../assets/img/icon-loading.svg";
1717

1818
const spin = keyframes`
1919
from {
@@ -24,15 +24,15 @@ to {
2424
}
2525
`;
2626

27-
const Logo = (props: React.ComponentProps<"img">) => (
28-
<img {...props} src={logo_url} />
27+
const LoadingIcon = (props: React.ComponentProps<"img">) => (
28+
<img {...props} src={loadinIcongUrl} alt="loading icon" />
2929
);
3030

31-
const SpinningLogo = styled(Logo)`
32-
height: 10vmin;
33-
pointer-events: none;
34-
fill: #CBD1DD;
35-
animation: ${spin} infinite 5s linear;
31+
const SpinningLoadingIcon = styled(LoadingIcon)`
32+
height: 10vmin;
33+
pointer-events: none;
34+
fill: #cbd1dd;
35+
animation: ${spin} infinite 5s linear;
3636
`;
3737

3838
export default function Loader() {
@@ -43,7 +43,7 @@ export default function Loader() {
4343
alignItems="center"
4444
minHeight="40vh"
4545
>
46-
<SpinningLogo></SpinningLogo>
46+
<SpinningLoadingIcon></SpinningLoadingIcon>
4747
</Box>
4848
);
4949
}

quickwit/quickwit-ui/src/components/QueryActionBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function QueryEditorActionBar(props: SearchComponentProps) {
2525
const handleChange = (_event: React.SyntheticEvent, newTab: number) => {
2626
const updatedSearchRequest = {
2727
...props.searchRequest,
28-
aggregation: newTab != 0,
28+
aggregation: newTab !== 0,
2929
};
3030
props.onSearchRequestUpdate(updatedSearchRequest);
3131
props.runSearch(updatedSearchRequest);

quickwit/quickwit-ui/src/components/QueryEditor/AggregationEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function MetricKind(props: SearchComponentProps) {
4949
const handleTypeChange = (event: SelectChangeEvent) => {
5050
const value = event.target.value;
5151
const updatedMetric =
52-
value != "count" ? { ...metricRef.current!, type: value } : null;
52+
value !== "count" ? { ...metricRef.current!, type: value } : null;
5353
const updatedAggregation = {
5454
...props.searchRequest.aggregationConfig,
5555
metric: updatedMetric,
@@ -261,7 +261,7 @@ export function AggregationKind(props: SearchComponentProps) {
261261
let addHistogram = true;
262262
let addTerm = true;
263263
for (let i = 0; i < agg.length; i++) {
264-
if (i == pos) continue;
264+
if (i === pos) continue;
265265
if (getAggregationKind(agg[i]) === "histogram") addHistogram = false;
266266
if (getAggregationKind(agg[i]) === "term") addTerm = false;
267267
}

quickwit/quickwit-ui/src/components/QueryEditor/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const createIndexCompletionProvider = (indexMetadata: IndexMetadata) => {
152152
label: field.json_path,
153153
kind: CompletionItemKind.Field,
154154
insertText:
155-
field.field_mapping.type == "json"
155+
field.field_mapping.type === "json"
156156
? field.json_path + "."
157157
: field.json_path + ":",
158158
range: range,

0 commit comments

Comments
 (0)