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 49
49
"packageManager" : " yarn@4.0.2" ,
50
50
"workspaces" : [
51
51
" packages/**"
52
- ]
52
+ ],
53
+ "dependencies" : {
54
+ "html-standard" : " ^0.0.2"
55
+ }
53
56
}
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 40
40
"dependencies" : {
41
41
"@eslint/plugin-kit" : " 0.2.8" ,
42
42
"@html-eslint/template-parser" : " ^0.40.0" ,
43
- "@html-eslint/template-syntax-parser" : " ^0.40.0"
43
+ "@html-eslint/template-syntax-parser" : " ^0.40.0" ,
44
+ "html-standard" : " ^0.0.3"
44
45
},
45
46
"devDependencies" : {
46
47
"@eslint/core" : " 0.13.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 @@ -1305,6 +1305,7 @@ __metadata:
1305
1305
es-html-parser: "npm:0.2.0"
1306
1306
eslint: "npm:^9.21.0"
1307
1307
espree: "npm:^10.3.0"
1308
+ html-standard: "npm:^0.0.3"
1308
1309
typescript: "npm:^5.7.2"
1309
1310
languageName: unknown
1310
1311
linkType: soft
@@ -1320,6 +1321,7 @@ __metadata:
1320
1321
eslint: "npm:^9.19.0"
1321
1322
eslint-plugin-jest: "npm:^28.11.0"
1322
1323
eslint-plugin-n: "npm:^17.15.1"
1324
+ html-standard: "npm:^0.0.2"
1323
1325
husky: "npm:^9.1.4"
1324
1326
jest: "npm:^29.7.0"
1325
1327
lerna: "npm:^8.1.9"
@@ -8818,6 +8820,20 @@ __metadata:
8818
8820
languageName: node
8819
8821
linkType: hard
8820
8822
8823
+ "html-standard@npm:^0.0.2":
8824
+ version: 0.0.2
8825
+ resolution: "html-standard@npm:0.0.2"
8826
+ checksum: 73823c8f664ac499e6415fa15b7f8771f92465ca2d5e98ae006ff79619f9ba4b7a69685ca212d82635c83cd9322811641f986073b7ca0b27ff0ab92484bb4247
8827
+ languageName: node
8828
+ linkType: hard
8829
+
8830
+ "html-standard@npm:^0.0.3":
8831
+ version: 0.0.3
8832
+ resolution: "html-standard@npm:0.0.3"
8833
+ checksum: 782dcd5161cb044c18c9239f332cbcae73072c96bcf2336b0dad4f3162f45d47076aaccd679f69276108e3172171bf45a0f5374c876976793ac165e85d62923f
8834
+ languageName: node
8835
+ linkType: hard
8836
+
8821
8837
"htmlnano@npm:^2.0.0":
8822
8838
version: 2.1.1
8823
8839
resolution: "htmlnano@npm:2.1.1"
You can’t perform that action at this time.
0 commit comments