Skip to content

Commit ef8e97d

Browse files
committed
Remove unused variables, functions, dependencies and exports
- Fix undefined string for Navbar - Move knip configuration to main workspace - Completely remove APP_SHOW_ENV_BANNER - Use working-directory on all github workflow
1 parent c6c3a92 commit ef8e97d

File tree

63 files changed

+231
-839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+231
-839
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Lint JS
4949
run: yarn lint:js
5050

51-
- name: build UI library
51+
- name: Build
5252
run: yarn build
5353

5454
- uses: actions/upload-artifact@v4
@@ -60,6 +60,9 @@ jobs:
6060
name: Run tests
6161
environment: 'test'
6262
runs-on: ubuntu-latest
63+
defaults:
64+
run:
65+
working-directory: app
6366
needs: [ui]
6467
steps:
6568
- uses: actions/checkout@v4
@@ -75,15 +78,16 @@ jobs:
7578

7679
- name: Install dependencies
7780
run: yarn install --frozen-lockfile
78-
working-directory: app
7981

8082
- name: Run test
8183
run: yarn test
82-
working-directory: app
8384

8485
translation:
8586
name: Identify error with translation files
8687
runs-on: ubuntu-latest
88+
defaults:
89+
run:
90+
working-directory: app
8791
needs: [ui]
8892
steps:
8993
- uses: actions/checkout@v4
@@ -99,11 +103,9 @@ jobs:
99103

100104
- name: Install dependencies
101105
run: yarn install --frozen-lockfile
102-
working-directory: app
103106

104107
- name: Identify error with translation files
105108
run: yarn lint:translation
106-
working-directory: app
107109

108110
unimported:
109111
name: Identify unused files
@@ -116,22 +118,22 @@ jobs:
116118
node-version: 20
117119
cache: 'yarn'
118120

119-
- uses: actions/download-artifact@v4
120-
with:
121-
name: ui-build
122-
path: packages/ui/dist
121+
- name: Install dependencies
122+
run: yarn initialize:type
123+
working-directory: app
123124

124125
- name: Install dependencies
125126
run: yarn install --frozen-lockfile
126-
working-directory: app
127127

128128
- name: Identify unused files
129129
run: yarn lint:unused
130-
working-directory: app
131130

132131
lint:
133132
name: Lint JS
134133
runs-on: ubuntu-latest
134+
defaults:
135+
run:
136+
working-directory: app
135137
needs: [ui]
136138
steps:
137139
- uses: actions/checkout@v4
@@ -147,15 +149,16 @@ jobs:
147149

148150
- name: Install dependencies
149151
run: yarn install --frozen-lockfile
150-
working-directory: app
151152

152153
- name: Lint JS
153154
run: yarn lint:js
154-
working-directory: app
155155

156156
lint-css:
157157
name: Lint CSS
158158
runs-on: ubuntu-latest
159+
defaults:
160+
run:
161+
working-directory: app
159162
needs: [ui]
160163
steps:
161164
- uses: actions/checkout@v4
@@ -171,11 +174,9 @@ jobs:
171174

172175
- name: Install dependencies
173176
run: yarn install --frozen-lockfile
174-
working-directory: app
175177

176178
- name: Lint CSS
177179
run: yarn lint:css
178-
working-directory: app
179180

180181
# FIXME: Identify a way to generate schema before we run typecheck
181182
# typecheck:
@@ -196,8 +197,11 @@ jobs:
196197
build:
197198
name: Build GO Web App
198199
environment: 'test'
199-
needs: [lint, lint-css, test, ui]
200200
runs-on: ubuntu-latest
201+
defaults:
202+
run:
203+
working-directory: app
204+
needs: [lint, lint-css, test, ui]
201205
steps:
202206
- uses: actions/checkout@v4
203207
- uses: actions/setup-node@v4
@@ -212,11 +216,9 @@ jobs:
212216

213217
- name: Install dependencies
214218
run: yarn install --frozen-lockfile
215-
working-directory: app
216219

217220
- name: Build
218221
run: yarn build
219-
working-directory: app
220222

221223
validate_helm:
222224
name: Validate Helm

app/env.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export default defineConfig({
1717
},
1818
APP_API_ENDPOINT: Schema.string({ format: 'url', protocol: true, tld: false }),
1919
APP_ADMIN_URL: Schema.string.optional({ format: 'url', protocol: true }),
20-
APP_SHOW_ENV_BANNER: Schema.boolean.optional(),
2120
APP_MAPBOX_ACCESS_TOKEN: Schema.string(),
2221
APP_TINY_API_KEY: Schema.string(),
2322
APP_RISK_API_ENDPOINT: Schema.string({ format: 'url', protocol: true }),

app/knip.json

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

app/package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"prestart": "yarn initialize:type",
2020
"pretypecheck": "yarn initialize:type",
2121
"prelint:js": "yarn initialize:type",
22-
"prelint:unused": "yarn initialize:type",
2322
"prebuild": "yarn initialize:type",
2423
"start": "vite",
2524
"build": "vite build",
@@ -30,10 +29,8 @@
3029
"typecheck": "tsc",
3130
"lint:js": "eslint src",
3231
"lint:css": "stylelint \"./src/**/*.css\"",
33-
"lint:unused": "unimported",
34-
"lint:unused-new": "knip --tags=-knipignore",
3532
"lint:translation": "yarn translatte:lint",
36-
"lint": "yarn lint:js && yarn lint:css && yarn lint:unused && yarn lint:translation",
33+
"lint": "yarn lint:js && yarn lint:css && yarn lint:translation",
3734
"lint:fix": "yarn lint:js --fix && yarn lint:css --fix",
3835
"test": "vitest",
3936
"test:coverage": "vitest run --coverage",
@@ -65,10 +62,10 @@
6562
},
6663
"devDependencies": {
6764
"@eslint/eslintrc": "^3.1.0",
65+
"@eslint/js": "^9.14.0",
6866
"@eslint/json": "^0.5.0",
6967
"@julr/vite-plugin-validate-env": "^1.0.1",
7068
"@types/file-saver": "^2.0.5",
71-
"@types/html2canvas": "^1.0.0",
7269
"@types/mapbox-gl": "^1.13.0",
7370
"@types/node": "^20.11.6",
7471
"@types/papaparse": "^5.3.8",
@@ -94,9 +91,8 @@
9491
"eslint-plugin-react-hooks": "^5.0.0",
9592
"eslint-plugin-react-refresh": "^0.4.13",
9693
"eslint-plugin-simple-import-sort": "^12.1.1",
97-
"fast-glob": "^3.3.0",
94+
"fast-glob": "^3.3.2",
9895
"happy-dom": "^9.18.3",
99-
"knip": "^5.36.3",
10096
"openapi-typescript": "6.5.5",
10197
"patch-package": "^7.0.0",
10298
"postcss": "^8.3.0",
@@ -114,7 +110,6 @@
114110
"ts-md5": "^1.3.1",
115111
"tsx": "^4.7.2",
116112
"typescript": "^5.5.2",
117-
"unimported": "1.28.0",
118113
"vite": "^5.0.10",
119114
"vite-plugin-checker": "^0.6.2",
120115
"vite-plugin-compression2": "^0.11.0",

app/scripts/translatte/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
export interface MigrationAddActionItem {
1+
interface MigrationAddActionItem {
22
action: 'add',
33
key: string,
44
value: string,
55
namespace: string,
66
}
77

8-
export interface MigrationRemoveActionItem {
8+
interface MigrationRemoveActionItem {
99
action: 'remove',
1010
key: string,
1111
namespace: string,
1212
}
1313

14-
export interface MigrationUpdateActionItem {
14+
interface MigrationUpdateActionItem {
1515
action: 'update',
1616
key: string,
1717
namespace: string,

app/scripts/translatte/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { join, isAbsolute, basename } from 'path';
2-
import fg from 'fast-glob';
32
import { promisify } from 'util';
43
import { readFile, writeFile, unlink } from 'fs';
4+
import glob from 'fast-glob';
55
import {
66
isDefined,
77
intersection,
@@ -17,10 +17,9 @@ import {
1717
SourceFileContent,
1818
} from './types';
1919

20-
export const readFilePromisify = promisify(readFile);
20+
const readFilePromisify = promisify(readFile);
2121
export const writeFilePromisify = promisify(writeFile);
22-
export const unlinkPromisify = promisify(unlink);
23-
export const glob = fg.glob;
22+
const unlinkPromisify = promisify(unlink);
2423

2524
// Utilities
2625

app/src/App/routes/common.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type ExtendedProps = {
3131
) => boolean;
3232
};
3333

34-
export interface CustomWrapRoute {
34+
interface CustomWrapRoute {
3535
<T>(
3636
myRouteOptions: MyInputIndexRouteObject<T, ExtendedProps>
3737
): MyOutputIndexRouteObject<ExtendedProps>

app/src/components/Link/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Omit<{
113113
spacing?: ButtonFeatureProps['spacing'];
114114
}, OMISSION>
115115

116-
export type InternalLinkProps = {
116+
type InternalLinkProps = {
117117
external?: never;
118118
to: keyof WrappedRoutes | undefined | null;
119119
urlParams?: UrlParams;

app/src/components/Navbar/i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"userMenuTools":"Tools",
6060
"userMenuResources":"Resources",
6161
"userMenuGoBlog":"GO Blog",
62+
"userMenuOperationalLearning":"Operational Learning",
6263
"userMenuOperationalLearningDescription":"Operational learning in emergencies is the lesson learned from managing and dealing with crises, refining protocols for resource allocation, decision-making, communication strategies, and others.",
6364
"userMenuOperationalToolboxItem":"Operational Toolbox",
6465
"userMenuOperationalToolboxItemDescription":"This operational toolbox is a central repository with key operational document helpful for your mission like templates, checklists, guidance and examples.",

app/src/components/NonFieldError/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import i18n from './i18n.json';
1717
import styles from './styles.module.css';
1818

19-
export interface Props<T> {
19+
interface Props<T> {
2020
className?: string;
2121
error?: Error<T>;
2222
withFallbackError?: boolean;

0 commit comments

Comments
 (0)