brainy/eslint.config.js

86 lines
2 KiB
JavaScript
Raw Normal View History

import js from '@eslint/js'
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
export default [
js.configs.recommended,
{
files: ['src/**/*.ts', 'src/**/*.js'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
exports: 'writable',
module: 'writable',
require: 'readonly',
global: 'readonly',
URL: 'readonly'
}
},
plugins: {
'@typescript-eslint': tseslint
},
rules: {
// TypeScript specific rules
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'after-used',
argsIgnorePattern: '^_'
}
],
// Semi rule removed - not available in v9
// General rules
'no-unused-vars': 'off', // Using TypeScript rule instead
'no-extra-semi': 'off',
'semi': 'off', // Using TypeScript rule instead
'no-undef': 'off', // TypeScript handles this
'no-redeclare': 'off', // TypeScript handles this
// Allow console for logging
'no-console': 'off',
// Allow empty catch blocks with comment
'no-empty': ['error', { allowEmptyCatch: true }]
}
},
{
files: ['tests/**/*.ts', 'tests/**/*.js'],
languageOptions: {
globals: {
describe: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
vi: 'readonly',
test: 'readonly'
}
}
},
{
ignores: [
'dist/**',
'node_modules/**',
'*.min.js',
'coverage/**',
'.git/**',
'scripts/**/*.cjs',
'scripts/**/*.js',
'examples/**',
'bin/**'
]
}
]