Peter Makowski has proposed merging 
~petermakowski/maas-site-manager:eslint-restrict-enum into 
maas-site-manager:main.

Commit message:
test: disallow use of TS enums

Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~petermakowski/maas-site-manager/+git/site-manager/+merge/439604

Most TypeScript features are type-level extensions to JavaScript, and they 
don't affect the code's runtime behaviour. This rule is broken by enums.

enums generate additional code at compile time and are not part of core 
JavaScript language. Many people argue that their use should be avoided.

This merge proposal adds an eslint rule that disallows them suggesting to use 
objects or types instead.
-- 
Your team MAAS Committers is requested to review the proposed merge of 
~petermakowski/maas-site-manager:eslint-restrict-enum into 
maas-site-manager:main.
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 9675872..722eb61 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -67,6 +67,13 @@ module.exports = {
             ignoreRestSiblings: true,
           },
         ],
+        "no-restricted-syntax": [
+          "error",
+          {
+            selector: "TSEnumDeclaration",
+            message: "Avoid enums, use const or string literal instead",
+          },
+        ],
         "@typescript-eslint/consistent-type-imports": 2,
         "import/namespace": "off",
         "import/no-named-as-default": 0,
-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to