@angular-eslint/eslint-plugin-template 19.4.1-alpha.0 → 19.4.1-alpha.2
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 +1 -0
- package/dist/configs/all.json +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/rules/no-nested-tags.d.ts +6 -0
- package/dist/rules/no-nested-tags.d.ts.map +1 -0
- package/dist/rules/no-nested-tags.js +49 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Please see https://github.com/angular-eslint/angular-eslint for full usage instr
|
|
|
23
23
|
| Rule | Description | :white_check_mark: | :wrench: | :bulb: | :accessibility: |
|
|
24
24
|
| --- | --- | --- | --- | --- | --- |
|
|
25
25
|
| [`no-duplicate-attributes`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-duplicate-attributes.md) | Ensures that there are no duplicate input properties or output event listeners | | | :bulb: | |
|
|
26
|
+
| [`no-nested-tags`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-nested-tags.md) | Denies nesting of <p> and <a> tags. | | | | |
|
|
26
27
|
<!-- prettier-ignore-end -->
|
|
27
28
|
|
|
28
29
|
<!-- end problems rule list -->
|
package/dist/configs/all.json
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@angular-eslint/template/no-inline-styles": "error",
|
|
24
24
|
"@angular-eslint/template/no-interpolation-in-attributes": "error",
|
|
25
25
|
"@angular-eslint/template/no-negated-async": "error",
|
|
26
|
+
"@angular-eslint/template/no-nested-tags": "error",
|
|
26
27
|
"@angular-eslint/template/no-positive-tabindex": "error",
|
|
27
28
|
"@angular-eslint/template/prefer-contextual-for-variables": "error",
|
|
28
29
|
"@angular-eslint/template/prefer-control-flow": "error",
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
"@angular-eslint/template/no-inline-styles": string;
|
|
26
26
|
"@angular-eslint/template/no-interpolation-in-attributes": string;
|
|
27
27
|
"@angular-eslint/template/no-negated-async": string;
|
|
28
|
+
"@angular-eslint/template/no-nested-tags": string;
|
|
28
29
|
"@angular-eslint/template/no-positive-tabindex": string;
|
|
29
30
|
"@angular-eslint/template/prefer-contextual-for-variables": string;
|
|
30
31
|
"@angular-eslint/template/prefer-control-flow": string;
|
|
@@ -103,6 +104,7 @@ declare const _default: {
|
|
|
103
104
|
"no-call-expression": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noCallExpression", import("./rules/no-call-expression").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
104
105
|
"no-distracting-elements": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDistractingElements", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
105
106
|
"no-duplicate-attributes": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-duplicate-attributes").MessageIds, import("./rules/no-duplicate-attributes").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
107
|
+
"no-nested-tags": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noNestedTags", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
106
108
|
"no-inline-styles": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noInlineStyles", import("./rules/no-inline-styles").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
107
109
|
"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>;
|
|
108
110
|
"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>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,kBA2CE"}
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ const no_duplicate_attributes_1 = __importStar(require("./rules/no-duplicate-att
|
|
|
61
61
|
const no_inline_styles_1 = __importStar(require("./rules/no-inline-styles"));
|
|
62
62
|
const no_interpolation_in_attributes_1 = __importStar(require("./rules/no-interpolation-in-attributes"));
|
|
63
63
|
const no_negated_async_1 = __importStar(require("./rules/no-negated-async"));
|
|
64
|
+
const no_nested_tags_1 = __importStar(require("./rules/no-nested-tags"));
|
|
64
65
|
const no_positive_tabindex_1 = __importStar(require("./rules/no-positive-tabindex"));
|
|
65
66
|
const prefer_ngsrc_1 = __importStar(require("./rules/prefer-ngsrc"));
|
|
66
67
|
const prefer_contextual_for_variables_1 = __importStar(require("./rules/prefer-contextual-for-variables"));
|
|
@@ -99,6 +100,7 @@ module.exports = {
|
|
|
99
100
|
[no_call_expression_1.RULE_NAME]: no_call_expression_1.default,
|
|
100
101
|
[no_distracting_elements_1.RULE_NAME]: no_distracting_elements_1.default,
|
|
101
102
|
[no_duplicate_attributes_1.RULE_NAME]: no_duplicate_attributes_1.default,
|
|
103
|
+
[no_nested_tags_1.RULE_NAME]: no_nested_tags_1.default,
|
|
102
104
|
[no_inline_styles_1.RULE_NAME]: no_inline_styles_1.default,
|
|
103
105
|
[no_interpolation_in_attributes_1.RULE_NAME]: no_interpolation_in_attributes_1.default,
|
|
104
106
|
[no_negated_async_1.RULE_NAME]: no_negated_async_1.default,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type Options = [];
|
|
2
|
+
export type MessageIds = 'noNestedTags';
|
|
3
|
+
export declare const RULE_NAME = "no-nested-tags";
|
|
4
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noNestedTags", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=no-nested-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-nested-tags.d.ts","sourceRoot":"","sources":["../../src/rules/no-nested-tags.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,eAAO,MAAM,SAAS,mBAAmB,CAAC;;AAM1C,wBAqCG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RULE_NAME = void 0;
|
|
4
|
+
const bundled_angular_compiler_1 = require("@angular-eslint/bundled-angular-compiler");
|
|
5
|
+
const utils_1 = require("@angular-eslint/utils");
|
|
6
|
+
const create_eslint_rule_1 = require("../utils/create-eslint-rule");
|
|
7
|
+
exports.RULE_NAME = 'no-nested-tags';
|
|
8
|
+
exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
9
|
+
name: exports.RULE_NAME,
|
|
10
|
+
meta: {
|
|
11
|
+
type: 'problem',
|
|
12
|
+
docs: {
|
|
13
|
+
description: 'Denies nesting of <p> and <a> tags.',
|
|
14
|
+
},
|
|
15
|
+
schema: [],
|
|
16
|
+
messages: {
|
|
17
|
+
noNestedTags: '<{{tag}}> elements must not be nested! This breaks angular incremental hydration as all browsers will convert "<{{tag}}>1<{{tag}}>2</{{tag}}>3</{{tag}}>" into "<{{tag}}>1</{{tag}}><{{tag}}>2</{{tag}}>3", creating a DOM mismatch between SSR and Angular',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultOptions: [],
|
|
21
|
+
create(context) {
|
|
22
|
+
const parserServices = (0, utils_1.getTemplateParserServices)(context);
|
|
23
|
+
return {
|
|
24
|
+
'Element[name=/^(p|a)$/]'(node) {
|
|
25
|
+
const hasInvalidNesting = hasAncestorOfSameType(node);
|
|
26
|
+
if (hasInvalidNesting) {
|
|
27
|
+
const loc = parserServices.convertElementSourceSpanToLoc(context, node);
|
|
28
|
+
context.report({
|
|
29
|
+
loc,
|
|
30
|
+
messageId: 'noNestedTags',
|
|
31
|
+
data: {
|
|
32
|
+
tag: node.name,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
function hasAncestorOfSameType(node) {
|
|
41
|
+
let parent = node.parent;
|
|
42
|
+
while (parent) {
|
|
43
|
+
if (parent instanceof bundled_angular_compiler_1.TmplAstElement && parent.name === node.name) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
parent = parent.parent;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin-template",
|
|
3
|
-
"version": "19.4.1-alpha.
|
|
3
|
+
"version": "19.4.1-alpha.2",
|
|
4
4
|
"description": "ESLint plugin for Angular Templates",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"aria-query": "5.3.2",
|
|
22
22
|
"axobject-query": "4.1.0",
|
|
23
|
-
"@angular-eslint/bundled-angular-compiler": "19.4.1-alpha.
|
|
24
|
-
"@angular-eslint/utils": "19.4.1-alpha.
|
|
23
|
+
"@angular-eslint/bundled-angular-compiler": "19.4.1-alpha.2",
|
|
24
|
+
"@angular-eslint/utils": "19.4.1-alpha.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/aria-query": "5.0.4",
|
|
28
|
-
"@angular-eslint/template-parser": "19.4.1-alpha.
|
|
29
|
-
"@angular-eslint/test-utils": "19.4.1-alpha.
|
|
28
|
+
"@angular-eslint/template-parser": "19.4.1-alpha.2",
|
|
29
|
+
"@angular-eslint/test-utils": "19.4.1-alpha.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@typescript-eslint/types": "^7.11.0 || ^8.0.0",
|