@utoo/lint 0.4.7 → 0.4.8
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/estree-parser.cjs +0 -29
- package/package.json +7 -7
package/lib/estree-parser.cjs
CHANGED
|
@@ -178,32 +178,6 @@ function forEachChild(node, callback) {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
const JSX_ENTITIES = {
|
|
182
|
-
amp: "&", lt: "<", gt: ">", quot: "\"", apos: "'", nbsp: "\u00a0", copy: "\u00a9", reg: "\u00ae",
|
|
183
|
-
trade: "\u2122", hellip: "\u2026", mdash: "\u2014", ndash: "\u2013", laquo: "\u00ab", raquo: "\u00bb",
|
|
184
|
-
lsquo: "\u2018", rsquo: "\u2019", ldquo: "\u201c", rdquo: "\u201d", times: "\u00d7", divide: "\u00f7",
|
|
185
|
-
euro: "\u20ac", pound: "\u00a3", yen: "\u00a5", cent: "\u00a2", deg: "\u00b0", plusmn: "\u00b1",
|
|
186
|
-
middot: "\u00b7", bull: "\u2022", larr: "\u2190", rarr: "\u2192", uarr: "\u2191", darr: "\u2193",
|
|
187
|
-
hearts: "\u2665", sect: "\u00a7", para: "\u00b6", iexcl: "\u00a1", iquest: "\u00bf", frac12: "\u00bd",
|
|
188
|
-
frac14: "\u00bc", frac34: "\u00be", micro: "\u00b5", ensp: "\u2002", emsp: "\u2003", thinsp: "\u2009",
|
|
189
|
-
zwnj: "\u200c", zwj: "\u200d", shy: "\u00ad", infin: "\u221e", ne: "\u2260", le: "\u2264", ge: "\u2265"
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
// ESLint's parsers expose entity-decoded JSX text and attribute values while
|
|
193
|
-
// keeping `raw` intact; mirror that for the common entities.
|
|
194
|
-
function decodeJsxEntities(value) {
|
|
195
|
-
if (typeof value !== "string" || !value.includes("&")) {
|
|
196
|
-
return value;
|
|
197
|
-
}
|
|
198
|
-
return value.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z][a-zA-Z0-9]*);/gu, (match, entity) => {
|
|
199
|
-
if (entity[0] === "#") {
|
|
200
|
-
const codePoint = entity[1] === "x" || entity[1] === "X" ? Number.parseInt(entity.slice(2), 16) : Number.parseInt(entity.slice(1), 10);
|
|
201
|
-
return Number.isFinite(codePoint) && codePoint <= 0x10ffff ? String.fromCodePoint(codePoint) : match;
|
|
202
|
-
}
|
|
203
|
-
return Object.hasOwn(JSX_ENTITIES, entity) ? JSX_ENTITIES[entity] : match;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
181
|
function setParent(node, parent) {
|
|
208
182
|
Object.defineProperty(node, "parent", {
|
|
209
183
|
value: parent,
|
|
@@ -230,9 +204,6 @@ function normalizeTree(program, text, locate) {
|
|
|
230
204
|
}
|
|
231
205
|
decorateNode(node, locate);
|
|
232
206
|
setParent(node, parent);
|
|
233
|
-
if (node.type === "JSXText" || (node.type === "Literal" && parent?.type === "JSXAttribute")) {
|
|
234
|
-
node.value = decodeJsxEntities(node.value);
|
|
235
|
-
}
|
|
236
207
|
forEachChild(node, (child) => stack.push([child, node]));
|
|
237
208
|
}
|
|
238
209
|
program.start = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/lint",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "High-performance JavaScript and TypeScript linter powered by Yuku",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
"use-at-your-own-risk.js"
|
|
75
75
|
],
|
|
76
76
|
"optionalDependencies": {
|
|
77
|
-
"@utoo/lint-darwin-arm64": "0.4.
|
|
78
|
-
"@utoo/lint-darwin-x64": "0.4.
|
|
79
|
-
"@utoo/lint-linux-arm64": "0.4.
|
|
80
|
-
"@utoo/lint-linux-x64": "0.4.
|
|
81
|
-
"@utoo/lint-win32-x64": "0.4.
|
|
77
|
+
"@utoo/lint-darwin-arm64": "0.4.8",
|
|
78
|
+
"@utoo/lint-darwin-x64": "0.4.8",
|
|
79
|
+
"@utoo/lint-linux-arm64": "0.4.8",
|
|
80
|
+
"@utoo/lint-linux-x64": "0.4.8",
|
|
81
|
+
"@utoo/lint-win32-x64": "0.4.8"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@eslint/eslintrc": "2.1.4",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"eslint-scope": "9.1.2",
|
|
89
89
|
"esquery": "1.7.0",
|
|
90
90
|
"jiti": "2.7.0",
|
|
91
|
-
"yuku-parser": "0.
|
|
91
|
+
"yuku-parser": "0.18.0"
|
|
92
92
|
},
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public",
|