Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian McKenzie committed Nov 14, 2022
1 parent 8a8dcaf commit e5e392b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
3 changes: 1 addition & 2 deletions website/src/frontend-scripts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ export const matchesDark: undefined | MediaQueryList =
export function getCurrentTheme(): ThemeName {
let currentScheme = window.localStorage.getItem("data-theme");
if (currentScheme == null) {
currentScheme =
matchesDark !== undefined && matchesDark.matches ? "dark" : "light";
currentScheme = matchesDark?.matches ? "dark" : "light";
}
return currentScheme === "dark" ? "dark" : "light";
}
Expand Down
5 changes: 1 addition & 4 deletions website/src/playground/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
PlaygroundProps,
RomeAstSyntacticData,
} from "./types";
import type { PlaygroundProps, RomeAstSyntacticData } from "./types";
import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
import CodeMirror from "./CodeMirror";
import type { ViewUpdate } from "@codemirror/view";
Expand Down
6 changes: 3 additions & 3 deletions website/src/playground/tabs/DiagnosticsListTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ function renderDiagnosticMessage(diagnostic: Diagnostic) {
function DiagnosticIcon({ severity }: { severity: Diagnostic["severity"] }) {
switch (severity) {
case "Information":
return <img src={infoIcon} />;
return <img alt="Info" src={infoIcon} />;

case "Warning":
return <img src={warningIcon} />;
return <img alt="Warning" src={warningIcon} />;

default:
return <img src={errorIcon} />;
return <img alt="Error" src={errorIcon} />;
}
}

Expand Down
14 changes: 11 additions & 3 deletions website/src/playground/tabs/SettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ export default function SettingsTab({
return state;
}

const { [state.currentFile]: _, ...otherFiles } = state.files;

const files: PlaygroundState["files"] = {
...state.files,
...otherFiles,
[newFilename]: state.files[state.currentFile]!,
};
delete files[state.currentFile];

return {
...state,
currentFile: newFilename,
Expand All @@ -97,6 +99,7 @@ export default function SettingsTab({

function createFile(filename: string) {
if (
// rome-ignore lint(complexity/useSimplifiedLogicExpression): Not sure how else to do this
!isScriptFilename(filename) &&
!isJSXFilename(filename) &&
!isTypeScriptFilename(filename)
Expand Down Expand Up @@ -233,7 +236,11 @@ function FileViewItem({
onClick: () => void;
}) {
return (
<li className={classnames(isActive && "active")} onClick={onClick}>
<li
className={classnames(isActive && "active")}
onClick={onClick}
onKeyDown={onClick}
>
{filename}
</li>
);
Expand Down Expand Up @@ -273,6 +280,7 @@ function NewFileInput({
return (
<input
type="text"
// rome-ignore lint(a11y/noAutofocus): Not sure how else to do this
autoFocus={true}
onKeyDown={onKeyDown}
onChange={onChange}
Expand Down
2 changes: 1 addition & 1 deletion website/src/playground/workers/romeWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ self.addEventListener("message", async (e) => {
syntax: {
// Replace 4 spaced indentation with 2
// TODO replace this in Rome itself
ast: syntaxTree.ast.replace(/ /g, " "),
ast: syntaxTree.ast.replace(/ {4}/g, " "),
cst: syntaxTree.cst,
},
diagnostics: {
Expand Down

0 comments on commit e5e392b

Please sign in to comment.