Skip to content

Commit 48c3d0d

Browse files
committed
Fix linting issues across CLI, common-ui, and e2e-db packages
- CLI: Ignore Cypress files in ESLint config, remove unused error variable - common-ui: Replace 'any' types with more specific types for better type safety - e2e-db: Configure ESLint to allow 'var' in declare blocks and namespaces for Jest matchers
1 parent bbd5a30 commit 48c3d0d

File tree

8 files changed

+16
-8
lines changed

8 files changed

+16
-8
lines changed

packages/cli/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import backendConfig from '../../eslint.config.backend.mjs';
33
export default [
44
...backendConfig,
55
{
6-
ignores: ['node_modules/**', 'dist/**', 'eslint.config.mjs', 'tsconfig.json', 'testproject/**'],
6+
ignores: ['node_modules/**', 'dist/**', 'eslint.config.mjs', 'tsconfig.json', 'testproject/**', 'cypress/**', 'cypress.config.js'],
77
},
88
{
99
languageOptions: {

packages/cli/src/utils/pack-courses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function packCourses(options: PackCoursesOptions): Promise<void> {
5151
const manifestContent = await fs.readFile(manifestPath, 'utf-8');
5252
const manifest = JSON.parse(manifestContent);
5353
courseTitle = manifest.courseName || manifest.courseConfig?.name || courseId;
54-
} catch (error) {
54+
} catch {
5555
console.warn(chalk.yellow(`⚠️ Could not read manifest for course title, using courseId`));
5656
}
5757

packages/common-ui/src/components/cardRendering/MarkdownRendererHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,6 @@ export function parseComponentToken(token: MarkedToken): {
191191
componentName: string;
192192
props: Record<string, string>;
193193
} | null {
194-
const text = (token as any).text || (token as any).raw;
194+
const text = ('text' in token ? token.text : 'raw' in token ? token.raw : '') as string;
195195
return parseComponentSyntax(text);
196196
}

packages/common-ui/src/composables/CompositionViewable.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ export function useQuestionView<Q extends Question>(
133133
}
134134

135135
// Helper functions
136-
export function isQuestionView(component: any): component is QuestionViewUtils<Question> {
137-
return 'submitAnswer' in component && 'priorAttempts' in component;
136+
export function isQuestionView(component: unknown): component is QuestionViewUtils<Question> {
137+
return (
138+
typeof component === 'object' &&
139+
component !== null &&
140+
'submitAnswer' in component &&
141+
'priorAttempts' in component
142+
);
138143
}
139144

140145
// Example usage in a child component:

packages/common-ui/src/composables/Displayable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export abstract class Displayable {
2121
public static dataShapes: DataShape[];
2222

2323
public static views: Array<ViewComponent>;
24-
public static seedData?: Array<any>;
24+
public static seedData?: Array<unknown>;
2525
/**
2626
* True if this displayable content type is meant to have
2727
* user-submitted questions. False if supplied seedData array

packages/common-ui/src/composables/useAuthUI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function useAuthUI() {
4242
// Access the sync strategy through the user's private syncStrategy property
4343
// NoOpSyncStrategy (local-only) returns false for canCreateAccount
4444
// CouchDBSyncStrategy (remote sync) returns true for canCreateAccount
45-
const userInternal = user as any; // Type assertion to access private members
45+
const userInternal = user as { syncStrategy?: { canCreateAccount?: () => boolean } };
4646
const canCreateAccount = userInternal.syncStrategy?.canCreateAccount?.();
4747

4848
isLocalOnlyMode.value = !canCreateAccount;

packages/e2e-db/eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export default [
2727
// Testing-specific rules
2828
'@typescript-eslint/no-explicit-any': 'off', // Tests often need any for mocking
2929
'@typescript-eslint/explicit-function-return-type': 'off', // Test functions don't need return types
30+
'no-var': 'off', // var is required in declare global blocks
31+
'no-console': 'off', // Tests can use console for debugging
32+
'@typescript-eslint/no-namespace': 'off', // Namespaces needed for Jest matcher declarations
3033
},
3134
},
3235
];

packages/e2e-db/src/setup/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class DatabaseManager {
1818
await this.couch.db.list();
1919
console.log('✅ CouchDB is ready');
2020
return;
21-
} catch (error) {
21+
} catch {
2222
if (attempt === maxAttempts) {
2323
throw new Error(`CouchDB not ready after ${maxAttempts} attempts`);
2424
}

0 commit comments

Comments
 (0)