Skip to content

feat: update svelte2tsx to >=0.7.9 #114

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 2 commits into from
Jun 9, 2024
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/loud-bags-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"typescript-eslint-parser-for-extra-files": minor
---

feat: update svelte2tsx to >=0.7.9
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
package-lock=false
force=true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"peerDependencies": {
"@typescript-eslint/parser": ">=5.41.0",
"astrojs-compiler-sync": ">=0.3.1",
"svelte2tsx": ">=0.5.20",
"svelte2tsx": ">=0.7.9",
"typescript": ">=4.8.4",
"vue": "^3.2.45"
},
Expand Down
6 changes: 4 additions & 2 deletions src/transform/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export function transformForSvelte(
if (context.current) {
return code;
}

// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires -- ignore
const svelte2tsx: typeof Svelte2tsx = require("svelte2tsx");
const result = svelte2tsx.svelte2tsx(code, {
filename: context.filePath,
});

return `/// <reference types="svelte2tsx/svelte-shims" />

return `/// <reference types="svelte2tsx/svelte-shims-v4" />
/// <reference types="svelte2tsx/svelte-shims" />

${result.code}`;
}
4 changes: 2 additions & 2 deletions tests/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type * as tsEslintParser from "@typescript-eslint/parser";
import path from "path";
import * as vueParser from "vue-eslint-parser";

const PROJECT_ROOT = path.join(__dirname, "../../..");
const PROJECT_ROOT = path.normalize(path.join(__dirname, "../../.."));

export function buildTypes(
input: string,
Expand Down Expand Up @@ -59,7 +59,7 @@ export function buildTypes(
return `${l} // ${types[i].join(", ").replace(/\n\s*/g, " ")}`;
})
.join("\n")
.replace(new RegExp(escapeRegExp(PROJECT_ROOT), "gu"), "");
.replace(new RegExp(escapeRegExp(PROJECT_ROOT), "giu"), "");
}

function escapeRegExp(string: string) {
Expand Down
Loading