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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

absidue
Copy link

@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

⚠️ No Changeset found

Latest commit: 0449608

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

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.

1 participant