diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 1af6ee58..6662510e 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -80,7 +80,9 @@ module.exports = { version: 'detect', }, 'import/resolver': { - typescript: {}, // this loads /tsconfig.json to eslint + typescript: { + project: 'packages/core/tsconfig.json', + }, // this loads /tsconfig.json to eslint }, 'import/core-modules': ['src'], }, diff --git a/packages/core/src/backends/proxy/implementation.ts b/packages/core/src/backends/proxy/implementation.ts index b7410b3a..c4e88015 100644 --- a/packages/core/src/backends/proxy/implementation.ts +++ b/packages/core/src/backends/proxy/implementation.ts @@ -10,6 +10,7 @@ import type { ImplementationFile, PersistOptions, User, + ImplementationMediaFile, } from '@staticcms/core/interface'; import type { Cursor } from '@staticcms/core/lib/util'; import type AssetProxy from '@staticcms/core/valueObjects/AssetProxy'; @@ -89,7 +90,7 @@ export default class ProxyBackend implements BackendClass { return Promise.resolve(''); } - async request(payload: { action: string; params: Record }) { + async request(payload: { action: string; params: Record }): Promise { const response = await unsentRequest.fetchWithTimeout(this.proxyUrl, { method: 'POST', headers: { 'Content-Type': 'application/json; charset=utf-8' }, @@ -105,28 +106,32 @@ export default class ProxyBackend implements BackendClass { } } - entriesByFolder(folder: string, extension: string, depth: number) { + entriesByFolder( + folder: string, + extension: string, + depth: number, + ): Promise { return this.request({ action: 'entriesByFolder', params: { branch: this.branch, folder, extension, depth }, }); } - entriesByFiles(files: ImplementationFile[]) { + entriesByFiles(files: ImplementationFile[]): Promise { return this.request({ action: 'entriesByFiles', params: { branch: this.branch, files }, }); } - getEntry(path: string) { + getEntry(path: string): Promise { return this.request({ action: 'getEntry', params: { branch: this.branch, path }, }); } - async persistEntry(entry: BackendEntry, options: PersistOptions) { + async persistEntry(entry: BackendEntry, options: PersistOptions): Promise { const assets = await Promise.all(entry.assets.map(serializeAsset)); return this.request({ action: 'persistEntry', @@ -153,8 +158,8 @@ export default class ProxyBackend implements BackendClass { }); } - async getMediaFile(path: string) { - const file = await this.request({ + async getMediaFile(path: string): Promise { + const file = await this.request({ action: 'getMediaFile', params: { branch: this.branch, path }, }); @@ -187,10 +192,10 @@ export default class ProxyBackend implements BackendClass { } allEntriesByFolder( - _folder: string, - _extension: string, - _depth: number, + folder: string, + extension: string, + depth: number, ): Promise { - throw new Error('Not supported'); + return this.entriesByFolder(folder, extension, depth); } }