// Copyright (C) 2026 Doan Luu Duc Tai // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import js from '@eslint/js'; import tseslint from 'typescript-eslint'; import { defineConfig } from 'eslint/config'; import { fileURLToPath } from 'node:url'; const root = fileURLToPath(new URL('../../../', import.meta.url)); export default defineConfig( { ignores: ['var/**', '.tools/**', 'node_modules/**', 'target/**', 'bin/**', 'dist/**'] }, { files: ['**/*.ts'], extends: [js.configs.recommended, tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], languageOptions: { parserOptions: { project: ['tsconfig.browser.json', 'tsconfig.worker.json', 'tsconfig.tests.json', 'tsconfig.tools.json'], tsconfigRootDir: root, }, }, linterOptions: { noInlineConfig: true, reportUnusedDisableDirectives: 'error', reportUnusedInlineConfigs: 'error' }, rules: { '@typescript-eslint/ban-ts-comment': ['error', { 'ts-check': true, 'ts-expect-error': true, 'ts-ignore': true, 'ts-nocheck': true }], '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }], '@typescript-eslint/explicit-function-return-type': 'error', '@typescript-eslint/explicit-module-boundary-types': 'error', '@typescript-eslint/no-unsafe-type-assertion': 'error', '@typescript-eslint/no-unsafe-call': 'error', '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: false }], '@typescript-eslint/no-misused-promises': 'error', '@typescript-eslint/strict-boolean-expressions': ['error', { allowString: false, allowNumber: false, allowNullableObject: false, allowNullableBoolean: false, allowNullableString: false, allowNullableNumber: false, allowAny: false }], '@typescript-eslint/switch-exhaustiveness-check': ['error', { requireDefaultForNonUnion: true }], '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error', 'no-restricted-syntax': ['error', { selector: 'TSAnyKeyword', message: 'Use unknown and validate untrusted values.' }, { selector: 'TSNonNullExpression', message: 'Check presence explicitly.' }], 'no-eval': 'error', 'no-implied-eval': 'error', 'eqeqeq': ['error', 'always'], }, }, );