@darraghor/eslint-plugin-nestjs-typed 6.0.0-rc.7 → 6.0.0-rc.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.
- package/dist/configs/base.d.ts +8 -0
- package/dist/configs/index.d.ts +11 -0
- package/dist/configs/noSwagger.d.ts +6 -0
- package/dist/configs/recommended.d.ts +6 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +21 -24
- package/dist/rules/allPropertiesAreWhitelisted/allPropertiesAreWhitelisted.d.ts +2 -0
- package/dist/rules/allPropertiesHaveExplicitDefined/allPropertiesHaveExplicitDefined.d.ts +3 -0
- package/dist/rules/apiEnumPropertyBestPractices/apiEnumPropertyBestPractices.d.ts +6 -0
- package/dist/rules/apiEnumPropertyBestPractices/enumTestResultModel.d.ts +7 -0
- package/dist/rules/apiMethodsShouldBeGuarded/apiMethodsShouldBeGuarded.d.ts +4 -0
- package/dist/rules/apiMethodsShouldSpecifyApiOperation/apiMethodsShouldSpecifyApiOperation.d.ts +4 -0
- package/dist/rules/apiMethodsShouldSpecifyApiResponse/apiMethodsShouldSpecifyApiResponse.d.ts +4 -0
- package/dist/rules/apiPropertyMatchesPropertyOptionality/apiPropertyMatchesPropertyOptionality.d.ts +5 -0
- package/dist/rules/apiPropertyReturningArrayShouldSetArray/apiPropertyReturningArrayShouldSetArray.d.ts +5 -0
- package/dist/rules/apiPropertyReturningArrayShouldSetArray/arraySetResultModel.d.ts +5 -0
- package/dist/rules/controllerDecoratedHasApiTags/controllerDecoratedHasApiTags.d.ts +4 -0
- package/dist/rules/index.d.ts +23 -0
- package/dist/rules/injectablesShouldBeProvided/injectableShouldBeProvided.d.ts +9 -0
- package/dist/rules/noDuplicateDecorators/noDuplicateDecorators.d.ts +9 -0
- package/dist/rules/paramDecoratorNameMatchesRouteParam/paramDecoratorNameMatchesRouteParam.d.ts +21 -0
- package/dist/rules/paramDecoratorNameMatchesRouteParam/rule.testData.d.ts +10 -0
- package/dist/rules/providerInjectedShouldMatchFactory/ProviderInjectedShouldMatchFactory.d.ts +4 -0
- package/dist/rules/shouldSpecifyForbidUnknownValues/shouldSpecifyForbidUnknownValuesRule.d.ts +7 -0
- package/dist/rules/sortModuleMetadataArrays/sortModuleMetadataArrays.d.ts +11 -0
- package/dist/rules/validateNestedOfArrayShouldSetEach/arraySetResultModel.d.ts +5 -0
- package/dist/rules/validateNestedOfArrayShouldSetEach/validateNestedOfArrayShouldSetEach.d.ts +5 -0
- package/dist/rules/validateNonPrimitiveNeedsTypeDecorator/validateNonPrimitiveNeedsDecorators.d.ts +10 -0
- package/dist/testing/fixtureSetup.d.ts +1 -0
- package/dist/testing/preRun.d.ts +1 -0
- package/dist/utils/ast.d.ts +2 -0
- package/dist/utils/createRule.d.ts +2 -0
- package/dist/utils/files/customFileEnumeratorWrapper.d.ts +8 -0
- package/dist/utils/files/isFilteredPath.d.ts +4 -0
- package/dist/utils/nestModules/models/NestProvidedInjectablesMap.d.ts +5 -0
- package/dist/utils/nestModules/nestModuleAstParser.d.ts +7 -0
- package/dist/utils/nestModules/nestProvidedInjectableMapper.d.ts +14 -0
- package/dist/utils/nestModules/nestProvidedInjectableMapper.testData.d.ts +7 -0
- package/dist/utils/nestModules/nestProviderAstParser.d.ts +7 -0
- package/dist/utils/typedTokenHelpers.d.ts +59 -0
- package/dist/utils/wellKnownSelectors.d.ts +1 -0
- package/package.json +10 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const allConfigs: {
|
|
2
|
+
recommended: {
|
|
3
|
+
extends: string[];
|
|
4
|
+
rules: Partial<import("eslint").Linter.RulesRecord>;
|
|
5
|
+
};
|
|
6
|
+
"no-swagger": {
|
|
7
|
+
extends: string[];
|
|
8
|
+
rules: Partial<import("eslint").Linter.RulesRecord>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default allConfigs;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint";
|
|
2
|
+
import { TSESLint } from "@typescript-eslint/utils";
|
|
3
|
+
export declare const parser: TSESLint.FlatConfig.Parser;
|
|
4
|
+
export declare const plugin: TSESLint.FlatConfig.Plugin;
|
|
5
|
+
declare const classicPlugin: {
|
|
6
|
+
configs: {
|
|
7
|
+
recommended: {
|
|
8
|
+
extends: string[];
|
|
9
|
+
rules: Partial<import("eslint").Linter.RulesRecord>;
|
|
10
|
+
};
|
|
11
|
+
"no-swagger": {
|
|
12
|
+
extends: string[];
|
|
13
|
+
rules: Partial<import("eslint").Linter.RulesRecord>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
rules: {
|
|
17
|
+
"all-properties-have-explicit-defined": TSESLint.RuleModule<"missing-is-defined-decorator" | "missing-is-optional-decorator" | "conflicting-defined-decorators-defined-optional" | "conflicting-defined-decorators-defined-validate-if" | "conflicting-defined-decorators-optional-validate-if" | "conflicting-defined-decorators-all", [], unknown, TSESLint.RuleListener>;
|
|
18
|
+
"api-property-matches-property-optionality": TSESLint.RuleModule<"shouldUseOptionalDecorator" | "shouldUseRequiredDecorator", [], unknown, TSESLint.RuleListener>;
|
|
19
|
+
"injectable-should-be-provided": TSESLint.RuleModule<"injectableInModule" | "controllersInModule", [{
|
|
20
|
+
src: string[];
|
|
21
|
+
filterFromPaths: string[];
|
|
22
|
+
}], unknown, TSESLint.RuleListener>;
|
|
23
|
+
"no-duplicate-decorators": TSESLint.RuleModule<"noDuplicateDecorators", import("./rules/noDuplicateDecorators/noDuplicateDecorators").NoDuplicateDecoratorsOptions, unknown, TSESLint.RuleListener>;
|
|
24
|
+
"provided-injected-should-match-factory-parameters": TSESLint.RuleModule<"mainMessage", [], unknown, TSESLint.RuleListener>;
|
|
25
|
+
"controllers-should-supply-api-tags": TSESLint.RuleModule<"shouldUseApiTagDecorator", [], unknown, TSESLint.RuleListener>;
|
|
26
|
+
"api-method-should-specify-api-response": TSESLint.RuleModule<"shouldSpecifyApiResponse", [], unknown, TSESLint.RuleListener>;
|
|
27
|
+
"api-method-should-specify-api-operation": TSESLint.RuleModule<"shouldSpecifyApiOperation", [], unknown, TSESLint.RuleListener>;
|
|
28
|
+
"api-enum-property-best-practices": TSESLint.RuleModule<"needsEnumNameAdded" | "needsTypeRemoved" | "enumNameShouldMatchType", [], unknown, TSESLint.RuleListener>;
|
|
29
|
+
"api-property-returning-array-should-set-array": TSESLint.RuleModule<"shouldSetArrayPropertyTrue" | "shouldSetArrayPropertyFalse", [], unknown, TSESLint.RuleListener>;
|
|
30
|
+
"should-specify-forbid-unknown-values": TSESLint.RuleModule<"shouldSpecifyForbidUnknownValues", [], unknown, TSESLint.RuleListener>;
|
|
31
|
+
"param-decorator-name-matches-route-param": TSESLint.RuleModule<"paramIdentifierDoesntNeedColon" | "paramIdentifierShouldMatch", [], unknown, TSESLint.RuleListener>;
|
|
32
|
+
"validated-non-primitive-property-needs-type-decorator": TSESLint.RuleModule<"shouldUseTypeDecorator" | "autofixWithTypeDecorator", import("./rules/validateNonPrimitiveNeedsTypeDecorator/validateNonPrimitiveNeedsDecorators").ValidateNonPrimitivePropertyTypeDecoratorOptions, unknown, TSESLint.RuleListener>;
|
|
33
|
+
"validate-nested-of-array-should-set-each": TSESLint.RuleModule<"shouldSetEachPropertyTrue" | "shouldSetEachPropertyFalse", [], unknown, TSESLint.RuleListener>;
|
|
34
|
+
"all-properties-are-whitelisted": TSESLint.RuleModule<"missing-property-decorator", [], unknown, TSESLint.RuleListener>;
|
|
35
|
+
"api-methods-should-be-guarded": TSESLint.RuleModule<"apiMethodsShouldBeGuarded", [], unknown, TSESLint.RuleListener>;
|
|
36
|
+
"sort-module-metadata-arrays": TSESLint.RuleModule<"moduleMetadataArraysAreSorted", import("./rules/sortModuleMetadataArrays/sortModuleMetadataArrays").RuleOptions, unknown, TSESLint.RuleListener>;
|
|
37
|
+
};
|
|
38
|
+
meta: {
|
|
39
|
+
name: string;
|
|
40
|
+
version: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export { classicPlugin };
|
|
44
|
+
export type ConfigArray = TSESLint.FlatConfig.ConfigArray;
|
|
45
|
+
declare const _default: {
|
|
46
|
+
plugin: FlatConfig.Plugin;
|
|
47
|
+
configs: {
|
|
48
|
+
flatRecommended: ConfigArray;
|
|
49
|
+
flatNoSwagger: ConfigArray;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -37,9 +37,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.classicPlugin = exports.plugin = exports.parser = void 0;
|
|
40
|
-
exports.flatBaseConfig = flatBaseConfig;
|
|
41
|
-
exports.flatRecommendedConfig = flatRecommendedConfig;
|
|
42
|
-
exports.flatNoSwaggerConfig = flatNoSwaggerConfig;
|
|
43
40
|
const configs_1 = __importDefault(require("./configs"));
|
|
44
41
|
const rules_1 = __importDefault(require("./rules"));
|
|
45
42
|
const parserBase = __importStar(require("@typescript-eslint/parser"));
|
|
@@ -66,7 +63,7 @@ const classicPlugin = {
|
|
|
66
63
|
meta,
|
|
67
64
|
};
|
|
68
65
|
exports.classicPlugin = classicPlugin;
|
|
69
|
-
|
|
66
|
+
const flatBaseConfig = (plugin, parser) => {
|
|
70
67
|
const baseConfig = {
|
|
71
68
|
name: "@darraghor/nestjs-typed/base",
|
|
72
69
|
languageOptions: {
|
|
@@ -78,24 +75,24 @@ function flatBaseConfig(plugin, parser) {
|
|
|
78
75
|
},
|
|
79
76
|
};
|
|
80
77
|
return baseConfig;
|
|
81
|
-
}
|
|
82
|
-
function flatRecommendedConfig(plugin, parser) {
|
|
83
|
-
const recommendedConfig = {
|
|
84
|
-
name: "@darraghor/nestjs-typed/recommended",
|
|
85
|
-
rules: configs_1.default.recommended.rules,
|
|
86
|
-
};
|
|
87
|
-
return [flatBaseConfig(plugin, parser), recommendedConfig];
|
|
88
|
-
}
|
|
89
|
-
function flatNoSwaggerConfig() {
|
|
90
|
-
return [
|
|
91
|
-
{
|
|
92
|
-
name: "@darraghor/nestjs-typed/recommended",
|
|
93
|
-
rules: configs_1.default.recommended.rules,
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
const flatRecommended = flatRecommendedConfig(exports.plugin, exports.parser);
|
|
98
|
-
const flatNoSwagger = flatNoSwaggerConfig();
|
|
78
|
+
};
|
|
99
79
|
// export the flat configs
|
|
100
|
-
exports.default = {
|
|
101
|
-
|
|
80
|
+
exports.default = {
|
|
81
|
+
plugin: exports.plugin,
|
|
82
|
+
configs: {
|
|
83
|
+
flatRecommended: [
|
|
84
|
+
flatBaseConfig(exports.plugin, exports.parser),
|
|
85
|
+
{
|
|
86
|
+
name: "@darraghor/nestjs-typed/recommended",
|
|
87
|
+
rules: configs_1.default.recommended.rules,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
flatNoSwagger: [
|
|
91
|
+
{
|
|
92
|
+
name: "@darraghor/nestjs-typed/no-swagger",
|
|
93
|
+
rules: configs_1.default["no-swagger"].rules,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQ0Esd0RBQWdDO0FBQ2hDLG9EQUE0QjtBQUU1QixzRUFBd0Q7QUFDeEQscUZBQTBEO0FBRTFELHVLQUF1SztBQUV2SyxzSEFBc0g7QUFDdEgsaUVBQWlFO0FBQ2pFLE1BQU0sRUFBQyxJQUFJLEVBQUUsT0FBTyxFQUFDLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUdoRCxDQUFDO0FBQ0YsTUFBTSxJQUFJLEdBQUc7SUFDVCxJQUFJO0lBQ0osT0FBTztDQUNWLENBQUM7QUFDVyxRQUFBLE1BQU0sR0FBK0I7SUFDOUMsSUFBSSxFQUFFLFVBQVUsQ0FBQyxJQUFJO0lBQ3JCLGNBQWMsRUFBRSxVQUFVLENBQUMsY0FBYztDQUM1QyxDQUFDO0FBRVcsUUFBQSxNQUFNLEdBQStCLHVCQUdqRCxDQUFDO0FBQ0YsTUFBTSxhQUFhLEdBQUc7SUFDbEIsT0FBTyxFQUFFO1FBQ0wsV0FBVyxFQUFFLGlCQUFPLENBQUMsV0FBVztRQUNoQyxZQUFZLEVBQUUsaUJBQU8sQ0FBQyxZQUFZLENBQUM7S0FDdEM7SUFDRCxLQUFLLEVBQUwsZUFBSztJQUNMLElBQUk7Q0FDaUIsQ0FBQztBQW9CbEIsc0NBQWE7QUFsQnJCLE1BQU0sY0FBYyxHQUFHLENBQ25CLE1BQXlCLEVBQ3pCLE1BQXlCLEVBQ1IsRUFBRTtJQUNuQixNQUFNLFVBQVUsR0FBc0I7UUFDbEMsSUFBSSxFQUFFLDhCQUE4QjtRQUNwQyxlQUFlLEVBQUU7WUFDYixNQUFNO1lBQ04sVUFBVSxFQUFFLFFBQVE7U0FDdkI7UUFDRCxPQUFPLEVBQUU7WUFDTCx5QkFBeUIsRUFBRSxNQUFNO1NBQ3BDO0tBQ0osQ0FBQztJQUNGLE9BQU8sVUFBVSxDQUFDO0FBQ3RCLENBQUMsQ0FBQztBQUtGLDBCQUEwQjtBQUMxQixrQkFBZTtJQUNYLE1BQU0sRUFBTixjQUFNO0lBQ04sT0FBTyxFQUFFO1FBQ0wsZUFBZSxFQUFFO1lBQ2IsY0FBYyxDQUFDLGNBQU0sRUFBRSxjQUFNLENBQUM7WUFDOUI7Z0JBQ0ksSUFBSSxFQUFFLHFDQUFxQztnQkFDM0MsS0FBSyxFQUFFLGlCQUFPLENBQUMsV0FBVyxDQUFDLEtBQUs7YUFDbkM7U0FDSjtRQUNELGFBQWEsRUFBRTtZQUNYO2dCQUNJLElBQUksRUFBRSxvQ0FBb0M7Z0JBQzFDLEtBQUssRUFBRSxpQkFBTyxDQUFDLFlBQVksQ0FBQyxDQUFDLEtBQUs7YUFDckM7U0FDSjtLQUlKO0NBQ0osQ0FBQyJ9
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
declare const rule: ESLintUtils.RuleModule<"missing-is-defined-decorator" | "missing-is-optional-decorator" | "conflicting-defined-decorators-defined-optional" | "conflicting-defined-decorators-defined-validate-if" | "conflicting-defined-decorators-optional-validate-if" | "conflicting-defined-decorators-all", [], unknown, ESLintUtils.RuleListener>;
|
|
3
|
+
export default rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { EnumTestResultModel } from "./enumTestResultModel";
|
|
3
|
+
export declare const hasEnumSpecifiedCorrectly: (node: TSESTree.Node, isEnumType: boolean) => EnumTestResultModel;
|
|
4
|
+
export declare const needsEnumNameMatchingEnumType: (enumNameProperty: TSESTree.Property, enumProperty: TSESTree.Property) => boolean;
|
|
5
|
+
declare const rule: ESLintUtils.RuleModule<"needsEnumNameAdded" | "needsTypeRemoved" | "enumNameShouldMatchType", [], unknown, ESLintUtils.RuleListener>;
|
|
6
|
+
export default rule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const apiMethodsShouldBeGuarded: (node: TSESTree.MethodDefinition) => boolean;
|
|
3
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"apiMethodsShouldBeGuarded", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
export default rule;
|
package/dist/rules/apiMethodsShouldSpecifyApiOperation/apiMethodsShouldSpecifyApiOperation.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const shouldUseApiResponseDecorator: (node: TSESTree.MethodDefinition) => boolean;
|
|
3
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSpecifyApiOperation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
export default rule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const shouldUseApiResponseDecorator: (node: TSESTree.MethodDefinition) => boolean;
|
|
3
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSpecifyApiResponse", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
export default rule;
|
package/dist/rules/apiPropertyMatchesPropertyOptionality/apiPropertyMatchesPropertyOptionality.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const shouldUseRequiredDecorator: (node: TSESTree.PropertyDefinition) => boolean;
|
|
3
|
+
export declare const shouldUseOptionalDecorator: (node: TSESTree.PropertyDefinition) => boolean;
|
|
4
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldUseOptionalDecorator" | "shouldUseRequiredDecorator", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
export default rule;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import ArraySetResultModel from "./arraySetResultModel";
|
|
3
|
+
export declare const shouldSetArrayProperty: (node: TSESTree.PropertyDefinition) => ArraySetResultModel;
|
|
4
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSetArrayPropertyTrue" | "shouldSetArrayPropertyFalse", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
export default rule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const shouldUseApiTagDecorator: (node: TSESTree.ClassDeclaration) => boolean;
|
|
3
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldUseApiTagDecorator", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
export default rule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const allRules: {
|
|
2
|
+
"all-properties-have-explicit-defined": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missing-is-defined-decorator" | "missing-is-optional-decorator" | "conflicting-defined-decorators-defined-optional" | "conflicting-defined-decorators-defined-validate-if" | "conflicting-defined-decorators-optional-validate-if" | "conflicting-defined-decorators-all", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
"api-property-matches-property-optionality": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldUseOptionalDecorator" | "shouldUseRequiredDecorator", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
"injectable-should-be-provided": import("@typescript-eslint/utils/ts-eslint").RuleModule<"injectableInModule" | "controllersInModule", [{
|
|
5
|
+
src: string[];
|
|
6
|
+
filterFromPaths: string[];
|
|
7
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
|
+
"no-duplicate-decorators": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDuplicateDecorators", import("./noDuplicateDecorators/noDuplicateDecorators").NoDuplicateDecoratorsOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
+
"provided-injected-should-match-factory-parameters": import("@typescript-eslint/utils/ts-eslint").RuleModule<"mainMessage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
|
+
"controllers-should-supply-api-tags": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldUseApiTagDecorator", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
|
+
"api-method-should-specify-api-response": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSpecifyApiResponse", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
|
+
"api-method-should-specify-api-operation": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSpecifyApiOperation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
|
+
"api-enum-property-best-practices": import("@typescript-eslint/utils/ts-eslint").RuleModule<"needsEnumNameAdded" | "needsTypeRemoved" | "enumNameShouldMatchType", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
14
|
+
"api-property-returning-array-should-set-array": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSetArrayPropertyTrue" | "shouldSetArrayPropertyFalse", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
15
|
+
"should-specify-forbid-unknown-values": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSpecifyForbidUnknownValues", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
16
|
+
"param-decorator-name-matches-route-param": import("@typescript-eslint/utils/ts-eslint").RuleModule<"paramIdentifierDoesntNeedColon" | "paramIdentifierShouldMatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
17
|
+
"validated-non-primitive-property-needs-type-decorator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldUseTypeDecorator" | "autofixWithTypeDecorator", import("./validateNonPrimitiveNeedsTypeDecorator/validateNonPrimitiveNeedsDecorators").ValidateNonPrimitivePropertyTypeDecoratorOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
18
|
+
"validate-nested-of-array-should-set-each": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSetEachPropertyTrue" | "shouldSetEachPropertyFalse", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
19
|
+
"all-properties-are-whitelisted": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missing-property-decorator", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
20
|
+
"api-methods-should-be-guarded": import("@typescript-eslint/utils/ts-eslint").RuleModule<"apiMethodsShouldBeGuarded", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
21
|
+
"sort-module-metadata-arrays": import("@typescript-eslint/utils/ts-eslint").RuleModule<"moduleMetadataArraysAreSorted", import("./sortModuleMetadataArrays/sortModuleMetadataArrays").RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
22
|
+
};
|
|
23
|
+
export default allRules;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
type Options = [
|
|
3
|
+
{
|
|
4
|
+
src: string[];
|
|
5
|
+
filterFromPaths: string[];
|
|
6
|
+
}
|
|
7
|
+
];
|
|
8
|
+
declare const rule: TSESLint.RuleModule<"injectableInModule" | "controllersInModule", Options, unknown, TSESLint.RuleListener>;
|
|
9
|
+
export default rule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type NoDuplicateDecoratorsOptions = [
|
|
2
|
+
{
|
|
3
|
+
customList: string[];
|
|
4
|
+
}
|
|
5
|
+
];
|
|
6
|
+
export declare const shouldTrigger: () => boolean;
|
|
7
|
+
export declare const standardDecoratorsToValidate: string[];
|
|
8
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDuplicateDecorators", NoDuplicateDecoratorsOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
+
export default rule;
|
package/dist/rules/paramDecoratorNameMatchesRouteParam/paramDecoratorNameMatchesRouteParam.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
interface ResultModel {
|
|
3
|
+
hasColonInName: boolean;
|
|
4
|
+
paramNameNotMatchedInPath: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const parsePathParts: (decorator: TSESTree.Decorator) => string[];
|
|
7
|
+
/**
|
|
8
|
+
* nestjs allows for paths with _+?()*
|
|
9
|
+
* this rule doesn't support parsing those so we'll just pass
|
|
10
|
+
*/
|
|
11
|
+
export declare const hasPathPartsAnyRegexParams: (pathPartsToCheck: string[]) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if there is a matching path part for the paramName
|
|
14
|
+
* @param paramName
|
|
15
|
+
* @param pathPartsToCheck
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const isParameterNameIncludedInAPathPart: (paramName: string, pathPartsToCheck: string[]) => boolean;
|
|
19
|
+
export declare const shouldTrigger: (decorator: TSESTree.Decorator) => ResultModel;
|
|
20
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"paramIdentifierDoesntNeedColon" | "paramIdentifierShouldMatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
21
|
+
export default rule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const hasMismatchedInjected: (node: TSESTree.VariableDeclarator) => boolean;
|
|
3
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"mainMessage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
export default rule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const isValidationPipeNewExpression: (node: TSESTree.Node) => boolean;
|
|
3
|
+
export declare const checkObjectExpression: (os: TSESTree.ObjectExpression) => boolean;
|
|
4
|
+
export declare const shouldTriggerNewExpressionHasProperty: (node: TSESTree.Node) => boolean;
|
|
5
|
+
export declare const shouldTriggerForVariableDeclaratorExpression: (node: TSESTree.VariableDeclarator) => boolean;
|
|
6
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSpecifyForbidUnknownValues", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
export default rule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
export type RuleOptions = [
|
|
3
|
+
{
|
|
4
|
+
locale?: string;
|
|
5
|
+
}
|
|
6
|
+
];
|
|
7
|
+
export type ValidModuleNodeTypes = TSESTree.Identifier | TSESTree.CallExpression;
|
|
8
|
+
export declare const isValidModuleMetaPropertyType: (node: TSESTree.Expression | TSESTree.SpreadElement | null) => node is ValidModuleNodeTypes;
|
|
9
|
+
export declare const getRelevantNodeName: (node: TSESTree.Node) => string;
|
|
10
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"moduleMetadataArraysAreSorted", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import ArraySetResultModel from "./arraySetResultModel";
|
|
3
|
+
export declare const shouldSetArrayProperty: (node: TSESTree.PropertyDefinition) => ArraySetResultModel;
|
|
4
|
+
declare const rule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldSetEachPropertyTrue" | "shouldSetEachPropertyFalse", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
export default rule;
|
package/dist/rules/validateNonPrimitiveNeedsTypeDecorator/validateNonPrimitiveNeedsDecorators.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
export type ValidateNonPrimitivePropertyTypeDecoratorOptions = [
|
|
3
|
+
{
|
|
4
|
+
additionalTypeDecorators: string[];
|
|
5
|
+
additionalCustomValidatorDecorators: string[];
|
|
6
|
+
}
|
|
7
|
+
];
|
|
8
|
+
export declare const shouldTrigger: () => boolean;
|
|
9
|
+
declare const rule: ESLintUtils.RuleModule<"shouldUseTypeDecorator" | "autofixWithTypeDecorator", ValidateNonPrimitivePropertyTypeDecoratorOptions, unknown, ESLintUtils.RuleListener>;
|
|
10
|
+
export default rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFixturesRootDirectory(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { NestProvidedInjectablesMap } from "./models/NestProvidedInjectablesMap";
|
|
3
|
+
export declare const nestModuleAstParser: {
|
|
4
|
+
findNestModuleClass(ast: TSESTree.Program): TSESTree.ClassDeclaration | null;
|
|
5
|
+
mapNestModuleDecorator(n: TSESTree.ClassDeclaration, path: string): [string, NestProvidedInjectablesMap] | null;
|
|
6
|
+
mapModuleDecoratorOptionProperty(moduleDecorator: TSESTree.Decorator, propertyName: string): Set<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TSESLint, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { NestProvidedInjectablesMap } from "./models/NestProvidedInjectablesMap";
|
|
3
|
+
declare const NestProvidedInjectableMapper: {
|
|
4
|
+
detectDirectoryToScanForFiles(sourceGlob: string | string[] | undefined, currentWorkingDirectory: string): string[];
|
|
5
|
+
parseFileList(files: {
|
|
6
|
+
ignored: boolean;
|
|
7
|
+
filename: string;
|
|
8
|
+
}[], context: Readonly<TSESLint.RuleContext<never, any>>): Map<string, NestProvidedInjectablesMap>;
|
|
9
|
+
notEmpty<TValue>(value: TValue | null): value is TValue;
|
|
10
|
+
readFileContents(path: string): string;
|
|
11
|
+
isNestInjectableThatIsNeverProvided(node: TSESTree.ClassDeclaration): boolean;
|
|
12
|
+
mapAllProvidedInjectables(ast: TSESTree.Program, path: string): [string, NestProvidedInjectablesMap] | null;
|
|
13
|
+
};
|
|
14
|
+
export default NestProvidedInjectableMapper;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NestProvidedInjectablesMap } from "./models/NestProvidedInjectablesMap";
|
|
2
|
+
export declare const fakeFilePath = "fake/path.ts";
|
|
3
|
+
export declare const fakeContext: any;
|
|
4
|
+
export declare const moduleMappingTestData: {
|
|
5
|
+
moduleCode: string;
|
|
6
|
+
expectedMapping: (string | NestProvidedInjectablesMap)[];
|
|
7
|
+
}[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { NestProvidedInjectablesMap } from "./models/NestProvidedInjectablesMap";
|
|
3
|
+
export declare const nestProviderAstParser: {
|
|
4
|
+
mapNestProviderObject(n: TSESTree.Property, path: string): [string, NestProvidedInjectablesMap] | null;
|
|
5
|
+
findProvideProperty(providerDeclaration: TSESTree.VariableDeclarator | undefined, propertyName: string): TSESTree.Property | null;
|
|
6
|
+
findNestProviderVariableDeclaration(ast: TSESTree.Program): TSESTree.VariableDeclarator | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TSESLint, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { ParserServices } from "@typescript-eslint/parser";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare const typedTokenHelpers: {
|
|
5
|
+
decoratorsThatCouldMeanTheDevIsValidatingAnArray: string[];
|
|
6
|
+
isTypeArrayTypeOrUnionOfArrayTypes(node: TSESTree.Node, parserService: ParserServices, checker: ts.TypeChecker): boolean;
|
|
7
|
+
getNodeType(node: TSESTree.Node, parserService: ParserServices, checker: ts.TypeChecker): ts.Type;
|
|
8
|
+
expressionNodeIsArrayType(node: TSESTree.Expression, parserService: ParserServices, checker: ts.TypeChecker): boolean;
|
|
9
|
+
getPropertyValueEqualsExpected(firstArgument: TSESTree.ObjectExpression, propertyName: string, expectedValue: string | number | bigint | boolean | RegExp | null): boolean;
|
|
10
|
+
getConstrainedTypeAtLocation(checker: ts.TypeChecker, node: ts.Node): ts.Type;
|
|
11
|
+
nodeHasDecoratorsNamed(n: TSESTree.ClassDeclaration | TSESTree.PropertyDefinition | TSESTree.MethodDefinition, decoratorNames: string[]): boolean;
|
|
12
|
+
getDecoratorsNamed(n: TSESTree.ClassDeclaration | TSESTree.PropertyDefinition | TSESTree.MethodDefinition, decoratorNames: string[]): TSESTree.Decorator[];
|
|
13
|
+
parseStringToAst(code: string, path: string, context: Readonly<TSESLint.RuleContext<never, never[]>>): TSESTree.Program;
|
|
14
|
+
isEnumType(type: ts.Type): boolean;
|
|
15
|
+
isOptionalPropertyValue(node: TSESTree.PropertyDefinition): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if an import is an import of the given decorator name
|
|
18
|
+
* @param imp
|
|
19
|
+
* @param decoratorName
|
|
20
|
+
*/
|
|
21
|
+
importIsDecorator(imp: TSESTree.ImportDeclaration, decoratorName: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if decorator is in imports of a node
|
|
24
|
+
* @param imports
|
|
25
|
+
* @param decorator
|
|
26
|
+
*/
|
|
27
|
+
decoratorIsImportedFromClassValidator(imports: TSESTree.ImportDeclaration[], decorator: TSESTree.Decorator): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Checks whether a decorator is a class validator decorator
|
|
30
|
+
* @param program The root program node
|
|
31
|
+
* @param decorator The decorator node
|
|
32
|
+
*/
|
|
33
|
+
decoratorIsClassValidatorDecorator(program: TSESTree.Program | null, decorator: TSESTree.Decorator): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the root program of a node
|
|
36
|
+
* @param node
|
|
37
|
+
*/
|
|
38
|
+
getRootProgram(node: TSESTree.BaseNode): TSESTree.Program | null;
|
|
39
|
+
/**
|
|
40
|
+
* Gets all the decorators actually imported from class-validator lib or decorators that were included in the additionalCustomValidatorDecorators options
|
|
41
|
+
* @param node PropertyDefinition node
|
|
42
|
+
*/
|
|
43
|
+
getValidationDecorators(node: TSESTree.PropertyDefinition, additionalCustomValidatorDecorators?: string[]): TSESTree.Decorator[];
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the decorator is the IsEnum decorator
|
|
46
|
+
* @param decorator
|
|
47
|
+
*/
|
|
48
|
+
decoratorIsIsEnum(decorator: TSESTree.Decorator): boolean;
|
|
49
|
+
/** Checks if the decorator is the IsObject decorator
|
|
50
|
+
* @param decorator
|
|
51
|
+
*/
|
|
52
|
+
decoratorIsIsObject(decorator: TSESTree.Decorator): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the name of a decorator
|
|
55
|
+
* Returns null if no name is found
|
|
56
|
+
* @param decorator
|
|
57
|
+
*/
|
|
58
|
+
getDecoratorName(decorator: TSESTree.Decorator): string | null;
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODULE_CLASS_DECORATOR = "ClassDeclaration > Decorator[expression.callee.name=\"Module\"]";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darraghor/eslint-plugin-nestjs-typed",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.9",
|
|
4
4
|
"description": "Eslint rules for nestjs projects",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -Rf ./dist/",
|
|
@@ -47,7 +47,15 @@
|
|
|
47
47
|
"url": "https://darraghoriordan.com"
|
|
48
48
|
},
|
|
49
49
|
"main": "dist/index.js",
|
|
50
|
-
"
|
|
50
|
+
"type": "commonjs",
|
|
51
|
+
"exports": {
|
|
52
|
+
".": {
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"default": "./dist/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
51
59
|
"dependencies": {
|
|
52
60
|
"@typescript-eslint/scope-manager": "^8.21.0",
|
|
53
61
|
"@typescript-eslint/utils": "^8.21.0",
|