Skip to content

Commit 5a7fdda

Browse files
author
Clauderic Demers
committed
chore: add console warning in dev about arrayMove deprecation
1 parent 0e855c5 commit 5a7fdda

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": ["plugin:shopify/react"],
33
"rules": {
4+
"no-process-env": "off",
45
"no-lonely-if": "off",
56
"no-undefined": "off",
67
"no-param-reassign": "off",

src/utils.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
/* global process */
12
import invariant from 'invariant';
23

34
export function arrayMove(array, from, to) {
45
// Will be deprecated soon. Consumers should install 'array-move' instead
56
// https://www.npmjs.com/package/array-move
67

8+
if (process.env.NODE_ENV !== 'production') {
9+
if (typeof console !== 'undefined') {
10+
// eslint-disable-next-line no-console
11+
console.warn(
12+
"Deprecation warning: arrayMove will no longer be exported by 'react-sortable-hoc' in the next major release. Please install the `array-move` package locally instead. https://www.npmjs.com/package/array-move",
13+
);
14+
}
15+
}
16+
717
array = array.slice();
818
array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
919

0 commit comments

Comments
 (0)