diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index e225c8b49..c874d21d5 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -122,7 +122,8 @@ }, { "description": "Every matched dependency becomes external.", - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } ] }, @@ -157,7 +158,8 @@ "FilterItemTypes": { "anyOf": [ { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, { "type": "string" @@ -238,7 +240,8 @@ "type": "boolean" }, { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } ] }, @@ -253,12 +256,14 @@ "type": "array", "items": { "description": "A regular expression, when matched the module is not parsed", - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, "minItems": 1 }, { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, { "instanceof": "Function", @@ -310,7 +315,8 @@ "type": "boolean" }, { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } ] }, @@ -340,7 +346,8 @@ }, "wrappedContextRegExp": { "description": "Set the inner regular expression for partial dynamic dependencies", - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } } }, @@ -554,7 +561,8 @@ "type": "string" }, { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, { "type": "object", @@ -642,13 +650,15 @@ "description": "Assign modules to a cache group by module name", "oneOf": [ { - "instanceof": "Function" + "instanceof": "Function", + "tsType": "Function" }, { "type": "string" }, { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } ] }, @@ -663,7 +673,8 @@ "type": "string" }, { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } ] } @@ -1210,7 +1221,8 @@ "RuleSetCondition": { "anyOf": [ { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, { "type": "string", diff --git a/schemas/plugins/BannerPlugin.json b/schemas/plugins/BannerPlugin.json index 555e29ed7..af313b90d 100644 --- a/schemas/plugins/BannerPlugin.json +++ b/schemas/plugins/BannerPlugin.json @@ -8,7 +8,8 @@ "Rule": { "oneOf": [ { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, { "type": "string", diff --git a/schemas/plugins/IgnorePlugin.json b/schemas/plugins/IgnorePlugin.json index 924073868..83cd78ad8 100644 --- a/schemas/plugins/IgnorePlugin.json +++ b/schemas/plugins/IgnorePlugin.json @@ -7,11 +7,13 @@ "properties": { "contextRegExp": { "description": "A RegExp to test the context (directory) against", - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, "resourceRegExp": { "description": "A RegExp to test the request against", - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" } } }, diff --git a/schemas/plugins/SourceMapDevToolPlugin.json b/schemas/plugins/SourceMapDevToolPlugin.json index 49ca38cf4..dd9d31090 100644 --- a/schemas/plugins/SourceMapDevToolPlugin.json +++ b/schemas/plugins/SourceMapDevToolPlugin.json @@ -3,7 +3,8 @@ "rule": { "oneOf": [ { - "instanceof": "RegExp" + "instanceof": "RegExp", + "tsType": "RegExp" }, { "type": "string", diff --git a/test/Schemas.lint.js b/test/Schemas.lint.js index 66503cd00..30fc1b52f 100644 --- a/test/Schemas.lint.js +++ b/test/Schemas.lint.js @@ -76,7 +76,7 @@ describe("Schemas", () => { } }); - if (Object.keys(item).indexOf("$ref") >= 0) { + if ("$ref" in item) { it("should not have other properties next to $ref", () => { const otherProperties = Object.keys(item).filter( p => p !== "$ref" @@ -91,6 +91,14 @@ describe("Schemas", () => { }); } + if ("instanceof" in item) { + it("should have tsType specified when using instanceof", () => { + if (!("tsType" in item)) { + throw new Error("When using instanceof, tsType is required"); + } + }); + } + arrayProperties.forEach(prop => { if (prop in item) { describe(prop, () => {