Skip to content

Commit 5678e0d

Browse files
author
John Agan
authored
Initial rewrite to Typescript (#69)
1 parent 2cf97f7 commit 5678e0d

Some content is hidden

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

68 files changed

+4408
-3602
lines changed

.babelrc

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

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/*

.eslintrc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
2-
"extends": ["airbnb-base", "prettier"],
3-
"plugins": ["prettier"],
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"ignorePatterns": ["dist", "**/*.d.ts"],
5+
"plugins": ["prettier", "@typescript-eslint"],
6+
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
7+
"parserOptions": {
8+
"ecmaVersion": 6,
9+
"sourceType": "module"
10+
},
411
"rules": {
5-
"camelcase": "off",
6-
"arrow-body-style": "off",
7-
"no-underscore-dangle": 0,
8-
"class-methods-use-this": 0,
9-
"max-classes-per-file": "off",
12+
"@typescript-eslint/no-explicit-any": "warn",
1013
"prettier/prettier": ["error"]
11-
},
12-
"ignorePatterns": ["node_modules/", "dist/"]
14+
}
1315
}

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ on: [push]
44

55
jobs:
66
test:
7-
name: Tests
7+
name: Jest
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v3
1111
- uses: actions/setup-node@v3
1212
- run: yarn install
1313
- run: yarn test
1414
lint:
15-
name: Linter
15+
name: ESLint
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v3

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules/
22
dist/
3-
coverage
4-
.nyc_output
53
*.log
4+
.env

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ The constructor takes in a few optional parameters to initialize the API client
1919
* `token` - the access token to use
2020
* `headers` - additional headers to add to the request
2121
* `version` - the version of the API you wish to use
22-
* `mode` - the [sec-fetch-mode](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Mode) to use
2322

2423
``` javascript
2524
const Webflow = require("webflow-api");
@@ -31,7 +30,6 @@ const webflow = new Webflow({ token: "[ACCESS TOKEN]" });
3130
const webflow = new Webflow({
3231
token: "[ACCESS TOKEN]",
3332
version: "1.0.0",
34-
mode: "cors",
3533
headers: {
3634
"User-Agent": "My Webflow App / 1.0"
3735
}
@@ -85,6 +83,9 @@ const webflow = new Webflow();
8583

8684
// set token
8785
webflow.token = "[ACCESS TOKEN]";
86+
87+
// remove the token
88+
webflow.clearToken();
8889
```
8990
### Calling APIs Directly
9091
All Webflow API endpoints can be called directly using the `get`, `post`, `put`, and `delete` methods.
@@ -146,9 +147,7 @@ const result = await webflow.revokeToken({
146147
});
147148

148149
// ensure it went through
149-
if (result.didRevoke) {
150-
// should equal true
151-
}
150+
result.didRevoke === true
152151
```
153152

154153
## Examples

0 commit comments

Comments
 (0)