@dereekb/nestjs 13.38.0 → 13.40.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/eslint/package.json +7 -7
- package/mailgun/package.json +11 -11
- package/openai/package.json +11 -11
- package/openrouter/package.json +8 -8
- package/package.json +27 -35
- package/stripe/package.json +11 -11
- package/twilio/index.esm.js +18 -1
- package/twilio/package.json +11 -11
- package/twilio/src/lib/twilio.api.d.ts +1 -1
- package/twilio/src/lib/twilio.interop.d.ts +7 -0
- package/typeform/package.json +11 -11
- package/vapiai/package.json +11 -11
- package/eslint/index.cjs.default.js +0 -1
- package/eslint/index.cjs.js +0 -418
- package/eslint/index.cjs.mjs +0 -2
- package/index.cjs.default.js +0 -1
- package/index.cjs.js +0 -2789
- package/index.cjs.mjs +0 -2
- package/mailgun/index.cjs.default.js +0 -1
- package/mailgun/index.cjs.js +0 -1802
- package/mailgun/index.cjs.mjs +0 -2
- package/openai/index.cjs.default.js +0 -1
- package/openai/index.cjs.js +0 -1068
- package/openai/index.cjs.mjs +0 -2
- package/openrouter/index.cjs.default.js +0 -1
- package/openrouter/index.cjs.js +0 -1200
- package/openrouter/index.cjs.mjs +0 -2
- package/stripe/index.cjs.default.js +0 -1
- package/stripe/index.cjs.js +0 -780
- package/stripe/index.cjs.mjs +0 -2
- package/twilio/index.cjs.default.js +0 -1
- package/twilio/index.cjs.js +0 -2184
- package/twilio/index.cjs.mjs +0 -2
- package/typeform/index.cjs.default.js +0 -1
- package/typeform/index.cjs.js +0 -1182
- package/typeform/index.cjs.mjs +0 -2
- package/vapiai/index.cjs.default.js +0 -1
- package/vapiai/index.cjs.js +0 -1055
- package/vapiai/index.cjs.mjs +0 -2
package/eslint/index.cjs.js
DELETED
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _array_like_to_array(arr, len) {
|
|
4
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
5
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6
|
-
return arr2;
|
|
7
|
-
}
|
|
8
|
-
function _array_without_holes(arr) {
|
|
9
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
10
|
-
}
|
|
11
|
-
function _iterable_to_array(iter) {
|
|
12
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13
|
-
}
|
|
14
|
-
function _non_iterable_spread() {
|
|
15
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16
|
-
}
|
|
17
|
-
function _to_consumable_array(arr) {
|
|
18
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
19
|
-
}
|
|
20
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
21
|
-
if (!o) return;
|
|
22
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
23
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
24
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
25
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
26
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The import source that NestJS decorators come from.
|
|
30
|
-
*/ var NESTJS_COMMON_MODULE = '@nestjs/common';
|
|
31
|
-
/**
|
|
32
|
-
* NestJS class decorators that make a class eligible for dependency injection.
|
|
33
|
-
*/ var NESTJS_CLASS_DECORATORS = new Set([
|
|
34
|
-
'Injectable',
|
|
35
|
-
'Controller',
|
|
36
|
-
'Resolver'
|
|
37
|
-
]);
|
|
38
|
-
/**
|
|
39
|
-
* Decorators that count as valid parameter injection markers.
|
|
40
|
-
* Any parameter with at least one of these is considered properly annotated.
|
|
41
|
-
*/ var VALID_PARAM_DECORATORS = new Set([
|
|
42
|
-
'Inject',
|
|
43
|
-
'Optional',
|
|
44
|
-
'Self',
|
|
45
|
-
'SkipSelf',
|
|
46
|
-
'Host'
|
|
47
|
-
]);
|
|
48
|
-
/**
|
|
49
|
-
* Extracts the decorator name from a decorator node.
|
|
50
|
-
*
|
|
51
|
-
* @param decorator - The decorator AST node.
|
|
52
|
-
* @returns The decorator name, or empty string if unrecognized.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```
|
|
56
|
-
* // Returns 'Injectable' for both:
|
|
57
|
-
* // @Injectable()
|
|
58
|
-
* // @Injectable
|
|
59
|
-
* ```
|
|
60
|
-
*/ function getDecoratorName(decorator) {
|
|
61
|
-
var expression = decorator.expression;
|
|
62
|
-
var name = '';
|
|
63
|
-
if (expression.type === 'CallExpression') {
|
|
64
|
-
if (expression.callee.type === 'Identifier') {
|
|
65
|
-
name = expression.callee.name;
|
|
66
|
-
} else if (expression.callee.type === 'MemberExpression' && expression.callee.property.type === 'Identifier') {
|
|
67
|
-
name = expression.callee.property.name;
|
|
68
|
-
}
|
|
69
|
-
} else if (expression.type === 'Identifier') {
|
|
70
|
-
name = expression.name;
|
|
71
|
-
}
|
|
72
|
-
return name;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Extracts the injection token name from a decorator like @Inject(TokenName).
|
|
76
|
-
*
|
|
77
|
-
* @param decorator - The decorator AST node.
|
|
78
|
-
* @returns The token identifier name, or null if not a simple identifier.
|
|
79
|
-
*/ function getInjectTokenFromDecorator(decorator) {
|
|
80
|
-
var expression = decorator.expression;
|
|
81
|
-
var tokenName = null;
|
|
82
|
-
if (expression.type === 'CallExpression' && expression.callee.type === 'Identifier' && expression.callee.name === 'Inject') {
|
|
83
|
-
var firstArg = expression.arguments[0];
|
|
84
|
-
if ((firstArg === null || firstArg === void 0 ? void 0 : firstArg.type) === 'Identifier') {
|
|
85
|
-
tokenName = firstArg.name;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return tokenName;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Extracts the parameter name from a constructor parameter node.
|
|
92
|
-
*
|
|
93
|
-
* @param param - The parameter AST node.
|
|
94
|
-
* @returns The parameter name for error reporting.
|
|
95
|
-
*/ function getParamName(param) {
|
|
96
|
-
var name = '(unknown)';
|
|
97
|
-
if (param.type === 'TSParameterProperty') {
|
|
98
|
-
var inner = param.parameter;
|
|
99
|
-
if (inner.type === 'Identifier') {
|
|
100
|
-
name = inner.name;
|
|
101
|
-
} else if (inner.type === 'AssignmentPattern' && inner.left.type === 'Identifier') {
|
|
102
|
-
name = inner.left.name;
|
|
103
|
-
}
|
|
104
|
-
} else if (param.type === 'Identifier') {
|
|
105
|
-
name = param.name;
|
|
106
|
-
} else if (param.type === 'AssignmentPattern' && param.left.type === 'Identifier') {
|
|
107
|
-
name = param.left.name;
|
|
108
|
-
}
|
|
109
|
-
return name;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Gets the class-typed injection token name from a parameter's type annotation, if available.
|
|
113
|
-
*
|
|
114
|
-
* Returns the type name only for simple TSTypeReference identifiers (i.e. class names like `FooApi`).
|
|
115
|
-
* Returns null for primitives, union types, generics, or any non-simple type reference.
|
|
116
|
-
*
|
|
117
|
-
* @param param - The parameter AST node.
|
|
118
|
-
* @returns The type name to use as injection token, or null if not auto-fixable.
|
|
119
|
-
*/ function getInjectTokenName(param) {
|
|
120
|
-
var _target_typeAnnotation, _typeAnnotation_typeName;
|
|
121
|
-
var target = param.type === 'TSParameterProperty' ? param.parameter : param;
|
|
122
|
-
var typeAnnotation = (_target_typeAnnotation = target.typeAnnotation) === null || _target_typeAnnotation === void 0 ? void 0 : _target_typeAnnotation.typeAnnotation;
|
|
123
|
-
var tokenName = null;
|
|
124
|
-
if ((typeAnnotation === null || typeAnnotation === void 0 ? void 0 : typeAnnotation.type) === 'TSTypeReference' && ((_typeAnnotation_typeName = typeAnnotation.typeName) === null || _typeAnnotation_typeName === void 0 ? void 0 : _typeAnnotation_typeName.type) === 'Identifier' && !typeAnnotation.typeArguments) {
|
|
125
|
-
tokenName = typeAnnotation.typeName.name;
|
|
126
|
-
}
|
|
127
|
-
return tokenName;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Returns the first class decorator that is both in `classDecorators` and imported from '@nestjs/common'.
|
|
131
|
-
*
|
|
132
|
-
* @param classNode - The ClassDeclaration AST node.
|
|
133
|
-
* @param classDecorators - Class decorator names that trigger this rule.
|
|
134
|
-
* @param nestjsImports - Identifiers known to be imported from '@nestjs/common'.
|
|
135
|
-
* @returns The matched decorator node, or undefined when none matches.
|
|
136
|
-
*/ function findMatchedClassDecorator(classNode, classDecorators, nestjsImports) {
|
|
137
|
-
var decorators = classNode.decorators;
|
|
138
|
-
if (!decorators || decorators.length === 0) return undefined;
|
|
139
|
-
return decorators.find(function(d) {
|
|
140
|
-
var name = getDecoratorName(d);
|
|
141
|
-
return classDecorators.has(name) && nestjsImports.has(name);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Returns the constructor parameter list of a class declaration, if a constructor is present.
|
|
146
|
-
*
|
|
147
|
-
* @param classNode - The ClassDeclaration AST node.
|
|
148
|
-
* @returns The parameter list, or undefined when there's no constructor.
|
|
149
|
-
*/ function findConstructorParams(classNode) {
|
|
150
|
-
var constructor = classNode.body.body.find(function(member) {
|
|
151
|
-
return member.type === 'MethodDefinition' && member.kind === 'constructor';
|
|
152
|
-
});
|
|
153
|
-
return constructor === null || constructor === void 0 ? void 0 : constructor.value.params;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Builds the fixer for converting a type-only import into a value import so it
|
|
157
|
-
* can be used as an `@Inject()` token at runtime.
|
|
158
|
-
*
|
|
159
|
-
* @param fixer - The ESLint fixer instance.
|
|
160
|
-
* @param typeImportInfo - Info about the type-only import to convert.
|
|
161
|
-
* @returns The fixer command produced by `fixer.removeRange`.
|
|
162
|
-
*/ function buildTypeOnlyImportFix(fixer, typeImportInfo) {
|
|
163
|
-
var fixResult;
|
|
164
|
-
if (typeImportInfo.isDeclarationLevel) {
|
|
165
|
-
// `import type { X } from '...'` → `import { X } from '...'`
|
|
166
|
-
var importKeywordEnd = typeImportInfo.declaration.range[0] + 'import '.length;
|
|
167
|
-
fixResult = fixer.removeRange([
|
|
168
|
-
importKeywordEnd,
|
|
169
|
-
importKeywordEnd + 'type '.length
|
|
170
|
-
]);
|
|
171
|
-
} else {
|
|
172
|
-
// `import { type X }` → `import { X }`
|
|
173
|
-
var specRange = typeImportInfo.specifier.range;
|
|
174
|
-
var importedRange = typeImportInfo.specifier.imported.range;
|
|
175
|
-
fixResult = fixer.removeRange([
|
|
176
|
-
specRange[0],
|
|
177
|
-
importedRange[0]
|
|
178
|
-
]);
|
|
179
|
-
}
|
|
180
|
-
return fixResult;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* ESLint rule requiring @Inject() on all constructor parameters in NestJS injectable classes.
|
|
184
|
-
*
|
|
185
|
-
* Required when emitDecoratorMetadata is disabled — without it, NestJS cannot infer
|
|
186
|
-
* constructor parameter types and will throw at runtime if @Inject() is missing.
|
|
187
|
-
*
|
|
188
|
-
* Only applies to decorators imported from '@nestjs/common', so Angular @Injectable()
|
|
189
|
-
* classes are not affected.
|
|
190
|
-
*
|
|
191
|
-
* Also flags injection tokens that are type-only imports (`import type { X }` or
|
|
192
|
-
* `import { type X }`), since those cannot be used as values at runtime.
|
|
193
|
-
*
|
|
194
|
-
* Auto-fixes:
|
|
195
|
-
* - Missing @Inject(): adds `@Inject(ClassName)` for simple class-typed parameters
|
|
196
|
-
* - Type-only imports: removes the `type` modifier from the import specifier
|
|
197
|
-
*
|
|
198
|
-
* Register as a plugin in your flat ESLint config, then enable individual rules
|
|
199
|
-
* under the chosen plugin prefix (e.g. 'dereekb-nestjs/require-nest-inject').
|
|
200
|
-
*/ var NESTJS_REQUIRE_INJECT_RULE = {
|
|
201
|
-
meta: {
|
|
202
|
-
type: 'problem',
|
|
203
|
-
fixable: 'code',
|
|
204
|
-
docs: {
|
|
205
|
-
description: 'Require @Inject() decorator on constructor parameters in NestJS injectable classes',
|
|
206
|
-
recommended: true
|
|
207
|
-
},
|
|
208
|
-
messages: {
|
|
209
|
-
missingInject: 'Constructor parameter "{{name}}" in @{{classDecorator}}() class must have an @Inject() decorator. Without emitDecoratorMetadata, NestJS cannot infer the injection token and will throw at runtime.',
|
|
210
|
-
typeOnlyInjectToken: '@Inject({{token}}) uses "{{token}}" which is a type-only import. It must be a value import to be used as an injection token at runtime.'
|
|
211
|
-
},
|
|
212
|
-
schema: [
|
|
213
|
-
{
|
|
214
|
-
type: 'object',
|
|
215
|
-
properties: {
|
|
216
|
-
additionalClassDecorators: {
|
|
217
|
-
type: 'array',
|
|
218
|
-
items: {
|
|
219
|
-
type: 'string'
|
|
220
|
-
},
|
|
221
|
-
description: 'Additional class decorator names (beyond Injectable, Controller, Resolver) that should trigger this rule.'
|
|
222
|
-
},
|
|
223
|
-
additionalParamDecorators: {
|
|
224
|
-
type: 'array',
|
|
225
|
-
items: {
|
|
226
|
-
type: 'string'
|
|
227
|
-
},
|
|
228
|
-
description: 'Additional parameter decorator names (beyond Inject, Optional, Self, SkipSelf, Host) to treat as valid injection markers.'
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
additionalProperties: false
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
|
-
create: function create(context) {
|
|
236
|
-
var options = context.options[0] || {};
|
|
237
|
-
var classDecorators = new Set(_to_consumable_array(NESTJS_CLASS_DECORATORS).concat(_to_consumable_array(options.additionalClassDecorators || [])));
|
|
238
|
-
var paramDecorators = new Set(_to_consumable_array(VALID_PARAM_DECORATORS).concat(_to_consumable_array(options.additionalParamDecorators || [])));
|
|
239
|
-
/**
|
|
240
|
-
* Tracks identifiers imported from '@nestjs/common'.
|
|
241
|
-
* Only decorators whose local name appears in this set will trigger the rule.
|
|
242
|
-
*/ var nestjsImports = new Set();
|
|
243
|
-
/**
|
|
244
|
-
* Tracks all type-only imports across the file, keyed by local identifier name.
|
|
245
|
-
* Used to detect when @Inject(Token) uses a type-only import.
|
|
246
|
-
*/ var typeOnlyImports = new Map();
|
|
247
|
-
/**
|
|
248
|
-
* Reference to the '@nestjs/common' ImportDeclaration node, used for adding
|
|
249
|
-
* the Inject import if it's missing during auto-fix.
|
|
250
|
-
*/ var nestjsImportNode = null;
|
|
251
|
-
return {
|
|
252
|
-
ImportDeclaration: function ImportDeclaration(node) {
|
|
253
|
-
var isDeclarationTypeOnly = node.importKind === 'type';
|
|
254
|
-
if (node.source.value === NESTJS_COMMON_MODULE) {
|
|
255
|
-
nestjsImportNode = node;
|
|
256
|
-
}
|
|
257
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
258
|
-
try {
|
|
259
|
-
for(var _iterator = node.specifiers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
260
|
-
var specifier = _step.value;
|
|
261
|
-
if (specifier.type !== 'ImportSpecifier') {
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
var localName = specifier.local.name;
|
|
265
|
-
// Track @nestjs/common imports
|
|
266
|
-
if (node.source.value === NESTJS_COMMON_MODULE) {
|
|
267
|
-
nestjsImports.add(localName);
|
|
268
|
-
}
|
|
269
|
-
// Track type-only imports from any source
|
|
270
|
-
var isTypeOnly = isDeclarationTypeOnly || specifier.importKind === 'type';
|
|
271
|
-
if (isTypeOnly) {
|
|
272
|
-
typeOnlyImports.set(localName, {
|
|
273
|
-
specifier: specifier,
|
|
274
|
-
declaration: node,
|
|
275
|
-
isDeclarationLevel: isDeclarationTypeOnly
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
} catch (err) {
|
|
280
|
-
_didIteratorError = true;
|
|
281
|
-
_iteratorError = err;
|
|
282
|
-
} finally{
|
|
283
|
-
try {
|
|
284
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
285
|
-
_iterator.return();
|
|
286
|
-
}
|
|
287
|
-
} finally{
|
|
288
|
-
if (_didIteratorError) {
|
|
289
|
-
throw _iteratorError;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
ClassDeclaration: function ClassDeclaration(classNode) {
|
|
295
|
-
var matchedClassDecorator = findMatchedClassDecorator(classNode, classDecorators, nestjsImports);
|
|
296
|
-
if (!matchedClassDecorator) return;
|
|
297
|
-
var params = findConstructorParams(classNode);
|
|
298
|
-
if (!params || params.length === 0) return;
|
|
299
|
-
var classDecoratorName = getDecoratorName(matchedClassDecorator);
|
|
300
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
301
|
-
try {
|
|
302
|
-
for(var _iterator = params[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
303
|
-
var param = _step.value;
|
|
304
|
-
processConstructorParam(param, classDecoratorName);
|
|
305
|
-
}
|
|
306
|
-
} catch (err) {
|
|
307
|
-
_didIteratorError = true;
|
|
308
|
-
_iteratorError = err;
|
|
309
|
-
} finally{
|
|
310
|
-
try {
|
|
311
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
312
|
-
_iterator.return();
|
|
313
|
-
}
|
|
314
|
-
} finally{
|
|
315
|
-
if (_didIteratorError) {
|
|
316
|
-
throw _iteratorError;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
function processConstructorParam(param, classDecoratorName) {
|
|
323
|
-
var paramDecoratorsOnNode = param.decorators;
|
|
324
|
-
var hasValidDecorator = !!paramDecoratorsOnNode && paramDecoratorsOnNode.some(function(d) {
|
|
325
|
-
return paramDecorators.has(getDecoratorName(d));
|
|
326
|
-
});
|
|
327
|
-
if (hasValidDecorator) {
|
|
328
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
329
|
-
try {
|
|
330
|
-
for(var _iterator = paramDecoratorsOnNode[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
331
|
-
var decorator = _step.value;
|
|
332
|
-
reportTypeOnlyTokenIfAny(decorator);
|
|
333
|
-
}
|
|
334
|
-
} catch (err) {
|
|
335
|
-
_didIteratorError = true;
|
|
336
|
-
_iteratorError = err;
|
|
337
|
-
} finally{
|
|
338
|
-
try {
|
|
339
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
340
|
-
_iterator.return();
|
|
341
|
-
}
|
|
342
|
-
} finally{
|
|
343
|
-
if (_didIteratorError) {
|
|
344
|
-
throw _iteratorError;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
reportMissingInject(param, classDecoratorName);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function reportTypeOnlyTokenIfAny(decorator) {
|
|
353
|
-
var tokenName = getInjectTokenFromDecorator(decorator);
|
|
354
|
-
if (!tokenName) return;
|
|
355
|
-
var typeImportInfo = typeOnlyImports.get(tokenName);
|
|
356
|
-
if (!typeImportInfo) return;
|
|
357
|
-
context.report({
|
|
358
|
-
node: decorator,
|
|
359
|
-
messageId: 'typeOnlyInjectToken',
|
|
360
|
-
data: {
|
|
361
|
-
token: tokenName
|
|
362
|
-
},
|
|
363
|
-
fix: function fix(fixer) {
|
|
364
|
-
return buildTypeOnlyImportFix(fixer, typeImportInfo);
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
// Remove from tracking so we don't report the same import twice
|
|
368
|
-
typeOnlyImports.delete(tokenName);
|
|
369
|
-
}
|
|
370
|
-
function reportMissingInject(param, classDecoratorName) {
|
|
371
|
-
var tokenName = getInjectTokenName(param);
|
|
372
|
-
context.report({
|
|
373
|
-
node: param,
|
|
374
|
-
messageId: 'missingInject',
|
|
375
|
-
data: {
|
|
376
|
-
name: getParamName(param),
|
|
377
|
-
classDecorator: classDecoratorName
|
|
378
|
-
},
|
|
379
|
-
fix: tokenName ? function(fixer) {
|
|
380
|
-
return buildMissingInjectFix(fixer, param, tokenName);
|
|
381
|
-
} : undefined
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
function buildMissingInjectFix(fixer, param, tokenName) {
|
|
385
|
-
var fixes = [
|
|
386
|
-
fixer.insertTextBefore(param, "@Inject(".concat(tokenName, ") "))
|
|
387
|
-
];
|
|
388
|
-
if (!nestjsImports.has('Inject') && nestjsImportNode) {
|
|
389
|
-
var lastSpecifier = nestjsImportNode.specifiers[nestjsImportNode.specifiers.length - 1];
|
|
390
|
-
if (lastSpecifier) {
|
|
391
|
-
fixes.push(fixer.insertTextAfter(lastSpecifier, ', Inject'));
|
|
392
|
-
}
|
|
393
|
-
nestjsImports.add('Inject');
|
|
394
|
-
}
|
|
395
|
-
return fixes;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* ESLint plugin for NestJS rules.
|
|
402
|
-
*
|
|
403
|
-
* Register as a plugin in your flat ESLint config, then enable individual rules
|
|
404
|
-
* under the chosen plugin prefix (e.g. 'dereekb-nestjs/require-nest-inject').
|
|
405
|
-
*/ var NESTJS_ESLINT_PLUGIN = {
|
|
406
|
-
rules: {
|
|
407
|
-
'require-nest-inject': NESTJS_REQUIRE_INJECT_RULE
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
/**
|
|
411
|
-
* camelCase alias of {@link NESTJS_ESLINT_PLUGIN} matching the conventional ESLint plugin export name.
|
|
412
|
-
*
|
|
413
|
-
* @dbxAllowConstantName
|
|
414
|
-
*/ var nestjsESLintPlugin = NESTJS_ESLINT_PLUGIN;
|
|
415
|
-
|
|
416
|
-
exports.NESTJS_ESLINT_PLUGIN = NESTJS_ESLINT_PLUGIN;
|
|
417
|
-
exports.NESTJS_REQUIRE_INJECT_RULE = NESTJS_REQUIRE_INJECT_RULE;
|
|
418
|
-
exports.nestjsESLintPlugin = nestjsESLintPlugin;
|
package/eslint/index.cjs.mjs
DELETED
package/index.cjs.default.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exports._default = require('./index.cjs.js').default;
|