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: target correct version of node in babel config #125

Merged
merged 1 commit into from
Sep 17, 2021
Merged

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Sep 17, 2021

Compiled code can safely use destructuring and async-await etc..

Diff:

diff --git i/build/runner/index.js w/build/runner/index.js
index f40bdc5..53434a7 100644
--- i/build/runner/index.js
+++ w/build/runner/index.js
@@ -1,7 +1,8 @@
 "use strict";
 
-const _require = require('create-jest-runner'),
-      createJestRunner = _require.createJestRunner;
+const {
+  createJestRunner
+} = require('create-jest-runner');
 
 const configOverrides = require('../utils/configOverrides');
 
diff --git i/build/runner/runESLint.js w/build/runner/runESLint.js
index 5837423..c6497e8 100644
--- i/build/runner/runESLint.js
+++ w/build/runner/runESLint.js
@@ -1,18 +1,14 @@
 "use strict";
 
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
+const {
+  pass,
+  fail,
+  skip
+} = require('create-jest-runner');
 
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-const _require = require('create-jest-runner'),
-      pass = _require.pass,
-      fail = _require.fail,
-      skip = _require.skip;
-
-const _require2 = require('eslint'),
-      CLIEngine = _require2.CLIEngine;
+const {
+  CLIEngine
+} = require('eslint');
 
 const getESLintOptions = require('../utils/getESLintOptions');
 
@@ -34,13 +30,13 @@ let cachedValues;
 
 const getCachedValues = (config, extraOptions) => {
   if (!cachedValues) {
-    const _getESLintOptions = getESLintOptions(config),
-          baseCliOptions = _getESLintOptions.cliOptions;
-
-    const cliOptions = _objectSpread(_objectSpread({}, baseCliOptions), {}, {
-      fix: getComputedFixValue(baseCliOptions)
-    }, extraOptions);
-
+    const {
+      cliOptions: baseCliOptions
+    } = getESLintOptions(config);
+    const cliOptions = { ...baseCliOptions,
+      fix: getComputedFixValue(baseCliOptions),
+      ...extraOptions
+    };
     const cli = new CLIEngine(cliOptions);
     const formatter = cli.getFormatter(cliOptions.format);
     cachedValues = {
@@ -65,10 +61,11 @@ const runESLint = ({
     require(config.setupTestFrameworkScriptFile);
   }
 
-  const _getCachedValues = getCachedValues(config, extraOptions),
-        cli = _getCachedValues.cli,
-        formatter = _getCachedValues.formatter,
-        cliOptions = _getCachedValues.cliOptions;
+  const {
+    cli,
+    formatter,
+    cliOptions
+  } = getCachedValues(config, extraOptions);
 
   if (cli.isPathIgnored(testPath)) {
     const end = Date.now();
diff --git i/build/utils/getESLintOptions.js w/build/utils/getESLintOptions.js
index 0f59fae..57f0165 100644
--- i/build/utils/getESLintOptions.js
+++ w/build/utils/getESLintOptions.js
@@ -1,7 +1,8 @@
 "use strict";
 
-const _require = require('cosmiconfig'),
-      cosmiconfigSync = _require.cosmiconfigSync;
+const {
+  cosmiconfigSync
+} = require('cosmiconfig');
 
 const normalizeConfig = require('./normalizeConfig');
 
diff --git i/build/utils/normalizeConfig.js w/build/utils/normalizeConfig.js
index 85826d8..38397de 100644
--- i/build/utils/normalizeConfig.js
+++ w/build/utils/normalizeConfig.js
@@ -1,11 +1,5 @@
 "use strict";
 
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
 const identity = v => v;
 
 const negate = v => !v;
@@ -119,24 +113,23 @@ const BASE_CONFIG = {
 /* eslint-disable no-param-reassign */
 
 const normalizeCliOptions = rawConfig => Object.keys(BASE_CONFIG).reduce((config, key) => {
-  const _BASE_CONFIG$key = BASE_CONFIG[key],
-        _BASE_CONFIG$key$name = _BASE_CONFIG$key.name,
-        name = _BASE_CONFIG$key$name === void 0 ? key : _BASE_CONFIG$key$name,
-        _BASE_CONFIG$key$tran = _BASE_CONFIG$key.transform,
-        transform = _BASE_CONFIG$key$tran === void 0 ? identity : _BASE_CONFIG$key$tran,
-        defaultValue = _BASE_CONFIG$key.default;
+  const {
+    name = key,
+    transform = identity,
+    default: defaultValue
+  } = BASE_CONFIG[key];
   const value = rawConfig[key] !== undefined ? rawConfig[key] : defaultValue;
-  return _objectSpread(_objectSpread({}, config), {}, {
+  return { ...config,
     [name]: transform(value)
-  });
+  };
 }, {});
 /* eslint-enable no-param-reassign */
 
 
 const normalizeConfig = config => {
-  return _objectSpread(_objectSpread({}, config), {}, {
+  return { ...config,
     cliOptions: normalizeCliOptions(config.cliOptions || {})
-  });
+  };
 };
 
 module.exports = normalizeConfig;
\ No newline at end of file
diff --git i/build/watchFixPlugin/index.js w/build/watchFixPlugin/index.js
index 55490ab..8f22440 100644
--- i/build/watchFixPlugin/index.js
+++ w/build/watchFixPlugin/index.js
@@ -1,11 +1,8 @@
 "use strict";
 
-function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
-
-function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
-
-const _require = require('jest'),
-      getJestVersion = _require.getVersion;
+const {
+  getVersion: getJestVersion
+} = require('jest');
 
 const chalk = require('chalk');
 
@@ -32,12 +29,10 @@ class ESLintWatchFixPlugin {
   } // eslint-disable-next-line class-methods-use-this
 
 
-  run() {
-    return _asyncToGenerator(function* () {
-      const fix = configOverrides.getFix();
-      configOverrides.setFix(!fix);
-      return true;
-    })();
+  async run() {
+    const fix = configOverrides.getFix();
+    configOverrides.setFix(!fix);
+    return true;
   }
 
   getUsageInfo() {

@SimenB SimenB merged commit 7ac26d1 into main Sep 17, 2021
@SimenB SimenB deleted the babel-target branch September 17, 2021 08:00
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.

None yet

1 participant