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',
|
||||
|
||||
Generated
+17
-3
@@ -14,6 +14,7 @@
|
||||
"builtin-modules": "3.3.0",
|
||||
"esbuild": "0.17.3",
|
||||
"eslint": "^9.17.0",
|
||||
"globals": "^16.4.0",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "5.7.3",
|
||||
@@ -513,6 +514,19 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc/node_modules/globals": {
|
||||
"version": "14.0.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
||||
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "9.38.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.38.0.tgz",
|
||||
@@ -1463,9 +1477,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "14.0.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
||||
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
||||
"version": "16.4.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz",
|
||||
"integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"builtin-modules": "3.3.0",
|
||||
"esbuild": "0.17.3",
|
||||
"eslint": "^9.17.0",
|
||||
"globals": "^16.4.0",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "5.7.3",
|
||||
|
||||
Reference in new issue
Block a user