Skip to content

Commit d732771

Browse files
SaraVieiraskeptrunedev
authored andcommitted
cleanup: lint CI with configs
1 parent 74e736d commit d732771

File tree

15 files changed

+325
-77
lines changed

15 files changed

+325
-77
lines changed

.github/workflows/ts-sdk-gh-pages.yml

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Deploy TS-SDK docs to github pages
33
on:
44
push:
55
branches: ["main"]
6-
pull_request:
7-
branches: ["main"]
86

97
jobs:
108
build:

clients/search-component/.eslintrc.json

-42
This file was deleted.

clients/search-component/README.md

+47
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,53 @@ export const trieve = new TrieveSDK({
2525
});
2626
```
2727

28+
And then you can use any of the two components in your React application or as web component:
29+
30+
### Search Modal
31+
32+
<details>
33+
<summary>Screenshots</summary>
34+
35+
![light closed](./github/modal-light-1.png)
36+
![dark closed](./github/modal-dark-1.png)
37+
![light open](./github/modal-light-2.png)
38+
39+
</details>
40+
41+
#### Usage in React:
42+
43+
```jsx
44+
<TrieveModalSearch trieve={trieve} />
45+
```
46+
47+
#### Usage in Web Components:
48+
49+
```html
50+
<trieve-modal-search trieve="<your trieve instance>" />
51+
```
52+
53+
### Search Results
54+
55+
<details>
56+
<summary>Screenshots</summary>
57+
58+
![light](./github/search-light.png)
59+
![dark](./github/search-dark.png)
60+
61+
</details>
62+
63+
#### Usage in React:
64+
65+
```jsx
66+
<TrieveSearch trieve={trieve} />
67+
```
68+
69+
#### Usage in Web Components:
70+
71+
```html
72+
<trieve-search trieve="<your trieve instance>" />
73+
```
74+
2875
## License
2976

3077
MIT
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
3+
import eslint from "@eslint/js";
4+
import tseslint from "typescript-eslint";
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
...tseslint.configs.recommended,
9+
{ ignores: ["**/*.js", "**/*.cjs"] }
10+
);
Loading
Loading
Loading
Loading
Loading

clients/search-component/package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,30 @@
77
"dist/*",
88
"dist/**/*"
99
],
10-
"version": "0.0.1",
10+
"version": "0.0.1-rc1",
1111
"license": "MIT",
1212
"scripts": {
1313
"dev": "run-p watch:css watch:js",
1414
"watch:css": "npx postcss src/app.css -o dist/app.css --watch",
1515
"watch:js": "node ./scripts/watch.js",
16-
"lint": "eslint 'src/**/*.ts'",
16+
"lint": "eslint",
1717
"build:clean": "rm tsconfig.tsbuildinfo && rm -rf dist && yarn type:gen && yarn build",
1818
"build": "run-s build:src build:css type:dts",
1919
"build:src": "node ./scripts/build.js",
2020
"type:dts": "tsc --emitDeclarationOnly --declarationMap",
2121
"build:css": "npx postcss src/app.css -o dist/app.css "
2222
},
2323
"devDependencies": {
24+
"@eslint/js": "^9.9.1",
2425
"@tailwindcss/forms": "^0.5.7",
26+
"@types/eslint__js": "^8.42.3",
2527
"@types/lodash-es": "^4.17.12",
2628
"@types/react": "^18.3.4",
2729
"@types/react-dom": "^18.3.0",
2830
"esbuild": "^0.23.1",
2931
"esbuild-node-externals": "^1.14.0",
3032
"esbuild-register": "^3.6.0",
33+
"eslint": "^9.9.1",
3134
"eslint-plugin-react": "^7.35.0",
3235
"npm-run-all": "^4.1.5",
3336
"postcss": "^8.4.41",
@@ -38,7 +41,8 @@
3841
"react-dom": "^18.3.1",
3942
"tailwind": "^4.0.0",
4043
"tailwindcss": "^3.4.10",
41-
"typescript": "^5.5.4"
44+
"typescript": "^5.5.4",
45+
"typescript-eslint": "^8.3.0"
4246
},
4347
"dependencies": {
4448
"@r2wc/react-to-web-component": "^2.0.3",

clients/search-component/src/TrieveModal/index.css

+17-18
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,29 @@ body {
6565
@apply font-normal text-xs text-zinc-600;
6666
}
6767
}
68-
}
69-
70-
&.dark {
71-
.kbd-wrapper {
72-
kbd {
73-
@apply border-zinc-400 text-zinc-400;
68+
&.dark {
69+
.kbd-wrapper {
70+
kbd {
71+
@apply border-zinc-400 text-zinc-400;
72+
}
7473
}
75-
}
7674

77-
@apply text-white bg-zinc-900;
75+
@apply text-white bg-zinc-900;
7876

79-
input {
80-
@apply bg-zinc-900 text-zinc-50 ring-zinc-700;
81-
}
77+
input {
78+
@apply bg-zinc-900 text-zinc-50 ring-zinc-700;
79+
}
8280

83-
.input-wrapper {
84-
@apply bg-zinc-900;
85-
}
81+
.input-wrapper {
82+
@apply bg-zinc-900;
83+
}
8684

87-
.item {
88-
@apply hover:bg-zinc-800 border-zinc-700 focus:bg-zinc-800 bg-zinc-900;
85+
.item {
86+
@apply hover:bg-zinc-800 border-zinc-700 focus:bg-zinc-800 bg-zinc-900;
8987

90-
.description {
91-
@apply text-zinc-400;
88+
.description {
89+
@apply text-zinc-400;
90+
}
9291
}
9392
}
9493
}

clients/search-component/src/TrieveModal/index.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ export const TrieveModalSearch = ({
5656

5757
const onUpOrDownClicked = (index: number, code: string) => {
5858
if (code === "ArrowDown") {
59-
index < results.length - 1
60-
? document.getElementById(`trieve-search-item-${index + 1}`)?.focus()
61-
: document.getElementById(`trieve-search-item-0`)?.focus();
59+
if (index < results.length - 1) {
60+
document.getElementById(`trieve-search-item-${index + 1}`)?.focus();
61+
} else {
62+
document.getElementById(`trieve-search-item-0`)?.focus();
63+
}
6264
}
6365

6466
if (code === "ArrowUp") {
65-
index > 0
66-
? document.getElementById(`trieve-search-item-${index - 1}`)?.focus()
67-
: inputRef.current?.focus();
67+
if (index > 0) {
68+
document.getElementById(`trieve-search-item-${index - 1}`)?.focus();
69+
} else {
70+
inputRef.current?.focus();
71+
}
6872
}
6973
};
7074

clients/search-component/src/TrieveModal/item.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const Item = ({
1717
onUpOrDownClicked,
1818
}: Props) => {
1919
const Component = item.chunk.link ? "a" : "button";
20+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2021
const itemRef = useRef<HTMLButtonElement | HTMLLinkElement | any>(null);
2122
const title =
2223
item.chunk.metadata?.title ||

clients/search-component/src/TrieveSearch/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const TrieveSearch = ({
3434
} else {
3535
onResultClick?.(state.selectedItem?.chunk as Chunk);
3636
}
37+
return state;
3738
}
3839
case useCombobox.stateChangeTypes.InputBlur: {
3940
return {

0 commit comments

Comments
 (0)