/
no-warning-html-comments.js
78 lines (75 loc) · 1.98 KB
/
no-warning-html-comments.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"use strict";
const RuleTester = require("../../eslint-compat").RuleTester;
const rule = require("../../../lib/rules/no-warning-html-comments");
const tester = new RuleTester({
languageOptions: {
parser: require("../../../lib/parser/micro-template-eslint-parser"),
ecmaVersion: 2015,
},
});
tester.run("no-warning-html-comments", rule, {
valid: [
{
filename: "test.html",
code: "",
},
"<!--comment-->",
{
filename: "test.html",
code: "<div></div>",
},
`<div>
<% arr.forEach((a)=>{ %>
<%= a %>
<%- a %>
<% }) %>
</div>`,
{
filename: "test.html",
code: "<!-- before TODO -->",
options: [
{
location: "start",
},
],
},
"<!-- eslint-disable-line lodash-template/no-warning-html-comments TODO -->",
],
invalid: [
{
filename: "test.html",
code: "<!--TODO-->",
output: null,
errors: [
{
message: "Unexpected 'todo' comment.",
line: 1,
column: 1,
type: "HTMLComment",
endLine: 1,
endColumn: 12,
},
],
},
{
filename: "test.html",
code: "<!-- before TODO -->",
output: null,
errors: ["Unexpected 'todo' comment."],
},
{
filename: "test.html",
code: "<!-- %T -->",
output: null,
options: [{ terms: ["%t"] }],
errors: ["Unexpected '%t' comment."],
},
{
filename: "test.html",
code: "<!-- %% -->",
output: null,
options: [{ terms: ["%%"] }],
errors: ["Unexpected '%%' comment."],
},
],
});