Skip to content

Commit 7574afc

Browse files
committed
Add linting
1 parent 33c8986 commit 7574afc

File tree

9 files changed

+638
-19
lines changed

9 files changed

+638
-19
lines changed

eslint.config.mjs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import eslint from '@eslint/js'
2+
import prettierConfig from 'eslint-config-prettier'
3+
import tseslint from 'typescript-eslint'
4+
import tailwind from 'eslint-plugin-tailwindcss'
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
...tseslint.configs.recommendedTypeChecked,
9+
...tailwind.configs['flat/recommended'],
10+
{
11+
languageOptions: {
12+
parserOptions: {
13+
projectService: true,
14+
tsconfigRootDir: import.meta.dirname,
15+
},
16+
},
17+
},
18+
prettierConfig,
19+
{
20+
// Note: there should be no other properties in this object
21+
ignores: [
22+
'dist',
23+
'src-tauri',
24+
'eslint.config.mjs',
25+
'postcss.config.js',
26+
'tailwind.config.js',
27+
'vite.config.ts',
28+
],
29+
},
30+
)

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"build": "tsc && vite build",
99
"preview": "vite preview",
1010
"tauri": "tauri",
11+
"lint": "eslint . && cd src-tauri && cargo clippy",
1112
"format": "prettier . --write && cd src-tauri && cargo fmt",
1213
"format:check": "prettier . --check && cd src-tauri && cargo fmt --check"
1314
},
@@ -26,15 +27,20 @@
2627
"react-dom": "^18.3.1"
2728
},
2829
"devDependencies": {
30+
"@eslint/js": "^9.17.0",
2931
"@tauri-apps/cli": "^2",
3032
"@types/react": "^18.3.1",
3133
"@types/react-dom": "^18.3.1",
3234
"@vitejs/plugin-react": "^4.3.4",
3335
"autoprefixer": "^10.4.20",
36+
"eslint": "^9.17.0",
37+
"eslint-config-prettier": "^9.1.0",
38+
"eslint-plugin-tailwindcss": "^3.17.5",
3439
"postcss": "^8.4.49",
3540
"prettier": "^3.4.2",
3641
"tailwindcss": "^3.4.17",
37-
"typescript": "~5.6.2",
42+
"typescript": "^5.7.2",
43+
"typescript-eslint": "^8.18.2",
3844
"vite": "^6.0.3"
3945
}
4046
}

src/components/Checkbox.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function Checkbox({ title, value, onChange }: CheckboxProps) {
3333
>
3434
<span
3535
aria-hidden="true"
36-
className="pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"
36+
className="pointer-events-none inline-block size-5 rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"
3737
/>
3838
</Switch>
3939
</Field>

src/components/SettingsProvider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function SettingsProvider({ children }: PropsWithChildren) {
88

99
useEffect(() => {
1010
let unlistenFn: UnlistenFn | undefined
11-
;(async () => {
11+
void (async () => {
1212
setSettings(await invoke('get_settings'))
1313

1414
unlistenFn = await listen<Settings>('settings_update', (event) => {

src/components/ThemeMetaSwitcher.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default function ThemeMetaSwitcher({ children }: PropsWithChildren) {
1010
theme.isDark ? 'dark' : 'light',
1111
)
1212
// trigger reflow so that overflow style is applied
13-
document.body.clientWidth
1413
document.documentElement.style.display = ''
1514
}, [theme.isDark])
1615
return children

src/containers/CodeEditor.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function CodeEditor() {
5656
const sortedLanguages = useSortedLanguages()
5757

5858
return (
59-
<div className="size-full grid grid-rows-[1fr_auto]">
60-
<div className="overflow-auto h-full overscroll-contain">
59+
<div className="grid size-full grid-rows-[1fr_auto]">
60+
<div className="h-full overflow-auto overscroll-contain">
6161
<CodeMirror
6262
onUpdate={onUpdateHandler}
6363
extensions={extensions}

src/containers/Settings.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Settings() {
1313

1414
return (
1515
<div
16-
className="size-full flex flex-col p-8 gap-4"
16+
className="flex size-full flex-col gap-4 p-8"
1717
style={{ backgroundColor: theme.background }}
1818
>
1919
<Dropdown

src/modules/useTheme.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function useTheme() {
1717

1818
useEffect(() => {
1919
let unlisten: UnlistenFn | undefined
20-
;(async () => {
20+
void (async () => {
2121
const window = getCurrentWindow()
2222
setSystemTheme((await window.theme()) ?? 'light')
2323

0 commit comments

Comments
 (0)