@html-eslint/eslint-plugin 0.38.1 → 0.40.0-alpha.0
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/lib/index.js +11 -2
- package/lib/languages/html-language.js +95 -0
- package/lib/languages/html-source-code.js +196 -0
- package/lib/languages/html-traversal-step.js +34 -0
- package/lib/rules/index.js +2 -0
- package/lib/rules/no-duplicate-class.js +137 -0
- package/lib/rules/require-attrs.js +23 -3
- package/lib/rules/use-baseline.js +64 -0
- package/lib/rules/utils/baseline.js +107 -0
- package/lib/types/rule.ts +1 -1
- package/package.json +10 -7
- package/types/index.d.ts +6 -1
- package/types/index.d.ts.map +1 -1
- package/types/languages/html-language.d.ts +55 -0
- package/types/languages/html-language.d.ts.map +1 -0
- package/types/languages/html-source-code.d.ts +70 -0
- package/types/languages/html-source-code.d.ts.map +1 -0
- package/types/languages/html-traversal-step.d.ts +22 -0
- package/types/languages/html-traversal-step.d.ts.map +1 -0
- package/types/rules/index.d.ts +1 -0
- package/types/rules/no-duplicate-class.d.ts +16 -0
- package/types/rules/no-duplicate-class.d.ts.map +1 -0
- package/types/rules/require-attrs.d.ts +3 -1
- package/types/rules/require-attrs.d.ts.map +1 -1
- package/types/rules/utils/baseline.d.ts.map +1 -1
- package/types/types/rule.d.ts +1 -1
- package/types/types/rule.d.ts.map +1 -1
package/lib/index.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
const rules = require("./rules");
|
|
2
2
|
const recommended = require("./configs/recommended");
|
|
3
3
|
const parser = require("@html-eslint/parser");
|
|
4
|
-
|
|
4
|
+
const { HTMLLanguage } = require("./languages/html-language");
|
|
5
|
+
const { name, version } = require("../package.json");
|
|
5
6
|
/**
|
|
6
7
|
* @typedef {import("./rules")} AllRules
|
|
7
8
|
* @typedef {import("./configs/recommended")} RecommendedConfig
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
* @type {{rules: AllRules, configs: {recommended: RecommendedConfig, "flat/recommended": import("eslint").Linter.FlatConfig }}}
|
|
12
|
+
* @type {{meta: { name: string, version: string }, rules: AllRules, configs: {recommended: RecommendedConfig, "flat/recommended": import("eslint").Linter.FlatConfig }}}
|
|
12
13
|
*/
|
|
13
14
|
const plugin = {
|
|
15
|
+
meta: {
|
|
16
|
+
name,
|
|
17
|
+
version,
|
|
18
|
+
},
|
|
14
19
|
// @ts-ignore
|
|
15
20
|
configs: {
|
|
16
21
|
recommended,
|
|
17
22
|
},
|
|
23
|
+
languages: {
|
|
24
|
+
html: new HTMLLanguage(),
|
|
25
|
+
},
|
|
18
26
|
rules,
|
|
19
27
|
};
|
|
20
28
|
|
|
@@ -23,6 +31,7 @@ Object.assign(plugin.configs, {
|
|
|
23
31
|
plugins: {
|
|
24
32
|
"@html-eslint": plugin,
|
|
25
33
|
},
|
|
34
|
+
|
|
26
35
|
languageOptions: {
|
|
27
36
|
parser,
|
|
28
37
|
},
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const { visitorKeys, parseForESLint } = require("@html-eslint/parser");
|
|
2
|
+
const { HTMLSourceCode } = require("./html-source-code");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('@eslint/core').File} File
|
|
6
|
+
* @typedef {import('@html-eslint/parser').ParserOptions} LanguageOptions
|
|
7
|
+
*/
|
|
8
|
+
class HTMLLanguage {
|
|
9
|
+
constructor() {
|
|
10
|
+
/**
|
|
11
|
+
* @property
|
|
12
|
+
* @type {"text"}
|
|
13
|
+
*/
|
|
14
|
+
this.fileType = "text";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @property
|
|
18
|
+
* @type {0|1}
|
|
19
|
+
*/
|
|
20
|
+
this.lineStart = 1;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @property
|
|
24
|
+
* @type {0|1}
|
|
25
|
+
*/
|
|
26
|
+
this.columnStart = 0;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
this.nodeTypeKey = "type";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The visitor keys for the CSSTree AST.
|
|
35
|
+
* @type {Record<string, string[]>}
|
|
36
|
+
*/
|
|
37
|
+
this.visitorKeys = visitorKeys;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {LanguageOptions} languageOptions
|
|
42
|
+
*/
|
|
43
|
+
validateLanguageOptions(languageOptions) {
|
|
44
|
+
if (!languageOptions) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (
|
|
48
|
+
"frontmatter" in languageOptions &&
|
|
49
|
+
typeof languageOptions.frontmatter !== "boolean"
|
|
50
|
+
) {
|
|
51
|
+
throw new TypeError("Expected a boolean value for 'frontmatter' option.");
|
|
52
|
+
}
|
|
53
|
+
if (
|
|
54
|
+
"templateEngineSyntax" in languageOptions &&
|
|
55
|
+
(typeof languageOptions.templateEngineSyntax !== "object" ||
|
|
56
|
+
!languageOptions.templateEngineSyntax)
|
|
57
|
+
) {
|
|
58
|
+
throw new TypeError(
|
|
59
|
+
"Expected an key-value record value for 'templateEngineSyntax' option."
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {File} file
|
|
66
|
+
* @param {Object} [context]
|
|
67
|
+
* @param {LanguageOptions} context.languageOptions
|
|
68
|
+
*/
|
|
69
|
+
parse(file, context) {
|
|
70
|
+
const code = /** @type {string} */ (file.body);
|
|
71
|
+
const languageOptions = (context && context.languageOptions) || {};
|
|
72
|
+
const result = parseForESLint(code, languageOptions);
|
|
73
|
+
return {
|
|
74
|
+
ok: true,
|
|
75
|
+
ast: result.ast,
|
|
76
|
+
comments: result.ast.comments,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @param {File} file
|
|
82
|
+
* @param {any} parseResult
|
|
83
|
+
*/
|
|
84
|
+
createSourceCode(file, parseResult) {
|
|
85
|
+
return new HTMLSourceCode({
|
|
86
|
+
text: /** @type {string} */ (file.body),
|
|
87
|
+
ast: parseResult.ast,
|
|
88
|
+
comments: parseResult.comments,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = {
|
|
94
|
+
HTMLLanguage,
|
|
95
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("eslint").AST.Program} Program
|
|
3
|
+
* @typedef {import("@eslint/plugin-kit").SourceLocation} SourceLocation
|
|
4
|
+
* @typedef {import("@eslint/plugin-kit").DirectiveType} DirectiveType
|
|
5
|
+
* @typedef {import("@eslint/core").TraversalStep} TraversalStep
|
|
6
|
+
* @typedef {import("@html-eslint/types").CommentContent} CommentContent
|
|
7
|
+
* @typedef {import("@html-eslint/types").AnyHTMLNode} AnyHTMLNode
|
|
8
|
+
* @typedef {import("../types").BaseNode} BaseNode
|
|
9
|
+
*/
|
|
10
|
+
const {
|
|
11
|
+
TextSourceCodeBase,
|
|
12
|
+
ConfigCommentParser,
|
|
13
|
+
Directive,
|
|
14
|
+
} = require("@eslint/plugin-kit");
|
|
15
|
+
const { SourceCode } = require("eslint");
|
|
16
|
+
const { HTMLTraversalStep, STEP_PHASE } = require("./html-traversal-step");
|
|
17
|
+
const { visitorKeys } = require("@html-eslint/parser");
|
|
18
|
+
|
|
19
|
+
const INLINE_CONFIG =
|
|
20
|
+
/^\s*(?:eslint(?:-enable|-disable(?:(?:-next)?-line)?)?)(?:\s|$)/u;
|
|
21
|
+
|
|
22
|
+
const commentParser = new ConfigCommentParser();
|
|
23
|
+
|
|
24
|
+
class HTMLSourceCode extends TextSourceCodeBase {
|
|
25
|
+
/**
|
|
26
|
+
* @param {{ast: Program, text: string, comments: CommentContent[]}} config
|
|
27
|
+
*/
|
|
28
|
+
constructor({ ast, text, comments }) {
|
|
29
|
+
super({ ast, text });
|
|
30
|
+
/**
|
|
31
|
+
* @property
|
|
32
|
+
*/
|
|
33
|
+
this.eslintSourceCode = new SourceCode(text, ast);
|
|
34
|
+
/**
|
|
35
|
+
* @property
|
|
36
|
+
*/
|
|
37
|
+
this.ast = ast;
|
|
38
|
+
/**
|
|
39
|
+
* @property
|
|
40
|
+
*/
|
|
41
|
+
this.comments = comments;
|
|
42
|
+
this.parentsMap = new Map();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {BaseNode} node
|
|
47
|
+
* @returns {[number, number]}
|
|
48
|
+
*/
|
|
49
|
+
getRange(node) {
|
|
50
|
+
return node.range;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {BaseNode} node
|
|
55
|
+
* @returns {import("@eslint/plugin-kit").SourceLocation}
|
|
56
|
+
*/
|
|
57
|
+
getLoc(node) {
|
|
58
|
+
return node.loc;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
getLines() {
|
|
62
|
+
return this.lines;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {import("@eslint/core").Position} loc
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
getIndexFromLoc(loc) {
|
|
70
|
+
return this.eslintSourceCode.getIndexFromLoc(loc);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {number} index
|
|
75
|
+
* @returns {import("@eslint/core").Position}
|
|
76
|
+
*/
|
|
77
|
+
getLocFromIndex(index) {
|
|
78
|
+
return this.eslintSourceCode.getLocFromIndex(index);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getInlineConfigNodes() {
|
|
82
|
+
return this.comments.filter((comment) => INLINE_CONFIG.test(comment.value));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getDisableDirectives() {
|
|
86
|
+
/**
|
|
87
|
+
* @type {{ruleId: null | string, message: string; loc: SourceLocation}[]}
|
|
88
|
+
*/
|
|
89
|
+
const problems = [];
|
|
90
|
+
/**
|
|
91
|
+
* @type {Directive[]}
|
|
92
|
+
*/
|
|
93
|
+
const directives = [];
|
|
94
|
+
|
|
95
|
+
this.getInlineConfigNodes().forEach((comment) => {
|
|
96
|
+
const parsed = commentParser.parseDirective(comment.value);
|
|
97
|
+
if (!parsed) return;
|
|
98
|
+
const { label, value, justification } = parsed;
|
|
99
|
+
// `eslint-disable-line` directives are not allowed to span multiple lines as it would be confusing to which lines they apply
|
|
100
|
+
if (
|
|
101
|
+
label === "eslint-disable-line" &&
|
|
102
|
+
comment.loc.start.line !== comment.loc.end.line
|
|
103
|
+
) {
|
|
104
|
+
const message = `${label} comment should not span multiple lines.`;
|
|
105
|
+
|
|
106
|
+
problems.push({
|
|
107
|
+
ruleId: null,
|
|
108
|
+
message,
|
|
109
|
+
loc: comment.loc,
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
switch (label) {
|
|
115
|
+
case "eslint-disable":
|
|
116
|
+
case "eslint-enable":
|
|
117
|
+
case "eslint-disable-next-line":
|
|
118
|
+
case "eslint-disable-line": {
|
|
119
|
+
const directiveType = label.slice("eslint-".length);
|
|
120
|
+
directives.push(
|
|
121
|
+
new Directive({
|
|
122
|
+
type: /** @type {DirectiveType} */ (directiveType),
|
|
123
|
+
node: comment,
|
|
124
|
+
value,
|
|
125
|
+
justification,
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return { problems, directives };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
traverse() {
|
|
136
|
+
/**
|
|
137
|
+
* @type {TraversalStep[]}
|
|
138
|
+
*/
|
|
139
|
+
const steps = [];
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param {AnyHTMLNode | Program} node
|
|
144
|
+
* @param {AnyHTMLNode | Program | null} parent
|
|
145
|
+
*/
|
|
146
|
+
const visit = (node, parent) => {
|
|
147
|
+
this.parentsMap.set(node, parent);
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
node.parent = parent;
|
|
150
|
+
steps.push(
|
|
151
|
+
new HTMLTraversalStep({
|
|
152
|
+
target: node,
|
|
153
|
+
phase: STEP_PHASE.ENTER,
|
|
154
|
+
args: [node, parent],
|
|
155
|
+
})
|
|
156
|
+
);
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
for (const key of visitorKeys[node.type] || []) {
|
|
159
|
+
// @ts-ignore
|
|
160
|
+
const child = node[key];
|
|
161
|
+
|
|
162
|
+
if (child) {
|
|
163
|
+
if (Array.isArray(child)) {
|
|
164
|
+
child.forEach((grandchild) => {
|
|
165
|
+
visit(grandchild, node);
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
visit(child, node);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
steps.push(
|
|
173
|
+
new HTMLTraversalStep({
|
|
174
|
+
target: node,
|
|
175
|
+
phase: STEP_PHASE.EXIT,
|
|
176
|
+
args: [node, parent],
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
visit(this.ast, null);
|
|
181
|
+
|
|
182
|
+
return steps;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {AnyHTMLNode} node
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
getParent(node) {
|
|
190
|
+
return this.parentsMap.get(node);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
module.exports = {
|
|
195
|
+
HTMLSourceCode,
|
|
196
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("eslint").AST.Program} Program
|
|
3
|
+
* @typedef {import('@html-eslint/types').AnyHTMLNode} AnyHTMLNode
|
|
4
|
+
*/
|
|
5
|
+
const { VisitNodeStep } = require("@eslint/plugin-kit");
|
|
6
|
+
|
|
7
|
+
const STEP_PHASE = {
|
|
8
|
+
/**
|
|
9
|
+
* @type {1}
|
|
10
|
+
*/
|
|
11
|
+
ENTER: 1,
|
|
12
|
+
/**
|
|
13
|
+
* @type {2}
|
|
14
|
+
*/
|
|
15
|
+
EXIT: 2,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
class HTMLTraversalStep extends VisitNodeStep {
|
|
19
|
+
/**
|
|
20
|
+
* @param {Object} options
|
|
21
|
+
* @param {AnyHTMLNode | Program} options.target
|
|
22
|
+
* @param {1|2} options.phase
|
|
23
|
+
* @param {Array<any>} options.args
|
|
24
|
+
*/
|
|
25
|
+
constructor({ target, phase, args }) {
|
|
26
|
+
super({ target, phase, args });
|
|
27
|
+
this.target = target;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = {
|
|
32
|
+
HTMLTraversalStep,
|
|
33
|
+
STEP_PHASE,
|
|
34
|
+
};
|
package/lib/rules/index.js
CHANGED
|
@@ -46,6 +46,7 @@ const noNestedInteractive = require("./no-nested-interactive");
|
|
|
46
46
|
const maxElementDepth = require("./max-element-depth");
|
|
47
47
|
const requireExplicitSize = require("./require-explicit-size");
|
|
48
48
|
const useBaseLine = require("./use-baseline");
|
|
49
|
+
const noDuplicateClass = require("./no-duplicate-class");
|
|
49
50
|
// import new rule here ↑
|
|
50
51
|
// DO NOT REMOVE THIS COMMENT
|
|
51
52
|
|
|
@@ -98,6 +99,7 @@ module.exports = {
|
|
|
98
99
|
"max-element-depth": maxElementDepth,
|
|
99
100
|
"require-explicit-size": requireExplicitSize,
|
|
100
101
|
"use-baseline": useBaseLine,
|
|
102
|
+
"no-duplicate-class": noDuplicateClass,
|
|
101
103
|
// export new rule here ↑
|
|
102
104
|
// DO NOT REMOVE THIS COMMENT
|
|
103
105
|
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("@html-eslint/types").AttributeValue } AttributeValue
|
|
6
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
7
|
+
* @typedef {Object} ClassInfo
|
|
8
|
+
* @property {string} name
|
|
9
|
+
* @property {import("@html-eslint/types").AnyNode['loc']} loc
|
|
10
|
+
* @property {import("@html-eslint/types").AnyNode['range']} range
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { NodeTypes } = require("es-html-parser");
|
|
14
|
+
const { RULE_CATEGORY } = require("../constants");
|
|
15
|
+
const { createVisitors } = require("./utils/visitors");
|
|
16
|
+
|
|
17
|
+
const MESSAGE_IDS = {
|
|
18
|
+
DUPLICATE_CLASS: "duplicateClass",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @type {RuleModule}
|
|
23
|
+
*/
|
|
24
|
+
module.exports = {
|
|
25
|
+
meta: {
|
|
26
|
+
type: "code",
|
|
27
|
+
docs: {
|
|
28
|
+
description: "Disallow to use duplicate class",
|
|
29
|
+
category: RULE_CATEGORY.BEST_PRACTICE,
|
|
30
|
+
recommended: false,
|
|
31
|
+
},
|
|
32
|
+
fixable: "code",
|
|
33
|
+
schema: [],
|
|
34
|
+
messages: {
|
|
35
|
+
[MESSAGE_IDS.DUPLICATE_CLASS]: "The class '{{class}}' is duplicated.",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
create(context) {
|
|
40
|
+
/**
|
|
41
|
+
* @param {AttributeValue} value
|
|
42
|
+
* @returns {{value: string, pos: number}[]}
|
|
43
|
+
*/
|
|
44
|
+
function splitClassAndSpaces(value) {
|
|
45
|
+
/**
|
|
46
|
+
* @type {{value: string, pos: number}[]}
|
|
47
|
+
*/
|
|
48
|
+
const result = [];
|
|
49
|
+
const regex = /(\s+|\S+)/g;
|
|
50
|
+
/**
|
|
51
|
+
* @type {RegExpExecArray | null}
|
|
52
|
+
*/
|
|
53
|
+
let match = null;
|
|
54
|
+
|
|
55
|
+
while ((match = regex.exec(value.value)) !== null) {
|
|
56
|
+
result.push({
|
|
57
|
+
value: match[0],
|
|
58
|
+
pos: match.index,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return createVisitors(context, {
|
|
66
|
+
Attribute(node) {
|
|
67
|
+
if (node.key.value.toLowerCase() !== "class") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const attributeValue = node.value;
|
|
71
|
+
if (
|
|
72
|
+
!attributeValue ||
|
|
73
|
+
!attributeValue.value ||
|
|
74
|
+
attributeValue.parts.some((part) => part.type === NodeTypes.Template)
|
|
75
|
+
) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const classesAndSpaces = splitClassAndSpaces(attributeValue);
|
|
79
|
+
const classSet = new Set();
|
|
80
|
+
classesAndSpaces.forEach(({ value, pos }, index) => {
|
|
81
|
+
const className = value.trim();
|
|
82
|
+
|
|
83
|
+
if (className.length && classSet.has(className)) {
|
|
84
|
+
context.report({
|
|
85
|
+
loc: {
|
|
86
|
+
start: {
|
|
87
|
+
line: attributeValue.loc.start.line,
|
|
88
|
+
column: attributeValue.loc.start.column + pos,
|
|
89
|
+
},
|
|
90
|
+
end: {
|
|
91
|
+
line: attributeValue.loc.start.line,
|
|
92
|
+
column:
|
|
93
|
+
attributeValue.loc.start.column + pos + className.length,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
data: {
|
|
97
|
+
class: className,
|
|
98
|
+
},
|
|
99
|
+
messageId: MESSAGE_IDS.DUPLICATE_CLASS,
|
|
100
|
+
fix(fixer) {
|
|
101
|
+
if (!node.value) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const before = classesAndSpaces[index - 1];
|
|
105
|
+
const after = classesAndSpaces[index + 1];
|
|
106
|
+
const hasSpacesBefore =
|
|
107
|
+
!!before && before.value.trim().length === 0;
|
|
108
|
+
const hasSpacesAfter =
|
|
109
|
+
!!after && after.value.trim().length === 0;
|
|
110
|
+
const hasClassBefore = !!classesAndSpaces[index - 2];
|
|
111
|
+
const hasClassAfter = !!classesAndSpaces[index + 2];
|
|
112
|
+
|
|
113
|
+
const startRange = hasSpacesBefore
|
|
114
|
+
? attributeValue.range[0] + before.pos
|
|
115
|
+
: attributeValue.range[0] + pos;
|
|
116
|
+
|
|
117
|
+
const endRange = hasSpacesAfter
|
|
118
|
+
? attributeValue.range[0] +
|
|
119
|
+
pos +
|
|
120
|
+
value.length +
|
|
121
|
+
after.value.length
|
|
122
|
+
: attributeValue.range[0] + pos + value.length;
|
|
123
|
+
|
|
124
|
+
return fixer.replaceTextRange(
|
|
125
|
+
[startRange, endRange],
|
|
126
|
+
hasClassBefore && hasClassAfter ? " " : ""
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
classSet.add(className);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
3
|
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
4
4
|
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
5
|
+
* @typedef { import("@html-eslint/types").Attribute } Attribute
|
|
5
6
|
*
|
|
6
7
|
* @typedef {Object} Option
|
|
7
8
|
* @property {string} tag
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
* @property {string} [value]
|
|
10
11
|
*
|
|
11
12
|
* @typedef { import("../types").RuleModule<Option[]> } RuleModule
|
|
13
|
+
* @typedef { import("../types").ReportFixFunction} ReportFixFunction
|
|
12
14
|
*
|
|
13
15
|
*/
|
|
14
16
|
|
|
@@ -33,7 +35,7 @@ module.exports = {
|
|
|
33
35
|
category: RULE_CATEGORY.BEST_PRACTICE,
|
|
34
36
|
recommended: false,
|
|
35
37
|
},
|
|
36
|
-
fixable:
|
|
38
|
+
fixable: "code",
|
|
37
39
|
schema: {
|
|
38
40
|
type: "array",
|
|
39
41
|
items: {
|
|
@@ -48,9 +50,9 @@ module.exports = {
|
|
|
48
50
|
},
|
|
49
51
|
},
|
|
50
52
|
messages: {
|
|
51
|
-
[MESSAGE_IDS.MISSING]: "Missing '{{attr}}'
|
|
53
|
+
[MESSAGE_IDS.MISSING]: "Missing '{{attr}}' attribute on '{{tag}}' tag",
|
|
52
54
|
[MESSAGE_IDS.UNEXPECTED]:
|
|
53
|
-
"Unexpected '{{attr}}'
|
|
55
|
+
"Unexpected '{{attr}}' attribute value. '{{expected}}' is expected",
|
|
54
56
|
},
|
|
55
57
|
},
|
|
56
58
|
|
|
@@ -97,6 +99,15 @@ module.exports = {
|
|
|
97
99
|
attr: attrName,
|
|
98
100
|
tag: tagName,
|
|
99
101
|
},
|
|
102
|
+
fix(fixer) {
|
|
103
|
+
if (!option.value) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return fixer.insertTextAfter(
|
|
107
|
+
node.openStart,
|
|
108
|
+
` ${attrName}="${option.value}"`
|
|
109
|
+
);
|
|
110
|
+
},
|
|
100
111
|
});
|
|
101
112
|
} else if (
|
|
102
113
|
typeof option.value === "string" &&
|
|
@@ -109,6 +120,15 @@ module.exports = {
|
|
|
109
120
|
attr: attrName,
|
|
110
121
|
expected: option.value,
|
|
111
122
|
},
|
|
123
|
+
fix(fixer) {
|
|
124
|
+
if (option.value) {
|
|
125
|
+
if (attr.value) {
|
|
126
|
+
return fixer.replaceText(attr.value, option.value);
|
|
127
|
+
}
|
|
128
|
+
return fixer.insertTextAfter(attr.key, `="${option.value}"`);
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
},
|
|
112
132
|
});
|
|
113
133
|
}
|
|
114
134
|
});
|
|
@@ -178,6 +178,65 @@ module.exports = {
|
|
|
178
178
|
return isSupported(globalAttrStatus);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
*
|
|
183
|
+
* @param {string} element
|
|
184
|
+
* @param {string} key
|
|
185
|
+
* @param {string} value
|
|
186
|
+
* @returns {string | null}
|
|
187
|
+
*/
|
|
188
|
+
function getElementAttributeSpecificStatusKey(element, key, value) {
|
|
189
|
+
const elementName = element.toLowerCase();
|
|
190
|
+
const attributeKey = key.toLowerCase();
|
|
191
|
+
const attributeValue = value.toLowerCase();
|
|
192
|
+
|
|
193
|
+
// <input type="...">
|
|
194
|
+
if (elementName === "input" && attributeKey === "type") {
|
|
195
|
+
return `input.type_${attributeValue}`;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// <a href="sms:0000..">
|
|
199
|
+
if (
|
|
200
|
+
elementName === "a" &&
|
|
201
|
+
attributeKey === "href" &&
|
|
202
|
+
attributeValue.trim().startsWith("sms:")
|
|
203
|
+
) {
|
|
204
|
+
return "a.href.href_sms";
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// <td rowspan="0"> <th rowspan="0">
|
|
208
|
+
if (
|
|
209
|
+
(elementName === "td" || elementName === "th") &&
|
|
210
|
+
attributeKey === "rowspan" &&
|
|
211
|
+
attributeValue === "0"
|
|
212
|
+
) {
|
|
213
|
+
return `${elementName}.rowspan.rowspan_zero`;
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @param {string} element
|
|
220
|
+
* @param {string} key
|
|
221
|
+
* @param {string} value
|
|
222
|
+
* @returns {boolean}
|
|
223
|
+
*/
|
|
224
|
+
function isSupportedElementSpecificAttributeKeyValue(element, key, value) {
|
|
225
|
+
const statusKey = getElementAttributeSpecificStatusKey(
|
|
226
|
+
element,
|
|
227
|
+
key,
|
|
228
|
+
value
|
|
229
|
+
);
|
|
230
|
+
if (!statusKey) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
const elementStatus = elements.get(statusKey);
|
|
234
|
+
if (!elementStatus) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
return isSupported(elementStatus);
|
|
238
|
+
}
|
|
239
|
+
|
|
181
240
|
/**
|
|
182
241
|
* @param {Tag | ScriptTag | StyleTag} node
|
|
183
242
|
* @param {string} elementName
|
|
@@ -224,6 +283,11 @@ module.exports = {
|
|
|
224
283
|
elementName,
|
|
225
284
|
attribute.key.value,
|
|
226
285
|
attribute.value.value
|
|
286
|
+
) ||
|
|
287
|
+
!isSupportedElementSpecificAttributeKeyValue(
|
|
288
|
+
elementName,
|
|
289
|
+
attribute.key.value,
|
|
290
|
+
attribute.value.value
|
|
227
291
|
)
|
|
228
292
|
) {
|
|
229
293
|
context.report({
|
|
@@ -11,7 +11,10 @@ const elements = new Map([
|
|
|
11
11
|
["a.attributionsrc", "0:"],
|
|
12
12
|
["a.download", "10:2019"],
|
|
13
13
|
["a.href", "10:2015"],
|
|
14
|
+
["a.href.href_sms", "0:"],
|
|
15
|
+
["a.href.href_top", "10:2015"],
|
|
14
16
|
["a.hreflang", "10:2015"],
|
|
17
|
+
["a.implicit_noopener", "10:2021"],
|
|
15
18
|
["a.ping", "0:"],
|
|
16
19
|
["a.referrerpolicy", "10:2020"],
|
|
17
20
|
["a.referrerpolicy.no-referrer-when-downgrade", "0:"],
|
|
@@ -22,6 +25,7 @@ const elements = new Map([
|
|
|
22
25
|
["a.rel.noreferrer", "10:2015"],
|
|
23
26
|
["a.target", "10:2015"],
|
|
24
27
|
["a.target.unfencedTop", "0:"],
|
|
28
|
+
["a.text_fragments", "5:2024"],
|
|
25
29
|
["a.type", "10:2015"],
|
|
26
30
|
["abbr", "10:2015"],
|
|
27
31
|
["address", "10:2015"],
|
|
@@ -31,6 +35,7 @@ const elements = new Map([
|
|
|
31
35
|
["area.coords", "10:2015"],
|
|
32
36
|
["area.download", "10:2017"],
|
|
33
37
|
["area.href", "10:2015"],
|
|
38
|
+
["area.implicit_noopener", "10:2021"],
|
|
34
39
|
["area.ping", "0:"],
|
|
35
40
|
["area.referrerpolicy", "10:2020"],
|
|
36
41
|
["area.referrerpolicy.no-referrer-when-downgrade", "0:"],
|
|
@@ -56,6 +61,8 @@ const elements = new Map([
|
|
|
56
61
|
["b", "10:2015"],
|
|
57
62
|
["base", "10:2015"],
|
|
58
63
|
["base.href", "10:2015"],
|
|
64
|
+
["base.href.forbid_data_javascript_urls", "5:2024"],
|
|
65
|
+
["base.href.relative_url", "10:2015"],
|
|
59
66
|
["base.target", "10:2015"],
|
|
60
67
|
["bdi", "10:2020"],
|
|
61
68
|
["bdo", "10:2015"],
|
|
@@ -75,6 +82,7 @@ const elements = new Map([
|
|
|
75
82
|
["button.formtarget", "10:2015"],
|
|
76
83
|
["button.name", "10:2015"],
|
|
77
84
|
["button.popovertarget", "5:2024"],
|
|
85
|
+
["button.popovertarget.implicit_anchor_reference", "0:"],
|
|
78
86
|
["button.popovertargetaction", "5:2024"],
|
|
79
87
|
["button.type", "10:2015"],
|
|
80
88
|
["button.value", "10:2015"],
|
|
@@ -82,12 +90,23 @@ const elements = new Map([
|
|
|
82
90
|
["canvas.height", "10:2015"],
|
|
83
91
|
["canvas.width", "10:2015"],
|
|
84
92
|
["caption", "10:2015"],
|
|
93
|
+
["caption.align", "0:"],
|
|
85
94
|
["cite", "10:2015"],
|
|
86
95
|
["code", "10:2015"],
|
|
87
96
|
["col", "10:2015"],
|
|
97
|
+
["col.align", "0:"],
|
|
98
|
+
["col.char", "0:"],
|
|
99
|
+
["col.charoff", "0:"],
|
|
88
100
|
["col.span", "10:2015"],
|
|
101
|
+
["col.valign", "0:"],
|
|
102
|
+
["col.width", "0:"],
|
|
89
103
|
["colgroup", "10:2015"],
|
|
104
|
+
["colgroup.align", "0:"],
|
|
105
|
+
["colgroup.char", "0:"],
|
|
106
|
+
["colgroup.charoff", "0:"],
|
|
90
107
|
["colgroup.span", "10:2015"],
|
|
108
|
+
["colgroup.valign", "0:"],
|
|
109
|
+
["colgroup.width", "0:"],
|
|
91
110
|
["data", "10:2017"],
|
|
92
111
|
["data.value", "10:2017"],
|
|
93
112
|
["datalist", "0:"],
|
|
@@ -203,6 +222,7 @@ const elements = new Map([
|
|
|
203
222
|
["iframe.width", "10:2015"],
|
|
204
223
|
["img", "10:2015"],
|
|
205
224
|
["img.alt", "10:2015"],
|
|
225
|
+
["img.aspect_ratio_computed_from_attributes", "10:2021"],
|
|
206
226
|
["img.attributionsrc", "0:"],
|
|
207
227
|
["img.crossorigin", "10:2015"],
|
|
208
228
|
["img.decoding", "10:2020"],
|
|
@@ -244,12 +264,38 @@ const elements = new Map([
|
|
|
244
264
|
["input.pattern", "10:2015"],
|
|
245
265
|
["input.placeholder", "10:2015"],
|
|
246
266
|
["input.popovertarget", "5:2024"],
|
|
267
|
+
["input.popovertarget.implicit_anchor_reference", "0:"],
|
|
247
268
|
["input.popovertargetaction", "5:2024"],
|
|
248
269
|
["input.readonly", "10:2015"],
|
|
249
270
|
["input.required", "10:2015"],
|
|
250
271
|
["input.size", "10:2015"],
|
|
251
272
|
["input.src", "10:2015"],
|
|
252
273
|
["input.step", "10:2015"],
|
|
274
|
+
["input.type_button", "10:2015"],
|
|
275
|
+
["input.type_checkbox", "10:2015"],
|
|
276
|
+
["input.type_color", "0:"],
|
|
277
|
+
["input.type_date", "10:2021"],
|
|
278
|
+
["input.type_datetime-local", "10:2021"],
|
|
279
|
+
["input.type_email", "10:2015"],
|
|
280
|
+
["input.type_file", "10:2015"],
|
|
281
|
+
["input.type_hidden", "10:2015"],
|
|
282
|
+
["input.type_image", "10:2015"],
|
|
283
|
+
["input.type_month", "0:"],
|
|
284
|
+
["input.type_number", "10:2015"],
|
|
285
|
+
["input.type_password", "10:2015"],
|
|
286
|
+
["input.type_password.insecure_login_handling", "0:"],
|
|
287
|
+
["input.type_radio", "10:2015"],
|
|
288
|
+
["input.type_range", "10:2017"],
|
|
289
|
+
["input.type_range.tick_marks", "5:2023"],
|
|
290
|
+
["input.type_range.vertical_orientation", "5:2024"],
|
|
291
|
+
["input.type_reset", "10:2015"],
|
|
292
|
+
["input.type_search", "10:2015"],
|
|
293
|
+
["input.type_submit", "10:2015"],
|
|
294
|
+
["input.type_tel", "10:2015"],
|
|
295
|
+
["input.type_text", "10:2015"],
|
|
296
|
+
["input.type_time", "10:2021"],
|
|
297
|
+
["input.type_url", "10:2015"],
|
|
298
|
+
["input.type_week", "0:"],
|
|
253
299
|
["ins", "10:2015"],
|
|
254
300
|
["ins.cite", "10:2015"],
|
|
255
301
|
["ins.datetime", "10:2015"],
|
|
@@ -276,6 +322,8 @@ const elements = new Map([
|
|
|
276
322
|
["link.referrerpolicy.origin-when-cross-origin", "0:"],
|
|
277
323
|
["link.referrerpolicy.unsafe-url", "0:"],
|
|
278
324
|
["link.rel", "10:2015"],
|
|
325
|
+
["link.rel.alternate_stylesheet", "0:"],
|
|
326
|
+
["link.rel.compression-dictionary", "0:"],
|
|
279
327
|
["link.rel.dns-prefetch", "5:2024"],
|
|
280
328
|
["link.rel.expect", "0:"],
|
|
281
329
|
["link.rel.manifest", "0:"],
|
|
@@ -372,13 +420,18 @@ const elements = new Map([
|
|
|
372
420
|
["script.type.module", "10:2018"],
|
|
373
421
|
["script.type.speculationrules", "0:"],
|
|
374
422
|
["script.type.speculationrules.eagerness", "0:"],
|
|
423
|
+
["script.type.speculationrules.expects_no_vary_search", "0:"],
|
|
375
424
|
["script.type.speculationrules.prefetch", "0:"],
|
|
376
425
|
["script.type.speculationrules.prerender", "0:"],
|
|
426
|
+
["script.type.speculationrules.referrer_policy", "0:"],
|
|
427
|
+
["script.type.speculationrules.relative_to", "0:"],
|
|
377
428
|
["script.type.speculationrules.requires", "0:"],
|
|
378
429
|
[
|
|
379
430
|
"script.type.speculationrules.requires.anonymous-client-ip-when-cross-origin",
|
|
380
431
|
"0:",
|
|
381
432
|
],
|
|
433
|
+
["script.type.speculationrules.source_optional", "0:"],
|
|
434
|
+
["script.type.speculationrules.tag", "0:"],
|
|
382
435
|
["script.type.speculationrules.urls", "0:"],
|
|
383
436
|
["script.type.speculationrules.where", "0:"],
|
|
384
437
|
["search", "5:2023"],
|
|
@@ -386,6 +439,7 @@ const elements = new Map([
|
|
|
386
439
|
["select", "10:2015"],
|
|
387
440
|
["select.disabled", "10:2015"],
|
|
388
441
|
["select.form", "10:2015"],
|
|
442
|
+
["select.hr_in_select", "0:"],
|
|
389
443
|
["select.multiple", "10:2015"],
|
|
390
444
|
["select.name", "10:2015"],
|
|
391
445
|
["select.required", "10:2015"],
|
|
@@ -409,13 +463,38 @@ const elements = new Map([
|
|
|
409
463
|
["style.media", "10:2015"],
|
|
410
464
|
["sub", "10:2015"],
|
|
411
465
|
["summary", "10:2020"],
|
|
466
|
+
["summary.display_list_item", "0:"],
|
|
412
467
|
["sup", "10:2015"],
|
|
413
468
|
["table", "10:2015"],
|
|
469
|
+
["table.align", "0:"],
|
|
470
|
+
["table.bgcolor", "0:"],
|
|
471
|
+
["table.border", "0:"],
|
|
472
|
+
["table.cellpadding", "0:"],
|
|
473
|
+
["table.cellspacing", "0:"],
|
|
474
|
+
["table.frame", "0:"],
|
|
475
|
+
["table.rules", "0:"],
|
|
476
|
+
["table.summary", "0:"],
|
|
477
|
+
["table.width", "0:"],
|
|
414
478
|
["tbody", "10:2015"],
|
|
479
|
+
["tbody.align", "0:"],
|
|
480
|
+
["tbody.bgcolor", "0:"],
|
|
481
|
+
["tbody.char", "0:"],
|
|
482
|
+
["tbody.charoff", "0:"],
|
|
483
|
+
["tbody.valign", "0:"],
|
|
415
484
|
["td", "10:2015"],
|
|
485
|
+
["td.abbr", "0:"],
|
|
486
|
+
["td.align", "0:"],
|
|
487
|
+
["td.axis", "0:"],
|
|
488
|
+
["td.bgcolor", "0:"],
|
|
489
|
+
["td.char", "0:"],
|
|
490
|
+
["td.charoff", "0:"],
|
|
416
491
|
["td.colspan", "10:2015"],
|
|
417
492
|
["td.headers", "10:2015"],
|
|
418
493
|
["td.rowspan", "10:2015"],
|
|
494
|
+
["td.rowspan.rowspan_zero", "0:"],
|
|
495
|
+
["td.scope", "0:"],
|
|
496
|
+
["td.valign", "0:"],
|
|
497
|
+
["td.width", "0:"],
|
|
419
498
|
["template", "10:2015"],
|
|
420
499
|
["template.shadowrootclonable", "0:"],
|
|
421
500
|
["template.shadowrootdelegatesfocus", "0:"],
|
|
@@ -431,6 +510,7 @@ const elements = new Map([
|
|
|
431
510
|
["textarea.minlength", "10:2018"],
|
|
432
511
|
["textarea.name", "10:2015"],
|
|
433
512
|
["textarea.placeholder", "10:2015"],
|
|
513
|
+
["textarea.placeholder.line_breaks", "10:2022"],
|
|
434
514
|
["textarea.readonly", "10:2015"],
|
|
435
515
|
["textarea.required", "10:2015"],
|
|
436
516
|
["textarea.rows", "10:2015"],
|
|
@@ -438,17 +518,40 @@ const elements = new Map([
|
|
|
438
518
|
["textarea.wrap", "10:2015"],
|
|
439
519
|
["textarea.wrap.hard", "0:"],
|
|
440
520
|
["tfoot", "10:2015"],
|
|
521
|
+
["tfoot.align", "0:"],
|
|
522
|
+
["tfoot.bgcolor", "0:"],
|
|
523
|
+
["tfoot.char", "0:"],
|
|
524
|
+
["tfoot.charoff", "0:"],
|
|
525
|
+
["tfoot.valign", "0:"],
|
|
441
526
|
["th", "10:2015"],
|
|
442
527
|
["th.abbr", "10:2015"],
|
|
528
|
+
["th.align", "0:"],
|
|
529
|
+
["th.axis", "0:"],
|
|
530
|
+
["th.bgcolor", "0:"],
|
|
531
|
+
["th.char", "0:"],
|
|
532
|
+
["th.charoff", "0:"],
|
|
443
533
|
["th.colspan", "10:2015"],
|
|
444
534
|
["th.headers", "10:2015"],
|
|
445
535
|
["th.rowspan", "10:2015"],
|
|
536
|
+
["th.rowspan.rowspan_zero", "0:"],
|
|
446
537
|
["th.scope", "10:2015"],
|
|
538
|
+
["th.valign", "0:"],
|
|
539
|
+
["th.width", "0:"],
|
|
447
540
|
["thead", "10:2015"],
|
|
541
|
+
["thead.align", "0:"],
|
|
542
|
+
["thead.bgcolor", "0:"],
|
|
543
|
+
["thead.char", "0:"],
|
|
544
|
+
["thead.charoff", "0:"],
|
|
545
|
+
["thead.valign", "0:"],
|
|
448
546
|
["time", "10:2017"],
|
|
449
547
|
["time.datetime", "10:2017"],
|
|
450
548
|
["title", "10:2015"],
|
|
451
549
|
["tr", "10:2015"],
|
|
550
|
+
["tr.align", "0:"],
|
|
551
|
+
["tr.bgcolor", "0:"],
|
|
552
|
+
["tr.char", "0:"],
|
|
553
|
+
["tr.charoff", "0:"],
|
|
554
|
+
["tr.valign", "0:"],
|
|
452
555
|
["track", "10:2015"],
|
|
453
556
|
["track.default", "10:2015"],
|
|
454
557
|
["track.kind", "10:2015"],
|
|
@@ -459,6 +562,7 @@ const elements = new Map([
|
|
|
459
562
|
["ul", "10:2015"],
|
|
460
563
|
["var", "10:2015"],
|
|
461
564
|
["video", "10:2015"],
|
|
565
|
+
["video.aspect_ratio_computed_from_attributes", "10:2020"],
|
|
462
566
|
["video.autoplay", "10:2016"],
|
|
463
567
|
["video.controls", "10:2015"],
|
|
464
568
|
["video.controlslist", "0:"],
|
|
@@ -484,10 +588,12 @@ const globalAttributes = new Map([
|
|
|
484
588
|
["enterkeyhint", "10:2021"],
|
|
485
589
|
["exportparts", "10:2020"],
|
|
486
590
|
["inert", "5:2023"],
|
|
591
|
+
["inert.ignores_find_in_page", "0:"],
|
|
487
592
|
["inputmode", "10:2021"],
|
|
488
593
|
["is", "0:"],
|
|
489
594
|
["lang", "10:2015"],
|
|
490
595
|
["nonce", "10:2022"],
|
|
596
|
+
["nonce.nonce_hiding", "10:2022"],
|
|
491
597
|
["part", "10:2020"],
|
|
492
598
|
["popover", "5:2024"],
|
|
493
599
|
["popover.hint", "0:"],
|
|
@@ -496,6 +602,7 @@ const globalAttributes = new Map([
|
|
|
496
602
|
["style", "10:2015"],
|
|
497
603
|
["tabindex", "10:2015"],
|
|
498
604
|
["title", "10:2015"],
|
|
605
|
+
["title.multi-line_titles", "10:2018"],
|
|
499
606
|
["translate", "5:2023"],
|
|
500
607
|
["virtualkeyboardpolicy", "0:"],
|
|
501
608
|
["writingsuggestions", "0:"],
|
package/lib/types/rule.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface RuleFixer {
|
|
|
71
71
|
replaceTextRange(range: eslint.AST.Range, text: string): RuleFix;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
type ReportFixFunction = (
|
|
74
|
+
export type ReportFixFunction = (
|
|
75
75
|
fixer: RuleFixer
|
|
76
76
|
) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null;
|
|
77
77
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-eslint/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0-alpha.0",
|
|
4
4
|
"description": "ESLint plugin for html",
|
|
5
5
|
"author": "yeonjuan",
|
|
6
6
|
"homepage": "https://github.com/yeonjuan/html-eslint#readme",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "jest --coverage",
|
|
23
|
+
"test:legacy": "TEST_ESLINT_LEGACY_CONFIG=true && jest",
|
|
23
24
|
"ts": "tsc --noEmit",
|
|
24
25
|
"lint": "eslint .",
|
|
25
26
|
"build": "rimraf types && tsc --project tsconfig.build.json"
|
|
@@ -37,18 +38,20 @@
|
|
|
37
38
|
"accessibility"
|
|
38
39
|
],
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@html-eslint/template-
|
|
41
|
+
"@eslint/plugin-kit": "0.2.8",
|
|
42
|
+
"@html-eslint/template-parser": "^0.40.0-alpha.0",
|
|
43
|
+
"@html-eslint/template-syntax-parser": "^0.40.0-alpha.0"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@html-eslint/
|
|
46
|
+
"@eslint/core": "0.13.0",
|
|
47
|
+
"@html-eslint/parser": "^0.40.0-alpha.0",
|
|
48
|
+
"@html-eslint/types": "^0.40.0-alpha.0",
|
|
46
49
|
"@types/eslint": "^9.6.1",
|
|
47
50
|
"@types/estree": "^0.0.47",
|
|
48
|
-
"es-html-parser": "0.
|
|
51
|
+
"es-html-parser": "0.2.0",
|
|
49
52
|
"eslint": "^9.21.0",
|
|
50
53
|
"espree": "^10.3.0",
|
|
51
54
|
"typescript": "^5.7.2"
|
|
52
55
|
},
|
|
53
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "f62545e1268c688f79026b078fcdc013aa4a462d"
|
|
54
57
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -4,9 +4,13 @@ export = plugin;
|
|
|
4
4
|
* @typedef {import("./configs/recommended")} RecommendedConfig
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* @type {{rules: AllRules, configs: {recommended: RecommendedConfig, "flat/recommended": import("eslint").Linter.FlatConfig }}}
|
|
7
|
+
* @type {{meta: { name: string, version: string }, rules: AllRules, configs: {recommended: RecommendedConfig, "flat/recommended": import("eslint").Linter.FlatConfig }}}
|
|
8
8
|
*/
|
|
9
9
|
declare const plugin: {
|
|
10
|
+
meta: {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
10
14
|
rules: AllRules;
|
|
11
15
|
configs: {
|
|
12
16
|
recommended: RecommendedConfig;
|
|
@@ -65,6 +69,7 @@ type AllRules = {
|
|
|
65
69
|
"max-element-depth": import("./types").RuleModule<[import("./rules/max-element-depth").Option]>;
|
|
66
70
|
"require-explicit-size": import("./types").RuleModule<[import("./rules/require-explicit-size").Option]>;
|
|
67
71
|
"use-baseline": import("./types").RuleModule<[import("./rules/use-baseline").Option]>;
|
|
72
|
+
"no-duplicate-class": import("./types").RuleModule<[]>;
|
|
68
73
|
};
|
|
69
74
|
type RecommendedConfig = {
|
|
70
75
|
rules: {
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.js"],"names":[],"mappings":";AAKA;;;GAGG;AAEH;;GAEG;AACH,sBAFU;IAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE;QAAC,WAAW,EAAE,iBAAiB,CAAC;QAAC,kBAAkB,EAAE,OAAO,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,CAAA;CAAC,CAetK"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type File = import("@eslint/core").File;
|
|
2
|
+
export type LanguageOptions = import("@html-eslint/parser").ParserOptions;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('@eslint/core').File} File
|
|
5
|
+
* @typedef {import('@html-eslint/parser').ParserOptions} LanguageOptions
|
|
6
|
+
*/
|
|
7
|
+
export class HTMLLanguage {
|
|
8
|
+
/**
|
|
9
|
+
* @property
|
|
10
|
+
* @type {"text"}
|
|
11
|
+
*/
|
|
12
|
+
fileType: "text";
|
|
13
|
+
/**
|
|
14
|
+
* @property
|
|
15
|
+
* @type {0|1}
|
|
16
|
+
*/
|
|
17
|
+
lineStart: 0 | 1;
|
|
18
|
+
/**
|
|
19
|
+
* @property
|
|
20
|
+
* @type {0|1}
|
|
21
|
+
*/
|
|
22
|
+
columnStart: 0 | 1;
|
|
23
|
+
/**
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
nodeTypeKey: string;
|
|
27
|
+
/**
|
|
28
|
+
* The visitor keys for the CSSTree AST.
|
|
29
|
+
* @type {Record<string, string[]>}
|
|
30
|
+
*/
|
|
31
|
+
visitorKeys: Record<string, string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* @param {LanguageOptions} languageOptions
|
|
34
|
+
*/
|
|
35
|
+
validateLanguageOptions(languageOptions: LanguageOptions): void;
|
|
36
|
+
/**
|
|
37
|
+
* @param {File} file
|
|
38
|
+
* @param {Object} [context]
|
|
39
|
+
* @param {LanguageOptions} context.languageOptions
|
|
40
|
+
*/
|
|
41
|
+
parse(file: File, context?: {
|
|
42
|
+
languageOptions: LanguageOptions;
|
|
43
|
+
}): {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
ast: any;
|
|
46
|
+
comments: any;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @param {File} file
|
|
50
|
+
* @param {any} parseResult
|
|
51
|
+
*/
|
|
52
|
+
createSourceCode(file: File, parseResult: any): HTMLSourceCode;
|
|
53
|
+
}
|
|
54
|
+
import { HTMLSourceCode } from "./html-source-code";
|
|
55
|
+
//# sourceMappingURL=html-language.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-language.d.ts","sourceRoot":"","sources":["../../lib/languages/html-language.js"],"names":[],"mappings":"mBAIa,OAAO,cAAc,EAAE,IAAI;8BAC3B,OAAO,qBAAqB,EAAE,aAAa;AAFxD;;;GAGG;AACH;IAEI;;;OAGG;IACH,UAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,WAFU,CAAC,GAAC,CAAC,CAEK;IAElB;;;OAGG;IACH,aAFU,CAAC,GAAC,CAAC,CAEO;IAEpB;;OAEG;IACH,aAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,aAFU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAEJ;IAGhC;;OAEG;IACH,yCAFW,eAAe,QAqBzB;IAED;;;;OAIG;IACH,YAJW,IAAI,YAEZ;QAAiC,eAAe,EAAxC,eAAe;KACzB;;;;MAUA;IAED;;;OAGG;IACH,uBAHW,IAAI,eACJ,GAAG,kBAQb;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type Program = import("eslint").AST.Program;
|
|
2
|
+
export type SourceLocation = import("@eslint/plugin-kit").SourceLocation;
|
|
3
|
+
export type DirectiveType = import("@eslint/plugin-kit").DirectiveType;
|
|
4
|
+
export type TraversalStep = import("@eslint/core").TraversalStep;
|
|
5
|
+
export type CommentContent = import("@html-eslint/types").CommentContent;
|
|
6
|
+
export type AnyHTMLNode = import("@html-eslint/types").AnyHTMLNode;
|
|
7
|
+
export type BaseNode = import("../types").BaseNode;
|
|
8
|
+
export class HTMLSourceCode extends TextSourceCodeBase {
|
|
9
|
+
/**
|
|
10
|
+
* @param {{ast: Program, text: string, comments: CommentContent[]}} config
|
|
11
|
+
*/
|
|
12
|
+
constructor({ ast, text, comments }: {
|
|
13
|
+
ast: Program;
|
|
14
|
+
text: string;
|
|
15
|
+
comments: CommentContent[];
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* @property
|
|
19
|
+
*/
|
|
20
|
+
eslintSourceCode: SourceCode;
|
|
21
|
+
/**
|
|
22
|
+
* @property
|
|
23
|
+
*/
|
|
24
|
+
ast: import("eslint").AST.Program;
|
|
25
|
+
/**
|
|
26
|
+
* @property
|
|
27
|
+
*/
|
|
28
|
+
comments: import("@html-eslint/types").CommentContent[];
|
|
29
|
+
parentsMap: Map<any, any>;
|
|
30
|
+
/**
|
|
31
|
+
* @param {BaseNode} node
|
|
32
|
+
* @returns {[number, number]}
|
|
33
|
+
*/
|
|
34
|
+
getRange(node: BaseNode): [number, number];
|
|
35
|
+
/**
|
|
36
|
+
* @param {BaseNode} node
|
|
37
|
+
* @returns {import("@eslint/plugin-kit").SourceLocation}
|
|
38
|
+
*/
|
|
39
|
+
getLoc(node: BaseNode): import("@eslint/plugin-kit").SourceLocation;
|
|
40
|
+
getLines(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* @param {import("@eslint/core").Position} loc
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
getIndexFromLoc(loc: import("@eslint/core").Position): number;
|
|
46
|
+
/**
|
|
47
|
+
* @param {number} index
|
|
48
|
+
* @returns {import("@eslint/core").Position}
|
|
49
|
+
*/
|
|
50
|
+
getLocFromIndex(index: number): import("@eslint/core").Position;
|
|
51
|
+
getInlineConfigNodes(): import("@html-eslint/types").CommentContent[];
|
|
52
|
+
getDisableDirectives(): {
|
|
53
|
+
problems: {
|
|
54
|
+
ruleId: null | string;
|
|
55
|
+
message: string;
|
|
56
|
+
loc: SourceLocation;
|
|
57
|
+
}[];
|
|
58
|
+
directives: Directive[];
|
|
59
|
+
};
|
|
60
|
+
traverse(): import("@eslint/core").TraversalStep[];
|
|
61
|
+
/**
|
|
62
|
+
* @param {AnyHTMLNode} node
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
getParent(node: AnyHTMLNode): any;
|
|
66
|
+
}
|
|
67
|
+
import { TextSourceCodeBase } from "@eslint/plugin-kit";
|
|
68
|
+
import { SourceCode } from "eslint";
|
|
69
|
+
import { Directive } from "@eslint/plugin-kit";
|
|
70
|
+
//# sourceMappingURL=html-source-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-source-code.d.ts","sourceRoot":"","sources":["../../lib/languages/html-source-code.js"],"names":[],"mappings":"sBACc,OAAO,QAAQ,EAAE,GAAG,CAAC,OAAO;6BAC5B,OAAO,oBAAoB,EAAE,cAAc;4BAC3C,OAAO,oBAAoB,EAAE,aAAa;4BAC1C,OAAO,cAAc,EAAE,aAAa;6BACpC,OAAO,oBAAoB,EAAE,cAAc;0BAC3C,OAAO,oBAAoB,EAAE,WAAW;uBACxC,OAAO,UAAU,EAAE,QAAQ;AAgBzC;IACE;;OAEG;IACH,qCAFW;QAAC,GAAG,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,cAAc,EAAE,CAAA;KAAC,EAiBlE;IAbC;;OAEG;IACH,6BAAiD;IACjD;;OAEG;IACH,kCAAc;IACd;;OAEG;IACH,wDAAwB;IACxB,0BAA2B;IAG7B;;;OAGG;IACH,eAHW,QAAQ,GACN,CAAC,MAAM,EAAE,MAAM,CAAC,CAI5B;IAED;;;OAGG;IACH,aAHW,QAAQ,GACN,OAAO,oBAAoB,EAAE,cAAc,CAIvD;IAED,qBAEC;IAED;;;OAGG;IACH,qBAHW,OAAO,cAAc,EAAE,QAAQ,UAKzC;IAED;;;OAGG;IACH,uBAHW,MAAM,GACJ,OAAO,cAAc,EAAE,QAAQ,CAI3C;IAED,sEAEC;IAED;;oBAEqB,IAAI,GAAG,MAAM;qBAAW,MAAM;iBAAO,cAAc;;;MA8CvE;IAED,mDAgDC;IAED;;;OAGG;IACH,gBAHW,WAAW,OAKrB;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type Program = import("eslint").AST.Program;
|
|
2
|
+
export type AnyHTMLNode = import("@html-eslint/types").AnyHTMLNode;
|
|
3
|
+
export class HTMLTraversalStep extends VisitNodeStep {
|
|
4
|
+
/**
|
|
5
|
+
* @param {Object} options
|
|
6
|
+
* @param {AnyHTMLNode | Program} options.target
|
|
7
|
+
* @param {1|2} options.phase
|
|
8
|
+
* @param {Array<any>} options.args
|
|
9
|
+
*/
|
|
10
|
+
constructor({ target, phase, args }: {
|
|
11
|
+
target: AnyHTMLNode | Program;
|
|
12
|
+
phase: 1 | 2;
|
|
13
|
+
args: Array<any>;
|
|
14
|
+
});
|
|
15
|
+
target: import("eslint").AST.Program | import("@html-eslint/types").AnyHTMLNode;
|
|
16
|
+
}
|
|
17
|
+
export namespace STEP_PHASE {
|
|
18
|
+
let ENTER: 1;
|
|
19
|
+
let EXIT: 2;
|
|
20
|
+
}
|
|
21
|
+
import { VisitNodeStep } from "@eslint/plugin-kit";
|
|
22
|
+
//# sourceMappingURL=html-traversal-step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-traversal-step.d.ts","sourceRoot":"","sources":["../../lib/languages/html-traversal-step.js"],"names":[],"mappings":"sBACc,OAAO,QAAQ,EAAE,GAAG,CAAC,OAAO;0BAC7B,OAAO,oBAAoB,EAAE,WAAW;AAerD;IACE;;;;;OAKG;IACH,qCAJG;QAAuC,MAAM,EAArC,WAAW,GAAG,OAAO;QACR,KAAK,EAAlB,CAAC,GAAC,CAAC;QACiB,IAAI,EAAxB,KAAK,CAAC,GAAG,CAAC;KACpB,EAIA;IADC,gFAAoB;CAEvB;;eApBW,CAAC;cAID,CAAC"}
|
package/types/rules/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare const _exports: {
|
|
|
47
47
|
"max-element-depth": import("../types").RuleModule<[maxElementDepth.Option]>;
|
|
48
48
|
"require-explicit-size": import("../types").RuleModule<[requireExplicitSize.Option]>;
|
|
49
49
|
"use-baseline": import("../types").RuleModule<[useBaseLine.Option]>;
|
|
50
|
+
"no-duplicate-class": import("../types").RuleModule<[]>;
|
|
50
51
|
};
|
|
51
52
|
export = _exports;
|
|
52
53
|
import requireImgAlt = require("./require-img-alt");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare namespace _exports {
|
|
2
|
+
export { Tag, StyleTag, ScriptTag, AttributeValue, RuleModule, ClassInfo };
|
|
3
|
+
}
|
|
4
|
+
declare const _exports: RuleModule;
|
|
5
|
+
export = _exports;
|
|
6
|
+
type Tag = import("@html-eslint/types").Tag;
|
|
7
|
+
type StyleTag = import("@html-eslint/types").StyleTag;
|
|
8
|
+
type ScriptTag = import("@html-eslint/types").ScriptTag;
|
|
9
|
+
type AttributeValue = import("@html-eslint/types").AttributeValue;
|
|
10
|
+
type RuleModule = import("../types").RuleModule<[]>;
|
|
11
|
+
type ClassInfo = {
|
|
12
|
+
name: string;
|
|
13
|
+
loc: import("@html-eslint/types").AnyNode["loc"];
|
|
14
|
+
range: import("@html-eslint/types").AnyNode["range"];
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=no-duplicate-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-duplicate-class.d.ts","sourceRoot":"","sources":["../../lib/rules/no-duplicate-class.js"],"names":[],"mappings":";;;wBAqBU,UAAU;;WApBN,OAAO,oBAAoB,EAAE,GAAG;gBAChC,OAAO,oBAAoB,EAAE,QAAQ;iBACrC,OAAO,oBAAoB,EAAE,SAAS;sBACtC,OAAO,oBAAoB,EAAE,cAAc;kBAC3C,OAAO,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;;UAEjC,MAAM;SACN,OAAO,oBAAoB,EAAE,OAAO,CAAC,KAAK,CAAC;WAC3C,OAAO,oBAAoB,EAAE,OAAO,CAAC,OAAO,CAAC"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
declare namespace _exports {
|
|
2
|
-
export { Tag, ScriptTag, StyleTag, Option, RuleModule };
|
|
2
|
+
export { Tag, ScriptTag, StyleTag, Attribute, Option, RuleModule, ReportFixFunction };
|
|
3
3
|
}
|
|
4
4
|
declare const _exports: RuleModule;
|
|
5
5
|
export = _exports;
|
|
6
6
|
type Tag = import("@html-eslint/types").Tag;
|
|
7
7
|
type ScriptTag = import("@html-eslint/types").ScriptTag;
|
|
8
8
|
type StyleTag = import("@html-eslint/types").StyleTag;
|
|
9
|
+
type Attribute = import("@html-eslint/types").Attribute;
|
|
9
10
|
type Option = {
|
|
10
11
|
tag: string;
|
|
11
12
|
attr: string;
|
|
12
13
|
value?: string | undefined;
|
|
13
14
|
};
|
|
14
15
|
type RuleModule = import("../types").RuleModule<Option[]>;
|
|
16
|
+
type ReportFixFunction = import("../types").ReportFixFunction;
|
|
15
17
|
//# sourceMappingURL=require-attrs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/require-attrs.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"require-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/require-attrs.js"],"names":[],"mappings":";;;wBA0BU,UAAU;;WAzBN,OAAO,oBAAoB,EAAE,GAAG;iBAChC,OAAO,oBAAoB,EAAE,SAAS;gBACtC,OAAO,oBAAoB,EAAE,QAAQ;iBACrC,OAAO,oBAAoB,EAAE,SAAS;;SAGtC,MAAM;UACN,MAAM;;;kBAGN,OAAO,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;yBACvC,OAAO,UAAU,EAAE,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/baseline.js"],"names":[],"mappings":"AAOA,
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/baseline.js"],"names":[],"mappings":"AAOA,2CA4jBG;AACH,mDA4BG;AAhmBH;;GAEG;AACH,4BAAsB,EAAE,CAAC;AACzB,2BAAqB,CAAC,CAAC;AACvB,6BAAuB,CAAC,CAAC"}
|
package/types/types/rule.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface RuleFixer {
|
|
|
56
56
|
replaceText(nodeOrToken: AnyNodeAndLine, text: string): RuleFix;
|
|
57
57
|
replaceTextRange(range: eslint.AST.Range, text: string): RuleFix;
|
|
58
58
|
}
|
|
59
|
-
type ReportFixFunction = (fixer: RuleFixer) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null;
|
|
59
|
+
export type ReportFixFunction = (fixer: RuleFixer) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null;
|
|
60
60
|
interface ReportDescriptorOptionsBase {
|
|
61
61
|
data?: {
|
|
62
62
|
[key: string]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../lib/types/rule.ts"],"names":[],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