Skip to content

Commit 8f5234f

Browse files
mgoltimdorr
andauthored
Enforce type imports where applicable (#338)
Co-authored-by: Tim Dorr <[email protected]>
1 parent ea2c5dd commit 8f5234f

File tree

10 files changed

+15
-11
lines changed

10 files changed

+15
-11
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"import/no-unresolved": "off",
2020
"import/named": "off",
2121
"@typescript-eslint/ban-ts-ignore": "off",
22+
"@typescript-eslint/consistent-type-imports": ["error"],
2223
"@typescript-eslint/explicit-function-return-type": "off",
2324
"@typescript-eslint/no-explicit-any": "off",
2425
"@typescript-eslint/member-delimiter-style": "off",

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Action, AnyAction, Middleware } from 'redux'
1+
import type { Action, AnyAction, Middleware } from 'redux'
22

33
/**
44
* The dispatch method as modified by React-Thunk; overloaded so that you can

test/.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
},
55
"rules": {
66
"@typescript-eslint/ban-ts-comment": "off",
7+
"@typescript-eslint/consistent-type-imports": ["error"],
78
"@typescript-eslint/explicit-function-return-type": "off",
89
"@typescript-eslint/camelcase": "off",
910
"@typescript-eslint/no-use-before-define": "off",

test/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"compilerOptions": {
44
"module": "commonjs",
55
"strict": true,
6+
"importsNotUsedAsValues": "error",
67
"target": "ES2015"
78
},
89
"include": ["**/*.ts"]

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"strict": true,
4+
"importsNotUsedAsValues": "error",
45
"target": "ESNext",
56
"module": "ESNext",
67
"moduleResolution": "Node",

typescript_test/.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"rules": {
33
"@typescript-eslint/ban-ts-comment": "off",
4+
"@typescript-eslint/consistent-type-imports": ["error"],
45
"@typescript-eslint/explicit-function-return-type": "off",
56
"@typescript-eslint/camelcase": "off",
67
"@typescript-eslint/no-unused-vars": "off",

typescript_test/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"module": "commonjs",
44
"strict": true,
5+
"importsNotUsedAsValues": "error",
56
"target": "ES2015"
67
},
78
"include": ["typescript.ts"]

typescript_test/typescript.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
import {
3-
applyMiddleware,
4-
bindActionCreators,
5-
createStore,
6-
Action,
7-
AnyAction
8-
} from 'redux'
9-
10-
import thunk, {
2+
import { applyMiddleware, bindActionCreators, createStore } from 'redux'
3+
import type { Action, AnyAction } from 'redux'
4+
5+
import thunk from '../src/index'
6+
import type {
117
ThunkAction,
128
ThunkActionDispatch,
139
ThunkDispatch,

typescript_test/typescript_extended/extended-redux.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
Dispatch
1010
} from 'redux'
1111

12-
import thunk, {
12+
import thunk from '../../src/index'
13+
import type {
1314
ThunkAction,
1415
ThunkActionDispatch,
1516
ThunkDispatch,

typescript_test/typescript_extended/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"compilerOptions": {
44
"module": "commonjs",
55
"strict": true,
6+
"importsNotUsedAsValues": "error",
67
"target": "ES2015"
78
},
89
"include": ["extended-redux.ts"]

0 commit comments

Comments
 (0)