Skip to content

Commit a702c87

Browse files
Merge pull request #1030 from EyeSeeTea/development
Release 2.24.0
2 parents 850e291 + 5ebd437 commit a702c87

150 files changed

Lines changed: 55229 additions & 12617 deletions

File tree

Some content is hidden

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

.env

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
BROWSER=false
22
PORT=8081
3-
SKIP_PREFLIGHT_CHECK=true
4-
REACT_APP_DHIS2_BASE_URL=https://dev.eyeseetea.com/play
3+
VITE_DHIS2_BASE_URL=https://dev.eyeseetea.com/play
54

65
CYPRESS_DHIS2_AUTH='admin:district'
76
CYPRESS_EXTERNAL_API="https://dev.eyeseetea.com/play"

.eslintrc.js

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
/** @format */
1+
const reactAppConfig = require("eslint-config-react-app");
2+
3+
const reactAppRestrictedGlobals = reactAppConfig.rules["no-restricted-globals"] || [];
4+
// Override no-restricted-globals to exclude 'name'. Review this rule if causes new issues
5+
const restrictedGlobals = reactAppRestrictedGlobals.filter(global => global !== "name");
26

37
module.exports = {
4-
extends: [
5-
"react-app",
6-
"eslint:recommended",
7-
"plugin:react/recommended",
8-
"plugin:cypress/recommended",
9-
"plugin:@typescript-eslint/recommended",
10-
],
8+
extends: ["react-app", "plugin:cypress/recommended"],
119
parser: "@typescript-eslint/parser",
10+
ignorePatterns: ["src/**/snapshots/*.ts", ".eslintrc.js"],
1211
rules: {
1312
"no-console": ["warn", { allow: ["debug", "warn", "error"] }],
1413
"@typescript-eslint/camelcase": "off",
15-
"@typescript-eslint/explicit-function-return-type": ["off"],
14+
"@typescript-eslint/explicit-function-return-type": "off",
15+
"@typescript-eslint/no-unused-vars": [
16+
"warn",
17+
{
18+
argsIgnorePattern: "^_",
19+
varsIgnorePattern: "^_",
20+
},
21+
],
1622
"unused-imports/no-unused-imports": "warn",
17-
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
1823
"react/prop-types": "off",
1924
"react/display-name": "off",
2025
"react/react-in-jsx-scope": "off",
@@ -35,20 +40,71 @@ module.exports = {
3540
"@typescript-eslint/indent": "off",
3641
"@typescript-eslint/member-delimiter-style": "off",
3742
"@typescript-eslint/type-annotation-spacing": "off",
38-
"@typescript-eslint/explicit-function-return-type": "off",
3943
"no-use-before-define": "off",
4044
"no-debugger": "warn",
4145
"no-extra-semi": "off",
4246
"no-mixed-spaces-and-tabs": "off",
47+
"no-useless-rename": "off",
4348
"react-hooks/rules-of-hooks": "error",
4449
"react-hooks/exhaustive-deps": "warn",
50+
"testing-library/await-async-query": "off",
51+
"testing-library/no-await-sync-query": "off",
52+
"testing-library/prefer-screen-queries": "off",
53+
"testing-library/no-debugging-utils": "off",
54+
"testing-library/no-dom-import": "off",
55+
"no-restricted-globals": restrictedGlobals,
4556
},
46-
plugins: ["cypress", "@typescript-eslint", "react-hooks", "unused-imports"],
57+
plugins: ["cypress", "unused-imports"],
4758
env: { "cypress/globals": true },
59+
parserOptions: {
60+
project: "./tsconfig.json",
61+
},
4862
settings: {
4963
react: {
5064
pragma: "React",
51-
version: "16.6.0",
65+
version: "17.0.2",
5266
},
5367
},
68+
overrides: [
69+
{
70+
files: ["cypress/**/*"],
71+
plugins: ["cypress"],
72+
env: { "cypress/globals": true },
73+
parser: "espree",
74+
parserOptions: {
75+
ecmaVersion: 2018,
76+
sourceType: "module",
77+
},
78+
rules: {
79+
"@typescript-eslint/no-misused-promises": "off",
80+
"@typescript-eslint/no-unused-vars": "off",
81+
"@typescript-eslint/no-unused-expressions": "off",
82+
"@typescript-eslint/no-use-before-define": "off",
83+
"@typescript-eslint/no-explicit-any": "off",
84+
"@typescript-eslint/no-empty-interface": "off",
85+
"@typescript-eslint/ban-ts-ignore": "off",
86+
"@typescript-eslint/no-empty-function": "off",
87+
"@typescript-eslint/explicit-module-boundary-types": "off",
88+
"@typescript-eslint/ban-types": "off",
89+
"@typescript-eslint/ban-ts-comment": "off",
90+
"@typescript-eslint/no-var-requires": "off",
91+
"@typescript-eslint/indent": "off",
92+
"@typescript-eslint/member-delimiter-style": "off",
93+
"@typescript-eslint/type-annotation-spacing": "off",
94+
"@typescript-eslint/camelcase": "off",
95+
"@typescript-eslint/explicit-function-return-type": "off",
96+
"@typescript-eslint/no-this-alias": "off",
97+
"@typescript-eslint/no-unnecessary-type-constraint": "off",
98+
},
99+
},
100+
{
101+
files: ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"],
102+
extends: ["plugin:testing-library/react"],
103+
rules: {
104+
"testing-library/prefer-screen-queries": "off",
105+
"testing-library/no-debugging-utils": "off",
106+
"testing-library/no-dom-import": "off",
107+
},
108+
},
109+
],
54110
};

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ cypress/fixtures/
4747

4848
# Configuration
4949
/**/app-config.json
50+
51+
# Variant-specific assets (copied to public/ during build/dev)
52+
/public/wmr

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.14.0
1+
v20.19.4

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ Notes:
5454

5555
- Requests to DHIS2 will be transparently proxied (see `src/setupProxy.js`) from `http://localhost:8081/dhis2/path` to `http://localhost:8080/path` to avoid CORS and cross-domain problems.
5656

57-
- The optional environment variable `REACT_APP_DHIS2_AUTH=USERNAME:PASSWORD` forces some credentials to be used by the proxy. This variable is usually not set, so the app has the same user logged in at `REACT_APP_DHIS2_BASE_URL`.
58-
59-
- The optional environment variable `REACT_APP_PROXY_LOG_LEVEL` can be helpful to debug the proxyfied requests (accepts: "warn" | "debug" | "info" | "error" | "silent")
57+
- The optional environment variable `VITE_DHIS2_AUTH=USERNAME:PASSWORD` forces some credentials to be used by the proxy. This variable is usually not set, so the app has the same user logged in at `VITE_DHIS2_BASE_URL`.
6058

6159
- Create a file `.env.local` (copy it from `.env`) to customize environment variables so you can simply run `yarn start`.
6260

63-
- [why-did-you-render](https://github.com/welldone-software/why-did-you-render) is installed, but it does not work when using standard react scripts (`yarn start`). Instead, use `yarn craco-start` to debug re-renders with WDYR. Note that hot reloading does not work out-of-the-box with [craco](https://github.com/gsoft-inc/craco).
61+
- [why-did-you-render](https://github.com/welldone-software/why-did-you-render) is installed and runs in development mode by default. Edit `src/presentation/utils/wdyr.ts` to customize or disable it.
6462

6563
### Customization of the development server:
6664

@@ -73,7 +71,7 @@ This will open the development server for the given front-end at port 8082 and w
7371
### Customize DHIS2 instance url
7472

7573
```
76-
REACT_APP_DHIS2_BASE_URL=http://localhost:8080
74+
VITE_DHIS2_BASE_URL=http://localhost:8080
7775
```
7876

7977
To use a different DHIS2 instance url set this environment variable before running a `start` command.
@@ -98,7 +96,7 @@ $ yarn cy:e2e:run # non-interactive
9896
$ yarn cy:e2e:open # interactive UI
9997
```
10098

101-
Application should be running at CYPRESS_ROOT_URL with as the environment variable REACT_APP_CYPRESS set to True.
99+
Application should be running at CYPRESS_ROOT_URL with as the environment variable VITE_CYPRESS set to True.
102100

103101
For this to work in Travis CI, you will have to create an environment variables (Settings -> Environment Variables) CYPRESS_DHIS2_AUTH with the password used in your testing DHIS2 instance and CYPRESS_ENCRYPTION_KEY used to encrypt passwords of receiver instances.
104102

@@ -115,7 +113,7 @@ $ yarn build
115113
To build a given front-end:
116114

117115
```
118-
$ yarn build [all|core-app|data-metadata-app|module-package-app|modules-list|package-exporter|msf-aggregate-data-app|sp-emergency-responses]
116+
$ yarn build [all|core-app|data-metadata-app|module-package-app|modules-list|package-exporter|msf-aggregate-data-app|sp-emergency-responses|wmr]
119117
```
120118

121119
To build the scheduler:
@@ -135,3 +133,11 @@ $ yarn update-po
135133
# ... add/edit translations in po files ...
136134
$ yarn localize
137135
```
136+
137+
## depcheck
138+
139+
Check for unused or missing dependencies:
140+
141+
```
142+
$ yarn run depcheck
143+
```

craco.config.js

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

cypress/support/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const dhis2Auth = _(dhis2AuthEnvValue)
2727
.value();
2828

2929
Cypress.Cookies.defaults({
30-
whitelist: "JSESSIONID",
30+
preserve: "JSESSIONID",
3131
});
3232

3333
const timeout = ms => {

0 commit comments

Comments
 (0)