web: Disallow const enums

This commit is contained in:
Nathan Adams 2023-11-20 19:32:14 +01:00
parent 770b671bc5
commit 5c6b544a11
3 changed files with 15 additions and 15 deletions

View File

@ -36,9 +36,9 @@ overrides:
'@typescript-eslint/no-unused-vars':
- error
- argsIgnorePattern: ^_
# Disallow non-const enums, as they generate unnecessary code.
# Taken from https://github.com/typescript-eslint/typescript-eslint/issues/561#issuecomment-593059472.
# Disallow const enums, as they can't be used by consumers.
# See https://www.typescriptlang.org/docs/handbook/enums.html#const-enum-pitfalls
no-restricted-syntax:
- error
- selector: 'TSEnumDeclaration:not([const=true])'
message: Don't declare non-const enums
- selector: 'TSEnumDeclaration[const=true]'
message: Don't declare const enums

View File

@ -1,7 +1,7 @@
/**
* Represents the various types of auto-play behaviours that are supported.
*/
export const enum AutoPlay {
export enum AutoPlay {
/**
* The player should automatically play the movie as soon as it is loaded.
*
@ -35,7 +35,7 @@ export const enum AutoPlay {
* When letterboxed, black bars will be rendered around the exterior
* margins of the content.
*/
export const enum Letterbox {
export enum Letterbox {
/**
* The content will never be letterboxed.
*/
@ -56,7 +56,7 @@ export const enum Letterbox {
* When the player is muted, this controls whether or not Ruffle will show a
* "click to unmute" overlay on top of the movie.
*/
export const enum UnmuteOverlay {
export enum UnmuteOverlay {
/**
* Show an overlay explaining that the movie is muted.
*/
@ -71,7 +71,7 @@ export const enum UnmuteOverlay {
/**
* Console logging level.
*/
export const enum LogLevel {
export enum LogLevel {
Error = "error",
Warn = "warn",
Info = "info",
@ -82,7 +82,7 @@ export const enum LogLevel {
/**
* The window mode of a Ruffle player.
*/
export const enum WindowMode {
export enum WindowMode {
/**
* The Flash content is rendered in its own window and layering is done with the browser's
* default behavior.
@ -122,7 +122,7 @@ export const enum WindowMode {
*
* The available backends may change in future releases.
*/
export const enum RenderBackend {
export enum RenderBackend {
/**
* An [in-development API](https://caniuse.com/webgpu) that will be preferred if available in the future.
* Should behave the same as wgpu-webgl, except with lower overhead and thus better performance.
@ -155,7 +155,7 @@ export const enum RenderBackend {
/**
* Represents the various context menu options that are supported.
*/
export const enum ContextMenu {
export enum ContextMenu {
/**
* The context menu should appear when right-clicking or long-pressing
* the Ruffle instance.
@ -198,7 +198,7 @@ export type Duration = SecsDuration | ObsoleteDuration;
/**
* The handling mode of links opening a new website.
*/
export const enum OpenURLMode {
export enum OpenURLMode {
/**
* Allow all links to open a new website.
*/
@ -218,7 +218,7 @@ export const enum OpenURLMode {
/**
* The networking API access mode of the Ruffle player.
*/
export const enum NetworkingAccessMode {
export enum NetworkingAccessMode {
/**
* All networking APIs are permitted in the SWF file.
*/

View File

@ -23,7 +23,7 @@ const DIMENSION_REGEX = /^\s*(\d+(\.\d+)?(%)?)/;
let isAudioContextUnmuted = false;
const enum PanicError {
enum PanicError {
Unknown,
CSPConflict,
FileProtocol,
@ -2365,7 +2365,7 @@ export class RufflePlayer extends HTMLElement {
/**
* Describes the loading state of an SWF movie.
*/
export const enum ReadyState {
export enum ReadyState {
/**
* No movie is loaded, or no information is yet available about the movie.
*/