@depup/angular-eslint__eslint-plugin 22.3.0-depup.0 → 22.5.0-depup.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/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/angular-eslint__eslint-plugin
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@angular-eslint/eslint-plugin](https://www.npmjs.com/package/@angular-eslint/eslint-plugin) @ 22.
|
|
17
|
-
| Processed | 2026-09-
|
|
16
|
+
| Original | [@angular-eslint/eslint-plugin](https://www.npmjs.com/package/@angular-eslint/eslint-plugin) @ 22.5.0 |
|
|
17
|
+
| Processed | 2026-09-08 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 1 |
|
|
20
20
|
|
package/changes.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -140,7 +140,7 @@ declare const _default: {
|
|
|
140
140
|
"runtime-localize": import("@typescript-eslint/utils/ts-eslint").RuleModule<"runtimeLocalize", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
141
141
|
name: string;
|
|
142
142
|
};
|
|
143
|
-
"sort-keys-in-type-decorator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"
|
|
143
|
+
"sort-keys-in-type-decorator": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/sort-keys-in-type-decorator").MessageIds, import("./rules/sort-keys-in-type-decorator").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
144
144
|
name: string;
|
|
145
145
|
};
|
|
146
146
|
"sort-lifecycle-methods": import("@typescript-eslint/utils/ts-eslint").RuleModule<"lifecycleMethodsNotSorted", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type OrderConfig = {
|
|
3
|
+
readonly Component?: string[];
|
|
4
|
+
readonly Directive?: string[];
|
|
5
|
+
readonly Injectable?: string[];
|
|
6
|
+
readonly NgModule?: string[];
|
|
7
|
+
readonly Pipe?: string[];
|
|
8
|
+
};
|
|
2
9
|
export type Options = [
|
|
3
|
-
{
|
|
4
|
-
|
|
10
|
+
OrderConfig & {
|
|
11
|
+
readonly allowUnconfiguredProperties?: boolean;
|
|
5
12
|
}
|
|
6
13
|
];
|
|
7
|
-
export type MessageIds = 'incorrectOrder';
|
|
14
|
+
export type MessageIds = 'incorrectOrder' | 'unconfiguredProperty';
|
|
8
15
|
export declare const RULE_NAME = "sort-keys-in-type-decorator";
|
|
9
|
-
declare const _default: TSESLint.RuleModule<
|
|
16
|
+
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../utils/create-eslint-rule").RuleDocs, TSESLint.RuleListener> & {
|
|
10
17
|
name: string;
|
|
11
18
|
};
|
|
12
19
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-keys-in-type-decorator.d.ts","sourceRoot":"","sources":["../../src/rules/sort-keys-in-type-decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAG9D,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"sort-keys-in-type-decorator.d.ts","sourceRoot":"","sources":["../../src/rules/sort-keys-in-type-decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAG9D,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,WAAW,GAAG;QACZ,QAAQ,CAAC,2BAA2B,CAAC,EAAE,OAAO,CAAC;KAChD;CACF,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,sBAAsB,CAAC;AAyEnE,eAAO,MAAM,SAAS,gCAAgC,CAAC;;;;AAEvD,wBAgLG;AAsFH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
|
|
@@ -45,6 +45,15 @@ const DEFAULT_ORDER = {
|
|
|
45
45
|
'queries',
|
|
46
46
|
'jit',
|
|
47
47
|
],
|
|
48
|
+
// https://angular.dev/api/core/Injectable
|
|
49
|
+
Injectable: [
|
|
50
|
+
'providedIn',
|
|
51
|
+
'useClass',
|
|
52
|
+
'useExisting',
|
|
53
|
+
'useFactory',
|
|
54
|
+
'useValue',
|
|
55
|
+
'deps',
|
|
56
|
+
],
|
|
48
57
|
// https://angular.dev/api/core/NgModule
|
|
49
58
|
NgModule: [
|
|
50
59
|
'id', // rarely used but good to have first if set
|
|
@@ -59,13 +68,17 @@ const DEFAULT_ORDER = {
|
|
|
59
68
|
// https://angular.dev/api/core/Pipe
|
|
60
69
|
Pipe: ['name', 'standalone', 'pure'],
|
|
61
70
|
};
|
|
71
|
+
const DEFAULT_OPTIONS = {
|
|
72
|
+
...DEFAULT_ORDER,
|
|
73
|
+
allowUnconfiguredProperties: true,
|
|
74
|
+
};
|
|
62
75
|
exports.RULE_NAME = 'sort-keys-in-type-decorator';
|
|
63
76
|
exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
64
77
|
name: exports.RULE_NAME,
|
|
65
78
|
meta: {
|
|
66
79
|
type: 'suggestion',
|
|
67
80
|
docs: {
|
|
68
|
-
description: 'Ensures that keys in type decorators (Component, Directive, NgModule, Pipe) are sorted in a consistent order',
|
|
81
|
+
description: 'Ensures that keys in type decorators (Component, Directive, Injectable, NgModule, Pipe) are sorted in a consistent order',
|
|
69
82
|
},
|
|
70
83
|
fixable: 'code',
|
|
71
84
|
schema: [
|
|
@@ -84,6 +97,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
84
97
|
type: 'string',
|
|
85
98
|
},
|
|
86
99
|
},
|
|
100
|
+
Injectable: {
|
|
101
|
+
type: 'array',
|
|
102
|
+
items: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
87
106
|
NgModule: {
|
|
88
107
|
type: 'array',
|
|
89
108
|
items: {
|
|
@@ -96,14 +115,19 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
96
115
|
type: 'string',
|
|
97
116
|
},
|
|
98
117
|
},
|
|
118
|
+
allowUnconfiguredProperties: {
|
|
119
|
+
type: 'boolean',
|
|
120
|
+
default: DEFAULT_OPTIONS.allowUnconfiguredProperties,
|
|
121
|
+
},
|
|
99
122
|
},
|
|
100
123
|
additionalProperties: false,
|
|
101
124
|
},
|
|
102
125
|
],
|
|
103
126
|
messages: {
|
|
104
127
|
incorrectOrder: 'Keys in @{{decorator}} decorator should be ordered: {{expectedOrder}}',
|
|
128
|
+
unconfiguredProperty: 'Property "{{property}}" is not in the configured key order for @{{decorator}}.',
|
|
105
129
|
},
|
|
106
|
-
defaultOptions: [
|
|
130
|
+
defaultOptions: [DEFAULT_OPTIONS],
|
|
107
131
|
},
|
|
108
132
|
create(context, [orderConfig]) {
|
|
109
133
|
function checkContext(node, decoratorName) {
|
|
@@ -116,12 +140,29 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
116
140
|
return;
|
|
117
141
|
}
|
|
118
142
|
const properties = utils_1.ASTUtils.getDecoratorProperties(node);
|
|
143
|
+
const allowUnconfiguredProperties = orderConfig.allowUnconfiguredProperties ?? true;
|
|
144
|
+
if (!allowUnconfiguredProperties) {
|
|
145
|
+
for (const property of properties) {
|
|
146
|
+
const propertyName = property.key.name;
|
|
147
|
+
if (!expectedOrder.includes(propertyName)) {
|
|
148
|
+
context.report({
|
|
149
|
+
node: property,
|
|
150
|
+
messageId: 'unconfiguredProperty',
|
|
151
|
+
data: {
|
|
152
|
+
decorator: decoratorName,
|
|
153
|
+
property: propertyName,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
119
159
|
if (properties.length <= 1) {
|
|
120
160
|
return;
|
|
121
161
|
}
|
|
122
162
|
const firstConfiguredIndex = properties.findIndex(({ key }) => expectedOrder.includes(key.name));
|
|
123
163
|
const lastNonConfiguredIndex = properties.findIndex(({ key }) => !expectedOrder.includes(key.name));
|
|
124
|
-
if (
|
|
164
|
+
if (allowUnconfiguredProperties &&
|
|
165
|
+
firstConfiguredIndex !== -1 &&
|
|
125
166
|
lastNonConfiguredIndex !== -1 &&
|
|
126
167
|
lastNonConfiguredIndex < firstConfiguredIndex) {
|
|
127
168
|
createInvalidSortRuleForDecorator(context, decoratorName, expectedOrder, properties, properties[lastNonConfiguredIndex]);
|
|
@@ -187,5 +228,5 @@ function reportAndFix(context, node, messageId, data, properties, expectedOrder,
|
|
|
187
228
|
});
|
|
188
229
|
}
|
|
189
230
|
exports.RULE_DOCS_EXTENSION = {
|
|
190
|
-
rationale: 'Maintaining a consistent order for properties in Angular decorators (@Component, @Directive, @NgModule, @Pipe) makes code more predictable and easier to scan. When all components in a codebase follow the same property order, developers can quickly locate specific metadata without searching. For example, if selector always comes first and providers always comes before changeDetection, you develop muscle memory for where to look. This is especially helpful in large components with many properties. The recommended default order groups related properties logically: identification (selector, name) first, then dependencies (imports, providers), then templates/styles, then configuration options. Consistent ordering also makes code reviews easier, reduces merge conflicts when multiple developers edit decorators, and creates a professional, well-organized codebase.',
|
|
231
|
+
rationale: 'Maintaining a consistent order for properties in Angular decorators (@Component, @Directive, @Injectable, @NgModule, @Pipe) makes code more predictable and easier to scan. When all components in a codebase follow the same property order, developers can quickly locate specific metadata without searching. For example, if selector always comes first and providers always comes before changeDetection, you develop muscle memory for where to look. This is especially helpful in large components with many properties. The recommended default order groups related properties logically: identification (selector, name) first, then dependencies (imports, providers), then templates/styles, then configuration options. Consistent ordering also makes code reviews easier, reduces merge conflicts when multiple developers edit decorators, and creates a professional, well-organized codebase. When `allowUnconfiguredProperties` is `false`, decorators omitted from the user configuration are still checked against their built-in default key order.',
|
|
191
232
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/angular-eslint__eslint-plugin",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.0-depup.0",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide (with updated dependencies)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"changes.json"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@angular-eslint/bundled-angular-compiler": "22.
|
|
24
|
-
"@angular-eslint/utils": "22.
|
|
23
|
+
"@angular-eslint/bundled-angular-compiler": "22.5.0",
|
|
24
|
+
"@angular-eslint/utils": "22.5.0",
|
|
25
25
|
"ts-api-utils": "^2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@angular-eslint/test-utils": "22.
|
|
28
|
+
"@angular-eslint/test-utils": "22.5.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@typescript-eslint/utils": "^8.0.0",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"depsUpdated": 1,
|
|
52
52
|
"originalPackage": "@angular-eslint/eslint-plugin",
|
|
53
|
-
"originalVersion": "22.
|
|
54
|
-
"processedAt": "2026-09-
|
|
53
|
+
"originalVersion": "22.5.0",
|
|
54
|
+
"processedAt": "2026-09-08T00:32:29.877Z",
|
|
55
55
|
"smokeTest": "passed"
|
|
56
56
|
}
|
|
57
57
|
}
|