Skip to content

Commit

Permalink
fix unused variables lints in relay-runtime
Browse files Browse the repository at this point in the history
Reviewed By: josephsavona

Differential Revision: D33436199

fbshipit-source-id: e6165fc7e0ea4e153addf270989efcd4f9eececb
  • Loading branch information
kassens authored and facebook-github-bot committed Jan 6, 2022
1 parent 2ea681c commit ed24f9d
Show file tree
Hide file tree
Showing 34 changed files with 26 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

const {createContainer} = require('../ReactRelayFragmentContainer');
const RelayEnvironmentProvider = require('../relay-hooks/RelayEnvironmentProvider');
// eslint-disable-next-line no-unused-vars
const React = require('react');
const {useEffect} = require('react');
const ReactTestRenderer = require('react-test-renderer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

const {createContainer} = require('../ReactRelayPaginationContainer');
const RelayEnvironmentProvider = require('../relay-hooks/RelayEnvironmentProvider');
// eslint-disable-next-line no-unused-vars
const React = require('react');
const {useEffect} = require('react');
const ReactTestRenderer = require('react-test-renderer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,11 @@ describe('ReactRelayRefetchContainer with fragment ownerhsip', () => {
});

describe('refetch()', () => {
let instance;

beforeEach(() => {
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1)
.data.node;
environment.mock.clearCache();
instance = ReactTestRenderer.create(
ReactTestRenderer.create(
<ContextSetter environment={environment}>
<TestContainer user={userPointer} />
</ContextSetter>,
Expand Down Expand Up @@ -389,7 +387,7 @@ describe('ReactRelayRefetchContainer with fragment ownerhsip', () => {
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1)
.data.node;
environment.mock.clearCache();
instance = ReactTestRenderer.create(
ReactTestRenderer.create(
<ContextSetter environment={environment}>
<TestContainer user={userPointer} />
</ContextSetter>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

const {createContainer} = require('../ReactRelayRefetchContainer');
const RelayEnvironmentProvider = require('../relay-hooks/RelayEnvironmentProvider');
// eslint-disable-next-line no-unused-vars
const React = require('react');
const {useEffect} = require('react');
const ReactTestRenderer = require('react-test-renderer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'use strict';

import type {ActorChangeTestFeedUnitFragment$key} from './__generated__/ActorChangeTestFeedUnitFragment.graphql';
import type {ActorChangeTestQuery} from './__generated__/ActorChangeTestQuery.graphql';
import type {
ActorIdentifier,
IActorEnvironment,
Expand All @@ -32,10 +31,7 @@ const {
MultiActorEnvironment,
getActorIdentifier,
} = require('relay-runtime/multi-actor-environment');
const {
disallowWarnings,
expectWarningWillFire,
} = require('relay-test-utils-internal');
const {disallowWarnings} = require('relay-test-utils-internal');

function ComponentWrapper(
props: $ReadOnly<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'use strict';
import type {ActorChangeWithDeferTestDeferFragment$key} from './__generated__/ActorChangeWithDeferTestDeferFragment.graphql';
import type {ActorChangeWithDeferTestFragment$key} from './__generated__/ActorChangeWithDeferTestFragment.graphql';
import type {ActorChangeWithDeferTestQuery} from './__generated__/ActorChangeWithDeferTestQuery.graphql';
import type {
IActorEnvironment,
IMultiActorEnvironment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import type {ActorIdentifier} from '../../../relay-runtime/multi-actor-environment/ActorIdentifier';
import type {ActorChangeWithMutationTestFragment$key} from './__generated__/ActorChangeWithMutationTestFragment.graphql';
import type {ActorChangeWithMutationTestMutation} from './__generated__/ActorChangeWithMutationTestMutation.graphql';
import type {ActorChangeWithMutationTestQuery} from './__generated__/ActorChangeWithMutationTestQuery.graphql';
import type {
IActorEnvironment,
IMultiActorEnvironment,
Expand All @@ -40,10 +39,7 @@ const {
MultiActorEnvironment,
getActorIdentifier,
} = require('relay-runtime/multi-actor-environment');
const {
disallowWarnings,
expectWarningWillFire,
} = require('relay-test-utils-internal');
const {disallowWarnings} = require('relay-test-utils-internal');

function ComponentWrapper(
props: $ReadOnly<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

'use strict';
import type {ActorChangeWithStreamTestFragment$key} from './__generated__/ActorChangeWithStreamTestFragment.graphql';
import type {ActorChangeWithStreamTestQuery} from './__generated__/ActorChangeWithStreamTestQuery.graphql';
import type {
IActorEnvironment,
IMultiActorEnvironment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ describe('useBlockingPaginationFragment', () => {
...
}) => {
// We need a render a component to run a Hook
const [owner, _setOwner] = useState(props.owner);
const [_, _setCount] = useState(0);
const [owner, setOwner_] = useState(props.owner);
const [, setCount] = useState(0);
const fragment = props.fragment ?? gqlFragment;
const artificialUserRef = useMemo(
() => environment.lookup(owner.fragment).data?.node,
Expand All @@ -388,8 +388,8 @@ describe('useBlockingPaginationFragment', () => {
? props.userRef
: artificialUserRef;

setOwner = _setOwner;
forceUpdate = _setCount;
setOwner = setOwner_;
forceUpdate = setCount;

const {data: userData} = useBlockingPaginationFragment(fragment, userRef);
return <Renderer user={userData} />;
Expand Down Expand Up @@ -842,10 +842,10 @@ describe('useBlockingPaginationFragment', () => {
// This prevents console.error output in the test, which is expected
jest.spyOn(console, 'error').mockImplementationOnce(() => {});
const {
__internal: {fetchQuery},
__internal: {fetchQuery: fetchQuery_},
} = require('relay-runtime');

fetchQuery(environment, query).subscribe({});
fetchQuery_(environment, query).subscribe({});

const callback = jest.fn();
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ describe('useBlockingPaginationFragment with useTransition', () => {
}) => {
// We need a render a component to run a Hook
const [owner, _setOwner] = useState(props.owner);
const [_, _setCount] = useState(0);
const [, setCount] = useState(0);
const fragment = props.fragment ?? gqlFragment;
const artificialUserRef = useMemo(() => {
const snapshot = environment.lookup(owner.fragment);
Expand All @@ -403,7 +403,7 @@ describe('useBlockingPaginationFragment with useTransition', () => {
: artificialUserRef;

setOwner = _setOwner;
forceUpdate = _setCount;
forceUpdate = setCount;

const {data: userData} =
useBlockingPaginationFragmentWithSuspenseTransition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => {

loaderRenderLogs = [];
LoaderComponent = function (props) {
const [entryPointRef, _loadEntryPoint] = useEntryPointLoader(
const [entryPointRef] = useEntryPointLoader(
environmentProvider,
props.entryPoint,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

const RelayEnvironmentProvider = require('../RelayEnvironmentProvider');
const useFragmentNode = require('../useFragmentNode');
// eslint-disable-next-line no-unused-vars
const React = require('react');
const {useEffect} = require('react');
const ReactTestRenderer = require('react-test-renderer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type {ReaderFragment} from '../../../relay-runtime/util/ReaderNode';
import type {RequestDescriptor} from 'relay-runtime/store/RelayStoreTypes';

const useFragmentNodeOriginal = require('../useFragmentNode');
// eslint-disable-next-line no-unused-vars
const React = require('react');
const ReactRelayContext = require('react-relay/ReactRelayContext');
const TestRenderer = require('react-test-renderer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ beforeEach(() => {
}) => {
// We need a render a component to run a Hook
const [owner, _setOwner] = useState<OperationDescriptor>(props.owner);
const [, _setCount] = useState(0);
const [, setCount] = useState(0);
const userRef = props.hasOwnProperty('userRef')
? props.userRef
: {
Expand All @@ -237,7 +237,7 @@ beforeEach(() => {
};

setSingularOwner = _setOwner;
forceSingularUpdate = () => _setCount(count => count + 1);
forceSingularUpdate = () => setCount(count => count + 1);

const [userData] = useFragmentNode(gqlSingularFragment, userRef);
return <SingularRenderer user={userData} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('usePaginationFragment', () => {
let gqlQueryWithLiteralArgs;
let gqlQueryWithStreaming;
let gqlPaginationQuery;
let gqlPaginationQueryWithStreaming;
let gqlFragment;
let gqlFragmentWithStreaming;
let query;
Expand Down Expand Up @@ -3964,8 +3963,6 @@ describe('usePaginationFragment', () => {
});

describe('paginating @fetchable types', () => {
let gqlRefetchQuery;

beforeEach(() => {
const fetchVariables = {id: 'a'};
gqlQuery = getRequest(graphql`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ describe.skip('useQueryLoader-react-double-effects', () => {

loaderRenderLogs = [];
LoaderComponent = function (props) {
const [queryRef, _loadQuery] = useQueryLoader(
gqlQuery,
props.initialQueryRef,
);
const [queryRef] = useQueryLoader(gqlQuery, props.initialQueryRef);

const queryRefId = queryRef == null ? 'null' : queryRef.id ?? 'Unknown';
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ describe('useRefetchableFragmentNode', () => {
...
}) => {
// We need a render a component to run a Hook
const [owner, _setOwner] = useState<OperationDescriptor>(props.owner);
const [_, _setCount] = useState(0);
const [owner, setOwner_] = useState<OperationDescriptor>(props.owner);
const [, setCount_] = useState(0);
const fragment = props.fragment ?? gqlFragment;
const artificialUserRef = useMemo(
() => ({
Expand All @@ -281,8 +281,8 @@ describe('useRefetchableFragmentNode', () => {
? props.userRef
: artificialUserRef;

forceUpdate = _setCount;
setOwner = _setOwner;
forceUpdate = setCount_;
setOwner = setOwner_;

const {fragmentData: userData, refetch: refetchInternal} =
useRefetchableFragmentNode(fragment, userRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('useRefetchableFragmentNode with useTransition', () => {
}) => {
// We need a render a component to run a Hook
const owner = props.owner;
const [_, _setCount] = useState(0);
const [, setCount] = useState(0);
const fragment = props.fragment ?? gqlFragment;
const artificialUserRef = useMemo(
() => ({
Expand All @@ -271,7 +271,7 @@ describe('useRefetchableFragmentNode with useTransition', () => {
? props.userRef
: artificialUserRef;

forceUpdate = _setCount;
forceUpdate = setCount;

const {data: userData} =
useRefetchableFragmentNodeWithSuspenseTransition(fragment, userRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

'use strict';

import type {DataID, Disposable, InvalidationState} from 'relay-runtime';
import type {DataID, Disposable} from 'relay-runtime';

const useRelayEnvironment = require('./useRelayEnvironment');
const {useEffect, useRef} = require('react');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import type {
MutationParameters,
RecordSourceSelectorProxy,
SelectorData,
SelectorStoreUpdater,
} from '../store/RelayStoreTypes';
import type {ConcreteRequest} from '../util/RelayConcreteNode';
Expand Down
1 change: 0 additions & 1 deletion packages/relay-runtime/store/RelayModernStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

'use strict';

import type {ActorIdentifier} from '../multi-actor-environment/ActorIdentifier';
import type {DataID, Disposable} from '../util/RelayRuntimeTypes';
import type {Availability} from './DataChecker';
import type {GetDataID} from './RelayResponseNormalizer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const {
} = require('../../multi-actor-environment');
const RelayNetwork = require('../../network/RelayNetwork');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ const {
const RelayModernStore = require('../RelayModernStore');
const RelayRecordSource = require('../RelayRecordSource');
const nullthrows = require('nullthrows');
const {
disallowWarnings,
expectWarningWillFire,
} = require('relay-test-utils-internal');
const {disallowWarnings} = require('relay-test-utils-internal');

disallowWarnings();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const {
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const {
} = require('../../multi-actor-environment');
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand All @@ -37,10 +36,7 @@ const RelayModernStore = require('../RelayModernStore');
const RelayRecordSource = require('../RelayRecordSource');
const QueryUserNormalizationFragment = require('./__generated__/RelayModernEnvironmentExecuteWithDeferAndModuleTestQuery_user$normalization.graphql');
const {graphql} = require('relay-runtime');
const {
disallowWarnings,
expectWarningWillFire,
} = require('relay-test-utils-internal');
const {disallowWarnings} = require('relay-test-utils-internal');

disallowWarnings();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type {NormalizationRootNode} from '../../util/NormalizationNode';
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type {NormalizationRootNode} from '../../util/NormalizationNode';
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import type {
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const ConnectionHandler = require('../../handlers/connection/ConnectionHandler')
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const {
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type {
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const {getFragment, getRequest, graphql} = require('../../query/GraphQLTag');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'use strict';

const {fetchQuery} = require('../../query/fetchQueryInternal');
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernFragmentSpecResolver = require('../RelayModernFragmentSpecResolver');
const {
createOperationDescriptor,
Expand Down
Loading

0 comments on commit ed24f9d

Please sign in to comment.