Refactor ESLint configuration and update test rules for clarity and consistency

- Consolidated and modularized `eslint.config.mjs` with defined rules for source, test, E2E, and scripts.
- Improved test and E2E rules with relaxed settings for flexibility and enhanced mocking.
- Standardized variable naming and removed redundant imports in unit and E2E tests.
- Updated error handling and comments to align with modern TypeScript best practices (e.g., `@ts-expect-error`).
This commit is contained in:
2025-11-10 10:57:43 +01:00
parent c8f90e9e8c
commit b2f3ec8f25
26 changed files with 85 additions and 34 deletions

View File

@@ -7,7 +7,6 @@ import { test, expect } from '@playwright/test';
import {
setupAuthenticatedMocks,
setupSuperuserMocks,
loginViaUI,
} from './helpers/auth';
test.describe('Admin Access Control', () => {

View File

@@ -4,7 +4,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupSuperuserMocks, loginViaUI } from './helpers/auth';
import { setupSuperuserMocks } from './helpers/auth';
test.describe('Admin Dashboard - Page Load', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -5,7 +5,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupSuperuserMocks, loginViaUI } from './helpers/auth';
import { setupSuperuserMocks } from './helpers/auth';
test.describe('Admin Organization Members - Navigation from Organizations List', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -4,7 +4,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupSuperuserMocks, loginViaUI } from './helpers/auth';
import { setupSuperuserMocks } from './helpers/auth';
test.describe('Admin Organization Management - Page Load', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -4,7 +4,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupSuperuserMocks, loginViaUI } from './helpers/auth';
import { setupSuperuserMocks } from './helpers/auth';
test.describe('Admin User Management - Page Load', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -11,9 +11,9 @@
* - Savings: ~690s (~11 minutes) per test run
*/
import { test as setup, expect } from '@playwright/test';
import { test as setup } from '@playwright/test';
import path from 'path';
import { setupAuthenticatedMocks, setupSuperuserMocks, loginViaUI } from './helpers/auth';
import { setupAuthenticatedMocks, setupSuperuserMocks } from './helpers/auth';
// Use absolute paths to ensure correct file location
const ADMIN_STORAGE_STATE = path.join(__dirname, '.auth', 'admin.json');

View File

@@ -57,7 +57,7 @@ export async function startCoverage(
try {
await page.coverage.startJSCoverage({
resetOnNavigation: options?.resetOnNavigation ?? false,
// @ts-ignore
// @ts-expect-error - includeRawScriptCoverage is not in official types but supported by Playwright
includeRawScriptCoverage: options?.includeRawScriptCoverage ?? false,
});
} catch (error) {

View File

@@ -214,7 +214,7 @@ test.describe('Homepage - Mobile Menu Interactions', () => {
test.skip('should close mobile menu when clicking outside', async ({ page }) => {
// Open mobile menu
const mobileMenu = await openMobileMenu(page);
const _mobileMenu = await openMobileMenu(page);
// Press Escape key to close menu (more reliable than clicking overlay)
await page.keyboard.press('Escape');

View File

@@ -4,7 +4,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupAuthenticatedMocks, loginViaUI } from './helpers/auth';
import { setupAuthenticatedMocks } from './helpers/auth';
test.describe('Settings Navigation', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -4,7 +4,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupAuthenticatedMocks, loginViaUI } from './helpers/auth';
import { setupAuthenticatedMocks } from './helpers/auth';
test.describe('Password Change', () => {
test.beforeEach(async ({ page }) => {

View File

@@ -4,7 +4,7 @@
*/
import { test, expect } from '@playwright/test';
import { setupAuthenticatedMocks, loginViaUI, MOCK_USER } from './helpers/auth';
import { setupAuthenticatedMocks, MOCK_USER } from './helpers/auth';
test.describe('Profile Settings', () => {
test.beforeEach(async ({ page }) => {