From 72472e9d7c3eba6429137413af8d06641ba8935b Mon Sep 17 00:00:00 2001 From: Aleksey Levenstein Date: Mon, 4 Oct 2021 17:29:26 +0300 Subject: [PATCH] chore: enable linter for tsx files --- package.json | 5 ++--- src/hooks/useDispatch.ts | 2 +- src/types.ts | 12 ++---------- test/components/connect.spec.tsx | 3 +-- test/hooks/useSelector.spec.tsx | 11 +---------- yarn.lock | 1 - 6 files changed, 7 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index f5992335a..3782694ab 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "build": "yarn build:types && yarn build:commonjs && yarn build:es && yarn build:umd && yarn build:umd:min", "clean": "rimraf lib dist es coverage", "api-types": "api-extractor run --local", - "format": "prettier --write \"{src,test}/**/*.{js,ts}\" \"docs/**/*.md\"", - "lint": "eslint src --ext ts,js test/utils test/components test/hooks", + "format": "prettier --write \"{src,test}/**/*.{js,ts,tsx}\" \"docs/**/*.md\"", + "lint": "eslint src --ext ts,tsx,js test/utils test/components test/hooks", "prepare": "yarn clean && yarn build", "pretest": "yarn lint", "test": "jest", @@ -56,7 +56,6 @@ "@types/use-sync-external-store": "^0.0.0", "hoist-non-react-statics": "^3.3.2", "loose-envify": "^1.4.0", - "prop-types": "^15.7.2", "react-is": "^16.13.1", "use-sync-external-store": "0.0.0-experimental-7d38e4fd8-20210930" }, diff --git a/src/hooks/useDispatch.ts b/src/hooks/useDispatch.ts index 3063b1341..c84f1846e 100644 --- a/src/hooks/useDispatch.ts +++ b/src/hooks/useDispatch.ts @@ -1,4 +1,4 @@ -import { Action, ActionCreator, AnyAction, Dispatch, Store } from 'redux' +import { Action, AnyAction, Dispatch } from 'redux' import { Context } from 'react' import { diff --git a/src/types.ts b/src/types.ts index a291b83a4..4fff99c46 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,17 +1,9 @@ /* eslint-disable no-unused-vars */ // TODO Ignoring all unused variables for now -import { - ClassAttributes, - Component, - ComponentClass, - ComponentType, - StatelessComponent, - Context, - NamedExoticComponent, -} from 'react' +import { ClassAttributes, ComponentClass, ComponentType } from 'react' -import { Action, ActionCreator, AnyAction, Dispatch, Store } from 'redux' +import { Action, AnyAction, Dispatch } from 'redux' // import hoistNonReactStatics = require('hoist-non-react-statics'); import type { NonReactStatics } from 'hoist-non-react-statics' diff --git a/test/components/connect.spec.tsx b/test/components/connect.spec.tsx index 6bad24a28..d52f63993 100644 --- a/test/components/connect.spec.tsx +++ b/test/components/connect.spec.tsx @@ -1,8 +1,7 @@ /*eslint-disable react/prop-types*/ -import React, { Component, MouseEvent, useLayoutEffect } from 'react' +import React, { Component, MouseEvent } from 'react' import createClass from 'create-react-class' -import PropTypes from 'prop-types' import { createStore, applyMiddleware } from 'redux' import { Provider as ProviderMock, connect } from '../../src/index' import * as rtl from '@testing-library/react' diff --git a/test/hooks/useSelector.spec.tsx b/test/hooks/useSelector.spec.tsx index 6c8402ea1..03f7d7861 100644 --- a/test/hooks/useSelector.spec.tsx +++ b/test/hooks/useSelector.spec.tsx @@ -10,14 +10,9 @@ import { connect, createSelectorHook, } from '../../src/index' -import { useReduxContext } from '../../src/hooks/useReduxContext' import type { FunctionComponent, DispatchWithoutAction, ReactNode } from 'react' import type { Store, AnyAction } from 'redux' -import type { - TypedUseSelectorHook, - ReactReduxContextValue, - Subscription, -} from '../../src/' +import type { TypedUseSelectorHook, ReactReduxContextValue } from '../../src/' describe('React', () => { describe('hooks', () => { @@ -138,11 +133,7 @@ describe('React', () => { } }) - let rootSubscription: Subscription - const Parent = () => { - const { subscription } = useReduxContext() as ReactReduxContextValue - rootSubscription = subscription const count = useNormalSelector((s) => s.count) return count === 1 ? : null } diff --git a/yarn.lock b/yarn.lock index 4736748ea..1bd96c4c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9063,7 +9063,6 @@ __metadata: jest: ^26.6.1 loose-envify: ^1.4.0 prettier: ^2.1.2 - prop-types: ^15.7.2 react: 0.0.0-experimental-7d38e4fd8-20210930 react-dom: 0.0.0-experimental-7d38e4fd8-20210930 react-is: ^16.13.1