@angular-eslint/utils 15.1.1-alpha.3 → 15.1.1-alpha.30

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.
@@ -9,24 +9,24 @@ import type { TSESLint } from '@typescript-eslint/utils';
9
9
  * See the convertAnnotatedSourceToFailureCase() utility itself for more details.
10
10
  */
11
11
  export declare const SPECIAL_UNDERLINE_CHARS: readonly ["~", "^", "#", "%", "¶", "*", "¨", "@"];
12
- declare type MultipleErrorOptions<TMessageIds extends string> = BaseErrorOptions & {
12
+ type MultipleErrorOptions<TMessageIds extends string> = BaseErrorOptions & {
13
13
  readonly messages: readonly (Message<TMessageIds> & {
14
- readonly char: typeof SPECIAL_UNDERLINE_CHARS[number];
14
+ readonly char: (typeof SPECIAL_UNDERLINE_CHARS)[number];
15
15
  })[];
16
16
  };
17
- declare type BaseErrorOptions = {
17
+ type BaseErrorOptions = {
18
18
  readonly description: string;
19
19
  readonly annotatedSource: string;
20
20
  readonly options?: readonly unknown[];
21
21
  readonly annotatedOutput?: string;
22
22
  readonly filename?: string;
23
23
  };
24
- declare type Message<TMessageIds extends string> = {
24
+ type Message<TMessageIds extends string> = {
25
25
  readonly messageId: TMessageIds;
26
26
  readonly data?: Record<string, unknown>;
27
27
  readonly suggestions?: TSESLint.SuggestionOutput<TMessageIds>[];
28
28
  };
29
- declare type SingleErrorOptions<TMessageIds extends string> = BaseErrorOptions & Message<TMessageIds>;
29
+ type SingleErrorOptions<TMessageIds extends string> = BaseErrorOptions & Message<TMessageIds>;
30
30
  /**
31
31
  * convertAnnotatedSourceToFailureCase() provides an ergonomic way to easily write
32
32
  * expected failure cases for ESLint rules by allowing you to directly annotate the
@@ -66,11 +66,11 @@ export declare enum AngularLifecycleMethods {
66
66
  }
67
67
  export declare const OPTION_STYLE_CAMEL_CASE = "camelCase";
68
68
  export declare const OPTION_STYLE_KEBAB_CASE = "kebab-case";
69
- export declare type SelectorStyle = typeof OPTION_STYLE_CAMEL_CASE | typeof OPTION_STYLE_KEBAB_CASE;
70
- export declare type AngularClassDecoratorKeys = keyof typeof AngularClassDecorators;
71
- export declare type AngularInnerClassDecoratorKeys = Exclude<keyof typeof AngularInnerClassDecorators, number>;
72
- export declare type AngularLifecycleInterfaceKeys = keyof typeof AngularLifecycleInterfaces;
73
- export declare type AngularLifecycleMethodKeys = keyof typeof AngularLifecycleMethods;
69
+ export type SelectorStyle = typeof OPTION_STYLE_CAMEL_CASE | typeof OPTION_STYLE_KEBAB_CASE;
70
+ export type AngularClassDecoratorKeys = keyof typeof AngularClassDecorators;
71
+ export type AngularInnerClassDecoratorKeys = Exclude<keyof typeof AngularInnerClassDecorators, number>;
72
+ export type AngularLifecycleInterfaceKeys = keyof typeof AngularLifecycleInterfaces;
73
+ export type AngularLifecycleMethodKeys = keyof typeof AngularLifecycleMethods;
74
74
  export declare const angularClassDecoratorKeys: readonly ("Component" | "Directive" | "Injectable" | "NgModule" | "Pipe")[];
75
75
  export declare const angularInnerClassDecoratorKeys: readonly ("ContentChild" | "ContentChildren" | "HostBinding" | "Input" | "Output" | "ViewChild" | "ViewChildren" | "HostListener" | "Attribute" | "Host" | "Inject" | "Optional" | "Self" | "SkipSelf")[];
76
76
  export declare const angularLifecycleInterfaceKeys: readonly ("AfterContentChecked" | "AfterContentInit" | "AfterViewChecked" | "AfterViewInit" | "DoBootstrap" | "DoCheck" | "OnChanges" | "OnDestroy" | "OnInit")[];
@@ -3,10 +3,10 @@ import type { SelectorStyle } from './ast-utils';
3
3
  export declare const OPTION_TYPE_ATTRIBUTE = "attribute";
4
4
  export declare const OPTION_TYPE_ATTRS = "attrs";
5
5
  export declare const OPTION_TYPE_ELEMENT = "element";
6
- export declare type SelectorStyleOption = SelectorStyle | string;
7
- export declare type SelectorTypeOption = typeof OPTION_TYPE_ATTRIBUTE | typeof OPTION_TYPE_ELEMENT | string;
8
- export declare type SelectorTypeInternal = typeof OPTION_TYPE_ATTRS | typeof OPTION_TYPE_ELEMENT;
9
- export declare type Options = [
6
+ export type SelectorStyleOption = SelectorStyle | string;
7
+ export type SelectorTypeOption = typeof OPTION_TYPE_ATTRIBUTE | typeof OPTION_TYPE_ELEMENT | string;
8
+ export type SelectorTypeInternal = typeof OPTION_TYPE_ATTRS | typeof OPTION_TYPE_ELEMENT;
9
+ export type Options = [
10
10
  {
11
11
  readonly type: SelectorTypeOption | readonly SelectorTypeOption[];
12
12
  readonly prefix: string | readonly string[];
@@ -18,10 +18,11 @@ export declare const SelectorValidator: {
18
18
  camelCase(selector: string): boolean;
19
19
  element(selector: string): boolean;
20
20
  kebabCase(selector: string): boolean;
21
- prefix(prefix: string, selectorStyle: SelectorStyle): (selector: string) => boolean;
21
+ prefix(prefix: string, selectorStyle: string): (selector: string) => boolean;
22
22
  };
23
23
  export declare const reportPrefixError: (node: TSESTree.Node, prefix: string | readonly string[], context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>) => void;
24
24
  export declare const reportStyleError: (node: TSESTree.Node, style: SelectorStyleOption, context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>) => void;
25
+ export declare const reportStyleAndPrefixError: (node: TSESTree.Node, style: SelectorStyleOption, prefix: string | readonly string[], context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>) => void;
25
26
  export declare const reportTypeError: (node: TSESTree.Node, type: SelectorTypeOption | readonly SelectorTypeOption[], context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>) => void;
26
27
  export declare const checkValidOptions: (type: SelectorTypeOption | readonly SelectorTypeOption[], prefix: string | readonly string[], style: SelectorStyleOption) => boolean;
27
28
  export declare const checkSelector: (node: TSESTree.Node, typeOption: SelectorTypeOption | readonly SelectorTypeOption[], prefixOption: readonly string[], styleOption: SelectorStyle) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkSelector = exports.checkValidOptions = exports.reportTypeError = exports.reportStyleError = exports.reportPrefixError = exports.SelectorValidator = exports.OPTION_TYPE_ELEMENT = exports.OPTION_TYPE_ATTRS = exports.OPTION_TYPE_ATTRIBUTE = void 0;
3
+ exports.checkSelector = exports.checkValidOptions = exports.reportTypeError = exports.reportStyleAndPrefixError = exports.reportStyleError = exports.reportPrefixError = exports.SelectorValidator = exports.OPTION_TYPE_ELEMENT = exports.OPTION_TYPE_ATTRS = exports.OPTION_TYPE_ATTRIBUTE = void 0;
4
4
  const bundled_angular_compiler_1 = require("@angular-eslint/bundled-angular-compiler");
5
5
  const ast_utils_1 = require("./ast-utils");
6
6
  const utils_1 = require("../utils");
@@ -71,6 +71,17 @@ const reportStyleError = (node, style, context) => {
71
71
  });
72
72
  };
73
73
  exports.reportStyleError = reportStyleError;
74
+ const reportStyleAndPrefixError = (node, style, prefix, context) => {
75
+ context.report({
76
+ node,
77
+ messageId: 'styleAndPrefixFailure',
78
+ data: {
79
+ style,
80
+ prefix: (0, utils_1.toHumanReadableText)((0, utils_1.arrayify)(prefix)),
81
+ },
82
+ });
83
+ };
84
+ exports.reportStyleAndPrefixError = reportStyleAndPrefixError;
74
85
  const reportTypeError = (node, type, context) => {
75
86
  context.report({
76
87
  node,
@@ -1,7 +1,7 @@
1
1
  import { TSESLint } from '@typescript-eslint/utils';
2
2
  declare const VALID_PARSERS: readonly ["@angular-eslint/template-parser", "@typescript-eslint/parser"];
3
- declare type RuleTesterConfig = Omit<TSESLint.RuleTesterConfig, 'parser'> & {
4
- parser: typeof VALID_PARSERS[number];
3
+ type RuleTesterConfig = Omit<TSESLint.RuleTesterConfig, 'parser'> & {
4
+ parser: (typeof VALID_PARSERS)[number];
5
5
  };
6
6
  export declare class RuleTester extends TSESLint.RuleTester {
7
7
  private filename?;
@@ -41,10 +41,10 @@ class RuleTester extends utils_1.TSESLint.RuleTester {
41
41
  // but that's not as clean to type, this saves us trying to manually enforce
42
42
  // that contributors require.resolve everything
43
43
  constructor(options) {
44
- var _a;
44
+ var _a, _b, _c;
45
45
  super(Object.assign(Object.assign({}, options), { parser: require.resolve(options.parser) }));
46
46
  if ((_a = options.parserOptions) === null || _a === void 0 ? void 0 : _a.project) {
47
- this.filename = path.join(getFixturesRootDir(), 'file.ts');
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');
48
48
  }
49
49
  // make sure that the parser doesn't hold onto file handles between tests
50
50
  // on linux (i.e. our CI env), there can be very a limited number of watch handles available
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/utils",
3
- "version": "15.1.1-alpha.3+3ee4816",
3
+ "version": "15.1.1-alpha.30+539cf9f",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,8 +15,8 @@
15
15
  "typescript": "*"
16
16
  },
17
17
  "dependencies": {
18
- "@angular-eslint/bundled-angular-compiler": "15.1.1-alpha.3+3ee4816",
19
- "@typescript-eslint/utils": "5.44.0"
18
+ "@angular-eslint/bundled-angular-compiler": "15.1.1-alpha.30+539cf9f",
19
+ "@typescript-eslint/utils": "5.45.1"
20
20
  },
21
- "gitHead": "3ee4816e9adb704f01e3d602be2102e867705b6e"
21
+ "gitHead": "539cf9f0cd33eae888cd27087ec9c22379161c93"
22
22
  }