mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Syntax fixes (#5367)
* Declare return types on functions And a very few other type related minor fixes * Minor syntax fixes * Remove unnecessary escape chars in regexes * Remove unnecessary awaits * Replace deprecated req.connection with req.socket * Replace deprecated upload with uploadOne * Remove unnecessary eslint-disable-next-line comments * Comment empty functions / catch or finally clauses * Fix irregular whitespaces * Add missing returns (null) * Remove unreachable code * A few logical fixes * Remove / Handle non-null assertions which are certainly unnecessary (e.g. in tests)
This commit is contained in:
@@ -13,7 +13,7 @@ import * as exceptions from './exceptions';
|
||||
import * as services from './services';
|
||||
import database from './database';
|
||||
|
||||
export async function ensureFoldersExist() {
|
||||
export async function ensureFoldersExist(): Promise<void> {
|
||||
const folders = ['endpoints', 'hooks', 'interfaces', 'modules', 'layouts', 'displays'];
|
||||
|
||||
for (const folder of folders) {
|
||||
@@ -26,11 +26,11 @@ export async function ensureFoldersExist() {
|
||||
}
|
||||
}
|
||||
|
||||
export async function initializeExtensions() {
|
||||
export async function initializeExtensions(): Promise<void> {
|
||||
await ensureFoldersExist();
|
||||
}
|
||||
|
||||
export async function listExtensions(type: string) {
|
||||
export async function listExtensions(type: string): Promise<string[]> {
|
||||
const extensionsPath = env.EXTENSIONS_PATH as string;
|
||||
const location = path.join(extensionsPath, type);
|
||||
|
||||
@@ -46,12 +46,12 @@ export async function listExtensions(type: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function registerExtensions(router: Router) {
|
||||
export async function registerExtensions(router: Router): Promise<void> {
|
||||
await registerExtensionHooks();
|
||||
await registerExtensionEndpoints(router);
|
||||
}
|
||||
|
||||
export async function registerExtensionEndpoints(router: Router) {
|
||||
export async function registerExtensionEndpoints(router: Router): Promise<void> {
|
||||
let endpoints: string[] = [];
|
||||
try {
|
||||
endpoints = await listExtensions('endpoints');
|
||||
@@ -61,7 +61,7 @@ export async function registerExtensionEndpoints(router: Router) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function registerExtensionHooks() {
|
||||
export async function registerExtensionHooks(): Promise<void> {
|
||||
let hooks: string[] = [];
|
||||
try {
|
||||
hooks = await listExtensions('hooks');
|
||||
|
||||
Reference in New Issue
Block a user