diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..e680809 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,27 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], + plugins: ['svelte3', '@typescript-eslint'], + ignorePatterns: ['*.cjs'], + overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], + settings: { + 'svelte3/typescript': () => require('typescript'), + }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2019, + }, + env: { + browser: true, + es2017: true, + node: true, + }, + rules: { + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + + }, +} \ No newline at end of file diff --git a/package.json b/package.json index f65f525..ee62b38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typed-hypixel-api", - "version": "0.1.10", + "version": "0.1.11", "main": "build/index.js", "types": "build/index.d.js", "repository": "https://github.com/skyblockstats/typed-hypixel-api.git", @@ -9,6 +9,12 @@ "files": [ "build" ], + "exports": { + "./responses": { + "require": "./v6.js", + "import": "./v6.mjs" + } + }, "dependencies": { "typescript": "^4.6.2", "undici": "^4.16.0" diff --git a/src/index.ts b/src/index.ts index 4c327db..2c4b2cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,16 +1,24 @@ -import { InvalidApiKeyResponse, MalformedUuidResponse, MissingFieldResponse, ThrottleResponse } from './responses/error' -import { SkyBlockCollectionsResponse } from './responses/resources/skyblock/collections' -import { SkyBlockSkillsResponse } from './responses/resources/skyblock/skills' -import { SkyBlockItemsResponse } from './responses/resources/skyblock/items' -import { SkyBlockProfilesResponse } from './responses/skyblock/profiles' -import { ApiKeyInformationResponse } from './responses/api' -import { PlayerDataResponse } from './responses/player' import { fetch } from 'undici' -import { FriendsResponse } from './responses/friends' -import { RecentGamesResponse } from './responses/recentgames' -import { OnlineStatusResponse } from './responses/status' -import { SkyBlockElectionResponse } from './responses/resources/skyblock/election' -import { SkyBlockProfileResponse } from './responses/skyblock/profile' +export * from './responses' +import { + ApiKeyInformationResponse, + FriendsResponse, + InvalidApiKeyResponse, + MalformedUuidResponse, + MissingFieldResponse, + OnlineStatusResponse, + PlayerDataResponse, + RecentGamesResponse, + SkyBlockCollectionsResponse, + SkyBlockElectionResponse, + SkyBlockItemsResponse, + SkyBlockProfileResponse, + SkyBlockProfilesResponse, + SkyBlockSkillsResponse, + ThrottleResponse +} from './responses' + + /** The base url of the Hypixel API with a trailing slash */ const BASE_URL = 'https://api.hypixel.net/' diff --git a/src/responses/index.ts b/src/responses/index.ts new file mode 100644 index 0000000..f84a95b --- /dev/null +++ b/src/responses/index.ts @@ -0,0 +1,12 @@ +export * from './resources/skyblock/collections' +export * from './resources/skyblock/election' +export * from './resources/skyblock/skills' +export * from './resources/skyblock/items' +export * from './skyblock/profiles' +export * from './skyblock/profile' +export * from './recentgames' +export * from './friends' +export * from './status' +export * from './player' +export * from './error' +export * from './api' diff --git a/src/responses/resources/skyblock/election.ts b/src/responses/resources/skyblock/election.ts index 1e130b4..61e7582 100644 --- a/src/responses/resources/skyblock/election.ts +++ b/src/responses/resources/skyblock/election.ts @@ -1,4 +1,4 @@ -interface Candidate { +export interface Candidate { key: string name: string perks: {