Skip to content

Commit 5b9e857

Browse files
Add the @typescript-eslint/consistent-type-imports eslint rule (#154)
1 parent 26e93de commit 5b9e857

10 files changed

+1446
-682
lines changed

.eslintrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ rules:
4545
"@typescript-eslint/no-unused-vars":
4646
- 2
4747
- varsIgnorePattern: ^_
48+
"@typescript-eslint/consistent-type-imports": "error"

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v1
1313
with:
14-
node-version: 16.x
14+
node-version: 18.20.2
1515
- run: yarn install --frozen-lockfile
1616
- run: yarn run validate-change

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.14.0
1+
18.20.2

package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
"test:unit": "jest",
1717
"lint": "eslint --max-warnings=0 '{src,examples}/**/*.{ts,tsx,js}'",
1818
"lint:prettier": "prettier './**/*.js' './**/*.ts' './**/*.tsx' './**/*.md' --list-different",
19+
"lint-fix": "eslint '{src,types}/**/*.{ts,js}' --fix && yarn prettier",
1920
"typecheck": "tsc",
2021
"build": "yarn run clean && yarn run rollup -c",
2122
"checkimport": "scripts/check-imports",
2223
"clean": "rimraf dist",
2324
"prettier": "prettier './**/*.js' './**/*.ts' './**/*.tsx' './**/*.md' --write",
25+
"prettier-check": "prettier './**/*.{js,ts,md,html,css}' --check",
2426
"doctoc": "doctoc README.md",
2527
"storybook": "start-storybook -p 6006 ",
2628
"local-install-publish": "yalc add @stripe/connect-js@1.0.0 && yalc publish",
@@ -53,18 +55,21 @@
5355
"@types/jest": "^24.0.25",
5456
"@types/react": "^16.8.0",
5557
"@types/react-dom": "^16.8.0",
56-
"@typescript-eslint/eslint-plugin": "^4.15.2",
57-
"@typescript-eslint/parser": "^4.15.2",
58+
"@typescript-eslint/eslint-plugin": "^7",
59+
"@typescript-eslint/parser": "^7",
60+
"@typescript-eslint/rule-tester": "^7",
61+
"@typescript-eslint/scope-manager": "^7",
62+
"@typescript-eslint/utils": "^7",
5863
"babel-eslint": "^10.0.3",
5964
"babel-jest": "^24.9.0",
6065
"conditional-type-checks": "^1.0.5",
61-
"eslint": "^6.8.0",
62-
"eslint-config-prettier": "^6.8.0",
63-
"eslint-plugin-import": "^2.18.2",
64-
"eslint-plugin-jest": "^22.6.3",
65-
"eslint-plugin-prettier": "^3.1.1",
66-
"eslint-plugin-react": "^7.32.2",
67-
"eslint-plugin-react-hooks": "^4.6.0",
66+
"eslint": "8.56.0",
67+
"eslint-config-prettier": "^8.3.0",
68+
"eslint-plugin-import": "^2.20.1",
69+
"eslint-plugin-jest": "^26.6.0",
70+
"eslint-plugin-prettier": "^4.2.1",
71+
"eslint-plugin-react": "^7.36.1",
72+
"eslint-plugin-react-hooks": "5.2.0-canary-7b402084-20250107",
6873
"jest": "^29.5.0",
6974
"jest-environment-jsdom": "^29.5.0",
7075
"jsdom": "^22.0.0",

src/Components.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {FetchEphemeralKeyFunction} from './types';
1+
import type {FetchEphemeralKeyFunction} from './types';
22
import {useCreateComponent} from './useCreateComponent';
33
import {useUpdateWithSetter} from './utils/useUpdateWithSetter';
4-
import {
4+
import type {
55
LoadError,
66
LoaderStart,
77
NotificationCount,

src/ConnectComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import * as connectJs from '@stripe/connect-js';
2+
import type * as connectJs from '@stripe/connect-js';
33

44
type ConnectComponentsPayload = {
55
connectInstance: connectJs.StripeConnectInstance;

src/useCreateComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable react-hooks/exhaustive-deps */
22
import * as React from 'react';
33
import {useConnectComponents} from './ConnectComponents';
4-
import {
4+
import type {
55
ConnectElementTagName,
66
ConnectHTMLElementRecord,
77
} from '@stripe/connect-js';

src/utils/useAttachAttribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

33
/**
4-
* @deprecated The method should not be used as we are deprecating the use of attributes directly.
4+
* @deprecated The method should not be used as we are deprecating the use of attributes directly.
55
* Define a setter for your use case and use useUpdateWithSetter instead.
66
*/
77
export const useAttachAttribute = (

src/utils/useUpdateWithSetter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react';
2-
import {CollectionOptions} from '../Components';
3-
import {
2+
import type {CollectionOptions} from '../Components';
3+
import type {
44
LoadError,
55
LoaderStart,
66
NotificationCount,
77
StepChange,
88
PaymentsListDefaultFilters,
99
} from '@stripe/connect-js';
10-
import {FetchEphemeralKeyFunction} from '../types';
10+
import type {FetchEphemeralKeyFunction} from '../types';
1111

1212
export const useUpdateWithSetter = <
1313
T extends HTMLElement,

0 commit comments

Comments
 (0)