forked from snyk/snyk-code-review-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 412425e
Showing
17 changed files
with
6,759 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,64 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"array-bracket-spacing": ["error", "always"], | ||
"block-scoped-var": "error", | ||
"brace-style": "error", | ||
"camelcase": "error", | ||
"comma-dangle": ["error", "always-multiline"], | ||
"computed-property-spacing": ["error", "never"], | ||
"curly": "error", | ||
"eol-last": "error", | ||
"eqeqeq": ["error", "smart"], | ||
"indent": [ | ||
"error", | ||
2, | ||
{ | ||
"SwitchCase": 1 | ||
} | ||
], | ||
"keyword-spacing": ["error", {"before": true, "after": true}], | ||
"max-depth": ["error", 5], | ||
"max-len": ["error", 120], | ||
"max-statements": ["error", 30], | ||
"new-cap": "off", | ||
"no-caller": "error", | ||
"no-debugger": "error", | ||
"no-else-return": "error", | ||
"no-extend-native": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-trailing-spaces": "error", | ||
"no-redeclare": "error", | ||
"no-undef": "error", | ||
"no-unused-vars": ["error", {"argsIgnorePattern": "next"}], | ||
"no-use-before-define": ["error", "nofunc"], | ||
"object-curly-spacing": ["error", "always"], | ||
"object-shorthand": ["error", "always"], | ||
"prefer-arrow-callback": "error", | ||
"prefer-const": "error", | ||
"quotes": ["error", "single", "avoid-escape"], | ||
"semi": ["error", "always"], | ||
"space-before-blocks": "error", | ||
"space-before-function-paren": [ | ||
"error", | ||
{ | ||
"anonymous": "ignore", | ||
"named": "never" | ||
} | ||
], | ||
"space-unary-ops": ["error", {"words": true, "nonwords": false}], | ||
"spaced-comment": "error" | ||
} | ||
} |
This file contains 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,2 @@ | ||
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners | ||
* @snyk/plg @snyk/cloudconfig |
This file contains 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 @@ | ||
node_modules |
This file contains 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 @@ | ||
12 |
This file contains 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,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright © 2021 <copyright holders> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains 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,46 @@ | ||
# npm dependency server | ||
|
||
A web server that provides a basic HTTP api for querying the dependency | ||
tree of an [npm](https://npmjs.org) package. | ||
|
||
## Prerequisites | ||
|
||
* [Node v12 LTS](https://nodejs.org/download/release/latest-v12.x/) | ||
|
||
## Getting Started | ||
|
||
To install dependencies and start the server in development mode: | ||
|
||
```sh | ||
npm install | ||
npm start | ||
``` | ||
|
||
The server will now be running on an available port (defaulting to 3000) and | ||
will restart on changes to the src files. | ||
|
||
Then we can try the `/package` endpoint. Here is an example that uses `curl` and | ||
`jq`, but feel free to use any client. | ||
|
||
```sh | ||
curl -s http://localhost:3000/package/react/16.13.0 | jq . | ||
``` | ||
|
||
Most of the code is boilerplate; the logic for the `/package` endpoint can be | ||
found in [src/package.ts](src/package.ts), and some basic tests in | ||
[test/package.test.ts](test/package.test.ts) | ||
|
||
You can run the tests with: | ||
|
||
```sh | ||
npm run test | ||
|
||
# Or in watch mode | ||
npm run test -- --watch | ||
``` | ||
|
||
The code is linted via eslint, you can run this via: | ||
|
||
```sh | ||
npm run lint | ||
``` |
This file contains 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,9 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: '<rootDir>/test/tsconfig.json', | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.