From d9cd098b61285780b3f190259216df22d32d983b Mon Sep 17 00:00:00 2001 From: clfreville2 Date: Wed, 20 Mar 2024 19:35:31 +0100 Subject: [PATCH] Switch to ESLint flat configs --- .eslintrc.cjs | 12 ------------ eslint.config.js | 15 +++++++++++++++ package.json | 15 ++++++++------- src/editor/GraphEditor.ts | 2 +- tsconfig.json | 2 +- 5 files changed, 25 insertions(+), 21 deletions(-) delete mode 100644 .eslintrc.cjs create mode 100644 eslint.config.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 0829442..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - env: { - browser: true, - }, - root: true, - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - rules: { - '@typescript-eslint/no-explicit-any': 'warn', - }, -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..6d403e2 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,15 @@ +// @ts-check + +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import globals from "globals"; + +export default tseslint.config( + { + ...eslint.configs.recommended, + languageOptions: { + globals: globals.browser + } + }, + ...tseslint.configs.recommended, +); diff --git a/package.json b/package.json index 0ab93bf..97e9d7b 100644 --- a/package.json +++ b/package.json @@ -9,16 +9,17 @@ "preview": "vite preview" }, "devDependencies": { + "@eslint/js": "^8.57.0", "@types/d3": "^7.4.3", - "@types/node": "^20.11.16", - "@typescript-eslint/eslint-plugin": "^6.20.0", - "@typescript-eslint/parser": "^6.20.0", - "eslint": "^8.56.0", - "typescript": "^5.3.3", - "vite": "^5.0.12" + "@types/eslint__js": "^8.42.3", + "eslint": "^8.57.0", + "globals": "^14.0.0", + "typescript": "^5.4.2", + "typescript-eslint": "^7.3.1", + "vite": "^5.2.2" }, "dependencies": { - "d3": "^7.8.5", + "d3": "^7.9.0", "ml-matrix": "^6.11.0" } } diff --git a/src/editor/GraphEditor.ts b/src/editor/GraphEditor.ts index cb41cb3..be2c6c4 100644 --- a/src/editor/GraphEditor.ts +++ b/src/editor/GraphEditor.ts @@ -26,7 +26,7 @@ export const debounce = ) => ReturnType>( func: F, waitFor: number = 150, ) => { - let timeout: NodeJS.Timeout; + let timeout: ReturnType; return (...args: Parameters) => { clearTimeout(timeout); diff --git a/tsconfig.json b/tsconfig.json index e93c9eb..591aec8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "useDefineForClassFields": true, "module": "ESNext", "lib": ["ESNext", "DOM", "DOM.Iterable"], - "types": ["@types/node", "vite/client"], + "types": ["vite/client"], "skipLibCheck": true, "allowJs": true, "checkJs": true,