diff options
| author | Doan Luu Duc Tai <doan@luuduct.ai> | 2026-10-31 13:08:08 -0500 |
|---|---|---|
| committer | Doan Luu Duc Tai <doan@luuduct.ai> | 2026-10-31 13:08:08 -0500 |
| commit | a80df869a92c330fbad9695057720b11a18af901 (patch) | |
| tree | 5307272821cb3adc3f0348413a3b904290890044 /eslint.config.ts | |
| parent | 9139398d465f5899cc31bc4cdd54daa7392ca550 (diff) | |
Forbid Rust lints and enforce strict typed TypeScript linting
Diffstat (limited to 'eslint.config.ts')
| -rw-r--r-- | eslint.config.ts | 53 |
1 files changed, 53 insertions, 0 deletions
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 <doan@luuduct.ai> +// +// 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 <https://www.gnu.org/licenses/>. + +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'], + }, + }, +); |
