Skip to content

site: reduce printWidth to 80 #4437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions site/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"printWidth": 100,
"printWidth": 80,
"semi": false,
"trailingComma": "all",
"overrides": [
{
"files": ["./README.md", "**/*.yaml"],
"options": {
"printWidth": 80,
"proseWrap": "always"
}
}
Expand Down
6 changes: 5 additions & 1 deletion site/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ module.exports = {
//
// SEE: https://storybook.js.org/docs/react/configure/webpack
webpackFinal: async (config) => {
config.resolve.modules = [path.resolve(__dirname, ".."), "node_modules", "../src"]
config.resolve.modules = [
path.resolve(__dirname, ".."),
"node_modules",
"../src",
]
return config
},
}
5 changes: 4 additions & 1 deletion site/e2e/pom/SignInPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export class SignInPage extends BasePom {
super(baseURL, "/login", page)
}

async submitBuiltInAuthentication(email: string, password: string): Promise<void> {
async submitBuiltInAuthentication(
email: string,
password: string,
): Promise<void> {
await this.page.fill("text=Email", email)
await this.page.fill("text=Password", password)
await this.page.click("text=Sign In")
Expand Down
5 changes: 4 additions & 1 deletion site/e2e/tests/healthz.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { test } from "@playwright/test"
import { HealthzPage } from "../pom/HealthzPage"

test("Healthz is available without authentication", async ({ baseURL, page }) => {
test("Healthz is available without authentication", async ({
baseURL,
page,
}) => {
const healthzPage = new HealthzPage(baseURL, page)
await page.goto(healthzPage.url, { waitUntil: "networkidle" })
await healthzPage.getOk().waitFor({ state: "visible" })
Expand Down
7 changes: 6 additions & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
href="/favicons/favicon.png"
data-react-helmet="true"
/>
<link rel="icon" type="image/svg+xml" href="/favicons/favicon.svg" data-react-helmet="true" />
<link
rel="icon"
type="image/svg+xml"
href="/favicons/favicon.svg"
data-react-helmet="true"
/>
</head>

<body>
Expand Down
13 changes: 11 additions & 2 deletions site/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@ module.exports = {
{
displayName: "lint",
runner: "jest-runner-eslint",
testMatch: ["<rootDir>/**/*.js", "<rootDir>/**/*.ts", "<rootDir>/**/*.tsx"],
testPathIgnorePatterns: ["/out/", "/_jest/", "jest.config.js", "jest-runner.*.js"],
testMatch: [
"<rootDir>/**/*.js",
"<rootDir>/**/*.ts",
"<rootDir>/**/*.tsx",
],
testPathIgnorePatterns: [
"/out/",
"/_jest/",
"jest.config.js",
"jest-runner.*.js",
],
},
],
collectCoverageFrom: [
Expand Down
5 changes: 4 additions & 1 deletion site/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const CONSOLE_FAIL_TYPES = ["error" /* 'warn' */] as const
CONSOLE_FAIL_TYPES.forEach((logType: typeof CONSOLE_FAIL_TYPES[number]) => {
global.console[logType] = <Type>(format: string, ...args: Type[]): void => {
throw new Error(
`Failing due to console.${logType} while running test!\n\n${util.format(format, ...args)}`,
`Failing due to console.${logType} while running test!\n\n${util.format(
format,
...args,
)}`,
)
}
})
Expand Down
36 changes: 27 additions & 9 deletions site/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,42 @@ import { SettingsLayout } from "./components/SettingsLayout/SettingsLayout"
// - Pages that are secondary, not in the main navigation or not usually accessed
// - Pages that use heavy dependencies like charts or time libraries
const NotFoundPage = lazy(() => import("./pages/404Page/404Page"))
const CliAuthenticationPage = lazy(() => import("./pages/CliAuthPage/CliAuthPage"))
const CliAuthenticationPage = lazy(
() => import("./pages/CliAuthPage/CliAuthPage"),
)
const HealthzPage = lazy(() => import("./pages/HealthzPage/HealthzPage"))
const AccountPage = lazy(() => import("./pages/UserSettingsPage/AccountPage/AccountPage"))
const SecurityPage = lazy(() => import("./pages/UserSettingsPage/SecurityPage/SecurityPage"))
const SSHKeysPage = lazy(() => import("./pages/UserSettingsPage/SSHKeysPage/SSHKeysPage"))
const CreateUserPage = lazy(() => import("./pages/UsersPage/CreateUserPage/CreateUserPage"))
const WorkspaceBuildPage = lazy(() => import("./pages/WorkspaceBuildPage/WorkspaceBuildPage"))
const AccountPage = lazy(
() => import("./pages/UserSettingsPage/AccountPage/AccountPage"),
)
const SecurityPage = lazy(
() => import("./pages/UserSettingsPage/SecurityPage/SecurityPage"),
)
const SSHKeysPage = lazy(
() => import("./pages/UserSettingsPage/SSHKeysPage/SSHKeysPage"),
)
const CreateUserPage = lazy(
() => import("./pages/UsersPage/CreateUserPage/CreateUserPage"),
)
const WorkspaceBuildPage = lazy(
() => import("./pages/WorkspaceBuildPage/WorkspaceBuildPage"),
)
const WorkspacePage = lazy(() => import("./pages/WorkspacePage/WorkspacePage"))
const WorkspaceSchedulePage = lazy(
() => import("./pages/WorkspaceSchedulePage/WorkspaceSchedulePage"),
)
const TerminalPage = lazy(() => import("./pages/TerminalPage/TerminalPage"))
const CreateWorkspacePage = lazy(() => import("./pages/CreateWorkspacePage/CreateWorkspacePage"))
const CreateWorkspacePage = lazy(
() => import("./pages/CreateWorkspacePage/CreateWorkspacePage"),
)
const TemplatePage = lazy(() => import("./pages/TemplatePage/TemplatePage"))

export const AppRouter: FC = () => {
const xServices = useContext(XServiceContext)
const permissions = useSelector(xServices.authXService, selectPermissions)
const featureVisibility = useSelector(xServices.entitlementsXService, selectFeatureVisibility)
const featureVisibility = useSelector(
xServices.entitlementsXService,
selectFeatureVisibility,
)

return (
<Suspense fallback={<FullScreenLoader />}>
Expand Down Expand Up @@ -142,7 +159,8 @@ export const AppRouter: FC = () => {
<AuthAndFrame>
<RequirePermission
isFeatureVisible={
featureVisibility[FeatureNames.AuditLog] && Boolean(permissions?.viewAuditLog)
featureVisibility[FeatureNames.AuditLog] &&
Boolean(permissions?.viewAuditLog)
}
>
<AuditPage />
Expand Down
5 changes: 4 additions & 1 deletion site/src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import "./i18n"

// if this is a development build and the developer wants to inspect
// helpful to see realtime changes on the services
if (process.env.NODE_ENV === "development" && process.env.INSPECT_XSTATE === "true") {
if (
process.env.NODE_ENV === "development" &&
process.env.INSPECT_XSTATE === "true"
) {
// configure the XState inspector to open in a new tab
inspect({
url: "https://stately.ai/viz?inspect",
Expand Down
38 changes: 28 additions & 10 deletions site/src/api/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,39 @@ describe("api.ts", () => {
["/api/v2/workspaces", undefined, "/api/v2/workspaces"],

["/api/v2/workspaces", { q: "" }, "/api/v2/workspaces"],
["/api/v2/workspaces", { q: "owner:1" }, "/api/v2/workspaces?q=owner%3A1"],

["/api/v2/workspaces", { q: "owner:me" }, "/api/v2/workspaces?q=owner%3Ame"],
])(`Workspaces - getURLWithSearchParams(%p, %p) returns %p`, (basePath, filter, expected) => {
expect(getURLWithSearchParams(basePath, filter)).toBe(expected)
})
[
"/api/v2/workspaces",
{ q: "owner:1" },
"/api/v2/workspaces?q=owner%3A1",
],

[
"/api/v2/workspaces",
{ q: "owner:me" },
"/api/v2/workspaces?q=owner%3Ame",
],
])(
`Workspaces - getURLWithSearchParams(%p, %p) returns %p`,
(basePath, filter, expected) => {
expect(getURLWithSearchParams(basePath, filter)).toBe(expected)
},
)
})

describe("getURLWithSearchParams - users", () => {
it.each<[string, TypesGen.UsersRequest | undefined, string]>([
["/api/v2/users", undefined, "/api/v2/users"],
["/api/v2/users", { q: "status:active" }, "/api/v2/users?q=status%3Aactive"],
[
"/api/v2/users",
{ q: "status:active" },
"/api/v2/users?q=status%3Aactive",
],
["/api/v2/users", { q: "" }, "/api/v2/users"],
])(`Users - getURLWithSearchParams(%p, %p) returns %p`, (basePath, filter, expected) => {
expect(getURLWithSearchParams(basePath, filter)).toBe(expected)
})
])(
`Users - getURLWithSearchParams(%p, %p) returns %p`,
(basePath, filter, expected) => {
expect(getURLWithSearchParams(basePath, filter)).toBe(expected)
},
)
})
})
Loading