Enhances ESLint configuration for TypeScript project
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
This commit is contained in:
3 files changed
+29
-12
No files matched your search
+11
-9
@@ -1,3 +1,4 @@
|
||||
import globals from 'globals';
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
@@ -7,6 +8,7 @@ export default tseslint.config(
|
||||
ignores: [
|
||||
'node_modules/**',
|
||||
'main.js',
|
||||
'dist/**',
|
||||
'*.config.js',
|
||||
'*.config.mjs'
|
||||
]
|
||||
@@ -15,6 +17,8 @@ export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
// TypeScript ESLint recommended rules
|
||||
...tseslint.configs.recommended,
|
||||
// Type-aware rules (requires tsconfig.json)
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
// Project-specific configuration
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
@@ -22,19 +26,17 @@ export default tseslint.config(
|
||||
parser: tseslint.parser,
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2020
|
||||
ecmaVersion: 'latest',
|
||||
project: ['./tsconfig.json']
|
||||
},
|
||||
globals: {
|
||||
// Node.js globals
|
||||
console: 'readonly',
|
||||
process: 'readonly',
|
||||
__dirname: 'readonly',
|
||||
__filename: 'readonly',
|
||||
Buffer: 'readonly',
|
||||
setImmediate: 'readonly',
|
||||
clearImmediate: 'readonly'
|
||||
...globals.node,
|
||||
...globals.browser
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': tseslint.plugin
|
||||
},
|
||||
rules: {
|
||||
// Disable base rule in favor of TypeScript version
|
||||
'no-unused-vars': 'off',
|
||||
|
||||
Reference in new issue
Block a user