eslint-plugin-templ 0.0.1 → 0.0.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 +2 -2
- package/dist/configs/recommended.d.ts +57 -0
- package/dist/configs/recommended.d.ts.map +1 -0
- package/dist/configs/recommended.js +49 -0
- package/dist/configs/recommended.js.map +1 -0
- package/dist/html-source-code.d.ts +65 -39
- package/dist/html-source-code.d.ts.map +1 -1
- package/dist/html-source-code.js +112 -60
- package/dist/html-source-code.js.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/parse-for-eslint.d.ts.map +1 -1
- package/dist/parse-for-eslint.js +163 -25
- package/dist/parse-for-eslint.js.map +1 -1
- package/dist/run-templ-ast-to-json-binary.js +5 -3
- package/dist/run-templ-ast-to-json-binary.js.map +1 -1
- package/dist/templ-ast-to-eslint-ast.d.ts +16 -1
- package/dist/templ-ast-to-eslint-ast.d.ts.map +1 -1
- package/dist/templ-ast-to-eslint-ast.js +475 -117
- package/dist/templ-ast-to-eslint-ast.js.map +1 -1
- package/dist/templ-ast.d.ts +1564 -384
- package/dist/templ-ast.d.ts.map +1 -1
- package/dist/templ-ast.js +146 -48
- package/dist/templ-ast.js.map +1 -1
- package/dist/templ-language.d.ts +16 -3
- package/dist/templ-language.d.ts.map +1 -1
- package/dist/templ-language.js +9 -3
- package/dist/templ-language.js.map +1 -1
- package/package.json +27 -23
package/README.md
CHANGED
|
@@ -26,13 +26,13 @@ export default defineConfig([
|
|
|
26
26
|
html,
|
|
27
27
|
templ,
|
|
28
28
|
},
|
|
29
|
-
extends: ["html/recommended"],
|
|
29
|
+
extends: ["html/recommended", "templ/recommended"],
|
|
30
30
|
language: "templ/templ",
|
|
31
31
|
},
|
|
32
32
|
]);
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
The above configuration enables HTML ESLint's recommended rules ([documentation](https://html-eslint.org/docs/rules)).
|
|
35
|
+
The above configuration enables HTML ESLint's recommended rules ([documentation](https://html-eslint.org/docs/rules)) along with this plugin's recommended configuration, which disables rules that are known to fail on Templ files.
|
|
36
36
|
|
|
37
37
|
In VS Code settings, assuming you have [the ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) installed, you have to tell ESLint to run on `.templ` files:
|
|
38
38
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommended ESLint configuration for Templ files.
|
|
3
|
+
*
|
|
4
|
+
* This configuration is organized into sections based on why rules are disabled:
|
|
5
|
+
* - templFmtConflicts: Rules that conflict with `templ fmt` formatter
|
|
6
|
+
* - templGenerateConflicts: Rules that conflict with `templ generate` code generation
|
|
7
|
+
* - templDocumentModelConflicts: Rules that assume each file is a whole HTML document
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Rules that conflict with `templ fmt`, the official Templ formatter.
|
|
11
|
+
* These rules require whitespace/formatting that contradicts templ fmt's opinionated style.
|
|
12
|
+
*/
|
|
13
|
+
export declare const templFmtConflicts: {
|
|
14
|
+
readonly "html/element-newline": "off";
|
|
15
|
+
readonly "html/indent": "off";
|
|
16
|
+
readonly "html/no-extra-spacing-tags": "off";
|
|
17
|
+
readonly "html/no-extra-spacing-text": "off";
|
|
18
|
+
readonly "html/no-trailing-spaces": "off";
|
|
19
|
+
readonly "html/no-multiple-empty-lines": "off";
|
|
20
|
+
readonly "html/no-extra-spacing-attrs": "off";
|
|
21
|
+
readonly "html/lowercase": "off";
|
|
22
|
+
readonly "html/quotes": ["error", "double"];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Rules that conflict with `templ generate` or the Templ parser.
|
|
26
|
+
* These are language/tooling constraints, not formatter conflicts.
|
|
27
|
+
*/
|
|
28
|
+
export declare const templGenerateConflicts: {
|
|
29
|
+
readonly "@eslint-community/eslint-comments/require-description": "off";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Rules that assume every linted file is a complete HTML document.
|
|
33
|
+
* Templ files and components can represent full documents or document fragments,
|
|
34
|
+
* so these rules are not semantically meaningful for all Templ code.
|
|
35
|
+
*/
|
|
36
|
+
export declare const templDocumentModelConflicts: {
|
|
37
|
+
readonly "html/require-doctype": "off";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Complete recommended configuration combining all rule sets.
|
|
41
|
+
*/
|
|
42
|
+
export declare const recommended: {
|
|
43
|
+
readonly rules: {
|
|
44
|
+
readonly "html/require-doctype": "off";
|
|
45
|
+
readonly "@eslint-community/eslint-comments/require-description": "off";
|
|
46
|
+
readonly "html/element-newline": "off";
|
|
47
|
+
readonly "html/indent": "off";
|
|
48
|
+
readonly "html/no-extra-spacing-tags": "off";
|
|
49
|
+
readonly "html/no-extra-spacing-text": "off";
|
|
50
|
+
readonly "html/no-trailing-spaces": "off";
|
|
51
|
+
readonly "html/no-multiple-empty-lines": "off";
|
|
52
|
+
readonly "html/no-extra-spacing-attrs": "off";
|
|
53
|
+
readonly "html/lowercase": "off";
|
|
54
|
+
readonly "html/quotes": ["error", "double"];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=recommended.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUE,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;CAEH,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;CAER,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;CAMd,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommended ESLint configuration for Templ files.
|
|
3
|
+
*
|
|
4
|
+
* This configuration is organized into sections based on why rules are disabled:
|
|
5
|
+
* - templFmtConflicts: Rules that conflict with `templ fmt` formatter
|
|
6
|
+
* - templGenerateConflicts: Rules that conflict with `templ generate` code generation
|
|
7
|
+
* - templDocumentModelConflicts: Rules that assume each file is a whole HTML document
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Rules that conflict with `templ fmt`, the official Templ formatter.
|
|
11
|
+
* These rules require whitespace/formatting that contradicts templ fmt's opinionated style.
|
|
12
|
+
*/
|
|
13
|
+
export const templFmtConflicts = {
|
|
14
|
+
"html/element-newline": "off", // templ fmt controls element spacing with tabs
|
|
15
|
+
"html/indent": "off", // templ fmt uses tabs, not configurable spaces
|
|
16
|
+
"html/no-extra-spacing-tags": "off", // templ fmt normalizes tag spacing
|
|
17
|
+
"html/no-extra-spacing-text": "off", // templ fmt normalizes text spacing
|
|
18
|
+
"html/no-trailing-spaces": "off", // templ fmt removes trailing spaces
|
|
19
|
+
"html/no-multiple-empty-lines": "off", // templ fmt normalizes blank lines
|
|
20
|
+
"html/no-extra-spacing-attrs": "off", // templ fmt normalizes attribute spacing
|
|
21
|
+
"html/lowercase": "off", // templ fmt writes <!DOCTYPE (uppercase), which conflicts with this rule
|
|
22
|
+
"html/quotes": ["error", "double"], // templ fmt enforces double quotes
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Rules that conflict with `templ generate` or the Templ parser.
|
|
26
|
+
* These are language/tooling constraints, not formatter conflicts.
|
|
27
|
+
*/
|
|
28
|
+
export const templGenerateConflicts = {
|
|
29
|
+
"@eslint-community/eslint-comments/require-description": "off", // Templ parser rejects "--" in comments
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Rules that assume every linted file is a complete HTML document.
|
|
33
|
+
* Templ files and components can represent full documents or document fragments,
|
|
34
|
+
* so these rules are not semantically meaningful for all Templ code.
|
|
35
|
+
*/
|
|
36
|
+
export const templDocumentModelConflicts = {
|
|
37
|
+
"html/require-doctype": "off", // Templ components are often fragments, not complete documents
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Complete recommended configuration combining all rule sets.
|
|
41
|
+
*/
|
|
42
|
+
export const recommended = {
|
|
43
|
+
rules: {
|
|
44
|
+
...templFmtConflicts,
|
|
45
|
+
...templGenerateConflicts,
|
|
46
|
+
...templDocumentModelConflicts,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=recommended.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended.js","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,sBAAsB,EAAE,KAAK,EAAE,+CAA+C;IAC9E,aAAa,EAAE,KAAK,EAAE,+CAA+C;IACrE,4BAA4B,EAAE,KAAK,EAAE,mCAAmC;IACxE,4BAA4B,EAAE,KAAK,EAAE,oCAAoC;IACzE,yBAAyB,EAAE,KAAK,EAAE,oCAAoC;IACtE,8BAA8B,EAAE,KAAK,EAAE,mCAAmC;IAC1E,6BAA6B,EAAE,KAAK,EAAE,yCAAyC;IAC/E,gBAAgB,EAAE,KAAK,EAAE,yEAAyE;IAClG,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,mCAAmC;CACzC,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uDAAuD,EAAE,KAAK,EAAE,wCAAwC;CAC1E,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,sBAAsB,EAAE,KAAK,EAAE,+DAA+D;CAChE,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE;QACL,GAAG,iBAAiB;QACpB,GAAG,sBAAsB;QACzB,GAAG,2BAA2B;KAC/B;CACO,CAAC"}
|
|
@@ -22,11 +22,25 @@
|
|
|
22
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
import type { Position, TraversalStep } from "@eslint/core";
|
|
26
25
|
import type { SourceLocation } from "@eslint/plugin-kit";
|
|
27
|
-
import type {
|
|
26
|
+
import type { CommentContent } from "@html-eslint/types";
|
|
28
27
|
import type { AST } from "eslint";
|
|
29
28
|
import { Directive, TextSourceCodeBase } from "@eslint/plugin-kit";
|
|
29
|
+
export declare function createHTMLSourceCode(config: {
|
|
30
|
+
ast: AST.Program;
|
|
31
|
+
text: string;
|
|
32
|
+
comments: CommentContent[];
|
|
33
|
+
}): TextSourceCodeBase & {
|
|
34
|
+
getDisableDirectives(): {
|
|
35
|
+
problems: {
|
|
36
|
+
ruleId: null | string;
|
|
37
|
+
message: string;
|
|
38
|
+
loc: SourceLocation;
|
|
39
|
+
}[];
|
|
40
|
+
directives: Directive[];
|
|
41
|
+
};
|
|
42
|
+
getInlineConfigNodes(): CommentContent[];
|
|
43
|
+
};
|
|
30
44
|
/**
|
|
31
45
|
* This is not a node generated by es-html-parser; it is created by utils's splitToLineNodes.
|
|
32
46
|
*/
|
|
@@ -42,6 +56,54 @@ export interface BaseNode {
|
|
|
42
56
|
loc: AST.SourceLocation;
|
|
43
57
|
}
|
|
44
58
|
export declare const visitorKeys: {
|
|
59
|
+
CssAnPlusB: readonly [];
|
|
60
|
+
CssAtrule: readonly ["prelude", "block"];
|
|
61
|
+
CssAtrulePrelude: readonly ["children"];
|
|
62
|
+
CssAttributeSelector: readonly ["name", "value"];
|
|
63
|
+
CssBlock: readonly ["children"];
|
|
64
|
+
CssBrackets: readonly ["children"];
|
|
65
|
+
CssCDC: readonly [];
|
|
66
|
+
CssCDO: readonly [];
|
|
67
|
+
CssClassSelector: readonly [];
|
|
68
|
+
CssCombinator: readonly [];
|
|
69
|
+
CssCondition: readonly ["children"];
|
|
70
|
+
CssDeclaration: readonly ["value"];
|
|
71
|
+
CssDeclarationList: readonly ["children"];
|
|
72
|
+
CssDimension: readonly [];
|
|
73
|
+
CssFeature: readonly ["value"];
|
|
74
|
+
CssFeatureFunction: readonly ["value"];
|
|
75
|
+
CssFeatureRange: readonly ["left", "middle", "right"];
|
|
76
|
+
CssFunction: readonly ["children"];
|
|
77
|
+
CssGeneralEnclosed: readonly ["children"];
|
|
78
|
+
CssHash: readonly [];
|
|
79
|
+
CssIdSelector: readonly [];
|
|
80
|
+
CssIdentifier: readonly [];
|
|
81
|
+
CssLayer: readonly [];
|
|
82
|
+
CssLayerList: readonly ["children"];
|
|
83
|
+
CssMediaQuery: readonly ["condition"];
|
|
84
|
+
CssMediaQueryList: readonly ["children"];
|
|
85
|
+
CssNestingSelector: readonly [];
|
|
86
|
+
CssNth: readonly ["nth", "selector"];
|
|
87
|
+
CssNumber: readonly [];
|
|
88
|
+
CssOperator: readonly [];
|
|
89
|
+
CssParentheses: readonly ["children"];
|
|
90
|
+
CssPercentage: readonly [];
|
|
91
|
+
CssPseudoClassSelector: readonly ["children"];
|
|
92
|
+
CssPseudoElementSelector: readonly ["children"];
|
|
93
|
+
CssRatio: readonly ["left", "right"];
|
|
94
|
+
CssRaw: readonly [];
|
|
95
|
+
CssRule: readonly ["prelude", "block"];
|
|
96
|
+
CssScope: readonly ["root", "limit"];
|
|
97
|
+
CssSelector: readonly ["children"];
|
|
98
|
+
CssSelectorList: readonly ["children"];
|
|
99
|
+
CssString: readonly [];
|
|
100
|
+
CssStyleSheet: readonly ["children"];
|
|
101
|
+
CssSupportsDeclaration: readonly ["declaration"];
|
|
102
|
+
CssTypeSelector: readonly [];
|
|
103
|
+
CssUnicodeRange: readonly [];
|
|
104
|
+
CssUrl: readonly [];
|
|
105
|
+
CssValue: readonly ["children"];
|
|
106
|
+
CssWhiteSpace: readonly [];
|
|
45
107
|
Program: string[];
|
|
46
108
|
Document: string[];
|
|
47
109
|
Attribute: string[];
|
|
@@ -72,45 +134,9 @@ export declare const visitorKeys: {
|
|
|
72
134
|
ScriptTag: string[];
|
|
73
135
|
ScriptTagContent: never[];
|
|
74
136
|
StyleTag: string[];
|
|
75
|
-
StyleTagContent:
|
|
137
|
+
StyleTagContent: string[];
|
|
76
138
|
Tag: string[];
|
|
77
139
|
Text: never[];
|
|
78
140
|
RawContent: never[];
|
|
79
141
|
};
|
|
80
|
-
export declare class HTMLSourceCode extends TextSourceCodeBase {
|
|
81
|
-
comments: CommentContent[];
|
|
82
|
-
parentsMap: Map<AnyHTMLNode | AST.Program, AnyHTMLNode | AST.Program>;
|
|
83
|
-
lineStartIndices: number[];
|
|
84
|
-
constructor({ ast, text, comments, }: {
|
|
85
|
-
ast: AST.Program;
|
|
86
|
-
text: string;
|
|
87
|
-
comments: CommentContent[];
|
|
88
|
-
});
|
|
89
|
-
getRange(node: BaseNode): [number, number];
|
|
90
|
-
getLoc(node: BaseNode): import("@eslint/plugin-kit").SourceLocation;
|
|
91
|
-
getLines(): string[];
|
|
92
|
-
/**
|
|
93
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L745
|
|
94
|
-
* @param {Position} loc
|
|
95
|
-
* @returns {number}
|
|
96
|
-
*/
|
|
97
|
-
getIndexFromLoc(loc: Position): number;
|
|
98
|
-
/**
|
|
99
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L694
|
|
100
|
-
* @param {number} index
|
|
101
|
-
* @returns {Position}
|
|
102
|
-
*/
|
|
103
|
-
getLocFromIndex(index: number): Position;
|
|
104
|
-
getInlineConfigNodes(): CommentContent[];
|
|
105
|
-
getDisableDirectives(): {
|
|
106
|
-
problems: {
|
|
107
|
-
ruleId: null | string;
|
|
108
|
-
message: string;
|
|
109
|
-
loc: SourceLocation;
|
|
110
|
-
}[];
|
|
111
|
-
directives: Directive[];
|
|
112
|
-
};
|
|
113
|
-
traverse(): TraversalStep[];
|
|
114
|
-
getParent(node: AnyHTMLNode): AnyHTMLNode | AST.Program | undefined;
|
|
115
|
-
}
|
|
116
142
|
//# sourceMappingURL=html-source-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-source-code.d.ts","sourceRoot":"","sources":["../src/html-source-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"html-source-code.d.ts","sourceRoot":"","sources":["../src/html-source-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,GAAG,EAAS,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAEL,SAAS,EACT,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAG5B,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B,GAAG,kBAAkB,GAAG;IACvB,oBAAoB,IAAI;QACtB,QAAQ,EAAE;YAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,cAAc,CAAA;SAAE,EAAE,CAAC;QAC5E,UAAU,EAAE,SAAS,EAAE,CAAC;KACzB,CAAC;IACF,oBAAoB,IAAI,cAAc,EAAE,CAAC;CAC1C,CAEA;AAED;;GAEG;AACH,MAAM,WAAW,IAAK,SAAQ,QAAQ;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC;CACzB;AAuDD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDvB,CAAC"}
|
package/dist/html-source-code.js
CHANGED
|
@@ -24,7 +24,60 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { ConfigCommentParser, Directive, TextSourceCodeBase, VisitNodeStep, } from "@eslint/plugin-kit";
|
|
26
26
|
import { NodeTypes } from "es-html-parser";
|
|
27
|
+
export function createHTMLSourceCode(config) {
|
|
28
|
+
return new HTMLSourceCode(config);
|
|
29
|
+
}
|
|
27
30
|
const NODE_TYPES = NodeTypes;
|
|
31
|
+
const cssVisitorKeys = {
|
|
32
|
+
CssAnPlusB: [],
|
|
33
|
+
CssAtrule: ["prelude", "block"],
|
|
34
|
+
CssAtrulePrelude: ["children"],
|
|
35
|
+
CssAttributeSelector: ["name", "value"],
|
|
36
|
+
CssBlock: ["children"],
|
|
37
|
+
CssBrackets: ["children"],
|
|
38
|
+
CssCDC: [],
|
|
39
|
+
CssCDO: [],
|
|
40
|
+
CssClassSelector: [],
|
|
41
|
+
CssCombinator: [],
|
|
42
|
+
CssCondition: ["children"],
|
|
43
|
+
CssDeclaration: ["value"],
|
|
44
|
+
CssDeclarationList: ["children"],
|
|
45
|
+
CssDimension: [],
|
|
46
|
+
CssFeature: ["value"],
|
|
47
|
+
CssFeatureFunction: ["value"],
|
|
48
|
+
CssFeatureRange: ["left", "middle", "right"],
|
|
49
|
+
CssFunction: ["children"],
|
|
50
|
+
CssGeneralEnclosed: ["children"],
|
|
51
|
+
CssHash: [],
|
|
52
|
+
CssIdSelector: [],
|
|
53
|
+
CssIdentifier: [],
|
|
54
|
+
CssLayer: [],
|
|
55
|
+
CssLayerList: ["children"],
|
|
56
|
+
CssMediaQuery: ["condition"],
|
|
57
|
+
CssMediaQueryList: ["children"],
|
|
58
|
+
CssNestingSelector: [],
|
|
59
|
+
CssNth: ["nth", "selector"],
|
|
60
|
+
CssNumber: [],
|
|
61
|
+
CssOperator: [],
|
|
62
|
+
CssParentheses: ["children"],
|
|
63
|
+
CssPercentage: [],
|
|
64
|
+
CssPseudoClassSelector: ["children"],
|
|
65
|
+
CssPseudoElementSelector: ["children"],
|
|
66
|
+
CssRatio: ["left", "right"],
|
|
67
|
+
CssRaw: [],
|
|
68
|
+
CssRule: ["prelude", "block"],
|
|
69
|
+
CssScope: ["root", "limit"],
|
|
70
|
+
CssSelector: ["children"],
|
|
71
|
+
CssSelectorList: ["children"],
|
|
72
|
+
CssString: [],
|
|
73
|
+
CssStyleSheet: ["children"],
|
|
74
|
+
CssSupportsDeclaration: ["declaration"],
|
|
75
|
+
CssTypeSelector: [],
|
|
76
|
+
CssUnicodeRange: [],
|
|
77
|
+
CssUrl: [],
|
|
78
|
+
CssValue: ["children"],
|
|
79
|
+
CssWhiteSpace: [],
|
|
80
|
+
};
|
|
28
81
|
export const visitorKeys = {
|
|
29
82
|
Program: ["body"],
|
|
30
83
|
[NODE_TYPES.Document]: ["children"],
|
|
@@ -68,10 +121,11 @@ export const visitorKeys = {
|
|
|
68
121
|
"close",
|
|
69
122
|
"value",
|
|
70
123
|
],
|
|
71
|
-
[NODE_TYPES.StyleTagContent]: [],
|
|
124
|
+
[NODE_TYPES.StyleTagContent]: ["stylesheet"],
|
|
72
125
|
[NODE_TYPES.Tag]: ["openStart", "openEnd", "close", "children", "attributes"],
|
|
73
126
|
[NODE_TYPES.Text]: [],
|
|
74
127
|
[NODE_TYPES.RawContent]: [],
|
|
128
|
+
...cssVisitorKeys,
|
|
75
129
|
};
|
|
76
130
|
const STEP_PHASE = {
|
|
77
131
|
ENTER: 1,
|
|
@@ -89,7 +143,7 @@ function createGlobalLinebreakMatcher() {
|
|
|
89
143
|
}
|
|
90
144
|
const INLINE_CONFIG = /^\s*(?:eslint(?:-enable|-disable(?:(?:-next)?-line)?)?)(?:\s|$)/u;
|
|
91
145
|
const commentParser = new ConfigCommentParser();
|
|
92
|
-
|
|
146
|
+
class HTMLSourceCode extends TextSourceCodeBase {
|
|
93
147
|
comments;
|
|
94
148
|
parentsMap;
|
|
95
149
|
lineStartIndices;
|
|
@@ -120,66 +174,11 @@ export class HTMLSourceCode extends TextSourceCodeBase {
|
|
|
120
174
|
getLines() {
|
|
121
175
|
return this.lines;
|
|
122
176
|
}
|
|
123
|
-
// Copied from eslint source code
|
|
124
177
|
/**
|
|
125
|
-
* @
|
|
126
|
-
* @param {Position} loc
|
|
127
|
-
* @returns {number}
|
|
178
|
+
* @private
|
|
128
179
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
typeof loc.line !== "number" ||
|
|
132
|
-
typeof loc.column !== "number") {
|
|
133
|
-
throw new TypeError("Expected `loc` to be an object with numeric `line` and `column` properties.");
|
|
134
|
-
}
|
|
135
|
-
if (loc.line <= 0) {
|
|
136
|
-
throw new RangeError(`Line number out of range (line ${loc.line} requested). Line numbers should be 1-based.`);
|
|
137
|
-
}
|
|
138
|
-
if (loc.line > this.lineStartIndices.length) {
|
|
139
|
-
throw new RangeError(`Line number out of range (line ${loc.line} requested, but only ${this.lineStartIndices.length} lines present).`);
|
|
140
|
-
}
|
|
141
|
-
const lineStartIndex = this.lineStartIndices[loc.line - 1];
|
|
142
|
-
const lineEndIndex = (loc.line === this.lineStartIndices.length
|
|
143
|
-
? this.text.length
|
|
144
|
-
: this.lineStartIndices[loc.line]);
|
|
145
|
-
const positionIndex = lineStartIndex + loc.column;
|
|
146
|
-
if ((loc.line === this.lineStartIndices.length &&
|
|
147
|
-
positionIndex > lineEndIndex) ||
|
|
148
|
-
(loc.line < this.lineStartIndices.length && positionIndex >= lineEndIndex)) {
|
|
149
|
-
throw new RangeError(`Column number out of range (column ${loc.column} requested, but the length of line ${loc.line} is ${lineEndIndex - lineStartIndex}).`);
|
|
150
|
-
}
|
|
151
|
-
return positionIndex;
|
|
152
|
-
}
|
|
153
|
-
// Copied from eslint source code
|
|
154
|
-
/**
|
|
155
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L694
|
|
156
|
-
* @param {number} index
|
|
157
|
-
* @returns {Position}
|
|
158
|
-
*/
|
|
159
|
-
getLocFromIndex(index) {
|
|
160
|
-
if (typeof index !== "number") {
|
|
161
|
-
throw new TypeError("Expected `index` to be a number.");
|
|
162
|
-
}
|
|
163
|
-
if (index < 0 || index > this.text.length) {
|
|
164
|
-
throw new RangeError(`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`);
|
|
165
|
-
}
|
|
166
|
-
if (index === this.text.length) {
|
|
167
|
-
return {
|
|
168
|
-
line: this.lines.length,
|
|
169
|
-
// @ts-expect-error (copied from html-eslint)
|
|
170
|
-
column: this.lines.at(-1).length,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
const lineNumber =
|
|
174
|
-
// @ts-expect-error (copied from html-eslint)
|
|
175
|
-
index >= this.lineStartIndices.at(-1)
|
|
176
|
-
? this.lineStartIndices.length
|
|
177
|
-
: this.lineStartIndices.findIndex((el) => index < el);
|
|
178
|
-
return {
|
|
179
|
-
line: lineNumber,
|
|
180
|
-
// @ts-expect-error (copied from html-eslint)
|
|
181
|
-
column: index - this.lineStartIndices[lineNumber - 1],
|
|
182
|
-
};
|
|
180
|
+
getAllComments() {
|
|
181
|
+
return [];
|
|
183
182
|
}
|
|
184
183
|
getInlineConfigNodes() {
|
|
185
184
|
return this.comments.filter((comment) => INLINE_CONFIG.test(comment.value));
|
|
@@ -266,5 +265,58 @@ export class HTMLSourceCode extends TextSourceCodeBase {
|
|
|
266
265
|
getParent(node) {
|
|
267
266
|
return this.parentsMap.get(node);
|
|
268
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* @private
|
|
270
|
+
*/
|
|
271
|
+
getJSDocComment() {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
277
|
+
getScope(node) {
|
|
278
|
+
if (node.type !== "Program") {
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
return createFakeGlobalScope(this.ast);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
get scopeManager() {
|
|
287
|
+
return {
|
|
288
|
+
scopes: [],
|
|
289
|
+
globalScope: createFakeGlobalScope(this.ast),
|
|
290
|
+
acquire: (node) => {
|
|
291
|
+
if (node.type === "Program") {
|
|
292
|
+
return createFakeGlobalScope(this.ast);
|
|
293
|
+
}
|
|
294
|
+
return null;
|
|
295
|
+
},
|
|
296
|
+
getDeclaredVariables: () => [],
|
|
297
|
+
addGlobals() { },
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function createFakeGlobalScope(node) {
|
|
302
|
+
const fakeGlobalScope = {
|
|
303
|
+
type: "global",
|
|
304
|
+
block: node,
|
|
305
|
+
set: new Map(),
|
|
306
|
+
through: [],
|
|
307
|
+
childScopes: [],
|
|
308
|
+
variableScope: null,
|
|
309
|
+
variables: [],
|
|
310
|
+
references: [],
|
|
311
|
+
functionExpressionScope: false,
|
|
312
|
+
isStrict: false,
|
|
313
|
+
upper: null,
|
|
314
|
+
implicit: {
|
|
315
|
+
variables: [],
|
|
316
|
+
set: new Map(),
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
fakeGlobalScope.variableScope = fakeGlobalScope;
|
|
320
|
+
return fakeGlobalScope;
|
|
269
321
|
}
|
|
270
322
|
//# sourceMappingURL=html-source-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-source-code.js","sourceRoot":"","sources":["../src/html-source-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"html-source-code.js","sourceRoot":"","sources":["../src/html-source-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAWH,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,kBAAkB,EAClB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,MAIpC;IAOC,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAkBD,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B,MAAM,cAAc,GAAG;IACrB,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,CAAC,UAAU,CAAC;IAC9B,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACvC,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,WAAW,EAAE,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,CAAC,UAAU,CAAC;IAC1B,cAAc,EAAE,CAAC,OAAO,CAAC;IACzB,kBAAkB,EAAE,CAAC,UAAU,CAAC;IAChC,YAAY,EAAE,EAAE;IAChB,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,kBAAkB,EAAE,CAAC,OAAO,CAAC;IAC7B,eAAe,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC;IAC5C,WAAW,EAAE,CAAC,UAAU,CAAC;IACzB,kBAAkB,EAAE,CAAC,UAAU,CAAC;IAChC,OAAO,EAAE,EAAE;IACX,aAA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+
configs: {
|
|
9
|
+
recommended: {
|
|
10
|
+
readonly rules: {
|
|
11
|
+
readonly "html/require-doctype": "off";
|
|
12
|
+
readonly "@eslint-community/eslint-comments/require-description": "off";
|
|
13
|
+
readonly "html/element-newline": "off";
|
|
14
|
+
readonly "html/indent": "off";
|
|
15
|
+
readonly "html/no-extra-spacing-tags": "off";
|
|
16
|
+
readonly "html/no-extra-spacing-text": "off";
|
|
17
|
+
readonly "html/no-trailing-spaces": "off";
|
|
18
|
+
readonly "html/no-multiple-empty-lines": "off";
|
|
19
|
+
readonly "html/no-extra-spacing-attrs": "off";
|
|
20
|
+
readonly "html/lowercase": "off";
|
|
21
|
+
readonly "html/quotes": ["error", "double"];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
8
25
|
languages: {
|
|
9
26
|
templ: TemplLanguage;
|
|
10
27
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CAYa,CAAC;AAE1B,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import { ESLint } from "eslint";
|
|
3
3
|
import { TemplLanguage } from "./templ-language.js";
|
|
4
|
+
import { recommended } from "./configs/recommended.js";
|
|
4
5
|
const pkg = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
5
6
|
const plugin = {
|
|
6
7
|
meta: {
|
|
@@ -8,6 +9,9 @@ const plugin = {
|
|
|
8
9
|
version: pkg.version,
|
|
9
10
|
namespace: "templ",
|
|
10
11
|
},
|
|
12
|
+
configs: {
|
|
13
|
+
recommended,
|
|
14
|
+
},
|
|
11
15
|
languages: {
|
|
12
16
|
templ: new TemplLanguage(),
|
|
13
17
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CACrE,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,SAAS,EAAE,OAAO;KACnB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,IAAI,aAAa,EAAE;KAC3B;CACsB,CAAC;AAE1B,eAAe,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CACrE,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,SAAS,EAAE,OAAO;KACnB;IACD,OAAO,EAAE;QACP,WAAW;KACZ;IACD,SAAS,EAAE;QACT,KAAK,EAAE,IAAI,aAAa,EAAE;KAC3B;CACsB,CAAC;AAE1B,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-for-eslint.d.ts","sourceRoot":"","sources":["../src/parse-for-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-for-eslint.d.ts","sourceRoot":"","sources":["../src/parse-for-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAmBlC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAqErE"}
|