Skip to content

Commit c067b1a

Browse files
committed
annotate type-only imports
1 parent 7604a1e commit c067b1a

75 files changed

Lines changed: 201 additions & 176 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,29 @@ module.exports = {
7777
"@graphql-eslint/variables-in-allowed-position": "error",
7878
},
7979
},
80+
{
81+
files: ["**/*.{ts,tsx}"],
82+
rules: {
83+
"@typescript-eslint/consistent-type-imports": [
84+
"error",
85+
{
86+
prefer: "type-imports",
87+
fixStyle: "inline-type-imports",
88+
},
89+
],
90+
"@typescript-eslint/no-unused-vars": [
91+
"error",
92+
{
93+
argsIgnorePattern: "^_",
94+
varsIgnorePattern: "^_",
95+
args: "after-used",
96+
ignoreRestSiblings: true,
97+
},
98+
],
99+
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
100+
"import/no-duplicates": ["error", { "prefer-inline": true }],
101+
},
102+
},
80103
],
81104
parserOptions: {
82105
ecmaVersion: 2018,
@@ -111,15 +134,6 @@ module.exports = {
111134
rules: {
112135
"react-hooks/rules-of-hooks": "error",
113136
"react-hooks/exhaustive-deps": "error",
114-
"@typescript-eslint/no-unused-vars": [
115-
"error",
116-
{
117-
argsIgnorePattern: "^_",
118-
varsIgnorePattern: "^_",
119-
args: "after-used",
120-
ignoreRestSiblings: true,
121-
},
122-
],
123137
"no-unused-expressions": [
124138
"error",
125139
{

@app/__tests__/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Pool, PoolClient } from "pg";
1+
import { Pool, type PoolClient } from "pg";
22

33
const pools: { [key: string]: Pool } = {};
44

@app/client/src/pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "antd/dist/reset.css";
22
import "nprogress/nprogress.css";
33
import "../styles.css";
44

5-
import { ApolloClient, ApolloProvider } from "@apollo/client";
5+
import { type ApolloClient, ApolloProvider } from "@apollo/client";
66
import { setGraphileApp, withApollo } from "@app/lib";
77
import { ConfigProvider, notification } from "antd";
88
import App from "next/app";

@app/client/src/pages/_document.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Document, {
2-
DocumentContext,
2+
type DocumentContext,
33
Head,
44
Html,
55
Main,

@app/client/src/pages/_error.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "@app/components";
88
import { useSharedQuery } from "@app/graphql";
99
import { Alert, Col, Row } from "antd";
10-
import { NextPage } from "next";
10+
import { type NextPage } from "next";
1111
import Link from "next/link";
1212
import * as React from "react";
1313

@app/client/src/pages/create-organization/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { PageHeader } from "@ant-design/pro-layout";
2-
import { ApolloError } from "@apollo/client";
2+
import { type ApolloError } from "@apollo/client";
33
import { AuthRestrict, Redirect, SharedLayout } from "@app/components";
44
import {
5-
CreatedOrganizationFragment,
5+
type CreatedOrganizationFragment,
66
useCreateOrganizationMutation,
77
useOrganizationBySlugLazyQuery,
88
useSharedQuery,
@@ -15,8 +15,8 @@ import {
1515
} from "@app/lib";
1616
import { Alert, Button, Col, Form, Input, Row, Spin, Typography } from "antd";
1717
import { debounce } from "lodash";
18-
import { NextPage } from "next";
19-
import { Store } from "rc-field-form/lib/interface";
18+
import { type NextPage } from "next";
19+
import { type Store } from "rc-field-form/lib/interface";
2020
import React, { useCallback, useEffect, useMemo, useState } from "react";
2121
import slugify from "slugify";
2222

@app/client/src/pages/forgot.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { UserOutlined } from "@ant-design/icons";
2-
import { ApolloError } from "@apollo/client";
2+
import { type ApolloError } from "@apollo/client";
33
import { AuthRestrict, SharedLayout } from "@app/components";
44
import { useForgotPasswordMutation, useSharedQuery } from "@app/graphql";
55
import { extractError, getCodeFromError } from "@app/lib";
6-
import type { InputRef } from "antd";
7-
import { Alert, Button, Form, Input } from "antd";
8-
import { NextPage } from "next";
6+
import { Alert, Button, Form, Input, type InputRef } from "antd";
7+
import { type NextPage } from "next";
98
import Link from "next/link";
10-
import { Store } from "rc-field-form/lib/interface";
9+
import { type Store } from "rc-field-form/lib/interface";
1110
import React, { useCallback, useEffect, useRef, useState } from "react";
1211

1312
const { useForm } = Form;

@app/client/src/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from "react";
33
const { Text, Title, Paragraph } = Typography;
44
import { SharedLayout } from "@app/components";
55
import { useSharedQuery } from "@app/graphql";
6-
import { NextPage } from "next";
6+
import { type NextPage } from "next";
77

88
// Convenience helper
99
const Li = ({ children, ...props }: any) => (

@app/client/src/pages/invitations/accept.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QueryResult } from "@apollo/client";
1+
import { type QueryResult } from "@apollo/client";
22
import {
33
AuthRestrict,
44
ButtonLink,
@@ -8,18 +8,18 @@ import {
88
SpinPadded,
99
} from "@app/components";
1010
import {
11-
InvitationDetailQuery,
12-
InvitationDetailQueryVariables,
13-
SharedLayout_UserFragment,
11+
type InvitationDetailQuery,
12+
type InvitationDetailQueryVariables,
13+
type SharedLayout_UserFragment,
1414
useAcceptOrganizationInviteMutation,
1515
useInvitationDetailQuery,
1616
} from "@app/graphql";
1717
import { getCodeFromError } from "@app/lib";
1818
import { Button, Col, Result, Row, Skeleton } from "antd";
19-
import { NextPage } from "next";
20-
import Router, { NextRouter, useRouter } from "next/router";
19+
import { type NextPage } from "next";
20+
import Router, { type NextRouter, useRouter } from "next/router";
2121
import * as qs from "querystring";
22-
import React, { FC } from "react";
22+
import React, { type FC } from "react";
2323

2424
interface IProps {
2525
id: string | null;

@app/client/src/pages/login.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { LockOutlined, UserAddOutlined, UserOutlined } from "@ant-design/icons";
2-
import { ApolloError, useApolloClient } from "@apollo/client";
2+
import { type ApolloError, useApolloClient } from "@apollo/client";
33
import {
44
AuthRestrict,
55
ButtonLink,
66
Col,
77
Redirect,
88
Row,
99
SharedLayout,
10-
SharedLayoutChildProps,
10+
type SharedLayoutChildProps,
1111
SocialLoginOptions,
1212
} from "@app/components";
1313
import { useLoginMutation, useSharedQuery } from "@app/graphql";
@@ -16,12 +16,11 @@ import {
1616
getCodeFromError,
1717
resetWebsocketConnection,
1818
} from "@app/lib";
19-
import type { InputRef } from "antd";
20-
import { Alert, Button, Form, Input } from "antd";
21-
import { NextPage } from "next";
19+
import { Alert, Button, Form, Input, type InputRef } from "antd";
20+
import { type NextPage } from "next";
2221
import Link from "next/link";
2322
import Router from "next/router";
24-
import { Store } from "rc-field-form/lib/interface";
23+
import { type Store } from "rc-field-form/lib/interface";
2524
import React, { useCallback, useEffect, useRef, useState } from "react";
2625

2726
interface LoginProps {

0 commit comments

Comments
 (0)