refactor: use eslint-config-neon for packages. (#8579)

Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
Suneet Tipirneni
2022-09-01 14:50:16 -04:00
committed by GitHub
parent 4bdb0593ae
commit edadb9fe5d
219 changed files with 2608 additions and 2053 deletions

View File

@@ -1,12 +1,14 @@
/* eslint-disable jsdoc/check-param-names */
import { URL } from 'node:url';
import {
ALLOWED_EXTENSIONS,
ALLOWED_SIZES,
ALLOWED_STICKER_EXTENSIONS,
DefaultRestOptions,
ImageExtension,
ImageSize,
StickerExtension,
} from './utils/constants';
type ImageExtension,
type ImageSize,
type StickerExtension,
} from './utils/constants.js';
/**
* The options used for image URLs
@@ -38,6 +40,10 @@ export interface ImageURLOptions extends BaseImageURLOptions {
* The options to use when making a CDN URL
*/
export interface MakeURLOptions {
/**
* The allowed extensions that can be used
*/
allowedExtensions?: readonly string[];
/**
* The extension to use for the image URL
*
@@ -48,10 +54,6 @@ export interface MakeURLOptions {
* The size specified in the image URL
*/
size?: ImageSize;
/**
* The allowed extensions that can be used
*/
allowedExtensions?: ReadonlyArray<string>;
}
/**
@@ -192,6 +194,7 @@ export class CDN {
/**
* Generates a URL for the icon of a role
*
* @param roleId - The id of the role that has the icon
* @param roleIconHash - The hash provided by Discord for this role icon
* @param options - Optional options for the role icon
@@ -285,6 +288,7 @@ export class CDN {
route: string,
{ allowedExtensions = ALLOWED_EXTENSIONS, extension = 'webp', size }: Readonly<MakeURLOptions> = {},
): string {
// eslint-disable-next-line no-param-reassign
extension = String(extension).toLowerCase();
if (!allowedExtensions.includes(extension)) {