Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eslint type import rule #429

Merged
merged 2 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = {
'newlines-between': 'always-and-inside-groups'
}],

'@typescript-eslint/consistent-type-imports': ['error'],
'@typescript-eslint/type-annotation-spacing': ['error'],

'array-callback-return': ['error'],
'arrow-spacing': ['error'],
'block-spacing': ['error'],
Expand Down Expand Up @@ -51,7 +54,6 @@ module.exports = {
'space-before-blocks': ['error'],
'space-before-function-paren': ['error', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always' }],
'space-infix-ops': 'error',
'@typescript-eslint/type-annotation-spacing': ['error'],
'yoda': 'error'
},
overrides: [
Expand Down
9 changes: 5 additions & 4 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import globalInstance, { AxiosInstance, AxiosResponse } from 'axios';
import type { AxiosInstance, AxiosResponse } from 'axios';
import globalInstance from 'axios';

import { Configuration } from './generated-client/configuration';
import { AuthenticationResult } from './generated-client/models/authentication-result';
import type { AuthenticationResult } from './generated-client/models/authentication-result';
import { ImageType } from './generated-client/models/image-type';
import { ClientInfo, DeviceInfo } from './models';
import { ImageRequestParameters } from './models/api/image-request-parameters';
import type { ClientInfo, DeviceInfo } from './models';
import type { ImageRequestParameters } from './models/api/image-request-parameters';
import { getAuthorizationHeader } from './utils';
import { getSessionApi } from './utils/api/session-api';
import { getUserApi } from './utils/api/user-api';
Expand Down
3 changes: 2 additions & 1 deletion src/discovery/discovery-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Jellyfin, RecommendedServerInfo, RecommendedServerInfoScore } from '..';
import type { Jellyfin, RecommendedServerInfo } from '..';
import { RecommendedServerInfoScore } from '..';

import { getAddressCandidates } from '../utils';

Expand Down
7 changes: 4 additions & 3 deletions src/discovery/recommended-server-discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { AxiosError, AxiosResponse } from 'axios';
import type { AxiosError, AxiosResponse } from 'axios';
import { compare } from 'compare-versions';

import { API_VERSION, Jellyfin, MINIMUM_VERSION, ProductNameIssue, RecommendedServerInfo, RecommendedServerInfoScore, RecommendedServerIssue, SlowResponseIssue, SystemInfoIssue, VersionMissingIssue, VersionOutdatedIssue, VersionUnsupportedIssue } from '..';
import { PublicSystemInfo } from '../generated-client/models/public-system-info';
import type { Jellyfin, RecommendedServerInfo, RecommendedServerIssue } from '..';
import { API_VERSION, MINIMUM_VERSION, ProductNameIssue, RecommendedServerInfoScore, SlowResponseIssue, SystemInfoIssue, VersionMissingIssue, VersionOutdatedIssue, VersionUnsupportedIssue } from '..';
import type { PublicSystemInfo } from '../generated-client/models/public-system-info';
import { getSystemApi } from '../utils/api/system-api';

/** The result of a SystemInfo request. */
Expand Down
4 changes: 2 additions & 2 deletions src/jellyfin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { AxiosInstance } from 'axios';
import type { AxiosInstance } from 'axios';

import { Api } from './api';
import { DiscoveryService } from './discovery';
import { ClientInfo, DeviceInfo } from './models';
import type { ClientInfo, DeviceInfo } from './models';

/** Parameters to create a Jellyfin SDK instance. */
export interface JellyfinParameters {
Expand Down
2 changes: 1 addition & 1 deletion src/models/api/image-request-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { ImageFormat } from '../../generated-client/models/image-format';
import type { ImageFormat } from '../../generated-client/models/image-format';

/**
* Interface representing supported request parameters for the getItemImage API.
Expand Down
4 changes: 2 additions & 2 deletions src/models/recommended-server-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { PublicSystemInfo } from '../generated-client/models/public-system-info';
import type { PublicSystemInfo } from '../generated-client/models/public-system-info';

import { RecommendedServerIssue } from './recommended-server-issue';
import type { RecommendedServerIssue } from './recommended-server-issue';

/** Possible score values for recommended servers. */
export enum RecommendedServerInfoScore {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/activity-log-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ActivityLogApi } from '../../generated-client/api/activity-log-api';

export function getActivityLogApi(api: Api): ActivityLogApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/api-key-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ApiKeyApi } from '../../generated-client/api/api-key-api';

export function getApiKeyApi(api: Api): ApiKeyApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/artists-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ArtistsApi } from '../../generated-client/api/artists-api';

export function getArtistsApi(api: Api): ArtistsApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/audio-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { AudioApi } from '../../generated-client/api/audio-api';

export function getAudioApi(api: Api): AudioApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/branding-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { BrandingApi } from '../../generated-client/api/branding-api';

export function getBrandingApi(api: Api): BrandingApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/channels-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ChannelsApi } from '../../generated-client/api/channels-api';

export function getChannelsApi(api: Api): ChannelsApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/client-log-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ClientLogApi } from '../../generated-client/api/client-log-api';

export function getClientLogApi(api: Api): ClientLogApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/collection-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { CollectionApi } from '../../generated-client/api/collection-api';

export function getCollectionApi(api: Api): CollectionApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/configuration-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ConfigurationApi } from '../../generated-client/api/configuration-api';

export function getConfigurationApi(api: Api): ConfigurationApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/dashboard-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { DashboardApi } from '../../generated-client/api/dashboard-api';

export function getDashboardApi(api: Api): DashboardApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/devices-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { DevicesApi } from '../../generated-client/api/devices-api';

export function getDevicesApi(api: Api): DevicesApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/display-preferences-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { DisplayPreferencesApi } from '../../generated-client/api/display-preferences-api';

export function getDisplayPreferencesApi(api: Api): DisplayPreferencesApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/dlna-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { DlnaApi } from '../../generated-client/api/dlna-api';

export function getDlnaApi(api: Api): DlnaApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/dlna-server-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { DlnaServerApi } from '../../generated-client/api/dlna-server-api';

export function getDlnaServerApi(api: Api): DlnaServerApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/dynamic-hls-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { DynamicHlsApi } from '../../generated-client/api/dynamic-hls-api';

export function getDynamicHlsApi(api: Api): DynamicHlsApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/environment-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { EnvironmentApi } from '../../generated-client/api/environment-api';

export function getEnvironmentApi(api: Api): EnvironmentApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/filter-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { FilterApi } from '../../generated-client/api/filter-api';

export function getFilterApi(api: Api): FilterApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/genres-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { GenresApi } from '../../generated-client/api/genres-api';

export function getGenresApi(api: Api): GenresApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/hls-segment-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { HlsSegmentApi } from '../../generated-client/api/hls-segment-api';

export function getHlsSegmentApi(api: Api): HlsSegmentApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/image-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ImageApi } from '../../generated-client/api/image-api';

export function getImageApi(api: Api): ImageApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/image-by-name-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ImageByNameApi } from '../../generated-client/api/image-by-name-api';

export function getImageByNameApi(api: Api): ImageByNameApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/instant-mix-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { InstantMixApi } from '../../generated-client/api/instant-mix-api';

export function getInstantMixApi(api: Api): InstantMixApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/item-lookup-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ItemLookupApi } from '../../generated-client/api/item-lookup-api';

export function getItemLookupApi(api: Api): ItemLookupApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/item-refresh-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ItemRefreshApi } from '../../generated-client/api/item-refresh-api';

export function getItemRefreshApi(api: Api): ItemRefreshApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/item-update-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ItemUpdateApi } from '../../generated-client/api/item-update-api';

export function getItemUpdateApi(api: Api): ItemUpdateApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/items-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { ItemsApi } from '../../generated-client/api/items-api';

export function getItemsApi(api: Api): ItemsApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/library-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { LibraryApi } from '../../generated-client/api/library-api';

export function getLibraryApi(api: Api): LibraryApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/library-structure-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { LibraryStructureApi } from '../../generated-client/api/library-structure-api';

export function getLibraryStructureApi(api: Api): LibraryStructureApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/live-tv-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { LiveTvApi } from '../../generated-client/api/live-tv-api';

export function getLiveTvApi(api: Api): LiveTvApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/localization-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { LocalizationApi } from '../../generated-client/api/localization-api';

export function getLocalizationApi(api: Api): LocalizationApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/media-info-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { MediaInfoApi } from '../../generated-client/api/media-info-api';

export function getMediaInfoApi(api: Api): MediaInfoApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/movies-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { MoviesApi } from '../../generated-client/api/movies-api';

export function getMoviesApi(api: Api): MoviesApi {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api/music-genres-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Api } from '../../api';
import type { Api } from '../../api';
import { MusicGenresApi } from '../../generated-client/api/music-genres-api';

export function getMusicGenresApi(api: Api): MusicGenresApi {
Expand Down
Loading