@angular-eslint/eslint-plugin 19.0.3-alpha.9 → 19.1.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-input-prefix.d.ts","sourceRoot":"","sources":["../../src/rules/no-input-prefix.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,OAAO,GAAG,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,eAAe,CAAC;AACzC,eAAO,MAAM,SAAS,oBAAoB,CAAC;;AAE3C,
|
|
1
|
+
{"version":3,"file":"no-input-prefix.d.ts","sourceRoot":"","sources":["../../src/rules/no-input-prefix.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,OAAO,GAAG,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,eAAe,CAAC;AACzC,eAAO,MAAM,SAAS,oBAAoB,CAAC;;AAE3C,wBAwIG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RULE_NAME = void 0;
|
|
4
4
|
const utils_1 = require("@angular-eslint/utils");
|
|
5
|
+
const utils_2 = require("@typescript-eslint/utils");
|
|
5
6
|
const create_eslint_rule_1 = require("../utils/create-eslint-rule");
|
|
6
7
|
exports.RULE_NAME = 'no-input-prefix';
|
|
7
8
|
exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
@@ -34,6 +35,16 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
34
35
|
return {
|
|
35
36
|
[utils_1.Selectors.INPUT_PROPERTY_OR_SETTER](node) {
|
|
36
37
|
const rawPropertyName = utils_1.ASTUtils.getRawText(node);
|
|
38
|
+
// The child that matched was just a literal initializer of a property definition
|
|
39
|
+
if (node.parent?.type === utils_2.TSESTree.AST_NODE_TYPES.PropertyDefinition) {
|
|
40
|
+
const initializingValue = node.parent.value;
|
|
41
|
+
if (initializingValue?.type === utils_2.TSESTree.AST_NODE_TYPES.Literal &&
|
|
42
|
+
rawPropertyName === utils_1.ASTUtils.getRawText(initializingValue) &&
|
|
43
|
+
node.range[0] === initializingValue.range[0] &&
|
|
44
|
+
node.range[1] === initializingValue.range[1]) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
37
48
|
const hasDisallowedPrefix = prefixes.some((prefix) => isDisallowedPrefix(prefix, rawPropertyName));
|
|
38
49
|
// Direct violation on the property name
|
|
39
50
|
if (hasDisallowedPrefix) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-signals.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-signals.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvE,KAAK,OAAO,GAAG;IACb;QACE,8BAA8B,EAAE,OAAO,CAAC;QACxC,kBAAkB,EAAE,OAAO,CAAC;QAC5B,kBAAkB,EAAE,OAAO,CAAC;QAC5B,eAAe,EAAE,OAAO,CAAC;QACzB,iCAAiC,EAAE,MAAM,EAAE,CAAC;KAC7C;CACF,CAAC;
|
|
1
|
+
{"version":3,"file":"prefer-signals.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-signals.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvE,KAAK,OAAO,GAAG;IACb;QACE,8BAA8B,EAAE,OAAO,CAAC;QACxC,kBAAkB,EAAE,OAAO,CAAC;QAC5B,kBAAkB,EAAE,OAAO,CAAC;QAC5B,eAAe,EAAE,OAAO,CAAC;QACzB,iCAAiC,EAAE,MAAM,EAAE,CAAC;KAC7C;CACF,CAAC;AA6BF,MAAM,MAAM,UAAU,GAClB,oBAAoB,GACpB,oBAAoB,GACpB,gCAAgC,CAAC;AACrC,eAAO,MAAM,SAAS,mBAAmB,CAAC;;AAE1C,wBAsLG"}
|
|
@@ -22,6 +22,7 @@ const KNOWN_SIGNAL_CREATION_FUNCTIONS = new Set([
|
|
|
22
22
|
'contentChild',
|
|
23
23
|
'contentChildren',
|
|
24
24
|
'input',
|
|
25
|
+
'linkedSignal',
|
|
25
26
|
'model',
|
|
26
27
|
'signal',
|
|
27
28
|
'toSignal',
|
|
@@ -96,8 +97,22 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
96
97
|
// There is no type annotation, so try to
|
|
97
98
|
// use the value assigned to the property
|
|
98
99
|
// to determine whether it would be a signal.
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
let value = node.value;
|
|
101
|
+
if (value?.type === utils_2.AST_NODE_TYPES.CallExpression) {
|
|
102
|
+
const callee = value.callee;
|
|
103
|
+
// A `WritableSignal` can be turned into a `Signal` using
|
|
104
|
+
// the `.asReadonly()` method. If that method is being,
|
|
105
|
+
// called, then we need to look at the object that the method
|
|
106
|
+
// is called on to determine if it's being called on a `Signal`.
|
|
107
|
+
if (callee.type === utils_2.AST_NODE_TYPES.MemberExpression) {
|
|
108
|
+
if (callee.property.type === utils_2.AST_NODE_TYPES.Identifier &&
|
|
109
|
+
callee.property.name === 'asReadonly') {
|
|
110
|
+
value = callee.object;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (value?.type === utils_2.AST_NODE_TYPES.CallExpression) {
|
|
115
|
+
let callee = value.callee;
|
|
101
116
|
// Some signal-creating functions have a `.required`
|
|
102
117
|
// member. For example, `input.required()`.
|
|
103
118
|
if (callee.type === utils_2.AST_NODE_TYPES.MemberExpression) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "19.0
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-eslint/
|
|
22
|
-
"@angular-eslint/
|
|
21
|
+
"@angular-eslint/bundled-angular-compiler": "19.1.0",
|
|
22
|
+
"@angular-eslint/utils": "19.1.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@angular-eslint/test-utils": "19.0
|
|
25
|
+
"@angular-eslint/test-utils": "19.1.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@typescript-eslint/utils": "^7.11.0 || ^8.0.0",
|