@angular-eslint/template-parser 13.2.1-alpha.3 → 14.0.0-alpha.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/dist/index.js CHANGED
@@ -1 +1 @@
1
- var e=require("@angular-eslint/bundled-angular-compiler"),t=require("eslint-scope");function n(e){return{start:{line:e.start.line+1,column:e.start.col},end:{line:e.end.line+1,column:e.end.col}}}function r(t,r){if("Element$1"!==r.type)throw new Error("convertElementSourceSpanToLoc is intented to be used only with elements.");return e.getHtmlTagDefinition(r.name).isVoid&&(r=function(t,n){const{rootNodes:r}=(s||(s=new e.HtmlParser)).parse(t.getSourceCode().getText(),t.getFilename());return o(r,n.sourceSpan)}(t,r)||r),n(r.sourceSpan)}function o(t,n){for(const r of t){if(r.sourceSpan.start.line===n.start.line&&r.sourceSpan.start.offset===n.start.offset)return r;if(r instanceof e.Element){const e=o(r.children,n);if(null!==e)return e}}return null}let s=null;const a={ASTWithSource:["ast"],Binary:["left","right"],BoundAttribute:["value"],BoundEvent:["handler"],BoundText:["value"],Conditional:["condition","trueExp","falseExp"],Element$1:["children","inputs","outputs","attributes"],Interpolation:["expressions"],PrefixNot:["expression"],Program:["templateNodes"],PropertyRead:["receiver"],Template:["templateAttrs","children","inputs"],BindingPipe:["exp"]};function l(e){let t=null;return"comments"!==e&&"leadingComments"!==e&&"loc"!==e&&"parent"!==e&&"range"!==e&&"tokens"!==e&&"trailingComments"!==e&&null!==(t=this[e])&&"object"==typeof t&&("string"==typeof t.type||Array.isArray(t))}function i(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}function c(e){let t=0,r=0;const o=a[e.type]||function(e){return Object.keys(e).filter(l,e)}(e);for(!e.loc&&e.sourceSpan&&(e.loc=n(e.sourceSpan)),t=0;t<o.length;++t){const n=e[o[t]],s=Array.isArray(n);if(void 0!==n.type&&(n.__originalType=n.type),s||n.type||(n.type=n.constructor.name),s)for(r=0;r<n.length;++r){const e=n[r];void 0!==e.type&&(e.__originalType=e.type),e.type&&"number"!=typeof e.type||(e.type=e.constructor.name),i(e)&&c(e)}else i(n)&&c(n)}}class u extends Error{constructor(e,t,n,r,o){super(e),this.fileName=void 0,this.index=void 0,this.lineNumber=void 0,this.column=void 0,this.fileName=t,this.index=n,this.lineNumber=r,this.column=o,Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0})}}function p(e){return new u(e.msg,e.span.start.file.url,e.span.start.offset,e.span.start.line+1,e.span.start.col+1)}function f(o,s){var l;const i=e.parseTemplate(o,s.filePath,{preserveWhitespaces:!0,preserveLineEndings:!0,collectCommentNodes:!0});let u=[];Array.isArray(i.commentNodes)&&(u=i.commentNodes);const f={type:"Program",comments:(m=u,m.map(e=>({type:"Block",value:e.value,loc:n(e.sourceSpan),range:[e.sourceSpan.start.offset,e.sourceSpan.end.offset]})).sort((e,t)=>e.range[0]-t.range[0])),tokens:[],range:[0,0],loc:{start:{line:0,column:0},end:{line:0,column:0}},templateNodes:i.nodes,value:o};var m;const d=new t.ScopeManager({});new t.Scope(d,"module",null,f,!1),c(f);const y=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.startSourceSpan||e.sourceSpan;t?n&&n.start.offset<t.start.offset&&(t=n):t=n}),t}(f),g=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.endSourceSpan||e.sourceSpan;t?n&&n.end.offset>t.end.offset&&(t=n):t=n}),t}(f);if(y&&g&&(f.range=[y.start.offset,g.end.offset],f.loc={start:n(y).start,end:n(g).end}),null!=(l=i.errors)&&l.length)throw p(i.errors[0]);return{ast:f,scopeManager:d,visitorKeys:a,services:{convertNodeSourceSpanToLoc:n,convertElementSourceSpanToLoc:r}}}exports.TemplateParseError=u,exports.createTemplateParseError=p,exports.parse=function(e,t){return f(e,t).ast},exports.parseForESLint=f;
1
+ var e=require("@angular-eslint/bundled-angular-compiler"),t=require("eslint-scope");function n(e){return{start:{line:e.start.line+1,column:e.start.col},end:{line:e.end.line+1,column:e.end.col}}}function r(t,r){if("Element$1"!==r.type)throw new Error("convertElementSourceSpanToLoc is intented to be used only with elements.");return e.getHtmlTagDefinition(r.name).isVoid&&(r=function(t,n){const{rootNodes:r}=(s||(s=new e.HtmlParser)).parse(t.getSourceCode().getText(),t.getFilename());return o(r,n.sourceSpan)}(t,r)||r),n(r.sourceSpan)}function o(t,n){for(const r of t){if(r.sourceSpan.start.line===n.start.line&&r.sourceSpan.start.offset===n.start.offset)return r;if(r instanceof e.Element){const e=o(r.children,n);if(null!==e)return e}}return null}let s=null;const a={ASTWithSource:["ast"],Binary:["left","right"],BoundAttribute:["value"],BoundEvent:["handler"],BoundText:["value"],Conditional:["condition","trueExp","falseExp"],Element$1:["children","inputs","outputs","attributes"],Interpolation:["expressions"],PrefixNot:["expression"],Program:["templateNodes"],PropertyRead:["receiver"],Template:["templateAttrs","children","inputs"],BindingPipe:["exp"]};function l(e){let t=null;return"comments"!==e&&"leadingComments"!==e&&"loc"!==e&&"parent"!==e&&"range"!==e&&"tokens"!==e&&"trailingComments"!==e&&null!==(t=this[e])&&"object"==typeof t&&("string"==typeof t.type||Array.isArray(t))}function i(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}function c(e){let t=0,r=0;const o=a[e.type]||function(e){return Object.keys(e).filter(l,e)}(e);for(!e.loc&&e.sourceSpan&&(e.loc=n(e.sourceSpan)),t=0;t<o.length;++t){const n=e[o[t]],s=Array.isArray(n);if(void 0!==n.type&&(n.__originalType=n.type),s||n.type||(n.type=n.constructor.name),s)for(r=0;r<n.length;++r){const e=n[r];void 0!==e.type&&(e.__originalType=e.type),e.type&&"number"!=typeof e.type||(e.type=e.constructor.name),i(e)&&c(e)}else i(n)&&c(n)}}class u extends Error{constructor(e,t,n,r,o){super(e),this.fileName=void 0,this.index=void 0,this.lineNumber=void 0,this.column=void 0,this.fileName=t,this.index=n,this.lineNumber=r,this.column=o,Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0})}}function p(e){return new u(e.msg,e.span.start.file.url,e.span.start.offset,e.span.start.line+1,e.span.start.col+1)}function f(o,s){var l,i;const u=e.parseTemplate(o,s.filePath,{preserveWhitespaces:!0,preserveLineEndings:!0,collectCommentNodes:!0});let f=[];Array.isArray(u.commentNodes)&&(f=u.commentNodes);const m={type:"Program",comments:(d=f,d.map(e=>({type:"Block",value:e.value,loc:n(e.sourceSpan),range:[e.sourceSpan.start.offset,e.sourceSpan.end.offset]})).sort((e,t)=>e.range[0]-t.range[0])),tokens:[],range:[0,0],loc:{start:{line:0,column:0},end:{line:0,column:0}},templateNodes:u.nodes,value:o};var d;const y=new t.ScopeManager({});new t.Scope(y,"module",null,m,!1),c(m);const g=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.startSourceSpan||e.sourceSpan;t?n&&n.start.offset<t.start.offset&&(t=n):t=n}),t}(m),S=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.endSourceSpan||e.sourceSpan;t?n&&n.end.offset>t.end.offset&&(t=n):t=n}),t}(m);if(g&&S&&(m.range=[g.start.offset,S.end.offset],m.loc={start:n(g).start,end:n(S).end}),null!=(l=s.suppressParseErrors)&&!l&&null!=(i=u.errors)&&i.length)throw p(u.errors[0]);return{ast:m,scopeManager:y,visitorKeys:a,services:{convertNodeSourceSpanToLoc:n,convertElementSourceSpanToLoc:r}}}exports.TemplateParseError=u,exports.createTemplateParseError=p,exports.parse=function(e,t){return f(e,t).ast},exports.parseForESLint=f;
@@ -27,9 +27,11 @@ export declare class TemplateParseError extends Error {
27
27
  constructor(message: string, fileName: string, index: number, lineNumber: number, column: number);
28
28
  }
29
29
  export declare function createTemplateParseError(parseError: ParseError): TemplateParseError;
30
- declare function parseForESLint(code: string, options: {
30
+ export interface ParserOptions {
31
31
  filePath: string;
32
- }): {
32
+ suppressParseErrors?: boolean;
33
+ }
34
+ declare function parseForESLint(code: string, options: ParserOptions): {
33
35
  ast: AST;
34
36
  scopeManager: ScopeManager;
35
37
  visitorKeys: VisitorKeys;
@@ -39,6 +41,4 @@ declare function parseForESLint(code: string, options: {
39
41
  };
40
42
  };
41
43
  export { parseForESLint };
42
- export declare function parse(code: string, options: {
43
- filePath: string;
44
- }): AST;
44
+ export declare function parse(code: string, options: ParserOptions): AST;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/template-parser",
3
- "version": "13.2.1-alpha.3+c3f3120",
3
+ "version": "14.0.0-alpha.0",
4
4
  "description": "Angular Template parser for ESLint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -17,12 +17,12 @@
17
17
  "LICENSE"
18
18
  ],
19
19
  "dependencies": {
20
- "@angular-eslint/bundled-angular-compiler": "13.2.1-alpha.3+c3f3120",
20
+ "@angular-eslint/bundled-angular-compiler": "14.0.0-alpha.0",
21
21
  "eslint-scope": "^5.1.0"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "eslint": "^7.0.0 || ^8.0.0",
25
25
  "typescript": "*"
26
26
  },
27
- "gitHead": "c3f3120b57f7dfe7ff1ff3f3a8791b2cf988e905"
27
+ "gitHead": "bb37c65bd1d8689848d98ae30c0a95ea3ce50675"
28
28
  }
package/CHANGELOG.md DELETED
@@ -1,167 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [13.2.0](https://github.com/angular-eslint/angular-eslint/compare/v13.1.0...v13.2.0) (2022-04-03)
7
-
8
- ### Features
9
-
10
- - **parser:** propagate parse errors from angular compiler ([#969](https://github.com/angular-eslint/angular-eslint/issues/969)) ([ab9b496](https://github.com/angular-eslint/angular-eslint/commit/ab9b496095c7194d614394c04548f6848c0d6aff))
11
-
12
- # [13.1.0](https://github.com/angular-eslint/angular-eslint/compare/v13.0.1...v13.1.0) (2022-02-13)
13
-
14
- **Note:** Version bump only for package @angular-eslint/template-parser
15
-
16
- ## [13.0.1](https://github.com/angular-eslint/angular-eslint/compare/v13.0.0...v13.0.1) (2021-11-19)
17
-
18
- **Note:** Version bump only for package @angular-eslint/template-parser
19
-
20
- # [13.0.0](https://github.com/angular-eslint/angular-eslint/compare/v12.7.0...v13.0.0) (2021-11-18)
21
-
22
- ### Features
23
-
24
- - angular-eslint v13 ([#780](https://github.com/angular-eslint/angular-eslint/issues/780)) ([f7ce631](https://github.com/angular-eslint/angular-eslint/commit/f7ce631524dd7834a422a5ac93a4c0534f9f23fa))
25
-
26
- # [12.7.0](https://github.com/angular-eslint/angular-eslint/compare/v12.6.1...v12.7.0) (2021-11-18)
27
-
28
- **Note:** Version bump only for package @angular-eslint/template-parser
29
-
30
- ## [12.6.1](https://github.com/angular-eslint/angular-eslint/compare/v12.6.0...v12.6.1) (2021-10-26)
31
-
32
- **Note:** Version bump only for package @angular-eslint/template-parser
33
-
34
- # [12.6.0](https://github.com/angular-eslint/angular-eslint/compare/v12.5.0...v12.6.0) (2021-10-25)
35
-
36
- ### Features
37
-
38
- - **bundled-angular-compiler:** create own bundle for `@angular/compiler` ([#720](https://github.com/angular-eslint/angular-eslint/issues/720)) ([0c42299](https://github.com/angular-eslint/angular-eslint/commit/0c422993496bb2670fbd31f55a5fe829704f5112))
39
-
40
- # [12.5.0](https://github.com/angular-eslint/angular-eslint/compare/v12.4.1...v12.5.0) (2021-09-20)
41
-
42
- **Note:** Version bump only for package @angular-eslint/template-parser
43
-
44
- ## [12.4.1](https://github.com/angular-eslint/angular-eslint/compare/v12.4.0...v12.4.1) (2021-09-09)
45
-
46
- **Note:** Version bump only for package @angular-eslint/template-parser
47
-
48
- # [12.4.0](https://github.com/angular-eslint/angular-eslint/compare/v12.3.1...v12.4.0) (2021-09-09)
49
-
50
- **Note:** Version bump only for package @angular-eslint/template-parser
51
-
52
- ## [12.3.1](https://github.com/angular-eslint/angular-eslint/compare/v12.3.0...v12.3.1) (2021-07-15)
53
-
54
- ### Bug Fixes
55
-
56
- - **template-parser:** correct typings for cjs ([#597](https://github.com/angular-eslint/angular-eslint/issues/597)) ([bb60224](https://github.com/angular-eslint/angular-eslint/commit/bb6022410139801dfee062b845c3a2d3f7b8a019))
57
-
58
- # [12.3.0](https://github.com/angular-eslint/angular-eslint/compare/v12.2.2...v12.3.0) (2021-07-13)
59
-
60
- **Note:** Version bump only for package @angular-eslint/template-parser
61
-
62
- ## [12.2.2](https://github.com/angular-eslint/angular-eslint/compare/v12.2.1...v12.2.2) (2021-07-10)
63
-
64
- **Note:** Version bump only for package @angular-eslint/template-parser
65
-
66
- ## [12.2.1](https://github.com/angular-eslint/angular-eslint/compare/v12.2.0...v12.2.1) (2021-07-10)
67
-
68
- **Note:** Version bump only for package @angular-eslint/template-parser
69
-
70
- # [12.2.0](https://github.com/angular-eslint/angular-eslint/compare/v12.1.0...v12.2.0) (2021-06-20)
71
-
72
- **Note:** Version bump only for package @angular-eslint/template-parser
73
-
74
- # [12.1.0](https://github.com/angular-eslint/angular-eslint/compare/v12.0.0...v12.1.0) (2021-05-30)
75
-
76
- ### Bug Fixes
77
-
78
- - **template-parser:** generate correct index.d.ts when building ([#480](https://github.com/angular-eslint/angular-eslint/issues/480)) ([e150044](https://github.com/angular-eslint/angular-eslint/commit/e150044b23496a5af42c335e7635429cb122532d))
79
-
80
- # [12.0.0](https://github.com/angular-eslint/angular-eslint/compare/v4.3.0...v12.0.0) (2021-05-13)
81
-
82
- ### Bug Fixes
83
-
84
- - **template-parser:** add missing `Conditional` and its keys to `VisitorKeys` ([#445](https://github.com/angular-eslint/angular-eslint/issues/445)) ([5ad0f1a](https://github.com/angular-eslint/angular-eslint/commit/5ad0f1aeca244dbd27496e5a2d8c569994a24dcf))
85
-
86
- ### Features
87
-
88
- - update to angular v12 ([c80008d](https://github.com/angular-eslint/angular-eslint/commit/c80008df8f6b9d08daf3043dffc1be45f8cfbe81))
89
-
90
- # [4.3.0](https://github.com/angular-eslint/angular-eslint/compare/v4.2.1...v4.3.0) (2021-05-12)
91
-
92
- **Note:** Version bump only for package @angular-eslint/template-parser
93
-
94
- ## [4.2.1](https://github.com/angular-eslint/angular-eslint/compare/v4.2.0...v4.2.1) (2021-05-12)
95
-
96
- **Note:** Version bump only for package @angular-eslint/template-parser
97
-
98
- # [4.2.0](https://github.com/angular-eslint/angular-eslint/compare/v4.1.0...v4.2.0) (2021-04-28)
99
-
100
- **Note:** Version bump only for package @angular-eslint/template-parser
101
-
102
- # [4.1.0](https://github.com/angular-eslint/angular-eslint/compare/v4.0.0...v4.1.0) (2021-04-28)
103
-
104
- **Note:** Version bump only for package @angular-eslint/template-parser
105
-
106
- # [4.0.0](https://github.com/angular-eslint/angular-eslint/compare/v3.0.1...v4.0.0) (2021-04-18)
107
-
108
- ### Features
109
-
110
- - **schematics:** options for convert-tslint-to-eslint ([#419](https://github.com/angular-eslint/angular-eslint/issues/419)) ([18fd863](https://github.com/angular-eslint/angular-eslint/commit/18fd863d6948578db96252da57702338a8ea5ea0))
111
-
112
- ## [3.0.1](https://github.com/angular-eslint/angular-eslint/compare/v3.0.0...v3.0.1) (2021-04-18)
113
-
114
- **Note:** Version bump only for package @angular-eslint/template-parser
115
-
116
- # [3.0.0](https://github.com/angular-eslint/angular-eslint/compare/v2.1.1...v3.0.0) (2021-04-17)
117
-
118
- ### Features
119
-
120
- - v3.0.0 ([#388](https://github.com/angular-eslint/angular-eslint/issues/388)) ([f92b184](https://github.com/angular-eslint/angular-eslint/commit/f92b184c5b0b57328d0a323ac8c89f1b3017b8d4))
121
-
122
- ## [2.1.1](https://github.com/angular-eslint/angular-eslint/compare/v2.1.0...v2.1.1) (2021-04-17)
123
-
124
- **Note:** Version bump only for package @angular-eslint/template-parser
125
-
126
- # [2.1.0](https://github.com/angular-eslint/angular-eslint/compare/v2.0.2...v2.1.0) (2021-04-11)
127
-
128
- ### Features
129
-
130
- - **template-parser:** support eslint-disable comments in HTML templates ([#405](https://github.com/angular-eslint/angular-eslint/issues/405)) ([5dd9578](https://github.com/angular-eslint/angular-eslint/commit/5dd9578d7c212cdead04c2142b920af6f654f2de))
131
-
132
- ## [2.0.2](https://github.com/angular-eslint/angular-eslint/compare/v2.0.1...v2.0.2) (2021-03-16)
133
-
134
- **Note:** Version bump only for package @angular-eslint/template-parser
135
-
136
- ## [2.0.1](https://github.com/angular-eslint/angular-eslint/compare/v2.0.0...v2.0.1) (2021-03-14)
137
-
138
- **Note:** Version bump only for package @angular-eslint/template-parser
139
-
140
- # [2.0.0](https://github.com/angular-eslint/angular-eslint/compare/v1.2.0...v2.0.0) (2021-03-13)
141
-
142
- ### Bug Fixes
143
-
144
- - **template-parser:** add BindingPipe exp to VisitorKeys ([#337](https://github.com/angular-eslint/angular-eslint/issues/337)) ([#338](https://github.com/angular-eslint/angular-eslint/issues/338)) ([75c406f](https://github.com/angular-eslint/angular-eslint/commit/75c406f9f496740a694681916b8b4cd7b438d574))
145
-
146
- ### Features
147
-
148
- - v2.0.0 ([#358](https://github.com/angular-eslint/angular-eslint/issues/358)) ([737fd04](https://github.com/angular-eslint/angular-eslint/commit/737fd04946a9533698c04665c771d944ffbe430c)), closes [#328](https://github.com/angular-eslint/angular-eslint/issues/328) [#245](https://github.com/angular-eslint/angular-eslint/issues/245)
149
-
150
- ### BREAKING CHANGES
151
-
152
- - The format of results output has changed
153
- - The rule no longer exists for use
154
-
155
- - feat(template-parser): updated use of parseTemplate to improve loc data
156
- - Requires @angular/compiler 11.2.0 and above
157
-
158
- - feat(schematics): change way indent and quotes are handled by conversion schematics
159
- - The conversion schematic handle these rules differently
160
-
161
- # [1.2.0](https://github.com/angular-eslint/angular-eslint/compare/v1.1.0...v1.2.0) (2021-02-06)
162
-
163
- **Note:** Version bump only for package @angular-eslint/template-parser
164
-
165
- # [1.1.0](https://github.com/angular-eslint/angular-eslint/compare/v1.0.0...v1.1.0) (2021-01-14)
166
-
167
- **Note:** Version bump only for package @angular-eslint/template-parser