eslint-config-webpack 4.12.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-webpack",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "Provides Webpack's eslint rules as an extensible shared config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -159,6 +159,31 @@ export const rule = {
159
159
  });
160
160
  }
161
161
 
162
+ const minLength = getKeyword(node, "minLength");
163
+
164
+ if (
165
+ minLength &&
166
+ !(minLength.value.type === "JSONLiteral" && minLength.value.value === 1)
167
+ ) {
168
+ context.report({
169
+ loc: minLength.key.loc,
170
+ messageId: "minLengthMustBeOne",
171
+ });
172
+ }
173
+
174
+ const enumKeyword = getKeyword(node, "enum");
175
+
176
+ if (enumKeyword && enumKeyword.value.type === "JSONArrayExpression") {
177
+ for (const element of enumKeyword.value.elements) {
178
+ if (element && element.type !== "JSONLiteral") {
179
+ context.report({
180
+ loc: element.loc,
181
+ messageId: "enumRequiresPrimitive",
182
+ });
183
+ }
184
+ }
185
+ }
186
+
162
187
  const absolutePath = getKeyword(node, "absolutePath");
163
188
 
164
189
  if (absolutePath && !isStringLiteral(type && type.value, "string")) {
@@ -292,8 +317,12 @@ export const rule = {
292
317
  'When using "absolutePath", "type" must be "string".',
293
318
  combinatorMultipleItems: '"{{keyword}}" must have more than one item.',
294
319
  emptyCombinator: '"{{keyword}}" must not be empty.',
320
+ enumRequiresPrimitive:
321
+ '"enum" must only hold primitive values, the precompiled validator cannot compare anything else.',
295
322
  instanceofRequiresTsType:
296
323
  'When using "instanceof", "tsType" is required.',
324
+ minLengthMustBeOne:
325
+ '"minLength" must be 1, the precompiled validator emits no other length check.',
297
326
  invalidDescription:
298
327
  "Description should start with an uppercase letter and end with a single dot.",
299
328
  missingAdditionalProperties: