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 eslint from '@eslint/js';
|
||||||
import tseslint from 'typescript-eslint';
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@ export default tseslint.config(
|
|||||||
ignores: [
|
ignores: [
|
||||||
'node_modules/**',
|
'node_modules/**',
|
||||||
'main.js',
|
'main.js',
|
||||||
|
'dist/**',
|
||||||
'*.config.js',
|
'*.config.js',
|
||||||
'*.config.mjs'
|
'*.config.mjs'
|
||||||
]
|
]
|
||||||
@@ -15,6 +17,8 @@ export default tseslint.config(
|
|||||||
eslint.configs.recommended,
|
eslint.configs.recommended,
|
||||||
// TypeScript ESLint recommended rules
|
// TypeScript ESLint recommended rules
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
|
// Type-aware rules (requires tsconfig.json)
|
||||||
|
...tseslint.configs.recommendedTypeChecked,
|
||||||
// Project-specific configuration
|
// Project-specific configuration
|
||||||
{
|
{
|
||||||
files: ['**/*.ts'],
|
files: ['**/*.ts'],
|
||||||
@@ -22,19 +26,17 @@ export default tseslint.config(
|
|||||||
parser: tseslint.parser,
|
parser: tseslint.parser,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
ecmaVersion: 2020
|
ecmaVersion: 'latest',
|
||||||
|
project: ['./tsconfig.json']
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
// Node.js globals
|
...globals.node,
|
||||||
console: 'readonly',
|
...globals.browser
|
||||||
process: 'readonly',
|
|
||||||
__dirname: 'readonly',
|
|
||||||
__filename: 'readonly',
|
|
||||||
Buffer: 'readonly',
|
|
||||||
setImmediate: 'readonly',
|
|
||||||
clearImmediate: 'readonly'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
plugins: {
|
||||||
|
'@typescript-eslint': tseslint.plugin
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
// Disable base rule in favor of TypeScript version
|
// Disable base rule in favor of TypeScript version
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
|
|||||||
Generated
+17
-3
@@ -14,6 +14,7 @@
|
|||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.17.3",
|
"esbuild": "0.17.3",
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
|
"globals": "^16.4.0",
|
||||||
"obsidian": "latest",
|
"obsidian": "latest",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "5.7.3",
|
"typescript": "5.7.3",
|
||||||
@@ -513,6 +514,19 @@
|
|||||||
"url": "https://opencollective.com/eslint"
|
"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": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "9.38.0",
|
"version": "9.38.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.38.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.38.0.tgz",
|
||||||
@@ -1463,9 +1477,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/globals": {
|
"node_modules/globals": {
|
||||||
"version": "14.0.0",
|
"version": "16.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz",
|
||||||
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
"integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.17.3",
|
"esbuild": "0.17.3",
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
|
"globals": "^16.4.0",
|
||||||
"obsidian": "latest",
|
"obsidian": "latest",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "5.7.3",
|
"typescript": "5.7.3",
|
||||||
|
|||||||
Reference in new issue
Block a user