Skip to content

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

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

Merged
merged 3 commits into from
Apr 19, 2025
Merged
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
@@ -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

83 changes: 42 additions & 41 deletions docs/internal-mechanism.md
Original file line number Diff line number Diff line change
@@ -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;
}
```

@@ -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;
});
}
```

@@ -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
@@ -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}
@@ -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",
@@ -14,7 +15,6 @@
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"type": "module",
"main": "lib/index.js",
"files": [
"lib"
@@ -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": {
@@ -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",

Unchanged files with check annotations Beta

import type {} from "svelte"; // FIXME: Workaround to get type information for "svelte/compiler"

Check warning on line 1 in src/parser/template.ts

GitHub Actions / lint

Unexpected 'fixme' comment: 'FIXME: Workaround to get type...'
import { parse } from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5.js";
import type * as SvAST from "./svelte-ast-types.js";
};
// Link declaration and declarations for backward compatibility.
// TODO Remove in v2 and later.

Check warning on line 22 in src/parser/converts/const.ts

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO Remove in v2 and later.'
Object.defineProperty(mustache, "declaration", {
get() {
return mustache.declarations[0];
(key as any).parent = sAttr;
ctx.scriptLet.addObjectShorthandProperty(attribute.key, sAttr, (es) => {
if (
// FIXME: Older parsers may use the same node. In that case, do not replace.

Check warning on line 174 in src/parser/converts/attr.ts

GitHub Actions / lint

Unexpected 'fixme' comment: 'FIXME: Older parsers may use the same...'
// We will drop support for ESLint v7 in the next major version and remove this branch.
es.key !== es.value
) {
/**
* @deprecated Use `declarations` instead.
*/
declaration: ESTree.VariableDeclarator; // TODO Remove in v2 and later.

Check warning on line 269 in src/ast/html.ts

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO Remove in v2 and later.'
declarations: [ESTree.VariableDeclarator];
parent:
| SvelteProgram