svelte-eslint-parser
Advanced tools
Comparing version 0.40.0 to 0.41.0
export declare const name = "svelte-eslint-parser"; | ||
export declare const version = "0.40.0"; | ||
export declare const version = "0.41.0"; |
@@ -8,2 +8,2 @@ "use strict"; | ||
exports.name = "svelte-eslint-parser"; | ||
exports.version = "0.40.0"; | ||
exports.version = "0.41.0"; |
@@ -80,8 +80,4 @@ "use strict"; | ||
const value = node.value; | ||
const shorthand = value.find((v) => v.type === "AttributeShorthand") || | ||
// for Svelte v5 | ||
(value.length === 1 && | ||
value[0].type === "ExpressionTag" && | ||
ctx.code[node.start] === "{" && | ||
ctx.code[node.end - 1] === "}"); | ||
const shorthand = isAttributeShorthandForSvelteV4(value) || | ||
isAttributeShorthandForSvelteV5(value); | ||
if (shorthand) { | ||
@@ -111,8 +107,18 @@ const key = Object.assign(Object.assign({}, attribute.key), { type: "Identifier" }); | ||
ctx.addToken("HTMLIdentifier", keyRange); | ||
processAttributeValue(node.value, attribute, parent, ctx); | ||
processAttributeValue(value, attribute, parent, ctx); | ||
return attribute; | ||
function isAttributeShorthandForSvelteV4(value) { | ||
var _a; | ||
return Array.isArray(value) && ((_a = value[0]) === null || _a === void 0 ? void 0 : _a.type) === "AttributeShorthand"; | ||
} | ||
function isAttributeShorthandForSvelteV5(value) { | ||
return (!Array.isArray(value) && | ||
value.type === "ExpressionTag" && | ||
ctx.code[node.start] === "{" && | ||
ctx.code[node.end - 1] === "}"); | ||
} | ||
} | ||
/** Common process attribute value */ | ||
function processAttributeValue(nodeValue, attribute, attributeParent, ctx) { | ||
const nodes = nodeValue | ||
const nodes = (Array.isArray(nodeValue) ? nodeValue : [nodeValue]) | ||
.filter((v) => v.type !== "Text" || | ||
@@ -119,0 +125,0 @@ // ignore empty |
@@ -171,3 +171,3 @@ import type ESTree from "estree"; | ||
name: string; | ||
value: (Text | AttributeShorthand | MustacheTag)[] | true; | ||
value: (Text | MustacheTag)[] | [AttributeShorthand] | true; | ||
} | ||
@@ -174,0 +174,0 @@ export interface Spread extends BaseNode { |
{ | ||
"name": "svelte-eslint-parser", | ||
"version": "0.40.0", | ||
"version": "0.41.0", | ||
"description": "Svelte parser for ESLint", | ||
@@ -29,3 +29,3 @@ "repository": "git+https://github.com/sveltejs/svelte-eslint-parser.git", | ||
"peerDependencies": { | ||
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.181" | ||
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.191" | ||
}, | ||
@@ -56,7 +56,7 @@ "peerDependenciesMeta": { | ||
"@types/mocha": "^10.0.7", | ||
"@types/node": "^20.14.10", | ||
"@types/node": "^20.14.11", | ||
"@types/semver": "^7.5.8", | ||
"@typescript-eslint/eslint-plugin": "^7.16.0", | ||
"@typescript-eslint/parser": "~7.16.0", | ||
"@typescript-eslint/types": "~7.16.0", | ||
"@typescript-eslint/eslint-plugin": "^7.16.1", | ||
"@typescript-eslint/parser": "~7.16.1", | ||
"@typescript-eslint/types": "~7.16.1", | ||
"benchmark": "^2.1.4", | ||
@@ -74,5 +74,5 @@ "chai": "^4.4.1", | ||
"eslint-plugin-node-dependencies": "^0.12.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-prettier": "^5.2.1", | ||
"eslint-plugin-regexp": "^2.6.0", | ||
"eslint-plugin-svelte": "^2.41.0", | ||
"eslint-plugin-svelte": "^2.42.0", | ||
"eslint-plugin-yml": "^1.14.0", | ||
@@ -85,8 +85,8 @@ "estree-walker": "^3.0.3", | ||
"nyc": "^17.0.0", | ||
"prettier": "~3.3.2", | ||
"prettier": "~3.3.3", | ||
"prettier-plugin-pkg": "^0.18.1", | ||
"prettier-plugin-svelte": "^3.2.5", | ||
"rimraf": "^6.0.0", | ||
"semver": "^7.6.2", | ||
"svelte": "^5.0.0-next.181", | ||
"prettier-plugin-svelte": "^3.2.6", | ||
"rimraf": "^6.0.1", | ||
"semver": "^7.6.3", | ||
"svelte": "^5.0.0-next.191", | ||
"svelte2tsx": "^0.7.13", | ||
@@ -93,0 +93,0 @@ "typescript": "~5.5.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347984
8364