From a80df869a92c330fbad9695057720b11a18af901 Mon Sep 17 00:00:00 2001 From: Doan Luu Duc Tai Date: Sat, 31 Oct 2026 13:08:08 -0500 Subject: Forbid Rust lints and enforce strict typed TypeScript linting --- eslint.config.ts | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 eslint.config.ts (limited to 'eslint.config.ts') diff --git a/eslint.config.ts b/eslint.config.ts new file mode 100644 index 0000000..4ad21d6 --- /dev/null +++ b/eslint.config.ts @@ -0,0 +1,53 @@ +// 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'], + }, + }, +); -- cgit v1.2.3