@angular-eslint/eslint-plugin-template 21.2.1-alpha.2 → 21.2.1-alpha.3

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
@@ -62,6 +62,7 @@ Please see https://github.com/angular-eslint/angular-eslint for full usage instr
62
62
  | [`no-inline-styles`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-inline-styles.md) | Disallows the use of inline styles in HTML templates | | | | |
63
63
  | [`no-interpolation-in-attributes`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-interpolation-in-attributes.md) | Ensures that property-binding is used instead of interpolation in attributes. | | :wrench: | | |
64
64
  | [`no-negated-async`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-negated-async.md) | Ensures that async pipe results, as well as values used with the async pipe, are not negated | :white_check_mark: | | :bulb: | |
65
+ | [`no-non-null-assertion`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-non-null-assertion.md) | Disallows the non-null assertion operator (!) in templates | | | | |
65
66
  | [`no-positive-tabindex`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-positive-tabindex.md) | Ensures that the `tabindex` attribute is not positive | | | :bulb: | |
66
67
  | [`prefer-at-else`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/prefer-at-else.md) | Prefer using `@else` instead of a second `@if` with the opposite condition to reduce code and make it easier to read. | | :wrench: | | |
67
68
  | [`prefer-at-empty`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/prefer-at-empty.md) | Prefer using `@empty` with `@for` loops instead of a separate `@if` or `@else` block to reduce code and make it easier to read. | | :wrench: | | |
@@ -25,6 +25,7 @@
25
25
  "@angular-eslint/template/no-interpolation-in-attributes": "error",
26
26
  "@angular-eslint/template/no-negated-async": "error",
27
27
  "@angular-eslint/template/no-nested-tags": "error",
28
+ "@angular-eslint/template/no-non-null-assertion": "error",
28
29
  "@angular-eslint/template/no-positive-tabindex": "error",
29
30
  "@angular-eslint/template/prefer-at-else": "error",
30
31
  "@angular-eslint/template/prefer-at-empty": "error",
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ declare const _default: {
27
27
  "@angular-eslint/template/no-interpolation-in-attributes": string;
28
28
  "@angular-eslint/template/no-negated-async": string;
29
29
  "@angular-eslint/template/no-nested-tags": string;
30
+ "@angular-eslint/template/no-non-null-assertion": string;
30
31
  "@angular-eslint/template/no-positive-tabindex": string;
31
32
  "@angular-eslint/template/prefer-at-else": string;
32
33
  "@angular-eslint/template/prefer-at-empty": string;
@@ -116,6 +117,7 @@ declare const _default: {
116
117
  "no-interpolation-in-attributes": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noInterpolationInAttributes", import("./rules/no-interpolation-in-attributes").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
117
118
  "no-negated-async": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-negated-async").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
118
119
  "no-nested-tags": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noNestedTags", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
120
+ "no-non-null-assertion": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noNonNullAssertion", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
119
121
  "no-positive-tabindex": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-positive-tabindex").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
120
122
  "prefer-at-else": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferAtElse", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
121
123
  "prefer-at-empty": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferAtEmpty", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,kBAgDE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,kBAiDE"}
package/dist/index.js CHANGED
@@ -64,6 +64,7 @@ const no_inline_styles_1 = __importStar(require("./rules/no-inline-styles"));
64
64
  const no_interpolation_in_attributes_1 = __importStar(require("./rules/no-interpolation-in-attributes"));
65
65
  const no_negated_async_1 = __importStar(require("./rules/no-negated-async"));
66
66
  const no_nested_tags_1 = __importStar(require("./rules/no-nested-tags"));
67
+ const no_non_null_assertion_1 = __importStar(require("./rules/no-non-null-assertion"));
67
68
  const no_positive_tabindex_1 = __importStar(require("./rules/no-positive-tabindex"));
68
69
  const prefer_ngsrc_1 = __importStar(require("./rules/prefer-ngsrc"));
69
70
  const prefer_at_else_1 = __importStar(require("./rules/prefer-at-else"));
@@ -111,6 +112,7 @@ module.exports = {
111
112
  [no_interpolation_in_attributes_1.RULE_NAME]: no_interpolation_in_attributes_1.default,
112
113
  [no_negated_async_1.RULE_NAME]: no_negated_async_1.default,
113
114
  [no_nested_tags_1.RULE_NAME]: no_nested_tags_1.default,
115
+ [no_non_null_assertion_1.RULE_NAME]: no_non_null_assertion_1.default,
114
116
  [no_positive_tabindex_1.RULE_NAME]: no_positive_tabindex_1.default,
115
117
  [prefer_at_else_1.RULE_NAME]: prefer_at_else_1.default,
116
118
  [prefer_at_empty_1.RULE_NAME]: prefer_at_empty_1.default,
@@ -1 +1 @@
1
- {"version":3,"file":"no-any.d.ts","sourceRoot":"","sources":["../../src/rules/no-any.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,kBAAkB,CAAC;AACtD,eAAO,MAAM,SAAS,WAAW,CAAC;;AAGlC,wBA0FG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
1
+ {"version":3,"file":"no-any.d.ts","sourceRoot":"","sources":["../../src/rules/no-any.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,kBAAkB,CAAC;AACtD,eAAO,MAAM,SAAS,WAAW,CAAC;;AAGlC,wBAuFG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -78,9 +78,6 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
78
78
  }
79
79
  reportAnyCall(node);
80
80
  },
81
- KeyedRead(node) {
82
- findAndReportAnyCalls(node);
83
- },
84
81
  };
85
82
  },
86
83
  });
@@ -0,0 +1,9 @@
1
+ export type Options = [];
2
+ export type MessageIds = 'noNonNullAssertion';
3
+ export declare const RULE_NAME = "no-non-null-assertion";
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noNonNullAssertion", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
+ export default _default;
6
+ export declare const RULE_DOCS_EXTENSION: {
7
+ rationale: string;
8
+ };
9
+ //# sourceMappingURL=no-non-null-assertion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-non-null-assertion.d.ts","sourceRoot":"","sources":["../../src/rules/no-non-null-assertion.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAC9C,eAAO,MAAM,SAAS,0BAA0B,CAAC;;AAEjD,wBAgCG;AAEH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RULE_DOCS_EXTENSION = exports.RULE_NAME = void 0;
4
+ const utils_1 = require("@angular-eslint/utils");
5
+ const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
+ exports.RULE_NAME = 'no-non-null-assertion';
7
+ exports.default = (0, create_eslint_rule_1.createESLintRule)({
8
+ name: exports.RULE_NAME,
9
+ meta: {
10
+ type: 'suggestion',
11
+ docs: {
12
+ description: 'Disallows the non-null assertion operator (!) in templates',
13
+ },
14
+ schema: [],
15
+ messages: {
16
+ noNonNullAssertion: 'Avoid using the non-null assertion operator (!) in templates. This bypasses type safety and can lead to runtime errors.',
17
+ },
18
+ },
19
+ defaultOptions: [],
20
+ create(context) {
21
+ (0, utils_1.ensureTemplateParser)(context);
22
+ const { sourceCode } = context;
23
+ return {
24
+ NonNullAssert(node) {
25
+ const { start, end } = node.sourceSpan;
26
+ context.report({
27
+ messageId: 'noNonNullAssertion',
28
+ loc: {
29
+ start: sourceCode.getLocFromIndex(start),
30
+ end: sourceCode.getLocFromIndex(end),
31
+ },
32
+ });
33
+ },
34
+ };
35
+ },
36
+ });
37
+ exports.RULE_DOCS_EXTENSION = {
38
+ rationale: "Equivalent of @typescript-eslint/no-non-null-assertion rule for Angular templates. TypeScript's `!` non-null assertion operator asserts to the type system that an expression is non-nullable, as in not `null` or `undefined`. Using assertions to tell the type system new information is often a sign that code is not fully type-safe. It's generally better to structure program logic so that TypeScript understands when values may be nullable.",
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin-template",
3
- "version": "21.2.1-alpha.2",
3
+ "version": "21.2.1-alpha.3",
4
4
  "description": "ESLint plugin for Angular Templates",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,19 +20,19 @@
20
20
  "dependencies": {
21
21
  "aria-query": "5.3.2",
22
22
  "axobject-query": "4.1.0",
23
- "@angular-eslint/bundled-angular-compiler": "21.2.1-alpha.2",
24
- "@angular-eslint/utils": "21.2.1-alpha.2"
23
+ "@angular-eslint/bundled-angular-compiler": "21.2.1-alpha.3",
24
+ "@angular-eslint/utils": "21.2.1-alpha.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/aria-query": "5.0.4",
28
- "@angular-eslint/test-utils": "21.2.1-alpha.2"
28
+ "@angular-eslint/test-utils": "21.2.1-alpha.3"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@typescript-eslint/types": "^7.11.0 || ^8.0.0",
32
32
  "@typescript-eslint/utils": "^7.11.0 || ^8.0.0",
33
33
  "eslint": "^8.57.0 || ^9.0.0",
34
34
  "typescript": "*",
35
- "@angular-eslint/template-parser": "21.2.1-alpha.2"
35
+ "@angular-eslint/template-parser": "21.2.1-alpha.3"
36
36
  },
37
37
  "gitHead": "e2006e5e9c99e5a943d1a999e0efa5247d29ec24"
38
38
  }