Updated linter

This commit is contained in:
maziggy
2026-01-11 07:19:45 +01:00
parent 1a5d867e14
commit fdac28e472
6 changed files with 40 additions and 6 deletions
+34
View File
@@ -19,5 +19,39 @@ export default defineConfig([
ecmaVersion: 2020,
globals: globals.browser,
},
rules: {
// Keep core React Hooks rules
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// Disable React Compiler rules (too strict for non-compiler codebases)
'react-hooks/static-components': 'off',
'react-hooks/set-state-in-effect': 'off',
'react-hooks/purity': 'off',
'react-hooks/immutability': 'off',
'react-hooks/preserve-manual-memoization': 'off',
'react-hooks/refs': 'off',
},
},
// Relaxed rules for test files
{
files: ['**/__tests__/**/*.{ts,tsx}', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'react-refresh/only-export-components': 'off',
},
},
// Files that legitimately export non-components (contexts, hooks, utilities)
{
files: [
'**/contexts/**/*.{ts,tsx}',
'**/hooks/**/*.{ts,tsx}',
'**/components/IconPicker.tsx',
'**/components/Layout.tsx',
'**/components/HMSErrorModal.tsx',
],
rules: {
'react-refresh/only-export-components': 'off',
},
},
])
+1 -1
View File
@@ -162,7 +162,7 @@ async function parse3MF(arrayBuffer: ArrayBuffer): Promise<{ objects: Map<string
}
}
}
} catch (e) {
} catch {
// Silently ignore model_settings.config parsing errors
}
}
+2 -2
View File
@@ -1457,7 +1457,7 @@ export function ArchivesPage() {
a.click();
URL.revokeObjectURL(url);
showToast('Export downloaded');
} catch (err) {
} catch {
showToast('Export failed', 'error');
} finally {
setIsExporting(false);
@@ -1486,7 +1486,7 @@ export function ArchivesPage() {
a.click();
URL.revokeObjectURL(url);
showToast('Export downloaded');
} catch (err) {
} catch {
showToast('Export failed', 'error');
} finally {
setIsExporting(false);
+1 -1
View File
@@ -2796,7 +2796,7 @@ function AddPrinterModal({
clearInterval(pollInterval);
try {
await discoveryApi.stopDiscovery();
} catch (e) {
} catch {
// Ignore stop errors
}
setDiscovering(false);
+1 -1
View File
@@ -2108,7 +2108,7 @@ export function SettingsPage() {
a.click();
URL.revokeObjectURL(url);
showToast(t('backup.downloaded', { defaultValue: 'Backup downloaded' }), 'success');
} catch (err) {
} catch {
// Dismiss loading toast on error
if (includesArchives) {
dismissToast(toastId);
+1 -1
View File
@@ -452,7 +452,7 @@ export function StatsPage() {
a.click();
URL.revokeObjectURL(url);
showToast('Export downloaded');
} catch (err) {
} catch {
showToast('Export failed', 'error');
} finally {
setIsExporting(false);