Skip to content

Commit

Permalink
Rename tsx files without JSX to ts files (#8085)
Browse files Browse the repository at this point in the history
This makes it clearer which files contain React components, and which do not.

# Important Notes
The main things that should be tested to confirm that this did not break anything is the two files containing Tailwind classes:
- Shortcuts ("delete" in context menu should still be red. `text-delete` is used elsewhere though, so this should not be broken either way)
- Indentation of directory contents (multiple levels)
Many of the others should more or less be self-testing:
- `index.tsx` -> `index.ts` would break the entire app if not handled properly
- `hooks.tsx` contains `useNavigate` which would break routing if absent, and `useToastAndLog` which would break most  toast notifications.
- `http.tsx` contains the HTTP client which would break all backend requests
- `useRefresh.tsx` would... break login and logout if it was broken I guess
  • Loading branch information
somebody1234 authored Nov 3, 2023
1 parent 8e20fc6 commit a7dba72
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/dashboard/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function bundle() {
})
opts.entryPoints.push(
path.resolve(THIS_PATH, 'src', 'index.html'),
path.resolve(THIS_PATH, 'src', 'index.tsx')
path.resolve(THIS_PATH, 'src', 'index.ts')
)
opts.metafile = ANALYZE
opts.loader['.html'] = 'copy'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/** @file Utilities for indenting elements. */

// Although this file does not contain JSX, it must be a `.tsx` file for Tailwind to include its
// strings as classes.

// =================
// === Constants ===
// =================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import UntrashIcon from 'enso-assets/untrash.svg'

import * as detect from 'enso-common/src/detect'

// This file MUST be a `.tsx` file so that Tailwind includes the CSS classes used here.

// =================
// === Constants ===
// =================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as loggerProvider from './providers/logger'
export function useToastAndLog() {
const logger = loggerProvider.useLogger()
return React.useCallback(
<T,>(
<T>(
messagePrefix: string | null,
error?: errorModule.MustNotBeKnown<T>,
options?: toastify.ToastOptions
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/dashboard/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)))

// The names come from a third-party API and cannot be changed.
/* eslint-disable no-restricted-syntax, @typescript-eslint/naming-convention */
export const content = [THIS_PATH + '/src/**/*.tsx']
export const content = [THIS_PATH + '/src/**/*.tsx', THIS_PATH + '/src/**/*.ts']
export const important = `:is(.enso-dashboard, .enso-chat)`
export const theme = {
extend: {
Expand Down
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/dashboard/test-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const OPTS = bundler.bundlerOptions({ outputPath: '/', devMode: true })
OPTS.define['REDIRECT_OVERRIDE'] = JSON.stringify(`http://localhost:${PORT}`)
OPTS.entryPoints.push(
path.resolve(THIS_PATH, 'src', 'index.html'),
path.resolve(THIS_PATH, 'src', 'index.tsx'),
path.resolve(THIS_PATH, 'src', 'index.ts'),
path.resolve(THIS_PATH, 'src', 'serviceWorker.ts')
)
OPTS.write = false
Expand Down
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/dashboard/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const OPTS = bundler.bundlerOptions({ outputPath: '/', devMode: process.env.DEV_
OPTS.define['REDIRECT_OVERRIDE'] = JSON.stringify(`http://localhost:${PORT}`)
OPTS.entryPoints.push(
path.resolve(THIS_PATH, 'src', 'index.html'),
path.resolve(THIS_PATH, 'src', 'index.tsx'),
path.resolve(THIS_PATH, 'src', 'index.ts'),
path.resolve(THIS_PATH, 'src', 'serviceWorker.ts')
)
OPTS.minify = false
Expand Down

0 comments on commit a7dba72

Please sign in to comment.