diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 78bad1d..6b4b348 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,6 @@ { "recommendations": [ "editorconfig.editorconfig", + "dbaeumer.vscode-eslint", ] } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..0495c32 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,33 @@ +// @ts-check + +import eslint from '@eslint/js' +import globals from 'globals' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.strictTypeChecked, + { + files: ['**/*.ts'], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + }, + { + files: ['**/*.js'], + extends: [ + tseslint.configs.disableTypeChecked, + ], + languageOptions: { + ecmaVersion: 'latest', + globals: { ...globals.node }, + sourceType: 'module', + }, + }, + { + ignores: ['out/*'], + }, +) diff --git a/package.json b/package.json index f14de80..6a534c0 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "private": true, "scripts": { "dev": "node scripts/dev.js", - "build": "tsc -noEmit -skipLibCheck && node scripts/esbuild.build.js production" + "build": "tsc -noEmit -skipLibCheck && node scripts/esbuild.build.js production", + "test:eslint": "eslint --cache --cache-location out/.eslintcache" }, "keywords": [ "obsidian.md", @@ -14,12 +15,16 @@ "author": "Kirill Gavrilov", "license": "MIT", "devDependencies": { + "@eslint/js": "9.18.0", "@types/node": "22.10.7", "enquirer": "2.4.1", "esbuild": "0.24.2", + "eslint": "9.18.0", + "globals": "15.14.0", "obsidian": "1.7.2", "obsidian-utils": "0.10.2", - "typescript": "5.7.3" + "typescript": "5.7.3", + "typescript-eslint": "8.21.0" }, "packageManager": "pnpm@9.15.4" }