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 48
48
"packageManager" : " yarn@4.0.2" ,
49
49
"workspaces" : [
50
50
" packages/**"
51
- ]
51
+ ],
52
+ "dependencies" : {
53
+ "html-standard" : " ^0.0.2"
54
+ }
52
55
}
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ const maxElementDepth = require("./max-element-depth");
47
47
const requireExplicitSize = require ( "./require-explicit-size" ) ;
48
48
const useBaseLine = require ( "./use-baseline" ) ;
49
49
const noDuplicateClass = require ( "./no-duplicate-class" ) ;
50
+ const useStandardHtml = require ( "./use-standard-html" ) ;
50
51
// import new rule here ↑
51
52
// DO NOT REMOVE THIS COMMENT
52
53
@@ -100,6 +101,7 @@ module.exports = {
100
101
"require-explicit-size" : requireExplicitSize ,
101
102
"use-baseline" : useBaseLine ,
102
103
"no-duplicate-class" : noDuplicateClass ,
104
+ "use-standard-html" : useStandardHtml ,
103
105
// export new rule here ↑
104
106
// DO NOT REMOVE THIS COMMENT
105
107
} ;
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 38
38
],
39
39
"dependencies" : {
40
40
"@html-eslint/template-parser" : " ^0.39.0" ,
41
- "@html-eslint/template-syntax-parser" : " ^0.39.0"
41
+ "@html-eslint/template-syntax-parser" : " ^0.39.0" ,
42
+ "html-standard" : " ^0.0.3"
42
43
},
43
44
"devDependencies" : {
44
45
"@html-eslint/parser" : " ^0.39.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:
1284
1284
es-html-parser: "npm:0.1.1"
1285
1285
eslint: "npm:^9.21.0"
1286
1286
espree: "npm:^10.3.0"
1287
+ html-standard: "npm:^0.0.3"
1287
1288
typescript: "npm:^5.7.2"
1288
1289
languageName: unknown
1289
1290
linkType: soft
@@ -1299,6 +1300,7 @@ __metadata:
1299
1300
eslint: "npm:^9.19.0"
1300
1301
eslint-plugin-jest: "npm:^28.11.0"
1301
1302
eslint-plugin-n: "npm:^17.15.1"
1303
+ html-standard: "npm:^0.0.2"
1302
1304
husky: "npm:^9.1.4"
1303
1305
jest: "npm:^29.7.0"
1304
1306
lerna: "npm:^8.1.9"
@@ -8797,6 +8799,20 @@ __metadata:
8797
8799
languageName: node
8798
8800
linkType: hard
8799
8801
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
+
8800
8816
"htmlnano@npm:^2.0.0":
8801
8817
version: 2.1.1
8802
8818
resolution: "htmlnano@npm:2.1.1"
You can’t perform that action at this time.
0 commit comments