Skip to content

Commit 81d7367

Browse files
authored
fix: enable ESLint (#4)
1 parent 720fbce commit 81d7367

6 files changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828

2929
- run: npm run build
3030

31+
- run: npm run lint
32+
3133
- run: npm run test
3234

3335
release:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ Interactively generate a new activity or form element.
6161

6262
Runs the project in development mode. Your activity pack will be available at [http://localhost:5000/main.js](http://localhost:5000/main.js). The HTTPS certificate of the development server is a self-signed certificate that web browsers will warn about. To work around this open [`https://localhost:5000/main.js`](https://localhost:5000/main.js) in a web browser and allow the invalid certificate as an exception. For creating a locally-trusted HTTPS certificate see the [Configuring a HTTPS Certificate](https://developers.geocortex.com/docs/workflow/sdk-web-overview/#configuring-a-https-certificate) section on the [Geocortex Developer Center](https://developers.geocortex.com/docs/workflow/overview/).
6363

64+
### `npm run test`
65+
Runs all unit tests.
66+
67+
### `npm run lint`
68+
Runs linter to perform static analysis.
69+
6470
### `npm run build`
6571

6672
Builds the activity pack for production to the `build` folder. It optimizes the build for the best performance.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"scripts": {
2222
"build": "vertigis-workflow-sdk build",
2323
"generate": "vertigis-workflow-sdk generate",
24+
"lint": "eslint -f codeframe --max-warnings 0 --ext .ts,.tsx src/",
2425
"start": "vertigis-workflow-sdk start",
2526
"test": "jest",
2627
"test:watch": "npm run test --watch"

src/__tests__/request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("request", () => {
7575
await expect(() => post(service, "path")).rejects.toThrow("url is required");
7676
});
7777
it("combines url and path", async () => {
78-
mockResponseOnce({}, (input, init) => {
78+
mockResponseOnce({}, (input) => {
7979
expect(input).toBe(`http://test/api/path`);
8080
});
8181

src/request.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ApiService } from "./ApiService";
22

3-
export async function get(
3+
export async function get<T = any>(
44
service: ApiService,
55
path: string,
66
params?: { [key: string]: any }
7-
) {
7+
): Promise<T> {
88
if (!service.url) {
99
throw new Error("url is required");
1010
}
@@ -20,11 +20,11 @@ export async function get(
2020
return response;
2121
}
2222

23-
export async function post(
23+
export async function post<T = any>(
2424
service: ApiService,
2525
path: string,
2626
data?: { [key: string]: any }
27-
) {
27+
): Promise<T> {
2828
if (!service.url) {
2929
throw new Error("url is required");
3030
}
@@ -42,7 +42,7 @@ export async function post(
4242
return response;
4343
}
4444

45-
function objectToQueryString(data?: {}): string {
45+
function objectToQueryString(data?: Record<string, string | number | boolean>): string {
4646
if (!data) {
4747
return "";
4848
}

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
"compilerOptions": {
44
"target": "es2018"
55
},
6-
"include": ["src"],
7-
"exclude": ["**/__tests__/**/*"]
6+
"include": ["src"]
87
}

0 commit comments

Comments
 (0)