chore: use Oxlint for frontend JavaScript and TypeScript lint (#32830)
> 🤖 This PR was written by Codex on behalf of Jake Howell. Use Oxlint for JavaScript and TypeScript linting in `site`, including the check and fix scripts. Biome handles formatting, import organization, and linting for files such as CSS and JSON. `make fmt/ts` invokes Biome directly for its formatting pass. The cutover retires Biome-only JavaScript and TypeScript coverage, including `noUnusedTemplateLiteral`, `noVoidTypeReturn`, and `noDynamicNamespaceImportAccess`. Oxlint enforces the restricted named imports for static imports and re-exports. Biome also checked named bindings obtained through dynamic imports, such as destructuring `toast` from `await import("sonner")`. TODO: `oxfmt` is the next target 🙂 Refs #31148 Depends on #32829
This commit is contained in:
1 parent
f2843c3678
commit
07ed8eb4f4
8 files changed
+13
-15
No files matched your search
@@ -703,9 +703,9 @@ else
|
||||
cd site
|
||||
# Avoid writing files in CI to reduce file write activity
|
||||
ifdef CI
|
||||
pnpm run check --linter-enabled=false
|
||||
pnpm exec biome check --error-on-warnings --linter-enabled=false .
|
||||
else
|
||||
pnpm run check:fix
|
||||
pnpm exec biome check --error-on-warnings --fix .
|
||||
endif
|
||||
endif
|
||||
.PHONY: fmt/ts
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ Use the TypeScript language server when available for definitions, references, t
|
||||
| Unit tests | `pnpm test` |
|
||||
| One unit file | `pnpm test path/to/file.test.ts` |
|
||||
| Typecheck | `pnpm lint:types` |
|
||||
| Biome check | `pnpm check` |
|
||||
| Code check | `pnpm check` |
|
||||
| Lint | `pnpm lint` |
|
||||
| Fix lint | `pnpm lint:fix` |
|
||||
| Format | `pnpm format` |
|
||||
@@ -49,7 +49,7 @@ Some end-to-end tests require a license. The Storybook MCP at `http://localhost:
|
||||
|
||||
## TypeScript and data flow
|
||||
|
||||
- Use ES modules and Biome. Prefer `for...of` over `forEach`.
|
||||
- Use ES modules. Run Oxlint for JavaScript and TypeScript linting and Biome for formatting. Prefer `for...of` over `forEach`.
|
||||
- Access browser globals directly. This is a client-only SPA, so do not guard them with `typeof window` or similar checks.
|
||||
- Components must not call API functions directly. Use established React Query definitions and key hierarchies.
|
||||
- Use `mutate()` with callbacks when the result does not need to be awaited. Do not swallow mutation failures in empty catches.
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"files": {
|
||||
"includes": ["!e2e/**/*Generated.ts", "!scripts/*.mjs", "!src/vendor"]
|
||||
},
|
||||
"javascript": {
|
||||
"linter": { "enabled": false }
|
||||
},
|
||||
"linter": {
|
||||
"rules": {
|
||||
"a11y": {
|
||||
|
||||
+5
-5
@@ -7,21 +7,21 @@
|
||||
"packageManager": "pnpm@12.16.1+sha512.091d1dee7927575661b25dab3c2ae31cafc1c54d6b71ed6a6600cf0c1cb10434a447eae14015f1b23e2e6bedeed79df94a932e2164d2832280dce3fb32f656d1",
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production pnpm vite build",
|
||||
"check": "biome check --error-on-warnings .",
|
||||
"check:fix": "biome check --error-on-warnings --fix .",
|
||||
"check": "biome check --error-on-warnings . && pnpm run lint:oxlint",
|
||||
"check:fix": "pnpm run lint:oxlint --fix; lint_status=$?; biome check --error-on-warnings --fix . && exit \"$lint_status\"",
|
||||
"check:all": "pnpm check && pnpm test",
|
||||
"dev": "vite",
|
||||
"format": "biome format --write .",
|
||||
"format:check": "biome format .",
|
||||
"lint": "pnpm run lint:check && pnpm run lint:oxlint && pnpm run lint:types && pnpm run lint:circular-deps && pnpm run lint:compiler && pnpm run lint:sentence-case && knip",
|
||||
"lint": "pnpm run lint:check && pnpm run lint:types && pnpm run lint:circular-deps && pnpm run lint:compiler && pnpm run lint:sentence-case && knip",
|
||||
"lint:compiler": "node scripts/check-compiler.mjs",
|
||||
"lint:sentence-case": "node scripts/check-sentence-case.mjs",
|
||||
"lint:check": "biome lint --error-on-warnings .",
|
||||
"lint:check": "biome lint --error-on-warnings . && pnpm run lint:oxlint",
|
||||
"lint:oxlint": "oxlint --deny-warnings",
|
||||
"lint:design-system": "oxlint --config .oxlintrc.design-system.jsonc",
|
||||
"lint:circular-deps": "dpdm --no-tree --no-warning -T ./src/App.tsx",
|
||||
"lint:knip": "knip",
|
||||
"lint:fix": "biome lint --error-on-warnings --write . && knip --fix",
|
||||
"lint:fix": "biome lint --error-on-warnings --write . && pnpm run lint:oxlint --fix && knip --fix",
|
||||
"lint:types": "tsc -p .",
|
||||
"playwright:install": "playwright install --with-deps chromium",
|
||||
"playwright:test": "make -C .. site/e2e/bin/coder && playwright test --config=e2e/playwright.config.ts",
|
||||
|
||||
@@ -482,8 +482,6 @@ export const MultiSelectCombobox: React.FC<MultiSelectComboboxProps> = ({
|
||||
heading={key}
|
||||
className="h-full overflow-auto"
|
||||
>
|
||||
{/* biome-ignore lint/complexity/noUselessFragments: A parent element is
|
||||
needed for multiple dropdown items */}
|
||||
<>
|
||||
{dropdowns.map((option) => {
|
||||
return (
|
||||
|
||||
@@ -21,7 +21,6 @@ export const DashboardLayout: React.FC = () => {
|
||||
<AnnouncementBanners />
|
||||
|
||||
<div className="flex flex-col min-h-screen justify-between">
|
||||
{/* biome-ignore lint/a11y/useValidAnchor: Skip links use fragment anchors by design. */}
|
||||
<a
|
||||
href="#main-content"
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -34,8 +34,7 @@ export const WorkspaceOutdatedTooltip: React.FC<
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
// Keep trigger clicks from triggering a parent clickable row's navigation.
|
||||
// Radix composes its own click handler, so the popover still opens. The
|
||||
// span's key handlers only satisfy Biome's lint/a11y/useKeyWithClickEvents.
|
||||
// Radix composes its own click handler, so the popover still opens.
|
||||
const stopPropagation = (event: React.SyntheticEvent) => {
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
@@ -192,7 +192,6 @@ const AgentChatSendMenu: React.FC<AgentChatSendMenuProps> = ({
|
||||
asChild
|
||||
disabled
|
||||
type={undefined}
|
||||
// biome-ignore lint/a11y/useValidAriaValues: undefined removes the Radix default.
|
||||
aria-haspopup={undefined}
|
||||
aria-expanded={undefined}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user