Files
homelab-upgrade/eslint.config.js
homelab-updaterandClaude Opus 5 cfbf5038c1
ci / check (push) Successful in 1m12s
ci / publish (push) Successful in 45s
fix(web): measure function source size without Buffer
Creating a function in the browser failed with 'Buffer is not defined':
the zod schema in domain/workflow-function.ts is bundled into the web app.
TextEncoder works in both. A lint rule now rejects Buffer/process in
domain and web, since Vitest runs in Node and cannot catch this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 18:18:26 +02:00

34 lines
1.2 KiB
JavaScript

import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import { layerRules } from './tools/layer-rules.ts';
export default tseslint.config(
{ ignores: ['node_modules/', 'dist/', 'coverage/'] },
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
},
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
},
},
...layerRules,
// domain is bundled into the browser with web: Node-only globals break there at runtime, not in Vitest (Node).
{
files: ['src/domain/**/*.ts', 'src/web/**/*.{ts,tsx}'],
ignores: ['**/*.test.{ts,tsx}'],
rules: {
'no-restricted-globals': ['error',
{ name: 'Buffer', message: 'Not in the browser: use TextEncoder/TextDecoder.' },
{ name: 'process', message: 'Not in the browser.' },
],
},
},
{ files: ['*.config.js'], ...tseslint.configs.disableTypeChecked },
);