]> git.proxmox.com Git - pve-eslint.git/blobdiff - eslint/lib/config/flat-config-schema.js
import 8.4.0 source
[pve-eslint.git] / eslint / lib / config / flat-config-schema.js
index c8cc711494090bfc932791836e1c9e227ea88ab7..cb8e7961add509f5c4e698f5850d75e7bcd30ddf 100644 (file)
@@ -195,13 +195,6 @@ function assertIsObjectOrString(value) {
 // Low-Level Schemas
 //-----------------------------------------------------------------------------
 
-
-/** @type {ObjectPropertySchema} */
-const numberSchema = {
-    merge: "replace",
-    validate: "number"
-};
-
 /** @type {ObjectPropertySchema} */
 const booleanSchema = {
     merge: "replace",
@@ -415,6 +408,18 @@ const rulesSchema = {
     }
 };
 
+/** @type {ObjectPropertySchema} */
+const ecmaVersionSchema = {
+    merge: "replace",
+    validate(value) {
+        if (typeof value === "number" || value === "latest") {
+            return;
+        }
+
+        throw new TypeError("Expected a number or \"latest\".");
+    }
+};
+
 /** @type {ObjectPropertySchema} */
 const sourceTypeSchema = {
     merge: "replace",
@@ -439,7 +444,7 @@ exports.flatConfigSchema = {
     },
     languageOptions: {
         schema: {
-            ecmaVersion: numberSchema,
+            ecmaVersion: ecmaVersionSchema,
             sourceType: sourceTypeSchema,
             globals: globalsSchema,
             parser: parserSchema,