Skip to content

Commit 2968484

Browse files
committed
lint: prefer-const
1 parent 16cd4a3 commit 2968484

33 files changed

+725
-726
lines changed

eslint.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default [
3232
"no-empty": "off",
3333
"no-unsafe-optional-chaining": "off",
3434
"no-useless-escape": "off",
35-
"prefer-const": "off",
3635
"react/jsx-key": "off",
3736
"react/no-unescaped-entities": "off",
3837
"jsx-a11y/alt-text": "off",

src/app/App.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ export const ImportStateButton: React.FC<{}> = ({ }) => {
8585

8686
const dispatch = useDispatch();
8787

88-
let $uploadStateFile = React.createRef<HTMLInputElement>();
88+
const $uploadStateFile = React.createRef<HTMLInputElement>();
8989

90-
let handleFileUpload = (event: React.FormEvent<HTMLElement>): void => {
90+
const handleFileUpload = (event: React.FormEvent<HTMLElement>): void => {
9191
const target: any = event.target;
9292
if (target && target.files) {
93-
for (let file of target.files) {
93+
for (const file of target.files) {
9494
//const file: File = target.files[0];
9595
(file as File).text().then((text) => {
9696
try {
97-
let savedState = JSON.parse(text);
97+
const savedState = JSON.parse(text);
9898
dispatch(dfActions.loadState(savedState));
9999
} catch {
100100

@@ -124,8 +124,8 @@ export const ExportStateButton: React.FC<{}> = ({}) => {
124124
return <Tooltip title="save session locally">
125125
<Button variant="text" onClick={()=>{
126126
function download(content: string, fileName: string, contentType: string) {
127-
let a = document.createElement("a");
128-
let file = new Blob([content], {type: contentType});
127+
const a = document.createElement("a");
128+
const file = new Blob([content], {type: contentType});
129129
a.href = URL.createObjectURL(file);
130130
a.download = fileName;
131131
a.click();
@@ -182,8 +182,8 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
182182
.then(function(response) { return response.json(); })
183183
.then(function(result) {
184184
if (Array.isArray(result) && result.length > 0) {
185-
let authInfo = result[0];
186-
let userInfo = {
185+
const authInfo = result[0];
186+
const userInfo = {
187187
name: authInfo['user_claims'].find((item: any) => item.typ == 'name')?.val || '',
188188
userId: authInfo['user_id']
189189
}
@@ -205,7 +205,7 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
205205
dispatch(fetchAvailableModels());
206206
}, []);
207207

208-
let theme = createTheme({
208+
const theme = createTheme({
209209
typography: {
210210
fontFamily: [
211211
"Arial",
@@ -230,7 +230,7 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
230230
},
231231
});
232232

233-
let switchers = (
233+
const switchers = (
234234
<Box sx={{ display: "flex" }} key="switchers">
235235
<ToggleButtonGroup
236236
color="primary"
@@ -262,7 +262,7 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
262262
</Box>
263263
)
264264

265-
let appBar = [
265+
const appBar = [
266266
<AppBar className="app-bar" position="static" key="app-bar-main">
267267
<Toolbar variant="dense" sx={{backgroundColor: betaMode ? 'lavender' : ''}}>
268268
<Button href={"/"} sx={{display: "flex", flexDirection: "row", textTransform: "none",
@@ -345,7 +345,7 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
345345
// </Dialog>
346346
];
347347

348-
let router = createBrowserRouter([
348+
const router = createBrowserRouter([
349349
{
350350
path: "/about",
351351
element: <About />,
@@ -358,7 +358,7 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
358358
}
359359
]);
360360

361-
let app =
361+
const app =
362362
<Box sx={{ flexGrow: 1, height: '100%', overflow: "hidden", display: "flex", flexDirection: "column"}}>
363363
{appBar}
364364
<RouterProvider router={router} />
@@ -375,7 +375,7 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
375375
function stringAvatar(name: string) {
376376
let displayName = ""
377377
try {
378-
let nameSplit = name.split(' ')
378+
const nameSplit = name.split(' ')
379379
displayName = `${nameSplit[0][0]}${nameSplit.length > 1 ? nameSplit[nameSplit.length-1][0] : ''}`
380380
} catch {
381381
displayName = name ? name[0] : "?";

0 commit comments

Comments
 (0)