From 50127cc2b225908668db90d610a85ded2ec06815 Mon Sep 17 00:00:00 2001 From: Divyanshu Agrawal Date: Fri, 24 Nov 2023 15:50:43 +0530 Subject: [PATCH] Fix lints and tests. --- .prettierrc.json | 3 ++- src/companion.ts | 3 ++- src/types.ts | 1 + src/webview/frontend/App.tsx | 5 +++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 779e350..d4b5cdd 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -4,5 +4,6 @@ "semi": true, "singleQuote": true, "trailingComma": "all", - "proseWrap": "always" + "proseWrap": "always", + "endOfLine": "crlf" } diff --git a/src/companion.ts b/src/companion.ts index ebf4f76..e2ccddb 100644 --- a/src/companion.ts +++ b/src/companion.ts @@ -18,6 +18,7 @@ import { spawn } from 'child_process'; import { getJudgeViewProvider } from './extension'; import { words_in_text } from './utilsPure'; import telmetry from './telmetry'; +import os from 'os'; const emptyResponse: CphEmptyResponse = { empty: true }; let savedResponse: CphEmptyResponse | CphSubmitResponse = emptyResponse; @@ -26,7 +27,7 @@ const COMPANION_LOGGING = false; export const submitKattisProblem = (problem: Problem) => { globalThis.reporter.sendTelemetryEvent(telmetry.SUBMIT_TO_KATTIS); const srcPath = problem.srcPath; - const homedir = require('os').homedir(); + const homedir = os.homedir(); let submitPath = `${homedir}/.kattis/submit.py`; if (process.platform == 'win32') { if ( diff --git a/src/types.ts b/src/types.ts index 77f30a4..856c30c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,4 @@ +/* eslint no-var: off */ import TelemetryReporter from '@vscode/extension-telemetry'; import * as vscode from 'vscode'; diff --git a/src/webview/frontend/App.tsx b/src/webview/frontend/App.tsx index 0d885b3..389d50a 100644 --- a/src/webview/frontend/App.tsx +++ b/src/webview/frontend/App.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useReducer } from 'react'; -import ReactDOM from 'react-dom'; +import { createRoot } from 'react-dom/client'; import { Problem, WebviewToVSEvent, @@ -678,4 +678,5 @@ function App() { } } -ReactDOM.render(, document.getElementById('app')); +const root = createRoot(document.getElementById('app')!); +root.render();