Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency prettier-plugin-pkg to ^0.19.0 #701

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/fixtures
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-pkg", "prettier-plugin-svelte"]
Copy link
Collaborator

@JounQin JounQin Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ota-meshi prettier is not working previously. 🤣

}
2 changes: 1 addition & 1 deletion docs/AST.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See [ESTree] for the AST node of the script generated by `espree`.
[variabledeclarator]: https://github.com/estree/estree/blob/master/es5.md#variabledeclarator
[pattern]: https://github.com/estree/estree/blob/master/es5.md#patterns

See details: [../src/ast/*](../src/ast/)
See details: [../src/ast/\*](../src/ast/)

## Common

Expand Down
83 changes: 42 additions & 41 deletions docs/internal-mechanism.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,26 @@ For example, if you enter `*.svelte` template to listen for input events:

```svelte
<script lang="ts">
function inputHandler () {
// process
}
function inputHandler() {
// process
}
</script>
<input on:input={inputHandler}>

<input on:input={inputHandler} />
```

Parse the following virtual script code as a script:

```ts

function inputHandler () {
// process
}
;function $_render1(){

(inputHandler) as ((e:'input' extends keyof HTMLElementEventMap ? HTMLElementEventMap['input'] : CustomEvent<any>) => void );
function inputHandler() {
// process
}
function $_render1() {
inputHandler as (
e: "input" extends keyof HTMLElementEventMap
? HTMLElementEventMap["input"]
: CustomEvent<any>,
) => void;
}
```

Expand All @@ -78,25 +81,24 @@ For example, when using `{#each}` and `{@const}`:

```svelte
<script lang="ts">
const array = [1, 2, 3]
const array = [1, 2, 3];
</script>

{#each array as e}
{@const ee = e * 2}
{ee}
{@const ee = e * 2}
{ee}
{/each}
```

Parse the following virtual script code as a script:

```ts

const array = [1, 2, 3]
;function $_render1(){

Array.from(array).forEach((e) => {
const array = [1, 2, 3];
function $_render1() {
Array.from(array).forEach((e) => {
const ee = e * 2;
(ee);
});
ee;
});
}
```

Expand All @@ -121,8 +123,9 @@ TypeScript's type inference is pretty good, so parsing Svelte as-is gives some w

e.g.

<!-- prettier-ignore -->
```ts
export let foo: { bar: number } | null = null
export let foo: { bar: number } | null = null;

$: console.log(foo && foo.bar);
// ^ never type
Expand All @@ -139,13 +142,13 @@ For example:

```svelte
<script lang="ts">
export let foo: { bar: number } | null = null
export let foo: { bar: number } | null = null;

$: console.log(foo && foo.bar);
$: console.log(foo && foo.bar);

$: r = foo && foo.bar;
$: r = foo && foo.bar;

$: ({ bar: n } = foo || { bar: 42 });
$: ({ bar: n } = foo || { bar: 42 });
</script>

{foo && foo.bar}
Expand All @@ -154,26 +157,24 @@ $: ({ bar: n } = foo || { bar: 42 });
Parse the following virtual script code as a script:

```ts

export let foo: { bar: number } | null = null
export let foo: { bar: number } | null = null;

$: function $_reactiveStatementScopeFunction1(){
console.log(foo && foo.bar);
$: function $_reactiveStatementScopeFunction1() {
console.log(foo && foo.bar);
}

$: let r =$_reactiveVariableScopeFunction2();
function $_reactiveVariableScopeFunction2(){
let $_tmpVar3;
return ($_tmpVar3 = foo && foo.bar);
$: let r = $_reactiveVariableScopeFunction2();
function $_reactiveVariableScopeFunction2() {
let $_tmpVar3;
return ($_tmpVar3 = foo && foo.bar);
}

$: let { bar: n } =$_reactiveVariableScopeFunction4();
function $_reactiveVariableScopeFunction4(){
let $_tmpVar5;
return ($_tmpVar5 = foo || { bar: 42 });
$: let { bar: n } = $_reactiveVariableScopeFunction4();
function $_reactiveVariableScopeFunction4() {
let $_tmpVar5;
return ($_tmpVar5 = foo || { bar: 42 });
}
;function $_render6(){

(foo && foo.bar);
function $_render6() {
foo && foo.bar;
}
```
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "svelte-eslint-parser",
"version": "1.1.2",
"type": "module",
"description": "Svelte parser for ESLint",
"repository": "git+https://github.com/sveltejs/svelte-eslint-parser.git",
"homepage": "https://github.com/sveltejs/svelte-eslint-parser#readme",
Expand All @@ -14,7 +15,6 @@
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"type": "module",
"main": "lib/index.js",
"files": [
"lib"
Expand All @@ -40,10 +40,10 @@
"prerelease": "pnpm run clean && pnpm run build",
"preversion": "pnpm run lint && pnpm run test",
"release": "changeset publish",
"run-update-fixtures": "pnpm run ts ./tools/update-fixtures.ts",
"test": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"ts": "node --import tsx/esm",
"update-fixtures": "git add package.json && pnpm i -D svelte@4 && git checkout package.json && pnpm run run-update-fixtures && pnpm i && pnpm run run-update-fixtures",
"run-update-fixtures": "pnpm run ts ./tools/update-fixtures.ts",
"version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version"
},
"peerDependencies": {
Expand Down Expand Up @@ -102,7 +102,7 @@
"magic-string": "^0.30.17",
"mocha": "^11.1.0",
"prettier": "~3.5.3",
"prettier-plugin-pkg": "^0.18.1",
"prettier-plugin-pkg": "^0.19.0",
"prettier-plugin-svelte": "^3.3.3",
"rimraf": "^6.0.1",
"semver": "^7.7.1",
Expand Down
Loading