Skip to content

Commit bcf5b9e

Browse files
committed
dev: 优化 ESLint 配置
1 parent b8a3c55 commit bcf5b9e

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

eslint.config.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import tseslint from 'typescript-eslint'
66
import { globalIgnores } from 'eslint/config'
77

88
export default tseslint.config([
9-
globalIgnores(['dist']),
9+
globalIgnores([
10+
'dist',
11+
'Extremer/frontend/wailsjs/**',
12+
'Landing/.astro/**',
13+
'dev/instructions/**',
14+
'docsite/docs/.vitepress/cache/**',
15+
'src/components/iconfonts/**',
16+
]),
1017
{
1118
files: ['**/*.{ts,tsx}'],
1219
extends: [
@@ -19,5 +26,15 @@ export default tseslint.config([
1926
ecmaVersion: 2020,
2027
globals: globals.browser,
2128
},
29+
rules: {
30+
'@typescript-eslint/no-explicit-any': 'off',
31+
'@typescript-eslint/no-unused-expressions': 'warn',
32+
'@typescript-eslint/no-unused-vars': 'warn',
33+
'no-case-declarations': 'warn',
34+
'no-constant-binary-expression': 'warn',
35+
'no-useless-escape': 'warn',
36+
'prefer-const': 'warn',
37+
'react-refresh/only-export-components': 'off',
38+
},
2239
},
2340
])

src/components/panels/main/SearchPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ function SearchPanel() {
3838
const allowSearch = !isEmbed || isCapAllowed("allowSearch");
3939
const allowAI = !isEmbed || isCapAllowed("allowAI");
4040

41-
// 若搜索被禁用,整个面板不渲染
42-
if (!allowSearch) return null;
43-
4441
// 状态
4542
const [searchValue, setSearchValue] = useState("");
4643
const [options, setOptions] = useState<AutoCompleteProps["options"]>([]);
@@ -327,6 +324,9 @@ function SearchPanel() {
327324
[],
328325
);
329326

327+
// 若搜索被禁用,整个面板不渲染
328+
if (!allowSearch) return null;
329+
330330
return (
331331
<div ref={containerRef} className={panelClass}>
332332
<AutoComplete

0 commit comments

Comments
 (0)