eslint-plugin-class-validator-type-match 4.1.8 → 4.1.9
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.
|
@@ -220,6 +220,20 @@ exports.default = createRule({
|
|
|
220
220
|
return false;
|
|
221
221
|
});
|
|
222
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* Helper: Check if property has @ValidateIf decorator
|
|
225
|
+
*/
|
|
226
|
+
const hasValidateIfDecorator = (node) => {
|
|
227
|
+
if (!node.decorators || node.decorators.length === 0)
|
|
228
|
+
return false;
|
|
229
|
+
return node.decorators.some((decorator) => {
|
|
230
|
+
const expr = decorator.expression;
|
|
231
|
+
if (expr.type === 'CallExpression' && expr.callee.type === 'Identifier') {
|
|
232
|
+
return expr.callee.name === 'ValidateIf';
|
|
233
|
+
}
|
|
234
|
+
return false;
|
|
235
|
+
});
|
|
236
|
+
};
|
|
223
237
|
/**
|
|
224
238
|
* Helper: Create fixer to add ? to property
|
|
225
239
|
*/
|
|
@@ -362,7 +376,7 @@ exports.default = createRule({
|
|
|
362
376
|
/**
|
|
363
377
|
* Priority 5: Property is optional (?) but missing @IsOptional() decorator
|
|
364
378
|
*/
|
|
365
|
-
if (isOptionalProperty && !hasDecorator) {
|
|
379
|
+
if (isOptionalProperty && !hasDecorator && !hasValidateIfDecorator(node)) {
|
|
366
380
|
issues.push({
|
|
367
381
|
messageId: 'missingOptionalDecorator',
|
|
368
382
|
});
|
|
@@ -371,7 +385,7 @@ exports.default = createRule({
|
|
|
371
385
|
* Priority 6: Type includes undefined but missing @IsOptional() and not optional
|
|
372
386
|
* Only check if strictNullChecks is enabled
|
|
373
387
|
*/
|
|
374
|
-
if (strictNullChecks && hasUndefined && !hasDecorator && !isOptionalProperty) {
|
|
388
|
+
if (strictNullChecks && hasUndefined && !hasDecorator && !isOptionalProperty && !hasValidateIfDecorator(node)) {
|
|
375
389
|
issues.push({
|
|
376
390
|
messageId: 'undefinedUnionWithoutDecorator',
|
|
377
391
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-class-validator-type-match",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.9",
|
|
4
4
|
"description": "ESLint plugin to ensure class-validator decorators match TypeScript type annotations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"eslint": "^9.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@typescript-eslint/utils": "8.
|
|
40
|
+
"@typescript-eslint/utils": "8.56.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@commitlint/cli": "20.
|
|
44
|
-
"@commitlint/config-conventional": "20.
|
|
45
|
-
"@eslint/js": "9.39.
|
|
46
|
-
"@typescript-eslint/parser": "8.
|
|
47
|
-
"@typescript-eslint/rule-tester": "8.
|
|
48
|
-
"@vitest/coverage-v8": "4.0.
|
|
49
|
-
"eslint": "9.39.
|
|
50
|
-
"globals": "17.
|
|
43
|
+
"@commitlint/cli": "20.4.2",
|
|
44
|
+
"@commitlint/config-conventional": "20.4.2",
|
|
45
|
+
"@eslint/js": "9.39.3",
|
|
46
|
+
"@typescript-eslint/parser": "8.56.1",
|
|
47
|
+
"@typescript-eslint/rule-tester": "8.56.1",
|
|
48
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
49
|
+
"eslint": "9.39.3",
|
|
50
|
+
"globals": "17.4.0",
|
|
51
51
|
"husky": "9.1.7",
|
|
52
|
-
"lint-staged": "16.
|
|
53
|
-
"prettier": "3.8.
|
|
52
|
+
"lint-staged": "16.3.1",
|
|
53
|
+
"prettier": "3.8.1",
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
|
-
"typescript-eslint": "8.
|
|
56
|
-
"vitest": "4.0.
|
|
55
|
+
"typescript-eslint": "8.56.1",
|
|
56
|
+
"vitest": "4.0.18"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
|
-
"node": "
|
|
59
|
+
"node": "25.7.0"
|
|
60
60
|
}
|
|
61
61
|
}
|