mirror of
https://github.com/jellyfin/jellyfin-sdk-typescript.git
synced 2024-11-23 05:59:44 +00:00
Update eslint rules
This commit is contained in:
parent
1ecca70e5e
commit
14adfb92ab
46
.eslintrc.js
46
.eslintrc.js
@ -2,10 +2,52 @@ module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'@typescript-eslint'
|
||||
],
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended'
|
||||
],
|
||||
rules: {
|
||||
'array-callback-return': ['error'],
|
||||
'block-spacing': ['error'],
|
||||
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
||||
'comma-dangle': ['error', 'never'],
|
||||
'comma-spacing': ['error'],
|
||||
'eol-last': ['error'],
|
||||
'indent': ['error', 'tab', { 'SwitchCase': 1 }],
|
||||
'jsx-quotes': ['error', 'prefer-single'],
|
||||
'keyword-spacing': ['error'],
|
||||
'max-statements-per-line': ['error'],
|
||||
'no-floating-decimal': ['error'],
|
||||
'no-multi-spaces': ['error'],
|
||||
'no-multiple-empty-lines': ['error', { 'max': 1 }],
|
||||
'no-restricted-globals': ['error'],
|
||||
'no-trailing-spaces': ['error'],
|
||||
'no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
|
||||
'one-var': ['error', 'never'],
|
||||
'padded-blocks': ['error', 'never'],
|
||||
'prefer-const': ['error', {'destructuring': 'all'}],
|
||||
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
|
||||
'semi': ['error'],
|
||||
'no-var': ['error'],
|
||||
'space-before-blocks': ['error'],
|
||||
'space-before-function-paren': ['error', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always' }],
|
||||
'space-infix-ops': 'error',
|
||||
'yoda': 'error'
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
'./src/**'
|
||||
],
|
||||
env: {
|
||||
node: false,
|
||||
browser: true
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -2,4 +2,4 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node'
|
||||
};
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ test('Test the BaseAPI constructor', () => {
|
||||
|
||||
const api = jellyfin.createApi(TEST_CONFIGURATION);
|
||||
expect(api.configuration.basePath).toEqual(SERVER_URL);
|
||||
expect(api.authorizationHeader).toEqual('MediaBrowser Client="jellyfin-sdk-typescript", Device="device-name", DeviceId="device-id", Version="v0.1.0", Token=""')
|
||||
expect(api.authorizationHeader).toEqual('MediaBrowser Client="jellyfin-sdk-typescript", Device="device-name", DeviceId="device-id", Version="v0.1.0", Token=""');
|
||||
});
|
||||
|
||||
test('Test public users api', async () => {
|
||||
@ -52,6 +52,6 @@ test('Test library api', async () => {
|
||||
await api.authenticateUserByName({ Username: 'demo', Pw: '' });
|
||||
|
||||
const libraries = await api.libraryApi.getMediaFolders();
|
||||
console.log('Libraries =>', libraries.data);
|
||||
// console.log('Libraries =>', libraries.data);
|
||||
expect(libraries.data).toBeTruthy();
|
||||
});
|
||||
|
@ -6,8 +6,8 @@
|
||||
import globalInstance, { AxiosResponse } from 'axios';
|
||||
import { getAuthorizationHeader } from '.';
|
||||
|
||||
import { ActivityLogApi, ApiKeyApi, ArtistsApi, AudioApi, AuthenticateUserByName, AuthenticationResult, BrandingApi, ChannelsApi, CollectionApi, Configuration, ConfigurationApi, DashboardApi, DevicesApi, DisplayPreferencesApi, DlnaApi, DlnaServerApi, DynamicHlsApi, EnvironmentApi, FilterApi, GenresApi, HlsSegmentApi, ImageApi, ImageByNameApi, InstantMixApi, ItemLookupApi, ItemRefreshApi, ItemsApi, ItemUpdateApi, LibraryApi, LibraryStructureApi, LiveTvApi, LocalizationApi, MediaInfoApi, MoviesApi, MusicGenresApi, NotificationsApi, PackageApi, PersonsApi, PlaylistsApi, PlaystateApi, PluginsApi, QuickConnectApi, RemoteImageApi, ScheduledTasksApi, SearchApi, SessionApi, StartupApi, StudiosApi, SubtitleApi, SuggestionsApi, SyncPlayApi, SystemApi, TimeSyncApi, TrailersApi, TvShowsApi, UniversalAudioApi, UserApi, UserLibraryApi, UserViewsApi, VideoAttachmentsApi, VideoHlsApi, VideosApi, YearsApi } from "./generated-client";
|
||||
import { ClientInfo, DeviceInfo } from "./models";
|
||||
import { ActivityLogApi, ApiKeyApi, ArtistsApi, AudioApi, AuthenticateUserByName, AuthenticationResult, BrandingApi, ChannelsApi, CollectionApi, Configuration, ConfigurationApi, DashboardApi, DevicesApi, DisplayPreferencesApi, DlnaApi, DlnaServerApi, DynamicHlsApi, EnvironmentApi, FilterApi, GenresApi, HlsSegmentApi, ImageApi, ImageByNameApi, InstantMixApi, ItemLookupApi, ItemRefreshApi, ItemsApi, ItemUpdateApi, LibraryApi, LibraryStructureApi, LiveTvApi, LocalizationApi, MediaInfoApi, MoviesApi, MusicGenresApi, NotificationsApi, PackageApi, PersonsApi, PlaylistsApi, PlaystateApi, PluginsApi, QuickConnectApi, RemoteImageApi, ScheduledTasksApi, SearchApi, SessionApi, StartupApi, StudiosApi, SubtitleApi, SuggestionsApi, SyncPlayApi, SystemApi, TimeSyncApi, TrailersApi, TvShowsApi, UniversalAudioApi, UserApi, UserLibraryApi, UserViewsApi, VideoAttachmentsApi, VideoHlsApi, VideosApi, YearsApi } from './generated-client';
|
||||
import { ClientInfo, DeviceInfo } from './models';
|
||||
|
||||
export const AUTHORIZATION_HEADER = 'X-Emby-Authorization';
|
||||
|
||||
@ -35,7 +35,7 @@ export class Api {
|
||||
this.configuration.apiKey = this.authorizationHeader;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for authenticating a user by name and updating the internal state.
|
||||
* @param authenticateUserByNameParam The authentication parameters object.
|
||||
|
@ -3,8 +3,8 @@
|
||||
* 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 { DeviceInfo } from "./generated-client";
|
||||
import { ClientInfo } from "./models";
|
||||
import { DeviceInfo } from './generated-client';
|
||||
import { ClientInfo } from './models';
|
||||
|
||||
/**
|
||||
* Returns a valid authorization header string.
|
||||
|
Loading…
Reference in New Issue
Block a user