stock-bot/eslint.config.js
2026-10-20 14:35:45 -04:00

116 lines
2.7 KiB
JavaScript

import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
export default [
// Global ignores first
{
ignores: [
'dist/**',
'build/**',
'node_modules/**',
'**/dist/**',
'**/build/**',
'**/node_modules/**',
'**/.turbo/**',
'**/coverage/**',
'**/*.js',
'**/*.mjs',
'**/*.d.ts',
'.turbo/**',
'coverage/**',
'scripts/**',
'monitoring/**',
'database/**',
'**/.angular/**',
'**/src/polyfills.ts',
],
},
// Base JavaScript configuration
js.configs.recommended,
{
files: ['**/*.cjs'],
languageOptions: {
globals: { __dirname: 'readonly', require: 'readonly', module: 'readonly' },
},
},
// TypeScript configuration
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
// Disable base rules that are covered by TypeScript equivalents
'no-unused-vars': 'off',
'no-undef': 'off',
// TypeScript specific rules
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
// General rules
'no-console': 'warn',
'no-debugger': 'error',
'no-var': 'error',
'prefer-const': 'error',
eqeqeq: ['error', 'always'],
curly: ['error', 'all'],
},
},
// Handler files configuration
{
files: ['**/*.handler.ts'],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_|Handler$', // Ignore classes ending with Handler
destructuredArrayIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
// Test files configuration
{
files: ['**/*.test.ts', '**/*.spec.ts', '**/test/**/*', '**/tests/**/*'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'no-console': 'off',
},
},
// Console output is the interface of CLIs, examples, and the browser log sink.
{
files: [
'**/examples/**',
'**/scripts/**',
'tools/coverage-cli/**',
'**/web-app/src/utils/browserLog.ts',
],
rules: { 'no-console': 'off' },
},
];