Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 7cba651

Browse files
committed
Fix linting
1 parent 63709aa commit 7cba651

File tree

3 files changed

+78
-71
lines changed

3 files changed

+78
-71
lines changed

CODE_OF_CONDUCT.md

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
## Our Pledge
44

5-
In the interest of fostering an open and welcoming environment, we as
6-
contributors and maintainers pledge to making participation in our project and
7-
our community a harassment-free experience for everyone, regardless of age, body
8-
size, disability, ethnicity, gender identity and expression, level of experience,
9-
nationality, personal appearance, race, religion, or sexual identity and
10-
orientation.
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making
6+
participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7+
disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race,
8+
religion, or sexual identity and orientation.
119

1210
## Our Standards
1311

14-
Examples of behavior that contributes to creating a positive environment
15-
include:
12+
Examples of behavior that contributes to creating a positive environment include:
1613

1714
- Using welcoming and inclusive language
1815
- Being respectful of differing viewpoints and experiences
@@ -22,53 +19,42 @@ include:
2219

2320
Examples of unacceptable behavior by participants include:
2421

25-
- The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
22+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
2723
- Trolling, insulting/derogatory comments, and personal or political attacks
2824
- Public or private harassment
29-
- Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
- Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
26+
- Other conduct which could reasonably be considered inappropriate in a professional setting
3327

3428
## Our Responsibilities
3529

36-
Project maintainers are responsible for clarifying the standards of acceptable
37-
behavior and are expected to take appropriate and fair corrective action in
38-
response to any instances of unacceptable behavior.
30+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31+
appropriate and fair corrective action in response to any instances of unacceptable behavior.
3932

40-
Project maintainers have the right and responsibility to remove, edit, or
41-
reject comments, commits, code, wiki edits, issues, and other contributions
42-
that are not aligned to this Code of Conduct, or to ban temporarily or
43-
permanently any contributor for other behaviors that they deem inappropriate,
44-
threatening, offensive, or harmful.
33+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34+
issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35+
contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
4536

4637
## Scope
4738

48-
This Code of Conduct applies both within project spaces and in public spaces
49-
when an individual is representing the project or its community. Examples of
50-
representing a project or community include using an official project e-mail
51-
address, posting via an official social media account, or acting as an appointed
52-
representative at an online or offline event. Representation of a project may be
53-
further defined and clarified by project maintainers.
39+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
40+
project or its community. Examples of representing a project or community include using an official project e-mail
41+
address, posting via an official social media account, or acting as an appointed representative at an online or offline
42+
event. Representation of a project may be further defined and clarified by project maintainers.
5443

5544
## Enforcement
5645

57-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at david@netlify.com. All
59-
complaints will be reviewed and investigated and will result in a response that
60-
is deemed necessary and appropriate to the circumstances. The project team is
61-
obligated to maintain confidentiality with regard to the reporter of an incident.
62-
Further details of specific enforcement policies may be posted separately.
46+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47+
david@netlify.com. All complaints will be reviewed and investigated and will result in a response that is deemed
48+
necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to
49+
the reporter of an incident. Further details of specific enforcement policies may be posted separately.
6350

64-
Project maintainers who do not follow or enforce the Code of Conduct in good
65-
faith may face temporary or permanent repercussions as determined by other
66-
members of the project's leadership.
51+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
52+
repercussions as determined by other members of the project's leadership.
6753

6854
## Attribution
6955

70-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at [http://contributor-covenant.org/version/1/4][version]
56+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
57+
[http://contributor-covenant.org/version/1/4][version]
7258

7359
[homepage]: http://contributor-covenant.org
7460
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CONTRIBUTING
22

3-
Contributions are always welcome, no matter how large or small. Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md).
3+
Contributions are always welcome, no matter how large or small. Before contributing, please read the
4+
[code of conduct](CODE_OF_CONDUCT.md).
45

56
## Setup
67

@@ -17,7 +18,8 @@ You can also use yarn.
1718

1819
## Testing
1920

20-
This repo uses [ava](https://github.com/avajs/ava) for testing. Any files in the `src` directory that have a `.test.js` file extension are automatically detected and run as tests.
21+
This repo uses [ava](https://github.com/avajs/ava) for testing. Any files in the `src` directory that have a `.test.js`
22+
file extension are automatically detected and run as tests.
2123

2224
We also test for a few other things:
2325

@@ -28,9 +30,11 @@ We also test for a few other things:
2830

2931
## Architecture
3032

31-
We target Node.js LTS and stable environments, and aim for basic modern browser support when possible. In order to facilitate simple contributions, we avoided any kind of build steps.
33+
We target Node.js LTS and stable environments, and aim for basic modern browser support when possible. In order to
34+
facilitate simple contributions, we avoided any kind of build steps.
3235

33-
If you need to add new API routes, please add them to the [open-api](https://github.com/netlify/open-api) repo. This client will automatically inherent the new routes from that module.
36+
If you need to add new API routes, please add them to the [open-api](https://github.com/netlify/open-api) repo. This
37+
client will automatically inherent the new routes from that module.
3438

3539
Projects that depend heavily on this client that should be taken into consideration when making changes:
3640

@@ -45,5 +49,5 @@ $ npm publish
4549

4650
## License
4751

48-
By contributing to Netlify Node Client, you agree that your contributions will be licensed
49-
under its [MIT license](LICENSE).
52+
By contributing to Netlify Node Client, you agree that your contributions will be licensed under its
53+
[MIT license](LICENSE).

README.md

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# netlify/js-client
22

3-
[![npm version][npm-img]][npm] [![build status][build-img]][build]
4-
[![coverage][coverage-img]][coverage] [![dependencies][david-img]][david] [![downloads][dl-img]][dl]
3+
[![npm version][npm-img]][npm] [![build status][build-img]][build] [![coverage][coverage-img]][coverage]
4+
[![dependencies][david-img]][david] [![downloads][dl-img]][dl]
55

66
A Netlify [OpenAPI](https://github.com/netlify/open-api) client that works in the browser and Node.js.
77

@@ -10,7 +10,7 @@ A Netlify [OpenAPI](https://github.com/netlify/open-api) client that works in th
1010
```js
1111
const NetlifyAPI = require('netlify')
1212

13-
const listNetlifySites = async function() {
13+
const listNetlifySites = async function () {
1414
const client = new NetlifyAPI('1234myAccessToken')
1515
const sites = await client.listSites()
1616
return sites
@@ -24,7 +24,7 @@ const NetlifyAPI = require('netlify')
2424

2525
const client = new NetlifyAPI('1234myAccessToken')
2626

27-
const listCreateAndDeleteSite = async function() {
27+
const listCreateAndDeleteSite = async function () {
2828
// Fetch sites
2929
const sites = await client.listSites()
3030

@@ -61,53 +61,62 @@ const opts = {
6161
pathPrefix: '/api/v1',
6262
accessToken: '1234myAccessToken',
6363
agent: undefined, // e.g. HttpsProxyAgent
64-
globalParams: {} // parameters you want available for every request.
64+
globalParams: {}, // parameters you want available for every request.
6565
// Global params are only sent of the OpenAPI spec specifies the provided params.
6666
}
6767
```
6868

6969
### `client.accessToken`
7070

71-
A setter/getter that returns the `accessToken` that the client is configured to use. You can set this after the class is instantiated, and all subsequent calls will use the newly set `accessToken`.
71+
A setter/getter that returns the `accessToken` that the client is configured to use. You can set this after the class is
72+
instantiated, and all subsequent calls will use the newly set `accessToken`.
7273

7374
### `client.basePath`
7475

7576
A getter that returns the formatted base URL of the endpoint the client is configured to use.
7677

7778
### OpenAPI Client methods
7879

79-
The client is dynamically generated from the [OpenAPI](https://github.com/netlify/open-api) definition file. Each method is is named after the `operationId` name of each operation. **To see a list of available operations, please see the [OpenAPI website](https://open-api.netlify.com/)**.
80+
The client is dynamically generated from the [OpenAPI](https://github.com/netlify/open-api) definition file. Each method
81+
is is named after the `operationId` name of each operation. **To see a list of available operations, please see the
82+
[OpenAPI website](https://open-api.netlify.com/)**.
8083

8184
Every OpenAPI operation has the following signature:
8285

8386
#### `response = await client.operationId([params], [opts])`
8487

85-
Performs a call to the given endpoint corresponding with the `operationId`. Returns a promise resolved with the body of the response, or rejected with an error with the details about the request attached. Rejects if the `status` > 400.
88+
Performs a call to the given endpoint corresponding with the `operationId`. Returns a promise resolved with the body of
89+
the response, or rejected with an error with the details about the request attached. Rejects if the `status` > 400.
8690

8791
- `params` is an object that includes any of the required or optional endpoint parameters.
88-
- `params.body` should be an object which gets serialized to JSON automatically. Any object can live here but refer to the OpenAPI specification for allowed fields in a particular request body. It can also be a function returning an object.
89-
- If the endpoint accepts `binary`, `params.body` can be a Node.js readable stream or a function returning one (e.g. `() => fs.createReadStream('./foo')`). Using a function is recommended.
92+
- `params.body` should be an object which gets serialized to JSON automatically. Any object can live here but refer to
93+
the OpenAPI specification for allowed fields in a particular request body. It can also be a function returning an
94+
object.
95+
- If the endpoint accepts `binary`, `params.body` can be a Node.js readable stream or a function returning one (e.g.
96+
`() => fs.createReadStream('./foo')`). Using a function is recommended.
9097

9198
```js
9299
// example params
93100
const params = {
94101
any_param_needed,
95102
paramsCanAlsoBeCamelCase,
96103
body: {
97-
an: 'arbitrary js object'
98-
}
104+
an: 'arbitrary js object',
105+
},
99106
}
100107
```
101108

102-
Optional `opts` can include any property you want passed to [`node-fetch`](https://github.com/bitinn/node-fetch). The `headers` property is merged with some `defaultHeaders`.
109+
Optional `opts` can include any property you want passed to [`node-fetch`](https://github.com/bitinn/node-fetch). The
110+
`headers` property is merged with some `defaultHeaders`.
103111

104112
```js
105113
// example opts
106114
const opts = {
107-
headers: { // Default headers
115+
headers: {
116+
// Default headers
108117
'User-agent': 'netlify-js-client',
109-
accept: 'application/json'
110-
}
118+
accept: 'application/json',
119+
},
111120
// any other properties for node-fetch
112121
}
113122
```
@@ -128,22 +137,25 @@ async function getSomeData() {
128137
}
129138
```
130139

131-
If the response includes `json` in the `contentType` header, fetch will deserialize the JSON body. Otherwise the `text` of the response is returned.
140+
If the response includes `json` in the `contentType` header, fetch will deserialize the JSON body. Otherwise the `text`
141+
of the response is returned.
132142

133143
### API Flow Methods
134144

135145
Some methods have been added in addition to the open API operations that make certain actions simpler to perform.
136146

137147
#### `accessToken = await client.getAccessToken(ticket, [opts])`
138148

139-
Pass in a [`ticket`](https://open-api.netlify.com/#model-ticket) and get back an `accessToken`. Call this with the response from a `client.createTicket({ client_id })` call. Automatically sets the `accessToken` to `this.accessToken` and returns `accessToken` for the consumer to save for later.
149+
Pass in a [`ticket`](https://open-api.netlify.com/#model-ticket) and get back an `accessToken`. Call this with the
150+
response from a `client.createTicket({ client_id })` call. Automatically sets the `accessToken` to `this.accessToken`
151+
and returns `accessToken` for the consumer to save for later.
140152

141153
Optional `opts` include:
142154

143155
```js
144156
const opts = {
145157
poll: 1000, // number of ms to wait between polling
146-
timeout: 3.6e6 // number of ms to wait before timing out
158+
timeout: 3.6e6, // number of ms to wait before timing out
147159
}
148160
```
149161

@@ -165,8 +177,9 @@ async function login() {
165177

166178
#### `deploy = await client.deploy(siteId, buildDir, [opts])`
167179

168-
**Node.js only**: Pass in a `siteId`, a `buildDir` (the folder you want to deploy) and an options object to deploy the contents of that folder.
169-
Sometimes this method needs to write to a `tmpDir`. By default `tmpDir` is a folder in the system temporary directory.
180+
**Node.js only**: Pass in a `siteId`, a `buildDir` (the folder you want to deploy) and an options object to deploy the
181+
contents of that folder. Sometimes this method needs to write to a `tmpDir`. By default `tmpDir` is a folder in the
182+
system temporary directory.
170183

171184
The following paths can be passed in the options:
172185

@@ -186,9 +199,11 @@ const opts = {
186199
parallelHash: 100, // number of parallel hashing calls
187200
parallelUpload: 5, // number of files to upload in parallel
188201
maxRetry: 5, // number of times to try on failed file uploads
189-
filter: filepath => { /* return false to filter a file from the deploy */ },
202+
filter: (filepath) => {
203+
/* return false to filter a file from the deploy */
204+
},
190205
tmpDir: tempy.directory(), // a temporary directory to zip functions into
191-
statusCb: statusObj => {
206+
statusCb: (statusObj) => {
192207
// a callback function to receive status events
193208
// statusObj: {
194209
// type: name-of-step
@@ -199,13 +214,14 @@ const opts = {
199214
// for an example of how this can be used.
200215
},
201216
// passing a deployId will update an existing deploy based on the provided options
202-
deployId: null
217+
deployId: null,
203218
}
204219
```
205220

206221
## Proxy support
207222

208-
**Node.js only**: If this client is used behind a corporate proxy, you can pass an `HttpsProxyAgent` or any other `http.Agent` that can handle your situation as `agent` option:
223+
**Node.js only**: If this client is used behind a corporate proxy, you can pass an `HttpsProxyAgent` or any other
224+
`http.Agent` that can handle your situation as `agent` option:
209225

210226
```js
211227
const HttpsProxyAgent = require('https-proxy-agent')
@@ -217,7 +233,8 @@ const client = new NetlifyAPI('1234myAccessToken', { agent })
217233

218234
## UMD Builds
219235

220-
A UMD build is provided for your convenience, however browser support is still experimental. Contributions to improve browser support are welcome.
236+
A UMD build is provided for your convenience, however browser support is still experimental. Contributions to improve
237+
browser support are welcome.
221238

222239
## Contributing
223240

0 commit comments

Comments
 (0)