Skip to content

Dependency/bump eslint v9 #1071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Root-level ESLint configuration for the monorepo
// Individual apps should have their own eslint.config.js files

export default [
// Global ignores for the entire monorepo
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'**/coverage/**',
'**/.next/**',
'**/out/**',
'**/public/**',
'**/static/**',
'**/*.min.js',
'**/bundle*.js',
'**/vendor/**',
'**/test-results/**',
'**/playwright-report/**',
'**/screenshots/**',
'**/report/**',
'**/save/**',
'**/yarn-error.log',
'**/data/**',
'**/docs/**',
'**/docker/**',
'**/env.d/**',
'**/gitlint/**',
'**/helm/**',
'**/crowdin/**',
'**/bin/**',
],
},
];
9 changes: 0 additions & 9 deletions src/frontend/apps/e2e/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/frontend/apps/e2e/__tests__/app-impress/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
) => {
const browserName = browserConfig?.name || 'chromium';

const { storageState, ...useConfig } = browserConfig?.use;

Check warning on line 10 in src/frontend/apps/e2e/__tests__/app-impress/auth.setup.ts

View workflow job for this annotation

GitHub Actions / lint-front

Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError
const browser = await chromium.launch();
const context = await browser.newContext(useConfig);
const page = await context.newPage();

try {
await page.goto('/', { waitUntil: 'networkidle' });

Check warning on line 16 in src/frontend/apps/e2e/__tests__/app-impress/auth.setup.ts

View workflow job for this annotation

GitHub Actions / lint-front

Unexpected use of networkidle
await page.content();
await expect(page.getByText('Docs').first()).toBeVisible();

Expand Down Expand Up @@ -45,11 +45,11 @@
};

async function globalSetup(config: FullConfig) {
/* eslint-disable @typescript-eslint/no-non-null-assertion */
const chromeConfig = config.projects.find((p) => p.name === 'chromium')!;
const firefoxConfig = config.projects.find((p) => p.name === 'firefox')!;
const webkitConfig = config.projects.find((p) => p.name === 'webkit')!;
/* eslint-enable @typescript-eslint/no-non-null-assertion */

await saveStorageState(chromeConfig);
await saveStorageState(webkitConfig);
Expand Down
102 changes: 102 additions & 0 deletions src/frontend/apps/e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import js from '@eslint/js';
import tsEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import playwright from 'eslint-plugin-playwright';

export default [
// Base JavaScript config
js.configs.recommended,

// TypeScript configuration
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': tsEslint,
},
rules: {
...tsEslint.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
}],
'no-console': 'off',
},
},

// Playwright test configuration
{
files: ['**/*.spec.ts', '**/*.test.ts', '__tests__/**/*.ts'],
plugins: {
playwright,
},
rules: {
...playwright.configs.recommended.rules,
'playwright/no-skipped-test': 'warn',
'playwright/no-conditional-expect': 'warn',
'playwright/no-conditional-in-test': 'warn',
'playwright/no-wait-for-timeout': 'warn',
'playwright/expect-expect': 'warn',
'playwright/no-networkidle': 'warn',
'playwright/no-force-option': 'warn',
},
},

// Global configuration for all files
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
// Node.js globals
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
global: 'readonly',
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
require: 'readonly',
module: 'readonly',
exports: 'readonly',
NodeJS: 'readonly',
// Browser globals that might be accessed in tests
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
location: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
fetch: 'readonly',
},
},
rules: {
'no-undef': 'error',
'no-unsafe-optional-chaining': 'warn',
},
},

// Ignore patterns
{
ignores: [
'node_modules/**',
'test-results/**',
'playwright-report/**',
'screenshots/**',
'report/**',
'save/**',
'*.log',
'**/*.min.js',
],
},
];
3 changes: 2 additions & 1 deletion src/frontend/apps/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "app-e2e",
"version": "3.3.0",
"private": true,
"type": "module",
"scripts": {
"lint": "eslint . --ext .ts",
"lint": "eslint . --config ./eslint.config.js",
"install-playwright": "playwright install --with-deps",
"test": "playwright test",
"test:ui": "yarn test --ui",
Expand Down
14 changes: 0 additions & 14 deletions src/frontend/apps/impress/.eslintrc.js

This file was deleted.

66 changes: 66 additions & 0 deletions src/frontend/apps/impress/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import impressNextFlat from 'eslint-config-impress/next-flat';
import jest from 'eslint-plugin-jest';

export default [
...impressNextFlat,
{
ignores: ['node_modules/**', '.eslintrc.js', 'service-worker.js', '.next/**', 'out/**', 'build/**'],
},
{
// Additional browser and DOM globals for Next.js app
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
// DOM and HTML globals
HTMLElement: 'readonly',
HTMLDivElement: 'readonly',
SVGSVGElement: 'readonly',
Event: 'readonly',
KeyboardEvent: 'readonly',
MessageEvent: 'readonly',

// Web APIs
Request: 'readonly',
Response: 'readonly',
RequestInit: 'readonly',
Headers: 'readonly',
Blob: 'readonly',
File: 'readonly',
FormData: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
TextDecoder: 'readonly',
TextEncoder: 'readonly',
DOMParser: 'readonly',
IntersectionObserver: 'readonly',

// Service Worker globals
ServiceWorkerGlobalScope: 'readonly',
BodyInit: 'readonly',
self: 'readonly',
},
},
rules: {
// Allow some flexibility for escape characters in regex
'no-useless-escape': 'warn',
// Allow redeclaring for legitimate cases
'no-redeclare': 'warn',
},
},
{
// Jest configuration for test files
files: ['**/*.test.js', '**/*.test.ts', '**/*.test.tsx', '**/__tests__/**/*'],
plugins: {
jest,
},
languageOptions: {
globals: {
...jest.environments.globals.globals,
},
},
rules: {
...jest.configs.recommended.rules,
'jest/no-conditional-expect': 'warn',
},
},
];
2 changes: 0 additions & 2 deletions src/frontend/apps/impress/jest/mocks/ComponentMock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export const ComponentMock = () => {
return <div>My component mocked</div>;
};
6 changes: 3 additions & 3 deletions src/frontend/apps/impress/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const crypto = require('crypto');
import crypto from 'crypto';

const { InjectManifest } = require('workbox-webpack-plugin');
import { InjectManifest } from 'workbox-webpack-plugin';

const buildId = crypto.randomBytes(256).toString('hex').slice(0, 8);

Expand Down Expand Up @@ -62,4 +62,4 @@ const nextConfig = {
},
};

module.exports = nextConfig;
export default nextConfig;
1 change: 1 addition & 0 deletions src/frontend/apps/impress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "app-impress",
"version": "3.3.0",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "prettier --check . && yarn stylelint && next build",
Expand Down
16 changes: 16 additions & 0 deletions src/frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Root ESLint config for the frontend workspace
export default [
{
ignores: [
'node_modules/**',
'build/**',
'dist/**',
'.next/**',
'out/**',
// Let individual apps handle their own configs
'apps/**',
'packages/**',
'servers/**',
],
},
];
2 changes: 1 addition & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/react-dom": "19.1.6",
"@typescript-eslint/eslint-plugin": "8.33.1",
"@typescript-eslint/parser": "8.33.1",
"eslint": "8.57.0",
"eslint": "9.28.0",
"react": "19.1.0",
"react-dom": "19.1.0",
"typescript": "5.8.3",
Expand Down
Loading
Loading