diff --git a/eslint.config.js b/eslint.config.js index a4c0ca7c..1e4ee457 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,6 +2,7 @@ import storybook from "eslint-plugin-storybook"; import boundaries from 'eslint-plugin-boundaries'; import unusedImports from 'eslint-plugin-unused-imports'; +import { importX } from 'eslint-plugin-import-x' import { defineConfig, globalIgnores } from "eslint/config"; @@ -73,6 +74,7 @@ export default defineConfig([ js, 'unused-imports': unusedImports, unicorn, + 'import-x': importX, }, rules: { ...defaultRules, @@ -103,9 +105,13 @@ export default defineConfig([ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md // -- this enforces that type-only imports are fixed to top-level type imports IE // import {type Foo, type Bar} from 'a'; => import type { Foo, Bar} from 'a'; - // "import/consistent-type-specifier-style": [ - // "error", "prefer-top-level-if-only-type-imports" - // ] + // + // USE eslint-plugin-import-x since its more actively developed? + // waiting on the status of this for supporting mixed inline types + // https://github.com/un-ts/eslint-plugin-import-x/issues/501 + // "import-x/consistent-type-specifier-style": [ + // "error", "prefer-top-level" + // ], "unicorn/prefer-then-catch": "error", "unicorn/consistent-destructuring": "warn", "unicorn/consistent-function-scoping": "warn", @@ -134,7 +140,9 @@ export default defineConfig([ languageOptions: { globals: { ...globals.node, - } + }, + ecmaVersion: 'latest', + sourceType: 'module', }, files: ['src/**/*.ts','src/**/*.tsx'] }, diff --git a/package-lock.json b/package-lock.json index 77c5f682..23d97b20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -171,6 +171,7 @@ "eslint": "^10.6.0", "eslint-import-resolver-typescript": "^4.4.5", "eslint-plugin-boundaries": "^7.0.2", + "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-mocha": "^11.3.0", "eslint-plugin-prefer-arrow-functions": "^3.2.4", "eslint-plugin-react-hooks": "^7.1.1", @@ -8895,6 +8896,16 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "license": "MIT" }, + "node_modules/comment-parser": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.7.tgz", + "integrity": "sha512-0h+uSNtQGW3D98eQt3jJ8L06Fves8hncB4V/PKdw/Qb8Hnk19VaKuTr55UNRYiSoVa7WwrFls+rh3ux9agmkeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/common-tags": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", @@ -10586,6 +10597,43 @@ "eslint": ">=6.0.0" } }, + "node_modules/eslint-plugin-import-x": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.17.1.tgz", + "integrity": "sha512-4cdstYkKCyjumM2Q9NSI03K8D2a9F4Ssz33K2lv2hQa4KmR9jPLwk3uWGtNvclfqBrPGfGuMBwsGMbe6dMRbfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "^8.56.0", + "comment-parser": "^1.4.1", + "debug": "^4.4.1", + "eslint-import-context": "^0.1.9", + "is-glob": "^4.0.3", + "minimatch": "^9.0.3 || ^10.1.2", + "semver": "^7.7.2", + "stable-hash-x": "^0.2.0", + "unrs-resolver": "^1.9.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-import-x" + }, + "peerDependencies": { + "@typescript-eslint/utils": "^8.56.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "eslint-import-resolver-node": "*" + }, + "peerDependenciesMeta": { + "@typescript-eslint/utils": { + "optional": true + }, + "eslint-import-resolver-node": { + "optional": true + } + } + }, "node_modules/eslint-plugin-mocha": { "version": "11.3.0", "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-11.3.0.tgz", diff --git a/package.json b/package.json index 2d04c74a..c13d4706 100644 --- a/package.json +++ b/package.json @@ -211,6 +211,7 @@ "eslint": "^10.6.0", "eslint-import-resolver-typescript": "^4.4.5", "eslint-plugin-boundaries": "^7.0.2", + "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-mocha": "^11.3.0", "eslint-plugin-prefer-arrow-functions": "^3.2.4", "eslint-plugin-react-hooks": "^7.1.1", diff --git a/src/backend/common/infrastructure/Atomic.ts b/src/backend/common/infrastructure/Atomic.ts index bfdf9381..e6682623 100644 --- a/src/backend/common/infrastructure/Atomic.ts +++ b/src/backend/common/infrastructure/Atomic.ts @@ -3,7 +3,8 @@ import type { Dayjs, ManipulateType } from "dayjs"; import type { Request, Response } from "express"; import type { NextFunction, ParamsDictionary, Query } from "express-serve-static-core"; import type { FixedSizeList } from 'fixed-size-list'; -import { type DeviceId, type ErrorLike, isPlayObject, type PlayMeta, type PlayObject, type PlayObjectMinimal, type PlayPlatformId, type PlayUserId, type UnixTimestamp } from "../../../core/Atomic.ts"; +import { isPlayObject } from "../../../core/Atomic.ts"; +import type {DeviceId, ErrorLike, PlayMeta, PlayObject, PlayObjectMinimal, PlayPlatformId, PlayUserId, UnixTimestamp} from "../../../core/Atomic.ts"; import type TupleMap from "../TupleMap.ts"; import type { MusicBrainzApi } from 'musicbrainz-api'; import type { ReportedPlayerStatus, SourceType } from "../../../core/Atomic.ts";