Update typescript configs

This commit is contained in:
Declan Chidlow 2024-07-13 20:18:12 +08:00
parent 13db769a22
commit bfd2ea2094
5 changed files with 53 additions and 31 deletions

View file

@ -1,28 +1,32 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
// Some stricter flags (enabled)
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true,
// Additional improvements
"esModuleInterop": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"useDefineForClassFields": true,
"types": ["bun-types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]

View file

@ -1,4 +1,4 @@
import { Route, BrowserRouter, Routes, useLocation } from 'react-router-dom';
import { Route, BrowserRouter, Routes } from 'react-router-dom';
import Home from './pages/Home';
import './App.css';
import '@revoltchat/ui/src/styles/dark.css';
@ -9,10 +9,10 @@ import ServerDashboard from './pages/ServerDashboard/ServerDashboard';
import localforage from 'localforage';
import TexPage from './pages/Tex';
const API_URL = import.meta.env.VITE_API_URL?.toString()
const API_URL = import.meta.env['VITE_API_URL']?.toString()
|| 'http://localhost:9000';
const BOT_PREFIX = import.meta.env.VITE_BOT_PREFIX?.toString()
const BOT_PREFIX = import.meta.env['VITE_BOT_PREFIX']?.toString()
|| '/';
function App() {

View file

@ -1,4 +1,4 @@
import { FunctionComponent, useState } from "react";
import { FunctionComponent } from "react";
import './styles/CategorySelector.css';
const CategorySelector: FunctionComponent<{ keys: { id: string, name: string }[], selected: string, onChange: (key: string) => void }> = (props) => {

View file

@ -106,14 +106,14 @@ const ServerDashboard: FunctionComponent = () => {
const server: Server = res.data.server;
setServerInfo(server);
setPrefix(server.serverConfig?.prefix || '');
setPrefixAllowSpace(!!server.serverConfig?.spaceAfterPrefix);
setDmOnKick(!!server.serverConfig?.dmOnKick);
setDmOnWarn(!!server.serverConfig?.dmOnWarn);
setContact(server.serverConfig?.contact || '');
setPrefix(server.serverConfig?.['prefix'] || '');
setPrefixAllowSpace(!!server.serverConfig?.['spaceAfterPrefix']);
setDmOnKick(!!server.serverConfig?.['dmOnKick']);
setDmOnWarn(!!server.serverConfig?.['dmOnWarn']);
setContact(server.serverConfig?.['contact'] || '');
setBotManagers(server.serverConfig?.botManagers ?? []);
setModerators(server.serverConfig?.moderators ?? []);
setBotManagers(server.serverConfig?.['botManagers'] ?? []);
setModerators(server.serverConfig?.['moderators'] ?? []);
loadAutomodInfo(server);
} catch(e: any) {

View file

@ -1,20 +1,38 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "Node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noEmit": true,
// Some stricter flags (enabled)
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true,
// Additional improvements
"useDefineForClassFields": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"include": ["./src"]
"incremental": true
},
"include": ["./src/**/*"],
"exclude": ["node_modules", "dist"]
}