diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index d82463b..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "env": { - "es2022": true, - "node": true - }, - "extends": [ - "eslint:recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:@typescript-eslint/recommended" - ], - "parserOptions": { - "parser": "@typescript-eslint/parser", - "ecmaVersion": 2022, - "sourceType": "module" - }, - "plugins": ["import"], - "rules": { - "import/first": "error", - "import/exports-last": "error", - "import/newline-after-import": "error", - "import/prefer-default-export": "error", - "import/group-exports": "error", - "import/no-duplicates": "error", - "import/no-amd": "error", - "import/no-commonjs": "error", - "import/order": [ - "error", - { - "newlines-between": "always", - "alphabetize": { - "order": "asc" - } - } - ], - "import/no-unused-modules": "error", - "import/no-mutable-exports": "error", - "import/no-extraneous-dependencies": [ - "error", - { "devDependencies": ["src/**/*.test.ts"] } - ], - "@typescript-eslint/explicit-function-return-type": "error" - }, - "settings": { - "import/resolver": { - "typescript": {} - } - } -} diff --git a/bun.lockb b/bun.lockb index 954c547..6d0fef0 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..aee7ef7 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,59 @@ +/* eslint-disable import-x/no-extraneous-dependencies */ +import js from '@eslint/js'; +import eslintPluginImportX from 'eslint-plugin-import-x'; +import globals from 'globals'; +import { configs as tsConfigs, parser as tsParser } from 'typescript-eslint'; + +export default [ + js.configs.recommended, + eslintPluginImportX.flatConfigs.recommended, + eslintPluginImportX.flatConfigs.typescript, + ...tsConfigs.recommended, + { + languageOptions: { + parser: tsParser, + globals: { + ...globals.node, + }, + ecmaVersion: 2020, + sourceType: 'module', + }, + rules: { + 'import-x/first': 'error', + 'import-x/exports-last': 'error', + 'import-x/newline-after-import': 'error', + 'import-x/prefer-default-export': 'error', + 'import-x/group-exports': 'error', + 'import-x/no-duplicates': 'error', + 'import-x/no-amd': 'error', + 'import-x/no-commonjs': 'error', + 'import-x/order': [ + 'error', + { + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + ], + 'newlines-between': 'always', + + alphabetize: { + order: 'asc', + }, + }, + ], + 'import-x/no-unused-modules': 'error', + 'import-x/no-mutable-exports': 'error', + 'import-x/no-extraneous-dependencies': [ + 'error', + { + devDependencies: ['src/**/*.test.ts'], + }, + ], + '@typescript-eslint/explicit-function-return-type': 'error', + }, + }, +]; diff --git a/package.json b/package.json index 8736b5f..9a98804 100644 --- a/package.json +++ b/package.json @@ -35,13 +35,14 @@ "prepack": "npm run build" }, "devDependencies": { + "@eslint/js": "^9.11.0", "@types/bun": "^1.1.8", - "@typescript-eslint/eslint-plugin": "^8.4.0", - "eslint": "^8.57.0", + "eslint": "^9.11.0", "eslint-import-resolver-typescript": "^3.6.3", - "eslint-plugin-import": "^2.30.0", + "eslint-plugin-import-x": "^4.2.1", "prettier": "^3.3.3", "typescript": "5.4.3", + "typescript-eslint": "^8.6.0", "vitest": "^2.0.5" } }