Updates ESLint configuration to: - Use latest globals for Node.js and browser environments - Enable type-aware TypeScript ESLint rules - Improve parser and ecmaVersion settings - Add explicit TypeScript ESLint plugin Increases code quality and type safety for the project
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
import globals from 'globals';
|
|
import eslint from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
export default tseslint.config(
|
|
// Ignore patterns (replaces .eslintignore)
|
|
{
|
|
ignores: [
|
|
'node_modules/**',
|
|
'main.js',
|
|
'dist/**',
|
|
'*.config.js',
|
|
'*.config.mjs'
|
|
]
|
|
},
|
|
// Base ESLint recommended rules
|
|
eslint.configs.recommended,
|
|
// TypeScript ESLint recommended rules
|
|
...tseslint.configs.recommended,
|
|
// Type-aware rules (requires tsconfig.json)
|
|
...tseslint.configs.recommendedTypeChecked,
|
|
// Project-specific configuration
|
|
{
|
|
files: ['**/*.ts'],
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
sourceType: 'module',
|
|
ecmaVersion: 'latest',
|
|
project: ['./tsconfig.json']
|
|
},
|
|
globals: {
|
|
...globals.node,
|
|
...globals.browser
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint.plugin
|
|
},
|
|
rules: {
|
|
// Disable base rule in favor of TypeScript version
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
'no-prototype-builtins': 'off',
|
|
'@typescript-eslint/no-empty-function': 'off'
|
|
}
|
|
}
|
|
);
|