Skip to content

Commit 86ca964

Browse files
Linter setup and fixes
1 parent 9b67c90 commit 86ca964

18 files changed

+125
-536
lines changed

.env.development.local

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_APP_API_BASE_URL='http://localhost:8001/api'

client/.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_APP_API_BASE_URL='/api'

client/.gitignore

Lines changed: 0 additions & 26 deletions
This file was deleted.

client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
</head>
99
<body>
1010
<div id="root"></div>
11-
<script type="module" src="/src/main.tsx"></script>
11+
<script type="module" src="/src/index.tsx"></script>
1212
</body>
1313
</html>

client/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,34 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build": "yarn lint --fix && tsc && vite build --mode production",
99
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1010
"preview": "vite preview"
1111
},
12+
"engines": {
13+
"node": ">=20"
14+
},
1215
"dependencies": {
1316
"antd": "^5.12.7",
1417
"autoprefixer": "^10.4.16",
1518
"compare-versions": "^6.1.0",
16-
"postcss": "^8.4.32",
1719
"react": "^18.2.0",
1820
"react-dom": "^18.2.0",
1921
"react-router-dom": "^6.21.1",
20-
"react-toggle-dark-mode": "^1.1.1",
21-
"tailwindcss": "^3.4.0"
22+
"react-toggle-dark-mode": "^1.1.1"
2223
},
2324
"devDependencies": {
2425
"@types/react": "^18.2.43",
2526
"@types/react-dom": "^18.2.17",
26-
"@typescript-eslint/eslint-plugin": "^6.14.0",
27-
"@typescript-eslint/parser": "^6.14.0",
27+
"@typescript-eslint/eslint-plugin": "^7.4.0",
28+
"@typescript-eslint/parser": "^7.4.0",
2829
"@vitejs/plugin-react": "^4.2.1",
29-
"eslint": "^8.55.0",
30+
"eslint": "^8.57.0",
3031
"eslint-plugin-react-hooks": "^4.6.0",
3132
"eslint-plugin-react-refresh": "^0.4.5",
3233
"sass": "^1.69.6",
33-
"typescript": "^5.2.2",
34+
"strip-ansi": "^7.1.0",
35+
"typescript": "^5.4.3",
3436
"vite": "^5.0.8",
3537
"vite-plugin-svgr": "^4.2.0"
3638
}

client/postcss.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

client/src/App.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ import './App.scss';
1515

1616
import NopalmLogo from './logos/NopalmLogo';
1717

18-
import SocialMediaLinks from './components/SocialMediaLinks';
18+
// import SocialMediaLinks from './components/SocialMediaLinks';
1919

20-
import { AppProps } from './helpers/types';
20+
import { AppProps, SettingsResultProps } from './helpers/types';
2121

22-
const { Header, Content, Footer, Sider } = Layout;
22+
const { Header, Content, Sider } = Layout;
2323

2424
type MenuItem = Required<MenuProps>['items'][number];
2525

26-
const routesToPages: any = {
26+
const routesToPages: {
27+
[key: string]: (settings: SettingsResultProps, reflectUpdatedUserSettings?: () => void ) => JSX.Element
28+
} = {
2729
project_details: (settings) => <ProjectDetails settings={settings} />,
2830
packages: (settings) => <Packages settings={settings} />,
29-
settings: (settings, reflectUpdatedUserSettings) => <Settings settings={settings} reflectUpdatedUserSettings={reflectUpdatedUserSettings}/>,
31+
settings: (settings, reflectUpdatedUserSettings) => <Settings settings={settings} reflectUpdatedUserSettings={reflectUpdatedUserSettings}/>,
3032
};
3133

3234
function getMenuItem(

client/src/api/Dataservice.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// Testing
2-
const API_BASE_URL = 'http://localhost:8001/api';
3-
4-
// Actual
5-
// const API_BASE_URL = '/api'
1+
const API_BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
62

73
import { InstalledPackageProps, ProjectDetailsProps, SettingsResultProps } from '../helpers/types';
84

client/src/components/PackageCard.tsx

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ const PackageCard: React.FC<PackageCardProps> = (props: PackageCardProps) => {
4343
try {
4444
await Dataservice.updatePackage(props.package.name, props.package.installed_version, checked);
4545

46-
debugger;
4746
setIsDevDepToggleLoading(false);
4847

4948
props.reRenderPackages();
5049

5150
return notify('Updated the package', `Successfully updated the package as ${checked ? 'dev' : 'normal'} dependency`, 'success');
5251
} catch (ex) {
53-
console.log('imma here')
54-
debugger;
5552
const msg = `Error updating the package ${props.package.name}`;
5653

5754
console.error(msg, ex);
@@ -64,48 +61,36 @@ const PackageCard: React.FC<PackageCardProps> = (props: PackageCardProps) => {
6461
props.modifyListOfPackagesToInstall(props.package.name, selectedVersionToInstall, isDevPackage)
6562
}
6663

67-
function uninstallPackage(packageName: string) {
68-
return new Promise(async (resolve, reject) => {
69-
try {
70-
await Dataservice.uninstallPackage(packageName);
71-
72-
props.reRenderPackages();
73-
74-
notify('Uninstalled Package', `Successfully uninstalled package ${packageName}`, 'success');
64+
async function uninstallPackage(packageName: string) {
65+
try {
66+
await Dataservice.uninstallPackage(packageName);
7567

76-
resolve('success');
77-
} catch (ex) {
78-
const msg = `Error uninstalling package ${packageName}`;
68+
props.reRenderPackages();
7969

80-
console.error(msg, ex);
70+
return notify('Uninstalled Package', `Successfully uninstalled package ${packageName}`, 'success');
71+
} catch (ex) {
72+
const msg = `Error uninstalling package ${packageName}`;
8173

82-
notify('Uninstalling Package', msg, 'error');
74+
console.error(msg, ex);
8375

84-
reject('failure')
85-
}
86-
});
76+
return notify('Uninstalling Package', msg, 'error');
77+
}
8778
}
8879

89-
function updatePackage(packageName: string, version: string) {
90-
return new Promise(async (resolve, reject) => {
91-
try {
92-
await Dataservice.updatePackage(packageName, version, undefined);
80+
async function updatePackage(packageName: string, version: string) {
81+
try {
82+
await Dataservice.updatePackage(packageName, version, undefined);
9383

94-
props.reRenderPackages();
84+
props.reRenderPackages();
9585

96-
resolve(
97-
notify('Updgraded the package', `Successfully upgraded package ${packageName}`, 'success')
98-
);
99-
} catch (ex) {
100-
const msg = `Error upgrading package ${packageName} to the latest version`;
86+
return notify('Updgraded the package', `Successfully upgraded package ${packageName}`, 'success');
87+
} catch (ex) {
88+
const msg = `Error upgrading package ${packageName} to the latest version`;
10189

102-
console.error(msg, ex);
90+
console.error(msg, ex);
10391

104-
reject(
105-
notify('Upgrading the package', msg, 'error')
106-
)
107-
}
108-
});
92+
return notify('Upgrading the package', msg, 'error');
93+
}
10994
}
11095

11196
return (

0 commit comments

Comments
 (0)