Skip to content

Commit 4f13cb8

Browse files
authored
Refactor to import fixes from pnpm migration to main (#1604)
1 parent 38850f8 commit 4f13cb8

File tree

33 files changed

+220
-88
lines changed

33 files changed

+220
-88
lines changed

.changeset/famous-rivers-happen.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@flopflip/cypress-plugin": patch
3+
"@flopflip/launchdarkly-adapter": patch
4+
"@flopflip/react-broadcast": patch
5+
"@flopflip/react-redux": patch
6+
"@flopflip/react": patch
7+
"@flopflip/splitio-adapter": patch
8+
"@flopflip/test-utils": patch
9+
"@flopflip/types": patch
10+
---
11+
12+
Refactor to import fixes from pnpm migration to `main`

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
sourceType: 'module',
44
ecmaVersion: 7,
55
ecmaFeatures: { jsx: true, modules: true },
6+
project: ['./tsconfig.lint.json'],
67
},
78
extends: [
89
'xo',

jest-runner-test.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// eslint-disable-next-line @typescript-eslint/no-require-imports
12
require('@testing-library/jest-dom/extend-expect');

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"develop": "jest --projects jest.*.config.js --watch",
99
"lint": "jest --config jest.lint.config.js --maxWorkers 5",
1010
"pretypecheck": "rimraf packages/**/dist/",
11-
"typecheck": "tsc --noEmit",
11+
"typecheck": "tsc --project tsconfig.json --noEmit && tsc --project packages/cypress-plugin/tsconfig.json --noEmit",
1212
"format": "yarn format:ts && yarn format:md && yarn format:yaml",
1313
"format:ts": "prettier --write '**/*.{js, ts, tsx}'",
1414
"format:md": "prettier --parser markdown --write '**/*.md'",
@@ -90,6 +90,7 @@
9090
"eslint-plugin-testing-library": "5.1.0",
9191
"husky": "7.0.4",
9292
"jest": "27.5.1",
93+
"jest-localstorage-mock": "2.4.19",
9394
"lint-staged": "12.3.7",
9495
"pinst": "3.0.0",
9596
"prettier": "2.6.0",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": true,
5+
// be explicit about types included
6+
// to avoid clashing with Jest types
7+
"types": ["cypress"]
8+
},
9+
"exclude": [""],
10+
"include": [
11+
"../node_modules/cypress",
12+
"./**/*.ts"
13+
]
14+
}

packages/launchdarkly-adapter/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@
2929
"@babel/runtime": "7.17.8",
3030
"@flopflip/adapter-utilities": "1.0.24",
3131
"@flopflip/types": "4.1.20",
32+
"@types/merge-deep": "3.0.0",
3233
"debounce-fn": "4.0.0",
33-
"deepmerge": "4.2.2",
3434
"launchdarkly-js-client-sdk": "2.20.2",
3535
"lodash": "4.17.21",
36+
"merge-deep": "3.0.3",
3637
"mitt": "3.0.0",
3738
"tiny-warning": "1.0.3"
3839
},

packages/launchdarkly-adapter/src/adapter/adapter.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@ import {
2222
AdapterSubscriptionStatus,
2323
} from '@flopflip/types';
2424
import debounce from 'debounce-fn';
25-
import merge from 'deepmerge';
2625
import {
26+
type LDClient,
27+
type LDUser,
2728
initialize as initializeLaunchDarklyClient,
28-
LDClient,
29-
LDUser,
3029
} from 'launchdarkly-js-client-sdk';
31-
import { type LDUser as TLDUser } from 'launchdarkly-js-sdk-common';
3230
import isEqual from 'lodash/isEqual';
31+
import merge from 'merge-deep';
3332
import mitt, { Emitter } from 'mitt';
3433
import warning from 'tiny-warning';
3534

3635
type TEmitterEvents = {
3736
flagsStateChange: TFlags;
3837
statusStateChange: Partial<TAdapterStatus>;
3938
};
40-
type TLaunchDarklyUser = TUser<TLDUser>;
39+
type TLaunchDarklyUser = TUser<LDUser>;
4140
type TLaunchDarklyAdapterState = {
4241
user?: TLaunchDarklyUser;
4342
client?: LDClient;

packages/react-broadcast/src/components/configure/configure.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import {
88
type TConfigureAdapterProps,
99
type TFlags,
1010
type TFlagsChange,
11-
} from '@flopflip/types';
12-
import {
1311
AdapterConfigurationStatus,
1412
AdapterSubscriptionStatus,
1513
} from '@flopflip/types';
@@ -101,9 +99,9 @@ const useStatusState = (): [
10199
return [status, setStatus];
102100
};
103101

104-
const Configure = <AdapterInstance extends TAdapter>(
102+
function Configure<AdapterInstance extends TAdapter>(
105103
props: Props<AdapterInstance>
106-
) => {
104+
) {
107105
const adapterIdentifiers = useMemo(
108106
() => [props.adapter.id],
109107
[props.adapter.id]
@@ -164,7 +162,7 @@ const Configure = <AdapterInstance extends TAdapter>(
164162
</ConfigureAdapter>
165163
</FlagsContext.Provider>
166164
);
167-
};
165+
}
168166

169167
Configure.displayName = 'ConfigureFlopflip';
170168
Configure.defaultProps = {

packages/react-broadcast/src/components/test-provider/test-provider.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
type TAdapterStatus,
55
type TFlags,
66
type TReconfigureAdapter,
7-
} from '@flopflip/types';
8-
import {
97
AdapterConfigurationStatus,
108
AdapterSubscriptionStatus,
119
} from '@flopflip/types';
@@ -32,14 +30,14 @@ const defaultProps: Pick<
3230
},
3331
};
3432

35-
const TestProvider = (props: TProps) => {
33+
function TestProvider(props: TProps) {
3634
const adapterContextValue = createAdapterContext(
3735
props.adapterIdentifiers,
3836
props.reconfigure,
3937
props.status
4038
);
4139
const flagsContextValue = createIntialFlagsContext(
42-
// @ts-expect-error
40+
// @ts-expect-error Can not remember. Sorry to myself.
4341
props.adapterIdentifiers,
4442
props.flags
4543
);
@@ -51,7 +49,7 @@ const TestProvider = (props: TProps) => {
5149
</FlagsContext.Provider>
5250
</AdapterContext.Provider>
5351
);
54-
};
52+
}
5553

5654
TestProvider.displayName = 'TestProviderFlopFlip';
5755
TestProvider.defaultProps = defaultProps;

packages/react-broadcast/src/components/toggle-feature/toggle-feature.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { type TFlagName, type TFlagVariation } from '@flopflip/types';
21
import {
32
ToggleFeature as SharedToggleFeature,
43
TToggleFeatureProps,
54
} from '@flopflip/react';
5+
import { type TFlagName, type TFlagVariation } from '@flopflip/types';
66
import React from 'react';
77

88
import { useFeatureToggle } from '../../hooks/';
99

1010
type Props = {
1111
flag: TFlagName;
1212
variation?: TFlagVariation;
13-
// eslint-disable-next-line @typescript-eslint/ban-types
13+
1414
} & Omit<TToggleFeatureProps, 'isFeatureEnabled'>;
1515

16-
const ToggleFeature = <OwnProps extends Props>(props: OwnProps) => {
16+
function ToggleFeature<OwnProps extends Props>(props: OwnProps) {
1717
const isFeatureEnabled = useFeatureToggle(props.flag, props.variation);
1818
return <SharedToggleFeature {...props} isFeatureEnabled={isFeatureEnabled} />;
19-
};
19+
}
2020

2121
ToggleFeature.displayName = 'ToggleFeature';
2222

0 commit comments

Comments
 (0)