@angular-eslint/utils 17.3.1-alpha.0 → 17.3.1-alpha.10

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.
@@ -21,9 +21,8 @@ exports.SPECIAL_UNDERLINE_CHARS = [
21
21
  '@',
22
22
  ];
23
23
  function convertAnnotatedSourceToFailureCase(errorOptions) {
24
- var _a, _b;
25
24
  const messages = 'messageId' in errorOptions
26
- ? [Object.assign(Object.assign({}, errorOptions), { char: '~' })]
25
+ ? [{ ...errorOptions, char: '~' }]
27
26
  : errorOptions.messages;
28
27
  let parsedSource = '';
29
28
  const errors = messages.map(({ char: currentValueChar, data, messageId, suggestions }) => {
@@ -50,9 +49,9 @@ function convertAnnotatedSourceToFailureCase(errorOptions) {
50
49
  name: errorOptions.description,
51
50
  code: parsedSource,
52
51
  filename: errorOptions.filename,
53
- options: (_a = errorOptions.options) !== null && _a !== void 0 ? _a : [],
52
+ options: errorOptions.options ?? [],
54
53
  errors,
55
- only: (_b = errorOptions.only) !== null && _b !== void 0 ? _b : false,
54
+ only: errorOptions.only ?? false,
56
55
  output: errorOptions.annotatedOutput
57
56
  ? parseInvalidSource(errorOptions.annotatedOutput).source
58
57
  : null,
@@ -35,7 +35,11 @@ var AngularPropertyAccessorDecorators;
35
35
  AngularPropertyAccessorDecorators["ViewChild"] = "ViewChild";
36
36
  AngularPropertyAccessorDecorators["ViewChildren"] = "ViewChildren";
37
37
  })(AngularPropertyAccessorDecorators || (AngularPropertyAccessorDecorators = {}));
38
- exports.AngularInnerClassDecorators = Object.assign(Object.assign(Object.assign({}, AngularConstructorParameterDecorators), AngularMethodDecorators), AngularPropertyAccessorDecorators);
38
+ exports.AngularInnerClassDecorators = {
39
+ ...AngularConstructorParameterDecorators,
40
+ ...AngularMethodDecorators,
41
+ ...AngularPropertyAccessorDecorators,
42
+ };
39
43
  var AngularLifecycleInterfaces;
40
44
  (function (AngularLifecycleInterfaces) {
41
45
  AngularLifecycleInterfaces["AfterContentChecked"] = "AfterContentChecked";
@@ -210,8 +214,7 @@ exports.getInterfaceName = getInterfaceName;
210
214
  const getPipeDecorator = (node) => (0, exports.getDecorator)(node, 'Pipe');
211
215
  exports.getPipeDecorator = getPipeDecorator;
212
216
  function getInterfaces(node) {
213
- var _a;
214
- return ((_a = node.implements) !== null && _a !== void 0 ? _a : [])
217
+ return (node.implements ?? [])
215
218
  .map(({ expression }) => expression)
216
219
  .filter(isIdentifierOrMemberExpression);
217
220
  }
@@ -238,9 +241,8 @@ function getNearestNodeFrom({ parent }, predicate) {
238
241
  }
239
242
  exports.getNearestNodeFrom = getNearestNodeFrom;
240
243
  const getClassName = (node) => {
241
- var _a;
242
244
  if (isClassDeclaration(node)) {
243
- return (_a = node.id) === null || _a === void 0 ? void 0 : _a.name;
245
+ return node.id?.name;
244
246
  }
245
247
  if (node.parent) {
246
248
  return (0, exports.getClassName)(node.parent);
@@ -249,12 +251,14 @@ const getClassName = (node) => {
249
251
  };
250
252
  exports.getClassName = getClassName;
251
253
  const getDecorator = (node, decoratorName) => {
252
- var _a;
253
- return (_a = node.decorators) === null || _a === void 0 ? void 0 : _a.find((decorator) => (0, exports.getDecoratorName)(decorator) === decoratorName);
254
+ return node.decorators?.find((decorator) => (0, exports.getDecoratorName)(decorator) === decoratorName);
254
255
  };
255
256
  exports.getDecorator = getDecorator;
256
257
  const getAngularClassDecorator = ({ decorators, }) => {
257
- return decorators === null || decorators === void 0 ? void 0 : decorators.map(exports.getDecoratorName).filter(utils_2.isNotNullOrUndefined).find(exports.isAngularClassDecorator);
258
+ return decorators
259
+ ?.map(exports.getDecoratorName)
260
+ .filter(utils_2.isNotNullOrUndefined)
261
+ .find(exports.isAngularClassDecorator);
258
262
  };
259
263
  exports.getAngularClassDecorator = getAngularClassDecorator;
260
264
  const getDecoratorArgument = ({ expression, }) => {
@@ -306,13 +310,13 @@ function getPropertyDefinitionName({ computed, key, }) {
306
310
  }
307
311
  exports.getPropertyDefinitionName = getPropertyDefinitionName;
308
312
  const getDecoratorProperty = (decorator, name) => {
309
- var _a;
310
- return (_a = (0, exports.getDecoratorArgument)(decorator)) === null || _a === void 0 ? void 0 : _a.properties.filter(isProperty).find(({ key }) => utils_1.ASTUtils.isIdentifier(key) && key.name === name);
313
+ return (0, exports.getDecoratorArgument)(decorator)
314
+ ?.properties.filter(isProperty)
315
+ .find(({ key }) => utils_1.ASTUtils.isIdentifier(key) && key.name === name);
311
316
  };
312
317
  exports.getDecoratorProperty = getDecoratorProperty;
313
318
  const getDecoratorPropertyValue = (decorator, name) => {
314
- var _a;
315
- return (_a = (0, exports.getDecoratorProperty)(decorator, name)) === null || _a === void 0 ? void 0 : _a.value;
319
+ return (0, exports.getDecoratorProperty)(decorator, name)?.value;
316
320
  };
317
321
  exports.getDecoratorPropertyValue = getDecoratorPropertyValue;
318
322
  const getDeclaredMethods = ({ body: { body }, }) => {
@@ -330,7 +334,7 @@ const getLifecycleInterfaceByMethodName = (methodName) => methodName.slice(2);
330
334
  exports.getLifecycleInterfaceByMethodName = getLifecycleInterfaceByMethodName;
331
335
  function isImportedFrom(identifier, moduleName) {
332
336
  const importDeclarations = getImportDeclarations(identifier, moduleName);
333
- return Boolean(importDeclarations === null || importDeclarations === void 0 ? void 0 : importDeclarations.some((importDeclaration) => importDeclaration.specifiers.some((specifier) => isImportSpecifier(specifier) &&
337
+ return Boolean(importDeclarations?.some((importDeclaration) => importDeclaration.specifiers.some((specifier) => isImportSpecifier(specifier) &&
334
338
  specifier.imported.name === identifier.name &&
335
339
  specifier.local.name === identifier.name)));
336
340
  }
@@ -3,54 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAriaAttributeKeys = void 0;
4
4
  let ariaAttributeKeys = null;
5
5
  function getAriaAttributeKeys() {
6
- return (ariaAttributeKeys !== null && ariaAttributeKeys !== void 0 ? ariaAttributeKeys : (ariaAttributeKeys = new Set([
7
- // Source: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques
8
- 'aria-activedescendant',
9
- 'aria-atomic',
10
- 'aria-autocomplete',
11
- 'aria-busy',
12
- 'aria-checked',
13
- 'aria-colcount',
14
- 'aria-colindex',
15
- 'aria-colspan',
16
- 'aria-controls',
17
- 'aria-current',
18
- 'aria-describedby',
19
- 'aria-details',
20
- 'aria-disabled',
21
- 'aria-dragged',
22
- 'aria-dropeffect',
23
- 'aria-errormessage',
24
- 'aria-expanded',
25
- 'aria-flowto',
26
- 'aria-haspopup',
27
- 'aria-hidden',
28
- 'aria-invalid',
29
- 'aria-label',
30
- 'aria-labelledby',
31
- 'aria-level',
32
- 'aria-live',
33
- 'aria-modal',
34
- 'aria-multiline',
35
- 'aria-multiselectable',
36
- 'aria-orientation',
37
- 'aria-owns',
38
- 'aria-placeholder',
39
- 'aria-posinset',
40
- 'aria-pressed',
41
- 'aria-readonly',
42
- 'aria-relevant',
43
- 'aria-required',
44
- 'aria-rowcount',
45
- 'aria-rowindex',
46
- 'aria-rowspan',
47
- 'aria-selected',
48
- 'aria-setsize',
49
- 'aria-sort',
50
- 'aria-valuemax',
51
- 'aria-valuemin',
52
- 'aria-valuenow',
53
- 'aria-valuetext',
54
- ])));
6
+ return (ariaAttributeKeys ??
7
+ (ariaAttributeKeys = new Set([
8
+ // Source: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques
9
+ 'aria-activedescendant',
10
+ 'aria-atomic',
11
+ 'aria-autocomplete',
12
+ 'aria-busy',
13
+ 'aria-checked',
14
+ 'aria-colcount',
15
+ 'aria-colindex',
16
+ 'aria-colspan',
17
+ 'aria-controls',
18
+ 'aria-current',
19
+ 'aria-describedby',
20
+ 'aria-details',
21
+ 'aria-disabled',
22
+ 'aria-dragged',
23
+ 'aria-dropeffect',
24
+ 'aria-errormessage',
25
+ 'aria-expanded',
26
+ 'aria-flowto',
27
+ 'aria-haspopup',
28
+ 'aria-hidden',
29
+ 'aria-invalid',
30
+ 'aria-label',
31
+ 'aria-labelledby',
32
+ 'aria-level',
33
+ 'aria-live',
34
+ 'aria-modal',
35
+ 'aria-multiline',
36
+ 'aria-multiselectable',
37
+ 'aria-orientation',
38
+ 'aria-owns',
39
+ 'aria-placeholder',
40
+ 'aria-posinset',
41
+ 'aria-pressed',
42
+ 'aria-readonly',
43
+ 'aria-relevant',
44
+ 'aria-required',
45
+ 'aria-rowcount',
46
+ 'aria-rowindex',
47
+ 'aria-rowspan',
48
+ 'aria-selected',
49
+ 'aria-setsize',
50
+ 'aria-sort',
51
+ 'aria-valuemax',
52
+ 'aria-valuemin',
53
+ 'aria-valuenow',
54
+ 'aria-valuetext',
55
+ ])));
55
56
  }
56
57
  exports.getAriaAttributeKeys = getAriaAttributeKeys;
@@ -3,179 +3,180 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNativeEventNames = void 0;
4
4
  let nativeEventNames = null;
5
5
  function getNativeEventNames() {
6
- return (nativeEventNames !== null && nativeEventNames !== void 0 ? nativeEventNames : (nativeEventNames = new Set([
7
- // Source: https://developer.mozilla.org/en-US/docs/Web/Events
8
- 'abort',
9
- 'afterprint',
10
- 'animationend',
11
- 'animationiteration',
12
- 'animationstart',
13
- 'appinstalled',
14
- 'audioprocess',
15
- 'audioend',
16
- 'audiostart',
17
- 'beforeprint',
18
- 'beforeunload',
19
- 'beginEvent',
20
- 'blocked',
21
- 'blur',
22
- 'boundary',
23
- 'cached',
24
- 'canplay',
25
- 'canplaythrough',
26
- 'change',
27
- 'chargingchange',
28
- 'chargingtimechange',
29
- 'checking',
30
- 'click',
31
- 'close',
32
- 'complete',
33
- 'compositionend',
34
- 'compositionstart',
35
- 'compositionupdate',
36
- 'contextmenu',
37
- 'copy',
38
- 'cut',
39
- 'dblclick',
40
- 'devicechange',
41
- 'devicelight',
42
- 'devicemotion',
43
- 'deviceorientation',
44
- 'deviceproximity',
45
- 'dischargingtimechange',
46
- 'DOMAttributeNameChanged',
47
- 'DOMAttrModified',
48
- 'DOMCharacterDataModified',
49
- 'DOMContentLoaded',
50
- 'DOMElementNameChanged',
51
- 'focus',
52
- 'focusin',
53
- 'focusout',
54
- 'DOMNodeInserted',
55
- 'DOMNodeInsertedIntoDocument',
56
- 'DOMNodeRemoved',
57
- 'DOMNodeRemovedFromDocument',
58
- 'DOMSubtreeModified',
59
- 'downloading',
60
- 'drag',
61
- 'dragend',
62
- 'dragenter',
63
- 'dragleave',
64
- 'dragover',
65
- 'dragstart',
66
- 'drop',
67
- 'durationchange',
68
- 'emptied',
69
- 'end',
70
- 'ended',
71
- 'endEvent',
72
- 'error',
73
- 'fullscreenchange',
74
- 'fullscreenerror',
75
- 'gamepadconnected',
76
- 'gamepaddisconnected',
77
- 'gotpointercapture',
78
- 'hashchange',
79
- 'lostpointercapture',
80
- 'input',
81
- 'invalid',
82
- 'keydown',
83
- 'keypress',
84
- 'keyup',
85
- 'languagechange',
86
- 'levelchange',
87
- 'load',
88
- 'loadeddata',
89
- 'loadedmetadata',
90
- 'loadend',
91
- 'loadstart',
92
- 'mark',
93
- 'message',
94
- 'messageerror',
95
- 'mousedown',
96
- 'mouseenter',
97
- 'mouseleave',
98
- 'mousemove',
99
- 'mouseout',
100
- 'mouseover',
101
- 'mouseup',
102
- 'nomatch',
103
- 'notificationclick',
104
- 'noupdate',
105
- 'obsolete',
106
- 'offline',
107
- 'online',
108
- 'open',
109
- 'orientationchange',
110
- 'pagehide',
111
- 'pageshow',
112
- 'paste',
113
- 'pause',
114
- 'pointercancel',
115
- 'pointerdown',
116
- 'pointerenter',
117
- 'pointerleave',
118
- 'pointerlockchange',
119
- 'pointerlockerror',
120
- 'pointermove',
121
- 'pointerout',
122
- 'pointerover',
123
- 'pointerup',
124
- 'play',
125
- 'playing',
126
- 'popstate',
127
- 'progress',
128
- 'push',
129
- 'pushsubscriptionchange',
130
- 'ratechange',
131
- 'readystatechange',
132
- 'repeatEvent',
133
- 'reset',
134
- 'resize',
135
- 'resourcetimingbufferfull',
136
- 'result',
137
- 'resume',
138
- 'scroll',
139
- 'seeked',
140
- 'seeking',
141
- 'select',
142
- 'selectstart',
143
- 'selectionchange',
144
- 'show',
145
- 'soundend',
146
- 'soundstart',
147
- 'speechend',
148
- 'speechstart',
149
- 'stalled',
150
- 'start',
151
- 'storage',
152
- 'submit',
153
- 'success',
154
- 'suspend',
155
- 'SVGAbort',
156
- 'SVGError',
157
- 'SVGLoad',
158
- 'SVGResize',
159
- 'SVGScroll',
160
- 'SVGUnload',
161
- 'SVGZoom',
162
- 'timeout',
163
- 'timeupdate',
164
- 'touchcancel',
165
- 'touchend',
166
- 'touchmove',
167
- 'touchstart',
168
- 'transitionend',
169
- 'unload',
170
- 'updateready',
171
- 'upgradeneeded',
172
- 'userproximity',
173
- 'voiceschanged',
174
- 'versionchange',
175
- 'visibilitychange',
176
- 'volumechange',
177
- 'waiting',
178
- 'wheel',
179
- ])));
6
+ return (nativeEventNames ??
7
+ (nativeEventNames = new Set([
8
+ // Source: https://developer.mozilla.org/en-US/docs/Web/Events
9
+ 'abort',
10
+ 'afterprint',
11
+ 'animationend',
12
+ 'animationiteration',
13
+ 'animationstart',
14
+ 'appinstalled',
15
+ 'audioprocess',
16
+ 'audioend',
17
+ 'audiostart',
18
+ 'beforeprint',
19
+ 'beforeunload',
20
+ 'beginEvent',
21
+ 'blocked',
22
+ 'blur',
23
+ 'boundary',
24
+ 'cached',
25
+ 'canplay',
26
+ 'canplaythrough',
27
+ 'change',
28
+ 'chargingchange',
29
+ 'chargingtimechange',
30
+ 'checking',
31
+ 'click',
32
+ 'close',
33
+ 'complete',
34
+ 'compositionend',
35
+ 'compositionstart',
36
+ 'compositionupdate',
37
+ 'contextmenu',
38
+ 'copy',
39
+ 'cut',
40
+ 'dblclick',
41
+ 'devicechange',
42
+ 'devicelight',
43
+ 'devicemotion',
44
+ 'deviceorientation',
45
+ 'deviceproximity',
46
+ 'dischargingtimechange',
47
+ 'DOMAttributeNameChanged',
48
+ 'DOMAttrModified',
49
+ 'DOMCharacterDataModified',
50
+ 'DOMContentLoaded',
51
+ 'DOMElementNameChanged',
52
+ 'focus',
53
+ 'focusin',
54
+ 'focusout',
55
+ 'DOMNodeInserted',
56
+ 'DOMNodeInsertedIntoDocument',
57
+ 'DOMNodeRemoved',
58
+ 'DOMNodeRemovedFromDocument',
59
+ 'DOMSubtreeModified',
60
+ 'downloading',
61
+ 'drag',
62
+ 'dragend',
63
+ 'dragenter',
64
+ 'dragleave',
65
+ 'dragover',
66
+ 'dragstart',
67
+ 'drop',
68
+ 'durationchange',
69
+ 'emptied',
70
+ 'end',
71
+ 'ended',
72
+ 'endEvent',
73
+ 'error',
74
+ 'fullscreenchange',
75
+ 'fullscreenerror',
76
+ 'gamepadconnected',
77
+ 'gamepaddisconnected',
78
+ 'gotpointercapture',
79
+ 'hashchange',
80
+ 'lostpointercapture',
81
+ 'input',
82
+ 'invalid',
83
+ 'keydown',
84
+ 'keypress',
85
+ 'keyup',
86
+ 'languagechange',
87
+ 'levelchange',
88
+ 'load',
89
+ 'loadeddata',
90
+ 'loadedmetadata',
91
+ 'loadend',
92
+ 'loadstart',
93
+ 'mark',
94
+ 'message',
95
+ 'messageerror',
96
+ 'mousedown',
97
+ 'mouseenter',
98
+ 'mouseleave',
99
+ 'mousemove',
100
+ 'mouseout',
101
+ 'mouseover',
102
+ 'mouseup',
103
+ 'nomatch',
104
+ 'notificationclick',
105
+ 'noupdate',
106
+ 'obsolete',
107
+ 'offline',
108
+ 'online',
109
+ 'open',
110
+ 'orientationchange',
111
+ 'pagehide',
112
+ 'pageshow',
113
+ 'paste',
114
+ 'pause',
115
+ 'pointercancel',
116
+ 'pointerdown',
117
+ 'pointerenter',
118
+ 'pointerleave',
119
+ 'pointerlockchange',
120
+ 'pointerlockerror',
121
+ 'pointermove',
122
+ 'pointerout',
123
+ 'pointerover',
124
+ 'pointerup',
125
+ 'play',
126
+ 'playing',
127
+ 'popstate',
128
+ 'progress',
129
+ 'push',
130
+ 'pushsubscriptionchange',
131
+ 'ratechange',
132
+ 'readystatechange',
133
+ 'repeatEvent',
134
+ 'reset',
135
+ 'resize',
136
+ 'resourcetimingbufferfull',
137
+ 'result',
138
+ 'resume',
139
+ 'scroll',
140
+ 'seeked',
141
+ 'seeking',
142
+ 'select',
143
+ 'selectstart',
144
+ 'selectionchange',
145
+ 'show',
146
+ 'soundend',
147
+ 'soundstart',
148
+ 'speechend',
149
+ 'speechstart',
150
+ 'stalled',
151
+ 'start',
152
+ 'storage',
153
+ 'submit',
154
+ 'success',
155
+ 'suspend',
156
+ 'SVGAbort',
157
+ 'SVGError',
158
+ 'SVGLoad',
159
+ 'SVGResize',
160
+ 'SVGScroll',
161
+ 'SVGUnload',
162
+ 'SVGZoom',
163
+ 'timeout',
164
+ 'timeupdate',
165
+ 'touchcancel',
166
+ 'touchend',
167
+ 'touchmove',
168
+ 'touchstart',
169
+ 'transitionend',
170
+ 'unload',
171
+ 'updateready',
172
+ 'upgradeneeded',
173
+ 'userproximity',
174
+ 'voiceschanged',
175
+ 'versionchange',
176
+ 'visibilitychange',
177
+ 'volumechange',
178
+ 'waiting',
179
+ 'wheel',
180
+ ])));
180
181
  }
181
182
  exports.getNativeEventNames = getNativeEventNames;
@@ -7,7 +7,7 @@ const utils_2 = require("../utils");
7
7
  function getImportAddFix({ compatibleWithTypeOnlyImport = false, fixer, importName, moduleName, node, }) {
8
8
  const fullImport = `import { ${importName} } from '${moduleName}';\n`;
9
9
  const importDeclarations = (0, ast_utils_1.getImportDeclarations)(node, moduleName);
10
- if (!(importDeclarations === null || importDeclarations === void 0 ? void 0 : importDeclarations.length)) {
10
+ if (!importDeclarations?.length) {
11
11
  return fixer.insertTextAfterRange([0, 0], fullImport);
12
12
  }
13
13
  const importDeclarationSpecifier = (0, ast_utils_1.getImportDeclarationSpecifier)(importDeclarations, importName);
@@ -25,8 +25,7 @@ function getImportAddFix({ compatibleWithTypeOnlyImport = false, fixer, importNa
25
25
  }
26
26
  exports.getImportAddFix = getImportAddFix;
27
27
  function getImportRemoveFix(sourceCode, importDeclarations, importName, fixer) {
28
- var _a;
29
- const { importDeclaration, importSpecifier } = (_a = (0, ast_utils_1.getImportDeclarationSpecifier)(importDeclarations, importName)) !== null && _a !== void 0 ? _a : {};
28
+ const { importDeclaration, importSpecifier } = (0, ast_utils_1.getImportDeclarationSpecifier)(importDeclarations, importName) ?? {};
30
29
  if (!importDeclaration || !importSpecifier)
31
30
  return undefined;
32
31
  const isFirstImportSpecifier = importDeclaration.specifiers[0] === importSpecifier;
@@ -11,9 +11,10 @@ exports.getTemplateParserServices = getTemplateParserServices;
11
11
  * If @angular-eslint/template-parser is not the configured parser when the function is invoked it will throw
12
12
  */
13
13
  function ensureTemplateParser(context) {
14
- var _a, _b;
15
- if (!((_a = context.parserServices) === null || _a === void 0 ? void 0 : _a.convertNodeSourceSpanToLoc) ||
16
- !((_b = context.parserServices) === null || _b === void 0 ? void 0 : _b.convertElementSourceSpanToLoc)) {
14
+ if (!context.parserServices
15
+ ?.convertNodeSourceSpanToLoc ||
16
+ !context.parserServices
17
+ ?.convertElementSourceSpanToLoc) {
17
18
  /**
18
19
  * The user needs to have configured "parser" in their eslint config and set it
19
20
  * to @angular-eslint/template-parser
@@ -37,14 +37,17 @@ function isValidParser(parser) {
37
37
  return VALID_PARSERS.includes(parser);
38
38
  }
39
39
  class RuleTester extends utils_1.TSESLint.RuleTester {
40
+ filename;
40
41
  // as of eslint 6 you have to provide an absolute path to the parser
41
42
  // but that's not as clean to type, this saves us trying to manually enforce
42
43
  // that contributors require.resolve everything
43
44
  constructor(options) {
44
- var _a, _b, _c;
45
- super(Object.assign(Object.assign({}, options), { parser: require.resolve(options.parser) }));
46
- if ((_a = options.parserOptions) === null || _a === void 0 ? void 0 : _a.project) {
47
- this.filename = path.join((_c = (_b = options.parserOptions) === null || _b === void 0 ? void 0 : _b.tsconfigRootDir) !== null && _c !== void 0 ? _c : getFixturesRootDir(), 'file.ts');
45
+ super({
46
+ ...options,
47
+ parser: require.resolve(options.parser),
48
+ });
49
+ if (options.parserOptions?.project) {
50
+ this.filename = path.join(options.parserOptions?.tsconfigRootDir ?? getFixturesRootDir(), 'file.ts');
48
51
  }
49
52
  // make sure that the parser doesn't hold onto file handles between tests
50
53
  // on linux (i.e. our CI env), there can be very a limited number of watch handles available
@@ -55,7 +58,7 @@ class RuleTester extends utils_1.TSESLint.RuleTester {
55
58
  // eslint-disable-next-line @typescript-eslint/no-var-requires
56
59
  require(options.parser).clearCaches();
57
60
  }
58
- catch (_a) {
61
+ catch {
59
62
  // ignored
60
63
  }
61
64
  });
@@ -67,20 +70,21 @@ class RuleTester extends utils_1.TSESLint.RuleTester {
67
70
  const errorMessage = `Do not set the parser at the test level unless you want to use a parser other than ${VALID_PARSERS.join(', ')}`;
68
71
  const parsedTests = {
69
72
  valid: valid.map((test) => {
70
- var _a;
71
73
  if (typeof test !== 'string' && isValidParser(test.parser)) {
72
74
  throw Error(errorMessage);
73
75
  }
74
76
  return typeof test === 'string'
75
77
  ? { code: test, filename: this.filename }
76
- : Object.assign(Object.assign({}, test), { filename: (_a = test.filename) !== null && _a !== void 0 ? _a : this.filename });
78
+ : { ...test, filename: test.filename ?? this.filename };
77
79
  }),
78
80
  invalid: invalid.map((test) => {
79
- var _a;
80
81
  if (isValidParser(test.parser)) {
81
82
  throw Error(errorMessage);
82
83
  }
83
- return Object.assign(Object.assign({}, test), { filename: (_a = test.filename) !== null && _a !== void 0 ? _a : this.filename });
84
+ return {
85
+ ...test,
86
+ filename: test.filename ?? this.filename,
87
+ };
84
88
  }),
85
89
  };
86
90
  super.run(name, rule, parsedTests);
package/dist/utils.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare const objectKeys: <T>(o: T) => readonly Extract<keyof T, string>[
15
15
  * Enforces the invariant that the input is an array.
16
16
  */
17
17
  export declare function arrayify<T>(value: T | readonly T[]): readonly T[];
18
- export declare const isNotNullOrUndefined: <T>(input: T | null | undefined) => input is T;
18
+ export declare const isNotNullOrUndefined: <T>(input: null | undefined | T) => input is T;
19
19
  export declare const kebabToCamelCase: (value: string) => string;
20
20
  /**
21
21
  * Convert an array to human-readable text.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/utils",
3
- "version": "17.3.1-alpha.0",
3
+ "version": "17.3.1-alpha.10",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "typescript": "*"
21
21
  },
22
22
  "dependencies": {
23
- "@angular-eslint/bundled-angular-compiler": "17.3.1-alpha.0",
24
- "@typescript-eslint/utils": "7.2.0"
23
+ "@angular-eslint/bundled-angular-compiler": "17.3.1-alpha.10",
24
+ "@typescript-eslint/utils": "7.7.0"
25
25
  },
26
26
  "gitHead": "e2006e5e9c99e5a943d1a999e0efa5247d29ec24"
27
27
  }