File tree Expand file tree Collapse file tree 6 files changed +94
-2
lines changed Expand file tree Collapse file tree 6 files changed +94
-2
lines changed Original file line number Diff line number Diff line change 4848 "packageManager" : " yarn@4.0.2" ,
4949 "workspaces" : [
5050 " packages/**"
51- ]
51+ ],
52+ "dependencies" : {
53+ "html-standard" : " ^0.0.2"
54+ }
5255}
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ const noNestedInteractive = require("./no-nested-interactive");
4646const maxElementDepth = require ( "./max-element-depth" ) ;
4747const requireExplicitSize = require ( "./require-explicit-size" ) ;
4848const useBaseLine = require ( "./use-baseline" ) ;
49+ const useStandardHtml = require ( "./use-standard-html" ) ;
4950// import new rule here ↑
5051// DO NOT REMOVE THIS COMMENT
5152
@@ -98,6 +99,7 @@ module.exports = {
9899 "max-element-depth" : maxElementDepth ,
99100 "require-explicit-size" : requireExplicitSize ,
100101 "use-baseline" : useBaseLine ,
102+ "use-standard-html" : useStandardHtml ,
101103 // export new rule here ↑
102104 // DO NOT REMOVE THIS COMMENT
103105} ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @typedef { import("../types").RuleFixer } RuleFixer
3+ * @typedef { import("@html-eslint/types").Attribute } Attribute
4+ * @typedef { import("@html-eslint/types").Text } Text
5+ *
6+ * @typedef {Object } Option
7+ * @property {string[] } [Option.priority]
8+ * @typedef { import("../types").RuleModule<[Option]> } RuleModule
9+ */
10+
11+ const { RULE_CATEGORY } = require ( "../constants" ) ;
12+ const { getElementSpec } = require ( "html-standard" ) ;
13+
14+ const MESSAGE_IDS = {
15+ UNSORTED : "unsorted" ,
16+ } ;
17+
18+ /**
19+ * @type {RuleModule }
20+ */
21+ module . exports = {
22+ meta : {
23+ type : "code" ,
24+
25+ docs : {
26+ description : "TBD" ,
27+ category : RULE_CATEGORY . BEST_PRACTICE ,
28+ recommended : false ,
29+ } ,
30+ fixable : "code" ,
31+ schema : [
32+ {
33+ type : "object" ,
34+ properties : {
35+ priority : {
36+ type : "array" ,
37+ items : {
38+ type : "string" ,
39+ uniqueItems : true ,
40+ } ,
41+ } ,
42+ } ,
43+ } ,
44+ ] ,
45+ messages : {
46+ [ MESSAGE_IDS . UNSORTED ] : "TBD" ,
47+ } ,
48+ } ,
49+ create ( context ) {
50+ return {
51+ Tag ( node ) {
52+ const spec = getElementSpec ( node . name ) ;
53+ console . log ( spec ) ;
54+ } ,
55+ } ;
56+ } ,
57+ } ;
Original file line number Diff line number Diff line change 3838 ],
3939 "dependencies" : {
4040 "@html-eslint/template-parser" : " ^0.38.0" ,
41- "@html-eslint/template-syntax-parser" : " ^0.38.0"
41+ "@html-eslint/template-syntax-parser" : " ^0.38.0" ,
42+ "html-standard" : " ^0.0.3"
4243 },
4344 "devDependencies" : {
4445 "@html-eslint/parser" : " ^0.38.0" ,
Original file line number Diff line number Diff line change 1+ const createRuleTester = require ( "../rule-tester" ) ;
2+ const rule = require ( "../../lib/rules/use-standard-html" ) ;
3+
4+ const ruleTester = createRuleTester ( ) ;
5+
6+ ruleTester . run ( "use-standard-html" , rule , {
7+ valid : [
8+ {
9+ code : `<slot></slot>` ,
10+ } ,
11+ ] ,
12+ invalid : [ ] ,
13+ } ) ;
Original file line number Diff line number Diff line change @@ -1284,6 +1284,7 @@ __metadata:
12841284 es-html-parser: "npm:0.1.1"
12851285 eslint: "npm:^9.21.0"
12861286 espree: "npm:^10.3.0"
1287+ html-standard: "npm:^0.0.3"
12871288 typescript: "npm:^5.7.2"
12881289 languageName: unknown
12891290 linkType: soft
@@ -1299,6 +1300,7 @@ __metadata:
12991300 eslint: "npm:^9.19.0"
13001301 eslint-plugin-jest: "npm:^28.11.0"
13011302 eslint-plugin-n: "npm:^17.15.1"
1303+ html-standard: "npm:^0.0.2"
13021304 husky: "npm:^9.1.4"
13031305 jest: "npm:^29.7.0"
13041306 lerna: "npm:^8.1.9"
@@ -8797,6 +8799,20 @@ __metadata:
87978799 languageName: node
87988800 linkType: hard
87998801
8802+ "html-standard@npm:^0.0.2":
8803+ version: 0.0.2
8804+ resolution: "html-standard@npm:0.0.2"
8805+ checksum: 73823c8f664ac499e6415fa15b7f8771f92465ca2d5e98ae006ff79619f9ba4b7a69685ca212d82635c83cd9322811641f986073b7ca0b27ff0ab92484bb4247
8806+ languageName: node
8807+ linkType: hard
8808+
8809+ "html-standard@npm:^0.0.3":
8810+ version: 0.0.3
8811+ resolution: "html-standard@npm:0.0.3"
8812+ checksum: 782dcd5161cb044c18c9239f332cbcae73072c96bcf2336b0dad4f3162f45d47076aaccd679f69276108e3172171bf45a0f5374c876976793ac165e85d62923f
8813+ languageName: node
8814+ linkType: hard
8815+
88008816"htmlnano@npm:^2.0.0":
88018817 version: 2.1.1
88028818 resolution: "htmlnano@npm:2.1.1"
You can’t perform that action at this time.
0 commit comments