Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wet-carrots-open.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": patch
---

fix: Support `name_loc` property
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"prettier-plugin-svelte": "^3.4.0",
"rimraf": "^6.0.1",
"semver": "^7.7.2",
"svelte": "^5.41.0",
"svelte": "^5.45.4",
"svelte2tsx": "^0.7.45",
"tsx": "^4.20.5",
"typescript": "~5.9.2",
Expand Down
54 changes: 30 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/parser/compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export function getOptionsFromRoot(
return {
type: "SvelteOptions",
name: "svelte:options",
// @ts-expect-error - name_loc is required in Svelte since 5.45.3 but we can not set it.
name_loc: null,
attributes: root.options.attributes,
fragment: {
type: "Fragment",
Expand Down
3 changes: 3 additions & 0 deletions src/parser/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ function parseAttribute(state: State): Compiler.Attribute {
return {
type: "Attribute",
name: key,
name_loc: null,
value: true,
start,
end: keyEnd,
Expand All @@ -93,6 +94,7 @@ function parseAttribute(state: State): Compiler.Attribute {
return {
type: "Attribute",
name: key,
name_loc: null,
value: true,
start,
end: keyEnd,
Expand All @@ -103,6 +105,7 @@ function parseAttribute(state: State): Compiler.Attribute {
return {
type: "Attribute",
name: key,
name_loc: null,
value: [value],
start,
end: state.index,
Expand Down
20 changes: 20 additions & 0 deletions tests/src/parser/__snapshots__/html.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Object {
Object {
"end": 17,
"name": "lang",
"name_loc": null,
"start": 8,
"type": "Attribute",
"value": Array [
Expand All @@ -36,6 +37,7 @@ Object {
Object {
"end": 17,
"name": "lang",
"name_loc": null,
"start": 8,
"type": "Attribute",
"value": Array [
Expand All @@ -59,6 +61,7 @@ Object {
Object {
"end": 15,
"name": "lang",
"name_loc": null,
"start": 8,
"type": "Attribute",
"value": Array [
Expand All @@ -82,6 +85,7 @@ Object {
Object {
"end": 13,
"name": "global",
"name_loc": null,
"start": 7,
"type": "Attribute",
"value": true,
Expand All @@ -97,6 +101,7 @@ Object {
Object {
"end": 13,
"name": "global",
"name_loc": null,
"start": 7,
"type": "Attribute",
"value": true,
Expand All @@ -112,6 +117,7 @@ Object {
Object {
"end": 4,
"name": "attr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": true,
Expand All @@ -127,6 +133,7 @@ Object {
Object {
"end": 4,
"name": "attr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": true,
Expand All @@ -142,6 +149,7 @@ Object {
Object {
"end": 16,
"name": "attr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand All @@ -165,6 +173,7 @@ Object {
Object {
"end": 12,
"name": "attr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand All @@ -188,6 +197,7 @@ Object {
Object {
"end": 8,
"name": "empty",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand All @@ -211,6 +221,7 @@ Object {
Object {
"end": 8,
"name": "empty",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand All @@ -234,6 +245,7 @@ Object {
Object {
"end": 13,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -263,6 +275,7 @@ Object {
Object {
"end": 13,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -292,6 +305,7 @@ Object {
Object {
"end": 10,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -321,6 +335,7 @@ Object {
Object {
"end": 10,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -350,6 +365,7 @@ Object {
Object {
"end": 15,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -387,6 +403,7 @@ Object {
Object {
"end": 19,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -429,6 +446,7 @@ Object {
Object {
"end": 11,
"name": "expr",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down Expand Up @@ -458,6 +476,7 @@ Object {
Object {
"end": 9,
"name": "quote",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand All @@ -481,6 +500,7 @@ Object {
Object {
"end": 9,
"name": "quote",
"name_loc": null,
"start": 0,
"type": "Attribute",
"value": Array [
Expand Down
Loading