-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
<template lang="...">
to parse as raw text (#244)
* ignore template tag * Create real-dolphins-nail.md
- Loading branch information
Showing
14 changed files
with
2,223 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte-eslint-parser": minor | ||
--- | ||
|
||
feat: `<template lang="...">` to parse as raw text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { Locations } from "./common"; | ||
|
||
// internals | ||
export interface BaseNode extends Locations { | ||
type: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { BaseNode } from "./base"; | ||
|
||
export interface Position { | ||
/** >= 1 */ | ||
line: number; | ||
/** >= 0 */ | ||
column: number; | ||
} | ||
export type Range = [number, number]; | ||
export interface SourceLocation { | ||
start: Position; | ||
end: Position; | ||
} | ||
export interface Locations { | ||
loc: SourceLocation; | ||
range: Range; | ||
} | ||
|
||
export interface Token extends BaseNode { | ||
type: | ||
| "Boolean" | ||
| "Null" | ||
| "Identifier" | ||
| "Keyword" | ||
| "Punctuator" | ||
| "JSXIdentifier" | ||
| "JSXText" | ||
| "Numeric" | ||
| "String" | ||
| "RegularExpression" | ||
| "Template" | ||
// HTML | ||
| "HTMLText" | ||
| "HTMLIdentifier" | ||
| "MustacheKeyword" | ||
| "HTMLComment"; | ||
value: string; | ||
} | ||
|
||
export interface Comment extends BaseNode { | ||
type: "Line" | "Block"; | ||
value: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { SvelteHTMLNode } from "./html"; | ||
import type { SvelteScriptNode } from "./script"; | ||
|
||
export * from "./common"; | ||
export * from "./html"; | ||
export * from "./script"; | ||
|
||
export type SvelteNode = SvelteHTMLNode | SvelteScriptNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type ESTree from "estree"; | ||
import type { BaseNode } from "./base"; | ||
|
||
export type SvelteScriptNode = SvelteReactiveStatement; | ||
|
||
/** Node of `$` statement. */ | ||
export interface SvelteReactiveStatement extends BaseNode { | ||
type: "SvelteReactiveStatement"; | ||
label: ESTree.Identifier & { name: "$" }; | ||
body: ESTree.Statement; | ||
parent: ESTree.Node; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
let objs = [{a: 1, b: 2}, {a: 2, b: 3}] | ||
</script> | ||
|
||
<template lang="pug"> | ||
+each("objs as obj") | ||
p("{...obj}") {obj.a} | ||
</template> |
8 changes: 8 additions & 0 deletions
8
tests/fixtures/parser/ast/pug/each/each01-no-unused-vars-result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"ruleId": "no-unused-vars", | ||
"code": "objs", | ||
"line": 2, | ||
"column": 5 | ||
} | ||
] |
Oops, something went wrong.