fix linting

This commit is contained in:
7w1 committed 2026-05-04 20:51:28 -05:00
1 parent 1a6d6f4584
commit 6ee0b9983a
3 files changed
+16 -16

No files matched your search

@@ -165,9 +165,9 @@ export function ThemeImportModal({ open, onClose }: ThemeImportModalProps) {
setImportFileName(file.name);
setImportPaste('');
const reader = new FileReader();
reader.onload = () => {
reader.addEventListener('load', () => {
setUploadedFileCss(typeof reader.result === 'string' ? reader.result : '');
};
});
reader.readAsText(file);
};
+11 -11
View File
@@ -11,11 +11,11 @@ export type CachedThemeEntry = {
function openDb(): Promise<IDBDatabase> {
return new Promise((resolve, reject) => {
const req = indexedDB.open(DB_NAME, DB_VERSION);
req.onerror = () => reject(req.error);
req.onsuccess = () => resolve(req.result);
req.onupgradeneeded = () => {
req.addEventListener('error', () => reject(req.error));
req.addEventListener('success', () => resolve(req.result));
req.addEventListener('upgradeneeded', () => {
req.result.createObjectStore(STORE, { keyPath: 'url' });
};
});
});
}
@@ -24,11 +24,11 @@ export async function getCachedThemeCss(url: string): Promise<string | undefined
return new Promise((resolve, reject) => {
const tx = db.transaction(STORE, 'readonly');
const req = tx.objectStore(STORE).get(url);
req.onerror = () => reject(req.error);
req.onsuccess = () => {
req.addEventListener('error', () => reject(req.error));
req.addEventListener('success', () => {
const row = req.result as CachedThemeEntry | undefined;
resolve(row?.cssText);
};
});
});
}
@@ -38,8 +38,8 @@ export async function putCachedThemeCss(url: string, cssText: string): Promise<v
return new Promise((resolve, reject) => {
const tx = db.transaction(STORE, 'readwrite');
tx.objectStore(STORE).put(entry);
tx.oncomplete = () => resolve();
tx.onerror = () => reject(tx.error);
tx.addEventListener('complete', () => resolve());
tx.addEventListener('error', () => reject(tx.error));
});
}
@@ -48,7 +48,7 @@ export async function clearThemeCache(): Promise<void> {
return new Promise((resolve, reject) => {
const tx = db.transaction(STORE, 'readwrite');
tx.objectStore(STORE).clear();
tx.oncomplete = () => resolve();
tx.onerror = () => reject(tx.error);
tx.addEventListener('complete', () => resolve());
tx.addEventListener('error', () => reject(tx.error));
});
}
+3 -3
View File
@@ -31,8 +31,8 @@ export function getSableCssPackageKind(cssText: string): 'theme' | 'tweak' | 'un
const end = cssText.indexOf('*/', start + 2);
if (end === -1) break;
const block = cssText.slice(start + 2, end);
if (block.includes(META_TWEAK)) return 'tweak';
if (block.includes(META_THEME)) return 'theme';
if (block.indexOf(META_TWEAK) !== -1) return 'tweak';
if (block.indexOf(META_THEME) !== -1) return 'theme';
pos = end + 2;
}
return 'unknown';
@@ -46,7 +46,7 @@ function extractBlockCommentContaining(cssText: string, marker: string): string
const end = cssText.indexOf('*/', start + 2);
if (end === -1) return '';
const block = cssText.slice(start + 2, end);
if (block.includes(marker)) {
if (block.indexOf(marker) !== -1) {
return block;
}
pos = end + 2;