@angular-eslint/utils 12.7.0 → 13.0.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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [13.0.0](https://github.com/angular-eslint/angular-eslint/compare/v12.7.0...v13.0.0) (2021-11-18)
7
+
8
+ ### Features
9
+
10
+ - angular-eslint v13 ([#780](https://github.com/angular-eslint/angular-eslint/issues/780)) ([f7ce631](https://github.com/angular-eslint/angular-eslint/commit/f7ce631524dd7834a422a5ac93a4c0534f9f23fa))
11
+
6
12
  # [12.7.0](https://github.com/angular-eslint/angular-eslint/compare/v12.6.1...v12.7.0) (2021-11-18)
7
13
 
8
14
  **Note:** Version bump only for package @angular-eslint/utils
@@ -94,7 +94,7 @@ export declare const getDeclaredAngularLifecycleInterfaces: (node: TSESTree.Clas
94
94
  export declare const getDeclaredAngularLifecycleMethods: (node: TSESTree.ClassDeclaration) => readonly AngularLifecycleMethodKeys[];
95
95
  export declare function getNearestNodeFrom<T extends TSESTree.Node>({ parent }: TSESTree.Node, predicate: (parent: TSESTree.Node) => parent is T): T | null;
96
96
  export declare const getClassName: (node: TSESTree.Node) => string | undefined;
97
- export declare const getDecorator: (node: TSESTree.ClassDeclaration | TSESTree.ClassProperty | TSESTree.Identifier | TSESTree.MethodDefinition, decoratorName: string) => TSESTree.Decorator | undefined;
97
+ export declare const getDecorator: (node: TSESTree.ClassDeclaration | TSESTree.PropertyDefinition | TSESTree.Identifier | TSESTree.MethodDefinition, decoratorName: string) => TSESTree.Decorator | undefined;
98
98
  export declare const getAngularClassDecorator: ({ decorators, }: TSESTree.ClassDeclaration) => AngularClassDecoratorKeys | undefined;
99
99
  export declare const getDecoratorArgument: ({ expression, }: TSESTree.Decorator) => TSESTree.ObjectExpression | undefined;
100
100
  export declare const getDecoratorName: ({ expression, }: TSESTree.Decorator) => string | undefined;
@@ -105,7 +105,7 @@ export declare const isAngularLifecycleMethod: (value: string) => value is "ngAf
105
105
  export declare const isAngularClassDecorator: (value: string) => value is "Component" | "Directive" | "Injectable" | "NgModule" | "Pipe";
106
106
  export declare const isAngularInnerClassDecorator: (value: string) => value is AngularInnerClassDecoratorKeys;
107
107
  /**
108
- * `ClassProperty` nodes can have different types of `key`s
108
+ * `PropertyDefinition` nodes can have different types of `key`s
109
109
  *
110
110
  * E.g.
111
111
  *
@@ -115,7 +115,7 @@ export declare const isAngularInnerClassDecorator: (value: string) => value is A
115
115
  * ['c'] // Literal
116
116
  * }
117
117
  */
118
- export declare function getClassPropertyName({ computed, key, }: TSESTree.ClassProperty): string;
118
+ export declare function getPropertyDefinitionName({ computed, key, }: TSESTree.PropertyDefinition): string;
119
119
  export declare const getDecoratorProperty: (decorator: TSESTree.Decorator, name: string) => TSESTree.Property | undefined;
120
120
  export declare const getDecoratorPropertyValue: (decorator: TSESTree.Decorator, name: string) => TSESTree.Property['value'] | undefined;
121
121
  export declare const getDeclaredMethods: ({ body: { body }, }: TSESTree.ClassDeclaration) => readonly TSESTree.MethodDefinition[];
@@ -128,8 +128,8 @@ export declare function isCallExpression(node: TSESTree.Node): node is TSESTree.
128
128
  export declare function isMemberExpression(node: TSESTree.Node): node is TSESTree.MemberExpression;
129
129
  export declare function isIdentifierOrMemberExpression(node: TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
130
130
  export declare function isClassDeclaration(node: TSESTree.Node): node is TSESTree.ClassDeclaration;
131
- export declare function isClassProperty(node: TSESTree.Node): node is TSESTree.ClassProperty;
132
- export declare function isClassPropertyOrMethodDefinition(node: TSESTree.Node): node is TSESTree.ClassProperty | TSESTree.MethodDefinition;
131
+ export declare function isPropertyDefinition(node: TSESTree.Node): node is TSESTree.PropertyDefinition;
132
+ export declare function isPropertyOrMethodDefinition(node: TSESTree.Node): node is TSESTree.PropertyDefinition | TSESTree.MethodDefinition;
133
133
  export declare function isImportDefaultSpecifier(node: TSESTree.Node): node is TSESTree.ImportDefaultSpecifier;
134
134
  export declare function isImportNamespaceSpecifier(node: TSESTree.Node): node is TSESTree.ImportNamespaceSpecifier;
135
135
  export declare function isObjectExpression(node: TSESTree.Node): node is TSESTree.ObjectExpression;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isClassProperty = exports.isClassDeclaration = exports.isIdentifierOrMemberExpression = exports.isMemberExpression = exports.isCallExpression = exports.getReplacementText = exports.getRawText = exports.isImportedFrom = exports.getLifecycleInterfaceByMethodName = exports.getMethodName = exports.getDeclaredMethods = exports.getDecoratorPropertyValue = exports.getDecoratorProperty = exports.getClassPropertyName = exports.isAngularInnerClassDecorator = exports.isAngularClassDecorator = exports.isAngularLifecycleMethod = exports.isAngularLifecycleInterface = exports.ANGULAR_LIFECYCLE_METHODS = exports.ANGULAR_LIFECYCLE_INTERFACES = exports.getDecoratorName = exports.getDecoratorArgument = exports.getAngularClassDecorator = exports.getDecorator = exports.getClassName = exports.getNearestNodeFrom = exports.getDeclaredAngularLifecycleMethods = exports.getDeclaredAngularLifecycleInterfaces = exports.getDeclaredInterfaceNames = exports.getInterfaces = exports.getPipeDecorator = exports.getInterfaceName = exports.getInterface = exports.getImportDeclarationSpecifier = exports.getImportDeclarations = exports.getCorrespondentImportClause = exports.ANGULAR_CLASS_DECORATOR_MAPPER = exports.ANGULAR_CLASS_DECORATORS = exports.ANGULAR_INNER_CLASS_DECORATORS = exports.ANGULAR_CLASS_DECORATOR_LIFECYCLE_METHOD_MAPPER = exports.angularLifecycleMethodKeys = exports.angularLifecycleInterfaceKeys = exports.angularInnerClassDecoratorKeys = exports.angularClassDecoratorKeys = exports.OPTION_STYLE_KEBAB_CASE = exports.OPTION_STYLE_CAMEL_CASE = exports.AngularLifecycleMethods = exports.AngularLifecycleInterfaces = exports.AngularInnerClassDecorators = exports.AngularClassDecorators = void 0;
4
- exports.isImplementsToken = exports.isSuper = exports.isMethodDefinition = exports.isStringLiteral = exports.isImportSpecifier = exports.isImportDeclaration = exports.isTemplateLiteral = exports.isTemplateElement = exports.isLiteral = exports.isProperty = exports.isArrayExpression = exports.isObjectExpression = exports.isImportNamespaceSpecifier = exports.isImportDefaultSpecifier = exports.isClassPropertyOrMethodDefinition = void 0;
3
+ exports.isPropertyDefinition = exports.isClassDeclaration = exports.isIdentifierOrMemberExpression = exports.isMemberExpression = exports.isCallExpression = exports.getReplacementText = exports.getRawText = exports.isImportedFrom = exports.getLifecycleInterfaceByMethodName = exports.getMethodName = exports.getDeclaredMethods = exports.getDecoratorPropertyValue = exports.getDecoratorProperty = exports.getPropertyDefinitionName = exports.isAngularInnerClassDecorator = exports.isAngularClassDecorator = exports.isAngularLifecycleMethod = exports.isAngularLifecycleInterface = exports.ANGULAR_LIFECYCLE_METHODS = exports.ANGULAR_LIFECYCLE_INTERFACES = exports.getDecoratorName = exports.getDecoratorArgument = exports.getAngularClassDecorator = exports.getDecorator = exports.getClassName = exports.getNearestNodeFrom = exports.getDeclaredAngularLifecycleMethods = exports.getDeclaredAngularLifecycleInterfaces = exports.getDeclaredInterfaceNames = exports.getInterfaces = exports.getPipeDecorator = exports.getInterfaceName = exports.getInterface = exports.getImportDeclarationSpecifier = exports.getImportDeclarations = exports.getCorrespondentImportClause = exports.ANGULAR_CLASS_DECORATOR_MAPPER = exports.ANGULAR_CLASS_DECORATORS = exports.ANGULAR_INNER_CLASS_DECORATORS = exports.ANGULAR_CLASS_DECORATOR_LIFECYCLE_METHOD_MAPPER = exports.angularLifecycleMethodKeys = exports.angularLifecycleInterfaceKeys = exports.angularInnerClassDecoratorKeys = exports.angularClassDecoratorKeys = exports.OPTION_STYLE_KEBAB_CASE = exports.OPTION_STYLE_CAMEL_CASE = exports.AngularLifecycleMethods = exports.AngularLifecycleInterfaces = exports.AngularInnerClassDecorators = exports.AngularClassDecorators = void 0;
4
+ exports.isImplementsToken = exports.isSuper = exports.isMethodDefinition = exports.isStringLiteral = exports.isImportSpecifier = exports.isImportDeclaration = exports.isTemplateLiteral = exports.isTemplateElement = exports.isLiteral = exports.isProperty = exports.isArrayExpression = exports.isObjectExpression = exports.isImportNamespaceSpecifier = exports.isImportDefaultSpecifier = exports.isPropertyOrMethodDefinition = void 0;
5
5
  const experimental_utils_1 = require("@typescript-eslint/experimental-utils");
6
6
  const utils_1 = require("../utils");
7
7
  var AngularClassDecorators;
@@ -62,10 +62,10 @@ var AngularLifecycleMethods;
62
62
  })(AngularLifecycleMethods = exports.AngularLifecycleMethods || (exports.AngularLifecycleMethods = {}));
63
63
  exports.OPTION_STYLE_CAMEL_CASE = 'camelCase';
64
64
  exports.OPTION_STYLE_KEBAB_CASE = 'kebab-case';
65
- exports.angularClassDecoratorKeys = utils_1.objectKeys(AngularClassDecorators);
66
- exports.angularInnerClassDecoratorKeys = utils_1.objectKeys(exports.AngularInnerClassDecorators);
67
- exports.angularLifecycleInterfaceKeys = utils_1.objectKeys(AngularLifecycleInterfaces);
68
- exports.angularLifecycleMethodKeys = utils_1.objectKeys(AngularLifecycleMethods);
65
+ exports.angularClassDecoratorKeys = (0, utils_1.objectKeys)(AngularClassDecorators);
66
+ exports.angularInnerClassDecoratorKeys = (0, utils_1.objectKeys)(exports.AngularInnerClassDecorators);
67
+ exports.angularLifecycleInterfaceKeys = (0, utils_1.objectKeys)(AngularLifecycleInterfaces);
68
+ exports.angularLifecycleMethodKeys = (0, utils_1.objectKeys)(AngularLifecycleMethods);
69
69
  exports.ANGULAR_CLASS_DECORATOR_LIFECYCLE_METHOD_MAPPER = new Map([
70
70
  [
71
71
  AngularClassDecorators.Component,
@@ -147,7 +147,7 @@ exports.ANGULAR_CLASS_DECORATOR_MAPPER = new Map([
147
147
  function getCorrespondentImportClause(importDeclarations, compatibleWithTypeOnlyImport = false) {
148
148
  let importClause;
149
149
  for (const { importKind, specifiers } of importDeclarations) {
150
- const lastImportSpecifier = utils_1.getLast(specifiers);
150
+ const lastImportSpecifier = (0, utils_1.getLast)(specifiers);
151
151
  if ((!compatibleWithTypeOnlyImport && importKind === 'type') ||
152
152
  isImportNamespaceSpecifier(lastImportSpecifier)) {
153
153
  continue;
@@ -193,7 +193,7 @@ function getInterfaceName(interfaceMember) {
193
193
  : undefined;
194
194
  }
195
195
  exports.getInterfaceName = getInterfaceName;
196
- const getPipeDecorator = (node) => exports.getDecorator(node, 'Pipe');
196
+ const getPipeDecorator = (node) => (0, exports.getDecorator)(node, 'Pipe');
197
197
  exports.getPipeDecorator = getPipeDecorator;
198
198
  function getInterfaces(node) {
199
199
  var _a;
@@ -208,7 +208,7 @@ function getDeclaredInterfaceNames(node) {
208
208
  exports.getDeclaredInterfaceNames = getDeclaredInterfaceNames;
209
209
  const getDeclaredAngularLifecycleInterfaces = (node) => getDeclaredInterfaceNames(node).filter(exports.isAngularLifecycleInterface);
210
210
  exports.getDeclaredAngularLifecycleInterfaces = getDeclaredAngularLifecycleInterfaces;
211
- const getDeclaredAngularLifecycleMethods = (node) => exports.getDeclaredMethods(node)
211
+ const getDeclaredAngularLifecycleMethods = (node) => (0, exports.getDeclaredMethods)(node)
212
212
  .map(exports.getMethodName)
213
213
  .filter(utils_1.isNotNullOrUndefined)
214
214
  .filter(exports.isAngularLifecycleMethod);
@@ -229,14 +229,14 @@ const getClassName = (node) => {
229
229
  return (_a = node.id) === null || _a === void 0 ? void 0 : _a.name;
230
230
  }
231
231
  if (node.parent) {
232
- return exports.getClassName(node.parent);
232
+ return (0, exports.getClassName)(node.parent);
233
233
  }
234
234
  return undefined;
235
235
  };
236
236
  exports.getClassName = getClassName;
237
237
  const getDecorator = (node, decoratorName) => {
238
238
  var _a;
239
- return (_a = node.decorators) === null || _a === void 0 ? void 0 : _a.find((decorator) => exports.getDecoratorName(decorator) === decoratorName);
239
+ return (_a = node.decorators) === null || _a === void 0 ? void 0 : _a.find((decorator) => (0, exports.getDecoratorName)(decorator) === decoratorName);
240
240
  };
241
241
  exports.getDecorator = getDecorator;
242
242
  const getAngularClassDecorator = ({ decorators, }) => {
@@ -271,7 +271,7 @@ exports.isAngularClassDecorator = isAngularClassDecorator;
271
271
  const isAngularInnerClassDecorator = (value) => exports.ANGULAR_INNER_CLASS_DECORATORS.has(value);
272
272
  exports.isAngularInnerClassDecorator = isAngularInnerClassDecorator;
273
273
  /**
274
- * `ClassProperty` nodes can have different types of `key`s
274
+ * `PropertyDefinition` nodes can have different types of `key`s
275
275
  *
276
276
  * E.g.
277
277
  *
@@ -281,24 +281,24 @@ exports.isAngularInnerClassDecorator = isAngularInnerClassDecorator;
281
281
  * ['c'] // Literal
282
282
  * }
283
283
  */
284
- function getClassPropertyName({ computed, key, }) {
284
+ function getPropertyDefinitionName({ computed, key, }) {
285
285
  if (experimental_utils_1.ASTUtils.isIdentifier(key) && !computed) {
286
286
  return key.name;
287
287
  }
288
288
  if (isLiteral(key)) {
289
289
  return key.raw;
290
290
  }
291
- throw new Error(`Unexpected "ClassProperty.key.type" provided: ${key.type}`);
291
+ throw new Error(`Unexpected "PropertyDefinition.key.type" provided: ${key.type}`);
292
292
  }
293
- exports.getClassPropertyName = getClassPropertyName;
293
+ exports.getPropertyDefinitionName = getPropertyDefinitionName;
294
294
  const getDecoratorProperty = (decorator, name) => {
295
295
  var _a;
296
- return (_a = exports.getDecoratorArgument(decorator)) === null || _a === void 0 ? void 0 : _a.properties.filter(isProperty).find(({ key }) => experimental_utils_1.ASTUtils.isIdentifier(key) && key.name === name);
296
+ return (_a = (0, exports.getDecoratorArgument)(decorator)) === null || _a === void 0 ? void 0 : _a.properties.filter(isProperty).find(({ key }) => experimental_utils_1.ASTUtils.isIdentifier(key) && key.name === name);
297
297
  };
298
298
  exports.getDecoratorProperty = getDecoratorProperty;
299
299
  const getDecoratorPropertyValue = (decorator, name) => {
300
300
  var _a;
301
- return (_a = exports.getDecoratorProperty(decorator, name)) === null || _a === void 0 ? void 0 : _a.value;
301
+ return (_a = (0, exports.getDecoratorProperty)(decorator, name)) === null || _a === void 0 ? void 0 : _a.value;
302
302
  };
303
303
  exports.getDecoratorPropertyValue = getDecoratorPropertyValue;
304
304
  const getDeclaredMethods = ({ body: { body }, }) => {
@@ -325,7 +325,9 @@ function getRawText(node) {
325
325
  if (experimental_utils_1.ASTUtils.isIdentifier(node)) {
326
326
  return node.name;
327
327
  }
328
- if (isClassProperty(node) || isMethodDefinition(node) || isProperty(node)) {
328
+ if (isPropertyDefinition(node) ||
329
+ isMethodDefinition(node) ||
330
+ isProperty(node)) {
329
331
  return getRawText(node.key);
330
332
  }
331
333
  if (isLiteral(node)) {
@@ -362,14 +364,14 @@ function isClassDeclaration(node) {
362
364
  return node.type === experimental_utils_1.AST_NODE_TYPES.ClassDeclaration;
363
365
  }
364
366
  exports.isClassDeclaration = isClassDeclaration;
365
- function isClassProperty(node) {
366
- return node.type === experimental_utils_1.AST_NODE_TYPES.ClassProperty;
367
+ function isPropertyDefinition(node) {
368
+ return node.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition;
367
369
  }
368
- exports.isClassProperty = isClassProperty;
369
- function isClassPropertyOrMethodDefinition(node) {
370
- return isClassProperty(node) || isMethodDefinition(node);
370
+ exports.isPropertyDefinition = isPropertyDefinition;
371
+ function isPropertyOrMethodDefinition(node) {
372
+ return isPropertyDefinition(node) || isMethodDefinition(node);
371
373
  }
372
- exports.isClassPropertyOrMethodDefinition = isClassPropertyOrMethodDefinition;
374
+ exports.isPropertyOrMethodDefinition = isPropertyOrMethodDefinition;
373
375
  function isImportDefaultSpecifier(node) {
374
376
  return node.type === experimental_utils_1.AST_NODE_TYPES.ImportDefaultSpecifier;
375
377
  }
@@ -6,19 +6,19 @@ const ast_utils_1 = require("./ast-utils");
6
6
  const utils_1 = require("../utils");
7
7
  function getImportAddFix({ compatibleWithTypeOnlyImport = false, fixer, importName, moduleName, node, }) {
8
8
  const fullImport = `import { ${importName} } from '${moduleName}';\n`;
9
- const importDeclarations = ast_utils_1.getImportDeclarations(node, moduleName);
9
+ const importDeclarations = (0, ast_utils_1.getImportDeclarations)(node, moduleName);
10
10
  if (!(importDeclarations === null || importDeclarations === void 0 ? void 0 : importDeclarations.length)) {
11
11
  return fixer.insertTextAfterRange([0, 0], fullImport);
12
12
  }
13
- const importDeclarationSpecifier = ast_utils_1.getImportDeclarationSpecifier(importDeclarations, importName);
13
+ const importDeclarationSpecifier = (0, ast_utils_1.getImportDeclarationSpecifier)(importDeclarations, importName);
14
14
  if (importDeclarationSpecifier) {
15
15
  return undefined;
16
16
  }
17
- const importClause = ast_utils_1.getCorrespondentImportClause(importDeclarations, compatibleWithTypeOnlyImport);
17
+ const importClause = (0, ast_utils_1.getCorrespondentImportClause)(importDeclarations, compatibleWithTypeOnlyImport);
18
18
  if (!importClause) {
19
19
  return fixer.insertTextAfterRange([0, 0], fullImport);
20
20
  }
21
- const replacementText = ast_utils_1.isImportDefaultSpecifier(importClause)
21
+ const replacementText = (0, ast_utils_1.isImportDefaultSpecifier)(importClause)
22
22
  ? `, { ${importName} }`
23
23
  : `, ${importName}`;
24
24
  return fixer.insertTextAfter(importClause, replacementText);
@@ -26,11 +26,11 @@ function getImportAddFix({ compatibleWithTypeOnlyImport = false, fixer, importNa
26
26
  exports.getImportAddFix = getImportAddFix;
27
27
  function getImportRemoveFix(sourceCode, importDeclarations, importName, fixer) {
28
28
  var _a;
29
- const { importDeclaration, importSpecifier } = (_a = ast_utils_1.getImportDeclarationSpecifier(importDeclarations, importName)) !== null && _a !== void 0 ? _a : {};
29
+ const { importDeclaration, importSpecifier } = (_a = (0, ast_utils_1.getImportDeclarationSpecifier)(importDeclarations, importName)) !== null && _a !== void 0 ? _a : {};
30
30
  if (!importDeclaration || !importSpecifier)
31
31
  return undefined;
32
32
  const isFirstImportSpecifier = importDeclaration.specifiers[0] === importSpecifier;
33
- const isLastImportSpecifier = utils_1.getLast(importDeclaration.specifiers) === importSpecifier;
33
+ const isLastImportSpecifier = (0, utils_1.getLast)(importDeclaration.specifiers) === importSpecifier;
34
34
  const isSingleImportSpecifier = isFirstImportSpecifier && isLastImportSpecifier;
35
35
  if (isSingleImportSpecifier) {
36
36
  return fixer.remove(importDeclaration);
@@ -53,17 +53,17 @@ function getImportRemoveFix(sourceCode, importDeclarations, importName, fixer) {
53
53
  exports.getImportRemoveFix = getImportRemoveFix;
54
54
  function getImplementsSchemaFixer({ id, implements: classImplements }, interfaceName) {
55
55
  const [implementsNodeReplace, implementsTextReplace] = classImplements
56
- ? [utils_1.getLast(classImplements), `, ${interfaceName}`]
56
+ ? [(0, utils_1.getLast)(classImplements), `, ${interfaceName}`]
57
57
  : [id, ` implements ${interfaceName}`];
58
58
  return { implementsNodeReplace, implementsTextReplace };
59
59
  }
60
60
  exports.getImplementsSchemaFixer = getImplementsSchemaFixer;
61
61
  function getDecoratorPropertyAddFix({ expression }, fixer, text) {
62
- if (!ast_utils_1.isCallExpression(expression)) {
62
+ if (!(0, ast_utils_1.isCallExpression)(expression)) {
63
63
  return undefined;
64
64
  }
65
65
  const [firstArgument] = expression.arguments;
66
- if (!firstArgument || !ast_utils_1.isObjectExpression(firstArgument)) {
66
+ if (!firstArgument || !(0, ast_utils_1.isObjectExpression)(firstArgument)) {
67
67
  // `@Component()` => `@Component({changeDetection: ChangeDetectionStrategy.OnPush})`
68
68
  const [initialRange, endRange] = expression.range;
69
69
  return fixer.insertTextAfterRange([initialRange + 1, endRange - 1], `{${text}}`);
@@ -82,15 +82,15 @@ function getImplementsRemoveFix(sourceCode, classDeclaration, interfaceName, fix
82
82
  const { implements: classImplements } = classDeclaration;
83
83
  if (!classImplements)
84
84
  return undefined;
85
- const identifier = ast_utils_1.getInterface(classDeclaration, interfaceName);
85
+ const identifier = (0, ast_utils_1.getInterface)(classDeclaration, interfaceName);
86
86
  if (!identifier)
87
87
  return undefined;
88
88
  const isFirstInterface = classImplements[0].expression === identifier;
89
- const isLastInterface = utils_1.getLast(classImplements).expression === identifier;
89
+ const isLastInterface = (0, utils_1.getLast)(classImplements).expression === identifier;
90
90
  const hasSingleInterfaceImplemented = isFirstInterface && isLastInterface;
91
91
  const tokenBeforeInterface = sourceCode.getTokenBefore(identifier);
92
92
  if (hasSingleInterfaceImplemented) {
93
- return !tokenBeforeInterface || !ast_utils_1.isImplementsToken(tokenBeforeInterface)
93
+ return !tokenBeforeInterface || !(0, ast_utils_1.isImplementsToken)(tokenBeforeInterface)
94
94
  ? undefined
95
95
  : fixer.removeRange([
96
96
  tokenBeforeInterface.range[0],
@@ -56,7 +56,7 @@ const reportPrefixError = (node, prefix, context) => {
56
56
  node,
57
57
  messageId: 'prefixFailure',
58
58
  data: {
59
- prefix: utils_1.toHumanReadableText(utils_1.arrayify(prefix)),
59
+ prefix: (0, utils_1.toHumanReadableText)((0, utils_1.arrayify)(prefix)),
60
60
  },
61
61
  });
62
62
  };
@@ -83,7 +83,7 @@ const reportTypeError = (node, type, context) => {
83
83
  exports.reportTypeError = reportTypeError;
84
84
  const checkValidOptions = (type, prefix, style) => {
85
85
  // Get options
86
- const typeOption = utils_1.arrayify(type);
86
+ const typeOption = (0, utils_1.arrayify)(type);
87
87
  const styleOption = style;
88
88
  // Check if options are valid
89
89
  const isTypeOptionValid = typeOption.length > 0 &&
@@ -96,15 +96,15 @@ const checkValidOptions = (type, prefix, style) => {
96
96
  exports.checkValidOptions = checkValidOptions;
97
97
  const checkSelector = (node, typeOption, prefixOption, styleOption) => {
98
98
  // Get valid list of selectors
99
- const types = utils_1.arrayify(typeOption || [exports.OPTION_TYPE_ATTRS, exports.OPTION_TYPE_ELEMENT]).reduce((previousValue, currentValue) => previousValue.concat(SELECTOR_TYPE_MAPPER[currentValue]), []);
99
+ const types = (0, utils_1.arrayify)(typeOption || [exports.OPTION_TYPE_ATTRS, exports.OPTION_TYPE_ELEMENT]).reduce((previousValue, currentValue) => previousValue.concat(SELECTOR_TYPE_MAPPER[currentValue]), []);
100
100
  const styleValidator = styleOption === ast_utils_1.OPTION_STYLE_KEBAB_CASE
101
101
  ? exports.SelectorValidator.kebabCase
102
102
  : exports.SelectorValidator.camelCase;
103
103
  let listSelectors = null;
104
- if (node && ast_utils_1.isLiteral(node)) {
104
+ if (node && (0, ast_utils_1.isLiteral)(node)) {
105
105
  listSelectors = bundled_angular_compiler_1.CssSelector.parse(node.raw);
106
106
  }
107
- else if (node && ast_utils_1.isTemplateLiteral(node) && node.quasis[0]) {
107
+ else if (node && (0, ast_utils_1.isTemplateLiteral)(node) && node.quasis[0]) {
108
108
  listSelectors = bundled_angular_compiler_1.CssSelector.parse(node.quasis[0].value.raw);
109
109
  }
110
110
  if (!listSelectors) {
@@ -22,8 +22,8 @@ exports.COMPONENT_SELECTOR_LITERAL = `${exports.COMPONENT_CLASS_DECORATOR} ${met
22
22
  exports.DIRECTIVE_SELECTOR_LITERAL = `${exports.DIRECTIVE_CLASS_DECORATOR} ${metadataProperty('selector')} ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
23
23
  exports.COMPONENT_OR_DIRECTIVE_SELECTOR_LITERAL = `:matches(${exports.COMPONENT_SELECTOR_LITERAL}, ${exports.DIRECTIVE_SELECTOR_LITERAL})`;
24
24
  exports.INPUTS_METADATA_PROPERTY_LITERAL = `${exports.COMPONENT_OR_DIRECTIVE_CLASS_DECORATOR} ${metadataProperty('inputs')} > ArrayExpression ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
25
- exports.INPUT_ALIAS = `:matches(ClassProperty, MethodDefinition[kind='set']) ${exports.INPUT_DECORATOR} ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
26
- exports.INPUT_PROPERTY_OR_SETTER = `:matches(ClassProperty, MethodDefinition[kind='set'])[computed=false]:has(${exports.INPUT_DECORATOR}) > :matches(Identifier, Literal)`;
25
+ exports.INPUT_ALIAS = `:matches(PropertyDefinition, MethodDefinition[kind='set']) ${exports.INPUT_DECORATOR} ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
26
+ exports.INPUT_PROPERTY_OR_SETTER = `:matches(PropertyDefinition, MethodDefinition[kind='set'])[computed=false]:has(${exports.INPUT_DECORATOR}) > :matches(Identifier, Literal)`;
27
27
  exports.OUTPUTS_METADATA_PROPERTY_LITERAL = `${exports.COMPONENT_OR_DIRECTIVE_CLASS_DECORATOR} ${metadataProperty('outputs')} > ArrayExpression ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
28
- exports.OUTPUT_ALIAS = `:matches(ClassProperty, MethodDefinition[kind='get']) ${exports.OUTPUT_DECORATOR} ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
29
- exports.OUTPUT_PROPERTY_OR_GETTER = `:matches(ClassProperty, MethodDefinition[kind='get'])[computed=false]:has(${exports.OUTPUT_DECORATOR}) > :matches(Identifier, Literal)`;
28
+ exports.OUTPUT_ALIAS = `:matches(PropertyDefinition, MethodDefinition[kind='get']) ${exports.OUTPUT_DECORATOR} ${exports.LITERAL_OR_TEMPLATE_ELEMENT}`;
29
+ exports.OUTPUT_PROPERTY_OR_GETTER = `:matches(PropertyDefinition, MethodDefinition[kind='get'])[computed=false]:has(${exports.OUTPUT_DECORATOR}) > :matches(Identifier, Literal)`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/utils",
3
- "version": "12.7.0",
3
+ "version": "13.0.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,12 +11,12 @@
11
11
  "LICENSE"
12
12
  ],
13
13
  "peerDependencies": {
14
- "eslint": "*",
14
+ "eslint": "^7.0.0 || ^8.0.0",
15
15
  "typescript": "*"
16
16
  },
17
17
  "dependencies": {
18
- "@angular-eslint/bundled-angular-compiler": "12.7.0",
19
- "@typescript-eslint/experimental-utils": "4.28.2"
18
+ "@angular-eslint/bundled-angular-compiler": "13.0.0",
19
+ "@typescript-eslint/experimental-utils": "5.3.0"
20
20
  },
21
- "gitHead": "f1e7704b7c0f57d7743fef8cd7500bc3103b9b5b"
21
+ "gitHead": "3c3f54614742941d39e2dae941febdee05525ff1"
22
22
  }