@angular-eslint/eslint-plugin 20.6.1-alpha.4 → 20.6.1-alpha.6

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/index.d.ts CHANGED
@@ -97,7 +97,7 @@ declare const _default: {
97
97
  "no-outputs-metadata-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noOutputsMetadataProperty", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
98
98
  "no-pipe-impure": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-pipe-impure").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
99
99
  "no-queries-metadata-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noQueriesMetadataProperty", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
100
- "pipe-prefix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"pipePrefix", import("./rules/pipe-prefix").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
100
+ "pipe-prefix": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/pipe-prefix").MessageIds, import("./rules/pipe-prefix").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
101
101
  "prefer-host-metadata-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-host-metadata-property").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
102
102
  "prefer-on-push-component-change-detection": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-on-push-component-change-detection").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
103
103
  "prefer-signals": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-signals").MessageIds, [{
@@ -1,6 +1,6 @@
1
1
  import { SelectorUtils } from '@angular-eslint/utils';
2
2
  export type Options = SelectorUtils.RuleOptions;
3
- export type MessageIds = 'prefixFailure' | 'styleFailure' | 'styleAndPrefixFailure' | 'typeFailure' | 'shadowDomEncapsulatedStyleFailure';
3
+ export type MessageIds = 'prefixFailure' | 'styleFailure' | 'styleAndPrefixFailure' | 'typeFailure' | 'shadowDomEncapsulatedStyleFailure' | 'selectorAfterPrefixFailure';
4
4
  export declare const RULE_NAME = "component-selector";
5
5
  declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, SelectorUtils.RuleOptions, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
6
6
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"component-selector.d.ts","sourceRoot":"","sources":["../../src/rules/component-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACd,MAAM,uBAAuB,CAAC;AAK/B,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC;AAChD,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,uBAAuB,GACvB,aAAa,GACb,mCAAmC,CAAC;AACxC,eAAO,MAAM,SAAS,uBAAuB,CAAC;;AAS9C,wBAoMG;AAiBH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
1
+ {"version":3,"file":"component-selector.d.ts","sourceRoot":"","sources":["../../src/rules/component-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACd,MAAM,uBAAuB,CAAC;AAK/B,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC;AAChD,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,uBAAuB,GACvB,aAAa,GACb,mCAAmC,GACnC,4BAA4B,CAAC;AACjC,eAAO,MAAM,SAAS,uBAAuB,CAAC;;AAS9C,wBAsLG;AAiBH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -90,6 +90,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
90
90
  styleAndPrefixFailure: `The selector should be {{style}} and start with one of these prefixes: {{prefix}} (${STYLE_GUIDE_LINK} and ${STYLE_GUIDE_LINK})`,
91
91
  typeFailure: `The selector should be used as an {{type}} (${STYLE_GUIDE_LINK})`,
92
92
  shadowDomEncapsulatedStyleFailure: `The selector of a ShadowDom-encapsulated component should be \`${utils_1.ASTUtils.OPTION_STYLE_KEBAB_CASE}\` (${SHADOW_DOM_ENCAPSULATED_STYLE_LINK})`,
93
+ selectorAfterPrefixFailure: `There should be a selector after the {{prefix}} prefix`,
93
94
  },
94
95
  },
95
96
  defaultOptions: [
@@ -113,28 +114,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
113
114
  if (!parsedSelectors || parsedSelectors.length === 0) {
114
115
  return;
115
116
  }
116
- // For multiple configs, determine the actual selector type
117
- let applicableConfig = null;
118
- if (configByType.size > 1) {
119
- // Multiple configs - need to determine which one applies
120
- const actualType = utils_1.SelectorUtils.getActualSelectorType(rawSelectors);
121
- if (!actualType) {
122
- return;
123
- }
124
- const config = configByType.get(actualType);
125
- if (!config) {
126
- // No config defined for this selector type
127
- return;
128
- }
129
- applicableConfig = config;
130
- }
131
- else {
132
- // Single config or single type extracted from array
133
- const firstEntry = configByType.entries().next();
134
- if (!firstEntry.done) {
135
- applicableConfig = firstEntry.value[1];
136
- }
137
- }
117
+ const applicableConfig = utils_1.SelectorUtils.getApplicableConfig(rawSelectors, configByType);
138
118
  if (!applicableConfig) {
139
119
  return;
140
120
  }
@@ -156,6 +136,9 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
156
136
  if (!hasExpectedSelector.hasExpectedType) {
157
137
  utils_1.SelectorUtils.reportTypeError(rawSelectors, type, context);
158
138
  }
139
+ else if (!hasExpectedSelector.hasSelectorAfterPrefix) {
140
+ utils_1.SelectorUtils.reportSelectorAfterPrefixError(rawSelectors, prefix, context);
141
+ }
159
142
  else if (!hasExpectedSelector.hasExpectedStyle) {
160
143
  if (style === overrideStyle) {
161
144
  if (!hasExpectedSelector.hasExpectedPrefix) {
@@ -1,6 +1,6 @@
1
1
  import { SelectorUtils } from '@angular-eslint/utils';
2
2
  export type Options = SelectorUtils.RuleOptions;
3
- export type MessageIds = 'prefixFailure' | 'styleFailure' | 'typeFailure';
3
+ export type MessageIds = 'prefixFailure' | 'styleFailure' | 'typeFailure' | 'selectorAfterPrefixFailure';
4
4
  export declare const RULE_NAME = "directive-selector";
5
5
  declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, SelectorUtils.RuleOptions, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
6
6
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"directive-selector.d.ts","sourceRoot":"","sources":["../../src/rules/directive-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACd,MAAM,uBAAuB,CAAC;AAI/B,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,cAAc,GAAG,aAAa,CAAC;AAC1E,eAAO,MAAM,SAAS,uBAAuB,CAAC;;AAE9C,wBA6KG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
1
+ {"version":3,"file":"directive-selector.d.ts","sourceRoot":"","sources":["../../src/rules/directive-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACd,MAAM,uBAAuB,CAAC;AAI/B,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC;AAChD,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,aAAa,GACb,4BAA4B,CAAC;AACjC,eAAO,MAAM,SAAS,uBAAuB,CAAC;;AAE9C,wBA+JG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -83,6 +83,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
83
83
  prefixFailure: 'The selector should start with one of these prefixes: {{prefix}}',
84
84
  styleFailure: 'The selector should be {{style}}',
85
85
  typeFailure: 'The selector should be used as an {{type}}',
86
+ selectorAfterPrefixFailure: `There should be a selector after the {{prefix}} prefix`,
86
87
  },
87
88
  },
88
89
  defaultOptions: [
@@ -106,28 +107,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
106
107
  if (!parsedSelectors || parsedSelectors.length === 0) {
107
108
  return;
108
109
  }
109
- // For multiple configs, determine the actual selector type
110
- let applicableConfig = null;
111
- if (configByType.size > 1) {
112
- // Multiple configs - need to determine which one applies
113
- const actualType = utils_1.SelectorUtils.getActualSelectorType(rawSelectors);
114
- if (!actualType) {
115
- return;
116
- }
117
- const config = configByType.get(actualType);
118
- if (!config) {
119
- // No config defined for this selector type
120
- return;
121
- }
122
- applicableConfig = config;
123
- }
124
- else {
125
- // Single config or single type extracted from array
126
- const firstEntry = configByType.entries().next();
127
- if (!firstEntry.done) {
128
- applicableConfig = firstEntry.value[1];
129
- }
130
- }
110
+ const applicableConfig = utils_1.SelectorUtils.getApplicableConfig(rawSelectors, configByType);
131
111
  if (!applicableConfig) {
132
112
  return;
133
113
  }
@@ -144,6 +124,9 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
144
124
  if (!hasExpectedSelector.hasExpectedType) {
145
125
  utils_1.SelectorUtils.reportTypeError(rawSelectors, type, context);
146
126
  }
127
+ else if (!hasExpectedSelector.hasSelectorAfterPrefix) {
128
+ utils_1.SelectorUtils.reportSelectorAfterPrefixError(rawSelectors, prefix, context);
129
+ }
147
130
  else if (!hasExpectedSelector.hasExpectedStyle) {
148
131
  utils_1.SelectorUtils.reportStyleError(rawSelectors, style, context);
149
132
  }
@@ -3,9 +3,9 @@ export type Options = [
3
3
  prefixes: string[];
4
4
  }
5
5
  ];
6
- export type MessageIds = 'pipePrefix';
6
+ export type MessageIds = 'pipePrefix' | 'selectorAfterPrefixFailure';
7
7
  export declare const RULE_NAME = "pipe-prefix";
8
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"pipePrefix", Options, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
8
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
9
9
  export default _default;
10
10
  export declare const RULE_DOCS_EXTENSION: {
11
11
  rationale: string;
@@ -1 +1 @@
1
- {"version":3,"file":"pipe-prefix.d.ts","sourceRoot":"","sources":["../../src/rules/pipe-prefix.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AACtC,eAAO,MAAM,SAAS,gBAAgB,CAAC;;AAEvC,wBAmFG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
1
+ {"version":3,"file":"pipe-prefix.d.ts","sourceRoot":"","sources":["../../src/rules/pipe-prefix.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,4BAA4B,CAAC;AACrE,eAAO,MAAM,SAAS,gBAAgB,CAAC;;AAEvC,wBAoGG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -28,6 +28,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
28
28
  ],
29
29
  messages: {
30
30
  pipePrefix: '@Pipes should be prefixed with {{prefixes}}',
31
+ selectorAfterPrefixFailure: '@Pipes should have a selector after the {{prefixes}} prefix',
31
32
  },
32
33
  },
33
34
  defaultOptions: [
@@ -50,7 +51,8 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
50
51
  return;
51
52
  }
52
53
  const allowPrefixesExpression = prefixes.join('|');
53
- const prefixValidator = utils_1.SelectorUtils.SelectorValidator.prefix(allowPrefixesExpression, 'camelCase');
54
+ const prefixValidator = utils_1.SelectorUtils.SelectorValidator.prefix(allowPrefixesExpression, utils_1.ASTUtils.OPTION_STYLE_CAMEL_CASE);
55
+ const selectorAfterPrefixValidator = utils_1.SelectorUtils.SelectorValidator.selectorAfterPrefix(allowPrefixesExpression);
54
56
  let nameValue;
55
57
  if (utils_1.ASTUtils.isStringLiteral(nameSelector)) {
56
58
  nameValue = nameSelector.value;
@@ -70,6 +72,16 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
70
72
  prefixes: (0, utils_1.toHumanReadableText)(prefixes),
71
73
  },
72
74
  });
75
+ return;
76
+ }
77
+ if (!selectorAfterPrefixValidator.apply(this, [nameValue])) {
78
+ context.report({
79
+ node: nameSelector,
80
+ messageId: 'selectorAfterPrefixFailure',
81
+ data: {
82
+ prefixes: (0, utils_1.toHumanReadableText)(prefixes),
83
+ },
84
+ });
73
85
  }
74
86
  },
75
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin",
3
- "version": "20.6.1-alpha.4",
3
+ "version": "20.6.1-alpha.6",
4
4
  "description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -19,11 +19,11 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "ts-api-utils": "^2.1.0",
22
- "@angular-eslint/bundled-angular-compiler": "20.6.1-alpha.4",
23
- "@angular-eslint/utils": "20.6.1-alpha.4"
22
+ "@angular-eslint/bundled-angular-compiler": "20.6.1-alpha.6",
23
+ "@angular-eslint/utils": "20.6.1-alpha.6"
24
24
  },
25
25
  "devDependencies": {
26
- "@angular-eslint/test-utils": "20.6.1-alpha.4"
26
+ "@angular-eslint/test-utils": "20.6.1-alpha.6"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@typescript-eslint/utils": "^7.11.0 || ^8.0.0",