This repository was archived by the owner on Oct 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Add eslint-config-node
#211
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| indent_style = space | ||
| indent_size = 2 | ||
| end_of_line = lf | ||
| charset = utf-8 | ||
| max_line_length = 120 | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| const { overrides } = require('@netlify/eslint-config-node') | ||
|
|
||
| module.exports = { | ||
| extends: '@netlify/eslint-config-node', | ||
| rules: { | ||
| // TODO: enable those rules | ||
| 'array-callback-return': 0, | ||
| complexity: 0, | ||
| 'consistent-this': 0, | ||
| 'func-names': 0, | ||
| 'func-style': 0, | ||
| 'id-length': 0, | ||
| 'line-comment-position': 0, | ||
| 'max-nested-callbacks': 0, | ||
| 'max-statements': 0, | ||
| 'no-await-in-loop': 0, | ||
| 'no-inline-comments': 0, | ||
| 'no-magic-numbers': 0, | ||
| 'no-param-reassign': 0, | ||
| 'no-promise-executor-return': 0, | ||
| 'no-shadow': 0, | ||
| 'fp/no-class': 0, | ||
| 'fp/no-delete': 0, | ||
| 'fp/no-let': 0, | ||
| 'fp/no-loops': 0, | ||
| 'fp/no-mutating-assign': 0, | ||
| 'fp/no-mutating-methods': 0, | ||
| 'fp/no-mutation': 0, | ||
| 'fp/no-this': 0, | ||
| 'node/exports-style': 0, | ||
| 'node/global-require': 0, | ||
| 'node/prefer-global/process': 0, | ||
| 'promise/no-callback-in-promise': 0, | ||
| 'promise/prefer-await-to-callbacks': 0, | ||
| 'promise/prefer-await-to-then': 0, | ||
| 'unicorn/filename-case': 0, | ||
| 'you-dont-need-lodash-underscore/flatten': 0, | ||
| }, | ||
| overrides: [...overrides], | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text=auto eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1 @@ | ||
| { | ||
| "semi": false, | ||
| "singleQuote": true, | ||
| "printWidth": 120 | ||
| } | ||
| "@netlify/eslint-config-node/.prettierrc.json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,31 +9,38 @@ A Netlify [OpenAPI](https://github.com/netlify/open-api) client that works in th | |
|
|
||
| ```js | ||
| const NetlifyAPI = require('netlify') | ||
| const client = new NetlifyAPI('1234myAccessToken') | ||
| const sites = await client.listSites() | ||
|
|
||
| const listNetlifySites = async function() { | ||
| const client = new NetlifyAPI('1234myAccessToken') | ||
| const sites = await client.listSites() | ||
| return sites | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Top-level |
||
| ``` | ||
|
|
||
| ## Using OpenAPI operations | ||
|
|
||
| ```js | ||
| const NetlifyAPI = require('netlify') | ||
|
|
||
| const client = new NetlifyAPI('1234myAccessToken') | ||
|
|
||
| // Fetch sites | ||
| const sites = await client.listSites() | ||
| const listCreateAndDeleteSite = async function() { | ||
| // Fetch sites | ||
| const sites = await client.listSites() | ||
|
|
||
| // Create a site. Notice `body` here for sending OpenAPI body | ||
| const site = await client.createSite({ | ||
| body: { | ||
| name: `my-awesome-site`, | ||
| // ... https://open-api.netlify.com/#/default/createSite | ||
| }, | ||
| }) | ||
| // Create a site. Notice `body` here for sending OpenAPI body | ||
| const site = await client.createSite({ | ||
| body: { | ||
| name: `my-awesome-site`, | ||
| // ... https://open-api.netlify.com/#/default/createSite | ||
| }, | ||
| }) | ||
|
|
||
| // Delete site. Notice `site_id` is a path parameter https://open-api.netlify.com/#/default/deleteSite | ||
| await client.deleteSite({ | ||
| site_id: siteId, | ||
| }) | ||
| // Delete site. Notice `site_id` is a path parameter https://open-api.netlify.com/#/default/deleteSite | ||
| await client.deleteSite({ | ||
| site_id: siteId, | ||
| }) | ||
| } | ||
| ``` | ||
|
|
||
| ## API | ||
|
|
@@ -47,7 +54,7 @@ Create a new instance of the Netlify API client with the provided `accessToken`. | |
| `opts` includes: | ||
|
|
||
| ```js | ||
| { | ||
| const opts = { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Otherwise, ESLint seems to fail at parsing this. |
||
| userAgent: 'netlify/js-client', | ||
| scheme: 'https', | ||
| host: 'api.netlify.com', | ||
|
|
@@ -83,7 +90,7 @@ Performs a call to the given endpoint corresponding with the `operationId`. Retu | |
|
|
||
| ```js | ||
| // example params | ||
| { | ||
| const params = { | ||
| any_param_needed, | ||
| paramsCanAlsoBeCamelCase, | ||
| body: { | ||
|
|
@@ -96,7 +103,7 @@ Optional `opts` can include any property you want passed to [`node-fetch`](https | |
|
|
||
| ```js | ||
| // example opts | ||
| { | ||
| const opts = { | ||
| headers: { // Default headers | ||
| 'User-agent': 'netlify-js-client', | ||
| accept: 'application/json' | ||
|
|
@@ -115,7 +122,7 @@ async function getSomeData() { | |
| siteId: '1234abcd', | ||
| deploy_id: '4567', | ||
| }) | ||
| } catch (e) { | ||
| } catch (error) { | ||
| // handle error | ||
| } | ||
| } | ||
|
|
@@ -134,7 +141,7 @@ Pass in a [`ticket`](https://open-api.netlify.com/#model-ticket) and get back an | |
| Optional `opts` include: | ||
|
|
||
| ```js | ||
| { | ||
| const opts = { | ||
| poll: 1000, // number of ms to wait between polling | ||
| timeout: 3.6e6 // number of ms to wait before timing out | ||
| } | ||
|
|
@@ -169,7 +176,7 @@ The following paths can be passed in the options: | |
| Optional `opts` include: | ||
|
|
||
| ```js | ||
| { | ||
| const opts = { | ||
| fnDir: null, // path to a folder of functions to deploy | ||
| branch: null, // branch to pass onto the netlify api | ||
| configPath: null, // path to a netlify.toml file to include in the deploy (e.g. redirect support for manual deploys) | ||
|
|
@@ -183,17 +190,17 @@ Optional `opts` include: | |
| tmpDir: tempy.directory(), // a temporary directory to zip functions into | ||
| statusCb: statusObj => { | ||
| // a callback function to receive status events | ||
| /* statusObj: { | ||
| type: name-of-step | ||
| msg: msg to print | ||
| phase: [start, progress, stop] | ||
| } */ | ||
| // statusObj: { | ||
| // type: name-of-step | ||
| // msg: msg to print | ||
| // phase: [start, progress, stop] | ||
| // } | ||
| // See https://github.com/netlify/cli/blob/v2.0.0-beta.3/src/commands/deploy.js#L161-L195 | ||
| // for an example of how this can be used. | ||
| }, | ||
| // passing a deployId will update an existing deploy based on the provided options | ||
| deployId: null | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Proxy support | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align with Netlify Build. We're also removing Node 8 support soon.