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

fix: Bump tsconfig target to es2017 to avoid polyfilling await #567

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

absidue
Copy link
Contributor

@absidue absidue commented Nov 4, 2024

Currently the target in the tsconfig.json file it set to ES2015, which means that the TypeScript compiler is polyfilling the await keyword in lib/utils/parser-config-resolver/worker.ts because it is an ES2017 language feature.

To avoid that happening this pull request bumps the target in the tsconfig.json file to ES2017. This is a non-breaking change as this package dropped Node.js versions older than 18 in version 3.0.0 and Node.js 18 supports ES2022 language features.

Before and after diff of dist/utils/parser-config-resolver/worker.js:

@@ -1,21 +1,12 @@
 "use strict";
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
-    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
-    return new (P || (P = Promise))(function (resolve, reject) {
-        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
-        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
-        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
-        step((generator = generator.apply(thisArg, _arguments || [])).next());
-    });
-};
 Object.defineProperty(exports, "__esModule", { value: true });
 const synckit_1 = require("synckit");
 const eslint_1 = require("eslint-compat-utils/eslint");
 const parse_by_parser_1 = require("./parse-by-parser");
 const ESLint = (0, eslint_1.getESLint)();
-(0, synckit_1.runAsWorker)((cwd, filePath) => __awaiter(void 0, void 0, void 0, function* () {
+(0, synckit_1.runAsWorker)(async (cwd, filePath) => {
     const eslint = new ESLint({ cwd });
-    const config = yield eslint.calculateConfigForFile(filePath);
+    const config = await eslint.calculateConfigForFile(filePath);
     const languageOptions = config.languageOptions || {};
     const parserOptions = Object.assign({
         sourceType: languageOptions.sourceType || 'module',
@@ -38,4 +29,4 @@ const ESLint = (0, eslint_1.getESLint)();
         ast: result.ast,
         visitorKeys: result === null || result === void 0 ? void 0 : result.visitorKeys
     };
-}));
+});

Copy link

changeset-bot bot commented Nov 4, 2024

🦋 Changeset detected

Latest commit: 9ce64d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@intlify/eslint-plugin-vue-i18n Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

Thank you!

@ota-meshi ota-meshi merged commit 4ae81b0 into intlify:master Nov 19, 2024
8 checks passed
@absidue absidue deleted the tsconfig-await branch November 19, 2024 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants