Repository: prettier/prettier-atom (js)

Issue:
Can't update to or install v0.58.1
I saw there was an update available and used the atom ui to update the package but it failed and showed this error:

```
Installing “prettier-atom@0.58.1” failed.Hide output…

npm ERR! Invalid dependency type requested: alias

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/akonwi/.atom/.apm/_logs/2019-11-04T20_21_05_062Z-debug.log
```

I uninstalled the package completely and attempted to just install the latest version and I get the same result and error.


Pull request:
fix: search and replace 'prettier-eslint' to custom fork
This is an alternative implementation of https://github.com/prettier/prettier-atom/pull/564, which
used yarn alias to avoid making code changes. Unfortunately apm is tightly coupled to npm, which
doesn't support the alias feature.

Seems like a naive search and replace of `'prettier-eslint'` to `'@lewisl9029/prettier-eslint'` just worked according to the tests and local testing. @robwise let me know if you notice anything that shouldn't have been changed.

fix #565


Patch:
diff --git a/dist/displayDebugInfo/index.js b/dist/displayDebugInfo/index.js
index f41482e..6d4987d 100644
--- a/dist/displayDebugInfo/index.js
+++ b/dist/displayDebugInfo/index.js
@@ -27,7 +27,7 @@ Atom version: ${getAtomVersion()}
 prettier-atom version: ${getPackageInfo(__dirname).version}
 prettier: ${globalPrettierPath || 'bundled'}
 prettier version: ${getPackageInfo(globalPrettierPath || getDepPath('prettier')).version}
-prettier-eslint version: ${getPackageInfo(getDepPath('prettier-eslint')).version}
+prettier-eslint version: ${getPackageInfo(getDepPath('@lewisl9029/prettier-eslint')).version}
 prettier-atom configuration: ${JSON.stringify(getPrettierAtomConfig(), null, 2)}
 `.trim();
 };
diff --git a/dist/executePrettier/executePrettierOnBufferRange.js b/dist/executePrettier/executePrettierOnBufferRange.js
index 0f12e38..4afa5d2 100644
--- a/dist/executePrettier/executePrettierOnBufferRange.js
+++ b/dist/executePrettier/executePrettierOnBufferRange.js
@@ -6,13 +6,13 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
 
 var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
 
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
+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(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 
 const _ = require('lodash/fp');
 
-const prettierEslint = require('prettier-eslint');
+const prettierEslint = require('@lewisl9029/prettier-eslint');
 
 const prettierStylelint = require('prettier-stylelint');
 
diff --git a/dist/helpers/index.js b/dist/helpers/index.js
index 69cf3ad..ec7ec47 100644
--- a/dist/helpers/index.js
+++ b/dist/helpers/index.js
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
 
 var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
 
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
+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(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 
diff --git a/flow-typed/npm/prettier-eslint_vx.x.x.js b/flow-typed/npm/prettier-eslint_vx.x.x.js
index 7fa65b7..a7367ad 100644
--- a/flow-typed/npm/prettier-eslint_vx.x.x.js
+++ b/flow-typed/npm/prettier-eslint_vx.x.x.js
@@ -4,7 +4,7 @@
 /**
  * This is an autogenerated libdef stub for:
  *
- *   'prettier-eslint'
+ *   '@lewisl9029/prettier-eslint'
  *
  * Fill this stub out by replacing all the `any` types.
  *
@@ -13,7 +13,7 @@
  * https://github.com/flowtype/flow-typed
  */
 
-declare module 'prettier-eslint' {
+declare module '@lewisl9029/prettier-eslint' {
   declare module.exports: any;
 }
 
diff --git a/package.json b/package.json
index b64dd0a..6d439ef 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,6 @@
     "lodash": "^4.17.13",
     "loophole": "^1.1.0",
     "prettier": "1.18.2",
-    "prettier-eslint": "npm:@lewisl9029/prettier-eslint",
     "prettier-stylelint": "^0.4.2",
     "read-pkg-up": "^6.0.0",
     "yarn-global-modules": "^1.0.1"
@@ -64,6 +63,7 @@
     "jest": "^24.9.0",
     "nps": "^5.9.8",
     "opt-cli": "^1.6.0",
+    "prettier-eslint": "^9.0.0",
     "prettier-eslint-cli": "^5.0.0",
     "rimraf": "^3.0.0"
   },
diff --git a/src/displayDebugInfo/index.js b/src/displayDebugInfo/index.js
index 71fc1ce..53e61ef 100644
--- a/src/displayDebugInfo/index.js
+++ b/src/displayDebugInfo/index.js
@@ -15,7 +15,7 @@ Atom version: ${getAtomVersion()}
 prettier-atom version: ${getPackageInfo(__dirname).version}
 prettier: ${globalPrettierPath || 'bundled'}
 prettier version: ${getPackageInfo(globalPrettierPath || getDepPath('prettier')).version}
-prettier-eslint version: ${getPackageInfo(getDepPath('prettier-eslint')).version}
+prettier-eslint version: ${getPackageInfo(getDepPath('@lewisl9029/prettier-eslint')).version}
 prettier-atom configuration: ${JSON.stringify(getPrettierAtomConfig(), null, 2)}
 `.trim();
 };
diff --git a/src/executePrettier/executePrettierOnBufferRange.js b/src/executePrettier/executePrettierOnBufferRange.js
index 851aa63..77cdb7c 100644
--- a/src/executePrettier/executePrettierOnBufferRange.js
+++ b/src/executePrettier/executePrettierOnBufferRange.js
@@ -1,6 +1,6 @@
 // @flow
 const _ = require('lodash/fp');
-const prettierEslint = require('prettier-eslint');
+const prettierEslint = require('@lewisl9029/prettier-eslint');
 const prettierStylelint = require('prettier-stylelint');
 const { allowUnsafeNewFunction } = require('loophole');
 
diff --git a/yarn.lock b/yarn.lock
index f286543..a287221 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -897,7 +897,7 @@
     "@types/istanbul-reports" "^1.1.1"
     "@types/yargs" "^13.0.0"
 
-"@lewisl9029/prettier-eslint@^9.0.1", "prettier-eslint@npm:@lewisl9029/prettier-eslint":
+"@lewisl9029/prettier-eslint@^9.0.1":
   version "9.0.1"
   resolved "https://registry.yarnpkg.com/@lewisl9029/prettier-eslint/-/prettier-eslint-9.0.1.tgz#9be07525c3d917b8ff37477a94f2b4bdfca051d8"
   integrity sha512-k4vh8RmH2VEvrBSBQ/jw8bvyh77LxnQi6GkGlU6P3X0fyVlqKoTcmA0WfUKPgAzoM3DO8f9iA+Fgr7laofz/dg==


Test patch:
diff --git a/dist/executePrettier/executePrettierOnBufferRange.test.js b/dist/executePrettier/executePrettierOnBufferRange.test.js
index ab96772..00ea7cb 100644
--- a/dist/executePrettier/executePrettierOnBufferRange.test.js
+++ b/dist/executePrettier/executePrettierOnBufferRange.test.js
@@ -6,11 +6,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
 
 var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
 
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
+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(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 
-jest.mock('prettier-eslint');
+jest.mock('@lewisl9029/prettier-eslint');
 jest.mock('prettier-stylelint');
 jest.mock('prettier');
 jest.mock('../atomInterface');
@@ -20,7 +20,7 @@ jest.mock('./handleError');
 
 const prettier = require('prettier');
 
-const prettierEslint = require('prettier-eslint');
+const prettierEslint = require('@lewisl9029/prettier-eslint');
 
 const prettierStylelint = require('prettier-stylelint');
 
diff --git a/src/executePrettier/executePrettierOnBufferRange.test.js b/src/executePrettier/executePrettierOnBufferRange.test.js
index 6f4289c..7d1fbfd 100644
--- a/src/executePrettier/executePrettierOnBufferRange.test.js
+++ b/src/executePrettier/executePrettierOnBufferRange.test.js
@@ -1,4 +1,4 @@
-jest.mock('prettier-eslint');
+jest.mock('@lewisl9029/prettier-eslint');
 jest.mock('prettier-stylelint');
 jest.mock('prettier');
 jest.mock('../atomInterface');
@@ -7,7 +7,7 @@ jest.mock('../helpers');
 jest.mock('./handleError');
 
 const prettier = require('prettier');
-const prettierEslint = require('prettier-eslint');
+const prettierEslint = require('@lewisl9029/prettier-eslint');
 const prettierStylelint = require('prettier-stylelint');
 const {
   getPrettierEslintOptions,
diff --git a/src/formatOnSave/isPrettierInPackageJson.test.js b/src/formatOnSave/isPrettierInPackageJson.test.js
index 0ee3c17..c0dcdff 100644
--- a/src/formatOnSave/isPrettierInPackageJson.test.js
+++ b/src/formatOnSave/isPrettierInPackageJson.test.js
@@ -57,7 +57,9 @@ describe('when shouldUseEslint is true', () => {
   });
 
   it('is true if prettier-eslint is a dependency', () => {
-    readPkgUp.sync.mockImplementation(() => ({ package: { dependencies: { 'prettier-eslint': '^0.0.1' } } }));
+    readPkgUp.sync.mockImplementation(() => ({
+      package: { dependencies: { 'prettier-eslint': '^0.0.1' } },
+    }));
 
     const actual = isPrettierInPackageJson();