Skip to content

Commit 43a441f

Browse files
chore(site): align ESLint config to typescript-eslint's recommended-requiring-type-checking (#5797)
1 parent dd8eab5 commit 43a441f

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

site/.eslintrc.yaml

+21-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
extends:
99
- eslint:recommended
1010
- plugin:@typescript-eslint/recommended
11+
- plugin:@typescript-eslint/recommended-requiring-type-checking
1112
- plugin:eslint-comments/recommended
1213
- plugin:import/recommended
1314
- plugin:import/typescript
@@ -35,28 +36,38 @@ root: true
3536
rules:
3637
"@typescript-eslint/brace-style":
3738
["error", "1tbs", { "allowSingleLine": false }]
38-
"@typescript-eslint/camelcase": "off"
39-
"@typescript-eslint/explicit-function-return-type": "off"
4039
"@typescript-eslint/method-signature-style": ["error", "property"]
41-
"@typescript-eslint/no-floating-promises": error
42-
"@typescript-eslint/no-invalid-void-type": error
40+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
41+
"@typescript-eslint/no-misused-promises": "off"
42+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
43+
"@typescript-eslint/no-unsafe-argument": "off"
44+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
45+
"@typescript-eslint/no-unsafe-assignment": "off"
46+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
47+
"@typescript-eslint/no-unsafe-call": "off"
48+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
49+
"@typescript-eslint/no-unsafe-member-access": "off"
50+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
51+
"@typescript-eslint/no-unsafe-return": "off"
52+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
53+
"@typescript-eslint/require-await": "off"
54+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
55+
"@typescript-eslint/restrict-plus-operands": "off"
56+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
57+
"@typescript-eslint/restrict-template-expressions": "off"
58+
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
59+
"@typescript-eslint/unbound-method": "off"
4360
# We're disabling the `no-namespace` rule to use a pattern of defining an interface,
4461
# and then defining functions that operate on that data via namespace. This is helpful for
4562
# dealing with immutable objects. This is a common pattern that shows up in some other
4663
# large TypeScript projects, like VSCode.
4764
# More details: https://github.com/coder/m/pull/9720#discussion_r697609528
4865
"@typescript-eslint/no-namespace": "off"
49-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": error
50-
"@typescript-eslint/no-unnecessary-condition": warn
51-
"@typescript-eslint/no-unnecessary-type-assertion": warn
5266
"@typescript-eslint/no-unused-vars":
5367
- error
5468
- argsIgnorePattern: "^_"
5569
varsIgnorePattern: "^_"
5670
ignoreRestSiblings: true
57-
"@typescript-eslint/no-use-before-define": "off"
58-
"@typescript-eslint/object-curly-spacing": ["error", "always"]
59-
"@typescript-eslint/triple-slash-reference": "off"
6071
"brace-style": "off"
6172
"curly": ["error", "all"]
6273
"eslint-comments/require-description": "error"

site/src/api/api.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export const hardCodedCSRFCookie = (): string => {
2020
export const withDefaultFeatures = (
2121
fs: Partial<TypesGen.Entitlements["features"]>,
2222
): TypesGen.Entitlements["features"] => {
23-
for (const k in TypesGen.FeatureNames) {
24-
const feature = k as TypesGen.FeatureName
23+
for (const feature of TypesGen.FeatureNames) {
2524
// Skip fields that are already filled.
2625
if (fs[feature] !== undefined) {
2726
continue
@@ -140,8 +139,7 @@ export const getTokens = async (): Promise<TypesGen.APIKey[]> => {
140139
}
141140

142141
export const deleteAPIKey = async (keyId: string): Promise<void> => {
143-
const response = await axios.delete("/api/v2/users/me/keys/" + keyId)
144-
return response.data
142+
await axios.delete("/api/v2/users/me/keys/" + keyId)
145143
}
146144

147145
export const getUsers = async (

site/src/pages/TemplateSettingsPage/TemplateSettingsPage.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const fillAndSubmitForm = async ({
6565
await userEvent.clear(maxTtlField)
6666
await userEvent.type(maxTtlField, default_ttl_ms.toString())
6767

68-
const allowCancelJobsField = await screen.getByRole("checkbox")
68+
const allowCancelJobsField = screen.getByRole("checkbox")
6969
// checkbox is checked by default, so it must be clicked to get unchecked
7070
if (!allow_user_cancel_workspace_jobs) {
7171
await userEvent.click(allowCancelJobsField)

site/src/pages/UsersPage/UsersPage.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ describe("UsersPage", () => {
249249
expect(API.getUsers).toBeCalledWith({ offset: 0, limit: 25, q: "" }),
250250
)
251251

252-
const pageButtons = await container.querySelectorAll(
252+
const pageButtons = container.querySelectorAll(
253253
`button[name="Page button"]`,
254254
)
255255
// count handler says there are 2 pages of results

site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe("WorkspacesPage", () => {
4949
name: "Previous page",
5050
})
5151
expect(prevPage).toBeDisabled()
52-
const pageButtons = await container.querySelectorAll(
52+
const pageButtons = container.querySelectorAll(
5353
`button[name="Page button"]`,
5454
)
5555
expect(pageButtons.length).toBe(2)

site/src/xServices/users/searchUserXService.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export const searchUserMachine = createMachine(
5151
{
5252
services: {
5353
searchUsers: async (_, { query }) =>
54-
await (
55-
await getUsers(queryToFilter(query))
56-
).users,
54+
(await getUsers(queryToFilter(query))).users,
5755
},
5856
actions: {
5957
assignSearchResults: assign({

0 commit comments

Comments
 (0)